@deepdesk/deepdesk-sdk 17.0.0-rc.8 → 17.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
@@ -107,6 +107,7 @@ declare const styles$o: {
107
107
  readonly "dropdownItemButton": string;
108
108
  readonly "dropdownList": string;
109
109
  readonly "fadein": string;
110
+ readonly "icon": string;
110
111
  readonly "isClickable": string;
111
112
  readonly "isSelected": string;
112
113
  readonly "label": string;
@@ -492,7 +493,6 @@ declare namespace Server {
492
493
  visitor_name: string | null;
493
494
  chat_start_time: string | null;
494
495
  external_id: string;
495
- messages: ConversationMessage[];
496
496
  metadata: Metadata;
497
497
  };
498
498
  /**
@@ -593,64 +593,10 @@ declare namespace Server {
593
593
  suggestion: string;
594
594
  }[];
595
595
  };
596
- enum EventType {
597
- SEND_MESSAGE = "Send Message",
598
- HANDLING_TIME = "Handling Time",
599
- ADD_TO_PERSONAL_COLLECTION = "Add to personal collection",
600
- DELETE_FROM_PERSONAL_COLLECTION = "Delete from personal collection"
601
- }
602
- type UsedSuggestion = {
603
- ab_test_name?: string | null;
604
- ab_variant?: string | null;
605
- input_type: string;
606
- source?: string;
607
- source_text?: string;
608
- text: string;
609
- training_jobs?: string[];
610
- };
611
- /**
612
- * Abstract API object for event data
613
- * @deprecated in favor of EventDataV2
614
- * @see EventV2Data
615
- */
616
- type EventData = {
617
- conversation_id: string;
618
- client_version: string;
619
- source: 'agent' | 'visitor';
620
- pastes: string[];
621
- cuts: string[];
622
- deletions: string[];
623
- len_text_typed: number;
624
- len_text_total: number;
625
- len_text_assisted: number;
626
- len_text_pasted: number;
627
- len_text_cut: number;
628
- len_text_deleted: number;
629
- time_total_seconds: number;
630
- chars_per_second: number;
631
- text: string;
632
- num_pastes: number;
633
- text_suggestions_v2: UsedSuggestion[];
634
- url_suggestions_v2: UsedSuggestion[];
635
- url_link_suggestions_v2: UsedSuggestion[];
636
- suggestions_counters: {
637
- source: Sources;
638
- count_offered: number;
639
- }[];
640
- time_start: string;
641
- time_stop: string;
642
- agent_id?: string;
643
- agent_name?: string;
644
- agent_email?: string;
645
- platform: string;
646
- backend_version: string;
647
- engine_version: string;
648
- gpt_version: string;
649
- };
650
596
  /**
651
597
  * Backend API object for event data v2
652
598
  */
653
- type EventV2Data = {
599
+ type EventData = {
654
600
  name: string;
655
601
  platform?: string;
656
602
  conversation_id?: string;
@@ -701,15 +647,28 @@ declare namespace Server {
701
647
  /**
702
648
  * Handling time event data
703
649
  */
704
- type HandlingTimeEventData = Pick<EventData, 'conversation_id' | 'client_version' | 'time_start' | 'time_stop'> & Partial<Pick<EventData, 'agent_id' | 'agent_name' | 'agent_email'>>;
650
+ type HandlingTimeEventData = {
651
+ client_version: string;
652
+ time_start: string;
653
+ time_stop: string;
654
+ };
705
655
  /**
706
656
  * Send message event data
707
657
  */
708
- type SendMessageEventData = Pick<EventData, 'client_version' | 'conversation_id' | 'source' | 'pastes' | 'cuts' | 'deletions' | 'len_text_typed' | 'len_text_total' | 'len_text_assisted' | 'len_text_pasted' | 'len_text_cut' | 'len_text_deleted' | 'time_total_seconds' | 'chars_per_second' | 'num_pastes' | 'text' | 'text_suggestions_v2' | 'suggestions_counters'> & Partial<Pick<EventData, 'agent_id' | 'agent_name' | 'agent_email'>>;
709
- /**
710
- * PersonalCollection event data
711
- */
712
- type PersonalCollectionEventData = Pick<EventData, 'text' | 'platform'>;
658
+ type SendMessageEventData = {
659
+ client_version: string;
660
+ source: string;
661
+ len_text_total: number;
662
+ pastes: string[];
663
+ num_pastes: number;
664
+ suggestions: Array<{
665
+ input_type: string;
666
+ source?: Sources;
667
+ source_text?: string;
668
+ text: string;
669
+ training_jobs?: Array<string>;
670
+ }>;
671
+ };
713
672
  /**
714
673
  * Search results data
715
674
  */
@@ -772,27 +731,17 @@ declare namespace Server {
772
731
  sticky_messages: boolean;
773
732
  recommend_text_suggestions: boolean;
774
733
  assisted_intake: boolean;
775
- autocomplete_with_text_suggestions: boolean;
776
734
  entities_command: boolean;
777
- summarizer: boolean;
778
- summarizer_prompt_instruction: string;
779
- summarizer_model: string;
780
- /**
781
- * Old rule group
782
- * @deprecated in favor of `summarizer_assistant_new`
783
- */
784
- summarizer_assistant?: string;
785
- summarizer_assistant_new?: string;
786
- conversation_accepted_assistant?: string;
787
- conversation_new_message_assistant?: string;
788
- conversation_ended_assistant?: string;
735
+ summarizer_assistant_new: string | null;
736
+ conversation_accepted_assistant: string | null;
737
+ conversation_new_message_assistant: string | null;
738
+ conversation_ended_assistant: string | null;
789
739
  /**
790
740
  * @deprecated in favor of `knowledge_assistant_new`
791
741
  */
792
- knowledge_assistant: string;
793
- knowledge_assistant_new: string;
742
+ knowledge_assistant: string | null;
743
+ knowledge_assistant_new: string | null;
794
744
  on_demand_assistants: Array<OnDemandAssistant>;
795
- authorized_groups: number[];
796
745
  active_config: {
797
746
  default_locale: string;
798
747
  };
@@ -805,6 +754,7 @@ declare namespace Server {
805
754
  amount: number;
806
755
  lines: 'multiple' | 'single';
807
756
  schema?: CustomDataSchema;
757
+ property?: string;
808
758
  }>;
809
759
  };
810
760
  search: {
@@ -871,10 +821,8 @@ declare namespace Server {
871
821
  type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'metadata'>> & {
872
822
  metadata: Server.Metadata | null;
873
823
  };
874
- type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'metadata' | 'messages'>> & {
824
+ type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'metadata'>> & {
875
825
  metadata: Server.Metadata;
876
- } & {
877
- messages: ConversationMessage[];
878
826
  };
879
827
  /**
880
828
  * Create Conversation Options
@@ -910,15 +858,15 @@ type CreateConversationOptions = {
910
858
  */
911
859
  type SendMessageEventData = CamelCaseKeys<Server.SendMessageEventData>;
912
860
  /**
913
- * Event v2 payload
861
+ * Event payload
914
862
  */
915
- type EventV2<T = unknown> = CamelCaseKeys<Omit<Server.EventV2Data, 'name' | 'backend_version' | 'engine_version' | 'gpt_version' | 'data'>> & {
863
+ type Event$1<T = unknown> = CamelCaseKeys<Omit<Server.EventData, 'name' | 'backend_version' | 'engine_version' | 'gpt_version' | 'data'>> & {
916
864
  data: T;
917
865
  };
918
866
  /**
919
867
  * Handling time event data
920
868
  */
921
- type HandlingTimeEventData = CamelCaseKeys<Pick<Server.HandlingTimeEventData, 'conversation_id' | 'client_version' | 'time_start' | 'time_stop'>>;
869
+ type HandlingTimeEventData = CamelCaseKeys<Server.HandlingTimeEventData>;
922
870
  /**
923
871
  * Rule event meta data
924
872
  */
@@ -928,67 +876,61 @@ type RuleEventMeta = {
928
876
  group: string;
929
877
  };
930
878
  /**
931
- * Map the send event name to the data value in the payload. (V1)
932
- * @deprecated
933
- */
934
- type SendEventV1ArgumentMap = {
935
- 'Send Message': SendMessageEventData;
936
- 'Handling Time': HandlingTimeEventData;
937
- };
938
- /**
939
- * Map the send event name to the data value in the payload. (V2)
879
+ * Map the send event name to the data value in the payload
940
880
  */
941
- type SendEventV2ArgumentMap = {
942
- 'Add to personal collection': EventV2<{
881
+ type SendEventArgumentMap = {
882
+ 'Send Message': Event$1<SendMessageEventData>;
883
+ 'Handling Time': Event$1<HandlingTimeEventData>;
884
+ 'Add to personal collection': Event$1<{
943
885
  text: string;
944
886
  }>;
945
- 'Delete from personal collection': EventV2<{
887
+ 'Delete from personal collection': Event$1<{
946
888
  text: string;
947
889
  }>;
948
- 'entities found': EventV2<{
890
+ 'entities found': Event$1<{
949
891
  entities: Entity[];
950
892
  }>;
951
- 'conversation summarized': EventV2<{
893
+ 'conversation summarized': Event$1<{
952
894
  summary: string;
953
895
  assistant?: string;
954
896
  }>;
955
- 'style suggested': EventV2<{
897
+ 'style suggested': Event$1<{
956
898
  keywordMatches: {
957
899
  keyword: string;
958
900
  suggestion: string;
959
901
  }[];
960
902
  }>;
961
- 'Image attached': EventV2<{
903
+ 'Image attached': Event$1<{
962
904
  path: string;
963
905
  title: string;
964
906
  }>;
965
- 'Assistant response displayed': EventV2<RuleEventMeta & {
907
+ 'Assistant response displayed': Event$1<RuleEventMeta & {
966
908
  cueText: string;
967
909
  }>;
968
- 'Assistant response closed': EventV2<RuleEventMeta & {
910
+ 'Assistant response closed': Event$1<RuleEventMeta & {
969
911
  cueText: string;
970
912
  }>;
971
- 'Assistant response feedback': EventV2<RuleEventMeta & {
913
+ 'Assistant response feedback': Event$1<RuleEventMeta & {
972
914
  rating: 'up' | 'down';
973
915
  cueText: string;
974
916
  }>;
975
- 'Assistant response used': EventV2<RuleEventMeta & {
917
+ 'Assistant response used': Event$1<RuleEventMeta & {
976
918
  usedText: string;
977
919
  }>;
978
- 'Assistant response copied': EventV2<RuleEventMeta & {
920
+ 'Assistant response copied': Event$1<RuleEventMeta & {
979
921
  copiedText: string;
980
922
  }>;
981
- 'Assistant call to action': EventV2<RuleEventMeta & {
923
+ 'Assistant call to action': Event$1<RuleEventMeta & {
982
924
  eventName: string;
983
925
  value: string;
984
926
  }>;
985
- 'knowledge assist feedback': EventV2<{
927
+ 'knowledge assist feedback': Event$1<{
986
928
  question: string;
987
929
  isFollowUpQuestion: boolean;
988
930
  isAgent: boolean;
989
931
  answer: Server.KnowledgeResponse['answer'];
990
932
  }>;
991
- 'knowledge assist question answered': EventV2<{
933
+ 'knowledge assist question answered': Event$1<{
992
934
  question: string;
993
935
  answer: string;
994
936
  sources: {
@@ -998,32 +940,32 @@ type SendEventV2ArgumentMap = {
998
940
  isFollowUpQuestion: boolean;
999
941
  isAutoInitiated: boolean;
1000
942
  }>;
1001
- 'knowledge assist source viewed': EventV2<{
943
+ 'knowledge assist source viewed': Event$1<{
1002
944
  question: string;
1003
945
  sourceViewed: string;
1004
946
  }>;
1005
- 'knowledge assist reset': EventV2<{
947
+ 'knowledge assist reset': Event$1<{
1006
948
  threadId?: number;
1007
949
  }>;
1008
- 'summary feedback': EventV2<{
950
+ 'summary feedback': Event$1<{
1009
951
  summary: string;
1010
952
  rating: 'up' | 'down';
1011
953
  }>;
1012
- 'summary copied to clipboard': EventV2<{
954
+ 'summary copied to clipboard': Event$1<{
1013
955
  originalText: string;
1014
956
  finalText: string;
1015
957
  assistant: string;
1016
958
  }>;
1017
- 'open search': EventV2<{
959
+ 'open search': Event$1<{
1018
960
  via: 'ctrl+k' | 'autocomplete-overlay' | 'widget-shortcut';
1019
961
  }>;
1020
- 'open knowledge assistant': EventV2<{
962
+ 'open knowledge assistant': Event$1<{
1021
963
  via: 'ctrl+k' | 'widget-shortcut' | 'search-command';
1022
964
  }>;
1023
- 'open my deepdesk': EventV2<{
965
+ 'open my deepdesk': Event$1<{
1024
966
  via: 'widget-shortcut';
1025
967
  }>;
1026
- 'trigger on demand assistant': EventV2<{
968
+ 'trigger on demand assistant': Event$1<{
1027
969
  assistantCode: string;
1028
970
  }>;
1029
971
  };
@@ -1080,30 +1022,15 @@ declare class DeepdeskAPI {
1080
1022
  /**
1081
1023
  * Update converstation meta data
1082
1024
  */
1083
- updateConversation(conversationId: string, data: Partial<Omit<Conversation, 'messages'>>): Promise<Conversation>;
1025
+ updateConversation(conversationId: string, data: Partial<Conversation>): Promise<Conversation>;
1084
1026
  /**
1085
1027
  * Post converstation messages
1086
1028
  */
1087
- postMessages(conversationId: string, messages: CamelCaseKeys<Server.ConversationMessage>[]): Promise<({
1088
- text: string;
1089
- source: "agent" | "visitor" | "bot" | "system";
1090
- time: string;
1091
- externalId: string;
1092
- authorId: string;
1093
- authorName?: string | undefined;
1094
- authorEmail?: string | undefined;
1095
- } & {
1096
- metadata: Server.Metadata | null;
1097
- })[]>;
1098
- /**
1099
- * Send event with meta data for analytics
1100
- */
1101
- sendEvent<T extends keyof SendEventV2ArgumentMap>(event: T, payload: SendEventV2ArgumentMap[T]): Promise<void>;
1029
+ postMessages(conversationId: string, messages: CamelCaseKeys<Server.ConversationMessage>[]): Promise<void>;
1102
1030
  /**
1103
1031
  * Send event with meta data for analytics
1104
- * @deprecated
1105
1032
  */
1106
- sendEventV1<T extends keyof SendEventV1ArgumentMap>(event: T, payload: SendEventV1ArgumentMap[T]): Promise<void>;
1033
+ sendEvent<T extends keyof SendEventArgumentMap>(event: T, payload: SendEventArgumentMap[T]): Promise<void>;
1107
1034
  getEntities(messages: Array<{
1108
1035
  text: string;
1109
1036
  }>): Promise<Entity[]>;
@@ -1384,7 +1311,7 @@ type AssistantInteraction = {
1384
1311
  type State$2 = {
1385
1312
  cues: Cue[];
1386
1313
  threads: Record<number, AssistantInteraction[]>;
1387
- fetchState: FetchState;
1314
+ pending: string[];
1388
1315
  };
1389
1316
  type Transcript = Array<{
1390
1317
  source: string;
@@ -2072,6 +1999,7 @@ interface WidgetOptions {
2072
1999
  interface KnowledgeAssistantWidgetOptions extends KnowledgeAssistOptions {
2073
2000
  customStyles?: WidgetCustomStyles;
2074
2001
  isLegacyKnowledgeAssist?: boolean;
2002
+ title?: string;
2075
2003
  }
2076
2004
  declare class DeepdeskSDK {
2077
2005
  static version: string;
@@ -2088,6 +2016,7 @@ declare class DeepdeskSDK {
2088
2016
  private widgetElement;
2089
2017
  private widgetRoot;
2090
2018
  private dynamicThunkObject;
2019
+ private queues;
2091
2020
  isMounted: boolean;
2092
2021
  instanceId: number;
2093
2022
  private shouldRender;
@@ -2221,7 +2150,7 @@ declare class DeepdeskSDK {
2221
2150
  * Method to call when the conversation is updated, either by an incoming message
2222
2151
  * from the visitor, or a message sent by the agent.
2223
2152
  */
2224
- postMessages(messages: ConversationMessage[]): Promise<any>;
2153
+ postMessages(messages: ConversationMessage[]): Promise<void>;
2225
2154
  /**
2226
2155
  * Update converstation meta data
2227
2156
  */