Events
Events
The loyalty widget emits compact member facts on augeo.event. Hosts answer effects with augeo.ack.
augeo.state is a resolver result. Hosts do not listen for it.
Cart and wishlist writes are recommend-only. The host composes its own mutations.
Product-page activation uses the existing contextual Chat API through a host-owned integration. Read Product-page handoff for private selection data and correlated outcomes.
Prerequisites
| Item | Requirement |
|---|---|
| Host page | Serves HTTPS and can load a third-party script |
| Persona | loyalty-concierge only |
| Bundle global | window.AugeoChatSdkLoyaltyConcierge |
| Mount | Subscribe on document before you construct |
Load a pinned production loyalty bundle first. See Quick start.
Constants
| Name | Value | Use |
|---|---|---|
AUGEO_EVENT | augeo.event | Upward CustomEvent from widget to host |
AUGEO_ACK_EVENT | augeo.ack | Downward CustomEvent from host to widget |
| Spec | augeo.event | Value of spec on every compact envelope |
| Spec version | 1.0 | Value of specversion |
| Emission id | Unique string | Deduplicate deliveries on event.id |
Read constants from the loyalty IIFE global after the script loads.
Three contracts
| Direction | Name | spec | Role | Join |
|---|---|---|---|---|
| Up | augeo.event | augeo.event | Widget emits observed and measured facts | envelope id |
| Down | augeo.ack | augeo.ack | Host answers an effect | ack.eventId === event.id |
| Down | augeo.state | augeo.state | Resolver result for the card | effectId or slotId |
augeo.event and augeo.ack are bubbling composed CustomEvent objects. Read the payload from event.detail.
augeo.state is not a CustomEvent. After an ack or timeout the widget applies pending, confirmed, rejected, or unacknowledged.
Handling rules
| Rule | Detail |
|---|---|
| Deduplicate | Use event.id |
| Join acks | Set ack.eventId to event.id |
| Host outcomes | Send fulfilled or rejected only |
| Unacknowledged | The waiting layer mints this locally |
| First settlement | The first valid ack wins |
| Recommend-only | Host composes cart and wishlist mutations |
Do not send outcome.status of unacknowledged. The widget mints that after timeout.
Subscribe
Prefer subscribeAugeoEvents from the loyalty global. A raw document listener also works.
const { AUGEO_EVENT, subscribeAugeoEvents, isAugeoEventEnvelope } =
window.AugeoChatSdkLoyaltyConcierge;
const unsubscribe = subscribeAugeoEvents(document, (event) => {
handleFact(event);
});
document.addEventListener(AUGEO_EVENT, (e) => {
const event = e.detail;
if (!isAugeoEventEnvelope(event)) return;
handleFact(event);
});- Load the pinned production loyalty bundle.
- Subscribe on
documentso composed events reach you. - Drop details that fail
isAugeoEventEnvelope. - Deduplicate deliveries on
event.id. - Construct the assistant after the listener is attached.
Call the returned unsubscribe function when the host page tears down.
Related pages
| Topic | Page |
|---|---|
| Compact field list | Event envelope |
| Names this widget emits | Event catalog |
| Host ack contract | Acknowledgements |
| Event capability options | Event options |
| Destination writers | Analytics |
| JSON schema | Events v1 |
| Public helpers | API |
| Widget configuration | Configuration |
| Product scope | Overview |