@cimulate/copilot-widget 1.29.0 → 1.30.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.
@@ -47,6 +47,8 @@ declare type AllCopilotEvents = {
47
47
  bypassHandlers?: boolean;
48
48
  } & (AskCimAck | CopilotEvent | ConversationResetAck | Inquiry | DisplayProducts | FollowUp | PartialInquiry | RefinedSearch | RefinedBrowse | CopilotBrowseAck | Progress | ProductViewAck | CopilotError);
49
49
 
50
+ declare type AskCimEntryParams = Record<string, never>;
51
+
50
52
  declare interface BaseSearchParams {
51
53
  facetFilters?: Record<string, string[]>;
52
54
  catalogSegment?: string | null;
@@ -67,6 +69,8 @@ declare namespace browse {
67
69
  }
68
70
  }
69
71
 
72
+ declare type BrowseEntryParams = BrowsePayload["browseParams"];
73
+
70
74
  declare interface BrowsePayload extends CopilotBrowse {
71
75
  browseParams: Omit<BrowseState, "page" | "pageSize" | "includeFacets"> & {
72
76
  catalogSegment?: string;
@@ -142,6 +146,8 @@ declare namespace copilot {
142
146
  state,
143
147
  injectCopilotWidget,
144
148
  CopilotWidgetProps,
149
+ EntryType,
150
+ InitialEntry,
145
151
  ComponentType,
146
152
  SearchPayload,
147
153
  WidgetMode
@@ -197,12 +203,15 @@ declare interface CopilotWidgetProps extends CimCopilotSdkConfig {
197
203
  showProductDescription?: boolean;
198
204
  theme?: ThemeConfig;
199
205
  openLinksInNewTab?: boolean;
206
+ /**
207
+ * @deprecated This setting has been moved to the initialEntry object. Please use initialEntry.type instead.
208
+ */
200
209
  entryType?: EntryType;
210
+ initialEntry?: InitialEntry;
201
211
  entryMessage?: string;
202
212
  disclaimerText?: string;
203
213
  disclaimerMarkdown?: string;
204
214
  clientContext?: ClientContext;
205
- progressStepsLimit?: number;
206
215
  /**
207
216
  * Baseline catalog-scoping parameters (facetFilters, catalogSegment, pricebooks)
208
217
  * applied by the workflow as defaults on context-less requests (ask_cim, product view)
@@ -279,15 +288,15 @@ declare const CopilotWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, custome
279
288
 
280
289
  declare type DialogPosition = "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "right" | "center";
281
290
 
282
- declare type EntryType = "search" | "browse" | "pdp" | "ask_cim";
291
+ declare const ENTRY_TYPES: readonly ["ask_cim", "search", "browse", "pdp"];
292
+
293
+ declare type EntryType = (typeof ENTRY_TYPES)[number];
283
294
 
284
295
  declare const eventHandlers: {
285
296
  search: typeof search;
286
297
  browse: typeof browse;
287
298
  pdp: {
288
- setPdpContext: (context: ProductView & {
289
- productName?: string;
290
- }) => void;
299
+ setPdpContext: (context: PdpEntryParams) => void;
291
300
  updatePdpProductId: (pid: string) => void;
292
301
  updatePdpLink: (link: string) => void;
293
302
  };
@@ -334,6 +343,20 @@ declare interface HeaderConfig {
334
343
  headerTextTextAlign?: "left" | "center" | "right";
335
344
  }
336
345
 
346
+ declare type InitialEntry = {
347
+ type: "search";
348
+ params: SearchEntryParams;
349
+ } | {
350
+ type: "browse";
351
+ params: BrowseEntryParams;
352
+ } | {
353
+ type: "pdp";
354
+ params: PdpEntryParams;
355
+ } | {
356
+ type: "ask_cim";
357
+ params?: AskCimEntryParams;
358
+ };
359
+
337
360
  declare const injectCopilotWidget: ({ timeout, elementId, ...props }: CopilotWidgetProps & {
338
361
  timeout?: number;
339
362
  elementId: string;
@@ -401,6 +424,10 @@ declare interface MessagingModeConfig {
401
424
  */
402
425
  declare type OverrideTagName = string;
403
426
 
427
+ declare type PdpEntryParams = ProductView & {
428
+ productName?: string;
429
+ };
430
+
404
431
  declare interface ProductResultDetail {
405
432
  agentSessionId: string;
406
433
  kind: "search" | "detail";
@@ -454,6 +481,8 @@ declare namespace search {
454
481
  }
455
482
  }
456
483
 
484
+ declare type SearchEntryParams = SearchPayload["searchParams"];
485
+
457
486
  declare interface SearchPayload extends CopilotSearch {
458
487
  searchParams: Omit<SearchState, "page" | "pageSize" | "includeFacets"> & {
459
488
  catalogSegment?: string;
@@ -478,13 +507,13 @@ declare namespace session {
478
507
  * Performs a bulk update of user's browse context. This will override
479
508
  * all existing browse parameters.
480
509
  */
481
- declare const setBrowseContext: (context: BrowsePayload["browseParams"]) => void;
510
+ declare const setBrowseContext: (context: BrowseEntryParams) => void;
482
511
 
483
512
  /**
484
513
  * Performs a bulk update of user's search context. This will override
485
514
  * all existing search parameters.
486
515
  */
487
- declare const setSearchContext: (context: SearchPayload["searchParams"]) => void;
516
+ declare const setSearchContext: (context: SearchEntryParams) => void;
488
517
 
489
518
  declare interface SocketSdkContextType {
490
519
  copilot: CimulateCopilot | null;
@@ -521,12 +550,10 @@ declare interface SocketSdkContextType {
521
550
  declare const state: () => Readonly<{
522
551
  search: Readonly<SearchState>;
523
552
  browse: Readonly<BrowseState>;
524
- pdp: Readonly<ProductView & {
525
- productName?: string;
526
- }>;
553
+ pdp: Readonly<PdpEntryParams>;
527
554
  isConnected: boolean;
528
555
  isOpen: boolean;
529
- entryType: EntryType;
556
+ entryType: "ask_cim" | "search" | "browse" | "pdp";
530
557
  }>;
531
558
 
532
559
  declare type StaticQuestionsStrategy = "override" | "append" | "prepend";