@deepdesk/deepdesk-sdk 19.7.1 → 19.7.2-beta.1

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
@@ -2048,16 +2048,23 @@ declare class WebsocketClient {
2048
2048
  private eventListeners;
2049
2049
  private url;
2050
2050
  private maxReconnectAttempts;
2051
+ private readonly initialReconnectAttempts;
2051
2052
  private reconnectInterval;
2052
2053
  private shouldReconnect;
2053
2054
  private cleanupCallbacks;
2055
+ private disposed;
2056
+ private reconnectTimer?;
2054
2057
  constructor(options: WebsocketOptions);
2055
2058
  connect(): void;
2059
+ private attachSocket;
2056
2060
  private setupListeners;
2057
- private reconnect;
2061
+ private tryReconnect;
2058
2062
  send(event: string, data: any): void;
2059
2063
  on<T = unknown>(eventType: string, callback: EventCallback<T>): void;
2060
2064
  close(): void;
2065
+ /** Page navigation prompt (e.g. cancelled "Leave site?") — close only, keep reconnect eligible. */
2066
+ private closeForPageLeave;
2067
+ private stopSocketWithoutReconnect;
2061
2068
  cleanup(): void;
2062
2069
  }
2063
2070
 
@@ -2208,6 +2215,18 @@ interface WidgetOptions {
2208
2215
  openAdminFeedback?: OpenAdminFeedbackHandler;
2209
2216
  knowledgeAssist?: KnowledgeAssistOptions;
2210
2217
  assistantOptions?: Omit<EvaluateInput, 'assistantCode'>;
2218
+ /**
2219
+ * Mount the search overlay (command palette) next to the widget, so the widget's Search
2220
+ * button and CMD+K open a search box inside the widget's own frame.
2221
+ *
2222
+ * Set this only when nothing else on the page already mounts a search box, for example an
2223
+ * iframe whose host page has no Deepdesk SDK. When the host page already mounts one (it
2224
+ * calls `mount()` and receives the widget's `ShowCommandPalette` event), leave it off:
2225
+ * the search would open twice and the copy inside the widget would cover the widget.
2226
+ *
2227
+ * @default false
2228
+ */
2229
+ mountSearchOverlay?: boolean;
2211
2230
  }
2212
2231
  interface KnowledgeAssistantWidgetOptions extends KnowledgeAssistOptions {
2213
2232
  customStyles?: WidgetCustomStyles;
@@ -2223,6 +2242,7 @@ declare class DeepdeskSDK {
2223
2242
  private eventListeners;
2224
2243
  private unmountHandlers;
2225
2244
  private disposeHandlers;
2245
+ private disposed;
2226
2246
  private inlineSuggestions;
2227
2247
  private aboveSuggestions;
2228
2248
  private belowSuggestions;
@@ -2235,6 +2255,8 @@ declare class DeepdeskSDK {
2235
2255
  private dialogOverlaysCustomStyles;
2236
2256
  /** OR of includeLoginOverlay across ensureDialogOverlays callers (mount can upgrade widget-only). */
2237
2257
  private dialogOverlaysIncludeLogin;
2258
+ /** True while the rendered widget asked for the shared overlays (`mountSearchOverlay`). */
2259
+ private widgetOwnsDialogOverlays;
2238
2260
  private nicknameDialogUnsubscribe;
2239
2261
  private nicknameDialogFailed;
2240
2262
  private dynamicThunkObject;
@@ -3541,6 +3563,11 @@ declare class DeepdeskSDK {
3541
3563
  */
3542
3564
  private ensureDialogOverlays;
3543
3565
  private disposeDialogOverlays;
3566
+ /**
3567
+ * `mount()` is done with the shared overlays. They go away unless the rendered widget asked
3568
+ * for them (`mountSearchOverlay`); then only what `mount()` added, the login overlay, goes.
3569
+ */
3570
+ private releaseDialogOverlaysFromMount;
3544
3571
  private renderOverlays;
3545
3572
  /**
3546
3573
  * Renders the Deepdesk widget in a container element.
@@ -3552,10 +3579,11 @@ declare class DeepdeskSDK {
3552
3579
  * **Important:** Make sure to set the container element to a fixed or minimum size
3553
3580
  * (height and width) as the widget will grow to fill the container.
3554
3581
  *
3555
- * Also mounts dialog overlays (search command palette / CMD+K) so iframe-only
3556
- * integrations that never call {@link mount} still get search. Shared with `mount()` —
3557
- * only one overlays root exists per SDK instance. Does **not** mount `LoginOverlay`
3558
- * (iframe apps use their own sign-in); `mount()` still can.
3582
+ * Mounts dialog overlays (search command palette / CMD+K) only when
3583
+ * `options.mountSearchOverlay` is `true`, for iframe-only integrations that never call
3584
+ * {@link mount} and whose host page has no search box. Shared with `mount()` — only one
3585
+ * overlays root exists per SDK instance. Does **not** mount `LoginOverlay` (iframe apps
3586
+ * use their own sign-in); `mount()` still can.
3559
3587
  *
3560
3588
  * **Note:** Only one widget can be rendered per SDK instance.
3561
3589
  *
@@ -3566,6 +3594,7 @@ declare class DeepdeskSDK {
3566
3594
  * @param options.isEmbedded - Whether the widget is embedded in another application
3567
3595
  * @param options.knowledgeAssist - Knowledge assistant configuration
3568
3596
  * @param options.assistantOptions - Assistant evaluation options
3597
+ * @param options.mountSearchOverlay - Mount a search box inside the widget's frame (default: false)
3569
3598
  *
3570
3599
  * @example
3571
3600
  * ```typescript
@@ -3873,6 +3902,8 @@ declare function waitForElementVisibilityChange(element: HTMLElement, callback:
3873
3902
  isVisible: boolean;
3874
3903
  }) => void, interval?: number): Cancelable;
3875
3904
 
3905
+ declare function clearWidgetAssistantSessionId(externalConversationId: string | undefined): void;
3906
+
3876
3907
  type LogEvent<T extends keyof SendEventArgumentMap, P extends T = T> = {
3877
3908
  name: T;
3878
3909
  data: SendEventArgumentMap[P]['data'];
@@ -3882,4 +3913,4 @@ declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<
3882
3913
  type CSSModule = Record<string, string>;
3883
3914
  declare function useStyles<TStyles extends CSSModule>(componentName: string, defaultStyles: TStyles): TStyles;
3884
3915
 
3885
- 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, 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 };
3916
+ 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, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, clearWidgetAssistantSessionId, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };
package/dist/index.d.ts CHANGED
@@ -2048,16 +2048,23 @@ declare class WebsocketClient {
2048
2048
  private eventListeners;
2049
2049
  private url;
2050
2050
  private maxReconnectAttempts;
2051
+ private readonly initialReconnectAttempts;
2051
2052
  private reconnectInterval;
2052
2053
  private shouldReconnect;
2053
2054
  private cleanupCallbacks;
2055
+ private disposed;
2056
+ private reconnectTimer?;
2054
2057
  constructor(options: WebsocketOptions);
2055
2058
  connect(): void;
2059
+ private attachSocket;
2056
2060
  private setupListeners;
2057
- private reconnect;
2061
+ private tryReconnect;
2058
2062
  send(event: string, data: any): void;
2059
2063
  on<T = unknown>(eventType: string, callback: EventCallback<T>): void;
2060
2064
  close(): void;
2065
+ /** Page navigation prompt (e.g. cancelled "Leave site?") — close only, keep reconnect eligible. */
2066
+ private closeForPageLeave;
2067
+ private stopSocketWithoutReconnect;
2061
2068
  cleanup(): void;
2062
2069
  }
2063
2070
 
@@ -2208,6 +2215,18 @@ interface WidgetOptions {
2208
2215
  openAdminFeedback?: OpenAdminFeedbackHandler;
2209
2216
  knowledgeAssist?: KnowledgeAssistOptions;
2210
2217
  assistantOptions?: Omit<EvaluateInput, 'assistantCode'>;
2218
+ /**
2219
+ * Mount the search overlay (command palette) next to the widget, so the widget's Search
2220
+ * button and CMD+K open a search box inside the widget's own frame.
2221
+ *
2222
+ * Set this only when nothing else on the page already mounts a search box, for example an
2223
+ * iframe whose host page has no Deepdesk SDK. When the host page already mounts one (it
2224
+ * calls `mount()` and receives the widget's `ShowCommandPalette` event), leave it off:
2225
+ * the search would open twice and the copy inside the widget would cover the widget.
2226
+ *
2227
+ * @default false
2228
+ */
2229
+ mountSearchOverlay?: boolean;
2211
2230
  }
2212
2231
  interface KnowledgeAssistantWidgetOptions extends KnowledgeAssistOptions {
2213
2232
  customStyles?: WidgetCustomStyles;
@@ -2223,6 +2242,7 @@ declare class DeepdeskSDK {
2223
2242
  private eventListeners;
2224
2243
  private unmountHandlers;
2225
2244
  private disposeHandlers;
2245
+ private disposed;
2226
2246
  private inlineSuggestions;
2227
2247
  private aboveSuggestions;
2228
2248
  private belowSuggestions;
@@ -2235,6 +2255,8 @@ declare class DeepdeskSDK {
2235
2255
  private dialogOverlaysCustomStyles;
2236
2256
  /** OR of includeLoginOverlay across ensureDialogOverlays callers (mount can upgrade widget-only). */
2237
2257
  private dialogOverlaysIncludeLogin;
2258
+ /** True while the rendered widget asked for the shared overlays (`mountSearchOverlay`). */
2259
+ private widgetOwnsDialogOverlays;
2238
2260
  private nicknameDialogUnsubscribe;
2239
2261
  private nicknameDialogFailed;
2240
2262
  private dynamicThunkObject;
@@ -3541,6 +3563,11 @@ declare class DeepdeskSDK {
3541
3563
  */
3542
3564
  private ensureDialogOverlays;
3543
3565
  private disposeDialogOverlays;
3566
+ /**
3567
+ * `mount()` is done with the shared overlays. They go away unless the rendered widget asked
3568
+ * for them (`mountSearchOverlay`); then only what `mount()` added, the login overlay, goes.
3569
+ */
3570
+ private releaseDialogOverlaysFromMount;
3544
3571
  private renderOverlays;
3545
3572
  /**
3546
3573
  * Renders the Deepdesk widget in a container element.
@@ -3552,10 +3579,11 @@ declare class DeepdeskSDK {
3552
3579
  * **Important:** Make sure to set the container element to a fixed or minimum size
3553
3580
  * (height and width) as the widget will grow to fill the container.
3554
3581
  *
3555
- * Also mounts dialog overlays (search command palette / CMD+K) so iframe-only
3556
- * integrations that never call {@link mount} still get search. Shared with `mount()` —
3557
- * only one overlays root exists per SDK instance. Does **not** mount `LoginOverlay`
3558
- * (iframe apps use their own sign-in); `mount()` still can.
3582
+ * Mounts dialog overlays (search command palette / CMD+K) only when
3583
+ * `options.mountSearchOverlay` is `true`, for iframe-only integrations that never call
3584
+ * {@link mount} and whose host page has no search box. Shared with `mount()` — only one
3585
+ * overlays root exists per SDK instance. Does **not** mount `LoginOverlay` (iframe apps
3586
+ * use their own sign-in); `mount()` still can.
3559
3587
  *
3560
3588
  * **Note:** Only one widget can be rendered per SDK instance.
3561
3589
  *
@@ -3566,6 +3594,7 @@ declare class DeepdeskSDK {
3566
3594
  * @param options.isEmbedded - Whether the widget is embedded in another application
3567
3595
  * @param options.knowledgeAssist - Knowledge assistant configuration
3568
3596
  * @param options.assistantOptions - Assistant evaluation options
3597
+ * @param options.mountSearchOverlay - Mount a search box inside the widget's frame (default: false)
3569
3598
  *
3570
3599
  * @example
3571
3600
  * ```typescript
@@ -3873,6 +3902,8 @@ declare function waitForElementVisibilityChange(element: HTMLElement, callback:
3873
3902
  isVisible: boolean;
3874
3903
  }) => void, interval?: number): Cancelable;
3875
3904
 
3905
+ declare function clearWidgetAssistantSessionId(externalConversationId: string | undefined): void;
3906
+
3876
3907
  type LogEvent<T extends keyof SendEventArgumentMap, P extends T = T> = {
3877
3908
  name: T;
3878
3909
  data: SendEventArgumentMap[P]['data'];
@@ -3882,4 +3913,4 @@ declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<
3882
3913
  type CSSModule = Record<string, string>;
3883
3914
  declare function useStyles<TStyles extends CSSModule>(componentName: string, defaultStyles: TStyles): TStyles;
3884
3915
 
3885
- 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, 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 };
3916
+ 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, TextAreaInput, type TextSuggestion, ToggleButton, type UrlSuggestion, type VisitorInfo, type WidgetCustomStyles, type WidgetOptions, attachFile, authenticateWithKey, clearWidgetAssistantSessionId, createFullRange, createOverlayContainer, createRangeFromOffsets, escapeHTML, formatTextMarkup, getRangeOffsets, getRangeText, insertCKEditor, isHTML, isSupportedInputElement, logEvent, updateContentEditable, updateTextArea, useClickOutsideRoot, useStyles, waitForElementVisibilityChange };