@cimulate/copilot-widget 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/messaging.d.ts +69 -0
- package/dist/messaging.es.js +6758 -6723
- package/dist/messaging.umd.js +32 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
`@cimulate/copilot-widget` follows [Semantic Versioning](https://semver.org/). Each entry is a released `package.json` version (deployed on merge to `master`), newest first.
|
|
4
4
|
|
|
5
|
+
## 1.46.0 — 2026-10-01
|
|
6
|
+
|
|
7
|
+
- Messaging mode: the widget now dispatches a `cimulate:cart-update` `CustomEvent` on `window` after a cart mutation (add to cart, quantity change, remove, or coupon) succeeds, so a storefront can re-fetch and re-render its own cart without a page reload. Because the agent edits the same server-side basket the storefront reads, the host listener can simply re-fetch/re-render its cart. The event `detail` (`CartUpdateDetail`) also describes **what changed**: a primary `action` (`"add" | "remove" | "quantity" | "coupon" | "mixed" | "unknown"`) and a `changes` array of per-line/coupon deltas, derived by diffing the previous cart snapshot against the newly settled one. These are advisory: `changes` carries per-line/coupon deltas, not totals, so the host must re-fetch its own cart for authoritative state. The distinction is self-contained: it comes purely from the diff (the agent's cart block reports only success/failure, never the action type), so an edit driven by the cart card's own controls (remove, quantity, coupon) and the same edit typed as free text in the composer produce the same payload. Removing the last item — whose reply is a plain "your cart is now empty" message with no cart block — is ambiguous (an emptied cart and a failed edit are indistinguishable), so it is reported as `unknown` and the host re-fetches to get the truth. A plain "show my cart" display doesn't trigger the event but refreshes the snapshot the next diff is taken against. `detail.status` is `"success"`. New exports on the messaging entry (and `CimulateMessaging` UMD global): `CART_UPDATE_EVENT`, `addCartUpdateListener`, `removeCartUpdateListener`; and the types `CartUpdateDetail`, `CartUpdateAction`, `CartChange`, `CartLineChange`, `CartCouponChange`. Additive and backward-compatible.
|
|
8
|
+
|
|
9
|
+
## 1.45.1 — 2026-09-30
|
|
10
|
+
|
|
11
|
+
- Product detail cards now show the auto-selected variant's price immediately, including the struck-through original price when that variant has a promotional price.
|
|
12
|
+
|
|
5
13
|
## 1.45.0 — 2026-09-29
|
|
6
14
|
|
|
7
15
|
- Add Cimulate-owned frontend observability for messaging mode. When the widget bundle is built with a Falcon o11y write key (`VITE_O11Y_API_KEY`, injected at build time — never merchant-supplied), it emits messaging lifecycle events (page view, connect/reconnect, disconnect, participant joined, conversation started/cleared/closed) and live connection/session state gauges to Salesforce o11y. A build with no key is a no-op. Storefronts embedding the widget cannot enable, disable, or redirect telemetry. The o11y SDK is an optional dependency, lazy-loaded into a separate chunk so the core bundle is unaffected. No shopper PII leaves the browser (host URL is origin-only), and telemetry failures never surface to the host page.
|
|
@@ -101,6 +109,7 @@
|
|
|
101
109
|
|
|
102
110
|
- Fixed SAP-backed SCAPI product detail cards showing every variant as unavailable — with a disabled "Add to cart" — even when the storefront had inventory. These catalogs emit variant-matrix (`vmat`) keys as technical SAP ids (e.g. `Z_COL_INT`, `Z_TAGLIE_I027`) that don't match the human-readable variation-attribute ids (e.g. `Color`, `Size`), so the availability join silently failed. The card now detects this key mismatch and remaps the variant-matrix keys onto the variation-attribute ids by matching their value sets. It is a no-op for SFCC-native catalogs (e.g. NTO, Hibbett) and fails closed — leaving keys untouched — when a mapping is ambiguous or incomplete.
|
|
103
111
|
- The color axis is now matched case-insensitively, so SAP catalogs that send the color attribute id as `Color`/`COLOR` (rather than the SFCC-native `color`) still render color swatches and color-specific gallery images instead of falling back to a plain chip.
|
|
112
|
+
|
|
104
113
|
## 1.34.0 — 2026-09-08
|
|
105
114
|
|
|
106
115
|
- Agentforce messaging mode now stores JWT tokens and conversation IDs in localStorage (was sessionStorage), enabling cross-tab session sharing. Multiple tabs or windows on the same storefront now share the same conversation — navigate from main page to PDP and back, the conversation continues seamlessly. Existing sessions migrate automatically on first page load.
|
package/dist/messaging.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ import { RefinedSearch } from '@cimulate/copilot-sdk';
|
|
|
34
34
|
import { SearchParams } from '@cimulate/copilot-sdk';
|
|
35
35
|
import { SessionContextEntry } from '@cimulate/agentforce-sdk';
|
|
36
36
|
|
|
37
|
+
export declare const addCartUpdateListener: (listener: EventListener) => void;
|
|
38
|
+
|
|
37
39
|
declare interface AddToCartParams {
|
|
38
40
|
productName?: string;
|
|
39
41
|
sku?: string;
|
|
@@ -100,6 +102,19 @@ declare interface BrowseState extends CommonParams {
|
|
|
100
102
|
categoryName?: string;
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
export declare const CART_UPDATE_EVENT = "cimulate:cart-update";
|
|
106
|
+
|
|
107
|
+
export declare type CartChange = CartLineChange | CartCouponChange;
|
|
108
|
+
|
|
109
|
+
/** A change to the set of applied coupon codes. */
|
|
110
|
+
export declare type CartCouponChange = {
|
|
111
|
+
type: "coupon";
|
|
112
|
+
/** Codes present now but not before. */
|
|
113
|
+
added: string[];
|
|
114
|
+
/** Codes present before but not now. */
|
|
115
|
+
removed: string[];
|
|
116
|
+
};
|
|
117
|
+
|
|
103
118
|
declare type CartDetails = {
|
|
104
119
|
id: string;
|
|
105
120
|
currencyCode: string;
|
|
@@ -147,6 +162,18 @@ declare type CartItemVariant = {
|
|
|
147
162
|
value: string;
|
|
148
163
|
};
|
|
149
164
|
|
|
165
|
+
/** A single line-item delta between the previous and new cart. */
|
|
166
|
+
export declare type CartLineChange = {
|
|
167
|
+
type: "add" | "remove" | "quantity";
|
|
168
|
+
itemId: string;
|
|
169
|
+
productId: string;
|
|
170
|
+
name: string;
|
|
171
|
+
/** `0` when the line did not exist before (an add). */
|
|
172
|
+
quantityBefore: number;
|
|
173
|
+
/** `0` when the line no longer exists (a remove). */
|
|
174
|
+
quantityAfter: number;
|
|
175
|
+
};
|
|
176
|
+
|
|
150
177
|
/**
|
|
151
178
|
* The basket-mutation surface handed to a `Cart` override. Each method states an
|
|
152
179
|
* intent, not a message: the widget builds the natural-language request (using
|
|
@@ -208,6 +235,38 @@ declare type CartResponseData = {
|
|
|
208
235
|
};
|
|
209
236
|
};
|
|
210
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Primary action for a settled cart mutation, derived purely by diffing the
|
|
240
|
+
* previous cart snapshot against the newly settled one (self-contained — the
|
|
241
|
+
* agent's cart block reports only success/failure, never the action itself):
|
|
242
|
+
* - `add` / `remove` / `quantity` — a single line-level change of that kind
|
|
243
|
+
* - `coupon` — only the applied-coupon set changed
|
|
244
|
+
* - `mixed` — several distinct kinds of change in one turn
|
|
245
|
+
* - `unknown` — a settled turn with nothing reliably diffable: no previous
|
|
246
|
+
* snapshot, identical carts, or a cart-mutation reply that carried no cart
|
|
247
|
+
* block (an emptied cart and a failed edit are indistinguishable, so the host
|
|
248
|
+
* re-fetches rather than trust a fabricated delta)
|
|
249
|
+
*
|
|
250
|
+
* TODO(cart-events): reintroduce a `clear` action (and a distinct `error`
|
|
251
|
+
* signal) once the agent returns a disambiguated response for an emptied cart
|
|
252
|
+
* vs a failed edit — today both reply with plain markdown and no cart block, so
|
|
253
|
+
* the widget cannot tell them apart and reports `unknown` for that turn.
|
|
254
|
+
*/
|
|
255
|
+
export declare type CartUpdateAction = "add" | "remove" | "quantity" | "coupon" | "mixed" | "unknown";
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* `detail` of the `cimulate:cart-update` `CustomEvent`. `action` is the primary
|
|
259
|
+
* action for the turn; `changes` is every line/coupon delta detected by diffing
|
|
260
|
+
* the previous cart against the new one (empty when there was no cart block to
|
|
261
|
+
* diff). `status` stays `"success"` — the event only fires for a successful
|
|
262
|
+
* mutation — so existing listeners that read `detail.status` keep working.
|
|
263
|
+
*/
|
|
264
|
+
export declare type CartUpdateDetail = {
|
|
265
|
+
status: "success";
|
|
266
|
+
action: CartUpdateAction;
|
|
267
|
+
changes: CartChange[];
|
|
268
|
+
};
|
|
269
|
+
|
|
211
270
|
declare type CimCopilotSdkConfig = {
|
|
212
271
|
apiKey?: string;
|
|
213
272
|
apiToken?: string;
|
|
@@ -1103,6 +1162,8 @@ declare type RangeFilters = Array<{
|
|
|
1103
1162
|
max: number;
|
|
1104
1163
|
}>;
|
|
1105
1164
|
|
|
1165
|
+
export declare const removeCartUpdateListener: (listener: EventListener) => void;
|
|
1166
|
+
|
|
1106
1167
|
declare type ResponseItem = MarkdownResponse | ProductCarouselResponse | ProductTileResponse | ProductComparisonResponse | SuggestionsResponse | CartResponse | OrderConfirmationResponse | ToolResultsResponse;
|
|
1107
1168
|
|
|
1108
1169
|
declare type SearchEntryParams = SearchPayload["searchParams"];
|
|
@@ -1155,6 +1216,14 @@ export declare interface SendMessageOptions {
|
|
|
1155
1216
|
silent?: boolean;
|
|
1156
1217
|
reconcileMessageId?: string;
|
|
1157
1218
|
displayContent?: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Marks a send that mutates the shared server basket (the cart card's remove /
|
|
1221
|
+
* quantity / coupon controls). The provider fires `cimulate:cart-update` when
|
|
1222
|
+
* such a turn settles even if the reply carries no cart block — removing the
|
|
1223
|
+
* last item returns a plain "your cart is now empty" message with nothing to
|
|
1224
|
+
* detect in the content.
|
|
1225
|
+
*/
|
|
1226
|
+
cartMutation?: boolean;
|
|
1158
1227
|
}
|
|
1159
1228
|
|
|
1160
1229
|
export declare type SendMessageResult = {
|