@cimulate/copilot-widget 1.48.8 → 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 CHANGED
@@ -2,6 +2,20 @@
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
+
5
19
  ## 1.48.8 — 2026-10-13
6
20
 
7
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.
@@ -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
  /**
@@ -879,6 +883,8 @@ declare type OrderDetails = {
879
883
  subtotal: number;
880
884
  total: number;
881
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;
882
888
  shippingCost: number | null;
883
889
  shippingDiscount: number | null;
884
890
  shippingPromotions: string[];
@@ -924,6 +930,8 @@ export declare interface OverrideApi extends Pick<MessagingContextType, "isConne
924
930
  * backdrop behavior, or whether to render a close button.
925
931
  */
926
932
  mode: Mode;
933
+ reportFailure: ReportOverrideFailure;
934
+ reportEvent: ReportOverrideEvent;
927
935
  }
928
936
 
929
937
  /**
@@ -967,6 +975,32 @@ export declare class OverrideElement extends HTMLElement {
967
975
  protected render(): void;
968
976
  }
969
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
+
970
1004
  /**
971
1005
  * The single props object every override receives. `payload` is the block's raw
972
1006
  * data, verbatim from the agent — the widget does not normalize it, so its shape
@@ -1215,6 +1249,28 @@ declare type RangeFilters = Array<{
1215
1249
 
1216
1250
  export declare const removeCartUpdateListener: (listener: EventListener) => void;
1217
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
+
1218
1274
  declare type ResponseItem = MarkdownResponse | ProductCarouselResponse | ProductTileResponse | ProductComparisonResponse | SuggestionsResponse | CartResponse | OrderConfirmationResponse | ToolResultsResponse;
1219
1275
 
1220
1276
  declare type SearchEntryParams = SearchPayload["searchParams"];