@microsoft/omnichannel-chat-widget 1.6.2 → 1.6.3-main.e6221d5

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.
@@ -2,348 +2,655 @@
2
2
 
3
3
  import { LiveChatWidgetActionType } from "./common/LiveChatWidgetActionType";
4
4
  export const createReducer = () => {
5
- const reducer = (state, action) => {
6
- var _action$payload, _action$payload2, _action$payload3;
7
- switch (action.type) {
8
- case LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID:
9
- return {
10
- ...state,
11
- domainStates: {
12
- ...state.domainStates,
13
- widgetElementId: action.payload
14
- }
15
- };
16
- case LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS:
17
- return {
18
- ...state,
19
- domainStates: {
20
- ...state.domainStates,
21
- renderingMiddlewareProps: action.payload
22
- }
23
- };
24
- case LiveChatWidgetActionType.SET_MIDDLEWARE_LOCALIZED_TEXTS:
25
- return {
26
- ...state,
27
- domainStates: {
28
- ...state.domainStates,
29
- middlewareLocalizedTexts: action.payload
30
- }
31
- };
32
- case LiveChatWidgetActionType.SET_GLOBAL_DIR:
33
- return {
34
- ...state,
35
- domainStates: {
36
- ...state.domainStates,
37
- globalDir: action.payload === "ltr" || action.payload === "rtl" ? action.payload : "ltr"
38
- }
39
- };
40
- case LiveChatWidgetActionType.SET_MINIMIZED:
41
- return {
42
- ...state,
43
- appStates: {
44
- ...state.appStates,
45
- isMinimized: action.payload
46
- }
47
- };
48
- case LiveChatWidgetActionType.SET_CONVERSATION_STATE:
49
- return {
50
- ...state,
51
- appStates: {
52
- ...state.appStates,
53
- conversationState: action.payload
54
- }
55
- };
56
- case LiveChatWidgetActionType.SET_START_CHAT_FAILING:
57
- return {
58
- ...state,
59
- appStates: {
60
- ...state.appStates,
61
- startChatFailed: action.payload
62
- }
63
- };
64
- case LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE:
65
- return {
66
- ...state,
67
- domainStates: {
68
- ...state.domainStates,
69
- startChatFailureType: action.payload
70
- }
71
- };
72
- case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
73
- return {
74
- ...state,
75
- appStates: {
76
- ...state.appStates,
77
- outsideOperatingHours: action.payload
78
- }
79
- };
80
- case LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE:
81
- return {
82
- ...state,
83
- domainStates: {
84
- ...state.domainStates,
85
- preChatSurveyResponse: action.payload
86
- }
87
- };
88
- case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
89
- return {
90
- ...state,
91
- domainStates: {
92
- ...state.domainStates,
93
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
- customContext: action.payload
95
- }
96
- };
97
- case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
98
- return {
99
- ...state,
100
- appStates: {
101
- ...state.appStates,
102
- previousElementIdOnFocusBeforeModalOpen: action.payload
103
- }
104
- };
105
- case LiveChatWidgetActionType.SET_SHOW_CONFIRMATION:
106
- return {
107
- ...state,
108
- uiStates: {
109
- ...state.uiStates,
110
- showConfirmationPane: action.payload
111
- }
112
- };
113
- case LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT:
114
- return {
115
- ...state,
116
- domainStates: {
117
- ...state.domainStates,
118
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
119
- postChatContext: action.payload
120
- }
121
- };
122
- case LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
123
- return {
124
- ...state,
125
- uiStates: {
126
- ...state.uiStates,
127
- showCallingPopup: action.payload
128
- }
129
- };
130
- case LiveChatWidgetActionType.SET_INCOMING_CALL:
131
- return {
132
- ...state,
133
- uiStates: {
134
- ...state.uiStates,
135
- isIncomingCall: action.payload
136
- }
137
- };
138
- case LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
139
- return {
140
- ...state,
141
- uiStates: {
142
- ...state.uiStates,
143
- focusChatButton: action.payload
144
- }
145
- };
146
- case LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
147
- return {
148
- ...state,
149
- uiStates: {
150
- ...state.uiStates,
151
- disableVideoCall: action.payload
152
- }
153
- };
154
- case LiveChatWidgetActionType.DISABLE_LOCAL_VIDEO:
155
- return {
156
- ...state,
157
- uiStates: {
158
- ...state.uiStates,
159
- disableSelfVideo: action.payload
160
- }
161
- };
162
- case LiveChatWidgetActionType.DISABLE_REMOTE_VIDEO:
163
- return {
164
- ...state,
165
- uiStates: {
166
- ...state.uiStates,
167
- disableRemoteVideo: action.payload
168
- }
169
- };
170
- case LiveChatWidgetActionType.SET_CHAT_TOKEN:
171
- return {
172
- ...state,
173
- domainStates: {
174
- ...state.domainStates,
175
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
- chatToken: action.payload
177
- }
178
- };
179
- case LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE:
180
- return {
181
- ...state,
182
- uiStates: {
183
- ...state.uiStates,
184
- showEmailTranscriptPane: action.payload
185
- }
186
- };
187
- case LiveChatWidgetActionType.SET_PRECHAT_RESPONSE_EMAIL:
188
- return {
189
- ...state,
190
- appStates: {
191
- ...state.appStates,
192
- preChatResponseEmail: action.payload
193
- }
194
- };
195
- case LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION:
196
- return {
197
- ...state,
198
- appStates: {
199
- ...state.appStates,
200
- isAudioMuted: action.payload
201
- }
202
- };
203
- case LiveChatWidgetActionType.SET_E2VV_ENABLED:
204
- return {
205
- ...state,
206
- appStates: {
207
- ...state.appStates,
208
- e2vvEnabled: action.payload
209
- }
210
- };
211
- case LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY:
212
- return {
213
- ...state,
214
- appStates: {
215
- ...state.appStates,
216
- hideStartChatButton: action.payload
217
- }
218
- };
219
- case LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS:
220
- return {
221
- ...state,
222
- appStates: {
223
- ...state.appStates,
224
- proactiveChatStates: {
225
- ...state.appStates.proactiveChatStates,
226
- proactiveChatBodyTitle: (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.proactiveChatBodyTitle,
227
- proactiveChatEnablePrechat: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.proactiveChatEnablePrechat,
228
- proactiveChatInNewWindow: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.proactiveChatInNewWindow
229
- }
230
- }
231
- };
232
- case LiveChatWidgetActionType.SET_TELEMETRY_DATA:
233
- return {
234
- ...state,
235
- domainStates: {
236
- ...state.domainStates,
237
- telemetryInternalData: action.payload
238
- }
239
- };
240
- case LiveChatWidgetActionType.SET_RECONNECT_ID:
241
- return {
242
- ...state,
243
- appStates: {
244
- ...state.appStates,
245
- reconnectId: action.payload
246
- }
247
- };
248
- case LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT:
249
- return {
250
- ...state,
251
- appStates: {
252
- ...state.appStates,
253
- unreadMessageCount: action.payload
254
- }
255
- };
256
- case LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
257
- return {
258
- ...state,
259
- domainStates: {
260
- ...state.domainStates,
261
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
- liveChatContext: action.payload
263
- }
264
- };
265
- case LiveChatWidgetActionType.SET_WIDGET_STATE:
266
- return {
267
- ...action.payload
268
- };
269
- case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY:
270
- return {
271
- ...state,
272
- appStates: {
273
- ...state.appStates,
274
- conversationEndedBy: action.payload
275
- }
276
- };
277
- case LiveChatWidgetActionType.SET_WIDGET_SIZE:
278
- return {
279
- ...state,
280
- domainStates: {
281
- ...state.domainStates,
282
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
283
- widgetSize: action.payload
284
- }
285
- };
286
- case LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
287
- return {
288
- ...state,
289
- domainStates: {
290
- ...state.domainStates,
291
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
292
- widgetInstanceId: action.payload
293
- }
294
- };
295
- case LiveChatWidgetActionType.SET_LIVE_CHAT_CONFIG:
296
- return {
297
- ...state,
298
- domainStates: {
299
- ...state.domainStates,
300
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
- liveChatConfig: action.payload
302
- }
303
- };
304
- case LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID:
305
- return {
306
- ...state,
307
- domainStates: {
308
- ...state.domainStates,
309
- initialChatSdkRequestId: action.payload
310
- }
311
- };
312
- case LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED:
313
- return {
314
- ...state,
315
- appStates: {
316
- ...state.appStates,
317
- chatDisconnectEventReceived: action.payload
318
- }
319
- };
320
- case LiveChatWidgetActionType.SET_SURVEY_MODE:
321
- return {
322
- ...state,
323
- appStates: {
324
- ...state.appStates,
325
- selectedSurveyMode: action.payload
326
- }
327
- };
328
- case LiveChatWidgetActionType.SET_CONFIRMATION_STATE:
329
- return {
330
- ...state,
331
- domainStates: {
332
- ...state.domainStates,
333
- confirmationState: action.payload
334
- }
335
- };
336
- case LiveChatWidgetActionType.SET_POST_CHAT_PARTICIPANT_TYPE:
337
- return {
338
- ...state,
339
- appStates: {
340
- ...state.appStates,
341
- postChatParticipantType: action.payload
342
- }
343
- };
344
- default:
345
- return state;
346
- }
347
- };
348
5
  return reducer;
6
+ };
7
+ export const executeReducer = (state, action) => {
8
+ return reducer(state, action);
9
+ };
10
+
11
+ // inMemory state to store the runtime state of the widget for access immediately
12
+ let inMemory;
13
+ const reducer = (state, action) => {
14
+ var _action$payload, _action$payload2, _action$payload3, _action$payload4, _action$payload5, _action$payload6;
15
+ // Initialize inMemory state
16
+ if (!inMemory) {
17
+ inMemory = state;
18
+ }
19
+ switch (action.type) {
20
+ case LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID:
21
+ inMemory = {
22
+ ...inMemory,
23
+ domainStates: {
24
+ ...inMemory.domainStates,
25
+ widgetElementId: action.payload
26
+ }
27
+ };
28
+ return {
29
+ ...state,
30
+ domainStates: {
31
+ ...state.domainStates,
32
+ widgetElementId: action.payload
33
+ }
34
+ };
35
+ case LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS:
36
+ inMemory = {
37
+ ...inMemory,
38
+ domainStates: {
39
+ ...inMemory.domainStates,
40
+ renderingMiddlewareProps: action.payload
41
+ }
42
+ };
43
+ return {
44
+ ...state,
45
+ domainStates: {
46
+ ...state.domainStates,
47
+ renderingMiddlewareProps: action.payload
48
+ }
49
+ };
50
+ case LiveChatWidgetActionType.SET_MIDDLEWARE_LOCALIZED_TEXTS:
51
+ inMemory = {
52
+ ...inMemory,
53
+ domainStates: {
54
+ ...inMemory.domainStates,
55
+ middlewareLocalizedTexts: action.payload
56
+ }
57
+ };
58
+ return {
59
+ ...state,
60
+ domainStates: {
61
+ ...state.domainStates,
62
+ middlewareLocalizedTexts: action.payload
63
+ }
64
+ };
65
+ case LiveChatWidgetActionType.SET_GLOBAL_DIR:
66
+ inMemory = {
67
+ ...inMemory,
68
+ domainStates: {
69
+ ...inMemory.domainStates,
70
+ globalDir: action.payload === "ltr" || action.payload === "rtl" ? action.payload : "ltr"
71
+ }
72
+ };
73
+ return {
74
+ ...state,
75
+ domainStates: {
76
+ ...state.domainStates,
77
+ globalDir: action.payload === "ltr" || action.payload === "rtl" ? action.payload : "ltr"
78
+ }
79
+ };
80
+ case LiveChatWidgetActionType.SET_MINIMIZED:
81
+ inMemory = {
82
+ ...inMemory,
83
+ appStates: {
84
+ ...state.appStates,
85
+ isMinimized: action.payload
86
+ }
87
+ };
88
+ return {
89
+ ...state,
90
+ appStates: {
91
+ ...state.appStates,
92
+ isMinimized: action.payload
93
+ }
94
+ };
95
+ case LiveChatWidgetActionType.SET_CONVERSATION_STATE:
96
+ inMemory = {
97
+ ...inMemory,
98
+ appStates: {
99
+ ...inMemory.appStates,
100
+ conversationState: action.payload
101
+ }
102
+ };
103
+ return {
104
+ ...state,
105
+ appStates: {
106
+ ...state.appStates,
107
+ conversationState: action.payload
108
+ }
109
+ };
110
+ case LiveChatWidgetActionType.SET_START_CHAT_FAILING:
111
+ inMemory = {
112
+ ...inMemory,
113
+ appStates: {
114
+ ...inMemory.appStates,
115
+ startChatFailed: action.payload
116
+ }
117
+ };
118
+ return {
119
+ ...state,
120
+ appStates: {
121
+ ...state.appStates,
122
+ startChatFailed: action.payload
123
+ }
124
+ };
125
+ case LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE:
126
+ inMemory = {
127
+ ...inMemory,
128
+ domainStates: {
129
+ ...inMemory.domainStates,
130
+ startChatFailureType: action.payload
131
+ }
132
+ };
133
+ return {
134
+ ...state,
135
+ domainStates: {
136
+ ...state.domainStates,
137
+ startChatFailureType: action.payload
138
+ }
139
+ };
140
+ case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
141
+ inMemory = {
142
+ ...inMemory,
143
+ appStates: {
144
+ ...inMemory.appStates,
145
+ outsideOperatingHours: action.payload
146
+ }
147
+ };
148
+ return {
149
+ ...state,
150
+ appStates: {
151
+ ...state.appStates,
152
+ outsideOperatingHours: action.payload
153
+ }
154
+ };
155
+ case LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE:
156
+ inMemory = {
157
+ ...inMemory,
158
+ domainStates: {
159
+ ...inMemory.domainStates,
160
+ preChatSurveyResponse: action.payload
161
+ }
162
+ };
163
+ return {
164
+ ...state,
165
+ domainStates: {
166
+ ...state.domainStates,
167
+ preChatSurveyResponse: action.payload
168
+ }
169
+ };
170
+ case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
171
+ inMemory = {
172
+ ...inMemory,
173
+ domainStates: {
174
+ ...inMemory.domainStates,
175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
+ customContext: action.payload
177
+ }
178
+ };
179
+ return {
180
+ ...state,
181
+ domainStates: {
182
+ ...state.domainStates,
183
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
184
+ customContext: action.payload
185
+ }
186
+ };
187
+ case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
188
+ inMemory = {
189
+ ...inMemory,
190
+ appStates: {
191
+ ...inMemory.appStates,
192
+ previousElementIdOnFocusBeforeModalOpen: action.payload
193
+ }
194
+ };
195
+ return {
196
+ ...state,
197
+ appStates: {
198
+ ...state.appStates,
199
+ previousElementIdOnFocusBeforeModalOpen: action.payload
200
+ }
201
+ };
202
+ case LiveChatWidgetActionType.SET_SHOW_CONFIRMATION:
203
+ inMemory = {
204
+ ...inMemory,
205
+ uiStates: {
206
+ ...inMemory.uiStates,
207
+ showConfirmationPane: action.payload
208
+ }
209
+ };
210
+ return {
211
+ ...state,
212
+ uiStates: {
213
+ ...state.uiStates,
214
+ showConfirmationPane: action.payload
215
+ }
216
+ };
217
+ case LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT:
218
+ inMemory = {
219
+ ...inMemory,
220
+ domainStates: {
221
+ ...inMemory.domainStates,
222
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
+ postChatContext: action.payload
224
+ }
225
+ };
226
+ return {
227
+ ...state,
228
+ domainStates: {
229
+ ...state.domainStates,
230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
+ postChatContext: action.payload
232
+ }
233
+ };
234
+ case LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
235
+ inMemory = {
236
+ ...inMemory,
237
+ uiStates: {
238
+ ...inMemory.uiStates,
239
+ showCallingPopup: action.payload
240
+ }
241
+ };
242
+ return {
243
+ ...state,
244
+ uiStates: {
245
+ ...state.uiStates,
246
+ showCallingPopup: action.payload
247
+ }
248
+ };
249
+ case LiveChatWidgetActionType.SET_INCOMING_CALL:
250
+ inMemory = {
251
+ ...inMemory,
252
+ uiStates: {
253
+ ...inMemory.uiStates,
254
+ isIncomingCall: action.payload
255
+ }
256
+ };
257
+ return {
258
+ ...state,
259
+ uiStates: {
260
+ ...state.uiStates,
261
+ isIncomingCall: action.payload
262
+ }
263
+ };
264
+ case LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
265
+ inMemory = {
266
+ ...inMemory,
267
+ uiStates: {
268
+ ...inMemory.uiStates,
269
+ focusChatButton: action.payload
270
+ }
271
+ };
272
+ return {
273
+ ...state,
274
+ uiStates: {
275
+ ...state.uiStates,
276
+ focusChatButton: action.payload
277
+ }
278
+ };
279
+ case LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
280
+ inMemory = {
281
+ ...inMemory,
282
+ uiStates: {
283
+ ...inMemory.uiStates,
284
+ disableVideoCall: action.payload
285
+ }
286
+ };
287
+ return {
288
+ ...state,
289
+ uiStates: {
290
+ ...state.uiStates,
291
+ disableVideoCall: action.payload
292
+ }
293
+ };
294
+ case LiveChatWidgetActionType.DISABLE_LOCAL_VIDEO:
295
+ inMemory = {
296
+ ...inMemory,
297
+ uiStates: {
298
+ ...inMemory.uiStates,
299
+ disableSelfVideo: action.payload
300
+ }
301
+ };
302
+ return {
303
+ ...state,
304
+ uiStates: {
305
+ ...state.uiStates,
306
+ disableSelfVideo: action.payload
307
+ }
308
+ };
309
+ case LiveChatWidgetActionType.DISABLE_REMOTE_VIDEO:
310
+ inMemory = {
311
+ ...inMemory,
312
+ uiStates: {
313
+ ...inMemory.uiStates,
314
+ disableRemoteVideo: action.payload
315
+ }
316
+ };
317
+ return {
318
+ ...state,
319
+ uiStates: {
320
+ ...state.uiStates,
321
+ disableRemoteVideo: action.payload
322
+ }
323
+ };
324
+ case LiveChatWidgetActionType.SET_CHAT_TOKEN:
325
+ inMemory = {
326
+ ...inMemory,
327
+ domainStates: {
328
+ ...inMemory.domainStates,
329
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
330
+ chatToken: action.payload
331
+ }
332
+ };
333
+ return {
334
+ ...state,
335
+ domainStates: {
336
+ ...state.domainStates,
337
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
338
+ chatToken: action.payload
339
+ }
340
+ };
341
+ case LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE:
342
+ inMemory = {
343
+ ...inMemory,
344
+ uiStates: {
345
+ ...inMemory.uiStates,
346
+ showEmailTranscriptPane: action.payload
347
+ }
348
+ };
349
+ return {
350
+ ...state,
351
+ uiStates: {
352
+ ...state.uiStates,
353
+ showEmailTranscriptPane: action.payload
354
+ }
355
+ };
356
+ case LiveChatWidgetActionType.SET_PRECHAT_RESPONSE_EMAIL:
357
+ inMemory = {
358
+ ...inMemory,
359
+ appStates: {
360
+ ...inMemory.appStates,
361
+ preChatResponseEmail: action.payload
362
+ }
363
+ };
364
+ return {
365
+ ...state,
366
+ appStates: {
367
+ ...state.appStates,
368
+ preChatResponseEmail: action.payload
369
+ }
370
+ };
371
+ case LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION:
372
+ inMemory = {
373
+ ...inMemory,
374
+ appStates: {
375
+ ...inMemory.appStates,
376
+ isAudioMuted: action.payload
377
+ }
378
+ };
379
+ return {
380
+ ...state,
381
+ appStates: {
382
+ ...state.appStates,
383
+ isAudioMuted: action.payload
384
+ }
385
+ };
386
+ case LiveChatWidgetActionType.SET_E2VV_ENABLED:
387
+ inMemory = {
388
+ ...inMemory,
389
+ appStates: {
390
+ ...inMemory.appStates,
391
+ e2vvEnabled: action.payload
392
+ }
393
+ };
394
+ return {
395
+ ...state,
396
+ appStates: {
397
+ ...state.appStates,
398
+ e2vvEnabled: action.payload
399
+ }
400
+ };
401
+ case LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY:
402
+ inMemory = {
403
+ ...inMemory,
404
+ appStates: {
405
+ ...inMemory.appStates,
406
+ hideStartChatButton: action.payload
407
+ }
408
+ };
409
+ return {
410
+ ...state,
411
+ appStates: {
412
+ ...state.appStates,
413
+ hideStartChatButton: action.payload
414
+ }
415
+ };
416
+ case LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS:
417
+ inMemory = {
418
+ ...inMemory,
419
+ appStates: {
420
+ ...inMemory.appStates,
421
+ proactiveChatStates: {
422
+ ...state.appStates.proactiveChatStates,
423
+ proactiveChatBodyTitle: (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.proactiveChatBodyTitle,
424
+ proactiveChatEnablePrechat: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.proactiveChatEnablePrechat,
425
+ proactiveChatInNewWindow: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.proactiveChatInNewWindow
426
+ }
427
+ }
428
+ };
429
+ return {
430
+ ...state,
431
+ appStates: {
432
+ ...state.appStates,
433
+ proactiveChatStates: {
434
+ ...state.appStates.proactiveChatStates,
435
+ proactiveChatBodyTitle: (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : _action$payload4.proactiveChatBodyTitle,
436
+ proactiveChatEnablePrechat: (_action$payload5 = action.payload) === null || _action$payload5 === void 0 ? void 0 : _action$payload5.proactiveChatEnablePrechat,
437
+ proactiveChatInNewWindow: (_action$payload6 = action.payload) === null || _action$payload6 === void 0 ? void 0 : _action$payload6.proactiveChatInNewWindow
438
+ }
439
+ }
440
+ };
441
+ case LiveChatWidgetActionType.SET_TELEMETRY_DATA:
442
+ inMemory = {
443
+ ...inMemory,
444
+ domainStates: {
445
+ ...inMemory.domainStates,
446
+ telemetryInternalData: action.payload
447
+ }
448
+ };
449
+ return {
450
+ ...state,
451
+ domainStates: {
452
+ ...state.domainStates,
453
+ telemetryInternalData: action.payload
454
+ }
455
+ };
456
+ case LiveChatWidgetActionType.SET_RECONNECT_ID:
457
+ inMemory = {
458
+ ...inMemory,
459
+ appStates: {
460
+ ...inMemory.appStates,
461
+ reconnectId: action.payload
462
+ }
463
+ };
464
+ return {
465
+ ...state,
466
+ appStates: {
467
+ ...state.appStates,
468
+ reconnectId: action.payload
469
+ }
470
+ };
471
+ case LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT:
472
+ inMemory = {
473
+ ...inMemory,
474
+ appStates: {
475
+ ...inMemory.appStates,
476
+ unreadMessageCount: action.payload
477
+ }
478
+ };
479
+ return {
480
+ ...state,
481
+ appStates: {
482
+ ...state.appStates,
483
+ unreadMessageCount: action.payload
484
+ }
485
+ };
486
+ case LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
487
+ inMemory = {
488
+ ...inMemory,
489
+ domainStates: {
490
+ ...inMemory.domainStates,
491
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
492
+ liveChatContext: action.payload
493
+ }
494
+ };
495
+ return {
496
+ ...state,
497
+ domainStates: {
498
+ ...state.domainStates,
499
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
500
+ liveChatContext: action.payload
501
+ }
502
+ };
503
+ case LiveChatWidgetActionType.SET_WIDGET_STATE:
504
+ inMemory = {
505
+ ...action.payload
506
+ };
507
+ return {
508
+ ...action.payload
509
+ };
510
+ case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY:
511
+ inMemory = {
512
+ ...inMemory,
513
+ appStates: {
514
+ ...inMemory.appStates,
515
+ conversationEndedBy: action.payload
516
+ }
517
+ };
518
+ return {
519
+ ...state,
520
+ appStates: {
521
+ ...state.appStates,
522
+ conversationEndedBy: action.payload
523
+ }
524
+ };
525
+ case LiveChatWidgetActionType.SET_WIDGET_SIZE:
526
+ inMemory = {
527
+ ...inMemory,
528
+ domainStates: {
529
+ ...inMemory.domainStates,
530
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
531
+ widgetSize: action.payload
532
+ }
533
+ };
534
+ return {
535
+ ...state,
536
+ domainStates: {
537
+ ...state.domainStates,
538
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
539
+ widgetSize: action.payload
540
+ }
541
+ };
542
+ case LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
543
+ inMemory = {
544
+ ...inMemory,
545
+ domainStates: {
546
+ ...inMemory.domainStates,
547
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
548
+ widgetInstanceId: action.payload
549
+ }
550
+ };
551
+ return {
552
+ ...state,
553
+ domainStates: {
554
+ ...state.domainStates,
555
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
556
+ widgetInstanceId: action.payload
557
+ }
558
+ };
559
+ case LiveChatWidgetActionType.SET_LIVE_CHAT_CONFIG:
560
+ inMemory = {
561
+ ...inMemory,
562
+ domainStates: {
563
+ ...inMemory.domainStates,
564
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
565
+ liveChatConfig: action.payload
566
+ }
567
+ };
568
+ return {
569
+ ...state,
570
+ domainStates: {
571
+ ...state.domainStates,
572
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
573
+ liveChatConfig: action.payload
574
+ }
575
+ };
576
+ case LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID:
577
+ inMemory = {
578
+ ...inMemory,
579
+ domainStates: {
580
+ ...inMemory.domainStates,
581
+ initialChatSdkRequestId: action.payload
582
+ }
583
+ };
584
+ return {
585
+ ...state,
586
+ domainStates: {
587
+ ...state.domainStates,
588
+ initialChatSdkRequestId: action.payload
589
+ }
590
+ };
591
+ case LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED:
592
+ inMemory = {
593
+ ...inMemory,
594
+ appStates: {
595
+ ...inMemory.appStates,
596
+ chatDisconnectEventReceived: action.payload
597
+ }
598
+ };
599
+ return {
600
+ ...state,
601
+ appStates: {
602
+ ...state.appStates,
603
+ chatDisconnectEventReceived: action.payload
604
+ }
605
+ };
606
+ case LiveChatWidgetActionType.SET_SURVEY_MODE:
607
+ inMemory = {
608
+ ...inMemory,
609
+ appStates: {
610
+ ...inMemory.appStates,
611
+ selectedSurveyMode: action.payload
612
+ }
613
+ };
614
+ return {
615
+ ...state,
616
+ appStates: {
617
+ ...state.appStates,
618
+ selectedSurveyMode: action.payload
619
+ }
620
+ };
621
+ case LiveChatWidgetActionType.SET_CONFIRMATION_STATE:
622
+ inMemory = {
623
+ ...inMemory,
624
+ domainStates: {
625
+ ...inMemory.domainStates,
626
+ confirmationState: action.payload
627
+ }
628
+ };
629
+ return {
630
+ ...state,
631
+ domainStates: {
632
+ ...state.domainStates,
633
+ confirmationState: action.payload
634
+ }
635
+ };
636
+ case LiveChatWidgetActionType.SET_POST_CHAT_PARTICIPANT_TYPE:
637
+ inMemory = {
638
+ ...inMemory,
639
+ appStates: {
640
+ ...inMemory.appStates,
641
+ postChatParticipantType: action.payload
642
+ }
643
+ };
644
+ return {
645
+ ...state,
646
+ appStates: {
647
+ ...state.appStates,
648
+ postChatParticipantType: action.payload
649
+ }
650
+ };
651
+ case LiveChatWidgetActionType.GET_IN_MEMORY_STATE:
652
+ return inMemory;
653
+ default:
654
+ return state;
655
+ }
349
656
  };