@cimulate/copilot-widget 1.54.1 → 1.55.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 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.55.0 — 2026-11-06
6
+
7
+ - Messaging mode: `eventHandlers.cart.update` updates the latest cart message in the chat and does not emit `cimulate:cart-update`. The next agent cart result is compared with that basket. Cart messages restored while the conversation is resuming do not emit `cimulate:cart-update`.
8
+
9
+ ## 1.54.2 — 2026-11-05
10
+
11
+ - Carousel tiles no longer strike through a compare price that displays the same amount as the current price.
12
+
5
13
  ## 1.54.1 — 2026-11-04
6
14
 
7
15
  - Messaging mode keeps the connecting indicator on screen until a shopper or agent message is visible, so the transcript is not blank while a conversation opens. If nothing arrives, the transcript offers “What can we help with?” with suggestions to get a recommendation, find a gift, or start fresh.
package/README.md CHANGED
@@ -203,6 +203,37 @@ With `messagingConfig.enablePageContext`, the widget snapshots the page context
203
203
 
204
204
  The optional PDP `display` fields set the product chip and divider's name and image. SRP context shows a removable chip with a search icon and `Search: "query"`; its divider uses the same label. Only one context chip is shown at a time. Removing either chip clears page context, so the next message has no context or divider. The chip remains visible for later messages on the same product or search query. Setting SRP context replaces the PDP chip, and setting PDP context replaces the SRP chip.
205
205
 
206
+ ### Messaging Cart
207
+
208
+ Messaging integrations push the shopper's current basket with `eventHandlers.cart.update`. Call it from the messaging entry only: `window.CimulateMessaging.eventHandlers.cart.update(cart)` on the CDN, or the NPM import below. The Copilot entry does not expose it.
209
+
210
+ ```ts
211
+ import { eventHandlers } from "@cimulate/copilot-widget/messaging";
212
+
213
+ eventHandlers.cart.update({
214
+ id: "cart-1",
215
+ currencyCode: "USD",
216
+ subtotal: 90,
217
+ total: 90,
218
+ items: [
219
+ {
220
+ itemId: "line-1",
221
+ productId: "SKU-1",
222
+ name: "Men's Rovereto Running Shoes",
223
+ imageUrl: "https://store.example.com/products/shoes.jpg",
224
+ quantity: 1,
225
+ itemSubtotal: 90,
226
+ originalSubtotal: 90,
227
+ variants: [{ lbl: "Color", type: "color", value: "Black / White" }],
228
+ },
229
+ ],
230
+ });
231
+ ```
232
+
233
+ The object is the full basket (`CartDetails`), not a quantity stub. An empty `items` array means an empty cart. A payload without an `items` array is ignored. A call before the widget is mounted is ignored.
234
+
235
+ Call it after the widget is mounted, on page load, after the shopper changes the basket outside the widget, and again after a restored conversation. The latest cart message in the chat updates to that basket. Older cart messages stay as they were. The call does not emit `cimulate:cart-update`. The next agent cart result is compared with that basket.
236
+
206
237
  ## Linting and pre-commit hooks
207
238
 
208
239
  Lint and format locally with the npm scripts:
@@ -532,6 +532,9 @@ export declare const eventHandlers: {
532
532
  get: typeof getPageContext;
533
533
  clear: typeof clearPageContext;
534
534
  };
535
+ cart: {
536
+ update: typeof updateCart;
537
+ };
535
538
  };
536
539
 
537
540
  declare type FacetFilters = Record<string, string[]>;
@@ -1510,6 +1513,18 @@ declare type ToolResultsResponse = {
1510
1513
  data: unknown;
1511
1514
  };
1512
1515
 
1516
+ /**
1517
+ * Show the storefront's current basket on the latest cart message.
1518
+ * Pass the full basket. `items` is required; an empty array means an empty cart.
1519
+ * A payload without an `items` array is ignored.
1520
+ *
1521
+ * Call from the messaging entry after the widget is mounted, on page load and
1522
+ * after the shopper changes the basket outside the widget, and again after a
1523
+ * restored conversation. Older cart messages stay as they were. A call before
1524
+ * the widget is mounted is ignored. Does not emit `cimulate:cart-update`.
1525
+ */
1526
+ declare function updateCart(cart: CartDetails): void;
1527
+
1513
1528
  export declare function useMessaging(): MessagingContextType;
1514
1529
 
1515
1530
  declare interface WidgetComponentConfig {