@ujet/websdk-headless 3.41.4 → 3.43.4

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.
Files changed (4) hide show
  1. package/dist/index.d.ts +91 -57
  2. package/dist/index.js +146 -146
  3. package/dist/index.mjs +38984 -38886
  4. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -99,6 +99,28 @@ interface ChatMessageRequest {
99
99
  timestamp: string;
100
100
  };
101
101
  }
102
+ interface CheckInVisibilityStateRequest {
103
+ widget_minimized?: boolean;
104
+ tab_inactive?: boolean;
105
+ }
106
+ interface CheckInModalStateRequest {
107
+ modal_type: 'check_in';
108
+ }
109
+
110
+ declare enum PostSessionStatus {
111
+ WAITING = "waiting",
112
+ READY = "ready",
113
+ IN_PROGRESS = "in_progress",
114
+ FINISHED = "finished"
115
+ }
116
+ declare enum CheckInStatus {
117
+ CONFIRMED = "confirmed",
118
+ EXITED = "exited",
119
+ PENDING = "pending",
120
+ REQUESTED = "requested",
121
+ SKIPPED = "skipped",
122
+ TIMED_OUT = "timed_out"
123
+ }
102
124
 
103
125
  interface LanguageOption {
104
126
  lang: string;
@@ -199,6 +221,7 @@ interface ChatResponse {
199
221
  post_session_required?: boolean;
200
222
  post_session_opt_in_required?: boolean;
201
223
  post_session_transfer_status?: string;
224
+ check_in_status?: CheckInStatus;
202
225
  }
203
226
  interface CallResponse {
204
227
  created_at: string;
@@ -263,6 +286,7 @@ interface MessageResponse {
263
286
  };
264
287
  type: string;
265
288
  unredacted?: string;
289
+ visible?: boolean;
266
290
  [key: string]: unknown;
267
291
  }
268
292
  interface PdfStatusResponse {
@@ -332,6 +356,15 @@ interface QuestionItem {
332
356
  value: string;
333
357
  }[];
334
358
  }
359
+ interface CheckInResponse {
360
+ chat_id: number;
361
+ check_in_status: CheckInStatus;
362
+ check_in_at?: string;
363
+ }
364
+ interface ChatMessageResponse {
365
+ content: string;
366
+ timestamp: string;
367
+ }
335
368
 
336
369
  type RequestMethod = (url: string, options: RequestInit | Record<string, any>) => Promise<RequestReturn>;
337
370
  type EventHandler = (data: any) => void;
@@ -435,6 +468,35 @@ declare class EventManager {
435
468
  destroy(): void;
436
469
  }
437
470
 
471
+ declare abstract class BaseProvider {
472
+ static type: string;
473
+ private audio;
474
+ issueChatToken: IssueChatTokenMethod;
475
+ identity: string;
476
+ channelId: string;
477
+ region?: string;
478
+ inTask: boolean;
479
+ muted: boolean;
480
+ events: EventManager;
481
+ constructor(events: EventManager, state: ChatResponse, issueChatToken: IssueChatTokenMethod);
482
+ ping(): void;
483
+ on(eventName: string, handler: EventHandler): void;
484
+ off(eventName: string, handler: EventHandler): void;
485
+ trackInTask(message: MessageResponse): void;
486
+ abstract create(): Promise<void>;
487
+ abstract destroy(): Promise<void>;
488
+ abstract join(sid: string): Promise<void>;
489
+ abstract preview(text: string): Promise<void>;
490
+ abstract fetchMessages(files: {
491
+ [index: number]: File;
492
+ }): Promise<MessageResponse[]>;
493
+ abstract sendMessage(message: MessageRequest): Promise<number>;
494
+ abstract startTyping(): void;
495
+ abstract stopTyping(): void;
496
+ abstract registerConversationEvents(): void;
497
+ }
498
+ declare function addProviderType(Provider: typeof BaseProvider): void;
499
+
438
500
  declare class Chat {
439
501
  private provider;
440
502
  private store;
@@ -475,6 +537,8 @@ declare class Chat {
475
537
  get optInRequired(): boolean;
476
538
  get postSessionRequired(): boolean;
477
539
  get postSessionInProgress(): boolean;
540
+ get checkInStatus(): CheckInStatus | null;
541
+ set checkInStatus(newStatus: CheckInStatus | null);
478
542
  update(state: ChatResponse): void;
479
543
  on(eventName: string, handler: EventHandler): void;
480
544
  off(eventName: string, handler: EventHandler): void;
@@ -494,11 +558,26 @@ declare class Chat {
494
558
  private registerMessageEvents;
495
559
  }
496
560
 
497
- declare enum PostSessionStatus {
498
- WAITING = "waiting",
499
- READY = "ready",
500
- IN_PROGRESS = "in_progress",
501
- FINISHED = "finished"
561
+ declare global {
562
+ interface Window {
563
+ webkitIndexedDB: IDBFactory;
564
+ mozIndexedDB: IDBFactory;
565
+ OIndexedDB: IDBFactory;
566
+ msIndexedDB: IDBFactory;
567
+ }
568
+ }
569
+ declare class MediaStore {
570
+ private db;
571
+ private store;
572
+ save(index: number, file: File): Promise<void>;
573
+ getAll(): Promise<{
574
+ index: number;
575
+ file: File;
576
+ }[]>;
577
+ getAllFiles(): Promise<{
578
+ [index: number]: File;
579
+ }>;
580
+ clear(): Promise<void>;
502
581
  }
503
582
 
504
583
  declare class Cobrowse {
@@ -579,63 +658,18 @@ declare class Client {
579
658
  createCobrowseCode(lang?: string, customData?: Record<string, string>): Promise<string>;
580
659
  startCobrowse(from?: string): Promise<void>;
581
660
  getMessageAttachment(message: MessageResponse): Promise<File | null>;
661
+ checkIn(): Promise<CheckInResponse>;
662
+ exitCheckIn(): Promise<CheckInResponse>;
663
+ notifyCheckInState(data: CheckInVisibilityStateRequest): Promise<void>;
664
+ rejoinChat(): Promise<CheckInResponse>;
665
+ trackCheckInEvent(): Promise<void>;
666
+ private updateCheckIn;
582
667
  private initializeCobrowse;
583
668
  private registerOngoingChat;
584
669
  private getCobrowseScript;
585
670
  _triggerEvent(eventName: string, data?: any): void;
586
671
  }
587
672
 
588
- declare abstract class BaseProvider {
589
- static type: string;
590
- private audio;
591
- issueChatToken: IssueChatTokenMethod;
592
- identity: string;
593
- channelId: string;
594
- region?: string;
595
- inTask: boolean;
596
- muted: boolean;
597
- events: EventManager;
598
- constructor(events: EventManager, state: ChatResponse, issueChatToken: IssueChatTokenMethod);
599
- ping(): void;
600
- on(eventName: string, handler: EventHandler): void;
601
- off(eventName: string, handler: EventHandler): void;
602
- trackInTask(message: MessageResponse): void;
603
- abstract create(): Promise<void>;
604
- abstract destroy(): Promise<void>;
605
- abstract join(sid: string): Promise<void>;
606
- abstract preview(text: string): Promise<void>;
607
- abstract fetchMessages(files: {
608
- [index: number]: File;
609
- }): Promise<MessageResponse[]>;
610
- abstract sendMessage(message: MessageRequest): Promise<number>;
611
- abstract startTyping(): void;
612
- abstract stopTyping(): void;
613
- abstract registerConversationEvents(): void;
614
- }
615
- declare function addProviderType(Provider: typeof BaseProvider): void;
616
-
617
- declare global {
618
- interface Window {
619
- webkitIndexedDB: IDBFactory;
620
- mozIndexedDB: IDBFactory;
621
- OIndexedDB: IDBFactory;
622
- msIndexedDB: IDBFactory;
623
- }
624
- }
625
- declare class MediaStore {
626
- private db;
627
- private store;
628
- save(index: number, file: File): Promise<void>;
629
- getAll(): Promise<{
630
- index: number;
631
- file: File;
632
- }[]>;
633
- getAllFiles(): Promise<{
634
- [index: number]: File;
635
- }>;
636
- clear(): Promise<void>;
637
- }
638
-
639
673
  declare class Logger {
640
674
  channel: string;
641
675
  constructor(channel: string);
@@ -659,4 +693,4 @@ declare const OPTIONS: {
659
693
  version: string;
660
694
  };
661
695
 
662
- export { BaseProvider, type CallRequest, type CallResponse, Chat, type ChatDeflectionResponse, type ChatEndUserEventRequest, type ChatHistoryItem, type ChatHistoryResponse, type ChatMessageRequest, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, Client, type ClientEvent, type ClientOption, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, 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 };
696
+ 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, 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 };