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