@livechat/customer-sdk 4.0.2 → 5.0.1
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 +212 -58
- package/dist/customer-sdk.cjs.js +1473 -1206
- package/dist/customer-sdk.cjs.native.js +1482 -1215
- package/dist/customer-sdk.esm.js +1475 -1207
- package/dist/customer-sdk.js +2088 -1816
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +15 -17
- package/types/actions.d.ts +40 -24
- package/types/clientDataParsers.d.ts +4 -1
- package/types/constants/clientErrorCodes.d.ts +0 -1
- package/types/constants/organizationIds.d.ts +1 -1
- package/types/constants/reduxActions.d.ts +2 -0
- package/types/constants/serverPushActions.d.ts +3 -1
- package/types/constants/serverRequestActions.d.ts +3 -1
- package/types/graylog/index.d.ts +2 -2
- package/types/index.d.ts +27 -9
- package/types/reducer.d.ts +111 -87
- package/types/sendCustomerActions.d.ts +17 -0
- package/types/sendGreetingButtonClicked.d.ts +13 -0
- package/types/serverFrameParser.d.ts +49 -15
- package/types/sideEffects/checkGoals.d.ts +1 -1
- package/types/sideEffects/index.d.ts +4 -3
- package/types/sideStorage.d.ts +3 -2
- package/types/socketClient.d.ts +1 -1
- package/types/socketListener.d.ts +3 -3
- package/types/types/actions.d.ts +13 -3
- package/types/types/clientEntities.d.ts +77 -4
- package/types/types/frames.d.ts +59 -24
- package/types/types/serverEntities.d.ts +78 -3
- package/types/types/state.d.ts +2 -0
- package/types/sendTicketForm.d.ts +0 -14
|
@@ -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 {
|
|
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: "
|
|
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: "manual" | "disconnected" | "signed_out" | "remotely_signed_out" | "deleted" | "chat_deactivated" | "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<{
|
|
@@ -369,9 +402,10 @@ export declare const parseResponse: ({ request, response, }: {
|
|
|
369
402
|
}>;
|
|
370
403
|
} | {
|
|
371
404
|
action: "update_customer_page";
|
|
372
|
-
payload:
|
|
373
|
-
|
|
374
|
-
|
|
405
|
+
payload: {
|
|
406
|
+
groups: never;
|
|
407
|
+
success: true;
|
|
408
|
+
};
|
|
375
409
|
} | {
|
|
376
410
|
action: "update_event_properties";
|
|
377
411
|
payload: Readonly<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomerAuth } from '@livechat/customer-auth';
|
|
2
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
package/types/sideStorage.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Store } from './types';
|
|
2
2
|
import { SideStorage } from './types/serverEntities';
|
|
3
|
-
export declare const getSideStorage: (store: Store,
|
|
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
|
package/types/socketClient.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PlatformClient } from '@livechat/platform-client';
|
|
2
2
|
import { Store } from './types';
|
|
3
|
-
import { Push, PushResponse, Response, ResponseError
|
|
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 |
|
|
6
|
-
(type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response |
|
|
5
|
+
<Key extends keyof import("@livechat/platform-client/types").PlatformClientEvents<Push | import("./types/frames").Response | PushResponse | ResponseError>>(type: Key, handler?: import("mitt").Handler<import("@livechat/platform-client/types").PlatformClientEvents<Push | import("./types/frames").Response | PushResponse | ResponseError>[Key]> | undefined): void;
|
|
6
|
+
(type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<Push | import("./types/frames").Response | PushResponse | ResponseError>>): void;
|
|
7
7
|
} & {
|
|
8
|
-
(type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<import("./types/frames").Response |
|
|
8
|
+
(type: "*", handler: import("mitt").WildcardHandler<import("@livechat/platform-client/types").PlatformClientEvents<Push | import("./types/frames").Response | PushResponse | ResponseError>>): void;
|
|
9
9
|
(): void;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
package/types/types/actions.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Any, O } from 'ts-toolbelt';
|
|
2
2
|
import * as reduxActions from '../constants/reduxActions';
|
|
3
|
-
import
|
|
3
|
+
import * as serverFrameParser from '../serverFrameParser';
|
|
4
4
|
import * as clientEntities from './clientEntities';
|
|
5
5
|
import * as serverEntities from './serverEntities';
|
|
6
|
-
import
|
|
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
|
|
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;
|
package/types/types/frames.d.ts
CHANGED
|
@@ -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 |
|
|
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 |
|
|
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 |
|
|
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
|
}>;
|
|
@@ -8,6 +8,7 @@ export type Greeting = {
|
|
|
8
8
|
displayed_first_time: boolean;
|
|
9
9
|
accepted?: boolean;
|
|
10
10
|
subtype?: string;
|
|
11
|
+
is_exit_intent: boolean;
|
|
11
12
|
event: GreetingEvent;
|
|
12
13
|
agent: {
|
|
13
14
|
id: string;
|
|
@@ -138,7 +139,9 @@ export type ChatUser = ChatAgent | ChatCustomer;
|
|
|
138
139
|
export type PredictedAgent = Any.Compute<Pick<Agent, 'id' | 'avatar' | 'job_title' | 'type' | 'name'> & {
|
|
139
140
|
is_bot: boolean;
|
|
140
141
|
}>;
|
|
141
|
-
export type CustomerUpdate = Pick<Customer, 'avatar' | 'email' | 'name' | 'session_fields'
|
|
142
|
+
export type CustomerUpdate = Pick<Customer, 'avatar' | 'email' | 'name' | 'session_fields'> & {
|
|
143
|
+
name_is_default?: boolean;
|
|
144
|
+
};
|
|
142
145
|
export type FormType = 'prechat' | 'postchat' | 'ticket';
|
|
143
146
|
type FormFieldOption = {
|
|
144
147
|
id: string;
|
|
@@ -278,6 +281,7 @@ type RichMessageButtonBase = {
|
|
|
278
281
|
text: string;
|
|
279
282
|
user_ids: string[];
|
|
280
283
|
role?: RichMessageButtonRole;
|
|
284
|
+
button_id?: string;
|
|
281
285
|
};
|
|
282
286
|
type RichMessageButtonWithoutValue = Any.Compute<RichMessageButtonBase & {
|
|
283
287
|
type?: undefined;
|
|
@@ -291,10 +295,27 @@ type RichMessageUrlButton = Any.Compute<RichMessageButtonBase & {
|
|
|
291
295
|
value: string;
|
|
292
296
|
target?: 'current' | 'new';
|
|
293
297
|
}>;
|
|
298
|
+
type RichMessageOpenExternalButton = Any.Compute<RichMessageButtonBase & {
|
|
299
|
+
type: 'open_external';
|
|
300
|
+
value: string;
|
|
301
|
+
target?: 'current' | 'new';
|
|
302
|
+
}>;
|
|
303
|
+
type RichMessageAddToCartButton = Any.Compute<RichMessageButtonBase & {
|
|
304
|
+
type: 'add_to_cart';
|
|
305
|
+
value: string;
|
|
306
|
+
}>;
|
|
307
|
+
type RichMessageShowGalleryButton = Any.Compute<RichMessageButtonBase & {
|
|
308
|
+
type: 'show_gallery';
|
|
309
|
+
value: string;
|
|
310
|
+
}>;
|
|
294
311
|
type RichMessagePhoneButton = Any.Compute<RichMessageButtonBase & {
|
|
295
312
|
type: 'phone';
|
|
296
313
|
value: string;
|
|
297
314
|
}>;
|
|
315
|
+
type RichMessageCopyButton = Any.Compute<RichMessageButtonBase & {
|
|
316
|
+
type: 'copy';
|
|
317
|
+
value: string;
|
|
318
|
+
}>;
|
|
298
319
|
type RichMessageCancelButton = Any.Compute<RichMessageButtonBase & {
|
|
299
320
|
type: 'cancel';
|
|
300
321
|
}>;
|
|
@@ -303,7 +324,57 @@ type RichMessageWebviewButton = Any.Compute<RichMessageButtonBase & {
|
|
|
303
324
|
value: string;
|
|
304
325
|
webview_height?: 'full' | 'tall' | 'compact';
|
|
305
326
|
}>;
|
|
306
|
-
export type RichMessageButton = RichMessageButtonWithoutValue | RichMessageMessageButton | RichMessageUrlButton | RichMessagePhoneButton | RichMessageCancelButton | RichMessageWebviewButton;
|
|
327
|
+
export type RichMessageButton = RichMessageButtonWithoutValue | RichMessageMessageButton | RichMessageUrlButton | RichMessageOpenExternalButton | RichMessageAddToCartButton | RichMessageShowGalleryButton | RichMessagePhoneButton | RichMessageCancelButton | RichMessageWebviewButton | RichMessageCopyButton;
|
|
328
|
+
type RichMessageEcommerceAddonPriceRange = {
|
|
329
|
+
addon_type: 'price_range';
|
|
330
|
+
range_from?: string | number;
|
|
331
|
+
range_to?: string | number;
|
|
332
|
+
currency?: string;
|
|
333
|
+
};
|
|
334
|
+
type RichMessageEcommerceAddonMoreItems = {
|
|
335
|
+
addon_type: 'more_items';
|
|
336
|
+
};
|
|
337
|
+
type RichMessageEcommerceAddon = RichMessageEcommerceAddonPriceRange | RichMessageEcommerceAddonMoreItems;
|
|
338
|
+
type RichMessageEcommerceBaseOption = {
|
|
339
|
+
label: string;
|
|
340
|
+
option_id: string;
|
|
341
|
+
price?: string | number;
|
|
342
|
+
regular_price?: string | number;
|
|
343
|
+
max_price?: string | number;
|
|
344
|
+
currency?: string;
|
|
345
|
+
selected?: boolean;
|
|
346
|
+
available?: boolean;
|
|
347
|
+
};
|
|
348
|
+
type RichMessageEcommerceTagOption = RichMessageEcommerceBaseOption;
|
|
349
|
+
type RichMessageEcommerceSwatchOption = RichMessageEcommerceBaseOption & {
|
|
350
|
+
color: string;
|
|
351
|
+
};
|
|
352
|
+
type RichMessageEcommerceImageOption = RichMessageEcommerceBaseOption & {
|
|
353
|
+
image_url: string;
|
|
354
|
+
image_thumbnail_url?: string;
|
|
355
|
+
};
|
|
356
|
+
type RichMessageEcommerceSelectOption = RichMessageEcommerceBaseOption;
|
|
357
|
+
type RichMessageEcommerceWithTags = {
|
|
358
|
+
view_type: 'tags';
|
|
359
|
+
options?: RichMessageEcommerceTagOption[];
|
|
360
|
+
};
|
|
361
|
+
type RichMessageEcommerceWithSwatches = {
|
|
362
|
+
view_type: 'swatch';
|
|
363
|
+
options?: RichMessageEcommerceSwatchOption[];
|
|
364
|
+
};
|
|
365
|
+
type RichMessageEcommerceWithImages = {
|
|
366
|
+
view_type: 'images';
|
|
367
|
+
options?: RichMessageEcommerceImageOption[];
|
|
368
|
+
};
|
|
369
|
+
type RichMessageEcommerceWithSelect = {
|
|
370
|
+
view_type: 'select';
|
|
371
|
+
options?: RichMessageEcommerceSelectOption[];
|
|
372
|
+
};
|
|
373
|
+
type RichMessageEcommerce = {
|
|
374
|
+
product_id: string;
|
|
375
|
+
label?: string;
|
|
376
|
+
addons?: RichMessageEcommerceAddon[];
|
|
377
|
+
} & (RichMessageEcommerceWithTags | RichMessageEcommerceWithSwatches | RichMessageEcommerceWithImages | RichMessageEcommerceWithSelect);
|
|
307
378
|
export type RichMessageElement = {
|
|
308
379
|
title?: string;
|
|
309
380
|
subtitle?: string;
|
|
@@ -316,9 +387,10 @@ export type RichMessageElement = {
|
|
|
316
387
|
width?: number;
|
|
317
388
|
height?: number;
|
|
318
389
|
};
|
|
390
|
+
ecommerce?: RichMessageEcommerce;
|
|
319
391
|
buttons?: RichMessageButton[];
|
|
320
392
|
};
|
|
321
|
-
type RichMessageTemplate = 'cards' | 'quick_replies' | 'sticker';
|
|
393
|
+
type RichMessageTemplate = 'cards' | 'quick_replies' | 'sticker' | 'ecommerce';
|
|
322
394
|
type ServerGeneratedEventBase = {
|
|
323
395
|
id: string;
|
|
324
396
|
author_id: string;
|
|
@@ -348,11 +420,13 @@ type NonImageSpecificProps = {
|
|
|
348
420
|
type FormSpecificProps = {
|
|
349
421
|
type: 'form';
|
|
350
422
|
form_id: string;
|
|
423
|
+
form_type?: string;
|
|
351
424
|
fields: FormField[];
|
|
352
425
|
};
|
|
353
426
|
type FilledFormSpecificProps = {
|
|
354
427
|
type: 'filled_form';
|
|
355
428
|
form_id: string;
|
|
429
|
+
form_type?: string;
|
|
356
430
|
fields: FilledFormField[];
|
|
357
431
|
};
|
|
358
432
|
type MessageSpecificProps = {
|
|
@@ -404,6 +478,7 @@ export type RichMessage = Any.Compute<ServerGeneratedEventBase & EventBase & Ric
|
|
|
404
478
|
export type SystemMessage = Any.Compute<ServerGeneratedEventBase & EventBase & SystemMessageSpecificProps>;
|
|
405
479
|
export type CustomEvent = Any.Compute<ServerGeneratedEventBase & EventBase & CustomEventSpecificProps>;
|
|
406
480
|
export type GreetingEvent = Message | RichMessage;
|
|
481
|
+
export type PredictedWelcomeMessage = Omit<Message, 'postback'> | RichMessage;
|
|
407
482
|
export type Event = File | Form | FilledForm | Message | RichMessage | SystemMessage | CustomEvent;
|
|
408
483
|
export {};
|
|
409
484
|
//# sourceMappingURL=serverEntities.d.ts.map
|