@deepdesk/deepdesk-sdk 19.6.2-beta.11 → 19.6.2-beta.13

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/dist/index.d.mts CHANGED
@@ -406,7 +406,15 @@ declare enum FetchState {
406
406
  ERROR = "error"
407
407
  }
408
408
 
409
- interface State$a {
409
+ type State$a = {
410
+ data: Profile | null;
411
+ fetchState: FetchState;
412
+ /** Bumped on reset/clear so in-flight getProfile cannot repopulate profile. */
413
+ generation: number;
414
+ inFlightRequestId: string | null;
415
+ };
416
+
417
+ interface State$9 {
410
418
  current: Conversation | null;
411
419
  isSupported: boolean | null;
412
420
  }
@@ -447,7 +455,7 @@ type AssistantInteraction = {
447
455
  };
448
456
  evaluationId: string;
449
457
  };
450
- type State$9 = {
458
+ type State$8 = {
451
459
  cues: Cue[];
452
460
  threads: Record<number, AssistantInteraction[]>;
453
461
  pending: string[];
@@ -473,6 +481,7 @@ interface EvaluateInput {
473
481
  includeMetadata?: boolean;
474
482
  externalConversationId?: string;
475
483
  skipState?: boolean;
484
+ silent?: boolean;
476
485
  }
477
486
 
478
487
  type QueueMicrotaskErrorEventData = {
@@ -1287,19 +1296,11 @@ declare class DeepdeskAPI {
1287
1296
  }
1288
1297
 
1289
1298
  type StyleSuggestion = CamelCaseKeys<Server.StyleSuggestion>;
1290
- interface State$8 {
1299
+ interface State$7 {
1291
1300
  list: StyleSuggestion;
1292
1301
  fetchState: FetchState;
1293
1302
  }
1294
1303
 
1295
- type State$7 = {
1296
- data: Profile | null;
1297
- fetchState: FetchState;
1298
- /** Bumped on reset/clear so in-flight getProfile cannot repopulate profile. */
1299
- generation: number;
1300
- inFlightRequestId: string | null;
1301
- };
1302
-
1303
1304
  /**
1304
1305
  * A selection range representation for textarea's and contenteditables only using offsets.
1305
1306
  */
@@ -1469,9 +1470,9 @@ interface StoreConfig {
1469
1470
  preloadedState?: any;
1470
1471
  }
1471
1472
  declare const reducers: redux.Reducer<{
1472
- assistants: State$9;
1473
+ assistants: State$8;
1473
1474
  auth: State$2;
1474
- conversation: State$a;
1475
+ conversation: State$9;
1475
1476
  contentTypes: State$3;
1476
1477
  passwordlessToken: State$4;
1477
1478
  entities: State$1;
@@ -1523,9 +1524,9 @@ declare const reducers: redux.Reducer<{
1523
1524
  enableFeedbackForm: boolean;
1524
1525
  hasKeyboardInput: boolean;
1525
1526
  };
1526
- profile: State$7;
1527
+ profile: State$a;
1527
1528
  search: State$b;
1528
- styleSuggestions: State$8;
1529
+ styleSuggestions: State$7;
1529
1530
  ui: {
1530
1531
  showTabHint: boolean;
1531
1532
  inputHasFocus: boolean;
@@ -1535,9 +1536,9 @@ declare const reducers: redux.Reducer<{
1535
1536
  };
1536
1537
  textSuggestions: TextSuggestionState;
1537
1538
  }, redux.UnknownAction, Partial<{
1538
- assistants: State$9 | undefined;
1539
+ assistants: State$8 | undefined;
1539
1540
  auth: State$2 | undefined;
1540
- conversation: State$a | undefined;
1541
+ conversation: State$9 | undefined;
1541
1542
  contentTypes: State$3 | undefined;
1542
1543
  passwordlessToken: State$4 | undefined;
1543
1544
  entities: State$1 | undefined;
@@ -1589,9 +1590,9 @@ declare const reducers: redux.Reducer<{
1589
1590
  enableFeedbackForm: boolean;
1590
1591
  hasKeyboardInput: boolean;
1591
1592
  } | undefined;
1592
- profile: State$7 | undefined;
1593
+ profile: State$a | undefined;
1593
1594
  search: State$b | undefined;
1594
- styleSuggestions: State$8 | undefined;
1595
+ styleSuggestions: State$7 | undefined;
1595
1596
  ui: {
1596
1597
  showTabHint: boolean;
1597
1598
  inputHasFocus: boolean;
@@ -1602,9 +1603,9 @@ declare const reducers: redux.Reducer<{
1602
1603
  textSuggestions: TextSuggestionState | undefined;
1603
1604
  }>>;
1604
1605
  declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStore<{
1605
- assistants: State$9;
1606
+ assistants: State$8;
1606
1607
  auth: State$2;
1607
- conversation: State$a;
1608
+ conversation: State$9;
1608
1609
  contentTypes: State$3;
1609
1610
  passwordlessToken: State$4;
1610
1611
  entities: State$1;
@@ -1656,9 +1657,9 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStor
1656
1657
  enableFeedbackForm: boolean;
1657
1658
  hasKeyboardInput: boolean;
1658
1659
  };
1659
- profile: State$7;
1660
+ profile: State$a;
1660
1661
  search: State$b;
1661
- styleSuggestions: State$8;
1662
+ styleSuggestions: State$7;
1662
1663
  ui: {
1663
1664
  showTabHint: boolean;
1664
1665
  inputHasFocus: boolean;
@@ -2160,6 +2161,28 @@ interface KnowledgeAssistOptions {
2160
2161
  };
2161
2162
  }
2162
2163
  type OpenAdminFeedbackHandler = (feedbackPath: string) => void | Promise<void>;
2164
+ /**
2165
+ * Options for {@link DeepdeskSDK.reloadConversationContext} and
2166
+ * {@link DeepdeskSDK.syncHostConversation}.
2167
+ */
2168
+ type ReloadConversationContextOptions = {
2169
+ /** Conversation payload from the host (same shape as {@link DeepdeskSDK.upsertConversation}). */
2170
+ conversation: CreateConversation;
2171
+ /** Optional visitor fields to apply when refreshing metadata on the same session. */
2172
+ visitorInfo?: Partial<VisitorInfo>;
2173
+ /**
2174
+ * When `true`, clears on-screen assistant output after upsert (typical same-conversation refresh).
2175
+ * Visitor info is applied after the clear so it is not wiped with suggestion UI state.
2176
+ */
2177
+ clearDisplayedUi?: boolean;
2178
+ };
2179
+ /**
2180
+ * Options for {@link DeepdeskSDK.syncHostConversation}: metadata reload plus transcript publish.
2181
+ */
2182
+ type SyncHostConversationOptions = ReloadConversationContextOptions & {
2183
+ /** Host-built transcript; forwarded to {@link DeepdeskSDK.publishConversationTranscript}. */
2184
+ messages: ConversationMessage[];
2185
+ };
2163
2186
  interface WidgetOptions {
2164
2187
  customStyles?: WidgetCustomStyles;
2165
2188
  showImages?: boolean;
@@ -2238,9 +2261,9 @@ declare class DeepdeskSDK {
2238
2261
  */
2239
2262
  constructor({ deepdeskUrl, version, locale, token, fetch, productName, createCustomChannel, websocketClient, }: SDKOptions);
2240
2263
  get state(): {
2241
- assistants: State$9;
2264
+ assistants: State$8;
2242
2265
  auth: State$2;
2243
- conversation: State$a;
2266
+ conversation: State$9;
2244
2267
  contentTypes: State$3;
2245
2268
  passwordlessToken: State$4;
2246
2269
  entities: State$1;
@@ -2292,9 +2315,9 @@ declare class DeepdeskSDK {
2292
2315
  enableFeedbackForm: boolean;
2293
2316
  hasKeyboardInput: boolean;
2294
2317
  };
2295
- profile: State$7;
2318
+ profile: State$a;
2296
2319
  search: State$b;
2297
- styleSuggestions: State$8;
2320
+ styleSuggestions: State$7;
2298
2321
  ui: {
2299
2322
  showTabHint: boolean;
2300
2323
  inputHasFocus: boolean;
@@ -2695,6 +2718,127 @@ declare class DeepdeskSDK {
2695
2718
  * ```
2696
2719
  */
2697
2720
  resetConversation(): void;
2721
+ /**
2722
+ * Clears on-screen assistant answers and related suggestion UI for the loaded
2723
+ * conversation without unloading it from the store.
2724
+ *
2725
+ * **Preserved:** `conversation.current` (including `id`, `externalId`, and `metadata`),
2726
+ * visitor info, profile configuration, and active handling-time tracking.
2727
+ *
2728
+ * **Reset:** assistant panels, text/style/search/pinned suggestions, entities, and input
2729
+ * fields tied to displayed answers (same slices as after {@link resetConversation}, except
2730
+ * `conversation.current` and handling-time state stay set).
2731
+ *
2732
+ * Does not re-fetch CRM data or post transcript messages. For a host-driven refresh,
2733
+ * use {@link reloadConversationContext} with `clearDisplayedUi: true` and then
2734
+ * {@link publishConversationTranscript}, or {@link syncHostConversation} when no host
2735
+ * logic is needed between those steps.
2736
+ *
2737
+ * **Integrators:** do not dispatch private store actions (for example
2738
+ * `conversation/upsert/fulfilled`) to simulate a refresh; use the public methods above.
2739
+ *
2740
+ * No-op when no conversation is loaded.
2741
+ *
2742
+ * @example
2743
+ * ```typescript
2744
+ * // Same session, only wipe stale suggestions before reposting messages
2745
+ * sdk.clearDisplayedAnswers();
2746
+ * await sdk.publishConversationTranscript(messagesFromCrm);
2747
+ * ```
2748
+ */
2749
+ clearDisplayedAnswers(): void;
2750
+ /**
2751
+ * Applies host-fetched conversation metadata to the current SDK session.
2752
+ *
2753
+ * Upserts via {@link upsertConversation} and optionally clears on-screen assistant UI.
2754
+ * The host must fetch CRM (or other) data itself; this method does not load emails or
2755
+ * transcript text. Call {@link publishConversationTranscript} afterward to push messages
2756
+ * and refresh the conversation query.
2757
+ *
2758
+ * When `clearDisplayedUi` is `true`, {@link clearDisplayedAnswers} runs after the upsert.
2759
+ * If `visitorInfo` is provided, it is applied after upsert (and after the UI clear when
2760
+ * requested) so visitor fields survive reset paths—use this for same-conversation refresh flows.
2761
+ *
2762
+ * When switching to a different conversation, prefer {@link resetConversation} first,
2763
+ * then load or upsert the new conversation.
2764
+ *
2765
+ * @param options - Host conversation payload and optional visitor / UI flags.
2766
+ * @param options.conversation - Metadata to upsert (external id, platform, metadata, etc.).
2767
+ * @param options.visitorInfo - Visitor fields to merge when refreshing the same session.
2768
+ * @param options.clearDisplayedUi - Clear assistant/suggestion UI after upsert (default `false`).
2769
+ *
2770
+ * @example
2771
+ * ```typescript
2772
+ * const conversation = await fetchConversationFromCrm(caseId);
2773
+ * const messages = await fetchEmailsFromCrm(caseId);
2774
+ *
2775
+ * await sdk.reloadConversationContext({
2776
+ * conversation,
2777
+ * visitorInfo: { visitorId: contactId, visitorName: contactName },
2778
+ * clearDisplayedUi: true,
2779
+ * });
2780
+ *
2781
+ * // Optional: host-only widget state (assistant input, etc.)
2782
+ * updateWidgetAssistantInput(...);
2783
+ *
2784
+ * await sdk.publishConversationTranscript(messages);
2785
+ * ```
2786
+ */
2787
+ reloadConversationContext({ conversation, visitorInfo, clearDisplayedUi, }: ReloadConversationContextOptions): Promise<void>;
2788
+ /**
2789
+ * Publishes a host-built transcript for the current conversation.
2790
+ *
2791
+ * Sets the dynamic conversation query to the given messages and, when the array is
2792
+ * non-empty, posts them through {@link postMessages}. Use after
2793
+ * {@link reloadConversationContext} when the host already fetched the latest thread
2794
+ * from an external system.
2795
+ *
2796
+ * @param messages - Transcript lines (`source`, `text`, and other {@link ConversationMessage} fields).
2797
+ *
2798
+ * @example
2799
+ * ```typescript
2800
+ * await sdk.publishConversationTranscript([
2801
+ * {
2802
+ * externalId: 'msg-1',
2803
+ * time: '2024-01-01T12:00:00Z',
2804
+ * source: 'visitor',
2805
+ * authorId: 'visitor-1',
2806
+ * text: 'Hello',
2807
+ * metadata: null,
2808
+ * },
2809
+ * {
2810
+ * externalId: 'msg-2',
2811
+ * time: '2024-01-01T12:01:00Z',
2812
+ * source: 'agent',
2813
+ * authorId: 'agent-1',
2814
+ * text: 'Hi, how can I help?',
2815
+ * metadata: null,
2816
+ * },
2817
+ * ]);
2818
+ * ```
2819
+ */
2820
+ publishConversationTranscript(messages: ConversationMessage[]): Promise<void>;
2821
+ /**
2822
+ * Convenience wrapper: {@link reloadConversationContext} then {@link publishConversationTranscript}
2823
+ * in one call.
2824
+ *
2825
+ * Use {@link reloadConversationContext} and {@link publishConversationTranscript} separately
2826
+ * when the host must update widget-only state (for example assistant input) or run other
2827
+ * logic between metadata upsert and transcript publish.
2828
+ *
2829
+ * @param options - Same as {@link reloadConversationContext} plus `messages` for the transcript.
2830
+ *
2831
+ * @example
2832
+ * ```typescript
2833
+ * await sdk.syncHostConversation({
2834
+ * conversation: crmConversation,
2835
+ * visitorInfo: { visitorId: 'visitor-1', visitorName: 'Jane Doe' },
2836
+ * clearDisplayedUi: true,
2837
+ * messages: crmMessages,
2838
+ * });
2839
+ * ```
2840
+ */
2841
+ syncHostConversation({ conversation, messages, visitorInfo, clearDisplayedUi, }: SyncHostConversationOptions): Promise<void>;
2698
2842
  /**
2699
2843
  * Updates SDK configuration settings.
2700
2844
  *
@@ -3727,4 +3871,4 @@ declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<
3727
3871
  type CSSModule = Record<string, string>;
3728
3872
  declare function useStyles<TStyles extends CSSModule>(componentName: string, defaultStyles: TStyles): TStyles;
3729
3873
 
3730
- export { type AgentInfo, Card, ContentEditableInput, type Conversation, type ConversationAssistantResult, type ConversationMessage, DeepdeskAPI, DeepdeskSDK, type EvaluationAttachment, HTTPClient, InputMediator, type InputOverlayCustomStyles, InputType, KeyboardHint, Label, Locale, type Logger, type MountOptions, type OpenAdminFeedbackHandler, type PinnedMessage, type PlatformConfig, type RootState, Section, SectionList, type SelectionRange, Sources, Suggestion, type SuggestionEventMetrics, SuggestionList, type SuggestionMetrics, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };
3874
+ export { type AgentInfo, Card, ContentEditableInput, type Conversation, type ConversationAssistantResult, type ConversationMessage, DeepdeskAPI, DeepdeskSDK, type EvaluationAttachment, HTTPClient, InputMediator, type InputOverlayCustomStyles, InputType, KeyboardHint, Label, Locale, type Logger, type MountOptions, type OpenAdminFeedbackHandler, type PinnedMessage, type PlatformConfig, type ReloadConversationContextOptions, type RootState, Section, SectionList, type SelectionRange, Sources, Suggestion, type SuggestionEventMetrics, SuggestionList, type SuggestionMetrics, type SyncHostConversationOptions, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };
package/dist/index.d.ts CHANGED
@@ -406,7 +406,15 @@ declare enum FetchState {
406
406
  ERROR = "error"
407
407
  }
408
408
 
409
- interface State$a {
409
+ type State$a = {
410
+ data: Profile | null;
411
+ fetchState: FetchState;
412
+ /** Bumped on reset/clear so in-flight getProfile cannot repopulate profile. */
413
+ generation: number;
414
+ inFlightRequestId: string | null;
415
+ };
416
+
417
+ interface State$9 {
410
418
  current: Conversation | null;
411
419
  isSupported: boolean | null;
412
420
  }
@@ -447,7 +455,7 @@ type AssistantInteraction = {
447
455
  };
448
456
  evaluationId: string;
449
457
  };
450
- type State$9 = {
458
+ type State$8 = {
451
459
  cues: Cue[];
452
460
  threads: Record<number, AssistantInteraction[]>;
453
461
  pending: string[];
@@ -473,6 +481,7 @@ interface EvaluateInput {
473
481
  includeMetadata?: boolean;
474
482
  externalConversationId?: string;
475
483
  skipState?: boolean;
484
+ silent?: boolean;
476
485
  }
477
486
 
478
487
  type QueueMicrotaskErrorEventData = {
@@ -1287,19 +1296,11 @@ declare class DeepdeskAPI {
1287
1296
  }
1288
1297
 
1289
1298
  type StyleSuggestion = CamelCaseKeys<Server.StyleSuggestion>;
1290
- interface State$8 {
1299
+ interface State$7 {
1291
1300
  list: StyleSuggestion;
1292
1301
  fetchState: FetchState;
1293
1302
  }
1294
1303
 
1295
- type State$7 = {
1296
- data: Profile | null;
1297
- fetchState: FetchState;
1298
- /** Bumped on reset/clear so in-flight getProfile cannot repopulate profile. */
1299
- generation: number;
1300
- inFlightRequestId: string | null;
1301
- };
1302
-
1303
1304
  /**
1304
1305
  * A selection range representation for textarea's and contenteditables only using offsets.
1305
1306
  */
@@ -1469,9 +1470,9 @@ interface StoreConfig {
1469
1470
  preloadedState?: any;
1470
1471
  }
1471
1472
  declare const reducers: redux.Reducer<{
1472
- assistants: State$9;
1473
+ assistants: State$8;
1473
1474
  auth: State$2;
1474
- conversation: State$a;
1475
+ conversation: State$9;
1475
1476
  contentTypes: State$3;
1476
1477
  passwordlessToken: State$4;
1477
1478
  entities: State$1;
@@ -1523,9 +1524,9 @@ declare const reducers: redux.Reducer<{
1523
1524
  enableFeedbackForm: boolean;
1524
1525
  hasKeyboardInput: boolean;
1525
1526
  };
1526
- profile: State$7;
1527
+ profile: State$a;
1527
1528
  search: State$b;
1528
- styleSuggestions: State$8;
1529
+ styleSuggestions: State$7;
1529
1530
  ui: {
1530
1531
  showTabHint: boolean;
1531
1532
  inputHasFocus: boolean;
@@ -1535,9 +1536,9 @@ declare const reducers: redux.Reducer<{
1535
1536
  };
1536
1537
  textSuggestions: TextSuggestionState;
1537
1538
  }, redux.UnknownAction, Partial<{
1538
- assistants: State$9 | undefined;
1539
+ assistants: State$8 | undefined;
1539
1540
  auth: State$2 | undefined;
1540
- conversation: State$a | undefined;
1541
+ conversation: State$9 | undefined;
1541
1542
  contentTypes: State$3 | undefined;
1542
1543
  passwordlessToken: State$4 | undefined;
1543
1544
  entities: State$1 | undefined;
@@ -1589,9 +1590,9 @@ declare const reducers: redux.Reducer<{
1589
1590
  enableFeedbackForm: boolean;
1590
1591
  hasKeyboardInput: boolean;
1591
1592
  } | undefined;
1592
- profile: State$7 | undefined;
1593
+ profile: State$a | undefined;
1593
1594
  search: State$b | undefined;
1594
- styleSuggestions: State$8 | undefined;
1595
+ styleSuggestions: State$7 | undefined;
1595
1596
  ui: {
1596
1597
  showTabHint: boolean;
1597
1598
  inputHasFocus: boolean;
@@ -1602,9 +1603,9 @@ declare const reducers: redux.Reducer<{
1602
1603
  textSuggestions: TextSuggestionState | undefined;
1603
1604
  }>>;
1604
1605
  declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStore<{
1605
- assistants: State$9;
1606
+ assistants: State$8;
1606
1607
  auth: State$2;
1607
- conversation: State$a;
1608
+ conversation: State$9;
1608
1609
  contentTypes: State$3;
1609
1610
  passwordlessToken: State$4;
1610
1611
  entities: State$1;
@@ -1656,9 +1657,9 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStor
1656
1657
  enableFeedbackForm: boolean;
1657
1658
  hasKeyboardInput: boolean;
1658
1659
  };
1659
- profile: State$7;
1660
+ profile: State$a;
1660
1661
  search: State$b;
1661
- styleSuggestions: State$8;
1662
+ styleSuggestions: State$7;
1662
1663
  ui: {
1663
1664
  showTabHint: boolean;
1664
1665
  inputHasFocus: boolean;
@@ -2160,6 +2161,28 @@ interface KnowledgeAssistOptions {
2160
2161
  };
2161
2162
  }
2162
2163
  type OpenAdminFeedbackHandler = (feedbackPath: string) => void | Promise<void>;
2164
+ /**
2165
+ * Options for {@link DeepdeskSDK.reloadConversationContext} and
2166
+ * {@link DeepdeskSDK.syncHostConversation}.
2167
+ */
2168
+ type ReloadConversationContextOptions = {
2169
+ /** Conversation payload from the host (same shape as {@link DeepdeskSDK.upsertConversation}). */
2170
+ conversation: CreateConversation;
2171
+ /** Optional visitor fields to apply when refreshing metadata on the same session. */
2172
+ visitorInfo?: Partial<VisitorInfo>;
2173
+ /**
2174
+ * When `true`, clears on-screen assistant output after upsert (typical same-conversation refresh).
2175
+ * Visitor info is applied after the clear so it is not wiped with suggestion UI state.
2176
+ */
2177
+ clearDisplayedUi?: boolean;
2178
+ };
2179
+ /**
2180
+ * Options for {@link DeepdeskSDK.syncHostConversation}: metadata reload plus transcript publish.
2181
+ */
2182
+ type SyncHostConversationOptions = ReloadConversationContextOptions & {
2183
+ /** Host-built transcript; forwarded to {@link DeepdeskSDK.publishConversationTranscript}. */
2184
+ messages: ConversationMessage[];
2185
+ };
2163
2186
  interface WidgetOptions {
2164
2187
  customStyles?: WidgetCustomStyles;
2165
2188
  showImages?: boolean;
@@ -2238,9 +2261,9 @@ declare class DeepdeskSDK {
2238
2261
  */
2239
2262
  constructor({ deepdeskUrl, version, locale, token, fetch, productName, createCustomChannel, websocketClient, }: SDKOptions);
2240
2263
  get state(): {
2241
- assistants: State$9;
2264
+ assistants: State$8;
2242
2265
  auth: State$2;
2243
- conversation: State$a;
2266
+ conversation: State$9;
2244
2267
  contentTypes: State$3;
2245
2268
  passwordlessToken: State$4;
2246
2269
  entities: State$1;
@@ -2292,9 +2315,9 @@ declare class DeepdeskSDK {
2292
2315
  enableFeedbackForm: boolean;
2293
2316
  hasKeyboardInput: boolean;
2294
2317
  };
2295
- profile: State$7;
2318
+ profile: State$a;
2296
2319
  search: State$b;
2297
- styleSuggestions: State$8;
2320
+ styleSuggestions: State$7;
2298
2321
  ui: {
2299
2322
  showTabHint: boolean;
2300
2323
  inputHasFocus: boolean;
@@ -2695,6 +2718,127 @@ declare class DeepdeskSDK {
2695
2718
  * ```
2696
2719
  */
2697
2720
  resetConversation(): void;
2721
+ /**
2722
+ * Clears on-screen assistant answers and related suggestion UI for the loaded
2723
+ * conversation without unloading it from the store.
2724
+ *
2725
+ * **Preserved:** `conversation.current` (including `id`, `externalId`, and `metadata`),
2726
+ * visitor info, profile configuration, and active handling-time tracking.
2727
+ *
2728
+ * **Reset:** assistant panels, text/style/search/pinned suggestions, entities, and input
2729
+ * fields tied to displayed answers (same slices as after {@link resetConversation}, except
2730
+ * `conversation.current` and handling-time state stay set).
2731
+ *
2732
+ * Does not re-fetch CRM data or post transcript messages. For a host-driven refresh,
2733
+ * use {@link reloadConversationContext} with `clearDisplayedUi: true` and then
2734
+ * {@link publishConversationTranscript}, or {@link syncHostConversation} when no host
2735
+ * logic is needed between those steps.
2736
+ *
2737
+ * **Integrators:** do not dispatch private store actions (for example
2738
+ * `conversation/upsert/fulfilled`) to simulate a refresh; use the public methods above.
2739
+ *
2740
+ * No-op when no conversation is loaded.
2741
+ *
2742
+ * @example
2743
+ * ```typescript
2744
+ * // Same session, only wipe stale suggestions before reposting messages
2745
+ * sdk.clearDisplayedAnswers();
2746
+ * await sdk.publishConversationTranscript(messagesFromCrm);
2747
+ * ```
2748
+ */
2749
+ clearDisplayedAnswers(): void;
2750
+ /**
2751
+ * Applies host-fetched conversation metadata to the current SDK session.
2752
+ *
2753
+ * Upserts via {@link upsertConversation} and optionally clears on-screen assistant UI.
2754
+ * The host must fetch CRM (or other) data itself; this method does not load emails or
2755
+ * transcript text. Call {@link publishConversationTranscript} afterward to push messages
2756
+ * and refresh the conversation query.
2757
+ *
2758
+ * When `clearDisplayedUi` is `true`, {@link clearDisplayedAnswers} runs after the upsert.
2759
+ * If `visitorInfo` is provided, it is applied after upsert (and after the UI clear when
2760
+ * requested) so visitor fields survive reset paths—use this for same-conversation refresh flows.
2761
+ *
2762
+ * When switching to a different conversation, prefer {@link resetConversation} first,
2763
+ * then load or upsert the new conversation.
2764
+ *
2765
+ * @param options - Host conversation payload and optional visitor / UI flags.
2766
+ * @param options.conversation - Metadata to upsert (external id, platform, metadata, etc.).
2767
+ * @param options.visitorInfo - Visitor fields to merge when refreshing the same session.
2768
+ * @param options.clearDisplayedUi - Clear assistant/suggestion UI after upsert (default `false`).
2769
+ *
2770
+ * @example
2771
+ * ```typescript
2772
+ * const conversation = await fetchConversationFromCrm(caseId);
2773
+ * const messages = await fetchEmailsFromCrm(caseId);
2774
+ *
2775
+ * await sdk.reloadConversationContext({
2776
+ * conversation,
2777
+ * visitorInfo: { visitorId: contactId, visitorName: contactName },
2778
+ * clearDisplayedUi: true,
2779
+ * });
2780
+ *
2781
+ * // Optional: host-only widget state (assistant input, etc.)
2782
+ * updateWidgetAssistantInput(...);
2783
+ *
2784
+ * await sdk.publishConversationTranscript(messages);
2785
+ * ```
2786
+ */
2787
+ reloadConversationContext({ conversation, visitorInfo, clearDisplayedUi, }: ReloadConversationContextOptions): Promise<void>;
2788
+ /**
2789
+ * Publishes a host-built transcript for the current conversation.
2790
+ *
2791
+ * Sets the dynamic conversation query to the given messages and, when the array is
2792
+ * non-empty, posts them through {@link postMessages}. Use after
2793
+ * {@link reloadConversationContext} when the host already fetched the latest thread
2794
+ * from an external system.
2795
+ *
2796
+ * @param messages - Transcript lines (`source`, `text`, and other {@link ConversationMessage} fields).
2797
+ *
2798
+ * @example
2799
+ * ```typescript
2800
+ * await sdk.publishConversationTranscript([
2801
+ * {
2802
+ * externalId: 'msg-1',
2803
+ * time: '2024-01-01T12:00:00Z',
2804
+ * source: 'visitor',
2805
+ * authorId: 'visitor-1',
2806
+ * text: 'Hello',
2807
+ * metadata: null,
2808
+ * },
2809
+ * {
2810
+ * externalId: 'msg-2',
2811
+ * time: '2024-01-01T12:01:00Z',
2812
+ * source: 'agent',
2813
+ * authorId: 'agent-1',
2814
+ * text: 'Hi, how can I help?',
2815
+ * metadata: null,
2816
+ * },
2817
+ * ]);
2818
+ * ```
2819
+ */
2820
+ publishConversationTranscript(messages: ConversationMessage[]): Promise<void>;
2821
+ /**
2822
+ * Convenience wrapper: {@link reloadConversationContext} then {@link publishConversationTranscript}
2823
+ * in one call.
2824
+ *
2825
+ * Use {@link reloadConversationContext} and {@link publishConversationTranscript} separately
2826
+ * when the host must update widget-only state (for example assistant input) or run other
2827
+ * logic between metadata upsert and transcript publish.
2828
+ *
2829
+ * @param options - Same as {@link reloadConversationContext} plus `messages` for the transcript.
2830
+ *
2831
+ * @example
2832
+ * ```typescript
2833
+ * await sdk.syncHostConversation({
2834
+ * conversation: crmConversation,
2835
+ * visitorInfo: { visitorId: 'visitor-1', visitorName: 'Jane Doe' },
2836
+ * clearDisplayedUi: true,
2837
+ * messages: crmMessages,
2838
+ * });
2839
+ * ```
2840
+ */
2841
+ syncHostConversation({ conversation, messages, visitorInfo, clearDisplayedUi, }: SyncHostConversationOptions): Promise<void>;
2698
2842
  /**
2699
2843
  * Updates SDK configuration settings.
2700
2844
  *
@@ -3727,4 +3871,4 @@ declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<
3727
3871
  type CSSModule = Record<string, string>;
3728
3872
  declare function useStyles<TStyles extends CSSModule>(componentName: string, defaultStyles: TStyles): TStyles;
3729
3873
 
3730
- export { type AgentInfo, Card, ContentEditableInput, type Conversation, type ConversationAssistantResult, type ConversationMessage, DeepdeskAPI, DeepdeskSDK, type EvaluationAttachment, HTTPClient, InputMediator, type InputOverlayCustomStyles, InputType, KeyboardHint, Label, Locale, type Logger, type MountOptions, type OpenAdminFeedbackHandler, type PinnedMessage, type PlatformConfig, type RootState, Section, SectionList, type SelectionRange, Sources, Suggestion, type SuggestionEventMetrics, SuggestionList, type SuggestionMetrics, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };
3874
+ export { type AgentInfo, Card, ContentEditableInput, type Conversation, type ConversationAssistantResult, type ConversationMessage, DeepdeskAPI, DeepdeskSDK, type EvaluationAttachment, HTTPClient, InputMediator, type InputOverlayCustomStyles, InputType, KeyboardHint, Label, Locale, type Logger, type MountOptions, type OpenAdminFeedbackHandler, type PinnedMessage, type PlatformConfig, type ReloadConversationContextOptions, type RootState, Section, SectionList, type SelectionRange, Sources, Suggestion, type SuggestionEventMetrics, SuggestionList, type SuggestionMetrics, type SyncHostConversationOptions, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };