@ujet/websdk-headless 3.44.2 → 4.22.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/README.md CHANGED
@@ -24,10 +24,3 @@ const client = new Client({
24
24
  authenticate: authenticate,
25
25
  })
26
26
  ```
27
-
28
- ## Docs
29
- ### [API/Methods](docs/api.md)
30
- ### [Authentication](docs/authenticate.md)
31
- ### [Screen Share](docs/screen-share.md)
32
- ### [Events](docs/events.md)
33
- ### [Configuration Options](docs/options.md)
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ interface LogData {
6
6
  loglevel: string;
7
7
  timestamp: string;
8
8
  application: string;
9
- version: string;
10
- device: string;
9
+ sdk_version: string;
10
+ device_uuid: string;
11
11
  tenant: string;
12
12
  company_id: string;
13
13
  location_url: string;
@@ -16,6 +16,12 @@ interface LogData {
16
16
  data: any;
17
17
  tracker_id?: string;
18
18
  }
19
+ interface LogHistoryData {
20
+ date: string;
21
+ channel: string;
22
+ level: string;
23
+ args: any[];
24
+ }
19
25
  interface ClientEvent {
20
26
  name: string;
21
27
  payload: {
@@ -76,6 +82,8 @@ interface CallRequest {
76
82
  signed?: string;
77
83
  unsigned?: Record<string, any>;
78
84
  };
85
+ reschedule_call_id?: number;
86
+ use_advanced_call_scheduling?: boolean;
79
87
  }
80
88
  interface EmailRequest {
81
89
  name?: string;
@@ -106,6 +114,11 @@ interface CheckInVisibilityStateRequest {
106
114
  interface CheckInModalStateRequest {
107
115
  modal_type: 'check_in';
108
116
  }
117
+ interface GetTimeSlotsRequest {
118
+ lang?: string;
119
+ rescheduleCallId?: number;
120
+ useAdvancedCallScheduling?: boolean;
121
+ }
109
122
  interface CustomFormPayload {
110
123
  smart_action_id: number;
111
124
  form_response: {
@@ -230,11 +243,13 @@ interface ChatResponse {
230
243
  post_session_transfer_status?: string;
231
244
  check_in_status?: CheckInStatus;
232
245
  }
233
- interface CallResponse {
246
+ interface CallApiResponse {
234
247
  created_at: string;
235
248
  id: number;
236
249
  lang: string;
237
- menu_id: number;
250
+ selected_menu: {
251
+ id: number;
252
+ };
238
253
  menus: {
239
254
  id: number;
240
255
  name: string;
@@ -245,6 +260,9 @@ interface CallResponse {
245
260
  survey_enabled: boolean;
246
261
  type: string;
247
262
  }
263
+ interface CallResponse extends Omit<CallApiResponse, 'selected_menu'> {
264
+ menu_id: number;
265
+ }
248
266
  interface EmailResponse {
249
267
  attachment_count: number;
250
268
  id: number;
@@ -260,6 +278,10 @@ interface GenerateTranscriptResponse {
260
278
  chat_transcript_id: number;
261
279
  status: string;
262
280
  }
281
+ interface ChatDocumentItem {
282
+ media_id: number;
283
+ url: string;
284
+ }
263
285
  interface MessageResponse {
264
286
  $index: number;
265
287
  $sid: string;
@@ -281,6 +303,7 @@ interface MessageResponse {
281
303
  messages: string[];
282
304
  type: any;
283
305
  };
306
+ title?: string;
284
307
  type: string;
285
308
  unredacted?: string;
286
309
  signature?: string;
@@ -393,6 +416,17 @@ interface ChatMessageResponse {
393
416
  content: string;
394
417
  timestamp: string;
395
418
  }
419
+ interface ServerAuthResponse {
420
+ error?: number;
421
+ message?: any;
422
+ auth_token?: string;
423
+ log_proxy_auth_token?: string;
424
+ log_proxy_url?: string;
425
+ }
426
+ interface FeatureFlagsResponse {
427
+ 'advanced-call-scheduling': boolean;
428
+ 'consumer-agent-pdf'?: boolean;
429
+ }
396
430
 
397
431
  type RequestMethod = (url: string, options: RequestInit | Record<string, any>) => Promise<RequestReturn>;
398
432
  type EventHandler = (data: any) => void;
@@ -425,6 +459,8 @@ interface ConnectOption {
425
459
  lang: string;
426
460
  cobrowse: boolean;
427
461
  bridge: string;
462
+ bridgeOrigin: string;
463
+ modules: string[];
428
464
  }
429
465
  interface ConnectRequest {
430
466
  type: string;
@@ -498,6 +534,11 @@ declare abstract class BaseProvider {
498
534
  events: EventManager;
499
535
  constructor(events: EventManager, state: ChatResponse, issueChatToken: IssueChatTokenMethod);
500
536
  ping(): void;
537
+ /**
538
+ * Cleanup audio resources by removing event listeners.
539
+ * Should be called by subclasses in their destroy() method.
540
+ */
541
+ protected cleanupAudio(): void;
501
542
  on(eventName: string, handler: EventHandler): void;
502
543
  off(eventName: string, handler: EventHandler): void;
503
544
  trackInTask(message: MessageResponse): void;
@@ -617,6 +658,7 @@ declare class Client {
617
658
  on(eventName: string, handler: EventHandler): void;
618
659
  off(eventName: string, handler: EventHandler): void;
619
660
  getCompany(): Promise<CompanyResponse>;
661
+ getFeatureFlags(): Promise<FeatureFlagsResponse>;
620
662
  runTrigger(cb: (trigger: TriggerItem) => void): Promise<void>;
621
663
  trackClientEvents(events: ClientEvent[]): Promise<void>;
622
664
  getProhibitedFileTypes(): Promise<FileTypeItem[]>;
@@ -624,7 +666,12 @@ declare class Client {
624
666
  getCustomFormData(formId: string): Promise<RequestReturn>;
625
667
  submitCustomForm(payload: CustomFormPayload): Promise<RequestReturn>;
626
668
  getAfterHourMessage(lang?: string): Promise<string>;
669
+ getTimeSlots(menuId: number | string, options?: GetTimeSlotsRequest): Promise<string[]>;
670
+ /**
671
+ * @deprecated Use getTimeSlots(menuId, options) instead to avoid parameter ambiguity
672
+ */
627
673
  getTimeSlots(menuId: number | string, lang?: string): Promise<string[]>;
674
+ fetchTimeSlotAvailability(menuId: number | string, lang?: string): Promise<boolean>;
628
675
  getWaitTimes(menuId: number | string, lang?: string): Promise<WaitTimeResponse | null>;
629
676
  verifyForm(data: FormData): Promise<boolean>;
630
677
  createCall(menuId: number | string, data: CallRequest): Promise<CallResponse>;
@@ -635,8 +682,9 @@ declare class Client {
635
682
  loadChat(chatId: number | string): Promise<Chat>;
636
683
  resumeChat(chatId: number | string): Promise<Chat>;
637
684
  loadOngoingChat(): Promise<Chat | null>;
685
+ restoreCobrowseSession(): Promise<void>;
638
686
  finishChat(): Promise<void>;
639
- updatePostSession(postSessionStatus: PostSessionStatus): Promise<void>;
687
+ updatePostSession(postSessionStatus: PostSessionStatus, optInSelection?: boolean): Promise<void>;
640
688
  destroyChat(): Promise<void>;
641
689
  getChatDeflection(): Promise<ChatDeflectionResponse | null>;
642
690
  sendChatTranscripts(emails: string[]): Promise<void>;
@@ -662,23 +710,42 @@ declare class Client {
662
710
  notifyCheckInState(data: CheckInVisibilityStateRequest): Promise<void>;
663
711
  rejoinChat(): Promise<CheckInResponse>;
664
712
  trackCheckInEvent(): Promise<void>;
713
+ getLogs(): Promise<{
714
+ bridgeLogs: LogHistoryData[];
715
+ rootLogs: LogHistoryData[];
716
+ }>;
717
+ printLogs(): Promise<void>;
665
718
  private updateCheckIn;
666
719
  private initializeCobrowse;
667
720
  private registerOngoingChat;
668
721
  _triggerEvent(eventName: string, data?: any): void;
669
722
  }
670
723
 
724
+ declare class CircularBuffer<T> {
725
+ private buffer;
726
+ private writeIndex;
727
+ private size;
728
+ private readonly capacity;
729
+ constructor(capacity: number);
730
+ push(item: T): void;
731
+ toArray(): T[];
732
+ clear(): void;
733
+ }
734
+
671
735
  declare class Logger {
672
- channel: string;
673
- constructor(channel: string);
736
+ static logHandlers: LoggerHandler[];
737
+ static logHistory: CircularBuffer<LogHistoryData>;
674
738
  static addHandler(handler: LoggerHandler): void;
739
+ static printLogHistoryData(log: LogHistoryData): void;
740
+ static consoleLog(channel: string, level: string, ...args: any[]): void;
741
+ private channel;
742
+ constructor(channel: string);
675
743
  debug(...args: any[]): void;
676
744
  info(...args: any[]): void;
677
745
  warn(...args: any[]): void;
678
746
  error(...args: any[]): void;
679
- private _log;
747
+ private log;
680
748
  }
681
- declare const consoleLoggerHandler: LoggerHandler;
682
749
 
683
750
  declare const ENVIRONMENT: string;
684
751
  declare const VERSION: string;
@@ -691,4 +758,4 @@ declare const OPTIONS: {
691
758
  version: string;
692
759
  };
693
760
 
694
- export { BaseProvider, type CallRequest, type CallResponse, Chat, type ChatDeflectionResponse, type ChatEndUserEventRequest, type ChatHistoryItem, type ChatHistoryResponse, type ChatMessageRequest, type ChatMessageResponse, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, type CheckInModalStateRequest, type CheckInResponse, CheckInStatus, type CheckInVisibilityStateRequest, Client, type ClientEvent, type ClientOption, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, type CustomFormPayload, ENVIRONMENT, type EmailRequest, type EmailResponse, type EscalateRequest, type EventHandler, EventManager, type FileTypeItem, type FormData, type GenerateTranscriptResponse, type GetServerMessage, type HumanAgent, type IssueChatTokenMethod, type LanguageOption, type LogData, Logger, type LoggerHandler, MediaStore, type MenuChannel, type MenuItem, type MenuResponse, type MessageRequest, type MessageResponse, OPTIONS, type PdfStatusResponse, PostSessionStatus, type QuestionItem, type RateRequest, type RequestMethod, type RequestReturn, type SurveyAnswers, type TokenResponse, type TriggerItem, type TriggerMessage, type UserProfile, VERSION, type VirtualAgent, type WaitTimeResponse, addProviderType, consoleLoggerHandler };
761
+ export { BaseProvider, type CallApiResponse, type CallRequest, type CallResponse, Chat, type ChatDeflectionResponse, type ChatDocumentItem, type ChatEndUserEventRequest, type ChatHistoryItem, type ChatHistoryResponse, type ChatMessageRequest, type ChatMessageResponse, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, type CheckInModalStateRequest, type CheckInResponse, CheckInStatus, type CheckInVisibilityStateRequest, Client, type ClientEvent, type ClientOption, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, type CustomFormPayload, ENVIRONMENT, type EmailRequest, type EmailResponse, type EscalateRequest, type EventHandler, EventManager, type FeatureFlagsResponse, type FileTypeItem, type FormData, type GenerateTranscriptResponse, type GetServerMessage, type GetTimeSlotsRequest, type HumanAgent, type IssueChatTokenMethod, type LanguageOption, type LogData, type LogHistoryData, Logger, type LoggerHandler, MediaStore, type MenuChannel, type MenuItem, type MenuResponse, type MessageRequest, type MessageResponse, OPTIONS, type PdfStatusResponse, PostSessionStatus, type QuestionItem, type RateRequest, type RequestMethod, type RequestReturn, type ServerAuthResponse, type SurveyAnswers, type TokenResponse, type TriggerItem, type TriggerMessage, type UserProfile, VERSION, type VirtualAgent, type WaitTimeResponse, addProviderType };