@deepdesk/deepdesk-sdk 14.2.1-beta.4 → 14.2.1-beta.6

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
@@ -292,11 +292,6 @@ declare abstract class InputMediator<HTMLElementType extends HTMLElement> {
292
292
  dispose(): void;
293
293
  }
294
294
 
295
- type State$g = {
296
- startTime: Date | null;
297
- stopTime: Date | null;
298
- };
299
-
300
295
  /**
301
296
  * CamelCase type manipulation
302
297
  * ```
@@ -373,574 +368,195 @@ declare class HTTPClient {
373
368
  delete<TResponse>(path: string, init?: ExtendedRequestInit): Promise<TResponse>;
374
369
  }
375
370
 
376
- type SSEClientOptions = {
377
- timeout: number;
378
- };
379
- declare class SSEClient<TEventMap extends Record<string, (data?: any) => void>> {
380
- url: string;
381
- private eventListeners;
382
- private options;
383
- private timeoutTimer;
384
- eventSource: EventSource | undefined;
385
- constructor(url: string, options?: Partial<SSEClientOptions>);
386
- private proxyEvent;
387
- connect(): void;
388
- disconnect(): void;
389
- emit(type: keyof TEventMap, eventPayload: any): void;
390
- on(type: keyof TEventMap, handler: any): () => void;
391
- off(type: keyof TEventMap, handler: any): void;
392
- }
393
-
394
371
  declare namespace Server$1 {
395
- interface CustomMessageReplyOption {
396
- title: string;
397
- payload: string;
398
- }
399
- interface CustomMessage {
372
+ /**
373
+ * API create conversation payload
374
+ */
375
+ type CreateConversationPayload = {
376
+ platform: string;
377
+ session_id: string;
378
+ agent_id: string;
379
+ profile_code?: string;
380
+ tags?: Record<string, string> | null;
381
+ agent_name?: string;
382
+ agent_nickname?: string;
383
+ agent_email?: string;
384
+ };
385
+ /**
386
+ * API message object
387
+ */
388
+ type ConversationMessage = {
389
+ id: string;
390
+ time: string;
391
+ source: 'agent' | 'visitor' | 'bot' | 'system';
392
+ author_id: string;
393
+ author_name?: string;
394
+ author_email?: string;
400
395
  text: string;
401
- reply_options?: CustomMessageReplyOption[];
402
- }
403
- interface CustomMessagesResponse {
404
- suggestions: CustomMessage[];
405
- }
406
- declare enum AutoflowSessionState {
407
- Started = "Started",
408
- Aborted = "Aborted",
409
- Completed = "Completed"
410
- }
411
- interface Autoflow {
412
- description?: string;
413
- display_name?: string;
414
- trigger_payload?: string;
415
- state: AutoflowSessionState | null;
416
- }
417
- interface AutoflowsResponse {
418
- autoflows: Autoflow[];
419
- }
420
- interface AutoflowSessionPayload {
421
- platform_session_id: string;
422
- trigger_payload: string;
423
- }
424
- interface AutoflowSession {
396
+ tags: Record<string, string> | null;
397
+ };
398
+ /**
399
+ * API conversation object
400
+ */
401
+ type Conversation = {
425
402
  id: string;
426
- platform_session_id: string;
427
- session_type: string;
428
- state: AutoflowSessionState;
429
- data: {
430
- trigger_payload: string;
431
- 'trigger-payload': string;
403
+ profile_code: string | null;
404
+ channel: string | null;
405
+ platform: string;
406
+ agent_id: string;
407
+ agent_name: string | null;
408
+ agent_nickname: string | null;
409
+ agent_email: string | null;
410
+ agent_role: string | null;
411
+ engagement_type: string | null;
412
+ engagement_id: string | null;
413
+ engagement_name: string | null;
414
+ engagement_skill: string | null;
415
+ agent_note: string | null;
416
+ survey_email: string | null;
417
+ survey_name: string | null;
418
+ survey_phone: string | null;
419
+ visitor_id: string | null;
420
+ visitor_name: string | null;
421
+ visitor_device: string | null;
422
+ visitor_browser: string | null;
423
+ visitor_os: string | null;
424
+ visitor_country: string | null;
425
+ visitor_state: string | null;
426
+ visitor_city: string | null;
427
+ visitor_isp: string | null;
428
+ visitor_organization: string | null;
429
+ visitor_ip_address: string | null;
430
+ chat_start_time: number | null;
431
+ session_start_time: number | null;
432
+ visit_start_time: string | null;
433
+ session_id: string;
434
+ messages: ConversationMessage[];
435
+ tags: Record<string, string> | null;
436
+ has_active_profile: boolean;
437
+ created: string;
438
+ updated: string;
439
+ };
440
+ /**
441
+ * API object for url suggestion
442
+ */
443
+ type UrlSuggestion = {
444
+ id?: string;
445
+ score: number;
446
+ url: string;
447
+ context?: string;
448
+ image: string;
449
+ summary?: string;
450
+ title?: string;
451
+ image_sizes?: {
452
+ small: string;
453
+ medium: string;
454
+ large: string;
432
455
  };
433
- }
434
- }
435
- type EventMap = {
436
- customMessageSuggestion: (data: CamelCaseKeys<Server$1.CustomMessage>) => void;
437
- sessionAborted: (data: {
438
- id: string;
439
- }) => void;
440
- sessionCompleted: (data: {
441
- id: string;
442
- }) => void;
443
- };
444
- declare class DeepdeskBrokerAPI {
445
- apiUrl: string;
446
- client: HTTPClient;
447
- streams: Record<string, SSEClient<EventMap>>;
448
- logger: Logger;
449
- constructor(apiUrl: string, options?: HTTPClientOptions);
450
- getCustomMessages(platformSessionId: string): Promise<CamelCaseKeys<Server$1.CustomMessage[]>>;
451
- sendCustomMessage(platformSessionId: string, suggestion: CamelCaseKeys<Server$1.CustomMessage>): Promise<CamelCaseKeys<Server$1.CustomMessage>>;
452
- answerCustomMessage(platformSessionId: string, reply: CamelCaseKeys<Server$1.CustomMessageReplyOption>): Promise<void>;
453
- getAutoflows(platformSessionId: string): Promise<CamelCaseKeys<Server$1.Autoflow[]>>;
454
- startAutoflowSession(autoflowSession: CamelCaseKeys<Server$1.AutoflowSessionPayload>): Promise<CamelCaseKeys<Server$1.AutoflowSession>>;
455
- stopAutoflowSession(platformSessionId: string): Promise<void>;
456
- openStream(platformSessionId: string): SSEClient<EventMap>;
457
- closeStream(platformSessionId: string): void;
458
- }
459
-
460
- type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
461
- type State$f = {
462
- cues: EvaluationOutput<'json-schema:cues'>;
463
- fetchState: FetchState;
464
- };
465
- type Transcript = Array<{
466
- source: string;
467
- text: string;
468
- }>;
469
- type TranscriptOption = 'in-memory-transcript' | 'stored-transcript' | Transcript;
470
-
471
- interface StoreConfig {
472
- deepdeskAPI: DeepdeskAPI;
473
- deepdeskBrokerAPI?: DeepdeskBrokerAPI;
474
- dynamicThunkObject?: Record<string, unknown>;
475
- middleware?: Middleware[];
476
- preloadedState?: any;
477
- }
478
- declare const reducers: redux.Reducer<redux.CombinedState<{
479
- assistants: State$f;
480
- answer: State$6;
481
- auth: State$e;
482
- autoflows: State$d;
483
- conversation: State$c;
484
- contentTypes: State$b;
485
- customMessages: State$a;
486
- passwordlessToken: State$9;
487
- entities: State$8;
488
- knowledgeAssistant: State$7;
489
- handlingTime: State$g;
490
- info: {
491
- agentInfo?: AgentInfo | undefined;
492
- agentSettings: unknown;
493
- visitorInfo?: VisitorInfo | undefined;
494
- customData?: CustomData | undefined;
495
- platformVariables?: VariableMapping | undefined;
496
- fetchState: FetchState;
497
456
  };
498
- input: State$5;
499
- settings: {
500
- locale: Locale;
501
- deanonymize: boolean;
502
- fallbackImage: string | false;
503
- isEmbedded: boolean;
504
- showAutoflows: number | boolean;
505
- showCustomMessages: number | boolean;
506
- showImages: boolean;
507
- showSearch: boolean;
508
- showImageSearch: boolean;
509
- showStyleSuggestions: number | boolean;
510
- showMidSentenceSuggestions: boolean;
511
- showSuggestionsBeforePattern: string | false;
512
- showSuggestionsAfterPattern: string | false;
513
- showTabCompletion: boolean;
514
- showTextSuggestions: boolean;
515
- showEntitiesCommand: boolean;
516
- showSummaryCommand: boolean;
517
- showKnowledgeSearch: boolean;
518
- textSuggestionsCount: number;
519
- recommendTextSuggestions: boolean;
520
- searchTriggerKey: string;
521
- visible: boolean;
522
- insertLink: boolean;
523
- inlineSuggestions: boolean;
524
- floatingMenu: boolean;
525
- adminUrl?: string | undefined;
526
- productName: string;
527
- enableSuggestionFeedback: boolean;
528
- enableFeedbackForm: boolean;
529
- hasKeyboardInput: boolean;
457
+ /**
458
+ * API object for platform config
459
+ */
460
+ type PlatformConfig = {
461
+ config: {
462
+ account: {
463
+ code: string;
464
+ name: string;
465
+ url: string;
466
+ is_trial: boolean;
467
+ };
468
+ platform: {
469
+ name: string;
470
+ url: string;
471
+ has_sso: boolean;
472
+ authorization_url: string;
473
+ client_config: unknown;
474
+ };
475
+ };
530
476
  };
531
- profile: State$4;
532
- search: State$3;
533
- styleSuggestions: State$2;
534
- ui: {
535
- showTabHint: boolean;
536
- inputHasFocus: boolean;
537
- overlayCollapsed: boolean;
538
- openOverlayWhenTyping: boolean;
539
- overlayCollapsedUserOverwrite: boolean;
477
+ /**
478
+ * API object for account
479
+ */
480
+ type Account = {
481
+ code: string;
482
+ name: string;
483
+ rule_engine: boolean;
484
+ live_translation_enabled: boolean;
540
485
  };
541
- rules: State$1;
542
- textSuggestions: TextSuggestionState;
543
- }>, redux.AnyAction>;
544
- declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configureStore.ToolkitStore<redux.EmptyObject & {
545
- assistants: State$f;
546
- answer: State$6;
547
- auth: State$e;
548
- autoflows: State$d;
549
- conversation: State$c;
550
- contentTypes: State$b;
551
- customMessages: State$a;
552
- passwordlessToken: State$9;
553
- entities: State$8;
554
- knowledgeAssistant: State$7;
555
- handlingTime: State$g;
556
- info: {
557
- agentInfo?: AgentInfo | undefined;
558
- agentSettings: unknown;
559
- visitorInfo?: VisitorInfo | undefined;
560
- customData?: CustomData | undefined;
561
- platformVariables?: VariableMapping | undefined;
562
- fetchState: FetchState;
563
- };
564
- input: State$5;
565
- settings: {
566
- locale: Locale;
567
- deanonymize: boolean;
568
- fallbackImage: string | false;
569
- isEmbedded: boolean;
570
- showAutoflows: number | boolean;
571
- showCustomMessages: number | boolean;
572
- showImages: boolean;
573
- showSearch: boolean;
574
- showImageSearch: boolean;
575
- showStyleSuggestions: number | boolean;
576
- showMidSentenceSuggestions: boolean;
577
- showSuggestionsBeforePattern: string | false;
578
- showSuggestionsAfterPattern: string | false;
579
- showTabCompletion: boolean;
580
- showTextSuggestions: boolean;
581
- showEntitiesCommand: boolean;
582
- showSummaryCommand: boolean;
583
- showKnowledgeSearch: boolean;
584
- textSuggestionsCount: number;
585
- recommendTextSuggestions: boolean;
586
- searchTriggerKey: string;
587
- visible: boolean;
588
- insertLink: boolean;
589
- inlineSuggestions: boolean;
590
- floatingMenu: boolean;
591
- adminUrl?: string | undefined;
592
- productName: string;
593
- enableSuggestionFeedback: boolean;
594
- enableFeedbackForm: boolean;
595
- hasKeyboardInput: boolean;
596
- };
597
- profile: State$4;
598
- search: State$3;
599
- styleSuggestions: State$2;
600
- ui: {
601
- showTabHint: boolean;
602
- inputHasFocus: boolean;
603
- overlayCollapsed: boolean;
604
- openOverlayWhenTyping: boolean;
605
- overlayCollapsedUserOverwrite: boolean;
606
- };
607
- rules: State$1;
608
- textSuggestions: TextSuggestionState;
609
- }, redux.AnyAction, _reduxjs_toolkit.ThunkMiddleware<redux.CombinedState<{
610
- assistants: State$f;
611
- answer: State$6;
612
- auth: State$e;
613
- autoflows: State$d;
614
- conversation: State$c;
615
- contentTypes: State$b;
616
- customMessages: State$a;
617
- passwordlessToken: State$9;
618
- entities: State$8;
619
- knowledgeAssistant: State$7;
620
- handlingTime: State$g;
621
- info: {
622
- agentInfo?: AgentInfo | undefined;
623
- agentSettings: unknown;
624
- visitorInfo?: VisitorInfo | undefined;
625
- customData?: CustomData | undefined;
626
- platformVariables?: VariableMapping | undefined;
627
- fetchState: FetchState;
486
+ /**
487
+ * API object for free suggestion
488
+ */
489
+ type RecommendFreeSuggestion = {
490
+ score?: number;
491
+ title?: string;
492
+ text: string;
493
+ message?: string;
494
+ url?: string;
495
+ ab_variant?: string;
496
+ ab_test_name?: string;
497
+ training_jobs?: string[];
498
+ source_text: string;
628
499
  };
629
- input: State$5;
630
- settings: {
631
- locale: Locale;
632
- deanonymize: boolean;
633
- fallbackImage: string | false;
634
- isEmbedded: boolean;
635
- showAutoflows: number | boolean;
636
- showCustomMessages: number | boolean;
637
- showImages: boolean;
638
- showSearch: boolean;
639
- showImageSearch: boolean;
640
- showStyleSuggestions: number | boolean;
641
- showMidSentenceSuggestions: boolean;
642
- showSuggestionsBeforePattern: string | false;
643
- showSuggestionsAfterPattern: string | false;
644
- showTabCompletion: boolean;
645
- showTextSuggestions: boolean;
646
- showEntitiesCommand: boolean;
647
- showSummaryCommand: boolean;
648
- showKnowledgeSearch: boolean;
649
- textSuggestionsCount: number;
650
- recommendTextSuggestions: boolean;
651
- searchTriggerKey: string;
652
- visible: boolean;
653
- insertLink: boolean;
654
- inlineSuggestions: boolean;
655
- floatingMenu: boolean;
656
- adminUrl?: string | undefined;
657
- productName: string;
658
- enableSuggestionFeedback: boolean;
659
- enableFeedbackForm: boolean;
660
- hasKeyboardInput: boolean;
500
+ type ContentType = {
501
+ id: number;
502
+ code: string;
503
+ name: string;
504
+ description: string;
661
505
  };
662
- profile: State$4;
663
- search: State$3;
664
- styleSuggestions: State$2;
665
- ui: {
666
- showTabHint: boolean;
667
- inputHasFocus: boolean;
668
- overlayCollapsed: boolean;
669
- openOverlayWhenTyping: boolean;
670
- overlayCollapsedUserOverwrite: boolean;
506
+ /**
507
+ * API object for autocomplete suggestion
508
+ */
509
+ type AutocompleteSuggestion = {
510
+ label: string;
511
+ source: string;
512
+ value: string;
513
+ training_jobs: string[];
514
+ source_text: string;
515
+ search_keywords?: string[];
671
516
  };
672
- rules: State$1;
673
- textSuggestions: TextSuggestionState;
674
- }>, redux.AnyAction, {
675
- dynamicThunkObject: Record<string, unknown> | undefined;
676
- deepdeskAPI: DeepdeskAPI;
677
- deepdeskBrokerAPI: DeepdeskBrokerAPI | undefined;
678
- }>[]>;
679
- type RootState = ReturnType<typeof reducers>;
680
- type Store = ReturnType<typeof createStore>;
681
-
682
- interface State$e {
683
- isLoggedIn: boolean | null;
684
- loginFetchState: FetchState;
685
- verifyFetchState: FetchState;
686
- showLoginOverlay: boolean;
687
- }
688
-
689
- type Autoflow = CamelCaseKeys<Server$1.Autoflow> & {
690
- isBusy?: boolean;
691
- };
692
- interface State$d {
693
- list: Autoflow[];
694
- fetchState: FetchState;
695
- }
696
-
697
- interface State$c {
698
- current: Conversation | null;
699
- isSupported: boolean | null;
700
- }
701
-
702
- type ContentType = CamelCaseKeys<Server.ContentType>;
703
- type State$b = {
704
- data: ContentType[] | null;
705
- fetchState: FetchState;
706
- };
707
-
708
- type CustomMessage = CamelCaseKeys<Server$1.CustomMessage>;
709
- interface State$a {
710
- list: CustomMessage[];
711
- fetchState: FetchState;
712
- sentSuggestions: string[];
713
- errorSuggestions: string[];
714
- answeredSuggestions: string[];
715
- }
716
-
717
- type State$9 = {
718
- token: string | null;
719
- interval: NodeJS.Timer | null;
720
- };
721
-
722
- type State$8 = {
723
- data: Entity[] | null;
724
- fetchState: FetchState;
725
- };
726
-
727
- type State$7 = {
728
- data: KnowledgeAssistant | null;
729
- fetchState: FetchState;
730
- };
731
-
732
- interface ListItemSource {
733
- url?: string;
734
- name: string;
735
- }
736
-
737
- interface KnowledgeAnswer {
738
- answer: string;
739
- sources: ListItemSource[];
740
- }
741
- interface KnowledgeRequest {
742
- customerInstruction: string;
743
- question: string;
744
- doNotKnowAnswer?: string;
745
- }
746
- interface KnowledgeResponse {
747
- question: string;
748
- answer: KnowledgeAnswer;
749
- }
750
- type State$6 = {
751
- data: KnowledgeResponse[];
752
- fetchState: FetchState;
753
- };
754
-
755
- declare namespace Server {
756
517
  /**
757
- * API create conversation payload
518
+ * API object for pinned message
758
519
  */
759
- type CreateConversationPayload = {
760
- platform: string;
761
- session_id: string;
762
- agent_id: string;
763
- profile_code?: string;
764
- tags?: Record<string, string> | null;
765
- agent_name?: string;
766
- agent_nickname?: string;
767
- agent_email?: string;
520
+ type PinnedMessage = {
521
+ message: string;
522
+ title: string;
523
+ image: string;
524
+ image_sizes?: {
525
+ small: string;
526
+ medium: string;
527
+ large: string;
528
+ };
768
529
  };
769
530
  /**
770
- * API message object
531
+ * API object for style suggestions
771
532
  */
772
- type ConversationMessage = {
773
- id: string;
774
- time: string;
775
- source: 'agent' | 'visitor' | 'bot' | 'system';
776
- author_id: string;
777
- author_name?: string;
778
- author_email?: string;
533
+ type StyleSuggestion = {
534
+ keyword_matches: {
535
+ keyword: string;
536
+ suggestion: string;
537
+ }[];
538
+ };
539
+ declare enum EventType {
540
+ SEND_MESSAGE = "Send Message",
541
+ HANDLING_TIME = "Handling Time",
542
+ START_AUTOFLOW = "Start Autoflow",
543
+ ABORT_AUTOFLOW = "Abort Autoflow",
544
+ ADD_TO_PERSONAL_COLLECTION = "Add to personal collection",
545
+ DELETE_FROM_PERSONAL_COLLECTION = "Delete from personal collection"
546
+ }
547
+ type UsedSuggestion = {
548
+ ab_test_name?: string | null;
549
+ ab_variant?: string | null;
550
+ input_type: string;
551
+ source?: string;
552
+ source_text?: string;
779
553
  text: string;
780
- tags: Record<string, string> | null;
554
+ training_jobs?: string[];
781
555
  };
782
556
  /**
783
- * API conversation object
784
- */
785
- type Conversation = {
786
- id: string;
787
- profile_code: string | null;
788
- channel: string | null;
789
- platform: string;
790
- agent_id: string;
791
- agent_name: string | null;
792
- agent_nickname: string | null;
793
- agent_email: string | null;
794
- agent_role: string | null;
795
- engagement_type: string | null;
796
- engagement_id: string | null;
797
- engagement_name: string | null;
798
- engagement_skill: string | null;
799
- agent_note: string | null;
800
- survey_email: string | null;
801
- survey_name: string | null;
802
- survey_phone: string | null;
803
- visitor_id: string | null;
804
- visitor_name: string | null;
805
- visitor_device: string | null;
806
- visitor_browser: string | null;
807
- visitor_os: string | null;
808
- visitor_country: string | null;
809
- visitor_state: string | null;
810
- visitor_city: string | null;
811
- visitor_isp: string | null;
812
- visitor_organization: string | null;
813
- visitor_ip_address: string | null;
814
- chat_start_time: number | null;
815
- session_start_time: number | null;
816
- visit_start_time: string | null;
817
- session_id: string;
818
- messages: ConversationMessage[];
819
- tags: Record<string, string> | null;
820
- has_active_profile: boolean;
821
- created: string;
822
- updated: string;
823
- };
824
- /**
825
- * API object for url suggestion
826
- */
827
- type UrlSuggestion = {
828
- id?: string;
829
- score: number;
830
- url: string;
831
- context?: string;
832
- image: string;
833
- summary?: string;
834
- title?: string;
835
- image_sizes?: {
836
- small: string;
837
- medium: string;
838
- large: string;
839
- };
840
- };
841
- /**
842
- * API object for platform config
843
- */
844
- type PlatformConfig = {
845
- config: {
846
- account: {
847
- code: string;
848
- name: string;
849
- url: string;
850
- is_trial: boolean;
851
- };
852
- platform: {
853
- name: string;
854
- url: string;
855
- has_sso: boolean;
856
- authorization_url: string;
857
- client_config: unknown;
858
- };
859
- };
860
- };
861
- /**
862
- * API object for account
863
- */
864
- type Account = {
865
- code: string;
866
- name: string;
867
- rule_engine: boolean;
868
- live_translation_enabled: boolean;
869
- };
870
- /**
871
- * API object for free suggestion
872
- */
873
- type RecommendFreeSuggestion = {
874
- score?: number;
875
- title?: string;
876
- text: string;
877
- message?: string;
878
- url?: string;
879
- ab_variant?: string;
880
- ab_test_name?: string;
881
- training_jobs?: string[];
882
- source_text: string;
883
- };
884
- type ContentType = {
885
- id: number;
886
- code: string;
887
- name: string;
888
- description: string;
889
- };
890
- /**
891
- * API object for autocomplete suggestion
892
- */
893
- type AutocompleteSuggestion = {
894
- label: string;
895
- source: string;
896
- value: string;
897
- training_jobs: string[];
898
- source_text: string;
899
- search_keywords?: string[];
900
- };
901
- /**
902
- * API object for pinned message
903
- */
904
- type PinnedMessage = {
905
- message: string;
906
- title: string;
907
- image: string;
908
- image_sizes?: {
909
- small: string;
910
- medium: string;
911
- large: string;
912
- };
913
- };
914
- /**
915
- * API object for style suggestions
916
- */
917
- type StyleSuggestion = {
918
- keyword_matches: {
919
- keyword: string;
920
- suggestion: string;
921
- }[];
922
- };
923
- declare enum EventType {
924
- SEND_MESSAGE = "Send Message",
925
- HANDLING_TIME = "Handling Time",
926
- START_AUTOFLOW = "Start Autoflow",
927
- ABORT_AUTOFLOW = "Abort Autoflow",
928
- ADD_TO_PERSONAL_COLLECTION = "Add to personal collection",
929
- DELETE_FROM_PERSONAL_COLLECTION = "Delete from personal collection"
930
- }
931
- type UsedSuggestion = {
932
- ab_test_name?: string | null;
933
- ab_variant?: string | null;
934
- input_type: string;
935
- source?: string;
936
- source_text?: string;
937
- text: string;
938
- training_jobs?: string[];
939
- };
940
- /**
941
- * Abstract API object for event data
942
- * @deprecated in favor of EventDataV2
943
- * @see EventV2Data
557
+ * Abstract API object for event data
558
+ * @deprecated in favor of EventDataV2
559
+ * @see EventV2Data
944
560
  */
945
561
  type EventData = {
946
562
  conversation_id: string;
@@ -1020,13 +636,13 @@ declare namespace Server {
1020
636
  name: string;
1021
637
  response: string;
1022
638
  call_to_action?: CallToAction;
1023
- }> : T extends 'json-schema:knowledge-assist' ? Array<{
1024
- answer: string;
1025
- sources: {
639
+ }> : T extends 'json-schema:knowledge-assist' ? {
640
+ response: string;
641
+ sources?: {
1026
642
  name: string;
1027
643
  url: string;
1028
- };
1029
- }> : never;
644
+ }[];
645
+ } : never;
1030
646
  /**
1031
647
  * Handling time event data
1032
648
  */
@@ -1125,7 +741,11 @@ declare namespace Server {
1125
741
  conversation_accepted_assistant?: string;
1126
742
  conversation_new_message_assistant?: string;
1127
743
  conversation_ended_assistant?: string;
744
+ /**
745
+ * @deprecated in favor of `knowledge_assistant_new`
746
+ */
1128
747
  knowledge_assistant: string;
748
+ knowledge_assistant_new: string;
1129
749
  active_config: {
1130
750
  default_locale: string;
1131
751
  };
@@ -1180,11 +800,26 @@ declare namespace Server {
1180
800
  summary: string;
1181
801
  model?: string;
1182
802
  };
803
+ type KnowledgeRequest = {
804
+ customer_instruction: string;
805
+ question: string;
806
+ do_not_know_answer?: string;
807
+ };
808
+ type KnowledgeResponse = {
809
+ question: string;
810
+ answer: {
811
+ answer: string;
812
+ sources?: {
813
+ url?: string;
814
+ name: string;
815
+ }[];
816
+ };
817
+ };
1183
818
  }
1184
- type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'tags'>> & {
819
+ type ConversationMessage = CamelCaseKeys<Omit<Server$1.ConversationMessage, 'tags'>> & {
1185
820
  tags: Record<string, string> | null;
1186
821
  };
1187
- type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'tags' | 'messages'>> & {
822
+ type Conversation = CamelCaseKeys<Omit<Server$1.Conversation, 'tags' | 'messages'>> & {
1188
823
  tags: Record<string, string> | null;
1189
824
  } & {
1190
825
  messages: ConversationMessage[];
@@ -1217,21 +852,21 @@ type CreateConversationOptions = {
1217
852
  /**
1218
853
  * Send message event data
1219
854
  */
1220
- type SendMessageEventData$1 = CamelCaseKeys<Server.SendMessageEventData>;
855
+ type SendMessageEventData$1 = CamelCaseKeys<Server$1.SendMessageEventData>;
1221
856
  /**
1222
857
  * Event v2 payload
1223
858
  */
1224
- type EventV2<T = unknown> = CamelCaseKeys<Omit<Server.EventV2Data, 'name' | 'backend_version' | 'engine_version' | 'gpt_version' | 'data'>> & {
859
+ type EventV2<T = unknown> = CamelCaseKeys<Omit<Server$1.EventV2Data, 'name' | 'backend_version' | 'engine_version' | 'gpt_version' | 'data'>> & {
1225
860
  data: T;
1226
861
  };
1227
862
  /**
1228
863
  * Handling time event data
1229
864
  */
1230
- type HandlingTimeEventData = CamelCaseKeys<Pick<Server.HandlingTimeEventData, 'conversation_id' | 'client_version' | 'time_start' | 'time_stop'>>;
865
+ type HandlingTimeEventData = CamelCaseKeys<Pick<Server$1.HandlingTimeEventData, 'conversation_id' | 'client_version' | 'time_start' | 'time_stop'>>;
1231
866
  /**
1232
867
  * Autoflow event data
1233
868
  */
1234
- type AutoflowEventData = CamelCaseKeys<Server.AutoflowEventData>;
869
+ type AutoflowEventData = CamelCaseKeys<Server$1.AutoflowEventData>;
1235
870
  /**
1236
871
  * Rule event meta data
1237
872
  */
@@ -1305,7 +940,7 @@ type SendEventV2ArgumentMap = {
1305
940
  question: string;
1306
941
  isFollowUpQuestion: boolean;
1307
942
  isAgent: boolean;
1308
- answer: KnowledgeAnswer;
943
+ answer: Server$1.KnowledgeResponse['answer'];
1309
944
  }>;
1310
945
  };
1311
946
  /**
@@ -1341,22 +976,22 @@ declare class DeepdeskAPI {
1341
976
  static exchangeTokenPromise: Promise<void> | null;
1342
977
  private preflight;
1343
978
  constructor(apiUrl: string, options?: DeepdeskAPIOptions);
1344
- createConversation(options: CreateConversationOptions): Promise<CamelCaseKeys<Server.Conversation>>;
1345
- getMe(): Promise<CamelCaseKeys<Server.Me>>;
1346
- postIdentity(identity: CamelCaseKeys<Omit<Server.Identity, 'id'>>): Promise<void>;
1347
- patchMe(data: Partial<CamelCaseKeys<Omit<Server.Me, 'permissions'>>>): Promise<CamelCaseKeys<Server.Me>>;
1348
- getProfile(profileCode: string): Promise<CamelCaseKeys<Server.Profile>>;
1349
- getKnowledgeAssistant(code: string): Promise<CamelCaseKeys<Server.KnowledgeAssistant>>;
1350
- getContentTypes(): Promise<CamelCaseKeys<Server.ContentType[]>>;
1351
- getAccount(): Promise<CamelCaseKeys<Server.Account>>;
979
+ createConversation(options: CreateConversationOptions): Promise<CamelCaseKeys<Server$1.Conversation>>;
980
+ getMe(): Promise<CamelCaseKeys<Server$1.Me>>;
981
+ postIdentity(identity: CamelCaseKeys<Omit<Server$1.Identity, 'id'>>): Promise<void>;
982
+ patchMe(data: Partial<CamelCaseKeys<Omit<Server$1.Me, 'permissions'>>>): Promise<CamelCaseKeys<Server$1.Me>>;
983
+ getProfile(profileCode: string): Promise<CamelCaseKeys<Server$1.Profile>>;
984
+ getKnowledgeAssistant(code: string): Promise<CamelCaseKeys<Server$1.KnowledgeAssistant>>;
985
+ getContentTypes(): Promise<CamelCaseKeys<Server$1.ContentType[]>>;
986
+ getAccount(): Promise<CamelCaseKeys<Server$1.Account>>;
1352
987
  /**
1353
988
  * Fetch a Platform Config
1354
989
  * Don't provide the `platformConfigId` to get the active platform config.
1355
990
  * Provide the `platformConfigId` to get a specific platform config.
1356
991
  */
1357
- getPlatformConfig(platformConfigId?: number): Promise<CamelCaseKeys<Server.PlatformConfig['config']>>;
992
+ getPlatformConfig(platformConfigId?: number): Promise<CamelCaseKeys<Server$1.PlatformConfig['config']>>;
1358
993
  checkUserExists(externalId: string): Promise<boolean>;
1359
- getConversationBySessionId(sessionId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server.Conversation>>;
994
+ getConversationBySessionId(sessionId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server$1.Conversation>>;
1360
995
  isConversationSupported(sessionId: string, options?: RetryOptions): Promise<boolean>;
1361
996
  /**
1362
997
  * Update converstation meta data
@@ -1365,7 +1000,7 @@ declare class DeepdeskAPI {
1365
1000
  /**
1366
1001
  * Post converstation messages
1367
1002
  */
1368
- postMessages(conversationId: string, messages: CamelCaseKeys<Server.ConversationMessage>[]): Promise<({
1003
+ postMessages(conversationId: string, messages: CamelCaseKeys<Server$1.ConversationMessage>[]): Promise<({
1369
1004
  text: string;
1370
1005
  id: string;
1371
1006
  source: "agent" | "visitor" | "bot" | "system";
@@ -1396,7 +1031,7 @@ declare class DeepdeskAPI {
1396
1031
  * Exchange a temporary token for a access token cookie
1397
1032
  */
1398
1033
  exchangeTokenForAccessCookie(token: string): Promise<void>;
1399
- authenticateWithKey(key: string, user: CamelCaseKeys<Server.User>): Promise<void>;
1034
+ authenticateWithKey(key: string, user: CamelCaseKeys<Server$1.User>): Promise<void>;
1400
1035
  /**
1401
1036
  * Request text suggestions based on the current conversation
1402
1037
  */
@@ -1412,23 +1047,23 @@ declare class DeepdeskAPI {
1412
1047
  /**
1413
1048
  * Request autocomplete suggestions based on the agent text input
1414
1049
  */
1415
- getAutocompleteSuggestions(conversationId: string, params: CamelCaseKeys<Server.GetAutocompleteSuggestionsParams>): Promise<TextSuggestion[]>;
1050
+ getAutocompleteSuggestions(conversationId: string, params: CamelCaseKeys<Server$1.GetAutocompleteSuggestionsParams>): Promise<TextSuggestion[]>;
1416
1051
  /**
1417
1052
  * Request pinned messages
1418
1053
  */
1419
- getPinnedMessages(conversationId: string): Promise<CamelCaseKeys<Server.PinnedMessage[]>>;
1054
+ getPinnedMessages(conversationId: string): Promise<CamelCaseKeys<Server$1.PinnedMessage[]>>;
1420
1055
  /**
1421
1056
  * Request style suggestions
1422
1057
  */
1423
- getStyleSuggestions(params: CamelCaseKeys<Server.GetStyleSuggestionsParams>): Promise<CamelCaseKeys<Server.StyleSuggestion>>;
1058
+ getStyleSuggestions(params: CamelCaseKeys<Server$1.GetStyleSuggestionsParams>): Promise<CamelCaseKeys<Server$1.StyleSuggestion>>;
1424
1059
  /**
1425
1060
  * Search
1426
1061
  */
1427
- search(params: SearchOptions): Promise<CamelCaseKeys<Server.SearchResultsData>>;
1428
- knowledgeAssist(request: KnowledgeRequest, chatHistory: KnowledgeResponse[], assistantCode: string, meta?: {
1062
+ search(params: SearchOptions): Promise<CamelCaseKeys<Server$1.SearchResultsData>>;
1063
+ knowledgeAssist(request: CamelCaseKeys<Server$1.KnowledgeRequest>, chatHistory: Server$1.KnowledgeResponse[], assistantCode: string, meta?: {
1429
1064
  agentId?: string;
1430
1065
  conversationId?: string;
1431
- }): Promise<CamelCaseKeys<KnowledgeAnswer>>;
1066
+ }): Promise<CamelCaseKeys<Server$1.KnowledgeResponse['answer']>>;
1432
1067
  requestLoginByEmail(email: string): Promise<{
1433
1068
  code: string;
1434
1069
  message: string;
@@ -1443,7 +1078,7 @@ declare class DeepdeskAPI {
1443
1078
  */
1444
1079
  evaluateRule<Payload = unknown>(label: string, conversationId: string, payload: Payload, opts?: {
1445
1080
  raiseForFailingConditions?: boolean;
1446
- }): Promise<CamelCaseKeys<Server.LegacyCue[]>>;
1081
+ }): Promise<CamelCaseKeys<Server$1.LegacyCue[]>>;
1447
1082
  /**
1448
1083
  * Temporarily restore getSummary for more controlled rollout
1449
1084
  * @deprecated
@@ -1456,17 +1091,30 @@ declare class DeepdeskAPI {
1456
1091
  promptInstruction?: string;
1457
1092
  agentId?: string;
1458
1093
  externalConversationId?: string;
1459
- }): Promise<CamelCaseKeys<Server.Summary>>;
1460
- evaluateAssistant<TOutput extends Server.ResponseFormat = 'text', TInput = Record<string, unknown>>(assistantCode: string, options?: {
1094
+ }): Promise<CamelCaseKeys<Server$1.Summary>>;
1095
+ evaluateAssistant<TOutput extends Server$1.ResponseFormat = 'text', TInput = Record<string, unknown>>(assistantCode: string, options?: {
1461
1096
  expectFormat: TOutput;
1097
+ threadId?: number;
1462
1098
  input: TInput;
1463
1099
  transcript?: Array<{
1464
1100
  source: string;
1465
1101
  text: string;
1466
1102
  }>;
1467
- conversationId?: string;
1468
- }): Promise<CamelCaseKeys<Server.EvaluationOutput<TOutput>>>;
1469
- getRules(): Promise<CamelCaseKeys<Server.Rule[]>>;
1103
+ externalConversationId?: string;
1104
+ }): Promise<CamelCaseKeys<Server$1.EvaluationOutput<TOutput>>>;
1105
+ createAssistantThread(init: {
1106
+ assistantCode: string;
1107
+ }): Promise<{
1108
+ id: number;
1109
+ }>;
1110
+ postMessageToAssistantThread(init: {
1111
+ assistantCode: string;
1112
+ threadId: number;
1113
+ message: number;
1114
+ }): Promise<{
1115
+ threadId: number;
1116
+ }>;
1117
+ getRules(): Promise<CamelCaseKeys<Server$1.Rule[]>>;
1470
1118
  translateMessages(params: TranslationRequest): Promise<TranslationResponse>;
1471
1119
  private handleDeepdeskVersionHeaders;
1472
1120
  }
@@ -1499,157 +1147,526 @@ interface TextSuggestion extends SuggestionApiMetrics {
1499
1147
  medium: string;
1500
1148
  large: string;
1501
1149
  };
1502
- }
1503
- interface PinnedMessage extends SuggestionApiMetrics {
1504
- title: string;
1505
- message: string;
1506
- image: string;
1507
- imageSizes?: {
1508
- small: string;
1509
- medium: string;
1510
- large: string;
1150
+ }
1151
+ interface PinnedMessage extends SuggestionApiMetrics {
1152
+ title: string;
1153
+ message: string;
1154
+ image: string;
1155
+ imageSizes?: {
1156
+ small: string;
1157
+ medium: string;
1158
+ large: string;
1159
+ };
1160
+ }
1161
+ interface UrlSuggestion extends SuggestionApiMetrics {
1162
+ id?: string;
1163
+ url: string;
1164
+ context?: string;
1165
+ image: string;
1166
+ summary?: string;
1167
+ title?: string;
1168
+ imageSizes?: {
1169
+ small: string;
1170
+ medium: string;
1171
+ large: string;
1172
+ };
1173
+ }
1174
+ interface SearchSuggestion extends SuggestionApiMetrics {
1175
+ id?: string;
1176
+ text: string;
1177
+ title?: string;
1178
+ source?: string;
1179
+ context?: string;
1180
+ image?: string;
1181
+ type?: SearchResultType;
1182
+ }
1183
+ interface SuggestionEventMetrics {
1184
+ inputType: InputType;
1185
+ }
1186
+ interface SuggestionMetrics extends SuggestionApiMetrics, SuggestionEventMetrics {
1187
+ text: string;
1188
+ searchTerm?: string | null;
1189
+ }
1190
+ type VisitorInfo = {
1191
+ visitorId?: string;
1192
+ visitorName?: string;
1193
+ visitorTimeZone?: string;
1194
+ psid?: string;
1195
+ };
1196
+ type AgentInfo = {
1197
+ agentId: string;
1198
+ agentNickname: string;
1199
+ agentName?: string;
1200
+ agentEmail?: string;
1201
+ agentTimeZone?: string;
1202
+ agentDefaultLocale?: string;
1203
+ };
1204
+ type KnowledgeAssistant = CamelCaseKeys<Server$1.KnowledgeAssistant>;
1205
+ type User = CamelCaseKeys<Server$1.User>;
1206
+ type SendMessageEventData = CamelCaseKeys<Server$1.SendMessageEventData>;
1207
+ type Profile = CamelCaseKeys<Server$1.Profile>;
1208
+
1209
+ type CreateConversation = {
1210
+ platform: string;
1211
+ sessionId: string;
1212
+ profileCode?: string;
1213
+ agentId: string;
1214
+ agentName?: string;
1215
+ agentNickname?: string;
1216
+ agentEmail?: string;
1217
+ tags?: Record<string, string> | null;
1218
+ };
1219
+ type TranslationRequest = {
1220
+ targetLanguage: string;
1221
+ messages: Array<string>;
1222
+ };
1223
+ type Translation = {
1224
+ originalLanguage: string;
1225
+ targetLanguage: string;
1226
+ translation: string;
1227
+ };
1228
+ type TranslationResponse = Translation[];
1229
+ interface Entity {
1230
+ text: string;
1231
+ label: string;
1232
+ }
1233
+ type CustomData = Record<string, unknown>;
1234
+ type VariableMapping = Record<string, string>;
1235
+ type CustomDataSchema = Array<{
1236
+ path: string;
1237
+ label: string;
1238
+ type: 'string' | 'number';
1239
+ } | {
1240
+ path: string;
1241
+ label: string;
1242
+ type: 'boolean';
1243
+ trueValue?: string;
1244
+ falseValue?: string;
1245
+ }>;
1246
+ type PlatformConfig = CamelCaseKeys<Server$1.PlatformConfig>;
1247
+ /**
1248
+ * Utils
1249
+ */
1250
+ type Logger = {
1251
+ info(...args: any[]): void;
1252
+ warn(...args: any[]): void;
1253
+ error(...args: any[]): void;
1254
+ };
1255
+ declare enum FetchState {
1256
+ IDLE = "idle",
1257
+ LOADING = "loading",
1258
+ DONE = "done",
1259
+ ERROR = "error"
1260
+ }
1261
+
1262
+ type KeyboardMetric = Pick<KeyboardEvent, 'key' | 'shiftKey' | 'ctrlKey' | 'altKey' | 'metaKey'>;
1263
+ type StageSuggestion = {
1264
+ text: string;
1265
+ suggestion: TextSuggestion;
1266
+ eventMetrics: SuggestionEventMetrics;
1267
+ replace: 'selection' | 'until-selection-end';
1268
+ };
1269
+ type EditTextSuggestionPayload = {
1270
+ contentType: string;
1271
+ index: number | null;
1272
+ suggestions: TextSuggestion[];
1273
+ };
1274
+ type MetricState = {
1275
+ numCharsTyped: number;
1276
+ numCharsPasted: number;
1277
+ numCharsCut: number;
1278
+ numCharsDeleted: number;
1279
+ numPaste: number;
1280
+ agentStartedTypingTimestamp: number | null;
1281
+ externalTimeTotalSeconds: number | null;
1282
+ pastes: any[];
1283
+ deletions: any[];
1284
+ offeredTextSuggestions: TextSuggestion[];
1285
+ textSuggestions: SuggestionMetrics[];
1286
+ cuts: any[];
1287
+ };
1288
+ type State$f = {
1289
+ text: string;
1290
+ html: string | null;
1291
+ selection: SelectionRange;
1292
+ beforeInputChange: {
1293
+ text: string;
1294
+ selection: SelectionRange;
1295
+ keyDown: KeyboardMetric;
1296
+ } | null;
1297
+ mixedSuggestion: TextSuggestion | null;
1298
+ metrics: MetricState;
1299
+ textSuggestions: TextSuggestion[];
1300
+ selectedSuggestionIndex: number;
1301
+ };
1302
+
1303
+ type State$e = {
1304
+ startTime: Date | null;
1305
+ stopTime: Date | null;
1306
+ };
1307
+
1308
+ type SSEClientOptions = {
1309
+ timeout: number;
1310
+ };
1311
+ declare class SSEClient<TEventMap extends Record<string, (data?: any) => void>> {
1312
+ url: string;
1313
+ private eventListeners;
1314
+ private options;
1315
+ private timeoutTimer;
1316
+ eventSource: EventSource | undefined;
1317
+ constructor(url: string, options?: Partial<SSEClientOptions>);
1318
+ private proxyEvent;
1319
+ connect(): void;
1320
+ disconnect(): void;
1321
+ emit(type: keyof TEventMap, eventPayload: any): void;
1322
+ on(type: keyof TEventMap, handler: any): () => void;
1323
+ off(type: keyof TEventMap, handler: any): void;
1324
+ }
1325
+
1326
+ declare namespace Server {
1327
+ interface CustomMessageReplyOption {
1328
+ title: string;
1329
+ payload: string;
1330
+ }
1331
+ interface CustomMessage {
1332
+ text: string;
1333
+ reply_options?: CustomMessageReplyOption[];
1334
+ }
1335
+ interface CustomMessagesResponse {
1336
+ suggestions: CustomMessage[];
1337
+ }
1338
+ declare enum AutoflowSessionState {
1339
+ Started = "Started",
1340
+ Aborted = "Aborted",
1341
+ Completed = "Completed"
1342
+ }
1343
+ interface Autoflow {
1344
+ description?: string;
1345
+ display_name?: string;
1346
+ trigger_payload?: string;
1347
+ state: AutoflowSessionState | null;
1348
+ }
1349
+ interface AutoflowsResponse {
1350
+ autoflows: Autoflow[];
1351
+ }
1352
+ interface AutoflowSessionPayload {
1353
+ platform_session_id: string;
1354
+ trigger_payload: string;
1355
+ }
1356
+ interface AutoflowSession {
1357
+ id: string;
1358
+ platform_session_id: string;
1359
+ session_type: string;
1360
+ state: AutoflowSessionState;
1361
+ data: {
1362
+ trigger_payload: string;
1363
+ 'trigger-payload': string;
1364
+ };
1365
+ }
1366
+ }
1367
+ type EventMap = {
1368
+ customMessageSuggestion: (data: CamelCaseKeys<Server.CustomMessage>) => void;
1369
+ sessionAborted: (data: {
1370
+ id: string;
1371
+ }) => void;
1372
+ sessionCompleted: (data: {
1373
+ id: string;
1374
+ }) => void;
1375
+ };
1376
+ declare class DeepdeskBrokerAPI {
1377
+ apiUrl: string;
1378
+ client: HTTPClient;
1379
+ streams: Record<string, SSEClient<EventMap>>;
1380
+ logger: Logger;
1381
+ constructor(apiUrl: string, options?: HTTPClientOptions);
1382
+ getCustomMessages(platformSessionId: string): Promise<CamelCaseKeys<Server.CustomMessage[]>>;
1383
+ sendCustomMessage(platformSessionId: string, suggestion: CamelCaseKeys<Server.CustomMessage>): Promise<CamelCaseKeys<Server.CustomMessage>>;
1384
+ answerCustomMessage(platformSessionId: string, reply: CamelCaseKeys<Server.CustomMessageReplyOption>): Promise<void>;
1385
+ getAutoflows(platformSessionId: string): Promise<CamelCaseKeys<Server.Autoflow[]>>;
1386
+ startAutoflowSession(autoflowSession: CamelCaseKeys<Server.AutoflowSessionPayload>): Promise<CamelCaseKeys<Server.AutoflowSession>>;
1387
+ stopAutoflowSession(platformSessionId: string): Promise<void>;
1388
+ openStream(platformSessionId: string): SSEClient<EventMap>;
1389
+ closeStream(platformSessionId: string): void;
1390
+ }
1391
+
1392
+ type EvaluationOutput<T extends Server$1.ResponseFormat> = CamelCaseKeys<Server$1.EvaluationOutput<T>>;
1393
+ type AssistantThreadItem = {
1394
+ question: string;
1395
+ answer: {
1396
+ answer: string;
1397
+ sources?: {
1398
+ url?: string;
1399
+ name: string;
1400
+ }[];
1401
+ };
1402
+ };
1403
+ type State$d = {
1404
+ cues: EvaluationOutput<'json-schema:cues'>;
1405
+ threads: Record<number, AssistantThreadItem[]>;
1406
+ fetchState: FetchState;
1407
+ };
1408
+ type Transcript = Array<{
1409
+ source: string;
1410
+ text: string;
1411
+ }>;
1412
+ type TranscriptOption = 'in-memory-transcript' | 'stored-transcript' | Transcript;
1413
+
1414
+ interface StoreConfig {
1415
+ deepdeskAPI: DeepdeskAPI;
1416
+ deepdeskBrokerAPI?: DeepdeskBrokerAPI;
1417
+ dynamicThunkObject?: Record<string, unknown>;
1418
+ middleware?: Middleware[];
1419
+ preloadedState?: any;
1420
+ }
1421
+ declare const reducers: redux.Reducer<redux.CombinedState<{
1422
+ assistants: State$d;
1423
+ auth: State$c;
1424
+ autoflows: State$b;
1425
+ conversation: State$a;
1426
+ contentTypes: State$9;
1427
+ customMessages: State$8;
1428
+ passwordlessToken: State$7;
1429
+ entities: State$6;
1430
+ knowledgeAssistant: State$5;
1431
+ handlingTime: State$e;
1432
+ info: {
1433
+ agentInfo?: AgentInfo | undefined;
1434
+ agentSettings: unknown;
1435
+ visitorInfo?: VisitorInfo | undefined;
1436
+ customData?: CustomData | undefined;
1437
+ platformVariables?: VariableMapping | undefined;
1438
+ fetchState: FetchState;
1439
+ };
1440
+ input: State$f;
1441
+ settings: {
1442
+ locale: Locale;
1443
+ deanonymize: boolean;
1444
+ fallbackImage: string | false;
1445
+ isEmbedded: boolean;
1446
+ showAutoflows: number | boolean;
1447
+ showCustomMessages: number | boolean;
1448
+ showImages: boolean;
1449
+ showSearch: boolean;
1450
+ showImageSearch: boolean;
1451
+ showStyleSuggestions: number | boolean;
1452
+ showMidSentenceSuggestions: boolean;
1453
+ showSuggestionsBeforePattern: string | false;
1454
+ showSuggestionsAfterPattern: string | false;
1455
+ showTabCompletion: boolean;
1456
+ showTextSuggestions: boolean;
1457
+ showEntitiesCommand: boolean;
1458
+ showSummaryCommand: boolean;
1459
+ showKnowledgeSearch: boolean;
1460
+ textSuggestionsCount: number;
1461
+ recommendTextSuggestions: boolean;
1462
+ searchTriggerKey: string;
1463
+ visible: boolean;
1464
+ insertLink: boolean;
1465
+ inlineSuggestions: boolean;
1466
+ floatingMenu: boolean;
1467
+ adminUrl?: string | undefined;
1468
+ productName: string;
1469
+ enableSuggestionFeedback: boolean;
1470
+ enableFeedbackForm: boolean;
1471
+ hasKeyboardInput: boolean;
1472
+ };
1473
+ profile: State$4;
1474
+ search: State$3;
1475
+ styleSuggestions: State$2;
1476
+ ui: {
1477
+ showTabHint: boolean;
1478
+ inputHasFocus: boolean;
1479
+ overlayCollapsed: boolean;
1480
+ openOverlayWhenTyping: boolean;
1481
+ overlayCollapsedUserOverwrite: boolean;
1482
+ };
1483
+ rules: State$1;
1484
+ textSuggestions: TextSuggestionState;
1485
+ }>, redux.AnyAction>;
1486
+ declare function createStore(config: StoreConfig): _reduxjs_toolkit_dist_configureStore.ToolkitStore<redux.EmptyObject & {
1487
+ assistants: State$d;
1488
+ auth: State$c;
1489
+ autoflows: State$b;
1490
+ conversation: State$a;
1491
+ contentTypes: State$9;
1492
+ customMessages: State$8;
1493
+ passwordlessToken: State$7;
1494
+ entities: State$6;
1495
+ knowledgeAssistant: State$5;
1496
+ handlingTime: State$e;
1497
+ info: {
1498
+ agentInfo?: AgentInfo | undefined;
1499
+ agentSettings: unknown;
1500
+ visitorInfo?: VisitorInfo | undefined;
1501
+ customData?: CustomData | undefined;
1502
+ platformVariables?: VariableMapping | undefined;
1503
+ fetchState: FetchState;
1504
+ };
1505
+ input: State$f;
1506
+ settings: {
1507
+ locale: Locale;
1508
+ deanonymize: boolean;
1509
+ fallbackImage: string | false;
1510
+ isEmbedded: boolean;
1511
+ showAutoflows: number | boolean;
1512
+ showCustomMessages: number | boolean;
1513
+ showImages: boolean;
1514
+ showSearch: boolean;
1515
+ showImageSearch: boolean;
1516
+ showStyleSuggestions: number | boolean;
1517
+ showMidSentenceSuggestions: boolean;
1518
+ showSuggestionsBeforePattern: string | false;
1519
+ showSuggestionsAfterPattern: string | false;
1520
+ showTabCompletion: boolean;
1521
+ showTextSuggestions: boolean;
1522
+ showEntitiesCommand: boolean;
1523
+ showSummaryCommand: boolean;
1524
+ showKnowledgeSearch: boolean;
1525
+ textSuggestionsCount: number;
1526
+ recommendTextSuggestions: boolean;
1527
+ searchTriggerKey: string;
1528
+ visible: boolean;
1529
+ insertLink: boolean;
1530
+ inlineSuggestions: boolean;
1531
+ floatingMenu: boolean;
1532
+ adminUrl?: string | undefined;
1533
+ productName: string;
1534
+ enableSuggestionFeedback: boolean;
1535
+ enableFeedbackForm: boolean;
1536
+ hasKeyboardInput: boolean;
1537
+ };
1538
+ profile: State$4;
1539
+ search: State$3;
1540
+ styleSuggestions: State$2;
1541
+ ui: {
1542
+ showTabHint: boolean;
1543
+ inputHasFocus: boolean;
1544
+ overlayCollapsed: boolean;
1545
+ openOverlayWhenTyping: boolean;
1546
+ overlayCollapsedUserOverwrite: boolean;
1511
1547
  };
1512
- }
1513
- interface UrlSuggestion extends SuggestionApiMetrics {
1514
- id?: string;
1515
- url: string;
1516
- context?: string;
1517
- image: string;
1518
- summary?: string;
1519
- title?: string;
1520
- imageSizes?: {
1521
- small: string;
1522
- medium: string;
1523
- large: string;
1548
+ rules: State$1;
1549
+ textSuggestions: TextSuggestionState;
1550
+ }, redux.AnyAction, _reduxjs_toolkit.ThunkMiddleware<redux.CombinedState<{
1551
+ assistants: State$d;
1552
+ auth: State$c;
1553
+ autoflows: State$b;
1554
+ conversation: State$a;
1555
+ contentTypes: State$9;
1556
+ customMessages: State$8;
1557
+ passwordlessToken: State$7;
1558
+ entities: State$6;
1559
+ knowledgeAssistant: State$5;
1560
+ handlingTime: State$e;
1561
+ info: {
1562
+ agentInfo?: AgentInfo | undefined;
1563
+ agentSettings: unknown;
1564
+ visitorInfo?: VisitorInfo | undefined;
1565
+ customData?: CustomData | undefined;
1566
+ platformVariables?: VariableMapping | undefined;
1567
+ fetchState: FetchState;
1524
1568
  };
1569
+ input: State$f;
1570
+ settings: {
1571
+ locale: Locale;
1572
+ deanonymize: boolean;
1573
+ fallbackImage: string | false;
1574
+ isEmbedded: boolean;
1575
+ showAutoflows: number | boolean;
1576
+ showCustomMessages: number | boolean;
1577
+ showImages: boolean;
1578
+ showSearch: boolean;
1579
+ showImageSearch: boolean;
1580
+ showStyleSuggestions: number | boolean;
1581
+ showMidSentenceSuggestions: boolean;
1582
+ showSuggestionsBeforePattern: string | false;
1583
+ showSuggestionsAfterPattern: string | false;
1584
+ showTabCompletion: boolean;
1585
+ showTextSuggestions: boolean;
1586
+ showEntitiesCommand: boolean;
1587
+ showSummaryCommand: boolean;
1588
+ showKnowledgeSearch: boolean;
1589
+ textSuggestionsCount: number;
1590
+ recommendTextSuggestions: boolean;
1591
+ searchTriggerKey: string;
1592
+ visible: boolean;
1593
+ insertLink: boolean;
1594
+ inlineSuggestions: boolean;
1595
+ floatingMenu: boolean;
1596
+ adminUrl?: string | undefined;
1597
+ productName: string;
1598
+ enableSuggestionFeedback: boolean;
1599
+ enableFeedbackForm: boolean;
1600
+ hasKeyboardInput: boolean;
1601
+ };
1602
+ profile: State$4;
1603
+ search: State$3;
1604
+ styleSuggestions: State$2;
1605
+ ui: {
1606
+ showTabHint: boolean;
1607
+ inputHasFocus: boolean;
1608
+ overlayCollapsed: boolean;
1609
+ openOverlayWhenTyping: boolean;
1610
+ overlayCollapsedUserOverwrite: boolean;
1611
+ };
1612
+ rules: State$1;
1613
+ textSuggestions: TextSuggestionState;
1614
+ }>, redux.AnyAction, {
1615
+ dynamicThunkObject: Record<string, unknown> | undefined;
1616
+ deepdeskAPI: DeepdeskAPI;
1617
+ deepdeskBrokerAPI: DeepdeskBrokerAPI | undefined;
1618
+ }>[]>;
1619
+ type RootState = ReturnType<typeof reducers>;
1620
+ type Store = ReturnType<typeof createStore>;
1621
+
1622
+ interface State$c {
1623
+ isLoggedIn: boolean | null;
1624
+ loginFetchState: FetchState;
1625
+ verifyFetchState: FetchState;
1626
+ showLoginOverlay: boolean;
1525
1627
  }
1526
- interface SearchSuggestion extends SuggestionApiMetrics {
1527
- id?: string;
1528
- text: string;
1529
- title?: string;
1530
- source?: string;
1531
- context?: string;
1532
- image?: string;
1533
- type?: SearchResultType;
1534
- }
1535
- interface SuggestionEventMetrics {
1536
- inputType: InputType;
1537
- }
1538
- interface SuggestionMetrics extends SuggestionApiMetrics, SuggestionEventMetrics {
1539
- text: string;
1540
- searchTerm?: string | null;
1541
- }
1542
- type VisitorInfo = {
1543
- visitorId?: string;
1544
- visitorName?: string;
1545
- visitorTimeZone?: string;
1546
- psid?: string;
1547
- };
1548
- type AgentInfo = {
1549
- agentId: string;
1550
- agentNickname: string;
1551
- agentName?: string;
1552
- agentEmail?: string;
1553
- agentTimeZone?: string;
1554
- agentDefaultLocale?: string;
1555
- };
1556
- type KnowledgeAssistant = CamelCaseKeys<Server.KnowledgeAssistant>;
1557
- type User = CamelCaseKeys<Server.User>;
1558
- type SendMessageEventData = CamelCaseKeys<Server.SendMessageEventData>;
1559
- type Profile = CamelCaseKeys<Server.Profile>;
1560
1628
 
1561
- type CreateConversation = {
1562
- platform: string;
1563
- sessionId: string;
1564
- profileCode?: string;
1565
- agentId: string;
1566
- agentName?: string;
1567
- agentNickname?: string;
1568
- agentEmail?: string;
1569
- tags?: Record<string, string> | null;
1570
- };
1571
- type TranslationRequest = {
1572
- targetLanguage: string;
1573
- messages: Array<string>;
1574
- };
1575
- type Translation = {
1576
- originalLanguage: string;
1577
- targetLanguage: string;
1578
- translation: string;
1629
+ type Autoflow = CamelCaseKeys<Server.Autoflow> & {
1630
+ isBusy?: boolean;
1579
1631
  };
1580
- type TranslationResponse = Translation[];
1581
- interface Entity {
1582
- text: string;
1583
- label: string;
1632
+ interface State$b {
1633
+ list: Autoflow[];
1634
+ fetchState: FetchState;
1584
1635
  }
1585
- type CustomData = Record<string, unknown>;
1586
- type VariableMapping = Record<string, string>;
1587
- type CustomDataSchema = Array<{
1588
- path: string;
1589
- label: string;
1590
- type: 'string' | 'number';
1591
- } | {
1592
- path: string;
1593
- label: string;
1594
- type: 'boolean';
1595
- trueValue?: string;
1596
- falseValue?: string;
1597
- }>;
1598
- type PlatformConfig = CamelCaseKeys<Server.PlatformConfig>;
1599
- /**
1600
- * Utils
1601
- */
1602
- type Logger = {
1603
- info(...args: any[]): void;
1604
- warn(...args: any[]): void;
1605
- error(...args: any[]): void;
1606
- };
1607
- declare enum FetchState {
1608
- IDLE = "idle",
1609
- LOADING = "loading",
1610
- DONE = "done",
1611
- ERROR = "error"
1636
+
1637
+ interface State$a {
1638
+ current: Conversation | null;
1639
+ isSupported: boolean | null;
1612
1640
  }
1613
1641
 
1614
- type KeyboardMetric = Pick<KeyboardEvent, 'key' | 'shiftKey' | 'ctrlKey' | 'altKey' | 'metaKey'>;
1615
- type StageSuggestion = {
1616
- text: string;
1617
- suggestion: TextSuggestion;
1618
- eventMetrics: SuggestionEventMetrics;
1619
- replace: 'selection' | 'until-selection-end';
1642
+ type ContentType = CamelCaseKeys<Server$1.ContentType>;
1643
+ type State$9 = {
1644
+ data: ContentType[] | null;
1645
+ fetchState: FetchState;
1620
1646
  };
1621
- type EditTextSuggestionPayload = {
1622
- contentType: string;
1623
- index: number | null;
1624
- suggestions: TextSuggestion[];
1647
+
1648
+ type CustomMessage = CamelCaseKeys<Server.CustomMessage>;
1649
+ interface State$8 {
1650
+ list: CustomMessage[];
1651
+ fetchState: FetchState;
1652
+ sentSuggestions: string[];
1653
+ errorSuggestions: string[];
1654
+ answeredSuggestions: string[];
1655
+ }
1656
+
1657
+ type State$7 = {
1658
+ token: string | null;
1659
+ interval: NodeJS.Timer | null;
1625
1660
  };
1626
- type MetricState = {
1627
- numCharsTyped: number;
1628
- numCharsPasted: number;
1629
- numCharsCut: number;
1630
- numCharsDeleted: number;
1631
- numPaste: number;
1632
- agentStartedTypingTimestamp: number | null;
1633
- externalTimeTotalSeconds: number | null;
1634
- pastes: any[];
1635
- deletions: any[];
1636
- offeredTextSuggestions: TextSuggestion[];
1637
- textSuggestions: SuggestionMetrics[];
1638
- cuts: any[];
1661
+
1662
+ type State$6 = {
1663
+ data: Entity[] | null;
1664
+ fetchState: FetchState;
1639
1665
  };
1666
+
1640
1667
  type State$5 = {
1641
- text: string;
1642
- html: string | null;
1643
- selection: SelectionRange;
1644
- beforeInputChange: {
1645
- text: string;
1646
- selection: SelectionRange;
1647
- keyDown: KeyboardMetric;
1648
- } | null;
1649
- mixedSuggestion: TextSuggestion | null;
1650
- metrics: MetricState;
1651
- textSuggestions: TextSuggestion[];
1652
- selectedSuggestionIndex: number;
1668
+ data: KnowledgeAssistant | null;
1669
+ fetchState: FetchState;
1653
1670
  };
1654
1671
 
1655
1672
  type State$4 = {
@@ -1674,13 +1691,13 @@ interface State$3 {
1674
1691
  aggregates: Record<string, number>;
1675
1692
  }
1676
1693
 
1677
- type StyleSuggestion = CamelCaseKeys<Server.StyleSuggestion>;
1694
+ type StyleSuggestion = CamelCaseKeys<Server$1.StyleSuggestion>;
1678
1695
  interface State$2 {
1679
1696
  list: StyleSuggestion;
1680
1697
  fetchState: FetchState;
1681
1698
  }
1682
1699
 
1683
- type Cue = CamelCaseKeys<Server.LegacyCue>;
1700
+ type Cue = CamelCaseKeys<Server$1.LegacyCue>;
1684
1701
  type State$1 = {
1685
1702
  cues: Cue[];
1686
1703
  fetchState: FetchState;
@@ -2143,17 +2160,16 @@ declare class DeepdeskSDK {
2143
2160
  store: Store;
2144
2161
  constructor({ deepdeskUrl, brokerUrl, version, locale, token, fetch, productName, createCustomChannel, }: SDKOptions);
2145
2162
  get state(): redux.EmptyObject & {
2146
- assistants: State$f;
2147
- answer: State$6;
2148
- auth: State$e;
2149
- autoflows: State$d;
2150
- conversation: State$c;
2151
- contentTypes: State$b;
2152
- customMessages: State$a;
2153
- passwordlessToken: State$9;
2154
- entities: State$8;
2155
- knowledgeAssistant: State$7;
2156
- handlingTime: State$g;
2163
+ assistants: State$d;
2164
+ auth: State$c;
2165
+ autoflows: State$b;
2166
+ conversation: State$a;
2167
+ contentTypes: State$9;
2168
+ customMessages: State$8;
2169
+ passwordlessToken: State$7;
2170
+ entities: State$6;
2171
+ knowledgeAssistant: State$5;
2172
+ handlingTime: State$e;
2157
2173
  info: {
2158
2174
  agentInfo?: AgentInfo | undefined;
2159
2175
  agentSettings: unknown;
@@ -2162,7 +2178,7 @@ declare class DeepdeskSDK {
2162
2178
  platformVariables?: VariableMapping | undefined;
2163
2179
  fetchState: FetchState;
2164
2180
  };
2165
- input: State$5;
2181
+ input: State$f;
2166
2182
  settings: {
2167
2183
  locale: Locale;
2168
2184
  deanonymize: boolean;
@@ -2327,7 +2343,7 @@ declare class DeepdeskSDK {
2327
2343
  * Disable cues in widget by providing `showCuesInWidget: false`-option.
2328
2344
  * `expectFormat` could be 'text', 'json-object', 'json-schema:cues' or 'json-schema:knowledge-assist'
2329
2345
  */
2330
- evaluateAssistant<T extends Server.ResponseFormat = 'json-schema:cues'>(assistantCode: string, options?: {
2346
+ evaluateAssistant<T extends Server$1.ResponseFormat = 'json-schema:cues'>(assistantCode: string, options?: {
2331
2347
  expectFormat?: T;
2332
2348
  input?: Record<string, any>;
2333
2349
  transcript?: TranscriptOption;