@cimulate/copilot-widget 1.54.2 → 1.55.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,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.1 — 2026-11-06
6
+
7
+ - With page context enabled, queued messages wait for the agent welcome before sending. If welcome does not arrive within 12 seconds, the send fails with a welcome timeout instead of waiting indefinitely. Integrations without page context keep the existing fallback.
8
+
9
+ ## 1.55.0 — 2026-11-06
10
+
11
+ - 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`.
12
+
5
13
  ## 1.54.2 — 2026-11-05
6
14
 
7
15
  - Carousel tiles no longer strike through a compare price that displays the same amount as the current price.
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[]>;
@@ -854,7 +857,7 @@ export declare interface MessagingModeConfig {
854
857
  connectingMessages?: readonly string[] | null;
855
858
  }
856
859
 
857
- export declare const MessagingProvider: ({ scrt2Url, orgId, esDeveloperName, routingAttributes, conversationId: configConversationId, continuationToken: configContinuationToken, lastEventId: configLastEventId, capabilitiesVersion, enablePageContext, enableLogging, onConnect, onMessage, onError, onProductResult, onEndConversation, onSessionUpdate, children, }: MessagingProviderProps) => JSX_2.Element;
860
+ export declare const MessagingProvider: ({ scrt2Url, orgId, esDeveloperName, routingAttributes, conversationId: configConversationId, continuationToken: configContinuationToken, lastEventId: configLastEventId, capabilitiesVersion, enablePageContext, enableLogging, onConnect, onMessage, onError, onProductResult, onEndConversation, onSessionUpdate, onWelcomeTimeout, children, }: MessagingProviderProps) => JSX_2.Element;
858
861
 
859
862
  declare interface MessagingProviderProps {
860
863
  scrt2Url: string;
@@ -874,6 +877,7 @@ declare interface MessagingProviderProps {
874
877
  onProductResult?: (detail: ProductResultDetail) => void;
875
878
  onEndConversation?: (conversationId: string | null) => Promise<void> | void;
876
879
  onSessionUpdate?: (update: MessagingSessionUpdate) => void;
880
+ onWelcomeTimeout?: () => void;
877
881
  children: ReactNode;
878
882
  }
879
883
 
@@ -1510,6 +1514,18 @@ declare type ToolResultsResponse = {
1510
1514
  data: unknown;
1511
1515
  };
1512
1516
 
1517
+ /**
1518
+ * Show the storefront's current basket on the latest cart message.
1519
+ * Pass the full basket. `items` is required; an empty array means an empty cart.
1520
+ * A payload without an `items` array is ignored.
1521
+ *
1522
+ * Call from the messaging entry after the widget is mounted, on page load and
1523
+ * after the shopper changes the basket outside the widget, and again after a
1524
+ * restored conversation. Older cart messages stay as they were. A call before
1525
+ * the widget is mounted is ignored. Does not emit `cimulate:cart-update`.
1526
+ */
1527
+ declare function updateCart(cart: CartDetails): void;
1528
+
1513
1529
  export declare function useMessaging(): MessagingContextType;
1514
1530
 
1515
1531
  declare interface WidgetComponentConfig {