@livechat/customer-sdk 4.0.1 → 5.0.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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="ts-toolbelt" />
1
2
  import { Action } from './types/actions';
2
3
  import { InitialStateData, State } from './types/state';
3
4
  export declare const getAllRequests: (state: State) => Record<string, {
@@ -77,13 +78,6 @@ export declare const getAllRequests: (state: State) => Record<string, {
77
78
  type: import("./types/serverEntities").FormType;
78
79
  group_id: number;
79
80
  };
80
- }, "action" | "payload"> | import("Object/Pick")._Pick<{
81
- request_id: string;
82
- version?: string | undefined;
83
- action: "get_predicted_agent";
84
- payload: {
85
- group_id?: number | undefined;
86
- };
87
81
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
88
82
  request_id: string;
89
83
  version?: string | undefined;
@@ -139,6 +133,7 @@ export declare const getAllRequests: (state: State) => Record<string, {
139
133
  is_mobile?: boolean | undefined;
140
134
  group_id?: number | undefined;
141
135
  referrer?: string | undefined;
136
+ tab_id?: string | undefined;
142
137
  pushes?: Record<string, readonly import("./types").SubscribablePush[]> | undefined;
143
138
  };
144
139
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
@@ -149,6 +144,13 @@ export declare const getAllRequests: (state: State) => Record<string, {
149
144
  chat_id: string;
150
145
  seen_up_to: string;
151
146
  };
147
+ }, "action" | "payload"> | import("Object/Pick")._Pick<{
148
+ request_id: string;
149
+ version?: string | undefined;
150
+ action: "request_welcome_message";
151
+ payload: {
152
+ id?: string | undefined;
153
+ };
152
154
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
153
155
  request_id: string;
154
156
  version?: string | undefined;
@@ -175,6 +177,14 @@ export declare const getAllRequests: (state: State) => Record<string, {
175
177
  event: import("./types/serverEntities").RequestBodyEvent;
176
178
  attach_to_last_thread?: boolean | undefined;
177
179
  };
180
+ }, "action" | "payload"> | import("Object/Pick")._Pick<{
181
+ request_id: string;
182
+ version?: string | undefined;
183
+ action: "send_greeting_button_clicked";
184
+ payload: {
185
+ greeting_unique_id: string;
186
+ button_id: string;
187
+ };
178
188
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
179
189
  request_id: string;
180
190
  version?: string | undefined;
@@ -344,13 +354,6 @@ export declare const getRequest: (state: State, id: string) => {
344
354
  type: import("./types/serverEntities").FormType;
345
355
  group_id: number;
346
356
  };
347
- }, "action" | "payload"> | import("Object/Pick")._Pick<{
348
- request_id: string;
349
- version?: string | undefined;
350
- action: "get_predicted_agent";
351
- payload: {
352
- group_id?: number | undefined;
353
- };
354
357
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
355
358
  request_id: string;
356
359
  version?: string | undefined;
@@ -406,6 +409,7 @@ export declare const getRequest: (state: State, id: string) => {
406
409
  is_mobile?: boolean | undefined;
407
410
  group_id?: number | undefined;
408
411
  referrer?: string | undefined;
412
+ tab_id?: string | undefined;
409
413
  pushes?: Record<string, readonly import("./types").SubscribablePush[]> | undefined;
410
414
  };
411
415
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
@@ -416,6 +420,13 @@ export declare const getRequest: (state: State, id: string) => {
416
420
  chat_id: string;
417
421
  seen_up_to: string;
418
422
  };
423
+ }, "action" | "payload"> | import("Object/Pick")._Pick<{
424
+ request_id: string;
425
+ version?: string | undefined;
426
+ action: "request_welcome_message";
427
+ payload: {
428
+ id?: string | undefined;
429
+ };
419
430
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
420
431
  request_id: string;
421
432
  version?: string | undefined;
@@ -442,6 +453,14 @@ export declare const getRequest: (state: State, id: string) => {
442
453
  event: import("./types/serverEntities").RequestBodyEvent;
443
454
  attach_to_last_thread?: boolean | undefined;
444
455
  };
456
+ }, "action" | "payload"> | import("Object/Pick")._Pick<{
457
+ request_id: string;
458
+ version?: string | undefined;
459
+ action: "send_greeting_button_clicked";
460
+ payload: {
461
+ greeting_unique_id: string;
462
+ button_id: string;
463
+ };
445
464
  }, "action" | "payload"> | import("Object/Pick")._Pick<{
446
465
  request_id: string;
447
466
  version?: string | undefined;
@@ -537,6 +556,11 @@ export declare const getSelfId: (state: State) => string | null;
537
556
  export declare const isChatActive: (state: State, chatId: string) => boolean;
538
557
  export declare const isConnected: (state: State) => boolean;
539
558
  export declare const isDestroyed: (state: State) => boolean;
559
+ export declare const getRegionParam: <O extends {
560
+ region?: string | null | undefined;
561
+ }>(options: O) => {
562
+ 'x-region': string;
563
+ } | Record<string, never>;
540
564
  export declare const getApiOrigin: (state: State) => string;
541
565
  export declare const getServerUrl: (state: State) => string;
542
566
  export declare const createInitialState: (initialStateData: InitialStateData) => State;
@@ -0,0 +1,17 @@
1
+ import { CustomerAuth } from '@livechat/customer-auth';
2
+ import { Store } from './types';
3
+ type SendCustomerActionsDependencies = {
4
+ auth: CustomerAuth;
5
+ store: Store;
6
+ };
7
+ export type SendCustomerActionsAction = {
8
+ type: 'click' | 'submit';
9
+ timestamp: string;
10
+ properties: Record<string, any>;
11
+ };
12
+ export type SendCustomerActionsOptions = {
13
+ actions: SendCustomerActionsAction[];
14
+ };
15
+ declare const sendCustomerActions: ({ auth, store }: SendCustomerActionsDependencies, { actions }: SendCustomerActionsOptions) => Promise<void>;
16
+ export default sendCustomerActions;
17
+ //# sourceMappingURL=sendCustomerActions.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { CustomerAuth } from '@livechat/customer-auth';
2
+ import { Store } from './types';
3
+ type SendGreetingButtonClickedDependencies = {
4
+ auth: CustomerAuth;
5
+ store: Store;
6
+ };
7
+ export type SendGreetingButtonClickedOptions = {
8
+ greetingUniqueId: string;
9
+ buttonId: string;
10
+ };
11
+ declare const sendGreetingButtonClicked: ({ auth, store }: SendGreetingButtonClickedDependencies, { greetingUniqueId, buttonId }: SendGreetingButtonClickedOptions) => Promise<void>;
12
+ export default sendGreetingButtonClicked;
13
+ //# sourceMappingURL=sendGreetingButtonClicked.d.ts.map
@@ -1,7 +1,11 @@
1
1
  import { O } from 'ts-toolbelt';
2
2
  import * as clientEntities from './types/clientEntities';
3
3
  import * as serverEntities from './types/serverEntities';
4
- import { Request, Push, DirectResponse } from './types/frames';
4
+ import { DirectResponse, IncomingWelcomeMessagePush, Push, Request } from './types/frames';
5
+ export declare const parseIncomingWelcomeMessagePush: (payload: IncomingWelcomeMessagePush['payload']) => {
6
+ id: string;
7
+ event: clientEntities.PredictedWelcomeMessageEvent;
8
+ };
5
9
  export declare const parseForm: (form: {
6
10
  id: string;
7
11
  fields: serverEntities.FormField[];
@@ -64,16 +68,9 @@ export declare const parsePush: (push: Push) => {
64
68
  } | {
65
69
  action: "customer_disconnected";
66
70
  payload: {
67
- reason: "customer_banned" | "license_expired" | "product_version_changed" | "logged_out_remotely" | "misdirected_connection" | "access_token_expired" | "connection_timeout" | "customer_temporarily_blocked" | "inactivity_timeout" | "internal_error" | "license_not_found" | "service_temporarily_unavailable" | "too_many_connections" | "too_many_unauthorized_connections" | "unsupported_version";
71
+ reason: "access_token_expired" | "connection_timeout" | "customer_banned" | "customer_temporarily_blocked" | "inactivity_timeout" | "internal_error" | "license_expired" | "license_not_found" | "misdirected_connection" | "product_version_changed" | "service_temporarily_unavailable" | "too_many_connections" | "too_many_unauthorized_connections" | "unsupported_version" | "logged_out_remotely";
68
72
  data?: any;
69
73
  };
70
- } | {
71
- action: "customer_page_updated";
72
- payload: {
73
- url: string;
74
- title: string | undefined;
75
- openedAt: string;
76
- };
77
74
  } | {
78
75
  action: "customer_updated";
79
76
  payload: {
@@ -179,6 +176,30 @@ export declare const parsePush: (push: Push) => {
179
176
  isTyping: boolean;
180
177
  };
181
178
  };
179
+ } | {
180
+ action: "incoming_thinking_indicator";
181
+ payload: {
182
+ description?: string | undefined;
183
+ title?: string | undefined;
184
+ customId?: string | undefined;
185
+ chatId: string;
186
+ threadId: string;
187
+ authorId: string;
188
+ sentAt: string;
189
+ };
190
+ } | {
191
+ action: "incoming_event_preview";
192
+ payload: {
193
+ chatId: string;
194
+ threadId: string;
195
+ event: clientEntities.Event | null;
196
+ };
197
+ } | {
198
+ action: "incoming_welcome_message";
199
+ payload: {
200
+ id: string;
201
+ event: clientEntities.PredictedWelcomeMessageEvent;
202
+ };
182
203
  } | {
183
204
  action: "queue_position_updated";
184
205
  payload: {
@@ -215,6 +236,7 @@ export declare const parsePush: (push: Push) => {
215
236
  payload: {
216
237
  chatId: string;
217
238
  userId: string;
239
+ reason: "chat_deactivated" | "disconnected" | "manual" | "signed_out" | "remotely_signed_out" | "deleted" | "inactive" | "other";
218
240
  };
219
241
  };
220
242
  export declare const parseResponse: ({ request, response, }: {
@@ -284,9 +306,6 @@ export declare const parseResponse: ({ request, response, }: {
284
306
  };
285
307
  enabled: true;
286
308
  };
287
- } | {
288
- action: "get_predicted_agent";
289
- payload: clientEntities.PredictedAgent;
290
309
  } | {
291
310
  action: "get_url_info";
292
311
  payload: clientEntities.UrlInfo;
@@ -342,6 +361,15 @@ export declare const parseResponse: ({ request, response, }: {
342
361
  payload: Readonly<{
343
362
  readonly success: true;
344
363
  }>;
364
+ } | {
365
+ action: "request_welcome_message";
366
+ payload: {
367
+ id: string;
368
+ predictedAgent: clientEntities.PredictedAgent['agent'] & {
369
+ botType: 'chatbot' | 'ai_agent';
370
+ };
371
+ queue: boolean;
372
+ };
345
373
  } | {
346
374
  action: "send_sneak_peek";
347
375
  payload: Readonly<{
@@ -352,6 +380,11 @@ export declare const parseResponse: ({ request, response, }: {
352
380
  payload: Readonly<{
353
381
  readonly success: true;
354
382
  }>;
383
+ } | {
384
+ action: "send_greeting_button_clicked";
385
+ payload: Readonly<{
386
+ readonly success: true;
387
+ }>;
355
388
  } | {
356
389
  action: "send_rich_message_postback";
357
390
  payload: Readonly<{
@@ -1,5 +1,5 @@
1
1
  import { CustomerAuth } from '@livechat/customer-auth';
2
- import { Store, CustomerSessionFields } from '../types';
2
+ import { CustomerSessionFields, Store } from '../types';
3
3
  declare const checkGoals: (store: Store, auth: CustomerAuth, sessionFields?: CustomerSessionFields) => Promise<void>;
4
4
  export default checkGoals;
5
5
  //# sourceMappingURL=checkGoals.d.ts.map
@@ -1,13 +1,14 @@
1
1
  import { CustomerAuth } from '@livechat/customer-auth';
2
2
  import { SocketClient } from '../socketClient';
3
- import { Action } from '../types/actions';
4
3
  import { CustomerDataProvider, Store } from '../types';
5
- declare const _default: ({ auth, customerDataProvider, emitter, socket, licenseId, }: {
4
+ import { Action } from '../types/actions';
5
+ declare const _default: ({ auth, customerDataProvider, emitter, socket, parentStorage, hasCustomIdentityProvider, }: {
6
6
  auth: CustomerAuth;
7
7
  customerDataProvider?: CustomerDataProvider | undefined;
8
8
  socket: SocketClient;
9
9
  emitter: any;
10
- licenseId: number;
10
+ parentStorage?: Storage | undefined;
11
+ hasCustomIdentityProvider: boolean;
11
12
  }) => (action: Action, store: Store) => void;
12
13
  export default _default;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { Store } from './types';
2
2
  import { SideStorage } from './types/serverEntities';
3
- export declare const getSideStorage: (store: Store, licenseId: number) => Promise<SideStorage>;
4
- export declare const saveSideStorage: (store: Store, sideStorage: SideStorage) => void;
3
+ export declare const getSideStorage: (store: Store, parentStorage?: Storage) => Promise<SideStorage>;
4
+ export declare const saveSideStorage: (store: Store, sideStorage: SideStorage, parentStorage?: Storage) => void;
5
+ export declare const clearSideStorage: (store: Store, parentStorage?: Storage) => void;
5
6
  //# sourceMappingURL=sideStorage.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { PlatformClient } from '@livechat/platform-client';
2
2
  import { Store } from './types';
3
- import { Push, PushResponse, Response, ResponseError, Request } from './types/frames';
3
+ import { Push, PushResponse, Request, Response, ResponseError } from './types/frames';
4
4
  type Incoming = Push | PushResponse | Response | ResponseError;
5
5
  type ParametrizedPlatformClient = PlatformClient<Incoming, Request>;
6
6
  export type SocketClient = ParametrizedPlatformClient & {
@@ -2,10 +2,10 @@ import { SocketClient } from './socketClient';
2
2
  import { Store } from './types';
3
3
  import { Push, PushResponse, ResponseError } from './types/frames';
4
4
  declare const _default: (store: Store, socket: SocketClient) => {
5
- <Key extends keyof import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response | Push | PushResponse | ResponseError>>(type: Key, handler?: import("mitt").Handler<import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response | Push | PushResponse | ResponseError>[Key]> | undefined): void;
6
- (type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response | Push | PushResponse | ResponseError>>): void;
5
+ <Key extends keyof import("@livechat/platform-client/types").PlatformClientEvents<PushResponse | Push | import("./types/frames").Response | ResponseError>>(type: Key, handler?: import("mitt").Handler<import("@livechat/platform-client/types").PlatformClientEvents<PushResponse | Push | import("./types/frames").Response | ResponseError>[Key]> | undefined): void;
6
+ (type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<PushResponse | Push | import("./types/frames").Response | ResponseError>>): void;
7
7
  } & {
8
- (type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response | Push | PushResponse | ResponseError>>): void;
8
+ (type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<PushResponse | Push | import("./types/frames").Response | ResponseError>>): void;
9
9
  (): void;
10
10
  };
11
11
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import { Any, O } from 'ts-toolbelt';
2
2
  import * as reduxActions from '../constants/reduxActions';
3
- import { CustomerSessionFields, Page } from '.';
3
+ import * as serverFrameParser from '../serverFrameParser';
4
4
  import * as clientEntities from './clientEntities';
5
5
  import * as serverEntities from './serverEntities';
6
- import * as serverFrameParser from '../serverFrameParser';
6
+ import { CustomerSessionFields, Page } from '.';
7
7
  import { PushResponse, Request } from './frames';
8
8
  export type ChangeRegionAction = {
9
9
  type: typeof reduxActions.CHANGE_REGION;
@@ -152,6 +152,16 @@ export type UpdateCustomerPageAction = {
152
152
  type: typeof reduxActions.UPDATE_CUSTOMER_PAGE;
153
153
  payload: Page;
154
154
  };
155
- export type Action = ChangeRegionAction | CheckGoalsAction | DestroyAction | FailAllRequestsAction | LoginSuccessAction | PauseConnectionAction | PrefetchTokenAction | PushReceivedAction | PushResponseReceivedAction | ReconnectAction | RequestFailedAction | ResponseReceivedAction | SendRequestAction | SetChatActiveAction | SetSelfIdAction | SocketConnectedAction | SocketDisconnectedAction | SocketRecoveredAction | SocketUnstableAction | StartConnectionAction | UpdateCustomerPageAction;
155
+ export type ClearSensitiveSessionStateAction = {
156
+ type: typeof reduxActions.CLEAR_SENSITIVE_SESSION_STATE;
157
+ };
158
+ export type IdentityChangedAction = {
159
+ type: typeof reduxActions.IDENTITY_CHANGED;
160
+ payload: {
161
+ previousId: string;
162
+ newId: string;
163
+ };
164
+ };
165
+ export type Action = ChangeRegionAction | CheckGoalsAction | DestroyAction | FailAllRequestsAction | LoginSuccessAction | PauseConnectionAction | PrefetchTokenAction | PushReceivedAction | PushResponseReceivedAction | ReconnectAction | RequestFailedAction | ResponseReceivedAction | SendRequestAction | SetChatActiveAction | SetSelfIdAction | SocketConnectedAction | SocketDisconnectedAction | SocketRecoveredAction | SocketUnstableAction | StartConnectionAction | UpdateCustomerPageAction | ClearSensitiveSessionStateAction | IdentityChangedAction;
156
166
  export {};
157
167
  //# sourceMappingURL=actions.d.ts.map
@@ -8,6 +8,7 @@ export type Greeting = {
8
8
  addon: string | null;
9
9
  uniqueId: string;
10
10
  displayedFirstTime: boolean;
11
+ isExitIntent: boolean;
11
12
  accepted: boolean;
12
13
  subtype: GreetingSubtype;
13
14
  event: GreetingEvent;
@@ -120,7 +121,9 @@ export type PredictedAgent = {
120
121
  }>;
121
122
  queue: boolean;
122
123
  };
123
- export type CustomerUpdate = Any.Compute<Partial<Pick<Customer, 'avatar' | 'email' | 'name' | 'sessionFields'>>>;
124
+ export type CustomerUpdate = Any.Compute<Partial<Pick<Customer, 'avatar' | 'email' | 'name' | 'sessionFields'>> & {
125
+ nameIsDefault?: boolean;
126
+ }>;
124
127
  export type FormType = serverEntities.FormType;
125
128
  type FormFieldOption = {
126
129
  id: string;
@@ -238,19 +241,85 @@ type RichMessageUrlButton = Any.Compute<RichMessageButtonBase & {
238
241
  value: string;
239
242
  target?: 'current' | 'new';
240
243
  }>;
244
+ type RichMessageOpenExternalButton = Any.Compute<RichMessageButtonBase & {
245
+ type: 'open_external';
246
+ value: string;
247
+ target?: 'current' | 'new';
248
+ }>;
249
+ type RichMessageAddToCartButton = Any.Compute<RichMessageButtonBase & {
250
+ type: 'add_to_cart';
251
+ value: string;
252
+ }>;
253
+ type RichMessageShowGalleryButton = Any.Compute<RichMessageButtonBase & {
254
+ type: 'show_gallery';
255
+ value: string;
256
+ }>;
241
257
  type RichMessagePhoneButton = Any.Compute<RichMessageButtonBase & {
242
258
  type: 'phone';
243
259
  value: string;
244
260
  }>;
261
+ type RichMessageCopyButton = Any.Compute<RichMessageButtonBase & {
262
+ type: 'copy';
263
+ value: string;
264
+ }>;
245
265
  type RichMessageCancelButton = Any.Compute<RichMessageButtonBase & {
246
266
  type: 'cancel';
247
267
  }>;
248
268
  type RichMessageWebviewButton = Any.Compute<RichMessageButtonBase & {
249
269
  type: 'webview';
250
270
  value: string;
251
- webviewHeight?: 'full' | 'tall' | 'compact';
252
271
  }>;
253
- export type RichMessageButton = RichMessageButtonWithoutValue | RichMessageMessageButton | RichMessageUrlButton | RichMessagePhoneButton | RichMessageCancelButton | RichMessageWebviewButton;
272
+ export type RichMessageButton = RichMessageButtonWithoutValue | RichMessageMessageButton | RichMessageUrlButton | RichMessageOpenExternalButton | RichMessageAddToCartButton | RichMessageShowGalleryButton | RichMessagePhoneButton | RichMessageCancelButton | RichMessageWebviewButton | RichMessageCopyButton;
273
+ type RichMessageEcommerceAddonPriceRange = {
274
+ addonType: 'price_range';
275
+ rangeFrom?: string | number;
276
+ rangeTo?: string | number;
277
+ currency?: string;
278
+ };
279
+ type RichMessageEcommerceAddonMoreItems = {
280
+ addonType: 'more_items';
281
+ };
282
+ type RichMessageEcommerceAddon = RichMessageEcommerceAddonPriceRange | RichMessageEcommerceAddonMoreItems;
283
+ type RichMessageEcommerceBaseOption = {
284
+ label: string;
285
+ optionId: string;
286
+ price?: string | number;
287
+ regularPrice?: string | number;
288
+ maxPrice?: string | number;
289
+ currency?: string;
290
+ selected?: boolean;
291
+ available?: boolean;
292
+ };
293
+ type RichMessageEcommerceTagOption = RichMessageEcommerceBaseOption;
294
+ type RichMessageEcommerceSwatchOption = RichMessageEcommerceBaseOption & {
295
+ color: string;
296
+ };
297
+ type RichMessageEcommerceImageOption = RichMessageEcommerceBaseOption & {
298
+ imageUrl: string;
299
+ imageThumbnailUrl?: string;
300
+ };
301
+ type RichMessageEcommerceSelectOption = RichMessageEcommerceBaseOption;
302
+ type RichMessageEcommerceWithTags = {
303
+ viewType: 'tags';
304
+ options?: RichMessageEcommerceTagOption[];
305
+ };
306
+ type RichMessageEcommerceWithSwatches = {
307
+ viewType: 'swatch';
308
+ options?: RichMessageEcommerceSwatchOption[];
309
+ };
310
+ type RichMessageEcommerceWithImages = {
311
+ viewType: 'images';
312
+ options?: RichMessageEcommerceImageOption[];
313
+ };
314
+ type RichMessageEcommerceWithSelect = {
315
+ viewType: 'select';
316
+ options?: RichMessageEcommerceSelectOption[];
317
+ };
318
+ type RichMessageEcommerce = {
319
+ productId: string;
320
+ label?: string;
321
+ addons?: RichMessageEcommerceAddon[];
322
+ } & (RichMessageEcommerceWithTags | RichMessageEcommerceWithSwatches | RichMessageEcommerceWithImages | RichMessageEcommerceWithSelect);
254
323
  export type RichMessageElement = {
255
324
  title?: string;
256
325
  subtitle?: string;
@@ -263,10 +332,11 @@ export type RichMessageElement = {
263
332
  width?: number;
264
333
  height?: number;
265
334
  };
335
+ ecommerce?: RichMessageEcommerce;
266
336
  buttons?: RichMessageButton[];
267
337
  };
268
338
  export type AvailabilityStatus = 'online' | 'offline';
269
- type RichMessageTemplate = 'cards' | 'quick_replies' | 'sticker';
339
+ type RichMessageTemplate = 'cards' | 'quick_replies' | 'sticker' | 'ecommerce';
270
340
  type Thumbnail = {
271
341
  url: string;
272
342
  height: number;
@@ -308,11 +378,13 @@ type NonImageSpecificProps = {
308
378
  type FormSpecificProps = {
309
379
  type: typeof eventTypes.FORM;
310
380
  formId: string;
381
+ formType?: string;
311
382
  fields: FormField[];
312
383
  };
313
384
  type FilledFormSpecificProps = {
314
385
  type: typeof eventTypes.FILLED_FORM;
315
386
  formId: string;
387
+ formType?: string;
316
388
  fields: FilledFormField[];
317
389
  };
318
390
  type CustomEventSpecificProps = {
@@ -363,6 +435,7 @@ export type Message = Any.Compute<NonSpecificEventBase & MessageSpecificProps>;
363
435
  export type RichMessage = Any.Compute<NonSpecificEventBase & RichMessageSpecificProps>;
364
436
  export type SystemMessage = Any.Compute<NonSpecificEventBase & SystemMessageSpecificProps>;
365
437
  export type GreetingEvent = Object.Update<Message | RichMessage, 'threadId', null>;
438
+ export type PredictedWelcomeMessageEvent = Object.Update<Omit<Message, 'postback'> | RichMessage, 'threadId', null>;
366
439
  export type Event = File | Form | FilledForm | Message | RichMessage | SystemMessage | CustomEvent;
367
440
  export type UrlInfo = {
368
441
  url: string;
@@ -56,14 +56,6 @@ export type CustomerDisconnectedPush = {
56
56
  data?: any;
57
57
  };
58
58
  };
59
- export type CustomerPageUpdatedPush = {
60
- action: typeof serverPushActions.CUSTOMER_PAGE_UPDATED;
61
- payload: {
62
- url: string;
63
- title?: string;
64
- opened_at: string;
65
- };
66
- };
67
59
  export type CustomerSideStorageUpdatedPush = {
68
60
  action: typeof serverPushActions.CUSTOMER_SIDE_STORAGE_UPDATED;
69
61
  payload: {
@@ -181,6 +173,33 @@ export type IncomingTypingIndicatorPush = {
181
173
  };
182
174
  };
183
175
  };
176
+ export type IncomingThinkingIndicatorPush = {
177
+ action: typeof serverPushActions.INCOMING_THINKING_INDICATOR;
178
+ payload: {
179
+ chat_id: string;
180
+ thread_id: string;
181
+ author_id: string;
182
+ sent_at: string;
183
+ custom_id?: string;
184
+ title?: string;
185
+ description?: string;
186
+ };
187
+ };
188
+ export type IncomingEventPreviewPush = {
189
+ action: typeof serverPushActions.INCOMING_EVENT_PREVIEW;
190
+ payload: {
191
+ chat_id: string;
192
+ thread_id: string;
193
+ event: serverEntities.Event;
194
+ };
195
+ };
196
+ export type IncomingWelcomeMessagePush = {
197
+ action: typeof serverPushActions.INCOMING_WELCOME_MESSAGE;
198
+ payload: {
199
+ id: string;
200
+ event: serverEntities.PredictedWelcomeMessage;
201
+ };
202
+ };
184
203
  export type QueuePositionUpdatedPush = {
185
204
  action: typeof serverPushActions.QUEUE_POSITION_UPDATED;
186
205
  payload: {
@@ -219,6 +238,7 @@ export type UserRemovedFromChatPush = {
219
238
  chat_id: string;
220
239
  thread_id: string;
221
240
  user_id: string;
241
+ reason: 'disconnected' | 'signed_out' | 'remotely_signed_out' | 'deleted' | 'chat_deactivated' | 'manual' | 'inactive' | 'other';
222
242
  };
223
243
  };
224
244
  export type PushResponse = Any.Compute<{
@@ -227,7 +247,7 @@ export type PushResponse = Any.Compute<{
227
247
  } & (ChatDeactivatedPush | IncomingChatPush | IncomingEventPush)>;
228
248
  export type Push = Any.Compute<{
229
249
  type: 'push';
230
- } & (ChatDeactivatedPush | ChatPropertiesDeletedPush | ChatPropertiesUpdatedPush | ChatTransferredPush | CustomerDisconnectedPush | CustomerPageUpdatedPush | CustomerSideStorageUpdatedPush | CustomerUpdatedPush | EventPropertiesDeletedPush | EventPropertiesUpdatedPush | EventUpdatedPush | EventsMarkedAsSeenPush | GreetingAcceptedPush | GreetingCanceledPush | GroupsStatusUpdatedPush | IncomingChatPush | IncomingEventPush | IncomingMulticastPush | IncomingGreetingPush | IncomingRichMessagePostbackPush | IncomingTypingIndicatorPush | QueuePositionUpdatedPush | ThreadPropertiesDeletedPush | ThreadPropertiesUpdatedPush | UserAddedToChatPush | UserRemovedFromChatPush)>;
250
+ } & (ChatDeactivatedPush | ChatPropertiesDeletedPush | ChatPropertiesUpdatedPush | ChatTransferredPush | CustomerDisconnectedPush | CustomerSideStorageUpdatedPush | CustomerUpdatedPush | EventPropertiesDeletedPush | EventPropertiesUpdatedPush | EventUpdatedPush | EventsMarkedAsSeenPush | GreetingAcceptedPush | GreetingCanceledPush | GroupsStatusUpdatedPush | IncomingChatPush | IncomingEventPush | IncomingMulticastPush | IncomingGreetingPush | IncomingRichMessagePostbackPush | IncomingTypingIndicatorPush | IncomingThinkingIndicatorPush | IncomingEventPreviewPush | IncomingWelcomeMessagePush | QueuePositionUpdatedPush | ThreadPropertiesDeletedPush | ThreadPropertiesUpdatedPush | UserAddedToChatPush | UserRemovedFromChatPush)>;
231
251
  export type AcceptGreetingRequest = {
232
252
  action: typeof serverRequestActions.ACCEPT_GREETING;
233
253
  payload: {
@@ -289,12 +309,6 @@ export type GetFormRequest = {
289
309
  group_id: number;
290
310
  };
291
311
  };
292
- export type GetPredictedAgentRequest = {
293
- action: typeof serverRequestActions.GET_PREDICTED_AGENT;
294
- payload: {
295
- group_id?: number;
296
- };
297
- };
298
312
  export type GetUrlInfoRequest = {
299
313
  action: typeof serverRequestActions.GET_URL_INFO;
300
314
  payload: {
@@ -344,6 +358,7 @@ export type LoginRequest = {
344
358
  is_mobile?: boolean;
345
359
  group_id?: number;
346
360
  referrer?: string;
361
+ tab_id?: string;
347
362
  pushes?: Record<string, ReadonlyArray<SubscribablePush>>;
348
363
  };
349
364
  };
@@ -354,6 +369,12 @@ export type MarkEventsAsSeenRequest = {
354
369
  seen_up_to: string;
355
370
  };
356
371
  };
372
+ export type RequestWelcomeMessageRequest = {
373
+ action: typeof serverRequestActions.REQUEST_WELCOME_MESSAGE;
374
+ payload: {
375
+ id?: string;
376
+ };
377
+ };
357
378
  export type ResumeChatRequest = {
358
379
  action: typeof serverRequestActions.RESUME_CHAT;
359
380
  payload: {
@@ -378,6 +399,13 @@ export type SendEventRequest = {
378
399
  attach_to_last_thread?: boolean;
379
400
  };
380
401
  };
402
+ export type SendGreetingButtonClickedRequest = {
403
+ action: typeof serverRequestActions.SEND_GREETING_BUTTON_CLICKED;
404
+ payload: {
405
+ greeting_unique_id: string;
406
+ button_id: string;
407
+ };
408
+ };
381
409
  export type SendRichMessagePostbackRequest = {
382
410
  action: typeof serverRequestActions.SEND_RICH_MESSAGE_POSTBACK;
383
411
  payload: {
@@ -461,7 +489,7 @@ export type UpdateThreadPropertiesRequest = {
461
489
  export type Request = Any.Compute<{
462
490
  request_id: string;
463
491
  version?: string;
464
- } & (AcceptGreetingRequest | CancelGreetingRequest | DeactivateChatRequest | DeleteChatPropertiesRequest | DeleteEventPropertiesRequest | DeleteThreadPropertiesRequest | GetChatRequest | GetCustomerRequest | GetFormRequest | GetPredictedAgentRequest | GetUrlInfoRequest | ListGroupStatusesRequest | ListChatsRequest | ListThreadsRequest | LoginRequest | MarkEventsAsSeenRequest | ResumeChatRequest | SendEventRequest | SendRichMessagePostbackRequest | SendSneakPeekRequest | SetCustomerSessionFieldsRequest | StartChatRequest | UpdateChatPropertiesRequest | UpdateCustomerPageRequest | UpdateCustomerRequest | UpdateEventPropertiesRequest | UpdateThreadPropertiesRequest)>;
492
+ } & (AcceptGreetingRequest | CancelGreetingRequest | DeactivateChatRequest | DeleteChatPropertiesRequest | DeleteEventPropertiesRequest | DeleteThreadPropertiesRequest | GetChatRequest | GetCustomerRequest | GetFormRequest | GetUrlInfoRequest | ListGroupStatusesRequest | ListChatsRequest | ListThreadsRequest | LoginRequest | MarkEventsAsSeenRequest | RequestWelcomeMessageRequest | ResumeChatRequest | SendEventRequest | SendGreetingButtonClickedRequest | SendRichMessagePostbackRequest | SendSneakPeekRequest | SetCustomerSessionFieldsRequest | StartChatRequest | UpdateChatPropertiesRequest | UpdateCustomerPageRequest | UpdateCustomerRequest | UpdateEventPropertiesRequest | UpdateThreadPropertiesRequest)>;
465
493
  export type AcceptGreetingResponse = {
466
494
  action: typeof serverRequestActions.ACCEPT_GREETING;
467
495
  payload: EmptyObj;
@@ -506,13 +534,6 @@ export type GetFormResponse = {
506
534
  enabled: false;
507
535
  };
508
536
  };
509
- export type GetPredictedAgentResponse = {
510
- action: typeof serverRequestActions.GET_PREDICTED_AGENT;
511
- payload: {
512
- agent: serverEntities.PredictedAgent;
513
- queue: boolean;
514
- };
515
- };
516
537
  export type GetUrlInfoResponse = {
517
538
  action: typeof serverRequestActions.GET_URL_INFO;
518
539
  payload: {
@@ -566,6 +587,16 @@ export type MarkEventsAsSeenResponse = {
566
587
  action: typeof serverRequestActions.MARK_EVENTS_AS_SEEN;
567
588
  payload: EmptyObj;
568
589
  };
590
+ export type RequestWelcomeMessageResponse = {
591
+ action: typeof serverRequestActions.REQUEST_WELCOME_MESSAGE;
592
+ payload: {
593
+ id: string;
594
+ predicted_agent: serverEntities.PredictedAgent & {
595
+ bot_type: 'chatbot' | 'ai_agent';
596
+ };
597
+ queue: boolean;
598
+ };
599
+ };
569
600
  export type ResumeChatResponse = {
570
601
  action: typeof serverRequestActions.RESUME_CHAT;
571
602
  payload: {
@@ -578,6 +609,10 @@ export type SendEventResponse = {
578
609
  event_id: string;
579
610
  };
580
611
  };
612
+ export type SendGreetingButtonClickedResponse = {
613
+ action: typeof serverRequestActions.SEND_GREETING_BUTTON_CLICKED;
614
+ payload: EmptyObj;
615
+ };
581
616
  export type SendRichMessagePostbackResponse = {
582
617
  action: typeof serverRequestActions.SEND_RICH_MESSAGE_POSTBACK;
583
618
  payload: EmptyObj;
@@ -621,7 +656,7 @@ export type Response = Any.Compute<{
621
656
  type: 'response';
622
657
  request_id: string;
623
658
  success: true;
624
- } & (AcceptGreetingResponse | CancelGreetingResponse | DeleteChatPropertiesResponse | DeleteEventPropertiesResponse | DeleteThreadPropertiesResponse | GetChatResponse | GetCustomerResponse | GetFormResponse | GetPredictedAgentResponse | GetUrlInfoResponse | ListChatsResponse | ListGroupStatusesResponse | ListThreadsResponse | LoginResponse | MarkEventsAsSeenResponse | ResumeChatResponse | SendEventResponse | SendRichMessagePostbackResponse | SendSneakPeekResponse | SetCustomerSessionFieldsResponse | StartChatResponse | UpdateChatPropertiesResponse | UpdateCustomerPageResponse | UpdateCustomerResponse | UpdateEventPropertiesResponse | UpdateThreadPropertiesResponse)>;
659
+ } & (AcceptGreetingResponse | CancelGreetingResponse | DeleteChatPropertiesResponse | DeleteEventPropertiesResponse | DeleteThreadPropertiesResponse | SendGreetingButtonClickedResponse | GetChatResponse | GetCustomerResponse | GetFormResponse | GetUrlInfoResponse | ListChatsResponse | ListGroupStatusesResponse | ListThreadsResponse | LoginResponse | MarkEventsAsSeenResponse | RequestWelcomeMessageResponse | ResumeChatResponse | SendEventResponse | SendRichMessagePostbackResponse | SendSneakPeekResponse | SetCustomerSessionFieldsResponse | StartChatResponse | UpdateChatPropertiesResponse | UpdateCustomerPageResponse | UpdateCustomerResponse | UpdateEventPropertiesResponse | UpdateThreadPropertiesResponse)>;
625
660
  export type DirectResponse = Exclude<Response, {
626
661
  action: typeof serverRequestActions.RESUME_CHAT | typeof serverRequestActions.SEND_EVENT | typeof serverRequestActions.START_CHAT;
627
662
  }>;