@cimulate/copilot-widget 1.38.2 → 1.39.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.
@@ -358,6 +358,7 @@ export declare const eventHandlers: {
358
358
  };
359
359
  session: {
360
360
  resetConversation: () => void;
361
+ endConversation: () => void;
361
362
  };
362
363
  };
363
364
 
@@ -460,6 +461,7 @@ export declare interface MessagingContextType {
460
461
  sendMessage: SendMessage;
461
462
  addToCart: (params: AddToCartParams) => void;
462
463
  resetConversation: () => Promise<void>;
464
+ endConversation: () => Promise<void>;
463
465
  retryLastMessage: () => ReturnType<SendMessage> | undefined;
464
466
  retryConnection: () => void;
465
467
  downloadTranscript: () => Promise<void>;
@@ -526,6 +528,14 @@ export declare interface MessagingModeConfig {
526
528
  * block (product search or product-details lookup).
527
529
  */
528
530
  onProductResult?: (detail: ProductResultDetail) => void;
531
+ /**
532
+ * Invoked when the user clicks "End conversation". Fires before the
533
+ * conversation ends, allowing the storefront to show a satisfaction survey or
534
+ * perform cleanup. Can return a Promise to delay the disconnect (waits up to
535
+ * 30 seconds). The conversation ends gracefully even if the callback throws
536
+ * or times out.
537
+ */
538
+ onEndConversation?: (conversationId: string | null) => Promise<void> | void;
529
539
  /**
530
540
  * Capabilities version for the SCRT2 token request. Required (>= "63", i.e.
531
541
  * release 254) for action progress indicators (`CONVERSATION_PROGRESS_INDICATOR`)
@@ -550,7 +560,7 @@ export declare interface MessagingModeConfig {
550
560
  progressStepsLimit?: number;
551
561
  }
552
562
 
553
- export declare const MessagingProvider: ({ scrt2Url, orgId, esDeveloperName, routingAttributes, capabilitiesVersion, enableLogging, onConnect, onMessage, onError, onProductResult, children, }: MessagingProviderProps) => JSX_2.Element;
563
+ export declare const MessagingProvider: ({ scrt2Url, orgId, esDeveloperName, routingAttributes, capabilitiesVersion, enableLogging, onConnect, onMessage, onError, onProductResult, onEndConversation, children, }: MessagingProviderProps) => JSX_2.Element;
554
564
 
555
565
  declare interface MessagingProviderProps {
556
566
  scrt2Url: string;
@@ -564,6 +574,7 @@ declare interface MessagingProviderProps {
564
574
  onMessage?: (message: MessagingMessage) => void;
565
575
  onError?: (error: string) => void;
566
576
  onProductResult?: (detail: ProductResultDetail) => void;
577
+ onEndConversation?: (conversationId: string | null) => Promise<void> | void;
567
578
  children: ReactNode;
568
579
  }
569
580