@cimulate/copilot-widget 1.48.6 → 1.50.1
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 +22 -0
- package/dist/cimulate-copilot-widget.d.ts +11 -4
- package/dist/messaging.d.ts +70 -5
- package/dist/messaging.es.js +9706 -9542
- package/dist/messaging.umd.js +37 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.1 — 2026-10-14
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
## 1.50.0 — 2026-10-14
|
|
10
|
+
|
|
11
|
+
- 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`.
|
|
12
|
+
- A render crash inside a custom `tool_results` or Cart override is now reported to telemetry as `override_render_error`.
|
|
13
|
+
- Telemetry is not enabled in this release. No storefront action required.
|
|
14
|
+
|
|
15
|
+
## 1.49.0 — 2026-10-14
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
|
|
19
|
+
## 1.48.8 — 2026-10-13
|
|
20
|
+
|
|
21
|
+
- 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.
|
|
22
|
+
|
|
23
|
+
## 1.48.7 — 2026-10-13
|
|
24
|
+
|
|
25
|
+
- Messaging telemetry (when enabled in a release) now also reports connection, routing, send, and session-recovery failures, render errors, failed cart actions, and empty product searches. Error text, message content, and cart contents are never included. Telemetry is not enabled in this release. No storefront action or configuration required.
|
|
26
|
+
|
|
5
27
|
## 1.48.6 — 2026-10-13
|
|
6
28
|
|
|
7
29
|
- Markdown phone links such as `[555-0100](tel:5550100)` keep their `tel:` href, so the number is clickable. `mailto:` and `https` links are unchanged, and unsafe protocols such as `javascript:` are still removed.
|
|
@@ -110,10 +110,11 @@ declare interface CommonParams {
|
|
|
110
110
|
* One flat map from override key to custom-element tag name.
|
|
111
111
|
*
|
|
112
112
|
* `ProductTile`, `ProductCarousel`, `ProductDetailCard`, `ProductComparison`,
|
|
113
|
-
* `ProgressSteps`, `Suggestions`, and `Cart` are the named
|
|
114
|
-
* consults for its built-in UI: register one and the widget
|
|
115
|
-
* in place of the default tile/carousel/detail
|
|
116
|
-
* panel/follow-up buttons/
|
|
113
|
+
* `ProgressSteps`, `Suggestions`, `OrderConfirmation`, and `Cart` are the named
|
|
114
|
+
* keys the widget consults for its built-in UI: register one and the widget
|
|
115
|
+
* mounts your element in place of the default tile/carousel/detail
|
|
116
|
+
* card/comparison table/progress panel/follow-up buttons/order confirmation
|
|
117
|
+
* card/cart card (leave it unset and the built-in renders).
|
|
117
118
|
* Every other key is matched against a `type:"tool_results"` block's top-level
|
|
118
119
|
* `output_name` (never a field inside the arbitrary `data` payload); an
|
|
119
120
|
* unmatched block renders nothing. All of them receive the same `OverrideProps`.
|
|
@@ -131,6 +132,12 @@ declare interface ComponentOverrides {
|
|
|
131
132
|
ProductComparison?: OverrideTagName;
|
|
132
133
|
ProgressSteps?: OverrideTagName;
|
|
133
134
|
Suggestions?: OverrideTagName;
|
|
135
|
+
/**
|
|
136
|
+
* Replaces the in-chat order confirmation card. Receives generic
|
|
137
|
+
* {@link OverrideProps} with `payload.order` as the {@link OrderDetails}
|
|
138
|
+
* the agent emitted. Leave unset and the built-in card renders.
|
|
139
|
+
*/
|
|
140
|
+
OrderConfirmation?: OverrideTagName;
|
|
134
141
|
/**
|
|
135
142
|
* Replaces the in-chat cart BODY (items, totals, coupons) — a presentational
|
|
136
143
|
* slot. Checkout and the Apple/Google Pay iframe are NOT part of it: the widget
|
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
|
/**
|
|
@@ -325,10 +329,11 @@ declare type ComparisonTableRow = {
|
|
|
325
329
|
* One flat map from override key to custom-element tag name.
|
|
326
330
|
*
|
|
327
331
|
* `ProductTile`, `ProductCarousel`, `ProductDetailCard`, `ProductComparison`,
|
|
328
|
-
* `ProgressSteps`, `Suggestions`, and `Cart` are the named
|
|
329
|
-
* consults for its built-in UI: register one and the widget
|
|
330
|
-
* in place of the default tile/carousel/detail
|
|
331
|
-
* panel/follow-up buttons/
|
|
332
|
+
* `ProgressSteps`, `Suggestions`, `OrderConfirmation`, and `Cart` are the named
|
|
333
|
+
* keys the widget consults for its built-in UI: register one and the widget
|
|
334
|
+
* mounts your element in place of the default tile/carousel/detail
|
|
335
|
+
* card/comparison table/progress panel/follow-up buttons/order confirmation
|
|
336
|
+
* card/cart card (leave it unset and the built-in renders).
|
|
332
337
|
* Every other key is matched against a `type:"tool_results"` block's top-level
|
|
333
338
|
* `output_name` (never a field inside the arbitrary `data` payload); an
|
|
334
339
|
* unmatched block renders nothing. All of them receive the same `OverrideProps`.
|
|
@@ -346,6 +351,12 @@ export declare interface ComponentOverrides {
|
|
|
346
351
|
ProductComparison?: OverrideTagName;
|
|
347
352
|
ProgressSteps?: OverrideTagName;
|
|
348
353
|
Suggestions?: OverrideTagName;
|
|
354
|
+
/**
|
|
355
|
+
* Replaces the in-chat order confirmation card. Receives generic
|
|
356
|
+
* {@link OverrideProps} with `payload.order` as the {@link OrderDetails}
|
|
357
|
+
* the agent emitted. Leave unset and the built-in card renders.
|
|
358
|
+
*/
|
|
359
|
+
OrderConfirmation?: OverrideTagName;
|
|
349
360
|
/**
|
|
350
361
|
* Replaces the in-chat cart BODY (items, totals, coupons) — a presentational
|
|
351
362
|
* slot. Checkout and the Apple/Google Pay iframe are NOT part of it: the widget
|
|
@@ -872,6 +883,8 @@ declare type OrderDetails = {
|
|
|
872
883
|
subtotal: number;
|
|
873
884
|
total: number;
|
|
874
885
|
taxes: number | null;
|
|
886
|
+
/** "gross" means item prices already include tax, so `taxes` is part of `total`, not added to it. */
|
|
887
|
+
taxationMode?: "gross" | "net" | null;
|
|
875
888
|
shippingCost: number | null;
|
|
876
889
|
shippingDiscount: number | null;
|
|
877
890
|
shippingPromotions: string[];
|
|
@@ -917,6 +930,8 @@ export declare interface OverrideApi extends Pick<MessagingContextType, "isConne
|
|
|
917
930
|
* backdrop behavior, or whether to render a close button.
|
|
918
931
|
*/
|
|
919
932
|
mode: Mode;
|
|
933
|
+
reportFailure: ReportOverrideFailure;
|
|
934
|
+
reportEvent: ReportOverrideEvent;
|
|
920
935
|
}
|
|
921
936
|
|
|
922
937
|
/**
|
|
@@ -960,6 +975,32 @@ export declare class OverrideElement extends HTMLElement {
|
|
|
960
975
|
protected render(): void;
|
|
961
976
|
}
|
|
962
977
|
|
|
978
|
+
/**
|
|
979
|
+
* Optional context for {@link ReportOverrideEvent}. `details` follows the same
|
|
980
|
+
* rules as {@link OverrideFailureOptions}: up to 8 entries with identifier keys
|
|
981
|
+
* and finite number or boolean values; anything else is dropped.
|
|
982
|
+
*/
|
|
983
|
+
export declare interface OverrideEventOptions {
|
|
984
|
+
details?: Record<string, number | boolean>;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Optional context for {@link ReportOverrideFailure}. Only an HTTP status and
|
|
989
|
+
* numeric/boolean details are accepted, so a report can never carry shopper
|
|
990
|
+
* data such as names, emails, addresses, search text, or cart contents.
|
|
991
|
+
*
|
|
992
|
+
* - `status` → an HTTP status (100–599) from a failed call your component
|
|
993
|
+
* made; anything else is reported as 0.
|
|
994
|
+
* - `details` → up to 8 entries; keys must match `/^[a-zA-Z][a-zA-Z0-9_]{0,31}$/`
|
|
995
|
+
* and values must be finite numbers or booleans. Other entries
|
|
996
|
+
* are dropped, as are the reserved keys `env`, `org`, `esdn`,
|
|
997
|
+
* `wsid`, `msid`, `source`, and `override`.
|
|
998
|
+
*/
|
|
999
|
+
export declare interface OverrideFailureOptions {
|
|
1000
|
+
status?: number;
|
|
1001
|
+
details?: Record<string, number | boolean>;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
963
1004
|
/**
|
|
964
1005
|
* The single props object every override receives. `payload` is the block's raw
|
|
965
1006
|
* data, verbatim from the agent — the widget does not normalize it, so its shape
|
|
@@ -976,6 +1017,8 @@ export declare class OverrideElement extends HTMLElement {
|
|
|
976
1017
|
* the current (active) step.
|
|
977
1018
|
* - "Suggestions" → { suggestions: string[] } — the follow-up suggestion
|
|
978
1019
|
* strings shown after an agent message, in order.
|
|
1020
|
+
* - "OrderConfirmation" → { order } — the {@link OrderDetails} the agent
|
|
1021
|
+
* emitted on the `order_confirmation` block.
|
|
979
1022
|
* - "Cart" → uses its own {@link CartOverrideProps}, not this
|
|
980
1023
|
* generic shape: a display-only {@link DisplayCart} plus
|
|
981
1024
|
* a structured `cart` mutation api and NO `sendMessage`.
|
|
@@ -984,7 +1027,7 @@ export declare class OverrideElement extends HTMLElement {
|
|
|
984
1027
|
* - any custom-block key → the `tool_results` block's raw `data`, your own shape
|
|
985
1028
|
*/
|
|
986
1029
|
export declare interface OverrideProps {
|
|
987
|
-
/** The resolved override key: "ProductTile"/"ProductCarousel"/"ProductDetailCard"/"ProductComparison"/"ProgressSteps"/"Suggestions"/"Cart" for the built-in slots, else the `tool_results` block's `output_name`. */
|
|
1030
|
+
/** The resolved override key: "ProductTile"/"ProductCarousel"/"ProductDetailCard"/"ProductComparison"/"ProgressSteps"/"Suggestions"/"OrderConfirmation"/"Cart" for the built-in slots, else the `tool_results` block's `output_name`. */
|
|
988
1031
|
name: string;
|
|
989
1032
|
payload: unknown;
|
|
990
1033
|
api: OverrideApi;
|
|
@@ -1206,6 +1249,28 @@ declare type RangeFilters = Array<{
|
|
|
1206
1249
|
|
|
1207
1250
|
export declare const removeCartUpdateListener: (listener: EventListener) => void;
|
|
1208
1251
|
|
|
1252
|
+
/**
|
|
1253
|
+
* Record something that happened inside your override that is not a failure,
|
|
1254
|
+
* e.g. `api.reportEvent("size_chart_opened", { details: { sizes: 6 } })`.
|
|
1255
|
+
*
|
|
1256
|
+
* `code` follows the same rules as {@link ReportOverrideFailure}. The widget
|
|
1257
|
+
* tags the event with the override slot it came from. At most 50 events are
|
|
1258
|
+
* sent per widget session, and the call never throws. It does nothing when
|
|
1259
|
+
* telemetry is disabled.
|
|
1260
|
+
*/
|
|
1261
|
+
export declare type ReportOverrideEvent = (code: string, options?: OverrideEventOptions) => void;
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Report a failure inside your override to Commerce Client's operational telemetry,
|
|
1265
|
+
* e.g. `api.reportFailure("inventory_lookup_failed", { status: 503 })`.
|
|
1266
|
+
*
|
|
1267
|
+
* `code` must be a lowercase snake_case identifier (`/^[a-z][a-z0-9_]{0,39}$/`);
|
|
1268
|
+
* anything else is recorded as `invalid_code`. The widget tags the report with
|
|
1269
|
+
* the override slot it came from. At most 20 reports are sent per widget
|
|
1270
|
+
* session, and the call never throws. It does nothing when telemetry is disabled.
|
|
1271
|
+
*/
|
|
1272
|
+
export declare type ReportOverrideFailure = (code: string, options?: OverrideFailureOptions) => void;
|
|
1273
|
+
|
|
1209
1274
|
declare type ResponseItem = MarkdownResponse | ProductCarouselResponse | ProductTileResponse | ProductComparisonResponse | SuggestionsResponse | CartResponse | OrderConfirmationResponse | ToolResultsResponse;
|
|
1210
1275
|
|
|
1211
1276
|
declare type SearchEntryParams = SearchPayload["searchParams"];
|