@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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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.39.0 — 2026-09-15
6
+
7
+ - Agentforce messaging mode now exposes `eventHandlers.session.endConversation()` for storefronts (CDN and NPM). Calling it ends the SCRT2 conversation and clears the in-widget transcript WITHOUT starting a new session — unlike `resetConversation()`, it does not reconnect or create a replacement conversation. The next time the widget is opened it connects and starts a fresh session on demand.
8
+ - Added "End conversation" button in the overflow menu that calls the same underlying `endConversation` method. Shows "This conversation has ended." system message and disconnects without starting a fresh session. The existing "Clear chat" button continues to end the conversation, clear history, and start a fresh session immediately.
9
+ - Added `onEndConversation` callback that fires before the conversation ends, allowing storefronts to show a satisfaction survey or perform cleanup. The callback receives the `conversationId` and can return a Promise to delay the disconnect (waits up to 30 seconds). The conversation ends gracefully even if the callback throws or times out.
10
+ - Fixed system message when the server ends a conversation (2h timeout, agent leaves, etc.) from the misleading "Conversation reset" to the accurate "This conversation has ended."
11
+
5
12
  ## 1.38.2 — 2026-09-15
6
13
 
7
14
  - Fixed product detail cards showing no gallery when a catalog doesn't expose a `large` image view type. The card previously read gallery images only from `large` image groups; it now selects the best available view type in priority order (`hi-res`, `large`, `medium`, `small`) — mirroring the backend's image-selection logic — and commits to that single view type without cascading to a lower one. Within the chosen view type it still prefers the selected color's images, then the color-less default group, then the first usable group, and falls back to the product's primary image when none are usable. Image groups that omit their variation-attribute field are now treated the same as those explicitly marked as having none (as SCAPI emits default groups), so those default images are picked up correctly.
@@ -294,6 +294,8 @@ declare const CopilotWidgetProvider: ({ mode, apiKey, apiToken, baseUrl, custome
294
294
 
295
295
  declare type DialogPosition = "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "right" | "center";
296
296
 
297
+ declare const endConversation: () => void;
298
+
297
299
  declare const ENTRY_TYPES: readonly ["ask_cim", "search", "browse", "pdp"];
298
300
 
299
301
  declare type EntryType = (typeof ENTRY_TYPES)[number];
@@ -393,6 +395,14 @@ declare interface MessagingModeConfig {
393
395
  * block (product search or product-details lookup).
394
396
  */
395
397
  onProductResult?: (detail: ProductResultDetail) => void;
398
+ /**
399
+ * Invoked when the user clicks "End conversation". Fires before the
400
+ * conversation ends, allowing the storefront to show a satisfaction survey or
401
+ * perform cleanup. Can return a Promise to delay the disconnect (waits up to
402
+ * 30 seconds). The conversation ends gracefully even if the callback throws
403
+ * or times out.
404
+ */
405
+ onEndConversation?: (conversationId: string | null) => Promise<void> | void;
396
406
  /**
397
407
  * Capabilities version for the SCRT2 token request. Required (>= "63", i.e.
398
408
  * release 254) for action progress indicators (`CONVERSATION_PROGRESS_INDICATOR`)
@@ -503,6 +513,7 @@ declare interface SearchState extends CommonParams {
503
513
  declare namespace session {
504
514
  export {
505
515
  resetConversation,
516
+ endConversation,
506
517
  getSessionInformation,
507
518
  getConversationMessages,
508
519
  loadConversation