Type Alias: EnterAddMode
EnterAddMode = () =>
Promise<void>
Function
Starts snap-first add mode (connection point before product).
The stock embed does not call this on its own. Default stock add is product-first:
the shopper picks a catalog item (chooseProductToAdd), which arms a product for the next
snap click. Call this action when the embed or custom UI should use snap-first add
instead (elementAction add, no product armed until a snap is chosen).
What this call does (depends on whether the scene already has modules):
- Empty scene: turns on the in-memory snap-first session (
isSnapFirstAddEnabled), keeps neutral product-first UI (elementActionnull, no connection markers). Dispatchesmimeeq-modular-snap-first-session-started. After the first successful ChooseProductToAdd, runtime enters full snap-first add (same as calling this action when modules are already present). - Scene with modules: cancels other modular actions, deselects, sets the action to add
with no product armed, shows connection markers, and dispatches
mimeeq-modular-enter-add-mode. - In both cases the session stays active until ExitAddMode. It survives remove all (neutral scene) but is not saved in scene JSON or restored after a full page reload.
Snap-first session (opt-in via this action):
- While the session is on, a successful ChooseProductToAdd can re-arm add mode
for the next connection point (including after remove-all → neutral → catalog place).
Flows that never call
enterAddMode()stay product-first and do not get this re-arm. - If the shopper opens replace/move (or similar) while in add, runtime may suspend add internally and restore it when they cancel that toolbar action.
After a connection point is selected (mimeeq-modular-select-snap-to-add,
observers.modular.selectedSnapForAdd), observers.modular.compatibleProductsForSnap
lists SKUs that fit that snap. Stock embed (mmq-tab-elements, mmq-element-list-modal)
already subscribes and updates the visible catalog; you do not need extra wiring unless
the default product UI is hidden. Custom UI that replaces that catalog must subscribe
(or listen for the event) and call chooseProductToAdd or addProductToSnappingPoint
when the shopper picks a product. A successful place does not leave add mode; call
ExitAddMode when snap-first add should end. After a full page reload, call this
action again if the session should still be on.
Returns
Promise<void>
Remarks
A future embed-template option may default snap-first add for some merchants. Until that exists, this action is the supported opt-in.
Example
// Custom UI catalog (stock embed handles this when mmq-* product panels are shown):
await window.mimeeqApp.actions.enterAddMode();
window.mimeeqApp.observers.modular.compatibleProductsForSnap.subscribe((products) => {
renderCatalog(products);
});