@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.
- package/README.md +215 -59
- package/dist/customer-sdk.cjs.js +1460 -1205
- package/dist/customer-sdk.cjs.native.js +1470 -1215
- package/dist/customer-sdk.esm.js +1457 -1201
- package/dist/customer-sdk.js +2065 -1805
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +15 -17
- package/types/actions.d.ts +27 -11
- 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 +38 -14
- package/types/sendCustomerActions.d.ts +17 -0
- package/types/sendGreetingButtonClicked.d.ts +13 -0
- package/types/serverFrameParser.d.ts +45 -12
- 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 -15
|
@@ -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
|
package/types/types/state.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type InitialStateData = {
|
|
|
14
14
|
page?: Page | null;
|
|
15
15
|
region?: string | null;
|
|
16
16
|
referrer?: string | null;
|
|
17
|
+
tabId?: string | null;
|
|
17
18
|
uniqueGroups?: boolean;
|
|
18
19
|
mobile?: boolean;
|
|
19
20
|
};
|
|
@@ -35,6 +36,7 @@ export type State = {
|
|
|
35
36
|
page: Page | null;
|
|
36
37
|
region: string | null;
|
|
37
38
|
referrer: string | null;
|
|
39
|
+
tabId: string | null;
|
|
38
40
|
requests: Record<string, {
|
|
39
41
|
id: string;
|
|
40
42
|
promise: Promise<any>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CustomerAuth } from '@livechat/customer-auth';
|
|
2
|
-
import { Store } from './types';
|
|
3
|
-
import * as clientEntities from './types/clientEntities';
|
|
4
|
-
declare const sendTicketForm: (store: Store, auth: CustomerAuth, { filledForm, groupId, licenseId, timeZone, }: {
|
|
5
|
-
filledForm: Extract<clientEntities.RequestBodyEvent, {
|
|
6
|
-
type: 'filled_form';
|
|
7
|
-
}>;
|
|
8
|
-
licenseId: number;
|
|
9
|
-
groupId?: number | undefined;
|
|
10
|
-
timeZone?: string | undefined;
|
|
11
|
-
}) => Promise<{
|
|
12
|
-
id: string;
|
|
13
|
-
}>;
|
|
14
|
-
export default sendTicketForm;
|
|
15
|
-
//# sourceMappingURL=sendTicketForm.d.ts.map
|