All three belong to the install. When the merchant uninstalls your app, or the
app is suspended, none of them run on the storefront any more.
Scripts
POST /api/v1/scripts with your app token:
- The script is tied to your install. You can only list, change and delete
scripts your own install created; the merchant’s pixels and other apps’
scripts are invisible to you (
404). integrationis optional for apps.- Uninstalling switches your running scripts off. If the merchant reinstalls
your app and grants
WRITE_SCRIPTSagain, the scripts that were on come back on. So after an install, callGET /api/v1/scriptsbefore creating scripts, or a reinstall gives you duplicates. - The merchant sees your scripts under Integrations, “Added by apps”, with your app’s name, and can switch them off or remove them.
Declaring embeds and blocks
In the developer console, open your app and fill Storefront extensions, or sendextensions with PUT /api/v1/apps/developer/:id:
key: lowercase letters, numbers and dashes, up to 40 characters, unique in its list.scriptUrl(required) andstyleUrl:https://on a public host name.position(embeds):headorbody(default).- Block
settings[].type:text,textarea,number,toggle,colororselect(withoptions). A default that does not fit its type is replaced. - Up to 10 embeds, 20 blocks, 20 settings per block.
App embeds
Each embed is off until the merchant switches it on (Apps, Installed, “On your storefront”). Then every storefront page gets:window.SALESIVE_CONFIG for the store’s name, type and currency.
App blocks
Writing a block
The block’s script registers a mount function at its top level:elis the placeholder element; your block owns its contents.settingsis the placement’s settings over the defaults you declared.contextis what the theme passed about the page, for example{ productId }. Document what your block reads.- Without the SDK:
window.SalesiveAppBlocks.register("your-app/review-stars", mount), or push["review-stars", mount, "your-app"]ontowindow.__salesiveAppBlockQueuewhen the loader may not have run yet.
Placing a block in a theme
window.SALESIVE_APPS (the
store’s available blocks) and the /app-blocks.js loader only when the store
has at least one block.
Merchant placement from the theme editor (a
salesive.form.json field of type
appBlocks) is designed but not live yet. Today a theme places blocks in code.
