@cimulate/copilot-widget 1.29.1 → 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,7 +203,11 @@ 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;
@@ -278,15 +288,15 @@ declare const CopilotWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, custome
278
288
 
279
289
  declare type DialogPosition = "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "right" | "center";
280
290
 
281
- 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];
282
294
 
283
295
  declare const eventHandlers: {
284
296
  search: typeof search;
285
297
  browse: typeof browse;
286
298
  pdp: {
287
- setPdpContext: (context: ProductView & {
288
- productName?: string;
289
- }) => void;
299
+ setPdpContext: (context: PdpEntryParams) => void;
290
300
  updatePdpProductId: (pid: string) => void;
291
301
  updatePdpLink: (link: string) => void;
292
302
  };
@@ -333,6 +343,20 @@ declare interface HeaderConfig {
333
343
  headerTextTextAlign?: "left" | "center" | "right";
334
344
  }
335
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
+
336
360
  declare const injectCopilotWidget: ({ timeout, elementId, ...props }: CopilotWidgetProps & {
337
361
  timeout?: number;
338
362
  elementId: string;
@@ -400,6 +424,10 @@ declare interface MessagingModeConfig {
400
424
  */
401
425
  declare type OverrideTagName = string;
402
426
 
427
+ declare type PdpEntryParams = ProductView & {
428
+ productName?: string;
429
+ };
430
+
403
431
  declare interface ProductResultDetail {
404
432
  agentSessionId: string;
405
433
  kind: "search" | "detail";
@@ -453,6 +481,8 @@ declare namespace search {
453
481
  }
454
482
  }
455
483
 
484
+ declare type SearchEntryParams = SearchPayload["searchParams"];
485
+
456
486
  declare interface SearchPayload extends CopilotSearch {
457
487
  searchParams: Omit<SearchState, "page" | "pageSize" | "includeFacets"> & {
458
488
  catalogSegment?: string;
@@ -477,13 +507,13 @@ declare namespace session {
477
507
  * Performs a bulk update of user's browse context. This will override
478
508
  * all existing browse parameters.
479
509
  */
480
- declare const setBrowseContext: (context: BrowsePayload["browseParams"]) => void;
510
+ declare const setBrowseContext: (context: BrowseEntryParams) => void;
481
511
 
482
512
  /**
483
513
  * Performs a bulk update of user's search context. This will override
484
514
  * all existing search parameters.
485
515
  */
486
- declare const setSearchContext: (context: SearchPayload["searchParams"]) => void;
516
+ declare const setSearchContext: (context: SearchEntryParams) => void;
487
517
 
488
518
  declare interface SocketSdkContextType {
489
519
  copilot: CimulateCopilot | null;
@@ -520,12 +550,10 @@ declare interface SocketSdkContextType {
520
550
  declare const state: () => Readonly<{
521
551
  search: Readonly<SearchState>;
522
552
  browse: Readonly<BrowseState>;
523
- pdp: Readonly<ProductView & {
524
- productName?: string;
525
- }>;
553
+ pdp: Readonly<PdpEntryParams>;
526
554
  isConnected: boolean;
527
555
  isOpen: boolean;
528
- entryType: EntryType;
556
+ entryType: "ask_cim" | "search" | "browse" | "pdp";
529
557
  }>;
530
558
 
531
559
  declare type StaticQuestionsStrategy = "override" | "append" | "prepend";