@livechat/customer-sdk 3.1.4 → 4.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 +27 -78
- package/dist/customer-sdk.cjs.js +208 -228
- package/dist/customer-sdk.cjs.native.js +208 -228
- package/dist/customer-sdk.esm.js +202 -227
- package/dist/customer-sdk.js +222 -249
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +7 -7
- package/types/actions.d.ts +331 -0
- package/types/chatHistory.d.ts +19 -0
- package/types/clientDataParsers.d.ts +55 -0
- package/types/completionValues.d.ts +4 -0
- package/types/constants/clientErrorCodes.d.ts +11 -0
- package/types/constants/connectionStatuses.d.ts +6 -0
- package/types/constants/eventTypes.d.ts +8 -0
- package/types/constants/organizationIds.d.ts +2 -0
- package/types/constants/reduxActions.d.ts +23 -0
- package/types/constants/serverDisconnectionReasons.d.ts +16 -0
- package/types/constants/serverErrorCodes.d.ts +23 -0
- package/types/constants/serverPushActions.d.ts +27 -0
- package/types/constants/serverRequestActions.d.ts +30 -0
- package/types/constants/sortOrders.d.ts +3 -0
- package/types/constants/userTypes.d.ts +3 -0
- package/types/createError.d.ts +9 -0
- package/types/createStore.d.ts +12 -0
- package/types/debug.d.ts +3 -0
- package/types/graylog/index.d.ts +14 -0
- package/types/graylog/makeGrayLogRequest.d.ts +2 -0
- package/types/graylog/makeGrayLogRequest.native.d.ts +6 -0
- package/types/index.d.ts +252 -0
- package/types/reducer.d.ts +545 -0
- package/types/sendRequestAction.d.ts +4 -0
- package/types/sendTicketForm.d.ts +14 -0
- package/types/serverDataParser.d.ts +34 -0
- package/types/serverEventParser.d.ts +12 -0
- package/types/serverFrameParser.d.ts +393 -0
- package/types/sideEffects/checkGoals.d.ts +5 -0
- package/types/sideEffects/index.d.ts +13 -0
- package/types/sideStorage.d.ts +5 -0
- package/types/socketClient.d.ts +11 -0
- package/types/socketListener.d.ts +12 -0
- package/types/thunks.d.ts +4 -0
- package/types/types/actions.d.ts +157 -0
- package/types/types/clientEntities.d.ts +376 -0
- package/types/types/frames.d.ts +644 -0
- package/types/types/serverEntities.d.ts +409 -0
- package/types/types/state.d.ts +56 -0
- package/types/uploadFile.d.ts +19 -0
- package/types/validateFile/index.d.ts +3 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { Any } from 'ts-toolbelt';
|
|
2
|
+
import * as userTypes from '../constants/userTypes';
|
|
3
|
+
export type SideStorage = Record<string, never>;
|
|
4
|
+
export type Greeting = {
|
|
5
|
+
id: number;
|
|
6
|
+
addon?: string;
|
|
7
|
+
unique_id: string;
|
|
8
|
+
displayed_first_time: boolean;
|
|
9
|
+
accepted?: boolean;
|
|
10
|
+
subtype?: string;
|
|
11
|
+
event: GreetingEvent;
|
|
12
|
+
agent: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
avatar: string;
|
|
16
|
+
job_title: string;
|
|
17
|
+
is_bot: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type DynamicConfig = {
|
|
21
|
+
organization_id: string;
|
|
22
|
+
customer_data: {
|
|
23
|
+
chats_count: number;
|
|
24
|
+
invitations_accepted_count: number;
|
|
25
|
+
invitations_shown_count: number;
|
|
26
|
+
last_visit_timestamp: number;
|
|
27
|
+
name?: string;
|
|
28
|
+
page_views_count: number;
|
|
29
|
+
visits_count: number;
|
|
30
|
+
};
|
|
31
|
+
customer_groups: {
|
|
32
|
+
monitoring: {
|
|
33
|
+
id: number;
|
|
34
|
+
static_config_url: string;
|
|
35
|
+
language_config_url: string;
|
|
36
|
+
};
|
|
37
|
+
chats?: Record<number, {
|
|
38
|
+
chat_ids: string[];
|
|
39
|
+
static_config_url: string;
|
|
40
|
+
language_config_url: string;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
online_groups_ids?: number[];
|
|
44
|
+
static_config_version: string;
|
|
45
|
+
greeting?: Greeting;
|
|
46
|
+
};
|
|
47
|
+
export type Access = {
|
|
48
|
+
group_ids?: number[];
|
|
49
|
+
};
|
|
50
|
+
export type Properties = {
|
|
51
|
+
[namespace: string]: {
|
|
52
|
+
[key: string]: string | number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type CustomerFields = Record<string, string>;
|
|
56
|
+
export type CustomerSessionFields = Array<CustomerFields>;
|
|
57
|
+
export type Queue = {
|
|
58
|
+
position: number;
|
|
59
|
+
wait_time: number;
|
|
60
|
+
queued_at: string;
|
|
61
|
+
};
|
|
62
|
+
export type QueueUpdate = Pick<Queue, 'position' | 'wait_time'>;
|
|
63
|
+
export type Thread = {
|
|
64
|
+
id: string;
|
|
65
|
+
active: boolean;
|
|
66
|
+
access?: Access;
|
|
67
|
+
created_at: string;
|
|
68
|
+
user_ids: string[];
|
|
69
|
+
events: Event[];
|
|
70
|
+
properties?: Properties;
|
|
71
|
+
previous_thread_id?: string;
|
|
72
|
+
next_thread_id?: string;
|
|
73
|
+
queue?: Queue;
|
|
74
|
+
};
|
|
75
|
+
export type Chat = {
|
|
76
|
+
id: string;
|
|
77
|
+
thread?: Thread;
|
|
78
|
+
users: ChatUser[];
|
|
79
|
+
access?: Access;
|
|
80
|
+
properties?: Properties;
|
|
81
|
+
};
|
|
82
|
+
export type IncomingChat = Chat & {
|
|
83
|
+
thread: Thread;
|
|
84
|
+
};
|
|
85
|
+
export type ChatSummary = {
|
|
86
|
+
id: string;
|
|
87
|
+
active: boolean;
|
|
88
|
+
users: ChatUser[];
|
|
89
|
+
access?: Access;
|
|
90
|
+
properties?: Properties;
|
|
91
|
+
last_thread_id?: string;
|
|
92
|
+
last_thread_created_at?: string;
|
|
93
|
+
last_event_per_type: {
|
|
94
|
+
[Type in Event['type']]?: {
|
|
95
|
+
thread_id: string;
|
|
96
|
+
thread_created_at: string;
|
|
97
|
+
event: Extract<Event, {
|
|
98
|
+
type: Type;
|
|
99
|
+
}>;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export type Agent = {
|
|
104
|
+
type: typeof userTypes.AGENT;
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
avatar: string;
|
|
108
|
+
job_title: string;
|
|
109
|
+
present: boolean;
|
|
110
|
+
events_seen_up_to?: string;
|
|
111
|
+
};
|
|
112
|
+
export type OptionalCustomerProps = {
|
|
113
|
+
name?: string;
|
|
114
|
+
email?: string;
|
|
115
|
+
avatar?: string;
|
|
116
|
+
session_fields?: CustomerSessionFields;
|
|
117
|
+
};
|
|
118
|
+
type ChatUserProps = {
|
|
119
|
+
present: boolean;
|
|
120
|
+
events_seen_up_to?: string;
|
|
121
|
+
};
|
|
122
|
+
export type Customer = Any.Compute<{
|
|
123
|
+
type: typeof userTypes.CUSTOMER;
|
|
124
|
+
id: string;
|
|
125
|
+
statistics: {
|
|
126
|
+
chats_count: number;
|
|
127
|
+
threads_count: number;
|
|
128
|
+
visits_count: number;
|
|
129
|
+
page_views_count: number;
|
|
130
|
+
greetings_shown_count: number;
|
|
131
|
+
greetings_accepted_count: number;
|
|
132
|
+
};
|
|
133
|
+
} & OptionalCustomerProps>;
|
|
134
|
+
export type User = Agent | Customer;
|
|
135
|
+
export type ChatAgent = Any.Compute<Agent & ChatUserProps>;
|
|
136
|
+
export type ChatCustomer = Any.Compute<Omit<Customer, 'statistics'> & ChatUserProps>;
|
|
137
|
+
export type ChatUser = ChatAgent | ChatCustomer;
|
|
138
|
+
export type PredictedAgent = Any.Compute<Pick<Agent, 'id' | 'avatar' | 'job_title' | 'type' | 'name'> & {
|
|
139
|
+
is_bot: boolean;
|
|
140
|
+
}>;
|
|
141
|
+
export type CustomerUpdate = Pick<Customer, 'avatar' | 'email' | 'name' | 'session_fields'>;
|
|
142
|
+
export type FormType = 'prechat' | 'postchat' | 'ticket';
|
|
143
|
+
type FormFieldOption = {
|
|
144
|
+
id: string;
|
|
145
|
+
label: string;
|
|
146
|
+
checked: boolean;
|
|
147
|
+
};
|
|
148
|
+
type HeaderField = {
|
|
149
|
+
type: 'header';
|
|
150
|
+
id: string;
|
|
151
|
+
label: string;
|
|
152
|
+
};
|
|
153
|
+
type NameField = {
|
|
154
|
+
type: 'name';
|
|
155
|
+
id: string;
|
|
156
|
+
label: string;
|
|
157
|
+
required: boolean;
|
|
158
|
+
};
|
|
159
|
+
type EmailField = {
|
|
160
|
+
type: 'email';
|
|
161
|
+
id: string;
|
|
162
|
+
label: string;
|
|
163
|
+
required: boolean;
|
|
164
|
+
};
|
|
165
|
+
type QuestionField = {
|
|
166
|
+
type: 'question';
|
|
167
|
+
id: string;
|
|
168
|
+
label: string;
|
|
169
|
+
required: boolean;
|
|
170
|
+
};
|
|
171
|
+
type TextareaField = {
|
|
172
|
+
type: 'textarea';
|
|
173
|
+
id: string;
|
|
174
|
+
label: string;
|
|
175
|
+
required: boolean;
|
|
176
|
+
};
|
|
177
|
+
type RadioField = {
|
|
178
|
+
type: 'radio';
|
|
179
|
+
id: string;
|
|
180
|
+
label: string;
|
|
181
|
+
options: FormFieldOption[];
|
|
182
|
+
required: boolean;
|
|
183
|
+
};
|
|
184
|
+
type SelectField = {
|
|
185
|
+
type: 'select';
|
|
186
|
+
id: string;
|
|
187
|
+
label: string;
|
|
188
|
+
options: FormFieldOption[];
|
|
189
|
+
required: boolean;
|
|
190
|
+
};
|
|
191
|
+
type CheckboxField = {
|
|
192
|
+
type: 'checkbox';
|
|
193
|
+
id: string;
|
|
194
|
+
label: string;
|
|
195
|
+
options: FormFieldOption[];
|
|
196
|
+
required: boolean;
|
|
197
|
+
};
|
|
198
|
+
type CheckboxForEmailField = {
|
|
199
|
+
type: 'checkbox_for_email';
|
|
200
|
+
id: string;
|
|
201
|
+
label: string;
|
|
202
|
+
required: boolean;
|
|
203
|
+
checked: boolean;
|
|
204
|
+
};
|
|
205
|
+
type GroupChooserField = {
|
|
206
|
+
type: 'group_chooser';
|
|
207
|
+
id: string;
|
|
208
|
+
label: string;
|
|
209
|
+
options: Array<{
|
|
210
|
+
id: string;
|
|
211
|
+
label: string;
|
|
212
|
+
group_id: number;
|
|
213
|
+
}>;
|
|
214
|
+
required: boolean;
|
|
215
|
+
};
|
|
216
|
+
type RatingField = {
|
|
217
|
+
type: 'rating';
|
|
218
|
+
id: string;
|
|
219
|
+
label: string;
|
|
220
|
+
comment_label: string;
|
|
221
|
+
required: boolean;
|
|
222
|
+
};
|
|
223
|
+
type SubjectField = {
|
|
224
|
+
type: 'subject';
|
|
225
|
+
id: string;
|
|
226
|
+
label: string;
|
|
227
|
+
required: boolean;
|
|
228
|
+
};
|
|
229
|
+
export type FormField = HeaderField | NameField | EmailField | QuestionField | TextareaField | RadioField | SelectField | CheckboxField | CheckboxForEmailField | GroupChooserField | RatingField | SubjectField;
|
|
230
|
+
type CreateFilledField<Field extends FormField, Answer> = Any.Compute<Pick<Field, 'type' | 'id' | 'label'> & Answer>;
|
|
231
|
+
type FilledNameField = CreateFilledField<NameField, {
|
|
232
|
+
answer?: string;
|
|
233
|
+
}>;
|
|
234
|
+
type FilledEmailField = CreateFilledField<EmailField, {
|
|
235
|
+
answer?: string;
|
|
236
|
+
}>;
|
|
237
|
+
type FilledQuestionField = CreateFilledField<QuestionField, {
|
|
238
|
+
answer?: string;
|
|
239
|
+
}>;
|
|
240
|
+
type FilledTextareaField = CreateFilledField<TextareaField, {
|
|
241
|
+
answer?: string;
|
|
242
|
+
}>;
|
|
243
|
+
type FilledRadioField = CreateFilledField<RadioField, {
|
|
244
|
+
answer?: {
|
|
245
|
+
id: string;
|
|
246
|
+
label: string;
|
|
247
|
+
};
|
|
248
|
+
}>;
|
|
249
|
+
type FilledSelectField = CreateFilledField<SelectField, {
|
|
250
|
+
answer?: {
|
|
251
|
+
id: string;
|
|
252
|
+
label: string;
|
|
253
|
+
};
|
|
254
|
+
}>;
|
|
255
|
+
type FilledCheckboxField = CreateFilledField<CheckboxField, {
|
|
256
|
+
answers?: Array<{
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
}>;
|
|
260
|
+
}>;
|
|
261
|
+
type FilledCheckboxForEmailField = CreateFilledField<CheckboxForEmailField, {
|
|
262
|
+
answer?: boolean;
|
|
263
|
+
}>;
|
|
264
|
+
type FilledGroupChooserField = CreateFilledField<GroupChooserField, {
|
|
265
|
+
answer?: {
|
|
266
|
+
id: string;
|
|
267
|
+
group_id: number;
|
|
268
|
+
label: string;
|
|
269
|
+
};
|
|
270
|
+
}>;
|
|
271
|
+
type FilledSubjectField = CreateFilledField<SubjectField, {
|
|
272
|
+
answer?: string;
|
|
273
|
+
}>;
|
|
274
|
+
export type FilledFormField = FilledNameField | FilledEmailField | FilledQuestionField | FilledTextareaField | FilledRadioField | FilledSelectField | FilledCheckboxField | FilledCheckboxForEmailField | FilledGroupChooserField | FilledSubjectField;
|
|
275
|
+
export type RichMessageButtonRole = 'default' | 'primary' | 'danger';
|
|
276
|
+
type RichMessageButtonBase = {
|
|
277
|
+
postback_id: string;
|
|
278
|
+
text: string;
|
|
279
|
+
user_ids: string[];
|
|
280
|
+
role?: RichMessageButtonRole;
|
|
281
|
+
};
|
|
282
|
+
type RichMessageButtonWithoutValue = Any.Compute<RichMessageButtonBase & {
|
|
283
|
+
type?: undefined;
|
|
284
|
+
}>;
|
|
285
|
+
type RichMessageMessageButton = Any.Compute<RichMessageButtonBase & {
|
|
286
|
+
type: 'message';
|
|
287
|
+
value: string;
|
|
288
|
+
}>;
|
|
289
|
+
type RichMessageUrlButton = Any.Compute<RichMessageButtonBase & {
|
|
290
|
+
type: 'url';
|
|
291
|
+
value: string;
|
|
292
|
+
target?: 'current' | 'new';
|
|
293
|
+
}>;
|
|
294
|
+
type RichMessagePhoneButton = Any.Compute<RichMessageButtonBase & {
|
|
295
|
+
type: 'phone';
|
|
296
|
+
value: string;
|
|
297
|
+
}>;
|
|
298
|
+
type RichMessageCancelButton = Any.Compute<RichMessageButtonBase & {
|
|
299
|
+
type: 'cancel';
|
|
300
|
+
}>;
|
|
301
|
+
type RichMessageWebviewButton = Any.Compute<RichMessageButtonBase & {
|
|
302
|
+
type: 'webview';
|
|
303
|
+
value: string;
|
|
304
|
+
webview_height?: 'full' | 'tall' | 'compact';
|
|
305
|
+
}>;
|
|
306
|
+
export type RichMessageButton = RichMessageButtonWithoutValue | RichMessageMessageButton | RichMessageUrlButton | RichMessagePhoneButton | RichMessageCancelButton | RichMessageWebviewButton;
|
|
307
|
+
export type RichMessageElement = {
|
|
308
|
+
title?: string;
|
|
309
|
+
subtitle?: string;
|
|
310
|
+
image?: {
|
|
311
|
+
url: string;
|
|
312
|
+
name?: string;
|
|
313
|
+
alternative_text?: string;
|
|
314
|
+
content_type?: string;
|
|
315
|
+
size?: number;
|
|
316
|
+
width?: number;
|
|
317
|
+
height?: number;
|
|
318
|
+
};
|
|
319
|
+
buttons?: RichMessageButton[];
|
|
320
|
+
};
|
|
321
|
+
type RichMessageTemplate = 'cards' | 'quick_replies' | 'sticker';
|
|
322
|
+
type ServerGeneratedEventBase = {
|
|
323
|
+
id: string;
|
|
324
|
+
author_id: string;
|
|
325
|
+
created_at: string;
|
|
326
|
+
};
|
|
327
|
+
export type EventBase = {
|
|
328
|
+
custom_id?: string;
|
|
329
|
+
properties?: Properties;
|
|
330
|
+
};
|
|
331
|
+
type FileSpecificProps = {
|
|
332
|
+
type: 'file';
|
|
333
|
+
content_type: string;
|
|
334
|
+
url: string;
|
|
335
|
+
name: string;
|
|
336
|
+
};
|
|
337
|
+
type ImageSpecificProps = {
|
|
338
|
+
width: number;
|
|
339
|
+
height: number;
|
|
340
|
+
thumbnail_url: string;
|
|
341
|
+
thumbnail2x_url: string;
|
|
342
|
+
alternative_text?: string;
|
|
343
|
+
};
|
|
344
|
+
type NonImageSpecificProps = {
|
|
345
|
+
width?: undefined;
|
|
346
|
+
height?: undefined;
|
|
347
|
+
};
|
|
348
|
+
type FormSpecificProps = {
|
|
349
|
+
type: 'form';
|
|
350
|
+
form_id: string;
|
|
351
|
+
fields: FormField[];
|
|
352
|
+
};
|
|
353
|
+
type FilledFormSpecificProps = {
|
|
354
|
+
type: 'filled_form';
|
|
355
|
+
form_id: string;
|
|
356
|
+
fields: FilledFormField[];
|
|
357
|
+
};
|
|
358
|
+
type MessageSpecificProps = {
|
|
359
|
+
type: 'message';
|
|
360
|
+
text: string;
|
|
361
|
+
postback?: {
|
|
362
|
+
id: string;
|
|
363
|
+
thread_id: string;
|
|
364
|
+
event_id: string;
|
|
365
|
+
type: string;
|
|
366
|
+
value: string;
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
type RichMessageSpecificProps = {
|
|
370
|
+
type: 'rich_message';
|
|
371
|
+
template_id: RichMessageTemplate;
|
|
372
|
+
elements: RichMessageElement[];
|
|
373
|
+
};
|
|
374
|
+
type SystemMessageSpecificProps = {
|
|
375
|
+
type: 'system_message';
|
|
376
|
+
text: string;
|
|
377
|
+
system_message_type: string;
|
|
378
|
+
text_vars?: Record<string, string>;
|
|
379
|
+
};
|
|
380
|
+
type CustomEventSpecificProps = {
|
|
381
|
+
type: 'custom';
|
|
382
|
+
content?: any;
|
|
383
|
+
};
|
|
384
|
+
export type GroupStatus = 'online' | 'online_for_queue' | 'offline';
|
|
385
|
+
type RequestBodyFile = Any.Compute<EventBase & {
|
|
386
|
+
type: 'file';
|
|
387
|
+
url: string;
|
|
388
|
+
alternative_text: string;
|
|
389
|
+
}>;
|
|
390
|
+
type RequestBodyFilledForm = Any.Compute<EventBase & FilledFormSpecificProps>;
|
|
391
|
+
type RequestBodyMessage = Any.Compute<EventBase & MessageSpecificProps>;
|
|
392
|
+
type RequestBodySystemMessage = Any.Compute<EventBase & SystemMessageSpecificProps & {
|
|
393
|
+
recipients?: 'all' | 'agents';
|
|
394
|
+
}>;
|
|
395
|
+
type RequestBodyCustomEvent = Any.Compute<EventBase & CustomEventSpecificProps>;
|
|
396
|
+
export type RequestBodyEvent = RequestBodyFile | RequestBodyFilledForm | RequestBodyMessage | RequestBodySystemMessage | RequestBodyCustomEvent;
|
|
397
|
+
export type ImageFile = Any.Compute<ServerGeneratedEventBase & EventBase & FileSpecificProps & ImageSpecificProps>;
|
|
398
|
+
export type NonImageFile = Any.Compute<ServerGeneratedEventBase & EventBase & FileSpecificProps & NonImageSpecificProps>;
|
|
399
|
+
export type File = ImageFile | NonImageFile;
|
|
400
|
+
export type Form = Any.Compute<ServerGeneratedEventBase & EventBase & FormSpecificProps>;
|
|
401
|
+
export type FilledForm = Any.Compute<ServerGeneratedEventBase & EventBase & FilledFormSpecificProps>;
|
|
402
|
+
export type Message = Any.Compute<ServerGeneratedEventBase & EventBase & MessageSpecificProps>;
|
|
403
|
+
export type RichMessage = Any.Compute<ServerGeneratedEventBase & EventBase & RichMessageSpecificProps>;
|
|
404
|
+
export type SystemMessage = Any.Compute<ServerGeneratedEventBase & EventBase & SystemMessageSpecificProps>;
|
|
405
|
+
export type CustomEvent = Any.Compute<ServerGeneratedEventBase & EventBase & CustomEventSpecificProps>;
|
|
406
|
+
export type GreetingEvent = Message | RichMessage;
|
|
407
|
+
export type Event = File | Form | FilledForm | Message | RichMessage | SystemMessage | CustomEvent;
|
|
408
|
+
export {};
|
|
409
|
+
//# sourceMappingURL=serverEntities.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { O } from 'ts-toolbelt';
|
|
2
|
+
import { ConnectionStatus, Env, Page } from '.';
|
|
3
|
+
import { Request } from './frames';
|
|
4
|
+
type StateUser = Record<string, unknown>;
|
|
5
|
+
export type InitialStateData = {
|
|
6
|
+
application?: {
|
|
7
|
+
channelType?: 'direct_link' | 'code';
|
|
8
|
+
name?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
};
|
|
11
|
+
organizationId: string;
|
|
12
|
+
groupId?: number | null;
|
|
13
|
+
env: Env;
|
|
14
|
+
page?: Page | null;
|
|
15
|
+
region?: string | null;
|
|
16
|
+
referrer?: string | null;
|
|
17
|
+
uniqueGroups?: boolean;
|
|
18
|
+
mobile?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type State = {
|
|
21
|
+
application?: {
|
|
22
|
+
channelType?: 'direct_link' | 'code';
|
|
23
|
+
name?: string;
|
|
24
|
+
version?: string;
|
|
25
|
+
};
|
|
26
|
+
env: Env;
|
|
27
|
+
organizationId: string;
|
|
28
|
+
groupId: number | null;
|
|
29
|
+
chats: Record<string, {
|
|
30
|
+
active: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
connection: {
|
|
33
|
+
status: ConnectionStatus;
|
|
34
|
+
};
|
|
35
|
+
page: Page | null;
|
|
36
|
+
region: string | null;
|
|
37
|
+
referrer: string | null;
|
|
38
|
+
requests: Record<string, {
|
|
39
|
+
id: string;
|
|
40
|
+
promise: Promise<any>;
|
|
41
|
+
resolve: (val: any) => void;
|
|
42
|
+
reject: (err: any) => void;
|
|
43
|
+
request: O.Pick<Request, 'action' | 'payload'>;
|
|
44
|
+
}>;
|
|
45
|
+
users: {
|
|
46
|
+
self: {
|
|
47
|
+
id: string | null;
|
|
48
|
+
type: 'customer';
|
|
49
|
+
};
|
|
50
|
+
others: Record<string, StateUser>;
|
|
51
|
+
};
|
|
52
|
+
uniqueGroups: boolean;
|
|
53
|
+
mobile: boolean;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CustomerAuth } from '@livechat/customer-auth';
|
|
2
|
+
import { Options as GenericUploadFileOptions } from '@livechat/file-upload';
|
|
3
|
+
import { Store } from './types';
|
|
4
|
+
type UploadFileDependencies = {
|
|
5
|
+
auth: CustomerAuth;
|
|
6
|
+
store: Store;
|
|
7
|
+
};
|
|
8
|
+
export type UploadFileOptions = {
|
|
9
|
+
file: File;
|
|
10
|
+
onProgress?: GenericUploadFileOptions['onProgress'];
|
|
11
|
+
};
|
|
12
|
+
declare const uploadFile: ({ auth, store }: UploadFileDependencies, { file, onProgress }: UploadFileOptions) => {
|
|
13
|
+
promise: Promise<{
|
|
14
|
+
url: string;
|
|
15
|
+
}>;
|
|
16
|
+
cancel(): void;
|
|
17
|
+
};
|
|
18
|
+
export default uploadFile;
|
|
19
|
+
//# sourceMappingURL=uploadFile.d.ts.map
|