@defra/flood-webchat 0.0.1-beta.38-draft → 0.0.1-beta.39
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/dist/client.js +66 -184
- package/dist/client.js.map +1 -1
- package/package.json +1 -2
- package/src/client/components/availability/availability.jsx +2 -20
- package/src/client/components/availability/availability.scss +8 -0
- package/src/client/components/chat/chat.jsx +7 -39
- package/src/client/components/chat/chat.scss +13 -1
- package/src/client/components/panel/panel.jsx +0 -2
- package/src/client/components/screens/end-chat.jsx +4 -4
- package/src/client/components/screens/feedback.jsx +21 -7
- package/src/client/components/screens/request-chat.jsx +5 -1
- package/src/client/components/skip-link.jsx +2 -2
- package/src/client/lib/agent-status-headline.js +11 -13
- package/src/client/scss/_settings.scss +5 -21
- package/src/client/store/AppProvider.jsx +1 -7
- package/src/client/store/actions-map.js +4 -13
- package/src/client/components/live-region.jsx +0 -55
package/dist/client.js
CHANGED
|
@@ -19,8 +19,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
19
19
|
/* harmony import */ var _skip_link_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../skip-link.jsx */ "./src/client/components/skip-link.jsx");
|
|
20
20
|
/* harmony import */ var _store_useApp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../store/useApp */ "./src/client/store/useApp.js");
|
|
21
21
|
/* harmony import */ var _lib_history_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lib/history.js */ "./src/client/lib/history.js");
|
|
22
|
-
/* harmony import */ var _live_region_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../live-region.jsx */ "./src/client/components/live-region.jsx");
|
|
23
|
-
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
|
|
@@ -35,8 +33,7 @@ function Availability() {
|
|
|
35
33
|
unseenCount,
|
|
36
34
|
threadId,
|
|
37
35
|
setUnseenCount,
|
|
38
|
-
setInstigatorId
|
|
39
|
-
setLiveRegionText
|
|
36
|
+
setInstigatorId
|
|
40
37
|
} = (0,_store_useApp__WEBPACK_IMPORTED_MODULE_4__.useApp)();
|
|
41
38
|
const buttonRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
42
39
|
const onClick = e => {
|
|
@@ -61,14 +58,6 @@ function Availability() {
|
|
|
61
58
|
setChatVisibility(!isChatOpen);
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
65
|
-
if (!isChatOpen && unseenCount > 0) {
|
|
66
|
-
setLiveRegionText(`Floodline Webchat - ${unseenCount} new messages`);
|
|
67
|
-
}
|
|
68
|
-
return () => {
|
|
69
|
-
setLiveRegionText();
|
|
70
|
-
};
|
|
71
|
-
}, [unseenCount, isChatOpen]);
|
|
72
61
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
73
62
|
const onScroll = () => {
|
|
74
63
|
if (!threadId) {
|
|
@@ -111,9 +100,9 @@ function Availability() {
|
|
|
111
100
|
onKeyDown: onKeyDown,
|
|
112
101
|
role: "button",
|
|
113
102
|
"data-module": "govuk-button"
|
|
114
|
-
}, TextComponent, unseenCount > 0 && !isChatOpen ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
|
103
|
+
}, TextComponent, unseenCount > 0 && !isChatOpen ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
115
104
|
className: "wc-availability__unseen"
|
|
116
|
-
}, unseenCount)
|
|
105
|
+
}, unseenCount) : null))), isChatOpen && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_panel_panel_jsx__WEBPACK_IMPORTED_MODULE_2__.Panel, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_skip_link_jsx__WEBPACK_IMPORTED_MODULE_3__.SkipLink, null));
|
|
117
106
|
case 'EXISTING':
|
|
118
107
|
case 'UNAVAILABLE':
|
|
119
108
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", {
|
|
@@ -166,10 +155,8 @@ function Chat({
|
|
|
166
155
|
agent,
|
|
167
156
|
agentStatus,
|
|
168
157
|
isAgentTyping,
|
|
169
|
-
isChatOpen,
|
|
170
158
|
settings,
|
|
171
|
-
isKeyboard
|
|
172
|
-
setLiveRegionText
|
|
159
|
+
isKeyboard
|
|
173
160
|
} = (0,_store_useApp_js__WEBPACK_IMPORTED_MODULE_4__.useApp)();
|
|
174
161
|
const [userMessage, setUserMessage] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
|
|
175
162
|
const [focusVisibleWithin, setFocusVisibleWithin] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
@@ -194,39 +181,12 @@ function Chat({
|
|
|
194
181
|
};
|
|
195
182
|
const agentName = agent?.nickname || agent?.firstName;
|
|
196
183
|
const connectionHeadlineText = (0,_lib_agent_status_headline_js__WEBPACK_IMPORTED_MODULE_7__.agentStatusHeadline)(availability, agentStatus, agentName);
|
|
197
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
198
|
-
if (connectionHeadlineText) {
|
|
199
|
-
setLiveRegionText(`Floodline Webchat - ${connectionHeadlineText}`);
|
|
200
|
-
}
|
|
201
|
-
return () => {
|
|
202
|
-
setLiveRegionText();
|
|
203
|
-
};
|
|
204
|
-
}, [connectionHeadlineText]);
|
|
205
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
206
|
-
if (isAgentTyping && isChatOpen) {
|
|
207
|
-
setLiveRegionText(`${agentName} is typing...`);
|
|
208
|
-
}
|
|
209
|
-
return () => {
|
|
210
|
-
setLiveRegionText();
|
|
211
|
-
};
|
|
212
|
-
}, [isAgentTyping, isChatOpen]);
|
|
213
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
214
|
-
const lastAgentMessage = messages[messages.length - 1];
|
|
215
|
-
if (lastAgentMessage?.direction === 'outbound') {
|
|
216
|
-
setLiveRegionText(`${agentName} said: ${lastAgentMessage.text}`);
|
|
217
|
-
}
|
|
218
|
-
return () => {
|
|
219
|
-
setLiveRegionText();
|
|
220
|
-
};
|
|
221
|
-
}, [messages]);
|
|
222
184
|
const sendMessage = () => {
|
|
223
|
-
if (messageRef.current.value.length === 0) {
|
|
185
|
+
if (messageRef.current.value.length === 0 || agentStatus === 'closed') {
|
|
224
186
|
return;
|
|
225
187
|
}
|
|
226
188
|
try {
|
|
227
|
-
|
|
228
|
-
thread.sendTextMessage(message);
|
|
229
|
-
setLiveRegionText(`You said: ${message}`);
|
|
189
|
+
thread.sendTextMessage(messageRef.current.value.trim());
|
|
230
190
|
} catch (err) {
|
|
231
191
|
console.log('[Chat Error] sendMessage', err);
|
|
232
192
|
}
|
|
@@ -260,10 +220,12 @@ function Chat({
|
|
|
260
220
|
default:
|
|
261
221
|
break;
|
|
262
222
|
}
|
|
263
|
-
}
|
|
223
|
+
}
|
|
224
|
+
if (e.key === ' ') {
|
|
264
225
|
if (e.target.id === 'end-chat') {
|
|
265
226
|
onEndChatScreen(e);
|
|
266
|
-
}
|
|
227
|
+
}
|
|
228
|
+
if (e.target.id === 'wc-settings') {
|
|
267
229
|
onSettingsScreen(e);
|
|
268
230
|
}
|
|
269
231
|
}
|
|
@@ -420,72 +382,6 @@ const ErrorSummary = ({
|
|
|
420
382
|
|
|
421
383
|
/***/ }),
|
|
422
384
|
|
|
423
|
-
/***/ "./src/client/components/live-region.jsx":
|
|
424
|
-
/*!***********************************************!*\
|
|
425
|
-
!*** ./src/client/components/live-region.jsx ***!
|
|
426
|
-
\***********************************************/
|
|
427
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
428
|
-
|
|
429
|
-
__webpack_require__.r(__webpack_exports__);
|
|
430
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
431
|
-
/* harmony export */ LiveRegion: () => (/* binding */ LiveRegion)
|
|
432
|
-
/* harmony export */ });
|
|
433
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
434
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
435
|
-
/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.debounce */ "lodash.debounce");
|
|
436
|
-
/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_1__);
|
|
437
|
-
/* harmony import */ var _store_useApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../store/useApp */ "./src/client/store/useApp.js");
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
const LiveRegion = () => {
|
|
442
|
-
const {
|
|
443
|
-
agentStatus,
|
|
444
|
-
liveRegionText,
|
|
445
|
-
setLiveRegionText
|
|
446
|
-
} = (0,_store_useApp__WEBPACK_IMPORTED_MODULE_2__.useApp)();
|
|
447
|
-
const [textA, setTextA] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();
|
|
448
|
-
const [textB, setTextB] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();
|
|
449
|
-
const isSessionEnded = agentStatus === 'closed' || agentStatus === null;
|
|
450
|
-
const clearText = () => {
|
|
451
|
-
setTextA();
|
|
452
|
-
setTextB();
|
|
453
|
-
};
|
|
454
|
-
const setText = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(lodash_debounce__WEBPACK_IMPORTED_MODULE_1___default()(text => {
|
|
455
|
-
if (textA) {
|
|
456
|
-
setTextB(text);
|
|
457
|
-
} else {
|
|
458
|
-
setTextA(text);
|
|
459
|
-
}
|
|
460
|
-
}, 2000), [textA, textB]);
|
|
461
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
462
|
-
console.log('liveRegionText', liveRegionText);
|
|
463
|
-
if (liveRegionText) {
|
|
464
|
-
clearText();
|
|
465
|
-
setText(liveRegionText);
|
|
466
|
-
}
|
|
467
|
-
if (isSessionEnded) {
|
|
468
|
-
clearText();
|
|
469
|
-
setLiveRegionText();
|
|
470
|
-
}
|
|
471
|
-
return () => {
|
|
472
|
-
clearText();
|
|
473
|
-
setLiveRegionText();
|
|
474
|
-
};
|
|
475
|
-
}, [liveRegionText]);
|
|
476
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
477
|
-
className: "wc-live",
|
|
478
|
-
"aria-live": "polite",
|
|
479
|
-
"aria-atomic": "true"
|
|
480
|
-
}, textA), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
481
|
-
className: "wc-live",
|
|
482
|
-
"aria-live": "polite",
|
|
483
|
-
"aria-atomic": "true"
|
|
484
|
-
}, textB));
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
/***/ }),
|
|
488
|
-
|
|
489
385
|
/***/ "./src/client/components/message/message.jsx":
|
|
490
386
|
/*!***************************************************!*\
|
|
491
387
|
!*** ./src/client/components/message/message.jsx ***!
|
|
@@ -666,12 +562,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
666
562
|
/* harmony import */ var _screens_end_chat_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../screens/end-chat.jsx */ "./src/client/components/screens/end-chat.jsx");
|
|
667
563
|
/* harmony import */ var _screens_settings_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../screens/settings.jsx */ "./src/client/components/screens/settings.jsx");
|
|
668
564
|
/* harmony import */ var _screens_feedback_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../screens/feedback.jsx */ "./src/client/components/screens/feedback.jsx");
|
|
669
|
-
/* harmony import */ var
|
|
670
|
-
/* harmony import */ var
|
|
671
|
-
/* harmony import */ var
|
|
672
|
-
/* harmony import */ var
|
|
673
|
-
/* harmony import */ var _lib_history_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../lib/history.js */ "./src/client/lib/history.js");
|
|
674
|
-
|
|
565
|
+
/* harmony import */ var _store_useApp_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../store/useApp.js */ "./src/client/store/useApp.js");
|
|
566
|
+
/* harmony import */ var _store_useChatSdk_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../store/useChatSdk.js */ "./src/client/store/useChatSdk.js");
|
|
567
|
+
/* harmony import */ var _hooks_useFocusedElements_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../hooks/useFocusedElements.js */ "./src/client/hooks/useFocusedElements.js");
|
|
568
|
+
/* harmony import */ var _lib_history_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../lib/history.js */ "./src/client/lib/history.js");
|
|
675
569
|
|
|
676
570
|
|
|
677
571
|
|
|
@@ -700,13 +594,13 @@ function Panel() {
|
|
|
700
594
|
setUnseenCount,
|
|
701
595
|
isMobile,
|
|
702
596
|
isKeyboard
|
|
703
|
-
} = (0,
|
|
597
|
+
} = (0,_store_useApp_js__WEBPACK_IMPORTED_MODULE_10__.useApp)();
|
|
704
598
|
const {
|
|
705
599
|
fetchThread,
|
|
706
600
|
fetchMessages
|
|
707
|
-
} = (0,
|
|
601
|
+
} = (0,_store_useChatSdk_js__WEBPACK_IMPORTED_MODULE_11__.useChatSdk)(sdk);
|
|
708
602
|
const [screen, setScreen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(threadId ? 2 : 0);
|
|
709
|
-
(0,
|
|
603
|
+
(0,_hooks_useFocusedElements_js__WEBPACK_IMPORTED_MODULE_12__.useFocusedElements)(screen);
|
|
710
604
|
const onEscapeKey = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(e => {
|
|
711
605
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
712
606
|
if (threadId) {
|
|
@@ -714,7 +608,7 @@ function Panel() {
|
|
|
714
608
|
setUnseenCount(0);
|
|
715
609
|
}
|
|
716
610
|
setChatVisibility(false);
|
|
717
|
-
(0,
|
|
611
|
+
(0,_lib_history_js__WEBPACK_IMPORTED_MODULE_13__.historyReplaceState)();
|
|
718
612
|
document.getElementById(instigatorId)?.focus();
|
|
719
613
|
}
|
|
720
614
|
}, [thread, threadId, setUnseenCount, setChatVisibility]);
|
|
@@ -830,7 +724,7 @@ function Panel() {
|
|
|
830
724
|
"aria-labelledby": "wc-header-title"
|
|
831
725
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
832
726
|
className: "wc-panel__inner"
|
|
833
|
-
}, ScreenComponent)
|
|
727
|
+
}, ScreenComponent));
|
|
834
728
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(Component, document.body));
|
|
835
729
|
}
|
|
836
730
|
|
|
@@ -850,8 +744,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
850
744
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
851
745
|
/* harmony import */ var _panel_panel_header_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../panel/panel-header.jsx */ "./src/client/components/panel/panel-header.jsx");
|
|
852
746
|
/* harmony import */ var _store_useApp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../store/useApp.js */ "./src/client/store/useApp.js");
|
|
853
|
-
/* harmony import */ var _lib_history_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../lib/history.js */ "./src/client/lib/history.js");
|
|
854
|
-
|
|
855
747
|
|
|
856
748
|
|
|
857
749
|
|
|
@@ -865,11 +757,13 @@ function EndChat({
|
|
|
865
757
|
setMessages,
|
|
866
758
|
agentStatus,
|
|
867
759
|
thread,
|
|
760
|
+
threadId,
|
|
868
761
|
setUnseenCount,
|
|
869
762
|
isKeyboard
|
|
870
763
|
} = (0,_store_useApp_js__WEBPACK_IMPORTED_MODULE_2__.useApp)();
|
|
871
764
|
const confirmEndChat = async e => {
|
|
872
765
|
e.preventDefault();
|
|
766
|
+
window.localStorage.setItem('tmpThreadId', threadId);
|
|
873
767
|
setThreadId();
|
|
874
768
|
setMessages([]);
|
|
875
769
|
setCustomerId();
|
|
@@ -880,7 +774,6 @@ function EndChat({
|
|
|
880
774
|
if (agentStatus !== 'closed') {
|
|
881
775
|
thread.endChat();
|
|
882
776
|
}
|
|
883
|
-
(0,_lib_history_js__WEBPACK_IMPORTED_MODULE_3__.historyReplaceState)();
|
|
884
777
|
onEndChatConfirm(e);
|
|
885
778
|
};
|
|
886
779
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
@@ -893,7 +786,8 @@ function EndChat({
|
|
|
893
786
|
const handleKeyPress = e => {
|
|
894
787
|
if ((e.key === 'Enter' || e.key === ' ') && e.target.id === 'confirm-endchat') {
|
|
895
788
|
confirmEndChat(e);
|
|
896
|
-
}
|
|
789
|
+
}
|
|
790
|
+
if ((e.key === 'Enter' || e.key === ' ') && e.target.id === 'resume-chat') {
|
|
897
791
|
onChatScreen(e);
|
|
898
792
|
}
|
|
899
793
|
};
|
|
@@ -945,12 +839,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
945
839
|
function Feedback({
|
|
946
840
|
onCancel
|
|
947
841
|
}) {
|
|
948
|
-
const
|
|
842
|
+
const feedbackSend = e => {
|
|
843
|
+
const tmpThreadId = window.localStorage.getItem('tmpThreadId');
|
|
844
|
+
window.location.href = `https://defragroup.eu.qualtrics.com/jfe/form/SV_8dgFSJcxxIfqx5Y?Id=${tmpThreadId}&Source=${window.location.href}`;
|
|
845
|
+
window.localStorage.removeItem('tmpThreadId');
|
|
846
|
+
onCancel(e);
|
|
847
|
+
};
|
|
848
|
+
const feedbackClose = async e => {
|
|
949
849
|
onCancel(e);
|
|
950
850
|
};
|
|
951
851
|
const handleKeyPress = e => {
|
|
952
|
-
if (
|
|
953
|
-
|
|
852
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
853
|
+
if (e.target.id === 'feedback-close') {
|
|
854
|
+
feedbackClose(e);
|
|
855
|
+
}
|
|
856
|
+
if (e.target.id === 'feedback-send') {
|
|
857
|
+
feedbackSend(e);
|
|
858
|
+
}
|
|
954
859
|
}
|
|
955
860
|
};
|
|
956
861
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_panel_panel_header_jsx__WEBPACK_IMPORTED_MODULE_1__.PanelHeader, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
@@ -961,18 +866,21 @@ function Feedback({
|
|
|
961
866
|
id: "wc-subtitle",
|
|
962
867
|
className: "wc-heading"
|
|
963
868
|
}, "Give Feedback on Floodline webchat"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "Please note we\u2019re unable to respond to feedback."), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
869
|
+
id: "feedback-send",
|
|
964
870
|
className: "govuk-link",
|
|
965
871
|
href: "#",
|
|
966
872
|
target: "_blank",
|
|
967
|
-
rel: "noreferrer"
|
|
968
|
-
|
|
969
|
-
|
|
873
|
+
rel: "noreferrer",
|
|
874
|
+
onKeyDown: handleKeyPress,
|
|
875
|
+
onClick: feedbackSend
|
|
876
|
+
}, "Leave Feedback")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
877
|
+
id: "feedback-close",
|
|
970
878
|
className: "wc-link govuk-link",
|
|
971
879
|
href: "#",
|
|
972
880
|
"data-module": "govuk-button",
|
|
973
881
|
role: "button",
|
|
974
882
|
onKeyDown: handleKeyPress,
|
|
975
|
-
onClick:
|
|
883
|
+
onClick: feedbackClose
|
|
976
884
|
}, "Close")))));
|
|
977
885
|
}
|
|
978
886
|
|
|
@@ -1099,6 +1007,9 @@ function RequestChat({
|
|
|
1099
1007
|
const buttonLabel = isButtonDisabled ? 'Requesting...' : 'Request Chat';
|
|
1100
1008
|
const onRequestChat = async e => {
|
|
1101
1009
|
e.preventDefault();
|
|
1010
|
+
if (isButtonDisabled) {
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1102
1013
|
const errs = {};
|
|
1103
1014
|
if (nameRef.current.value.length === 0) {
|
|
1104
1015
|
errs.name = 'Enter your name';
|
|
@@ -1199,7 +1110,7 @@ function RequestChat({
|
|
|
1199
1110
|
className: "wc-button govuk-button govuk-!-margin-top-1",
|
|
1200
1111
|
"data-module": "govuk-button",
|
|
1201
1112
|
onClick: onRequestChat,
|
|
1202
|
-
disabled: isButtonDisabled
|
|
1113
|
+
"aria-disabled": isButtonDisabled
|
|
1203
1114
|
}, buttonLabel)))));
|
|
1204
1115
|
}
|
|
1205
1116
|
|
|
@@ -1364,10 +1275,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1364
1275
|
|
|
1365
1276
|
const SkipLink = () => {
|
|
1366
1277
|
const {
|
|
1367
|
-
|
|
1278
|
+
threadId,
|
|
1368
1279
|
setInstigatorId
|
|
1369
1280
|
} = (0,_store_useApp__WEBPACK_IMPORTED_MODULE_2__.useApp)();
|
|
1370
|
-
if (!
|
|
1281
|
+
if (!threadId) {
|
|
1371
1282
|
return null;
|
|
1372
1283
|
}
|
|
1373
1284
|
const targetContainer = document.getElementById('skip-links');
|
|
@@ -1503,20 +1414,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1503
1414
|
/* harmony export */ agentStatusHeadline: () => (/* binding */ agentStatusHeadline)
|
|
1504
1415
|
/* harmony export */ });
|
|
1505
1416
|
const agentStatusHeadline = (availability, agentStatus, agentName) => {
|
|
1506
|
-
let connectionHeadlineText = 'Connecting to Floodline';
|
|
1507
|
-
if (agentStatus === 'closed') {
|
|
1508
|
-
connectionHeadlineText = agentName ? `${agentName} ended the session` : 'Session ended by advisor';
|
|
1509
|
-
} else if (agentStatus) {
|
|
1510
|
-
if (agentName) {
|
|
1511
|
-
connectionHeadlineText = `You are speaking with ${agentName}`;
|
|
1512
|
-
} else {
|
|
1513
|
-
connectionHeadlineText = 'No advisers currently available';
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
1417
|
if (availability === 'UNAVAILABLE') {
|
|
1517
|
-
|
|
1418
|
+
return 'Webchat is not currently available';
|
|
1419
|
+
}
|
|
1420
|
+
if (!agentStatus) {
|
|
1421
|
+
return 'Connecting to Floodline';
|
|
1422
|
+
}
|
|
1423
|
+
switch (agentStatus) {
|
|
1424
|
+
case 'closed':
|
|
1425
|
+
case 'resolved':
|
|
1426
|
+
return agentName ? `${agentName} ended the session` : 'Session ended by advisor';
|
|
1427
|
+
default:
|
|
1428
|
+
return agentName ? `You are speaking with ${agentName}` : 'No advisers currently available';
|
|
1518
1429
|
}
|
|
1519
|
-
return connectionHeadlineText;
|
|
1520
1430
|
};
|
|
1521
1431
|
|
|
1522
1432
|
/***/ }),
|
|
@@ -1728,7 +1638,7 @@ const AppProvider = ({
|
|
|
1728
1638
|
payload: e.detail.data.case.status
|
|
1729
1639
|
});
|
|
1730
1640
|
};
|
|
1731
|
-
const onAgentTypingStarted =
|
|
1641
|
+
const onAgentTypingStarted = () => {
|
|
1732
1642
|
dispatch({
|
|
1733
1643
|
type: 'SET_AGENT_TYPING',
|
|
1734
1644
|
payload: true
|
|
@@ -1739,9 +1649,6 @@ const AppProvider = ({
|
|
|
1739
1649
|
type: 'SET_AGENT_TYPING',
|
|
1740
1650
|
payload: false
|
|
1741
1651
|
});
|
|
1742
|
-
dispatch({
|
|
1743
|
-
type: 'SET_LIVE_REGION_TEXT'
|
|
1744
|
-
});
|
|
1745
1652
|
};
|
|
1746
1653
|
const onMessageCreated = e => {
|
|
1747
1654
|
dispatch({
|
|
@@ -1887,12 +1794,6 @@ const AppProvider = ({
|
|
|
1887
1794
|
payload: id
|
|
1888
1795
|
});
|
|
1889
1796
|
};
|
|
1890
|
-
const setLiveRegionText = text => {
|
|
1891
|
-
dispatch({
|
|
1892
|
-
type: 'SET_LIVE_REGION_TEXT',
|
|
1893
|
-
payload: text
|
|
1894
|
-
});
|
|
1895
|
-
};
|
|
1896
1797
|
|
|
1897
1798
|
/**
|
|
1898
1799
|
* Application-wide state and state functions
|
|
@@ -1908,7 +1809,6 @@ const AppProvider = ({
|
|
|
1908
1809
|
setUnseenCount,
|
|
1909
1810
|
setChatVisibility,
|
|
1910
1811
|
setInstigatorId,
|
|
1911
|
-
setLiveRegionText,
|
|
1912
1812
|
onLiveChatRecovered,
|
|
1913
1813
|
onAssignedAgentChanged,
|
|
1914
1814
|
onAgentTypingStarted,
|
|
@@ -1988,17 +1888,16 @@ const setThread = (state, payload) => {
|
|
|
1988
1888
|
thread: payload
|
|
1989
1889
|
};
|
|
1990
1890
|
};
|
|
1991
|
-
const
|
|
1891
|
+
const setMessage = (state, payload) => {
|
|
1992
1892
|
return {
|
|
1993
1893
|
...state,
|
|
1994
|
-
messages: (0,_lib_transform_messages__WEBPACK_IMPORTED_MODULE_0__.
|
|
1894
|
+
messages: [...state.messages, (0,_lib_transform_messages__WEBPACK_IMPORTED_MODULE_0__.transformMessage)(payload)]
|
|
1995
1895
|
};
|
|
1996
1896
|
};
|
|
1997
|
-
const
|
|
1897
|
+
const setMessages = (state, payload) => {
|
|
1998
1898
|
return {
|
|
1999
1899
|
...state,
|
|
2000
|
-
|
|
2001
|
-
messages: [...state.messages, (0,_lib_transform_messages__WEBPACK_IMPORTED_MODULE_0__.transformMessage)(payload)]
|
|
1900
|
+
messages: (0,_lib_transform_messages__WEBPACK_IMPORTED_MODULE_0__.transformMessages)(payload).reverse()
|
|
2002
1901
|
};
|
|
2003
1902
|
};
|
|
2004
1903
|
const setAgent = (state, payload) => {
|
|
@@ -2031,12 +1930,6 @@ const setInstigatorId = (state, payload) => {
|
|
|
2031
1930
|
instigatorId: payload
|
|
2032
1931
|
};
|
|
2033
1932
|
};
|
|
2034
|
-
const setLiveRegionText = (state, payload) => {
|
|
2035
|
-
return {
|
|
2036
|
-
...state,
|
|
2037
|
-
liveRegionText: payload
|
|
2038
|
-
};
|
|
2039
|
-
};
|
|
2040
1933
|
const toggleIsMobile = (state, payload) => {
|
|
2041
1934
|
return {
|
|
2042
1935
|
...state,
|
|
@@ -2063,7 +1956,6 @@ const actionsMap = {
|
|
|
2063
1956
|
SET_AGENT_STATUS: setAgentStatus,
|
|
2064
1957
|
SET_UNSEEN_COUNT: setUnseenCount,
|
|
2065
1958
|
SET_INSTIGATOR_ID: setInstigatorId,
|
|
2066
|
-
SET_LIVE_REGION_TEXT: setLiveRegionText,
|
|
2067
1959
|
TOGGLE_IS_MOBILE: toggleIsMobile,
|
|
2068
1960
|
TOGGLE_IS_KEYBOARD: toggleIsKeyboard
|
|
2069
1961
|
};
|
|
@@ -2210,16 +2102,6 @@ module.exports = require("@nice-devone/nice-cxone-chat-web-sdk");
|
|
|
2210
2102
|
|
|
2211
2103
|
/***/ }),
|
|
2212
2104
|
|
|
2213
|
-
/***/ "lodash.debounce":
|
|
2214
|
-
/*!**********************************!*\
|
|
2215
|
-
!*** external "lodash.debounce" ***!
|
|
2216
|
-
\**********************************/
|
|
2217
|
-
/***/ ((module) => {
|
|
2218
|
-
|
|
2219
|
-
module.exports = require("lodash.debounce");
|
|
2220
|
-
|
|
2221
|
-
/***/ }),
|
|
2222
|
-
|
|
2223
2105
|
/***/ "luxon":
|
|
2224
2106
|
/*!************************!*\
|
|
2225
2107
|
!*** external "luxon" ***!
|