@cimulate/copilot-widget 1.29.1 → 1.30.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.
@@ -62,7 +62,7 @@ export declare const AgentForceWidget: (props: CopilotWidgetProps) => JSX_2.Elem
62
62
  * UIStateContext >
63
63
  * MessagingProvider (Agentforce/SCRT2 SDK)
64
64
  */
65
- export declare const AgentforceWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, logoUrl, headerText, headerConfig, theme, openLinksInNewTab, globalClassName, isDevelopment, componentType, componentConfig, entryType, entryMessage, disclaimerText, disclaimerMarkdown, clientContext, searchPlaceholder, searchButtonLabel, searchConfig, suggestionButtonConfig, messageAlignment, autoScroll, promptsConfig, showProductDescription, resetConversationMessage, conversationHistory, messagingConfig, overrides, overridesUrl, inlineOverrides, __features, children, }: CopilotWidgetProps & {
65
+ export declare const AgentforceWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, logoUrl, headerText, headerConfig, theme, openLinksInNewTab, 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 & {
66
66
  overridesUrl?: string;
67
67
  inlineOverrides?: ComponentOverrides;
68
68
  children: ReactNode;
@@ -82,6 +82,22 @@ declare type AllCopilotEvents = {
82
82
  bypassHandlers?: boolean;
83
83
  } & (AskCimAck | CopilotEvent | ConversationResetAck | Inquiry | DisplayProducts | FollowUp | PartialInquiry | RefinedSearch | RefinedBrowse | CopilotBrowseAck | Progress | ProductViewAck | CopilotError);
84
84
 
85
+ declare type AskCimEntryParams = Record<string, never>;
86
+
87
+ declare type BrowseEntryParams = BrowsePayload["browseParams"];
88
+
89
+ declare interface BrowsePayload extends CopilotBrowse {
90
+ browseParams: Omit<BrowseState, "page" | "pageSize" | "includeFacets"> & {
91
+ catalogSegment?: string;
92
+ pricebooks?: string[];
93
+ };
94
+ }
95
+
96
+ declare interface BrowseState extends CommonParams {
97
+ categoryId: string;
98
+ categoryName?: string;
99
+ }
100
+
85
101
  declare type CartDetails = {
86
102
  id: string;
87
103
  currencyCode: string;
@@ -95,8 +111,8 @@ declare type CartDetails = {
95
111
  promotionsDiscount: number | null;
96
112
  promotions: string[];
97
113
  couponsDiscount: number | null;
98
- couponsApplied: string[];
99
- coupons: string[];
114
+ couponsApplied: CouponEntry[];
115
+ coupons: CouponEntry[];
100
116
  headerMessage: string | null;
101
117
  /** May contain inline HTML (e.g. <strong>) — render as sanitized markup. */
102
118
  bodyMessage: string | null;
@@ -115,7 +131,7 @@ declare type CartItem = {
115
131
  originalSubtotal: number;
116
132
  variants: CartItemVariant[];
117
133
  promotions: string[];
118
- coupons: string[];
134
+ coupons: CouponEntry[];
119
135
  };
120
136
 
121
137
  declare type CartItemVariant = {
@@ -168,6 +184,16 @@ declare interface ClientContext {
168
184
  [key: string]: string | number;
169
185
  }
170
186
 
187
+ declare interface CommonParams {
188
+ page?: number | null;
189
+ pageSize?: number | null;
190
+ includeFacets?: boolean;
191
+ facetFilters?: FacetFilters;
192
+ rangeFilters?: RangeFilters;
193
+ catalogSegment?: string | null;
194
+ pricebooks?: string[] | null;
195
+ }
196
+
171
197
  declare type ComparisonTableRow = {
172
198
  row_name: string;
173
199
  values: string[];
@@ -224,7 +250,11 @@ declare interface CopilotWidgetProps extends CimCopilotSdkConfig {
224
250
  showProductDescription?: boolean;
225
251
  theme?: ThemeConfig;
226
252
  openLinksInNewTab?: boolean;
253
+ /**
254
+ * @deprecated This setting has been moved to the initialEntry object. Please use initialEntry.type instead.
255
+ */
227
256
  entryType?: EntryType;
257
+ initialEntry?: InitialEntry;
228
258
  entryMessage?: string;
229
259
  disclaimerText?: string;
230
260
  disclaimerMarkdown?: string;
@@ -285,9 +315,13 @@ declare interface CopilotWidgetProps extends CimCopilotSdkConfig {
285
315
  __features?: Record<string, boolean>;
286
316
  }
287
317
 
318
+ declare type CouponEntry = string | StructuredCoupon;
319
+
288
320
  declare type DialogPosition = "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "right" | "center";
289
321
 
290
- declare type EntryType = "search" | "browse" | "pdp" | "ask_cim";
322
+ declare const ENTRY_TYPES: readonly ["ask_cim", "search", "browse", "pdp"];
323
+
324
+ export declare type EntryType = (typeof ENTRY_TYPES)[number];
291
325
 
292
326
  export declare const eventHandlers: {
293
327
  components: {
@@ -307,6 +341,8 @@ export declare const eventHandlers: {
307
341
  };
308
342
  };
309
343
 
344
+ declare type FacetFilters = Record<string, string[]>;
345
+
310
346
  declare interface HeaderConfig {
311
347
  logoUrl?: string;
312
348
  headerText?: string;
@@ -318,6 +354,20 @@ declare interface HeaderConfig {
318
354
  headerTextTextAlign?: "left" | "center" | "right";
319
355
  }
320
356
 
357
+ export declare type InitialEntry = {
358
+ type: "search";
359
+ params: SearchEntryParams;
360
+ } | {
361
+ type: "browse";
362
+ params: BrowseEntryParams;
363
+ } | {
364
+ type: "pdp";
365
+ params: PdpEntryParams;
366
+ } | {
367
+ type: "ask_cim";
368
+ params?: AskCimEntryParams;
369
+ };
370
+
321
371
  export declare const injectMessagingWidget: ({ timeout, elementId, overridesUrl, overrides: inlineOverrides, ...props }: InjectMessagingWidgetOptions) => void;
322
372
 
323
373
  declare interface InjectMessagingWidgetOptions extends Omit<CopilotWidgetProps, "apiKey" | "apiToken" | "baseUrl" | "mode"> {
@@ -364,16 +414,13 @@ export declare interface MessagingContextType {
364
414
  isAgentTyping: boolean;
365
415
  conversationId: string | null;
366
416
  messages: MessagingMessage[];
367
- /** In-progress response blocks streamed before the final message arrives. */
368
417
  streamingBlocks: ResponseItem[];
369
418
  /**
370
419
  * Loading text for the action the agent is currently executing, from the
371
420
  * agent action's `progress_indicator_message`. Empty when none is active.
372
421
  */
373
422
  progressMessage: string;
374
- /** Accumulating list of progress step messages for the current turn. */
375
423
  progressSteps: string[];
376
- /** Whether the messaging is currently loading */
377
424
  loading: boolean;
378
425
  /**
379
426
  * True while a silent cart update is in flight. Silent sends leave `loading`
@@ -383,22 +430,12 @@ export declare interface MessagingContextType {
383
430
  cartUpdating: boolean;
384
431
  error: string | null;
385
432
  sendError: SendError | null;
386
- /**
387
- * True when an idle session expired in the background and its restart was
388
- * deferred until the user interacts. The composer stays enabled in this
389
- * state so the next message can trigger a fresh session.
390
- */
391
433
  sessionExpired: boolean;
392
434
  sendMessage: SendMessage;
393
435
  addToCart: (params: AddToCartParams) => void;
394
436
  resetConversation: () => void;
395
437
  retryLastMessage: () => ReturnType<SendMessage> | undefined;
396
438
  retryConnection: () => void;
397
- /**
398
- * Download the current conversation's transcript as a PDF. Resolves once the
399
- * browser download has been triggered; rejects if no conversation is active
400
- * or the request fails.
401
- */
402
439
  downloadTranscript: () => Promise<void>;
403
440
  }
404
441
 
@@ -433,7 +470,6 @@ export declare interface MessagingMessage {
433
470
  role: string;
434
471
  name?: string;
435
472
  };
436
- /** The raw event data for advanced consumers */
437
473
  raw?: AgentforceMessageEvent;
438
474
  }
439
475
 
@@ -570,7 +606,7 @@ declare type OrderDetails = {
570
606
  promotionsDiscount: number | null;
571
607
  promotions: string[];
572
608
  couponsDiscount: number | null;
573
- couponsApplied: string[];
609
+ couponsApplied: CouponEntry[];
574
610
  headerMessage: string | null;
575
611
  bodyMessage: string | null;
576
612
  footerMessage: string | null;
@@ -706,6 +742,10 @@ declare interface OverrideSendMessageOptions {
706
742
  */
707
743
  export declare type OverrideTagName = string;
708
744
 
745
+ declare type PdpEntryParams = ProductView & {
746
+ productName?: string;
747
+ };
748
+
709
749
  declare type PriceBreakdown = {
710
750
  original?: PriceBucket | null;
711
751
  sales?: PriceBucket | null;
@@ -856,8 +896,27 @@ declare type PromptsExtensionState = {
856
896
 
857
897
  declare type PromptsParams = AskCimSuggestions | CopilotSearchSuggestions | CopilotBrowseSuggestions | ProductViewSuggestions;
858
898
 
899
+ declare type RangeFilters = Array<{
900
+ field: string;
901
+ min: number;
902
+ max: number;
903
+ }>;
904
+
859
905
  declare type ResponseItem = MarkdownResponse | ProductCarouselResponse | ProductTileResponse | ProductComparisonResponse | SuggestionsResponse | CartResponse | OrderConfirmationResponse | ToolResultsResponse;
860
906
 
907
+ declare type SearchEntryParams = SearchPayload["searchParams"];
908
+
909
+ declare interface SearchPayload extends CopilotSearch {
910
+ searchParams: Omit<SearchState, "page" | "pageSize" | "includeFacets"> & {
911
+ catalogSegment?: string;
912
+ pricebooks?: string[];
913
+ };
914
+ }
915
+
916
+ declare interface SearchState extends CommonParams {
917
+ query: string;
918
+ }
919
+
861
920
  /**
862
921
  * A retryable message-send failure: the connection is live but the send itself
863
922
  * failed (5xx / network / timeout, not a session expiry). Holds what's needed
@@ -876,6 +935,7 @@ export declare type SendMessage = (text: string, options?: SendMessageOptions) =
876
935
  export declare interface SendMessageOptions {
877
936
  silent?: boolean;
878
937
  reconcileMessageId?: string;
938
+ displayContent?: string;
879
939
  }
880
940
 
881
941
  export declare type SendMessageResult = {
@@ -889,6 +949,12 @@ export declare type SendMessageResult = {
889
949
 
890
950
  declare type StaticQuestionsStrategy = "override" | "append" | "prepend";
891
951
 
952
+ declare type StructuredCoupon = {
953
+ code: string;
954
+ id?: string;
955
+ status?: string;
956
+ };
957
+
892
958
  declare type Suggestion = CopilotSearchSuggestion | FacetedNavigationSuggestion | ProductViewSuggestion | CopilotBrowseSuggestion;
893
959
 
894
960
  declare interface SuggestionButtonConfig {