@cimulate/copilot-widget 1.48.8 → 1.50.2
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 +18 -0
- package/dist/messaging.d.ts +66 -6
- package/dist/messaging.es.js +9862 -9727
- package/dist/messaging.umd.js +37 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.50.2 — 2026-10-14
|
|
6
|
+
|
|
7
|
+
- `cimulate:cart-update` now reports `action: "add"` (with empty `changes`) for the first cart the widget sees when the agent marks the cart summary `cartOperation: "add"` (case-insensitive), instead of `unknown`.
|
|
8
|
+
|
|
9
|
+
## 1.50.1 — 2026-10-14
|
|
10
|
+
|
|
11
|
+
- Messaging telemetry (when enabled in a release) now reports each conversation ending once, with why it ended (reset, ended, closed by the server, expired session, or connection recovery) and how long it had been idle. It also reports when the widget session ends, and how many attempts a reconnect took. It no longer sends separate events for connection changes that the connection state already shows. Telemetry is not enabled in this release. No storefront action or configuration required.
|
|
12
|
+
|
|
13
|
+
## 1.50.0 — 2026-10-14
|
|
14
|
+
|
|
15
|
+
- Override components get two new `api` methods: `reportFailure(code, { status, details })` reports a failure inside the override (for example, a call to your own backend) and `reportEvent(code, { details })` records a non-failure event. Both take a snake_case code and numeric or boolean details only, so no free text or shopper data can be sent. The widget tags each report with the override slot. Available on every slot, including Cart. See `docs/OVERRIDES_TEMPLATE.js`.
|
|
16
|
+
- A render crash inside a custom `tool_results` or Cart override is now reported to telemetry as `override_render_error`.
|
|
17
|
+
- Telemetry is not enabled in this release. No storefront action required.
|
|
18
|
+
|
|
19
|
+
## 1.49.0 — 2026-10-14
|
|
20
|
+
|
|
21
|
+
- Cart and order confirmation cards now hide the "Tax" row when the cart/order details carry `taxationMode: "gross"` (prices already include tax, e.g. UK/EU VAT), matching the Lightning messaging summary component. Payloads without `taxationMode`, or with `"net"`, render exactly as before.
|
|
22
|
+
|
|
5
23
|
## 1.48.8 — 2026-10-13
|
|
6
24
|
|
|
7
25
|
- Messaging mode: the in-chat order confirmation card is now overridable via the `OrderConfirmation` key in `ComponentOverrides`. Register a custom element (`window.CimulateOverrides.OrderConfirmation = "your-tag"`) and the widget mounts it in place of the built-in card, handing `{ name, payload: { order }, api }`. Leave the key unset and the default card keeps working. Customers implement their own replacement; this release only adds the slot.
|
package/dist/messaging.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ declare type CartDetails = {
|
|
|
123
123
|
subtotal: number;
|
|
124
124
|
total: number;
|
|
125
125
|
taxes: number | null;
|
|
126
|
+
/** "gross" means item prices already include tax, so `taxes` is part of `total`, not added to it. */
|
|
127
|
+
taxationMode?: "gross" | "net" | null;
|
|
126
128
|
shippingCost: number | null;
|
|
127
129
|
shippingDiscount: number | null;
|
|
128
130
|
shippingPromotions: string[];
|
|
@@ -201,6 +203,8 @@ export declare interface CartOverrideApi extends Pick<MessagingContextType, "isC
|
|
|
201
203
|
isLoading: MessagingContextType["loading"];
|
|
202
204
|
componentType: ComponentType;
|
|
203
205
|
mode: Mode;
|
|
206
|
+
reportFailure: ReportOverrideFailure;
|
|
207
|
+
reportEvent: ReportOverrideEvent;
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
/**
|
|
@@ -232,21 +236,25 @@ declare type CartResponseData = {
|
|
|
232
236
|
__action_execution_status__?: "success" | "failure";
|
|
233
237
|
cartSummary: {
|
|
234
238
|
cartDetails: CartDetails;
|
|
239
|
+
cartOperation?: string | null;
|
|
235
240
|
};
|
|
236
241
|
};
|
|
237
242
|
};
|
|
238
243
|
|
|
239
244
|
/**
|
|
240
|
-
* Primary action for a settled cart mutation, derived
|
|
241
|
-
*
|
|
242
|
-
*
|
|
245
|
+
* Primary action for a settled cart mutation, derived from the previous-vs-new
|
|
246
|
+
* cart diff, or from the agent's `cartSummary.cartOperation` (matched
|
|
247
|
+
* case-insensitively) when there is no previous snapshot to diff against:
|
|
243
248
|
* - `add` / `remove` / `quantity` — a single line-level change of that kind
|
|
249
|
+
* - `add` with empty `changes` — the first cart the widget has seen (nothing to
|
|
250
|
+
* diff against), but the agent reported `cartOperation: "add"`
|
|
244
251
|
* - `coupon` — only the applied-coupon set changed
|
|
245
252
|
* - `mixed` — several distinct kinds of change in one turn
|
|
246
253
|
* - `unknown` — a settled turn with nothing reliably diffable: no previous
|
|
247
|
-
* snapshot, identical carts, or a cart-mutation
|
|
248
|
-
* block (an emptied cart and a failed edit are
|
|
249
|
-
* re-fetches rather than trust a fabricated
|
|
254
|
+
* snapshot (and no agent-reported add), identical carts, or a cart-mutation
|
|
255
|
+
* reply that carried no cart block (an emptied cart and a failed edit are
|
|
256
|
+
* indistinguishable, so the host re-fetches rather than trust a fabricated
|
|
257
|
+
* delta)
|
|
250
258
|
*
|
|
251
259
|
* TODO(cart-events): reintroduce a `clear` action (and a distinct `error`
|
|
252
260
|
* signal) once the agent returns a disambiguated response for an emptied cart
|
|
@@ -879,6 +887,8 @@ declare type OrderDetails = {
|
|
|
879
887
|
subtotal: number;
|
|
880
888
|
total: number;
|
|
881
889
|
taxes: number | null;
|
|
890
|
+
/** "gross" means item prices already include tax, so `taxes` is part of `total`, not added to it. */
|
|
891
|
+
taxationMode?: "gross" | "net" | null;
|
|
882
892
|
shippingCost: number | null;
|
|
883
893
|
shippingDiscount: number | null;
|
|
884
894
|
shippingPromotions: string[];
|
|
@@ -924,6 +934,8 @@ export declare interface OverrideApi extends Pick<MessagingContextType, "isConne
|
|
|
924
934
|
* backdrop behavior, or whether to render a close button.
|
|
925
935
|
*/
|
|
926
936
|
mode: Mode;
|
|
937
|
+
reportFailure: ReportOverrideFailure;
|
|
938
|
+
reportEvent: ReportOverrideEvent;
|
|
927
939
|
}
|
|
928
940
|
|
|
929
941
|
/**
|
|
@@ -967,6 +979,32 @@ export declare class OverrideElement extends HTMLElement {
|
|
|
967
979
|
protected render(): void;
|
|
968
980
|
}
|
|
969
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Optional context for {@link ReportOverrideEvent}. `details` follows the same
|
|
984
|
+
* rules as {@link OverrideFailureOptions}: up to 8 entries with identifier keys
|
|
985
|
+
* and finite number or boolean values; anything else is dropped.
|
|
986
|
+
*/
|
|
987
|
+
export declare interface OverrideEventOptions {
|
|
988
|
+
details?: Record<string, number | boolean>;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Optional context for {@link ReportOverrideFailure}. Only an HTTP status and
|
|
993
|
+
* numeric/boolean details are accepted, so a report can never carry shopper
|
|
994
|
+
* data such as names, emails, addresses, search text, or cart contents.
|
|
995
|
+
*
|
|
996
|
+
* - `status` → an HTTP status (100–599) from a failed call your component
|
|
997
|
+
* made; anything else is reported as 0.
|
|
998
|
+
* - `details` → up to 8 entries; keys must match `/^[a-zA-Z][a-zA-Z0-9_]{0,31}$/`
|
|
999
|
+
* and values must be finite numbers or booleans. Other entries
|
|
1000
|
+
* are dropped, as are the reserved keys `env`, `org`, `esdn`,
|
|
1001
|
+
* `wsid`, `msid`, `source`, and `override`.
|
|
1002
|
+
*/
|
|
1003
|
+
export declare interface OverrideFailureOptions {
|
|
1004
|
+
status?: number;
|
|
1005
|
+
details?: Record<string, number | boolean>;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
970
1008
|
/**
|
|
971
1009
|
* The single props object every override receives. `payload` is the block's raw
|
|
972
1010
|
* data, verbatim from the agent — the widget does not normalize it, so its shape
|
|
@@ -1215,6 +1253,28 @@ declare type RangeFilters = Array<{
|
|
|
1215
1253
|
|
|
1216
1254
|
export declare const removeCartUpdateListener: (listener: EventListener) => void;
|
|
1217
1255
|
|
|
1256
|
+
/**
|
|
1257
|
+
* Record something that happened inside your override that is not a failure,
|
|
1258
|
+
* e.g. `api.reportEvent("size_chart_opened", { details: { sizes: 6 } })`.
|
|
1259
|
+
*
|
|
1260
|
+
* `code` follows the same rules as {@link ReportOverrideFailure}. The widget
|
|
1261
|
+
* tags the event with the override slot it came from. At most 50 events are
|
|
1262
|
+
* sent per widget session, and the call never throws. It does nothing when
|
|
1263
|
+
* telemetry is disabled.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare type ReportOverrideEvent = (code: string, options?: OverrideEventOptions) => void;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Report a failure inside your override to Commerce Client's operational telemetry,
|
|
1269
|
+
* e.g. `api.reportFailure("inventory_lookup_failed", { status: 503 })`.
|
|
1270
|
+
*
|
|
1271
|
+
* `code` must be a lowercase snake_case identifier (`/^[a-z][a-z0-9_]{0,39}$/`);
|
|
1272
|
+
* anything else is recorded as `invalid_code`. The widget tags the report with
|
|
1273
|
+
* the override slot it came from. At most 20 reports are sent per widget
|
|
1274
|
+
* session, and the call never throws. It does nothing when telemetry is disabled.
|
|
1275
|
+
*/
|
|
1276
|
+
export declare type ReportOverrideFailure = (code: string, options?: OverrideFailureOptions) => void;
|
|
1277
|
+
|
|
1218
1278
|
declare type ResponseItem = MarkdownResponse | ProductCarouselResponse | ProductTileResponse | ProductComparisonResponse | SuggestionsResponse | CartResponse | OrderConfirmationResponse | ToolResultsResponse;
|
|
1219
1279
|
|
|
1220
1280
|
declare type SearchEntryParams = SearchPayload["searchParams"];
|