-
Notifications
You must be signed in to change notification settings - Fork 70
feat(station-login): e911 Modal on Desktop Station Login #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brain-frog
wants to merge
15
commits into
webex:next
Choose a base branch
from
brain-frog:CAI-7905
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ca80cee
feat(station-login): add E911 emergency service notification modal
2f023d3
refactor(cc-components): rename E911Modal to lowercase and simplify e…
5e205c1
fix(cc-components): update E911Modal test import path
440fa9a
fix(e911-modal): address Codex review feedback
f0d949d
fix(e911-modal): address remaining PR #719 review feedback
419bdb6
feat(e911-modal): finalize modal integration, dismissal, and triggers
94c8372
docs(station-login-spec): add E911 modal requirements (spec-currency)
348060a
fix(store): reset E911 modal state on logout
1a5c5d4
fix(station-login): make checkE911ModalDisplay single-flight
d221975
fix(store): handle missing user-preference record for first-time E911…
0508bbc
fix(store): read desktopPreference from the correct SDK response shape
6d2ef4c
fix(store): use CI user id, not CC agentId, when creating a new user-…
c9c37aa
fix(station-login): reclaim E911Modal ownership when the owning insta…
27d5441
fix(station-login): make E911 in-flight check dedup module-scoped ins…
d3cda12
merge: resolve conflicts with upstream/next (SDK bump to 3.12.0-next.82)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ontact-center/cc-components/src/components/StationLogin/E911Modal/e911-modal.constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export const E911ModalLabels = { | ||
| TITLE: 'Emergency Service Notification', | ||
| WARNING_TITLE: 'Important', | ||
| WARNING_MESSAGE: | ||
| 'If your address has changed, update it in the Emergency Callback Number (ECBN) section of your profile before making any calls.', | ||
| HELP_LINK_TEXT: 'See help section', | ||
| DIALING_TITLE: 'Dialing Emergency Services', | ||
| DIALING_MESSAGE: | ||
| 'When you dial an emergency number (e.g., 911), your call will be routed to the appropriate emergency services based on your registered address. Ensure your address is always up to date to receive timely assistance.', | ||
| CHECKBOX_LABEL: 'I have read the notification', | ||
| CANCEL: 'Cancel', | ||
| SAVE_AND_CONTINUE: 'Save & Continue', | ||
| }; |
103 changes: 103 additions & 0 deletions
103
.../contact-center/cc-components/src/components/StationLogin/E911Modal/e911-modal.style.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| .e911-modal { | ||
| padding: 0; | ||
| border: none; | ||
| border-radius: 8px; | ||
| box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); | ||
| max-width: 480px; | ||
| width: 90%; | ||
|
|
||
| &::backdrop { | ||
| background-color: rgba(0, 0, 0, 0.5); | ||
| } | ||
|
|
||
| .e911-modal-content { | ||
| padding: 24px; | ||
| } | ||
|
|
||
| .e911-modal-header { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| margin-bottom: 16px; | ||
|
|
||
| .e911-modal-title { | ||
| margin: 0; | ||
| font-size: 18px; | ||
| font-weight: 600; | ||
| } | ||
|
|
||
| .e911-close-button { | ||
| background: none; | ||
| border: none; | ||
| cursor: pointer; | ||
| padding: 4px; | ||
| } | ||
| } | ||
|
|
||
| .e911-warning-box { | ||
| background-color: #fff3cd; | ||
| border: 1px solid #ffc107; | ||
| border-radius: 4px; | ||
| padding: 12px; | ||
| margin-bottom: 16px; | ||
|
|
||
| .e911-warning-title { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| margin-bottom: 8px; | ||
| font-weight: 600; | ||
| color: #856404; | ||
| } | ||
|
|
||
| .e911-warning-message { | ||
| color: #856404; | ||
| font-size: 14px; | ||
| line-height: 1.5; | ||
| } | ||
|
|
||
| .e911-help-link { | ||
| color: #0056b3; | ||
| text-decoration: underline; | ||
| cursor: pointer; | ||
| font-size: 14px; | ||
| margin-top: 8px; | ||
| display: inline-block; | ||
| } | ||
| } | ||
|
|
||
| .e911-dialing-section { | ||
| margin-bottom: 20px; | ||
|
|
||
| .e911-dialing-title { | ||
| font-weight: 600; | ||
| margin-bottom: 8px; | ||
| } | ||
|
|
||
| .e911-dialing-message { | ||
| font-size: 14px; | ||
| line-height: 1.5; | ||
| color: #666; | ||
| } | ||
| } | ||
|
|
||
| .e911-checkbox-container { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| margin-bottom: 20px; | ||
|
|
||
| .e911-checkbox-label { | ||
| font-size: 14px; | ||
| cursor: pointer; | ||
| } | ||
| } | ||
|
|
||
| .e911-modal-footer { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| gap: 12px; | ||
| padding-top: 16px; | ||
| border-top: 1px solid #e0e0e0; | ||
| } | ||
| } | ||
121 changes: 121 additions & 0 deletions
121
packages/contact-center/cc-components/src/components/StationLogin/E911Modal/e911-modal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| import React, {useRef, useEffect, useState} from 'react'; | ||
| import {Button, Text, Icon, Checkbox} from '@momentum-design/components/dist/react'; | ||
| import {E911ModalProps} from './e911-modal.types'; | ||
| import {E911ModalLabels} from './e911-modal.constants'; | ||
| import './e911-modal.style.scss'; | ||
|
|
||
| const E911Modal: React.FC<E911ModalProps> = ({isOpen, onSaveAndContinue, onCancel}) => { | ||
| const dialogRef = useRef<HTMLDialogElement>(null); | ||
| const [isChecked, setIsChecked] = useState(false); | ||
|
|
||
| const handleCheckboxChange = () => { | ||
| setIsChecked(!isChecked); | ||
| }; | ||
|
|
||
| const handleCancel = () => { | ||
| setIsChecked(false); | ||
| onCancel(); | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| const dialog = dialogRef.current; | ||
| if (!dialog) return; | ||
|
|
||
| if (isOpen) { | ||
| if (!dialog.open) { | ||
| dialog.showModal(); | ||
| } | ||
| } else { | ||
| if (dialog.open) { | ||
| dialog.close(); | ||
| } | ||
| setIsChecked(false); | ||
| } | ||
|
|
||
| const handleNativeCancel = (event: Event) => { | ||
| event.preventDefault(); | ||
| handleCancel(); | ||
| }; | ||
|
|
||
| dialog.addEventListener('cancel', handleNativeCancel); | ||
|
|
||
| return () => { | ||
| dialog.removeEventListener('cancel', handleNativeCancel); | ||
| }; | ||
| }, [isOpen, onCancel]); | ||
|
|
||
| const handleSaveAndContinue = () => { | ||
| if (isChecked) { | ||
| onSaveAndContinue(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <dialog ref={dialogRef} className="e911-modal" data-testid="e911-modal"> | ||
|
brain-frog marked this conversation as resolved.
Outdated
brain-frog marked this conversation as resolved.
Outdated
|
||
| <div className="e911-modal-content"> | ||
| <div className="e911-modal-header"> | ||
| <Text tagname="h2" type="body-large-bold" className="e911-modal-title"> | ||
| {E911ModalLabels.TITLE} | ||
| </Text> | ||
| <Button | ||
| size={32} | ||
| variant="tertiary" | ||
| color="default" | ||
| prefix-icon="cancel-bold" | ||
| type="button" | ||
| role="button" | ||
| aria-label="Close" | ||
| onClick={handleCancel} | ||
| className="e911-close-button" | ||
| data-testid="e911-close-button" | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="e911-warning-box"> | ||
| <div className="e911-warning-title"> | ||
| <Icon name="warning-filled" size={1} /> | ||
| <Text tagname="span" type="body-midsize-bold"> | ||
| {E911ModalLabels.WARNING_TITLE} | ||
| </Text> | ||
| </div> | ||
| <Text tagname="p" type="body-midsize-regular" className="e911-warning-message"> | ||
| {E911ModalLabels.WARNING_MESSAGE} | ||
| </Text> | ||
| <a href="#" className="e911-help-link" data-testid="e911-help-link"> | ||
|
brain-frog marked this conversation as resolved.
Outdated
|
||
| {E911ModalLabels.HELP_LINK_TEXT} | ||
| </a> | ||
| </div> | ||
|
|
||
| <div className="e911-dialing-section"> | ||
| <Text tagname="h3" type="body-midsize-bold" className="e911-dialing-title"> | ||
| {E911ModalLabels.DIALING_TITLE} | ||
| </Text> | ||
| <Text tagname="p" type="body-midsize-regular" className="e911-dialing-message"> | ||
| {E911ModalLabels.DIALING_MESSAGE} | ||
| </Text> | ||
| </div> | ||
|
|
||
| <div className="e911-checkbox-container"> | ||
| <Checkbox | ||
| data-testid="e911-checkbox" | ||
| checked={isChecked} | ||
| // @ts-expect-error: TODO: https://github.com/momentum-design/momentum-design/pull/1118 | ||
| onchange={handleCheckboxChange} | ||
| label={E911ModalLabels.CHECKBOX_LABEL} | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="e911-modal-footer"> | ||
| <Button variant="secondary" onClick={handleCancel} data-testid="e911-cancel-button" className="white-button"> | ||
| {E911ModalLabels.CANCEL} | ||
| </Button> | ||
| <Button onClick={handleSaveAndContinue} disabled={!isChecked} data-testid="e911-save-button"> | ||
| {E911ModalLabels.SAVE_AND_CONTINUE} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| </dialog> | ||
| ); | ||
| }; | ||
|
|
||
| export default E911Modal; | ||
5 changes: 5 additions & 0 deletions
5
...es/contact-center/cc-components/src/components/StationLogin/E911Modal/e911-modal.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface E911ModalProps { | ||
| isOpen: boolean; | ||
| onSaveAndContinue: () => void; | ||
| onCancel: () => void; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.