Replace a component of the InStore POS with a micro-frontend that you build and host, registered as an external module.
How POS UI module replacement works
The InStore POS is a host application that loads each of its components as a separate micro-frontend using Module Federation. Module Federation calls each loaded micro-frontend a remote. In InStore, you register a replacement as an external module.
An external module is a record that tells the POS to load your replacement module in place of a built-in component. You register the external module once for your tenant. Then assign it to a location or to a workstation. When a workstation starts, InStore resolves which external modules apply to it. It returns them with the rest of the workstation configuration. The POS loads your replacement module from the address in the record.
Registration and assignment are configuration. The replacement module itself is code that you build, host, and serve.
Components you can replace
type field of the external module record selects which one the replacement module provides:type | Component that the replacement module provides | Implementation guide |
|---|---|---|
type | Replacement guide | |
| ------------------- | --------------------------------------------------------------------------------------------------------------------- | |
Cart | Replace the Cart module | |
Catalog | Replace the Catalog module | |
Customer | Replace the Customer module | |
LookupCustomer | Provide the header Customer control | |
SearchTransaction | Replace the Search Transaction module | |
SuspendedCarts | Replace the Suspended Carts module |
An external module record describes where your replacement module lives and how to load it, and which component it replaces.
The following table lists the fields in the record you create for a replacement module:
| Field | Data type | Description |
|---|---|---|
default | Boolean | Whether the module is the tenant-wide fallback for its type. At most one module per type can be the default. |
key | String | Unique identifier for the module within your tenant. Accepts 2 to 256 letters, digits, underscores, and hyphens. |
module | String | Path that the replacement module exposes for the component, such as ./CartApp. |
scope | String | Module Federation container name that the replacement module exposes, such as acmeCart. |
type | String | Component that the replacement module provides. See Components you can replace for supported values. |
url | String | Address of the remoteEntry.js file for the replacement module. Accepts http and https addresses up to 2048 characters. |
The following request body registers a Cart replacement module:
{
"key": "external-cart-component",
"url": "https://modules.example.com/InStore_Example_Cart/remoteEntry.js",
"type": "Cart",
"scope": "acmeCart",
"module": "./CartApp",
"default": true
}
A replacement module runs inside the POS host and shares the host React instance. It renders within the same providers as a built-in module. Build the replacement module against the Module Federation interface of the component it replaces. Expose the container name and module path that you register.
Due to its hosted nature, the InStore POS loads a replacement module only through the Module Federation interface described on this page. A replacement module that does not expose the registered container name and module path fails to load. The component is then unavailable at every workstation the module is assigned to.
Assignments follow three rules:
- Each location and each workstation accepts at most one external module per type. To swap an assigned module, remove the existing assignment first.
- An external module that is still assigned to a location or a workstation can't be deleted. Remove every assignment first.
- At most one external module per type can be the tenant default.
The InStore State module
instoreState and consumed through Module Federation. That module owns the active Cart, localization, workstation configuration, the API client, and the theme. Every built-in component reads from it rather than holding its own copy.instoreState as a Module Federation remote and reads what it needs from there instead of calling the InStore backend on its own. This keeps a replaced component and the rest of the POS aligned on one Cart, one locale, and one session.Module resolution model
InStore consults three tiers to decide which external modules apply to a workstation. It uses the first tier that yields an assignment:
- Assignments on the workstation.
- Assignments on the parent location.
- External modules marked as the tenant default.
Tiers apply as a whole rather than merging by type. If a workstation assigns any external module, that assignment set answers in full. The workstation inherits nothing from its location. If no tier yields an external module, the POS loads the module bundled with it.
Changes take effect the next time the POS loads at that workstation.
Relationship to POS theming
Next steps
Use the following resources to finish and roll out your Cart module:
- Build a replacement module to configure Module Federation, resolve types, and read shared POS state.
- Replace InStore POS UI modules to register the module and assign it to a location or a workstation.
- Replace Catalog to read catalog state and render replacement catalog browsing and search.
- Replace Customer to read Customer state and render a replacement Customer lookup or header control.
- Replace Search Transaction to search Orders and render a replacement Search Transactions page.
- Replace Suspended Carts to list, suspend, and unsuspend Carts and render a replacement Suspended Carts page.
- Run InStore POS API requests to set the API host, Project, and tenant, and to get an access token.