@ujet/websdk-headless 3.41.4 → 3.42.2

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 +90 -57
  2. package/dist/index.js +146 -146
  3. package/dist/index.mjs +38772 -38688
  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' | 'timeout';
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,7 @@ declare class Chat {
475
537
  get optInRequired(): boolean;
476
538
  get postSessionRequired(): boolean;
477
539
  get postSessionInProgress(): boolean;
540
+ get checkInStatus(): CheckInStatus;
478
541
  update(state: ChatResponse): void;
479
542
  on(eventName: string, handler: EventHandler): void;
480
543
  off(eventName: string, handler: EventHandler): void;
@@ -494,11 +557,26 @@ declare class Chat {
494
557
  private registerMessageEvents;
495
558
  }
496
559
 
497
- declare enum PostSessionStatus {
498
- WAITING = "waiting",
499
- READY = "ready",
500
- IN_PROGRESS = "in_progress",
501
- FINISHED = "finished"
560
+ declare global {
561
+ interface Window {
562
+ webkitIndexedDB: IDBFactory;
563
+ mozIndexedDB: IDBFactory;
564
+ OIndexedDB: IDBFactory;
565
+ msIndexedDB: IDBFactory;
566
+ }
567
+ }
568
+ declare class MediaStore {
569
+ private db;
570
+ private store;
571
+ save(index: number, file: File): Promise<void>;
572
+ getAll(): Promise<{
573
+ index: number;
574
+ file: File;
575
+ }[]>;
576
+ getAllFiles(): Promise<{
577
+ [index: number]: File;
578
+ }>;
579
+ clear(): Promise<void>;
502
580
  }
503
581
 
504
582
  declare class Cobrowse {
@@ -579,63 +657,18 @@ declare class Client {
579
657
  createCobrowseCode(lang?: string, customData?: Record<string, string>): Promise<string>;
580
658
  startCobrowse(from?: string): Promise<void>;
581
659
  getMessageAttachment(message: MessageResponse): Promise<File | null>;
660
+ checkIn(): Promise<CheckInResponse>;
661
+ exitCheckIn(): Promise<CheckInResponse>;
662
+ notifyCheckInState(data: CheckInVisibilityStateRequest): Promise<void>;
663
+ rejoinChat(): Promise<CheckInResponse>;
664
+ trackCheckInEvent(): Promise<void>;
665
+ private updateCheckIn;
582
666
  private initializeCobrowse;
583
667
  private registerOngoingChat;
584
668
  private getCobrowseScript;
585
669
  _triggerEvent(eventName: string, data?: any): void;
586
670
  }
587
671
 
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
672
  declare class Logger {
640
673
  channel: string;
641
674
  constructor(channel: string);
@@ -659,4 +692,4 @@ declare const OPTIONS: {
659
692
  version: string;
660
693
  };
661
694
 
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 };
695
+ 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 };