@livechat/customer-sdk 3.1.1 → 3.1.2
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 +6 -0
- package/dist/customer-sdk.cjs.js +186 -636
- package/dist/customer-sdk.cjs.native.js +186 -635
- package/dist/customer-sdk.esm.js +187 -637
- package/dist/customer-sdk.js +264 -863
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +6 -5
- 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/reduxActions.d.ts +23 -0
- package/types/constants/serverDisconnectionReasons.d.ts +15 -0
- package/types/constants/serverErrorCodes.d.ts +23 -0
- package/types/constants/serverPushActions.d.ts +26 -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 +239 -0
- package/types/reducer.d.ts +546 -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 +385 -0
- package/types/sideEffects/checkGoals.d.ts +5 -0
- package/types/sideEffects/index.d.ts +12 -0
- package/types/sideStorage.d.ts +5 -0
- package/types/socketClient.d.ts +11 -0
- package/types/socketListener.d.ts +9 -0
- package/types/thunks.d.ts +4 -0
- package/types/types/actions.d.ts +157 -0
- package/types/types/clientEntities.d.ts +374 -0
- package/types/types/frames.d.ts +635 -0
- package/types/types/serverEntities.d.ts +408 -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,385 @@
|
|
|
1
|
+
import { O } from 'ts-toolbelt';
|
|
2
|
+
import * as clientEntities from './types/clientEntities';
|
|
3
|
+
import * as serverEntities from './types/serverEntities';
|
|
4
|
+
import { Request, Push, DirectResponse } from './types/frames';
|
|
5
|
+
export declare const parseForm: (form: {
|
|
6
|
+
id: string;
|
|
7
|
+
fields: serverEntities.FormField[];
|
|
8
|
+
}) => {
|
|
9
|
+
id: string;
|
|
10
|
+
fields: clientEntities.FormField[];
|
|
11
|
+
};
|
|
12
|
+
export declare const parsePush: (push: Push) => {
|
|
13
|
+
action: "chat_deactivated";
|
|
14
|
+
payload: {
|
|
15
|
+
chatId: string;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
action: "chat_properties_deleted";
|
|
19
|
+
payload: {
|
|
20
|
+
chatId: string;
|
|
21
|
+
properties: Record<string, string[]>;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
action: "chat_properties_updated";
|
|
25
|
+
payload: {
|
|
26
|
+
chatId: string;
|
|
27
|
+
properties: serverEntities.Properties;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
action: "chat_transferred";
|
|
31
|
+
payload: {
|
|
32
|
+
reason: "manual";
|
|
33
|
+
requesterId: string | undefined;
|
|
34
|
+
chatId: string;
|
|
35
|
+
threadId: string;
|
|
36
|
+
transferredTo: {
|
|
37
|
+
groupIds?: number[] | undefined;
|
|
38
|
+
agentIds?: number[] | undefined;
|
|
39
|
+
};
|
|
40
|
+
queue: {
|
|
41
|
+
queuedAt: string;
|
|
42
|
+
position: number;
|
|
43
|
+
waitTime: number;
|
|
44
|
+
} | null;
|
|
45
|
+
} | {
|
|
46
|
+
reason: "routing.inactive" | "routing.assigned";
|
|
47
|
+
chatId: string;
|
|
48
|
+
threadId: string;
|
|
49
|
+
transferredTo: {
|
|
50
|
+
groupIds?: number[] | undefined;
|
|
51
|
+
agentIds?: number[] | undefined;
|
|
52
|
+
};
|
|
53
|
+
queue: {
|
|
54
|
+
queuedAt: string;
|
|
55
|
+
position: number;
|
|
56
|
+
waitTime: number;
|
|
57
|
+
} | null;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
action: "customer_side_storage_updated";
|
|
61
|
+
payload: {
|
|
62
|
+
customer_side_storage: serverEntities.SideStorage;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
action: "customer_disconnected";
|
|
66
|
+
payload: {
|
|
67
|
+
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";
|
|
68
|
+
data?: any;
|
|
69
|
+
};
|
|
70
|
+
} | {
|
|
71
|
+
action: "customer_page_updated";
|
|
72
|
+
payload: {
|
|
73
|
+
url: string;
|
|
74
|
+
title: string | undefined;
|
|
75
|
+
openedAt: string;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
action: "customer_updated";
|
|
79
|
+
payload: {
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
email?: string | undefined;
|
|
82
|
+
avatar?: string | undefined;
|
|
83
|
+
sessionFields?: clientEntities.CustomerSessionFields | undefined;
|
|
84
|
+
id: string;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
action: "event_properties_deleted";
|
|
88
|
+
payload: {
|
|
89
|
+
chatId: string;
|
|
90
|
+
threadId: string;
|
|
91
|
+
eventId: string;
|
|
92
|
+
properties: Record<string, string[]>;
|
|
93
|
+
};
|
|
94
|
+
} | {
|
|
95
|
+
action: "event_properties_updated";
|
|
96
|
+
payload: {
|
|
97
|
+
chatId: string;
|
|
98
|
+
threadId: string;
|
|
99
|
+
eventId: string;
|
|
100
|
+
properties: serverEntities.Properties;
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
action: "event_updated";
|
|
104
|
+
payload: {
|
|
105
|
+
chatId: string;
|
|
106
|
+
threadId: string;
|
|
107
|
+
event: clientEntities.Event | null;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
action: "events_marked_as_seen";
|
|
111
|
+
payload: {
|
|
112
|
+
chatId: string;
|
|
113
|
+
userId: string;
|
|
114
|
+
seenUpTo: string;
|
|
115
|
+
};
|
|
116
|
+
} | {
|
|
117
|
+
action: "greeting_accepted";
|
|
118
|
+
payload: {
|
|
119
|
+
uniqueId: string;
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
action: "greeting_canceled";
|
|
123
|
+
payload: {
|
|
124
|
+
uniqueId: string;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
action: "incoming_chat";
|
|
128
|
+
payload: {
|
|
129
|
+
chat: {
|
|
130
|
+
thread: clientEntities.Thread;
|
|
131
|
+
id: string;
|
|
132
|
+
access: clientEntities.Access;
|
|
133
|
+
users: clientEntities.ChatUser[];
|
|
134
|
+
properties: serverEntities.Properties;
|
|
135
|
+
eventsSeenUpToMap: clientEntities.EventsSeenUpToMap;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
} | {
|
|
139
|
+
action: "incoming_event";
|
|
140
|
+
payload: {
|
|
141
|
+
chatId: string;
|
|
142
|
+
event: clientEntities.Event | null;
|
|
143
|
+
};
|
|
144
|
+
} | {
|
|
145
|
+
action: "incoming_greeting";
|
|
146
|
+
payload: clientEntities.Greeting;
|
|
147
|
+
} | {
|
|
148
|
+
action: "incoming_multicast";
|
|
149
|
+
payload: {
|
|
150
|
+
type?: string | undefined;
|
|
151
|
+
content: any;
|
|
152
|
+
};
|
|
153
|
+
} | {
|
|
154
|
+
action: "incoming_rich_message_postback";
|
|
155
|
+
payload: {
|
|
156
|
+
userId: string;
|
|
157
|
+
chatId: string;
|
|
158
|
+
threadId: string;
|
|
159
|
+
eventId: string;
|
|
160
|
+
postback: {
|
|
161
|
+
id: string;
|
|
162
|
+
toggled: boolean;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
} | {
|
|
166
|
+
action: "incoming_typing_indicator";
|
|
167
|
+
payload: {
|
|
168
|
+
chatId: string;
|
|
169
|
+
typingIndicator: {
|
|
170
|
+
authorId: string;
|
|
171
|
+
isTyping: boolean;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
} | {
|
|
175
|
+
action: "queue_position_updated";
|
|
176
|
+
payload: {
|
|
177
|
+
chatId: string;
|
|
178
|
+
threadId: string;
|
|
179
|
+
queue: {
|
|
180
|
+
position: number;
|
|
181
|
+
waitTime: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
action: "thread_properties_deleted";
|
|
186
|
+
payload: {
|
|
187
|
+
chatId: string;
|
|
188
|
+
threadId: string;
|
|
189
|
+
properties: Record<string, string[]>;
|
|
190
|
+
};
|
|
191
|
+
} | {
|
|
192
|
+
action: "thread_properties_updated";
|
|
193
|
+
payload: {
|
|
194
|
+
chatId: string;
|
|
195
|
+
threadId: string;
|
|
196
|
+
properties: serverEntities.Properties;
|
|
197
|
+
};
|
|
198
|
+
} | {
|
|
199
|
+
action: "user_added_to_chat";
|
|
200
|
+
payload: {
|
|
201
|
+
chatId: string;
|
|
202
|
+
user: clientEntities.ChatUser;
|
|
203
|
+
present: boolean;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
action: "user_removed_from_chat";
|
|
207
|
+
payload: {
|
|
208
|
+
chatId: string;
|
|
209
|
+
userId: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export declare const parseResponse: ({ request, response, }: {
|
|
213
|
+
request: O.Pick<Request, 'action' | 'payload'>;
|
|
214
|
+
response: DirectResponse;
|
|
215
|
+
}) => {
|
|
216
|
+
action: "accept_greeting";
|
|
217
|
+
payload: Readonly<{
|
|
218
|
+
readonly success: true;
|
|
219
|
+
}>;
|
|
220
|
+
} | {
|
|
221
|
+
action: "cancel_greeting";
|
|
222
|
+
payload: Readonly<{
|
|
223
|
+
readonly success: true;
|
|
224
|
+
}>;
|
|
225
|
+
} | {
|
|
226
|
+
action: "delete_chat_properties";
|
|
227
|
+
payload: Readonly<{
|
|
228
|
+
readonly success: true;
|
|
229
|
+
}>;
|
|
230
|
+
} | {
|
|
231
|
+
action: "delete_event_properties";
|
|
232
|
+
payload: Readonly<{
|
|
233
|
+
readonly success: true;
|
|
234
|
+
}>;
|
|
235
|
+
} | {
|
|
236
|
+
action: "delete_thread_properties";
|
|
237
|
+
payload: Readonly<{
|
|
238
|
+
readonly success: true;
|
|
239
|
+
}>;
|
|
240
|
+
} | {
|
|
241
|
+
action: "get_chat";
|
|
242
|
+
payload: {
|
|
243
|
+
thread: clientEntities.Thread | null;
|
|
244
|
+
id: string;
|
|
245
|
+
access: clientEntities.Access;
|
|
246
|
+
users: clientEntities.ChatUser[];
|
|
247
|
+
properties: serverEntities.Properties;
|
|
248
|
+
eventsSeenUpToMap: clientEntities.EventsSeenUpToMap;
|
|
249
|
+
};
|
|
250
|
+
} | {
|
|
251
|
+
action: "get_customer";
|
|
252
|
+
payload: {
|
|
253
|
+
type: "customer";
|
|
254
|
+
id: string;
|
|
255
|
+
name?: string | undefined;
|
|
256
|
+
email?: string | undefined;
|
|
257
|
+
avatar?: string | undefined;
|
|
258
|
+
sessionFields: clientEntities.CustomerSessionFields;
|
|
259
|
+
statistics: {
|
|
260
|
+
chatsCount: number;
|
|
261
|
+
threadsCount: number;
|
|
262
|
+
visitsCount: number;
|
|
263
|
+
pageViewsCount: number;
|
|
264
|
+
greetingsShownCount: number;
|
|
265
|
+
greetingsAcceptedCount: number;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
} | {
|
|
269
|
+
action: "get_form";
|
|
270
|
+
payload: {
|
|
271
|
+
enabled: false;
|
|
272
|
+
} | {
|
|
273
|
+
form: {
|
|
274
|
+
id: string;
|
|
275
|
+
fields: clientEntities.FormField[];
|
|
276
|
+
};
|
|
277
|
+
enabled: true;
|
|
278
|
+
};
|
|
279
|
+
} | {
|
|
280
|
+
action: "get_predicted_agent";
|
|
281
|
+
payload: clientEntities.PredictedAgent;
|
|
282
|
+
} | {
|
|
283
|
+
action: "get_url_info";
|
|
284
|
+
payload: clientEntities.UrlInfo;
|
|
285
|
+
} | {
|
|
286
|
+
action: "list_chats";
|
|
287
|
+
payload: {
|
|
288
|
+
chatsSummary: any;
|
|
289
|
+
totalChats: number;
|
|
290
|
+
users: clientEntities.ChatUser[];
|
|
291
|
+
previousPageId: string | null;
|
|
292
|
+
nextPageId: string | null;
|
|
293
|
+
};
|
|
294
|
+
} | {
|
|
295
|
+
action: "list_group_statuses";
|
|
296
|
+
payload: Record<number, serverEntities.GroupStatus>;
|
|
297
|
+
} | {
|
|
298
|
+
action: "list_threads";
|
|
299
|
+
payload: {
|
|
300
|
+
threads: clientEntities.Thread[];
|
|
301
|
+
previousPageId: string | null;
|
|
302
|
+
nextPageId: string | null;
|
|
303
|
+
};
|
|
304
|
+
} | {
|
|
305
|
+
action: "login";
|
|
306
|
+
payload: {
|
|
307
|
+
greeting?: clientEntities.Greeting | undefined;
|
|
308
|
+
dynamicConfig: serverEntities.DynamicConfig;
|
|
309
|
+
customer: {
|
|
310
|
+
type: "customer";
|
|
311
|
+
id: string;
|
|
312
|
+
name?: string | undefined;
|
|
313
|
+
email?: string | undefined;
|
|
314
|
+
avatar?: string | undefined;
|
|
315
|
+
sessionFields: clientEntities.CustomerSessionFields;
|
|
316
|
+
statistics: {
|
|
317
|
+
chatsCount: number;
|
|
318
|
+
threadsCount: number;
|
|
319
|
+
visitsCount: number;
|
|
320
|
+
pageViewsCount: number;
|
|
321
|
+
greetingsShownCount: number;
|
|
322
|
+
greetingsAcceptedCount: number;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
availability: clientEntities.AvailabilityStatus;
|
|
326
|
+
chats: {
|
|
327
|
+
id: string;
|
|
328
|
+
active: boolean | undefined;
|
|
329
|
+
hasUnreadEvents: boolean;
|
|
330
|
+
}[];
|
|
331
|
+
};
|
|
332
|
+
} | {
|
|
333
|
+
action: "mark_events_as_seen";
|
|
334
|
+
payload: Readonly<{
|
|
335
|
+
readonly success: true;
|
|
336
|
+
}>;
|
|
337
|
+
} | {
|
|
338
|
+
action: "send_sneak_peek";
|
|
339
|
+
payload: Readonly<{
|
|
340
|
+
readonly success: true;
|
|
341
|
+
}>;
|
|
342
|
+
} | {
|
|
343
|
+
action: "set_customer_session_fields";
|
|
344
|
+
payload: Readonly<{
|
|
345
|
+
readonly success: true;
|
|
346
|
+
}>;
|
|
347
|
+
} | {
|
|
348
|
+
action: "send_rich_message_postback";
|
|
349
|
+
payload: Readonly<{
|
|
350
|
+
readonly success: true;
|
|
351
|
+
}>;
|
|
352
|
+
} | {
|
|
353
|
+
action: "update_chat_properties";
|
|
354
|
+
payload: Readonly<{
|
|
355
|
+
readonly success: true;
|
|
356
|
+
}>;
|
|
357
|
+
} | {
|
|
358
|
+
action: "update_customer";
|
|
359
|
+
payload: Readonly<{
|
|
360
|
+
readonly success: true;
|
|
361
|
+
}>;
|
|
362
|
+
} | {
|
|
363
|
+
action: "update_customer_page";
|
|
364
|
+
payload: Readonly<{
|
|
365
|
+
readonly success: true;
|
|
366
|
+
}>;
|
|
367
|
+
} | {
|
|
368
|
+
action: "update_event_properties";
|
|
369
|
+
payload: Readonly<{
|
|
370
|
+
readonly success: true;
|
|
371
|
+
}>;
|
|
372
|
+
} | {
|
|
373
|
+
action: "update_thread_properties";
|
|
374
|
+
payload: Readonly<{
|
|
375
|
+
readonly success: true;
|
|
376
|
+
}>;
|
|
377
|
+
};
|
|
378
|
+
export declare const parseServerError: (error: {
|
|
379
|
+
type: string;
|
|
380
|
+
message: string;
|
|
381
|
+
}) => {
|
|
382
|
+
code: string;
|
|
383
|
+
message: string;
|
|
384
|
+
};
|
|
385
|
+
//# sourceMappingURL=serverFrameParser.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerAuth } from '@livechat/customer-auth';
|
|
2
|
+
import { Store, CustomerSessionFields } from '../types';
|
|
3
|
+
declare const checkGoals: (store: Store, auth: CustomerAuth, sessionFields?: CustomerSessionFields) => Promise<void>;
|
|
4
|
+
export default checkGoals;
|
|
5
|
+
//# sourceMappingURL=checkGoals.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomerAuth } from '@livechat/customer-auth';
|
|
2
|
+
import { SocketClient } from '../socketClient';
|
|
3
|
+
import { Action } from '../types/actions';
|
|
4
|
+
import { CustomerDataProvider, Store } from '../types';
|
|
5
|
+
declare const _default: ({ auth, customerDataProvider, emitter, socket, }: {
|
|
6
|
+
auth: CustomerAuth;
|
|
7
|
+
customerDataProvider?: CustomerDataProvider | undefined;
|
|
8
|
+
socket: SocketClient;
|
|
9
|
+
emitter: any;
|
|
10
|
+
}) => (action: Action, store: Store) => void;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Store } from './types';
|
|
2
|
+
import { SideStorage } from './types/serverEntities';
|
|
3
|
+
export declare const getSideStorage: (store: Store) => Promise<SideStorage>;
|
|
4
|
+
export declare const saveSideStorage: (store: Store, sideStorage: SideStorage) => Promise<void>;
|
|
5
|
+
//# sourceMappingURL=sideStorage.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PlatformClient } from '@livechat/platform-client';
|
|
2
|
+
import { Store } from './types';
|
|
3
|
+
import { Push, PushResponse, Response, ResponseError, Request } from './types/frames';
|
|
4
|
+
type Incoming = Push | PushResponse | Response | ResponseError;
|
|
5
|
+
type ParametrizedPlatformClient = PlatformClient<Incoming, Request>;
|
|
6
|
+
export type SocketClient = ParametrizedPlatformClient & {
|
|
7
|
+
reinitialize(): void;
|
|
8
|
+
};
|
|
9
|
+
declare const createSocketClient: (store: Store) => SocketClient;
|
|
10
|
+
export default createSocketClient;
|
|
11
|
+
//# sourceMappingURL=socketClient.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SocketClient } from './socketClient';
|
|
2
|
+
import { Store } from './types';
|
|
3
|
+
import { Push, PushResponse, ResponseError } from './types/frames';
|
|
4
|
+
declare const _default: (store: Store, socket: SocketClient) => {
|
|
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
|
+
} & (() => void);
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=socketListener.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Store } from './types';
|
|
2
|
+
export declare const failAllRequests: ({ getState, dispatch }: Store, reason: string) => void;
|
|
3
|
+
export declare const failRequest: ({ getState, dispatch }: Store, requestAction: any, error: any) => void;
|
|
4
|
+
//# sourceMappingURL=thunks.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Any, O } from 'ts-toolbelt';
|
|
2
|
+
import * as reduxActions from '../constants/reduxActions';
|
|
3
|
+
import { CustomerSessionFields, Page } from '.';
|
|
4
|
+
import * as clientEntities from './clientEntities';
|
|
5
|
+
import * as serverEntities from './serverEntities';
|
|
6
|
+
import * as serverFrameParser from '../serverFrameParser';
|
|
7
|
+
import { PushResponse, Request } from './frames';
|
|
8
|
+
export type ChangeRegionAction = {
|
|
9
|
+
type: typeof reduxActions.CHANGE_REGION;
|
|
10
|
+
payload: {
|
|
11
|
+
region: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type CheckGoalsAction = {
|
|
15
|
+
type: typeof reduxActions.CHECK_GOALS;
|
|
16
|
+
payload: {
|
|
17
|
+
sessionFields?: CustomerSessionFields;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type DestroyAction = {
|
|
21
|
+
type: typeof reduxActions.DESTROY;
|
|
22
|
+
payload: {
|
|
23
|
+
reason: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type FailAllRequestsAction = {
|
|
27
|
+
type: typeof reduxActions.FAIL_ALL_REQUESTS;
|
|
28
|
+
payload: {
|
|
29
|
+
reason: string;
|
|
30
|
+
rejects: ((err: any) => void)[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type LoginSuccessAction = {
|
|
34
|
+
type: typeof reduxActions.LOGIN_SUCCESS;
|
|
35
|
+
payload: {
|
|
36
|
+
dynamicConfig: serverEntities.DynamicConfig;
|
|
37
|
+
customer: clientEntities.Customer;
|
|
38
|
+
availability: 'online' | 'offline';
|
|
39
|
+
chats: Array<{
|
|
40
|
+
id: string;
|
|
41
|
+
active: boolean;
|
|
42
|
+
hasUnreadEvents: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
greeting?: clientEntities.Greeting;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type PauseConnectionAction = {
|
|
48
|
+
type: typeof reduxActions.PAUSE_CONNECTION;
|
|
49
|
+
payload: {
|
|
50
|
+
reason: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type PrefetchTokenAction = {
|
|
54
|
+
type: typeof reduxActions.PREFETCH_TOKEN;
|
|
55
|
+
payload: {
|
|
56
|
+
fresh: boolean;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type PushReceivedAction = {
|
|
60
|
+
type: typeof reduxActions.PUSH_RECEIVED;
|
|
61
|
+
payload: ReturnType<typeof serverFrameParser.parsePush>;
|
|
62
|
+
};
|
|
63
|
+
type ParsedPush = ReturnType<typeof serverFrameParser.parsePush>;
|
|
64
|
+
type ParsedPushResponse = Extract<ParsedPush, {
|
|
65
|
+
action: PushResponse['action'];
|
|
66
|
+
}>;
|
|
67
|
+
type PushResponsePayload = {
|
|
68
|
+
[T in ParsedPushResponse['action']]: Any.Compute<{
|
|
69
|
+
id: string;
|
|
70
|
+
promise: Promise<any>;
|
|
71
|
+
resolve: (value: any) => void;
|
|
72
|
+
} & Extract<ParsedPushResponse, {
|
|
73
|
+
action: T;
|
|
74
|
+
}>>;
|
|
75
|
+
}[ParsedPushResponse['action']];
|
|
76
|
+
export type PushResponseReceivedAction = {
|
|
77
|
+
type: typeof reduxActions.PUSH_RESPONSE_RECEIVED;
|
|
78
|
+
payload: PushResponsePayload;
|
|
79
|
+
};
|
|
80
|
+
export type RequestFailedAction = {
|
|
81
|
+
type: typeof reduxActions.REQUEST_FAILED;
|
|
82
|
+
payload: {
|
|
83
|
+
id: string;
|
|
84
|
+
reject: (err: any) => void;
|
|
85
|
+
error: {
|
|
86
|
+
code: string;
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export type ReconnectAction = {
|
|
92
|
+
type: typeof reduxActions.RECONNECT;
|
|
93
|
+
payload: {
|
|
94
|
+
delay: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
type ParsedResponse = ReturnType<typeof serverFrameParser.parseResponse>;
|
|
98
|
+
type DirectResponsePayload = {
|
|
99
|
+
[T in ParsedResponse['action']]: Any.Compute<{
|
|
100
|
+
id: string;
|
|
101
|
+
promise: Promise<any>;
|
|
102
|
+
resolve: (value: any) => void;
|
|
103
|
+
} & Extract<ParsedResponse, {
|
|
104
|
+
action: T;
|
|
105
|
+
}>>;
|
|
106
|
+
}[ParsedResponse['action']];
|
|
107
|
+
export type ResponseReceivedAction = {
|
|
108
|
+
type: typeof reduxActions.RESPONSE_RECEIVED;
|
|
109
|
+
payload: DirectResponsePayload;
|
|
110
|
+
};
|
|
111
|
+
export type SendRequestAction = {
|
|
112
|
+
type: typeof reduxActions.SEND_REQUEST;
|
|
113
|
+
payload: {
|
|
114
|
+
action: string;
|
|
115
|
+
promise: Promise<any>;
|
|
116
|
+
resolve: (val: any) => void;
|
|
117
|
+
reject: (err: any) => void;
|
|
118
|
+
id: string;
|
|
119
|
+
request: O.Pick<Request, 'action' | 'payload'>;
|
|
120
|
+
source?: 'login';
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export type SetChatActiveAction = {
|
|
124
|
+
type: typeof reduxActions.SET_CHAT_ACTIVE;
|
|
125
|
+
payload: {
|
|
126
|
+
id: string;
|
|
127
|
+
active: boolean;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export type SetSelfIdAction = {
|
|
131
|
+
type: typeof reduxActions.SET_SELF_ID;
|
|
132
|
+
payload: {
|
|
133
|
+
id: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export type SocketConnectedAction = {
|
|
137
|
+
type: typeof reduxActions.SOCKET_CONNECTED;
|
|
138
|
+
};
|
|
139
|
+
export type SocketDisconnectedAction = {
|
|
140
|
+
type: typeof reduxActions.SOCKET_DISCONNECTED;
|
|
141
|
+
};
|
|
142
|
+
export type SocketRecoveredAction = {
|
|
143
|
+
type: typeof reduxActions.SOCKET_RECOVERED;
|
|
144
|
+
};
|
|
145
|
+
export type SocketUnstableAction = {
|
|
146
|
+
type: typeof reduxActions.SOCKET_UNSTABLE;
|
|
147
|
+
};
|
|
148
|
+
export type StartConnectionAction = {
|
|
149
|
+
type: typeof reduxActions.START_CONNECTION;
|
|
150
|
+
};
|
|
151
|
+
export type UpdateCustomerPageAction = {
|
|
152
|
+
type: typeof reduxActions.UPDATE_CUSTOMER_PAGE;
|
|
153
|
+
payload: Page;
|
|
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;
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=actions.d.ts.map
|