@deepdesk/deepdesk-sdk 14.3.1-beta.9 → 15.0.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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { FC, HTMLAttributes, ForwardRefExoticComponent, RefAttributes, ReactNode, SyntheticEvent } from 'react';
2
2
  import * as redux from 'redux';
3
+ import { Unsubscribe } from 'redux';
3
4
  import * as _reduxjs_toolkit_dist_configureStore from '@reduxjs/toolkit/dist/configureStore';
4
5
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
5
6
  import { Middleware } from '@reduxjs/toolkit';
@@ -287,6 +288,7 @@ declare abstract class InputMediator<HTMLElementType extends HTMLElement> {
287
288
  focus(): void;
288
289
  emit<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputHandler<K>>): void;
289
290
  on<K extends keyof InputEventMap>(type: K, handler: InputHandler<K>): void;
291
+ off<K extends keyof InputEventMap>(type: K, handler: InputHandler<K>): void;
290
292
  activate(): void;
291
293
  deactivate(): void;
292
294
  dispose(): void;
@@ -924,6 +926,15 @@ type SendEventV2ArgumentMap = {
924
926
  question: string;
925
927
  sourceViewed: string;
926
928
  }>;
929
+ 'summary feedback': EventV2<{
930
+ summary: string;
931
+ rating: 'up' | 'down';
932
+ }>;
933
+ 'summary copied to clipboard': EventV2<{
934
+ originalText: string;
935
+ finalText: string;
936
+ assistant: string;
937
+ }>;
927
938
  };
928
939
  /**
929
940
  * Request retry options
@@ -1284,12 +1295,14 @@ type State$d = {
1284
1295
 
1285
1296
  type LegacyCue$1 = CamelCaseKeys<Server.LegacyCue> & {
1286
1297
  isLoading?: boolean;
1298
+ specialType?: 'summary';
1287
1299
  };
1288
1300
 
1289
1301
  type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
1290
1302
  type ArrayItemType<T> = T extends Array<infer I> ? I : never;
1291
1303
  type Cue = ArrayItemType<EvaluationOutput<'json-schema:cues'>> & {
1292
1304
  isLoading?: boolean;
1305
+ specialType?: 'summary';
1293
1306
  };
1294
1307
  type AssistantAnswerSource = {
1295
1308
  url?: string;
@@ -1394,6 +1407,8 @@ declare const reducers: redux.Reducer<redux.CombinedState<{
1394
1407
  insertLink: boolean;
1395
1408
  inlineSuggestions: boolean;
1396
1409
  floatingMenu: boolean;
1410
+ detectSubmit: boolean;
1411
+ automaticHandlingTime: boolean;
1397
1412
  adminUrl?: string | undefined;
1398
1413
  productName: string;
1399
1414
  enableSuggestionFeedback: boolean;
@@ -1455,6 +1470,8 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configu
1455
1470
  insertLink: boolean;
1456
1471
  inlineSuggestions: boolean;
1457
1472
  floatingMenu: boolean;
1473
+ detectSubmit: boolean;
1474
+ automaticHandlingTime: boolean;
1458
1475
  adminUrl?: string | undefined;
1459
1476
  productName: string;
1460
1477
  enableSuggestionFeedback: boolean;
@@ -1515,6 +1532,8 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configu
1515
1532
  insertLink: boolean;
1516
1533
  inlineSuggestions: boolean;
1517
1534
  floatingMenu: boolean;
1535
+ detectSubmit: boolean;
1536
+ automaticHandlingTime: boolean;
1518
1537
  adminUrl?: string | undefined;
1519
1538
  productName: string;
1520
1539
  enableSuggestionFeedback: boolean;
@@ -1919,12 +1938,15 @@ type State = {
1919
1938
  insertLink: boolean;
1920
1939
  inlineSuggestions: boolean;
1921
1940
  floatingMenu: boolean;
1941
+ detectSubmit: boolean;
1942
+ automaticHandlingTime: boolean;
1922
1943
  adminUrl?: string;
1923
1944
  productName: string;
1924
1945
  enableSuggestionFeedback: boolean;
1925
1946
  enableFeedbackForm: boolean;
1926
1947
  hasKeyboardInput: boolean;
1927
1948
  };
1949
+ type Settings = State;
1928
1950
  declare const set: _reduxjs_toolkit.ActionCreatorWithPayload<Partial<State>, "settings/set">;
1929
1951
 
1930
1952
  declare global {
@@ -1977,35 +1999,23 @@ interface SDKEventMap {
1977
1999
  showSearchOverlay: boolean;
1978
2000
  }
1979
2001
  type SDKHandler<K extends keyof SDKEventMap> = (eventPayload: SDKEventMap[K]) => void;
1980
- interface MountOptions {
2002
+ interface RenderOptions {
1981
2003
  customStyles?: InputOverlayCustomStyles & {
1982
2004
  rootNode?: string;
1983
2005
  suggestionsRootNode?: string;
1984
2006
  portalRootNode?: string;
1985
- floatingMenuRootNode?: string;
2007
+ floatingMenuParent?: string;
1986
2008
  };
1987
2009
  closestScrollSelector?: string;
1988
- automaticHandlingTime?: boolean;
1989
- showStyleSuggestions?: boolean;
1990
- showTabCompletion?: boolean;
1991
- showTextSuggestions?: boolean;
1992
- showMidSentenceSuggestions?: boolean;
1993
- showSuggestionsBeforePattern?: string | false;
1994
- showSuggestionsAfterPattern?: string | false;
1995
- textSuggestionsCount?: number;
1996
- detectSubmit?: boolean;
1997
- insertLink?: boolean;
1998
- isEmbedded?: boolean;
2010
+ floatingMenuParent?: HTMLElement;
1999
2011
  /**
2000
2012
  * By default append overlay to target.parentElement
2001
2013
  * Optionally append to different HTMLElement, for example `document.body`
2002
2014
  */
2003
2015
  appendOverlayTo?: HTMLElement;
2004
2016
  inputMediator?: InputMediator<HTMLElement>;
2005
- inlineSuggestions?: boolean;
2006
- floatingMenu?: boolean | {
2007
- appendOverlayTo?: HTMLElement;
2008
- };
2017
+ }
2018
+ interface MountOptions extends Partial<Settings>, RenderOptions {
2009
2019
  }
2010
2020
  interface WidgetOptions {
2011
2021
  customStyles?: WidgetCustomStyles;
@@ -2021,6 +2031,9 @@ declare class DeepdeskSDK {
2021
2031
  private broadcastEvents;
2022
2032
  private eventListeners;
2023
2033
  private unmountHandlers;
2034
+ private inlineSuggestions;
2035
+ private aboveSuggestions;
2036
+ private floatingMenu;
2024
2037
  private widgetRoot;
2025
2038
  private dynamicThunkObject;
2026
2039
  isMounted: boolean;
@@ -2070,6 +2083,8 @@ declare class DeepdeskSDK {
2070
2083
  insertLink: boolean;
2071
2084
  inlineSuggestions: boolean;
2072
2085
  floatingMenu: boolean;
2086
+ detectSubmit: boolean;
2087
+ automaticHandlingTime: boolean;
2073
2088
  adminUrl?: string | undefined;
2074
2089
  productName: string;
2075
2090
  enableSuggestionFeedback: boolean;
@@ -2113,6 +2128,8 @@ declare class DeepdeskSDK {
2113
2128
  insertLink: boolean;
2114
2129
  inlineSuggestions: boolean;
2115
2130
  floatingMenu: boolean;
2131
+ detectSubmit: boolean;
2132
+ automaticHandlingTime: boolean;
2116
2133
  adminUrl?: string | undefined;
2117
2134
  productName: string;
2118
2135
  enableSuggestionFeedback: boolean;
@@ -2275,7 +2292,13 @@ declare class DeepdeskSDK {
2275
2292
  * @param options - optional mount options
2276
2293
  */
2277
2294
  mount(inputElement: HTMLElement, options?: MountOptions): void;
2295
+ subscribe<T>(selector: (state: RootState) => T, callback: (value: T) => void): Unsubscribe;
2278
2296
  unmount(): void;
2297
+ private renderSuggestions;
2298
+ private renderInlineSuggestions;
2299
+ private renderAboveSuggestions;
2300
+ private renderFloatingMenu;
2301
+ private renderOverlays;
2279
2302
  /**
2280
2303
  * Injects the Deepdesk Widget element into the provided DOM element.
2281
2304
  * @param containerElement - the element to inject the deepdesk element in
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { FC, HTMLAttributes, ForwardRefExoticComponent, RefAttributes, ReactNode, SyntheticEvent } from 'react';
2
2
  import * as redux from 'redux';
3
+ import { Unsubscribe } from 'redux';
3
4
  import * as _reduxjs_toolkit_dist_configureStore from '@reduxjs/toolkit/dist/configureStore';
4
5
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
5
6
  import { Middleware } from '@reduxjs/toolkit';
@@ -287,6 +288,7 @@ declare abstract class InputMediator<HTMLElementType extends HTMLElement> {
287
288
  focus(): void;
288
289
  emit<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputHandler<K>>): void;
289
290
  on<K extends keyof InputEventMap>(type: K, handler: InputHandler<K>): void;
291
+ off<K extends keyof InputEventMap>(type: K, handler: InputHandler<K>): void;
290
292
  activate(): void;
291
293
  deactivate(): void;
292
294
  dispose(): void;
@@ -924,6 +926,15 @@ type SendEventV2ArgumentMap = {
924
926
  question: string;
925
927
  sourceViewed: string;
926
928
  }>;
929
+ 'summary feedback': EventV2<{
930
+ summary: string;
931
+ rating: 'up' | 'down';
932
+ }>;
933
+ 'summary copied to clipboard': EventV2<{
934
+ originalText: string;
935
+ finalText: string;
936
+ assistant: string;
937
+ }>;
927
938
  };
928
939
  /**
929
940
  * Request retry options
@@ -1284,12 +1295,14 @@ type State$d = {
1284
1295
 
1285
1296
  type LegacyCue$1 = CamelCaseKeys<Server.LegacyCue> & {
1286
1297
  isLoading?: boolean;
1298
+ specialType?: 'summary';
1287
1299
  };
1288
1300
 
1289
1301
  type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
1290
1302
  type ArrayItemType<T> = T extends Array<infer I> ? I : never;
1291
1303
  type Cue = ArrayItemType<EvaluationOutput<'json-schema:cues'>> & {
1292
1304
  isLoading?: boolean;
1305
+ specialType?: 'summary';
1293
1306
  };
1294
1307
  type AssistantAnswerSource = {
1295
1308
  url?: string;
@@ -1394,6 +1407,8 @@ declare const reducers: redux.Reducer<redux.CombinedState<{
1394
1407
  insertLink: boolean;
1395
1408
  inlineSuggestions: boolean;
1396
1409
  floatingMenu: boolean;
1410
+ detectSubmit: boolean;
1411
+ automaticHandlingTime: boolean;
1397
1412
  adminUrl?: string | undefined;
1398
1413
  productName: string;
1399
1414
  enableSuggestionFeedback: boolean;
@@ -1455,6 +1470,8 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configu
1455
1470
  insertLink: boolean;
1456
1471
  inlineSuggestions: boolean;
1457
1472
  floatingMenu: boolean;
1473
+ detectSubmit: boolean;
1474
+ automaticHandlingTime: boolean;
1458
1475
  adminUrl?: string | undefined;
1459
1476
  productName: string;
1460
1477
  enableSuggestionFeedback: boolean;
@@ -1515,6 +1532,8 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configu
1515
1532
  insertLink: boolean;
1516
1533
  inlineSuggestions: boolean;
1517
1534
  floatingMenu: boolean;
1535
+ detectSubmit: boolean;
1536
+ automaticHandlingTime: boolean;
1518
1537
  adminUrl?: string | undefined;
1519
1538
  productName: string;
1520
1539
  enableSuggestionFeedback: boolean;
@@ -1919,12 +1938,15 @@ type State = {
1919
1938
  insertLink: boolean;
1920
1939
  inlineSuggestions: boolean;
1921
1940
  floatingMenu: boolean;
1941
+ detectSubmit: boolean;
1942
+ automaticHandlingTime: boolean;
1922
1943
  adminUrl?: string;
1923
1944
  productName: string;
1924
1945
  enableSuggestionFeedback: boolean;
1925
1946
  enableFeedbackForm: boolean;
1926
1947
  hasKeyboardInput: boolean;
1927
1948
  };
1949
+ type Settings = State;
1928
1950
  declare const set: _reduxjs_toolkit.ActionCreatorWithPayload<Partial<State>, "settings/set">;
1929
1951
 
1930
1952
  declare global {
@@ -1977,35 +1999,23 @@ interface SDKEventMap {
1977
1999
  showSearchOverlay: boolean;
1978
2000
  }
1979
2001
  type SDKHandler<K extends keyof SDKEventMap> = (eventPayload: SDKEventMap[K]) => void;
1980
- interface MountOptions {
2002
+ interface RenderOptions {
1981
2003
  customStyles?: InputOverlayCustomStyles & {
1982
2004
  rootNode?: string;
1983
2005
  suggestionsRootNode?: string;
1984
2006
  portalRootNode?: string;
1985
- floatingMenuRootNode?: string;
2007
+ floatingMenuParent?: string;
1986
2008
  };
1987
2009
  closestScrollSelector?: string;
1988
- automaticHandlingTime?: boolean;
1989
- showStyleSuggestions?: boolean;
1990
- showTabCompletion?: boolean;
1991
- showTextSuggestions?: boolean;
1992
- showMidSentenceSuggestions?: boolean;
1993
- showSuggestionsBeforePattern?: string | false;
1994
- showSuggestionsAfterPattern?: string | false;
1995
- textSuggestionsCount?: number;
1996
- detectSubmit?: boolean;
1997
- insertLink?: boolean;
1998
- isEmbedded?: boolean;
2010
+ floatingMenuParent?: HTMLElement;
1999
2011
  /**
2000
2012
  * By default append overlay to target.parentElement
2001
2013
  * Optionally append to different HTMLElement, for example `document.body`
2002
2014
  */
2003
2015
  appendOverlayTo?: HTMLElement;
2004
2016
  inputMediator?: InputMediator<HTMLElement>;
2005
- inlineSuggestions?: boolean;
2006
- floatingMenu?: boolean | {
2007
- appendOverlayTo?: HTMLElement;
2008
- };
2017
+ }
2018
+ interface MountOptions extends Partial<Settings>, RenderOptions {
2009
2019
  }
2010
2020
  interface WidgetOptions {
2011
2021
  customStyles?: WidgetCustomStyles;
@@ -2021,6 +2031,9 @@ declare class DeepdeskSDK {
2021
2031
  private broadcastEvents;
2022
2032
  private eventListeners;
2023
2033
  private unmountHandlers;
2034
+ private inlineSuggestions;
2035
+ private aboveSuggestions;
2036
+ private floatingMenu;
2024
2037
  private widgetRoot;
2025
2038
  private dynamicThunkObject;
2026
2039
  isMounted: boolean;
@@ -2070,6 +2083,8 @@ declare class DeepdeskSDK {
2070
2083
  insertLink: boolean;
2071
2084
  inlineSuggestions: boolean;
2072
2085
  floatingMenu: boolean;
2086
+ detectSubmit: boolean;
2087
+ automaticHandlingTime: boolean;
2073
2088
  adminUrl?: string | undefined;
2074
2089
  productName: string;
2075
2090
  enableSuggestionFeedback: boolean;
@@ -2113,6 +2128,8 @@ declare class DeepdeskSDK {
2113
2128
  insertLink: boolean;
2114
2129
  inlineSuggestions: boolean;
2115
2130
  floatingMenu: boolean;
2131
+ detectSubmit: boolean;
2132
+ automaticHandlingTime: boolean;
2116
2133
  adminUrl?: string | undefined;
2117
2134
  productName: string;
2118
2135
  enableSuggestionFeedback: boolean;
@@ -2275,7 +2292,13 @@ declare class DeepdeskSDK {
2275
2292
  * @param options - optional mount options
2276
2293
  */
2277
2294
  mount(inputElement: HTMLElement, options?: MountOptions): void;
2295
+ subscribe<T>(selector: (state: RootState) => T, callback: (value: T) => void): Unsubscribe;
2278
2296
  unmount(): void;
2297
+ private renderSuggestions;
2298
+ private renderInlineSuggestions;
2299
+ private renderAboveSuggestions;
2300
+ private renderFloatingMenu;
2301
+ private renderOverlays;
2279
2302
  /**
2280
2303
  * Injects the Deepdesk Widget element into the provided DOM element.
2281
2304
  * @param containerElement - the element to inject the deepdesk element in