@iai-lib/any-chat-widget 0.1.0-alpha.6 → 0.1.0-alpha.60

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.
@@ -0,0 +1,19 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ export default class ContactForm extends LitElement {
4
+ static styles: any[];
5
+ params: {
6
+ firstName: string;
7
+ lastName: string;
8
+ email: string;
9
+ phone: string;
10
+ };
11
+ errors: never[];
12
+ phoneInput: HTMLInputElement;
13
+ private phoneCleave;
14
+ firstUpdated(): void;
15
+ submit(e: Event): void;
16
+ cancel(): void;
17
+ updateField(field: string, value: string): void;
18
+ render(): import('lit-html').TemplateResult<1>;
19
+ }
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ export default class TransferConfirmation extends LitElement {
4
+ static styles: any[];
5
+ transfer(): void;
6
+ cancel(): void;
7
+ render(): import('lit-html').TemplateResult<1>;
8
+ }
@@ -1 +1 @@
1
- export { AnyChatWidget } from "./modules/iaiChatWidget/iaiChatWidget";
1
+ export { AnyChatWidget } from './modules/iaiChatWidget/iaiChatWidget';
@@ -2,12 +2,12 @@ export declare class Five9WebSocket {
2
2
  private chatWsUrl;
3
3
  private readonly _emitter;
4
4
  readonly on: {
5
- <Key extends string | number | symbol>(type: Key, handler: import("mitt").Handler<any>): void;
6
- (type: "*", handler: import("mitt").WildcardHandler<any>): void;
5
+ <Key extends string | number | symbol>(type: Key, handler: import('mitt').Handler<any>): void;
6
+ (type: "*", handler: import('mitt').WildcardHandler<any>): void;
7
7
  };
8
8
  readonly off: {
9
- <Key extends string | number | symbol>(type: Key, handler?: import("mitt").Handler<any> | undefined): void;
10
- (type: "*", handler: import("mitt").WildcardHandler<any>): void;
9
+ <Key extends string | number | symbol>(type: Key, handler?: import('mitt').Handler<any> | undefined): void;
10
+ (type: "*", handler: import('mitt').WildcardHandler<any>): void;
11
11
  };
12
12
  private reconnectCodes;
13
13
  private reconnectAttempts;
@@ -1,14 +1,15 @@
1
- import { Five9Types } from "../../types/five9Types";
1
+ import { Five9Types } from '../../types/five9Types';
2
+
2
3
  export declare class Five9Manager {
3
4
  #private;
4
5
  private readonly _emitter;
5
6
  readonly on: {
6
- <Key extends string | number | symbol>(type: Key, handler: import("mitt").Handler<any>): void;
7
- (type: "*", handler: import("mitt").WildcardHandler<any>): void;
7
+ <Key extends string | number | symbol>(type: Key, handler: import('mitt').Handler<any>): void;
8
+ (type: "*", handler: import('mitt').WildcardHandler<any>): void;
8
9
  };
9
10
  readonly off: {
10
- <Key extends string | number | symbol>(type: Key, handler?: import("mitt").Handler<any> | undefined): void;
11
- (type: "*", handler: import("mitt").WildcardHandler<any>): void;
11
+ <Key extends string | number | symbol>(type: Key, handler?: import('mitt').Handler<any> | undefined): void;
12
+ (type: "*", handler: import('mitt').WildcardHandler<any>): void;
12
13
  };
13
14
  conversationStarted: boolean;
14
15
  private five9WebSocket?;
@@ -0,0 +1,4 @@
1
+ import { EnhancedContentParams } from '@iai-lib/chat-widget/dist/types/schema/WidgetOptions';
2
+ import { TemplateResult } from 'lit-html';
3
+
4
+ export declare function photoViewer({ html, params }: EnhancedContentParams): TemplateResult;
@@ -0,0 +1,4 @@
1
+ import { EnhancedContentParams } from '@iai-lib/chat-widget/dist/types/schema/WidgetOptions';
2
+ import { TemplateResult } from 'lit-html';
3
+
4
+ export declare function unitList({ html, params }: EnhancedContentParams): TemplateResult;
@@ -1,2 +1,3 @@
1
- import { FunctionCallParams } from "@iai-lib/chat-widget/dist/types/schema/WidgetOptions";
2
- export declare function showScheduleTourWidget({ id, params, chatWindow }: FunctionCallParams): Promise<void>;
1
+ import { FunctionCallParams } from '@iai-lib/chat-widget/dist/types/schema/WidgetOptions';
2
+
3
+ export declare function generateShowScheduleTourWidgetHandler(schedulerUrl: string): (params: FunctionCallParams) => void;
@@ -1,6 +1,7 @@
1
- import { Five9Manager } from "../../five9/five9Manager";
2
- import { ChatWindowApi } from "@iai-lib/chat-widget/dist/types/types/widget";
3
- import { FunctionCallParams } from "@iai-lib/chat-widget/dist/types/schema/WidgetOptions";
1
+ import { FunctionCallParams } from '@iai-lib/chat-widget/dist/types/schema/WidgetOptions';
2
+ import { ChatWindowApi } from '@iai-lib/chat-widget/dist/types/types/widget';
3
+ import { Five9Manager } from '../../five9/five9Manager';
4
+
4
5
  export declare function getChatSessionKey(historyKey: string | null): string;
5
- export declare function transferToLiveAgent({ params, chatWindow }: FunctionCallParams): Promise<void>;
6
+ export declare function transferToLiveAgent({ id, params, chatWindow, html, }: FunctionCallParams): Promise<void>;
6
7
  export declare function hijackChatForLiveAgent(chatWindow: ChatWindowApi, five9Manager: Five9Manager): void;
@@ -0,0 +1,8 @@
1
+ import { ChatWindowApi } from '@iai-lib/chat-widget/dist/types/types/widget';
2
+ import { TwilioManager } from '../../twilio/twilioManager';
3
+
4
+ /**
5
+ * Hijacks the chat window to use Twilio for live agent communication
6
+ * Maps Twilio events to the chat window API
7
+ */
8
+ export declare function hijackChatForTwilio(chatWindow: ChatWindowApi, twilioManager: TwilioManager): void;
@@ -1,7 +1,11 @@
1
- import { WidgetOptions } from "@iai-lib/chat-widget/dist/types/schema/WidgetOptions";
2
- import { IAIChatWidget } from "@iai-lib/chat-widget";
1
+ import { IAIChatWidget } from '@iai-lib/chat-widget';
2
+ import { WidgetOptions } from '@iai-lib/chat-widget/dist/types/schema/WidgetOptions';
3
+
3
4
  export declare class AnyChatWidget {
4
5
  chatWidget: IAIChatWidget;
5
- constructor(widgetOptions: WidgetOptions);
6
+ constructor(widgetOptions: Partial<WidgetOptions>, anyOptions: AnyOptions);
6
7
  destroy(): void;
7
8
  }
9
+ export interface AnyOptions {
10
+ schedulerUrl: string;
11
+ }
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Type definitions for Twilio Conversations integration
3
+ *
4
+ * These types define the structure of data used throughout the Twilio chat implementation.
5
+ * They mirror the Five9 types structure for API compatibility while adapting to Twilio's model.
6
+ */
7
+ /**
8
+ * Twilio-specific enumerations
9
+ */
10
+ export declare namespace TwilioTypes {
11
+ /**
12
+ * Message content types supported by Twilio Conversations
13
+ */
14
+ enum MessageType {
15
+ TEXT = "TEXT",
16
+ MEDIA = "MEDIA"
17
+ }
18
+ /**
19
+ * Message acknowledgment/delivery status types
20
+ */
21
+ enum AcknowledgeType {
22
+ DELIVERED = "DELIVERED",
23
+ READ = "READ",
24
+ FAILED = "FAILED"
25
+ }
26
+ /**
27
+ * Connection states for the Twilio client
28
+ */
29
+ enum ConnectionState {
30
+ CONNECTING = "connecting",
31
+ CONNECTED = "connected",
32
+ DISCONNECTING = "disconnecting",
33
+ DISCONNECTED = "disconnected",
34
+ DENIED = "denied",
35
+ ERROR = "error"
36
+ }
37
+ /**
38
+ * Conversation lifecycle states
39
+ */
40
+ enum ConversationStatus {
41
+ PENDING = "PENDING",
42
+ ACTIVE = "ACTIVE",
43
+ INACTIVE = "INACTIVE",
44
+ CLOSED = "CLOSED"
45
+ }
46
+ /**
47
+ * Participant types in a conversation
48
+ */
49
+ enum ParticipantType {
50
+ CHAT = "chat",
51
+ SMS = "sms",
52
+ WHATSAPP = "whatsapp"
53
+ }
54
+ /**
55
+ * Message delivery receipt types
56
+ */
57
+ enum DeliveryStatus {
58
+ QUEUED = "queued",
59
+ SENT = "sent",
60
+ DELIVERED = "delivered",
61
+ READ = "read",
62
+ FAILED = "failed",
63
+ UNDELIVERED = "undelivered"
64
+ }
65
+ /**
66
+ * Configuration for initializing Twilio chat
67
+ */
68
+ type TwilioConfig = {
69
+ /** Twilio Account SID (optional - can be managed on backend) */
70
+ accountSid?: string;
71
+ /** Access token for authenticating the client */
72
+ accessToken: string;
73
+ /** Identity/username for the chat participant */
74
+ identity: string;
75
+ /** Conversation SID to join (optional - can be created dynamically) */
76
+ conversationSid?: string;
77
+ /** Token refresh endpoint URL */
78
+ tokenRefreshUrl?: string;
79
+ /** Enable automatic reconnection on connection loss */
80
+ autoReconnect?: boolean;
81
+ /** Maximum reconnection attempts */
82
+ maxReconnectAttempts?: number;
83
+ /** Log level for debugging */
84
+ logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
85
+ };
86
+ /**
87
+ * Contact information for conversation participants
88
+ */
89
+ type Contact = {
90
+ email?: string;
91
+ firstName?: string;
92
+ lastName?: string;
93
+ phoneNumber?: string;
94
+ attributes?: Record<string, string>;
95
+ };
96
+ /**
97
+ * Parameters for creating a new conversation
98
+ */
99
+ type ConversationParams = {
100
+ /** Friendly name for the conversation */
101
+ friendlyName?: string;
102
+ /** Unique name/identifier for the conversation */
103
+ uniqueName?: string;
104
+ /** Custom attributes for the conversation */
105
+ attributes?: Record<string, any>;
106
+ /** Contact information */
107
+ contact?: Contact;
108
+ /** Participant identity to add */
109
+ participantIdentity?: string;
110
+ };
111
+ /**
112
+ * Message content structure
113
+ */
114
+ type Message = {
115
+ /** Type of message */
116
+ messageType: MessageType;
117
+ /** Text content of the message */
118
+ message: string;
119
+ /** Optional attributes */
120
+ attributes?: Record<string, any>;
121
+ /** Media URLs (for media messages) */
122
+ media?: string[];
123
+ };
124
+ /**
125
+ * Message acknowledgment data
126
+ */
127
+ type AcknowledgeMessage = {
128
+ /** Acknowledgment type */
129
+ type: AcknowledgeType;
130
+ /** Message index or SID to acknowledge */
131
+ messageId: string;
132
+ };
133
+ /**
134
+ * Batch message acknowledgments
135
+ */
136
+ type AcknowledgeMessages = {
137
+ messages: AcknowledgeMessage[];
138
+ };
139
+ /**
140
+ * Event emitted when a message is received
141
+ */
142
+ type MessageAddedEvent = {
143
+ /** Message index in the conversation */
144
+ index: number;
145
+ /** Message SID */
146
+ sid: string;
147
+ /** Message body/text */
148
+ body: string | null;
149
+ /** Author identity */
150
+ author: string;
151
+ /** Author friendly name (if available from participant attributes) */
152
+ authorFriendlyName?: string;
153
+ /** Participant SID */
154
+ participantSid: string;
155
+ /** Timestamp */
156
+ timestamp: Date;
157
+ /** Message attributes */
158
+ attributes: Record<string, any>;
159
+ /** Media attachments */
160
+ media?: any[];
161
+ };
162
+ /**
163
+ * Event emitted when a participant joins
164
+ */
165
+ type ParticipantJoinedEvent = {
166
+ /** Participant SID */
167
+ sid: string;
168
+ /** Participant identity */
169
+ identity: string;
170
+ /** Participant friendly name (if available from attributes) */
171
+ friendlyName?: string;
172
+ /** Participant attributes */
173
+ attributes: Record<string, any>;
174
+ /** Timestamp */
175
+ timestamp: Date;
176
+ };
177
+ /**
178
+ * Event emitted when a participant leaves
179
+ */
180
+ type ParticipantLeftEvent = {
181
+ /** Participant SID */
182
+ sid: string;
183
+ /** Participant identity */
184
+ identity: string;
185
+ /** Participant friendly name (if available from attributes) */
186
+ friendlyName?: string;
187
+ /** Timestamp */
188
+ timestamp: Date;
189
+ };
190
+ /**
191
+ * Event emitted when typing is detected
192
+ */
193
+ type TypingEvent = {
194
+ /** Participant identity who is typing */
195
+ identity: string;
196
+ /** Participant SID */
197
+ participantSid: string;
198
+ /** Is currently typing */
199
+ isTyping: boolean;
200
+ };
201
+ /**
202
+ * Event emitted on connection state changes
203
+ */
204
+ type ConnectionStateChangeEvent = {
205
+ /** Previous connection state */
206
+ previous: ConnectionState;
207
+ /** Current connection state */
208
+ current: ConnectionState;
209
+ };
210
+ /**
211
+ * Event emitted on conversation state changes
212
+ */
213
+ type ConversationStateChangeEvent = {
214
+ /** Conversation SID */
215
+ conversationSid: string;
216
+ /** Previous status */
217
+ previous: ConversationStatus;
218
+ /** Current status */
219
+ current: ConversationStatus;
220
+ };
221
+ /**
222
+ * Error event data
223
+ */
224
+ type ErrorEvent = {
225
+ /** Error message */
226
+ message: string;
227
+ /** Error code */
228
+ code?: number;
229
+ /** Error status */
230
+ status?: number;
231
+ /** Additional error details */
232
+ details?: any;
233
+ /** Timestamp */
234
+ timestamp: Date;
235
+ };
236
+ /**
237
+ * Token refresh data
238
+ */
239
+ type TokenData = {
240
+ /** New access token */
241
+ token: string;
242
+ /** Token expiration time */
243
+ expiresAt?: Date;
244
+ };
245
+ /**
246
+ * Conversation metadata
247
+ */
248
+ type ConversationInfo = {
249
+ /** Conversation SID */
250
+ sid: string;
251
+ /** Friendly name */
252
+ friendlyName: string | null;
253
+ /** Unique name */
254
+ uniqueName: string | null;
255
+ /** Conversation attributes */
256
+ attributes: Record<string, any>;
257
+ /** Creation date */
258
+ dateCreated: Date;
259
+ /** Last update date */
260
+ dateUpdated: Date;
261
+ /** Conversation state */
262
+ state: string;
263
+ /** Current status */
264
+ status: ConversationStatus;
265
+ };
266
+ /**
267
+ * Participant information
268
+ */
269
+ type Participant = {
270
+ /** Participant SID */
271
+ sid: string;
272
+ /** Identity */
273
+ identity: string;
274
+ /** Participant type */
275
+ type: ParticipantType;
276
+ /** Attributes */
277
+ attributes: Record<string, any>;
278
+ /** Last read message index */
279
+ lastReadMessageIndex: number | null;
280
+ /** Last read timestamp */
281
+ lastReadTimestamp: Date | null;
282
+ };
283
+ /**
284
+ * Message delivery receipt
285
+ */
286
+ type DeliveryReceipt = {
287
+ /** Message SID */
288
+ messageSid: string;
289
+ /** Delivery status */
290
+ status: DeliveryStatus;
291
+ /** Participant SID who acknowledged */
292
+ participantSid: string;
293
+ /** Timestamp */
294
+ timestamp: Date;
295
+ };
296
+ /**
297
+ * Session state for serialization/deserialization
298
+ */
299
+ type SessionState = {
300
+ /** Access token */
301
+ accessToken: string | null;
302
+ /** Identity */
303
+ identity: string | null;
304
+ /** Conversation SID */
305
+ conversationSid: string | null;
306
+ /** Conversation started flag */
307
+ conversationStarted: boolean;
308
+ /** Connection state */
309
+ connectionState: ConnectionState;
310
+ /** Conversation status */
311
+ conversationStatus: ConversationStatus;
312
+ };
313
+ /**
314
+ * Reconnection options
315
+ */
316
+ type ReconnectOptions = {
317
+ /** Maximum number of retry attempts */
318
+ maxAttempts?: number;
319
+ /** Initial delay in milliseconds */
320
+ initialDelay?: number;
321
+ /** Maximum delay in milliseconds */
322
+ maxDelay?: number;
323
+ /** Backoff multiplier */
324
+ backoffMultiplier?: number;
325
+ };
326
+ }