@deepdesk/deepdesk-sdk 18.0.2 → 18.0.3-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
@@ -896,6 +896,7 @@ type RuleEventMeta = {
896
896
  name: string;
897
897
  description: string;
898
898
  group: string;
899
+ evaluationId: string;
899
900
  };
900
901
  /**
901
902
  * Map the send event name to the data value in the payload
@@ -1127,7 +1128,10 @@ declare class DeepdeskAPI {
1127
1128
  text: string;
1128
1129
  }>;
1129
1130
  externalConversationId?: string;
1130
- }): Promise<CamelCaseKeys<Server.EvaluationOutput<TOutput>>>;
1131
+ }): Promise<CamelCaseKeys<{
1132
+ evaluation_id: string;
1133
+ output: Server.EvaluationOutput<TOutput>;
1134
+ }>>;
1131
1135
  createAssistantThread(init: {
1132
1136
  assistantCode: string;
1133
1137
  }): Promise<{
@@ -1316,6 +1320,7 @@ type LegacyCue = CamelCaseKeys<Server.LegacyCue> & {
1316
1320
  isLoading?: boolean;
1317
1321
  editable?: boolean;
1318
1322
  specialType?: 'summary';
1323
+ evaluationId: string;
1319
1324
  };
1320
1325
 
1321
1326
  type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
@@ -1323,6 +1328,7 @@ type ArrayItemType<T> = T extends Array<infer I> ? I : never;
1323
1328
  type Cue = ArrayItemType<EvaluationOutput<'json-schema:cues'>> & {
1324
1329
  isLoading?: boolean;
1325
1330
  specialType?: 'summary';
1331
+ evaluationId: string;
1326
1332
  };
1327
1333
  type AssistantAnswerSource = {
1328
1334
  url?: string;
@@ -1334,6 +1340,7 @@ type AssistantInteraction = {
1334
1340
  answer: string;
1335
1341
  sources?: AssistantAnswerSource[];
1336
1342
  };
1343
+ evaluationId: string;
1337
1344
  };
1338
1345
  type State$2 = {
1339
1346
  cues: Cue[];
@@ -2066,6 +2073,7 @@ declare class DeepdeskSDK {
2066
2073
  private broadcastEvents;
2067
2074
  private eventListeners;
2068
2075
  private unmountHandlers;
2076
+ private disposeHandlers;
2069
2077
  private inlineSuggestions;
2070
2078
  private aboveSuggestions;
2071
2079
  private floatingMenu;
@@ -3133,6 +3141,7 @@ declare class DeepdeskSDK {
3133
3141
  setPlatformVariables(mapping: VariableMapping): void;
3134
3142
  /**
3135
3143
  * Registers a callback to be called when conversation is loaded.
3144
+ * Convenient wrapper around `subscribe`.
3136
3145
  *
3137
3146
  * This method allows you to register a callback function that will be executed
3138
3147
  * when a conversation is successfully loaded. The callback is called after
@@ -3141,6 +3150,8 @@ declare class DeepdeskSDK {
3141
3150
  * If a conversation is already loaded when this method is called, the callback
3142
3151
  * will be executed immediately.
3143
3152
  *
3153
+ * If the conversation changes, the callback will be called again.
3154
+ *
3144
3155
  * @param callback - Function to call when conversation loads
3145
3156
  *
3146
3157
  * @example
@@ -3151,7 +3162,7 @@ declare class DeepdeskSDK {
3151
3162
  * });
3152
3163
  * ```
3153
3164
  */
3154
- whenConversationLoaded(callback: () => void): void;
3165
+ whenConversationLoaded(callback: () => void): Unsubscribe;
3155
3166
  private overlayContainerFactory;
3156
3167
  private createInlineContainer;
3157
3168
  private createContainer;
@@ -3236,15 +3247,17 @@ declare class DeepdeskSDK {
3236
3247
  */
3237
3248
  subscribe<T>(selector: (state: RootState) => T, callback: (value: T) => void): Unsubscribe;
3238
3249
  /**
3239
- * Unmounts the SDK and cleans up all resources.
3250
+ * Unmounts the SDK and cleans up all resources related to the mount() method.
3240
3251
  *
3241
3252
  * This method removes all UI components, event listeners, and cleans up
3242
- * internal resources. It should be called when you're done using the SDK
3243
- * or when you need to remount it on a different element.
3253
+ * internal resources.
3244
3254
  *
3245
3255
  * After calling this method, the SDK instance can be reused by calling
3246
3256
  * `mount()` again on a new input element.
3247
3257
  *
3258
+ * **Important:** This method does not clean up all DeepdeskSDK resources.
3259
+ * Use `dispose()` to clean up all resources instead.
3260
+ *
3248
3261
  * @example
3249
3262
  * ```typescript
3250
3263
  * // Unmount when switching conversations
@@ -3252,6 +3265,19 @@ declare class DeepdeskSDK {
3252
3265
  * ```
3253
3266
  */
3254
3267
  unmount(): void;
3268
+ /**
3269
+ * Disposes of the DeepdeskSDK instance.
3270
+ *
3271
+ * This method removes all UI components, event listeners, and cleans up
3272
+ * internal resources. It should be called when you're done using the SDK.
3273
+ *
3274
+ * @example
3275
+ * ```typescript
3276
+ * // Dispose of DeepdeskSDK instance after conversation is unloaded
3277
+ * sdk.dispose();
3278
+ * ```
3279
+ */
3280
+ dispose(): void;
3255
3281
  private renderSuggestions;
3256
3282
  private renderInlineSuggestions;
3257
3283
  private renderAboveSuggestions;
package/dist/index.d.ts CHANGED
@@ -896,6 +896,7 @@ type RuleEventMeta = {
896
896
  name: string;
897
897
  description: string;
898
898
  group: string;
899
+ evaluationId: string;
899
900
  };
900
901
  /**
901
902
  * Map the send event name to the data value in the payload
@@ -1127,7 +1128,10 @@ declare class DeepdeskAPI {
1127
1128
  text: string;
1128
1129
  }>;
1129
1130
  externalConversationId?: string;
1130
- }): Promise<CamelCaseKeys<Server.EvaluationOutput<TOutput>>>;
1131
+ }): Promise<CamelCaseKeys<{
1132
+ evaluation_id: string;
1133
+ output: Server.EvaluationOutput<TOutput>;
1134
+ }>>;
1131
1135
  createAssistantThread(init: {
1132
1136
  assistantCode: string;
1133
1137
  }): Promise<{
@@ -1316,6 +1320,7 @@ type LegacyCue = CamelCaseKeys<Server.LegacyCue> & {
1316
1320
  isLoading?: boolean;
1317
1321
  editable?: boolean;
1318
1322
  specialType?: 'summary';
1323
+ evaluationId: string;
1319
1324
  };
1320
1325
 
1321
1326
  type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
@@ -1323,6 +1328,7 @@ type ArrayItemType<T> = T extends Array<infer I> ? I : never;
1323
1328
  type Cue = ArrayItemType<EvaluationOutput<'json-schema:cues'>> & {
1324
1329
  isLoading?: boolean;
1325
1330
  specialType?: 'summary';
1331
+ evaluationId: string;
1326
1332
  };
1327
1333
  type AssistantAnswerSource = {
1328
1334
  url?: string;
@@ -1334,6 +1340,7 @@ type AssistantInteraction = {
1334
1340
  answer: string;
1335
1341
  sources?: AssistantAnswerSource[];
1336
1342
  };
1343
+ evaluationId: string;
1337
1344
  };
1338
1345
  type State$2 = {
1339
1346
  cues: Cue[];
@@ -2066,6 +2073,7 @@ declare class DeepdeskSDK {
2066
2073
  private broadcastEvents;
2067
2074
  private eventListeners;
2068
2075
  private unmountHandlers;
2076
+ private disposeHandlers;
2069
2077
  private inlineSuggestions;
2070
2078
  private aboveSuggestions;
2071
2079
  private floatingMenu;
@@ -3133,6 +3141,7 @@ declare class DeepdeskSDK {
3133
3141
  setPlatformVariables(mapping: VariableMapping): void;
3134
3142
  /**
3135
3143
  * Registers a callback to be called when conversation is loaded.
3144
+ * Convenient wrapper around `subscribe`.
3136
3145
  *
3137
3146
  * This method allows you to register a callback function that will be executed
3138
3147
  * when a conversation is successfully loaded. The callback is called after
@@ -3141,6 +3150,8 @@ declare class DeepdeskSDK {
3141
3150
  * If a conversation is already loaded when this method is called, the callback
3142
3151
  * will be executed immediately.
3143
3152
  *
3153
+ * If the conversation changes, the callback will be called again.
3154
+ *
3144
3155
  * @param callback - Function to call when conversation loads
3145
3156
  *
3146
3157
  * @example
@@ -3151,7 +3162,7 @@ declare class DeepdeskSDK {
3151
3162
  * });
3152
3163
  * ```
3153
3164
  */
3154
- whenConversationLoaded(callback: () => void): void;
3165
+ whenConversationLoaded(callback: () => void): Unsubscribe;
3155
3166
  private overlayContainerFactory;
3156
3167
  private createInlineContainer;
3157
3168
  private createContainer;
@@ -3236,15 +3247,17 @@ declare class DeepdeskSDK {
3236
3247
  */
3237
3248
  subscribe<T>(selector: (state: RootState) => T, callback: (value: T) => void): Unsubscribe;
3238
3249
  /**
3239
- * Unmounts the SDK and cleans up all resources.
3250
+ * Unmounts the SDK and cleans up all resources related to the mount() method.
3240
3251
  *
3241
3252
  * This method removes all UI components, event listeners, and cleans up
3242
- * internal resources. It should be called when you're done using the SDK
3243
- * or when you need to remount it on a different element.
3253
+ * internal resources.
3244
3254
  *
3245
3255
  * After calling this method, the SDK instance can be reused by calling
3246
3256
  * `mount()` again on a new input element.
3247
3257
  *
3258
+ * **Important:** This method does not clean up all DeepdeskSDK resources.
3259
+ * Use `dispose()` to clean up all resources instead.
3260
+ *
3248
3261
  * @example
3249
3262
  * ```typescript
3250
3263
  * // Unmount when switching conversations
@@ -3252,6 +3265,19 @@ declare class DeepdeskSDK {
3252
3265
  * ```
3253
3266
  */
3254
3267
  unmount(): void;
3268
+ /**
3269
+ * Disposes of the DeepdeskSDK instance.
3270
+ *
3271
+ * This method removes all UI components, event listeners, and cleans up
3272
+ * internal resources. It should be called when you're done using the SDK.
3273
+ *
3274
+ * @example
3275
+ * ```typescript
3276
+ * // Dispose of DeepdeskSDK instance after conversation is unloaded
3277
+ * sdk.dispose();
3278
+ * ```
3279
+ */
3280
+ dispose(): void;
3255
3281
  private renderSuggestions;
3256
3282
  private renderInlineSuggestions;
3257
3283
  private renderAboveSuggestions;