@defra/flood-webchat 0.0.1-beta.22 → 0.0.1-beta.24

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.
@@ -7,12 +7,10 @@ import { Chat } from '../chat/chat.jsx'
7
7
  import { Unavailable } from '../screens/unavailable.jsx'
8
8
  import { EndChat } from '../screens/end-chat.jsx'
9
9
  import { Settings } from '../screens/settings.jsx'
10
- import { Feedback } from '../screens/feedback.jsx'
11
10
 
12
11
  import { useApp } from '../../store/useApp.js'
13
12
  import { useChatSdk } from '../../store/useChatSdk.js'
14
13
  import { useFocusedElements } from '../../hooks/useFocusedElements.js'
15
- import { EndFeedback } from '../screens/end-feedback.jsx'
16
14
 
17
15
  export function Panel () {
18
16
  const { sdk, availability, thread, threadId, setThread, setThreadId, setChatVisibility, setMessages, setUnseenCount } = useApp()
@@ -66,10 +64,6 @@ export function Panel () {
66
64
 
67
65
  const onEscapeKey = useCallback(e => {
68
66
  if (e.key === 'Escape' || e.key === 'Esc') {
69
- if (thread) {
70
- thread.lastMessageSeen()
71
- setUnseenCount(0)
72
- }
73
67
  setChatVisibility(false)
74
68
  }
75
69
  }, [])
@@ -83,9 +77,7 @@ export function Panel () {
83
77
  const goToRequestChatScreen = handleScreenChange(1)
84
78
  const goToChatScreen = handleScreenChange(2)
85
79
  const goToEndChatScreen = handleScreenChange(3)
86
- const goToFeedbackScreen = handleScreenChange(4)
87
80
  const goToSettingsScreen = handleScreenChange(5)
88
- const goToEndFeedbackScreen = handleScreenChange(6)
89
81
 
90
82
  let ScreenComponent
91
83
 
@@ -100,17 +92,11 @@ export function Panel () {
100
92
  ScreenComponent = <Chat onSettingsScreen={goToSettingsScreen} onEndChatScreen={goToEndChatScreen} />
101
93
  break
102
94
  case 3:
103
- ScreenComponent = <EndChat onChatScreen={goToChatScreen} onEndChatConfirm={goToFeedbackScreen} />
104
- break
105
- case 4:
106
- ScreenComponent = <Feedback onCancel={() => setChatVisibility(false)} onConfirmSubmit={goToEndFeedbackScreen} />
95
+ ScreenComponent = <EndChat onChatScreen={goToChatScreen} />
107
96
  break
108
97
  case 5:
109
98
  ScreenComponent = <Settings onCancel={goToChatScreen} />
110
99
  break
111
- case 6:
112
- ScreenComponent = <EndFeedback onClose={() => setChatVisibility(false)} />
113
- break
114
100
  default:
115
101
  ScreenComponent = <PreChat onContinue={goToRequestChatScreen} />
116
102
  }
@@ -1,34 +1,14 @@
1
1
  import React from 'react'
2
2
  import { PanelHeader } from '../panel/panel-header.jsx'
3
- import { useApp } from '../../store/useApp.js'
4
-
5
- export function EndChat ({ onChatScreen, onEndChatConfirm }) {
6
- const { setCustomerId, setThreadId, setMessages, agentStatus, thread, setUnseenCount } = useApp()
7
-
8
- const confirmEndChat = async e => {
9
- e.preventDefault()
10
-
11
- setThreadId()
12
- setMessages([])
13
- setCustomerId()
14
- thread.lastMessageSeen()
15
- setUnseenCount(0)
16
-
17
- // End chat if still open
18
- if (agentStatus !== 'closed') {
19
- thread.endChat()
20
- }
21
-
22
- onEndChatConfirm(e)
23
- }
24
3
 
4
+ export function EndChat ({ onChatScreen }) {
25
5
  return (
26
6
  <>
27
7
  <PanelHeader />
28
8
  <div className='wc-body'>
29
9
  <h3 className='govuk-heading-s' aria-live='polite'>Are you sure you want to end the chat?</h3>
30
10
  <div className='govuk-button-group'>
31
- <a href='#' className='govuk-button govuk-!-font-size-16' data-module='govuk-button' id='confirmEndChat' onClick={confirmEndChat}>Yes, end chat</a>
11
+ <a href='#' className='govuk-button govuk-!-font-size-16' data-module='govuk-button'>Yes, end chat</a>
32
12
  <a href='#' className='govuk-link govuk-!-font-size-16' onClick={onChatScreen}>No, resume chat</a>
33
13
  </div>
34
14
  </div>
@@ -18,21 +18,17 @@ export function PreChat ({ onContinue }) {
18
18
  </ul>
19
19
 
20
20
  <p className='govuk-body-s'>
21
- {
22
- 'There are other ways to '
23
- }
21
+ There are other ways to&nbsp;
24
22
  <a className='govuk-link' href='https://www.gov.uk/sign-up-for-flood-warnings' target='_blank' rel='noreferrer'>
25
23
  sign up for flood warnings
26
24
  </a>
27
- {
28
- ' and '
29
- }
25
+ &nbsp;and&nbsp;
30
26
  <a className='govuk-link' href='https://www.fws.environment-agency.gov.uk/app/olr/login' target='_blank' rel='noreferrer'>
31
27
  manage your flood warnings account
32
28
  </a>.
33
29
  </p>
34
30
  <p className='govuk-body-s'>
35
- {'Do not use webchat to '}
31
+ Do not use webchat to&nbsp;
36
32
  <a
37
33
  className='govuk-link'
38
34
  href='https://www.gov.uk/report-flood-cause'
@@ -59,7 +59,6 @@ export function RequestChat ({ onPreChatScreen }) {
59
59
  setCustomerId(customerId)
60
60
  setThreadId(threadId)
61
61
  setThread(thread)
62
- thread.setCustomField('threadid', threadId)
63
62
  } catch (err) {
64
63
  console.log('[Request Chat Error]', err)
65
64
  }
@@ -143,8 +142,13 @@ export function RequestChat ({ onPreChatScreen }) {
143
142
  </div>
144
143
  </div>
145
144
 
145
+ <div className='govuk-inset-text govuk-!-font-size-16'>
146
+ By selecting 'Request chat' you agree to the terms of our&nbsp;
147
+ <a href='https://check-for-flooding.service.gov.uk/privacy-notice' target='_blank' rel='noreferrer' className='govuk-link'>privacy notice</a>.
148
+ </div>
149
+
146
150
  <button
147
- className='govuk-button govuk-!-margin-top-1 govuk-!-font-size-16'
151
+ className='govuk-button govuk-!-margin-bottom-3 govuk-!-font-size-16'
148
152
  data-module='govuk-button'
149
153
  onClick={onRequestChat}
150
154
  >
@@ -52,7 +52,6 @@ export const AppProvider = ({ sdk, availability, options, children }) => {
52
52
  }
53
53
 
54
54
  useEffect(() => {
55
- sdk.onChatEvent('SetConsumerContactCustomFields', () => { console.log('Custom field set') })
56
55
  sdk.onChatEvent(ChatEvent.LIVECHAT_RECOVERED, onLiveChatRecovered)
57
56
  sdk.onChatEvent(ChatEvent.MESSAGE_CREATED, onMessageCreated)
58
57
  sdk.onChatEvent(ChatEvent.AGENT_TYPING_STARTED, onAgentTypingStarted)
@@ -1,18 +0,0 @@
1
- import React from 'react'
2
- import { PanelHeader } from '../panel/panel-header.jsx'
3
-
4
- export function EndFeedback ({ onClose }) {
5
- return (
6
- <>
7
- <PanelHeader />
8
-
9
- <div className='wc-body'>
10
- <h3 id='wc-subtitle' class='govuk-heading-m'>Thank you for your feedback</h3>
11
- <div>
12
- <a href='#' role='button' draggable='false' data-module='govuk-button' data-wc-focus-visible data-wc-close-btn onClick={onClose}>Close window</a>
13
- </div>
14
- </div>
15
-
16
- </>
17
- )
18
- }
@@ -1,154 +0,0 @@
1
- import React from 'react'
2
- import { PanelHeader } from '../panel/panel-header.jsx'
3
-
4
- export function Feedback ({ onCancel, onConfirmSubmit }) {
5
- const feedbackSubmit = async e => {
6
- e.preventDefault()
7
-
8
- onConfirmSubmit(e)
9
- }
10
-
11
- const onCancelFeedback = (e) => {
12
- e.preventDefault()
13
-
14
- onCancel()
15
- }
16
-
17
- return (
18
- <>
19
- <PanelHeader />
20
-
21
- <div className='wc-body'>
22
- <h3 id='wc-subtitle' className='govuk-heading-s'>Give Feedback on Floodline webchat</h3>
23
- <p>Please note we’re unable to respond to feedback.</p>
24
- <div className='govuk-form-group'>
25
- <fieldset className='govuk-fieldset govuk-!-margin-bottom-4'>
26
- <legend className='govuk-fieldset-heading govuk-fieldset__legend'>
27
- Overall, how did you feel about webchat?
28
- </legend>
29
- <div className='govuk-radios govuk-radios--small' data-module='govuk-radios'>
30
- <div className='govuk-radios__item'>
31
- <input
32
- id='very-satisfied'
33
- name='satisfaction'
34
- type='radio'
35
- className='govuk-radios__input'
36
- value='Very satisfied'
37
- />
38
-
39
- <label className='govuk-label govuk-radios__label' for='very-satisfied'>Very satisfied</label>
40
- </div>
41
- <div className='govuk-radios__item'>
42
- <input
43
- id='satisfied'
44
- name='satisfaction'
45
- type='radio'
46
- className='govuk-radios__input'
47
- value='Satisfied'
48
- />
49
-
50
- <label className='govuk-label govuk-radios__label' for='satisfied'>Satisfied</label>
51
- </div>
52
- <div className='govuk-radios__item'>
53
- <input
54
- id='no-opinion'
55
- name='satisfaction'
56
- type='radio'
57
- className='govuk-radios__input'
58
- value='No opinion'
59
- />
60
-
61
- <label className='govuk-label govuk-radios__label' for='no-opinion'>No Opinion</label>
62
- </div>
63
- <div className='govuk-radios__item'>
64
- <input
65
- id='dissatisfied'
66
- name='satisfaction'
67
- type='radio'
68
- className='govuk-radios__input'
69
- value='Dissatisfied'
70
- />
71
-
72
- <label className='govuk-label govuk-radios__label' for='dissatisfied'>Dissatisfied</label>
73
- </div>
74
- <div className='govuk-radios__item'>
75
- <input
76
- id='very-dissatisfied'
77
- name='satisfaction'
78
- type='radio'
79
- className='govuk-radios__input'
80
- value='Very dissatisfied'
81
- />
82
-
83
- <label className='govuk-label govuk-radios__label' for='very-dissatisfied'>Very dissatisfied</label>
84
- </div>
85
- </div>
86
- </fieldset>
87
-
88
- <fieldset className='govuk-fieldset govuk-!-margin-bottom-4'>
89
- <legend className='govuk-fieldset__legend'>
90
- Did the adviser answer your question?
91
- </legend>
92
- <div className='govuk-radios govuk-radios--small' data-module='govuk-radios'>
93
- <div className='govuk-radios__item'>
94
- <input
95
- id='answer-yes'
96
- name='answer'
97
- type='radio'
98
- className='govuk-radios__input'
99
- value='Yes'
100
- />
101
-
102
- <label className='govuk-label govuk-radios__label' for='answer-yes'>Yes</label>
103
- </div>
104
- <div className='govuk-radios__item'>
105
- <input
106
- id='answer-no'
107
- name='answer'
108
- type='radio'
109
- className='govuk-radios__input'
110
- value='No'
111
- />
112
-
113
- <label className='govuk-label govuk-radios__label' for='answer-no'>No</label>
114
- </div>
115
- <div className='govuk-radios__item'>
116
- <input
117
- id='answer-partly'
118
- name='answer'
119
- type='radio'
120
- className='govuk-radios__input'
121
- value='Partly'
122
- />
123
-
124
- <label className='govuk-label govuk-radios__label' for='answer-partly'>Partly</label>
125
- </div>
126
- </div>
127
- </fieldset>
128
-
129
- </div>
130
- <div className='govuk-form-group'>
131
- <label className='govuk-label' for='improvements'>
132
- How can we improve webchat? (optional)
133
- </label>
134
- <textarea className='govuk-textarea govuk-!-margin-bottom-4' id='improvements' name='improvements' rows='5' />
135
- </div>
136
-
137
- <div className='govuk-form-group'>
138
- <label className='wc-fieldset-heading govuk-label' for='research'>
139
- Tell us your email address if you want to take part in user research (optional)
140
- </label>
141
- <div id='research-hint' class='wc-hint govuk-hint'>
142
- We will not share your email address or use it for anything else. We’ll delete it after 2 years.
143
- </div>
144
- <input className='govuk-input govuk-!-margin-bottom-4' id='research' name='research' aria-describedby='research-hint' type='text' />
145
- </div>
146
-
147
- <div className='govuk-button-group'>
148
- <a id='feedback-save' href='#' className='govuk-button govuk-!-font-size-16' data-module='govuk-button' onClick={feedbackSubmit}>Submit</a>
149
- <a id='feedback-cancel' href='#' className='govuk-link govuk-!-font-size-16' data-module='govuk-button' onClick={onCancelFeedback}>Cancel</a>
150
- </div>
151
- </div>
152
- </>
153
- )
154
- }