@cimulate/copilot-widget 1.48.1 → 1.48.2

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,10 @@
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.48.2 — 2026-10-08
6
+
7
+ - Messaging mode accepts `messagingConfig.initialPageContext` to seed PDP or SRP page context once at mount (same shape as `eventHandlers.pageContext.set`). Seeding is gated on `enablePageContext`.
8
+
5
9
  ## 1.48.1 — 2026-10-08
6
10
 
7
11
  - Express payment cancel banner now honors a cartridge-supplied `payload.cancel` string when provided, falling back to the default copy otherwise. The error banner also wraps up to three lines before clipping to accommodate longer provider messages.
package/README.md CHANGED
@@ -177,6 +177,25 @@ eventHandlers.pageContext.clear();
177
177
 
178
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
179
 
180
+ To seed page context once at mount (same shape as `eventHandlers.pageContext.set`), pass `messagingConfig.initialPageContext` with `enablePageContext: true`. Later runtime updates still go through the event handler.
181
+
182
+ ```tsx
183
+ <AgentForceWidget
184
+ mode="messaging"
185
+ messagingConfig={{
186
+ enablePageContext: true,
187
+ initialPageContext: {
188
+ type: "srp",
189
+ query: "running shoes",
190
+ refinements: [{ name: "color", values: ["blue"] }],
191
+ minPrice: 50,
192
+ maxPrice: 150,
193
+ },
194
+ // existing SCRT2 fields...
195
+ }}
196
+ />
197
+ ```
198
+
180
199
  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.
181
200
 
182
201
  ## Linting and pre-commit hooks
@@ -461,6 +461,7 @@ declare interface MessagingModeConfig {
461
461
  * accept session context on the message endpoint.
462
462
  */
463
463
  enablePageContext?: boolean;
464
+ initialPageContext?: PageContext;
464
465
  /**
465
466
  * Requires the org's Agentforce agent to be
466
467
  * configured with an escalation path/topic, otherwise the button is a no-op.
@@ -507,10 +508,17 @@ declare interface MessagingSessionUpdate {
507
508
  */
508
509
  declare type OverrideTagName = string;
509
510
 
511
+ declare type PageContext = PdpPageContext | SrpPageContext;
512
+
510
513
  declare type PdpEntryParams = ProductView & {
511
514
  productName?: string;
512
515
  };
513
516
 
517
+ declare interface PdpPageContext {
518
+ type: "pdp";
519
+ id: string;
520
+ }
521
+
514
522
  declare interface ProductResultDetail {
515
523
  agentSessionId: string;
516
524
  kind: "search" | "detail";
@@ -631,6 +639,19 @@ declare interface SocketSdkContextType {
631
639
  getConversationMessages: (payload: ConversationEvents, callback: (events: CopilotEvent[]) => void) => void;
632
640
  }
633
641
 
642
+ declare interface SrpPageContext {
643
+ type: "srp";
644
+ query: string;
645
+ refinements?: SrpRefinement[];
646
+ minPrice?: number;
647
+ maxPrice?: number;
648
+ }
649
+
650
+ declare interface SrpRefinement {
651
+ name: string;
652
+ values: string[];
653
+ }
654
+
634
655
  declare const state: () => Readonly<{
635
656
  search: Readonly<SearchState>;
636
657
  browse: Readonly<BrowseState>;
@@ -67,7 +67,7 @@ export declare const AgentForceWidget: (props: CopilotWidgetProps) => JSX_2.Elem
67
67
  * UIStateContext >
68
68
  * MessagingProvider (Agentforce/SCRT2 SDK)
69
69
  */
70
- export declare const AgentforceWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, logoUrl, headerText, headerConfig, theme, openLinksInNewTab, onNavigate, globalClassName, isDevelopment, componentType, componentConfig, entryType, initialEntry, entryMessage, disclaimerText, disclaimerMarkdown, clientContext, searchPlaceholder, searchButtonLabel, searchConfig, suggestionButtonConfig, messageAlignment, autoScroll, promptsConfig, showProductDescription, resetConversationMessage, conversationHistory, messagingConfig, overrides, overridesUrl, inlineOverrides, __features, children, }: CopilotWidgetProps & {
70
+ export declare const AgentforceWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, logoUrl, headerText, headerConfig, theme, openLinksInNewTab, onNavigate, globalClassName, isDevelopment, componentType, componentConfig, initialEntry, entryMessage, disclaimerText, disclaimerMarkdown, clientContext, searchPlaceholder, searchButtonLabel, searchConfig, suggestionButtonConfig, messageAlignment, autoScroll, promptsConfig, showProductDescription, resetConversationMessage, conversationHistory, messagingConfig, overrides, overridesUrl, inlineOverrides, __features, children, }: CopilotWidgetProps & {
71
71
  overridesUrl?: string;
72
72
  inlineOverrides?: ComponentOverrides;
73
73
  children: ReactNode;
@@ -738,6 +738,7 @@ export declare interface MessagingModeConfig {
738
738
  * accept session context on the message endpoint.
739
739
  */
740
740
  enablePageContext?: boolean;
741
+ initialPageContext?: PageContext;
741
742
  /**
742
743
  * Requires the org's Agentforce agent to be
743
744
  * configured with an escalation path/topic, otherwise the button is a no-op.