@cimulate/copilot-widget 1.46.1 → 1.47.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.47.0 — 2026-10-05
6
+
7
+ - Messaging page context now accepts Search Results Page (SRP) state with a query, optional refinements, and optional price bounds. Each shopper turn sends the normalized SRP snapshot to SCRT2, while retries and session recovery reuse the original snapshot. PDP and SRP context remain mutually exclusive.
8
+
9
+ ## 1.46.2 — 2026-10-05
10
+
11
+ - Messaging mode exposes a session update callback via `messagingConfig.onSessionUpdate` which reports whenever the session or conversation changes, and optional `conversationId`, `continuationToken`, and `lastEventId` configs to seed the next inject so the same SCRT2 conversation resumes.
12
+
5
13
  ## 1.46.1 — 2026-10-02
6
14
 
7
15
  - Messaging telemetry is now gated per release by a build-time switch, so each release explicitly opts in. Telemetry is not enabled in this release. No storefront action or configuration required.
@@ -14,7 +22,7 @@
14
22
 
15
23
  - Product detail cards now show the auto-selected variant's price immediately, including the struck-through original price when that variant has a promotional price.
16
24
 
17
- ## 1.45.0 — 2026-09-29
25
+ ## 1.45.0 — 2026-09-30
18
26
 
19
27
  - Add Cimulate-owned frontend observability for messaging mode. When the widget bundle is built with a Falcon o11y write key (`VITE_O11Y_API_KEY`, injected at build time — never merchant-supplied), it emits messaging lifecycle events (page view, connect/reconnect, disconnect, participant joined, conversation started/cleared/closed) and live connection/session state gauges to Salesforce o11y. A build with no key is a no-op. Storefronts embedding the widget cannot enable, disable, or redirect telemetry. The o11y SDK is an optional dependency, lazy-loaded into a separate chunk so the core bundle is unaffected. No shopper PII leaves the browser (host URL is origin-only), and telemetry failures never surface to the host page.
20
28
 
package/README.md CHANGED
@@ -152,7 +152,7 @@ Settings are in `public/index.html`. Example configurations you can modify:
152
152
 
153
153
  ### Messaging Page Context
154
154
 
155
- Messaging integrations provide normalized storefront state through the generic page-context API. PDP is the first supported page type:
155
+ Messaging integrations provide normalized Product Detail Page (PDP) or Search Results Page (SRP) storefront state through the generic page-context API:
156
156
 
157
157
  ```ts
158
158
  import { eventHandlers } from "@cimulate/copilot-widget/messaging";
@@ -162,11 +162,21 @@ eventHandlers.pageContext.set({
162
162
  id: "product-123",
163
163
  });
164
164
 
165
+ eventHandlers.pageContext.set({
166
+ type: "srp",
167
+ query: "running shoes",
168
+ refinements: [{ name: "color", values: ["blue"] }],
169
+ minPrice: 50,
170
+ maxPrice: 150,
171
+ });
172
+
165
173
  const current = eventHandlers.pageContext.get();
166
174
 
167
175
  eventHandlers.pageContext.clear();
168
176
  ```
169
177
 
178
+ `refinements`, `minPrice`, and `maxPrice` are optional for SRP context. The widget omits empty refinements and undefined price bounds. PDP and SRP context are mutually exclusive.
179
+
170
180
  The widget snapshots the latest context immediately before a shopper turn is first sent. It reuses that snapshot for retries and session recovery, and sends the shopper's text unchanged.
171
181
 
172
182
  ## Linting and pre-commit hooks
@@ -404,6 +404,12 @@ declare interface MessagingModeConfig {
404
404
  scrt2Url: string;
405
405
  orgId: string;
406
406
  esDeveloperName: string;
407
+ /**
408
+ * Keys to seed the next conversation injection to resume an existing session.
409
+ */
410
+ conversationId?: string;
411
+ continuationToken?: string;
412
+ lastEventId?: string;
407
413
  routingAttributes?: Record<string, string>;
408
414
  /**
409
415
  * Invoked whenever a finalized Agentforce message carries a product result
@@ -418,6 +424,12 @@ declare interface MessagingModeConfig {
418
424
  * or times out.
419
425
  */
420
426
  onEndConversation?: (conversationId: string | null) => Promise<void> | void;
427
+ /**
428
+ * Invoked when the stored guest session changes (`created`, `resumed`,
429
+ * `refreshed`, `ended`, or `reset`). Persist or drop the snapshot so a
430
+ * destroyed WebView can resume the same conversation on the next inject.
431
+ */
432
+ onSessionUpdate?: (update: MessagingSessionUpdate) => void;
421
433
  /**
422
434
  * Capabilities version for the SCRT2 token request. Required (>= "63", i.e.
423
435
  * release 254) for action progress indicators (`CONVERSATION_PROGRESS_INDICATOR`)
@@ -457,6 +469,20 @@ declare interface MessagingModeConfig {
457
469
  progressStepsLimit?: number;
458
470
  }
459
471
 
472
+ declare type MessagingSessionReason = "created" | "resumed" | "refreshed" | "ended" | "reset";
473
+
474
+ declare interface MessagingSessionSnapshot {
475
+ conversationId: string;
476
+ continuationToken: string;
477
+ lastEventId: string;
478
+ storedAt: number;
479
+ }
480
+
481
+ declare interface MessagingSessionUpdate {
482
+ reason: MessagingSessionReason;
483
+ snapshot: MessagingSessionSnapshot | null;
484
+ }
485
+
460
486
  /**
461
487
  * A component override is the tag name of a pre-registered custom element
462
488
  * (e.g. "product-card"). The widget creates the element via