Skip to main content
A theme is the storefront’s React app. Your app reaches it in three ways, and they differ in who places your code: An app block is the surface most widgets want: the merchant chooses where it goes, and it can be switched off per block without uninstalling.

The Apps page in the theme editor

A theme earns an Apps page in the merchant’s theme editor by declaring an appBlocks field in its salesive.form.json:
The merchant picks from the blocks their installed apps provide and drags them into order. The saved value is an array, not a boolean:
The matching default in salesive.config.json is [], so a store with no apps saves nothing and every slot stays empty.
A field with no default is undefined on stores that predate it. Always treat the value as “maybe an array”: Array.isArray(value) ? value : [].

What the storefront injects

The platform writes two globals the theme reads, and only when the store has at least one block installed:
It also loads /app-blocks.js, which walks the page for placeholders and mounts each block into them. Your theme never calls into an app directly: it renders a placeholder carrying the right attributes and the loader does the rest. Because both globals are conditional, a slot must be safe to render before they exist. Return null rather than an empty wrapper, or you will ship an empty <div> with margins on every store that has no apps.

Demo: an app block

This is the whole contract, dependency-free. It is the component the default theme ships in src/components/AppBlockSlot.jsx:
Place it where the merchant’s choice should appear:
Passing context is how the block knows which product or order it is looking at. A block mounted without context gets an empty object and must not assume one.

The same thing with the SDK

If the theme already depends on salesive-dev-tools, its components do exactly this and save you the file:
Use hasAppBlock(key) when the theme needs to reserve layout space or hide a heading around a slot that might be empty. See storefront extensions for the rest of the exports.

Demo: an app embed

An embed needs no theme work at all: the merchant toggles it on, and the platform puts your script in the head of every page.
There is no store id in window.SALESIVE_CONFIG on a production storefront, so an embed cannot read one. Your embed calls your own server, and your server resolves which store the request is for from the install it recorded at OAuth time. Never trust a store id sent from the page.
An embed runs in the storefront page with the same reach as the theme’s own code. It can read the DOM and any global the theme exposes. Do not scrape shopper input, and do not rely on an embed for anything that must be isolated.

Demo: a script

A script is the app itself writing into the head through the API, with no merchant step. Use it for analytics or a tag that must load before the theme.
Needs WRITE_SCRIPTS. The merchant did not agree to this one individually, so keep it to what the install consent described.

Choosing a surface

Use an app block. It is the only surface where the merchant decides where the widget appears, and the only one they can move without editing code.
Use an app embed. One toggle, no theme edits, and it survives a theme switch.
Use a script. Reach for it last: it is invisible in the merchant’s settings compared with an embed.
Use the app proxy, which serves your page under /apps/<slug> on the store’s domain without your code entering the theme.

Verifying your slot

  1. Install your app on a development store.
  2. Set an appBlocks field in the theme’s form, and place your block in the editor’s Apps page.
  3. Open the storefront. The placeholder should carry data-salesive-app-block="<your-slug>/<your-key>".
  4. Uninstall the app and reload: the slot must disappear and leave no wrapper behind. A gap where the widget was is the most common bug here.