@deepdesk/deepdesk-sdk 18.2.1-beta.2 → 18.2.1-beta.21

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.ts CHANGED
@@ -4,7 +4,6 @@ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
4
4
  import { Middleware, Tuple } from '@reduxjs/toolkit';
5
5
  import * as redux from 'redux';
6
6
  import { Unsubscribe } from 'redux';
7
- import * as redux_thunk from 'redux-thunk';
8
7
 
9
8
  declare const styles$s: {
10
9
  readonly "content": string;
@@ -101,6 +100,8 @@ declare const styles$n: {
101
100
  readonly "actionsIsFixed": string;
102
101
  readonly "button": string;
103
102
  readonly "buttonDisabled": string;
103
+ readonly "buttonPrimary": string;
104
+ readonly "buttonSecondary": string;
104
105
  readonly "buttonWithIcon": string;
105
106
  readonly "buttonsContainer": string;
106
107
  readonly "dropdownButton": string;
@@ -126,8 +127,9 @@ interface ButtonProps<T extends React.ElementType> {
126
127
  title?: string;
127
128
  icon?: ReactNode;
128
129
  disabled?: boolean;
130
+ variant?: 'primary' | 'secondary';
129
131
  }
130
- declare function Button<T extends React.ElementType = 'button'>({ as, className, icon, title, children, disabled, ...restProps }: ButtonProps<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonProps<T>>): react_jsx_runtime.JSX.Element;
132
+ declare function Button<T extends React.ElementType = 'button'>({ as, className, icon, title, children, disabled, variant, ...restProps }: ButtonProps<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonProps<T>>): react_jsx_runtime.JSX.Element;
131
133
  declare const ButtonsContainer: React.FC<{
132
134
  children: React.ReactNode;
133
135
  }>;
@@ -407,15 +409,13 @@ declare enum FetchState {
407
409
  type LegacyCue = CamelCaseKeys<Server.LegacyCue> & {
408
410
  isLoading?: boolean;
409
411
  editable?: boolean;
410
- specialType?: 'summary';
411
412
  evaluationId: string;
412
413
  };
413
414
 
414
- type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
415
+ type EvaluationOutput = CamelCaseKeys<Server.EvaluationOutput>;
415
416
  type ArrayItemType<T> = T extends Array<infer I> ? I : never;
416
- type Cue = ArrayItemType<EvaluationOutput<'json-schema:cues'>> & {
417
+ type Cue = ArrayItemType<EvaluationOutput> & {
417
418
  isLoading?: boolean;
418
- specialType?: 'summary';
419
419
  evaluationId: string;
420
420
  };
421
421
  type AssistantAnswerSource = {
@@ -447,9 +447,7 @@ interface EvaluateInput {
447
447
  transcript?: TranscriptOption;
448
448
  includeMetadata?: boolean;
449
449
  skipState?: boolean;
450
- expectFormat: Server.ResponseFormat;
451
450
  }
452
- type SummaryInput = Omit<EvaluateInput, 'expectFormat'>;
453
451
 
454
452
  type Fetch = typeof window.fetch;
455
453
  type HTTPClientOptions = {
@@ -674,7 +672,6 @@ declare namespace Server {
674
672
  event: string;
675
673
  value?: string;
676
674
  }
677
- type ResponseFormat = 'text' | 'json-object' | 'json-schema:cues' | 'json-schema:knowledge-assist';
678
675
  interface LegacyCue {
679
676
  text: string;
680
677
  title: string;
@@ -688,24 +685,22 @@ declare namespace Server {
688
685
  MAX_RECURSION_LEVEL = "max_recursion_level",
689
686
  NO_ACCESS_TO_ASSISTANT = "no_access_to_assistant"
690
687
  }
691
- type EvaluationResponse<Output extends ResponseFormat> = {
688
+ type EvaluationResponse = {
692
689
  evaluation_id: string;
693
690
  evaluation_status: EvaluationStatus;
694
- output: EvaluationOutput<Output>;
691
+ output: EvaluationOutput;
695
692
  };
696
- type EvaluationOutput<T extends ResponseFormat> = T extends 'text' ? string : T extends 'json-object' ? unknown : T extends 'json-schema:cues' ? Array<{
693
+ type EvaluationOutput = Array<{
697
694
  code: string;
698
695
  name: string;
699
696
  response: string;
700
697
  editable?: boolean;
701
698
  call_to_action?: CallToAction;
702
- }> : T extends 'json-schema:knowledge-assist' ? {
703
- response: string;
704
699
  sources?: {
705
700
  name: string;
706
701
  url: string;
707
702
  }[];
708
- } : never;
703
+ }>;
709
704
  /**
710
705
  * Handling time event data
711
706
  */
@@ -1128,10 +1123,6 @@ declare class DeepdeskAPI {
1128
1123
  * Search
1129
1124
  */
1130
1125
  search(params: SearchOptions): Promise<CamelCaseKeys<Server.SearchResultsData>>;
1131
- knowledgeAssist(request: CamelCaseKeys<Server.KnowledgeRequest>, chatHistory: Server.KnowledgeResponse[], assistantCode: string, meta?: {
1132
- agentId?: string;
1133
- conversationId?: string;
1134
- }): Promise<CamelCaseKeys<Server.KnowledgeResponse['answer']>>;
1135
1126
  requestLoginByEmail(email: string): Promise<{
1136
1127
  code: string;
1137
1128
  message: string;
@@ -1141,8 +1132,7 @@ declare class DeepdeskAPI {
1141
1132
  verifyLoginToken(token: string): Promise<{
1142
1133
  isLoggedIn: boolean;
1143
1134
  }>;
1144
- evaluateAssistant<TOutput extends Server.ResponseFormat = 'text', TInput = Record<string, unknown>>(assistantCode: string, options?: {
1145
- expectFormat: TOutput;
1135
+ evaluateAssistant<TInput = Record<string, unknown>>(assistantCode: string, options?: {
1146
1136
  threadId?: number;
1147
1137
  input: TInput;
1148
1138
  transcript?: Array<{
@@ -1150,7 +1140,7 @@ declare class DeepdeskAPI {
1150
1140
  text: string;
1151
1141
  }>;
1152
1142
  externalConversationId?: string;
1153
- }): Promise<CamelCaseKeys<Server.EvaluationResponse<TOutput>>>;
1143
+ }): Promise<CamelCaseKeys<Server.EvaluationResponse>>;
1154
1144
  createAssistantThread(init: {
1155
1145
  assistantCode: string;
1156
1146
  }): Promise<{
@@ -1333,6 +1323,7 @@ interface State$2 {
1333
1323
  loginFetchState: FetchState;
1334
1324
  verifyFetchState: FetchState;
1335
1325
  showLoginOverlay: boolean;
1326
+ loginError: string | null;
1336
1327
  }
1337
1328
 
1338
1329
  type State$1 = {
@@ -1361,6 +1352,7 @@ declare const reducers: redux.Reducer<{
1361
1352
  customData?: CustomData;
1362
1353
  platformVariables?: VariableMapping;
1363
1354
  fetchState: FetchState;
1355
+ showNicknameDialog: boolean;
1364
1356
  };
1365
1357
  input: State$7;
1366
1358
  settings: {
@@ -1385,6 +1377,7 @@ declare const reducers: redux.Reducer<{
1385
1377
  searchTriggerKey: string;
1386
1378
  visible: boolean;
1387
1379
  insertLink: boolean;
1380
+ addToPersonalCollection: boolean;
1388
1381
  inlineSuggestions: boolean;
1389
1382
  suggestionsPlacement: "inline" | "above" | "below";
1390
1383
  floatingMenu: boolean;
@@ -1422,6 +1415,7 @@ declare const reducers: redux.Reducer<{
1422
1415
  customData?: CustomData;
1423
1416
  platformVariables?: VariableMapping;
1424
1417
  fetchState: FetchState;
1418
+ showNicknameDialog: boolean;
1425
1419
  } | undefined;
1426
1420
  input: State$7 | undefined;
1427
1421
  settings: {
@@ -1446,6 +1440,7 @@ declare const reducers: redux.Reducer<{
1446
1440
  searchTriggerKey: string;
1447
1441
  visible: boolean;
1448
1442
  insertLink: boolean;
1443
+ addToPersonalCollection: boolean;
1449
1444
  inlineSuggestions: boolean;
1450
1445
  suggestionsPlacement: "inline" | "above" | "below";
1451
1446
  floatingMenu: boolean;
@@ -1484,6 +1479,7 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStor
1484
1479
  customData?: CustomData;
1485
1480
  platformVariables?: VariableMapping;
1486
1481
  fetchState: FetchState;
1482
+ showNicknameDialog: boolean;
1487
1483
  };
1488
1484
  input: State$7;
1489
1485
  settings: {
@@ -1508,6 +1504,7 @@ declare function createStore(config: StoreConfig): _reduxjs_toolkit.EnhancedStor
1508
1504
  searchTriggerKey: string;
1509
1505
  visible: boolean;
1510
1506
  insertLink: boolean;
1507
+ addToPersonalCollection: boolean;
1511
1508
  inlineSuggestions: boolean;
1512
1509
  suggestionsPlacement: "inline" | "above" | "below";
1513
1510
  floatingMenu: boolean;
@@ -1731,6 +1728,9 @@ declare const styles$5: {
1731
1728
  readonly "hintsHidden": string;
1732
1729
  readonly "isCollapsed": string;
1733
1730
  readonly "isInline": string;
1731
+ readonly "loginError": string;
1732
+ readonly "loginErrorDismiss": string;
1733
+ readonly "loginErrorMessage": string;
1734
1734
  readonly "root": string;
1735
1735
  readonly "toggleButton": string;
1736
1736
  readonly "toggleButtonWrapper": string;
@@ -1892,6 +1892,7 @@ type State = {
1892
1892
  searchTriggerKey: string;
1893
1893
  visible: boolean;
1894
1894
  insertLink: boolean;
1895
+ addToPersonalCollection: boolean;
1895
1896
  inlineSuggestions: boolean;
1896
1897
  suggestionsPlacement: 'inline' | 'above' | 'below';
1897
1898
  floatingMenu: boolean;
@@ -1961,10 +1962,6 @@ interface SDKEventMap {
1961
1962
  selectionAfter: SelectionRange;
1962
1963
  };
1963
1964
  cues: LegacyCue[];
1964
- replace: {
1965
- text: string;
1966
- replace: SelectionRange;
1967
- };
1968
1965
  'select-image': {
1969
1966
  suggestion: TextSuggestion;
1970
1967
  };
@@ -2020,7 +2017,6 @@ interface WidgetOptions {
2020
2017
  }
2021
2018
  interface KnowledgeAssistantWidgetOptions extends KnowledgeAssistOptions {
2022
2019
  customStyles?: WidgetCustomStyles;
2023
- isLegacyKnowledgeAssist?: boolean;
2024
2020
  title?: string;
2025
2021
  }
2026
2022
  declare class DeepdeskSDK {
@@ -2039,6 +2035,8 @@ declare class DeepdeskSDK {
2039
2035
  private floatingMenu;
2040
2036
  private widgetElement;
2041
2037
  private widgetRoot;
2038
+ private nicknameDialogUnsubscribe;
2039
+ private nicknameDialogFailed;
2042
2040
  private dynamicThunkObject;
2043
2041
  private queues;
2044
2042
  isMounted: boolean;
@@ -2093,6 +2091,7 @@ declare class DeepdeskSDK {
2093
2091
  customData?: CustomData;
2094
2092
  platformVariables?: VariableMapping;
2095
2093
  fetchState: FetchState;
2094
+ showNicknameDialog: boolean;
2096
2095
  };
2097
2096
  input: State$7;
2098
2097
  settings: {
@@ -2117,6 +2116,7 @@ declare class DeepdeskSDK {
2117
2116
  searchTriggerKey: string;
2118
2117
  visible: boolean;
2119
2118
  insertLink: boolean;
2119
+ addToPersonalCollection: boolean;
2120
2120
  inlineSuggestions: boolean;
2121
2121
  suggestionsPlacement: "inline" | "above" | "below";
2122
2122
  floatingMenu: boolean;
@@ -2162,6 +2162,7 @@ declare class DeepdeskSDK {
2162
2162
  searchTriggerKey: string;
2163
2163
  visible: boolean;
2164
2164
  insertLink: boolean;
2165
+ addToPersonalCollection: boolean;
2165
2166
  inlineSuggestions: boolean;
2166
2167
  suggestionsPlacement: "inline" | "above" | "below";
2167
2168
  floatingMenu: boolean;
@@ -2752,7 +2753,6 @@ declare class DeepdeskSDK {
2752
2753
  *
2753
2754
  * @param assistantCode - The assistant code to evaluate
2754
2755
  * @param options - Evaluation options
2755
- * @param options.expectFormat - Expected response format ('json-schema:cues', 'json-schema:knowledge-assist', 'text', 'json-object')
2756
2756
  * @param options.input - Additional input data for the assistant
2757
2757
  * @param options.transcript - Transcript option ('in-memory-transcript' or custom transcript)
2758
2758
  * @param options.includeMetadata - Whether to include metadata in the response
@@ -2763,7 +2763,6 @@ declare class DeepdeskSDK {
2763
2763
  * ```typescript
2764
2764
  * // Evaluate assistant with cues format
2765
2765
  * const result = await sdk.evaluateAssistant('assistant-code-123', {
2766
- * expectFormat: 'json-schema:cues',
2767
2766
  * input: {
2768
2767
  * customerType: 'premium',
2769
2768
  * issueType: 'technical'
@@ -2772,7 +2771,6 @@ declare class DeepdeskSDK {
2772
2771
  *
2773
2772
  * // Evaluate with custom transcript
2774
2773
  * const result = await sdk.evaluateAssistant('assistant-code-456', {
2775
- * expectFormat: 'text',
2776
2774
  * transcript: [
2777
2775
  * { source: 'visitor', text: 'I have a problem with my order' },
2778
2776
  * { source: 'agent', text: 'I can help you with that' }
@@ -2786,13 +2784,12 @@ declare class DeepdeskSDK {
2786
2784
  * });
2787
2785
  * ```
2788
2786
  */
2789
- evaluateAssistant<T extends Server.ResponseFormat = 'json-schema:cues'>(assistantCode: string, options?: {
2790
- expectFormat?: T;
2787
+ evaluateAssistant(assistantCode: string, options?: {
2791
2788
  input?: Record<string, any>;
2792
2789
  transcript?: TranscriptOption;
2793
2790
  includeMetadata?: boolean;
2794
2791
  showCuesInWidget?: boolean;
2795
- }): Promise<EvaluationOutput<T> | string>;
2792
+ }): Promise<EvaluationOutput | string>;
2796
2793
  /**
2797
2794
  * Evaluates conversation lifecycle assistants.
2798
2795
  *
@@ -2839,52 +2836,6 @@ declare class DeepdeskSDK {
2839
2836
  includeMetadata?: boolean;
2840
2837
  showCuesInWidget?: boolean;
2841
2838
  }): Promise<void>;
2842
- /**
2843
- * @deprecated Specific 'Summarizer' assistants are deprecated.
2844
- *
2845
- * Generates a summary of the current conversation.
2846
- *
2847
- * This method uses the summarizer assistant configured in the profile to
2848
- * generate a concise summary of the current conversation. It assumes that
2849
- * `setConversationQuery()` has been called before this method and will
2850
- * throw an error if this is not the case.
2851
- *
2852
- * @param args - Summary generation options
2853
- * @param args.includeMetadata - Whether to include metadata in the summary
2854
- * @param args.transcript - Custom transcript to use (optional)
2855
- * @returns Promise that resolves to the summary text or null if no summarizer is configured
2856
- *
2857
- * @example
2858
- * ```typescript
2859
- * // Set up conversation query first
2860
- * sdk.setConversationQuery(async () => {
2861
- * return [
2862
- * { source: 'visitor', text: 'I have a problem with my order' },
2863
- * { source: 'agent', text: 'I can help you with that' },
2864
- * { source: 'visitor', text: 'My order number is 12345' }
2865
- * ];
2866
- * });
2867
- *
2868
- * // Generate summary
2869
- * const summary = await sdk.getSummary();
2870
- * console.log('Conversation summary:', summary);
2871
- *
2872
- * // Generate summary with metadata
2873
- * const summaryWithMetadata = await sdk.getSummary({
2874
- * includeMetadata: true
2875
- * });
2876
- *
2877
- * // Generate summary with custom transcript
2878
- * const customSummary = await sdk.getSummary({
2879
- * transcript: [
2880
- * { source: 'visitor', text: 'Custom conversation data' },
2881
- * { source: 'agent', text: 'Agent response' }
2882
- * ]
2883
- * });
2884
- * ```
2885
- *
2886
- */
2887
- getSummary(args?: Omit<SummaryInput, 'assistantCode'>): Promise<string | null>;
2888
2839
  private handleKeyDown;
2889
2840
  private handleAfterSendMessage;
2890
2841
  /**
@@ -3059,9 +3010,6 @@ declare class DeepdeskSDK {
3059
3010
  * text: msg.content
3060
3011
  * }));
3061
3012
  * });
3062
- *
3063
- * // Now you can use features that require setConversationQuery to be set
3064
- * const summary = await sdk.getSummary();
3065
3013
  * ```
3066
3014
  */
3067
3015
  setConversationQuery(fetchFn: () => Promise<Array<{
@@ -3178,6 +3126,7 @@ declare class DeepdeskSDK {
3178
3126
  * @throws {Error} If the input element is not a supported type (textarea or contentEditable div)
3179
3127
  */
3180
3128
  mount(inputElement: HTMLElement, options?: MountOptions): void;
3129
+ private promptForNickname;
3181
3130
  /**
3182
3131
  * Subscribes to internal state changes.
3183
3132
  *
@@ -3329,7 +3278,6 @@ declare class DeepdeskSDK {
3329
3278
  * @param options.customStyles - Custom styling for the widget
3330
3279
  * @param options.initialQuestion - Initial question to display
3331
3280
  * @param options.emptyState - Custom empty state configuration
3332
- * @param options.isLegacyKnowledgeAssist - Whether to use legacy knowledge assistant (default: false)
3333
3281
  * @param options.title - Custom title for the widget
3334
3282
  * @returns Object with unmount function to clean up the widget
3335
3283
  *
@@ -3558,16 +3506,7 @@ type LogEvent<T extends keyof SendEventArgumentMap, P extends T = T> = {
3558
3506
  name: T;
3559
3507
  data: SendEventArgumentMap[P]['data'];
3560
3508
  };
3561
- declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<T>): _reduxjs_toolkit.AsyncThunkAction<void, LogEvent<T, T>, {
3562
- state?: unknown;
3563
- dispatch?: redux_thunk.ThunkDispatch<unknown, unknown, redux.UnknownAction>;
3564
- extra?: unknown;
3565
- rejectValue?: unknown;
3566
- serializedErrorType?: unknown;
3567
- pendingMeta?: unknown;
3568
- fulfilledMeta?: unknown;
3569
- rejectedMeta?: unknown;
3570
- }>;
3509
+ declare function logEvent<T extends keyof SendEventArgumentMap>(event: LogEvent<T>): _reduxjs_toolkit.AsyncThunkAction<void, LogEvent<T, T>, _reduxjs_toolkit.AsyncThunkConfig>;
3571
3510
 
3572
3511
  type CSSModule = Record<string, string>;
3573
3512
  declare function useStyles<TStyles extends CSSModule>(componentName: string, defaultStyles: TStyles): TStyles;