@memori.ai/memori-react 8.45.6 → 8.46.0
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/CHANGELOG.md +7 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +27 -29
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +27 -29
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +0 -78
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +0 -39
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +0 -43
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +0 -1
- package/dist/components/ContentPreviewModal/DocumentMarkdown.d.ts +0 -7
- package/dist/components/ContentPreviewModal/DocumentMarkdown.js +0 -31
- package/dist/components/ContentPreviewModal/DocumentMarkdown.js.map +0 -1
- package/dist/components/DrawerFooter/DrawerFooter.css +0 -62
- package/dist/components/DrawerFooter/DrawerFooter.d.ts +0 -12
- package/dist/components/DrawerFooter/DrawerFooter.js +0 -10
- package/dist/components/DrawerFooter/DrawerFooter.js.map +0 -1
- package/dist/components/IconButton/IconButton.css +0 -135
- package/dist/components/IconButton/IconButton.d.ts +0 -9
- package/dist/components/IconButton/IconButton.js +0 -36
- package/dist/components/IconButton/IconButton.js.map +0 -1
- package/dist/components/LoginModal/LoginModal.css +0 -270
- package/dist/components/LoginModal/LoginModal.d.ts +0 -19
- package/dist/components/LoginModal/LoginModal.js +0 -355
- package/dist/components/LoginModal/LoginModal.js.map +0 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.css +0 -540
- package/dist/components/MobileSessionPanel/MobileSessionPanel.d.ts +0 -65
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js +0 -254
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js.map +0 -1
- package/dist/components/PositionPopover/PositionPopover.css +0 -218
- package/dist/components/PositionPopover/PositionPopover.d.ts +0 -22
- package/dist/components/PositionPopover/PositionPopover.js +0 -208
- package/dist/components/PositionPopover/PositionPopover.js.map +0 -1
- package/dist/components/ReasoningBlock/ReasoningBlock.css +0 -156
- package/dist/components/ReasoningBlock/ReasoningBlock.d.ts +0 -7
- package/dist/components/ReasoningBlock/ReasoningBlock.js +0 -61
- package/dist/components/ReasoningBlock/ReasoningBlock.js.map +0 -1
- package/dist/components/SideDrawer/SideDrawer.css +0 -112
- package/dist/components/SideDrawer/SideDrawer.d.ts +0 -22
- package/dist/components/SideDrawer/SideDrawer.js +0 -17
- package/dist/components/SideDrawer/SideDrawer.js.map +0 -1
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +0 -4
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +0 -144
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +0 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +0 -889
- package/dist/components/layouts/fullpage.css +0 -628
- package/dist/helpers/artifactPanel.d.ts +0 -6
- package/dist/helpers/artifactPanel.js +0 -42
- package/dist/helpers/artifactPanel.js.map +0 -1
- package/dist/helpers/chatScroll.d.ts +0 -12
- package/dist/helpers/chatScroll.js +0 -14
- package/dist/helpers/chatScroll.js.map +0 -1
- package/dist/helpers/conversationHistory.d.ts +0 -16
- package/dist/helpers/conversationHistory.js +0 -89
- package/dist/helpers/conversationHistory.js.map +0 -1
- package/dist/helpers/conversationTitle.d.ts +0 -8
- package/dist/helpers/conversationTitle.js +0 -27
- package/dist/helpers/conversationTitle.js.map +0 -1
- package/dist/helpers/enhanceBubbleCodeBlocks.d.ts +0 -5
- package/dist/helpers/enhanceBubbleCodeBlocks.js +0 -97
- package/dist/helpers/enhanceBubbleCodeBlocks.js.map +0 -1
- package/dist/helpers/highlightMatches.d.ts +0 -2
- package/dist/helpers/highlightMatches.js +0 -54
- package/dist/helpers/highlightMatches.js.map +0 -1
- package/dist/helpers/positionPopover.d.ts +0 -3
- package/dist/helpers/positionPopover.js +0 -22
- package/dist/helpers/positionPopover.js.map +0 -1
- package/dist/helpers/prism.d.ts +0 -16
- package/dist/helpers/prism.js +0 -78
- package/dist/helpers/prism.js.map +0 -1
- package/dist/helpers/reasoning.d.ts +0 -7
- package/dist/helpers/reasoning.js +0 -43
- package/dist/helpers/reasoning.js.map +0 -1
- package/dist/helpers/relativeTime.d.ts +0 -3
- package/dist/helpers/relativeTime.js +0 -56
- package/dist/helpers/relativeTime.js.map +0 -1
- package/dist/helpers/sourcesCount.d.ts +0 -2
- package/dist/helpers/sourcesCount.js +0 -22
- package/dist/helpers/sourcesCount.js.map +0 -1
- package/dist/helpers/tts/muteSpeaker.d.ts +0 -13
- package/dist/helpers/tts/muteSpeaker.js +0 -26
- package/dist/helpers/tts/muteSpeaker.js.map +0 -1
- package/dist/helpers/usePressTooltip.d.ts +0 -18
- package/dist/helpers/usePressTooltip.js +0 -38
- package/dist/helpers/usePressTooltip.js.map +0 -1
- package/dist/icons/FacebookIcon.d.ts +0 -3
- package/dist/icons/FacebookIcon.js +0 -6
- package/dist/icons/FacebookIcon.js.map +0 -1
- package/dist/icons/LinkedinIcon.d.ts +0 -3
- package/dist/icons/LinkedinIcon.js +0 -6
- package/dist/icons/LinkedinIcon.js.map +0 -1
- package/dist/icons/MemoriIcon.d.ts +0 -3
- package/dist/icons/MemoriIcon.js +0 -8
- package/dist/icons/MemoriIcon.js.map +0 -1
- package/dist/icons/TelegramIcon.d.ts +0 -3
- package/dist/icons/TelegramIcon.js +0 -6
- package/dist/icons/TelegramIcon.js.map +0 -1
- package/dist/icons/TwitterIcon.d.ts +0 -3
- package/dist/icons/TwitterIcon.js +0 -6
- package/dist/icons/TwitterIcon.js.map +0 -1
- package/dist/icons/WhatsappIcon.d.ts +0 -3
- package/dist/icons/WhatsappIcon.js +0 -6
- package/dist/icons/WhatsappIcon.js.map +0 -1
- package/dist/icons/artifacts/DocumentIcon.d.ts +0 -3
- package/dist/icons/artifacts/DocumentIcon.js +0 -6
- package/dist/icons/artifacts/DocumentIcon.js.map +0 -1
- package/dist/icons/artifacts/HtmlIcon.d.ts +0 -3
- package/dist/icons/artifacts/HtmlIcon.js +0 -6
- package/dist/icons/artifacts/HtmlIcon.js.map +0 -1
- package/dist/icons/artifacts/JavascriptIcon.d.ts +0 -3
- package/dist/icons/artifacts/JavascriptIcon.js +0 -6
- package/dist/icons/artifacts/JavascriptIcon.js.map +0 -1
- package/dist/icons/artifacts/MarkdownIcon.d.ts +0 -3
- package/dist/icons/artifacts/MarkdownIcon.js +0 -6
- package/dist/icons/artifacts/MarkdownIcon.js.map +0 -1
- package/dist/icons/artifacts/PythonIcon.d.ts +0 -3
- package/dist/icons/artifacts/PythonIcon.js +0 -6
- package/dist/icons/artifacts/PythonIcon.js.map +0 -1
- package/dist/icons/artifacts/SvgIcon.d.ts +0 -3
- package/dist/icons/artifacts/SvgIcon.js +0 -6
- package/dist/icons/artifacts/SvgIcon.js.map +0 -1
- package/dist/icons/artifacts/XmlIcon.d.ts +0 -3
- package/dist/icons/artifacts/XmlIcon.js +0 -6
- package/dist/icons/artifacts/XmlIcon.js.map +0 -1
- package/dist/icons/artifacts/cssIcon.d.ts +0 -3
- package/dist/icons/artifacts/cssIcon.js +0 -6
- package/dist/icons/artifacts/cssIcon.js.map +0 -1
- package/dist/styles/motion.css +0 -25
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +0 -78
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +0 -39
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +0 -40
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +0 -1
- package/esm/components/ContentPreviewModal/DocumentMarkdown.d.ts +0 -7
- package/esm/components/ContentPreviewModal/DocumentMarkdown.js +0 -28
- package/esm/components/ContentPreviewModal/DocumentMarkdown.js.map +0 -1
- package/esm/components/DrawerFooter/DrawerFooter.css +0 -62
- package/esm/components/DrawerFooter/DrawerFooter.d.ts +0 -12
- package/esm/components/DrawerFooter/DrawerFooter.js +0 -8
- package/esm/components/DrawerFooter/DrawerFooter.js.map +0 -1
- package/esm/components/IconButton/IconButton.css +0 -135
- package/esm/components/IconButton/IconButton.d.ts +0 -9
- package/esm/components/IconButton/IconButton.js +0 -33
- package/esm/components/IconButton/IconButton.js.map +0 -1
- package/esm/components/LoginModal/LoginModal.css +0 -270
- package/esm/components/LoginModal/LoginModal.d.ts +0 -19
- package/esm/components/LoginModal/LoginModal.js +0 -352
- package/esm/components/LoginModal/LoginModal.js.map +0 -1
- package/esm/components/MobileSessionPanel/MobileSessionPanel.css +0 -540
- package/esm/components/MobileSessionPanel/MobileSessionPanel.d.ts +0 -65
- package/esm/components/MobileSessionPanel/MobileSessionPanel.js +0 -251
- package/esm/components/MobileSessionPanel/MobileSessionPanel.js.map +0 -1
- package/esm/components/PositionPopover/PositionPopover.css +0 -218
- package/esm/components/PositionPopover/PositionPopover.d.ts +0 -22
- package/esm/components/PositionPopover/PositionPopover.js +0 -203
- package/esm/components/PositionPopover/PositionPopover.js.map +0 -1
- package/esm/components/ReasoningBlock/ReasoningBlock.css +0 -156
- package/esm/components/ReasoningBlock/ReasoningBlock.d.ts +0 -7
- package/esm/components/ReasoningBlock/ReasoningBlock.js +0 -58
- package/esm/components/ReasoningBlock/ReasoningBlock.js.map +0 -1
- package/esm/components/SideDrawer/SideDrawer.css +0 -112
- package/esm/components/SideDrawer/SideDrawer.d.ts +0 -22
- package/esm/components/SideDrawer/SideDrawer.js +0 -12
- package/esm/components/SideDrawer/SideDrawer.js.map +0 -1
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +0 -4
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js +0 -141
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +0 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +0 -889
- package/esm/components/layouts/fullpage.css +0 -628
- package/esm/helpers/artifactPanel.d.ts +0 -6
- package/esm/helpers/artifactPanel.js +0 -37
- package/esm/helpers/artifactPanel.js.map +0 -1
- package/esm/helpers/chatScroll.d.ts +0 -12
- package/esm/helpers/chatScroll.js +0 -9
- package/esm/helpers/chatScroll.js.map +0 -1
- package/esm/helpers/conversationHistory.d.ts +0 -16
- package/esm/helpers/conversationHistory.js +0 -82
- package/esm/helpers/conversationHistory.js.map +0 -1
- package/esm/helpers/conversationTitle.d.ts +0 -8
- package/esm/helpers/conversationTitle.js +0 -23
- package/esm/helpers/conversationTitle.js.map +0 -1
- package/esm/helpers/enhanceBubbleCodeBlocks.d.ts +0 -5
- package/esm/helpers/enhanceBubbleCodeBlocks.js +0 -94
- package/esm/helpers/enhanceBubbleCodeBlocks.js.map +0 -1
- package/esm/helpers/highlightMatches.d.ts +0 -2
- package/esm/helpers/highlightMatches.js +0 -49
- package/esm/helpers/highlightMatches.js.map +0 -1
- package/esm/helpers/positionPopover.d.ts +0 -3
- package/esm/helpers/positionPopover.js +0 -17
- package/esm/helpers/positionPopover.js.map +0 -1
- package/esm/helpers/prism.d.ts +0 -16
- package/esm/helpers/prism.js +0 -74
- package/esm/helpers/prism.js.map +0 -1
- package/esm/helpers/reasoning.d.ts +0 -7
- package/esm/helpers/reasoning.js +0 -39
- package/esm/helpers/reasoning.js.map +0 -1
- package/esm/helpers/relativeTime.d.ts +0 -3
- package/esm/helpers/relativeTime.js +0 -50
- package/esm/helpers/relativeTime.js.map +0 -1
- package/esm/helpers/sourcesCount.d.ts +0 -2
- package/esm/helpers/sourcesCount.js +0 -18
- package/esm/helpers/sourcesCount.js.map +0 -1
- package/esm/helpers/tts/muteSpeaker.d.ts +0 -13
- package/esm/helpers/tts/muteSpeaker.js +0 -21
- package/esm/helpers/tts/muteSpeaker.js.map +0 -1
- package/esm/helpers/usePressTooltip.d.ts +0 -18
- package/esm/helpers/usePressTooltip.js +0 -35
- package/esm/helpers/usePressTooltip.js.map +0 -1
- package/esm/icons/FacebookIcon.d.ts +0 -3
- package/esm/icons/FacebookIcon.js +0 -4
- package/esm/icons/FacebookIcon.js.map +0 -1
- package/esm/icons/LinkedinIcon.d.ts +0 -3
- package/esm/icons/LinkedinIcon.js +0 -4
- package/esm/icons/LinkedinIcon.js.map +0 -1
- package/esm/icons/MemoriIcon.d.ts +0 -3
- package/esm/icons/MemoriIcon.js +0 -6
- package/esm/icons/MemoriIcon.js.map +0 -1
- package/esm/icons/TelegramIcon.d.ts +0 -3
- package/esm/icons/TelegramIcon.js +0 -4
- package/esm/icons/TelegramIcon.js.map +0 -1
- package/esm/icons/TwitterIcon.d.ts +0 -3
- package/esm/icons/TwitterIcon.js +0 -4
- package/esm/icons/TwitterIcon.js.map +0 -1
- package/esm/icons/WhatsappIcon.d.ts +0 -3
- package/esm/icons/WhatsappIcon.js +0 -4
- package/esm/icons/WhatsappIcon.js.map +0 -1
- package/esm/icons/artifacts/DocumentIcon.d.ts +0 -3
- package/esm/icons/artifacts/DocumentIcon.js +0 -4
- package/esm/icons/artifacts/DocumentIcon.js.map +0 -1
- package/esm/icons/artifacts/HtmlIcon.d.ts +0 -3
- package/esm/icons/artifacts/HtmlIcon.js +0 -4
- package/esm/icons/artifacts/HtmlIcon.js.map +0 -1
- package/esm/icons/artifacts/JavascriptIcon.d.ts +0 -3
- package/esm/icons/artifacts/JavascriptIcon.js +0 -4
- package/esm/icons/artifacts/JavascriptIcon.js.map +0 -1
- package/esm/icons/artifacts/MarkdownIcon.d.ts +0 -3
- package/esm/icons/artifacts/MarkdownIcon.js +0 -4
- package/esm/icons/artifacts/MarkdownIcon.js.map +0 -1
- package/esm/icons/artifacts/PythonIcon.d.ts +0 -3
- package/esm/icons/artifacts/PythonIcon.js +0 -4
- package/esm/icons/artifacts/PythonIcon.js.map +0 -1
- package/esm/icons/artifacts/SvgIcon.d.ts +0 -3
- package/esm/icons/artifacts/SvgIcon.js +0 -4
- package/esm/icons/artifacts/SvgIcon.js.map +0 -1
- package/esm/icons/artifacts/XmlIcon.d.ts +0 -3
- package/esm/icons/artifacts/XmlIcon.js +0 -4
- package/esm/icons/artifacts/XmlIcon.js.map +0 -1
- package/esm/icons/artifacts/cssIcon.d.ts +0 -3
- package/esm/icons/artifacts/cssIcon.js +0 -4
- package/esm/icons/artifacts/cssIcon.js.map +0 -1
- package/esm/styles/motion.css +0 -25
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/* Login gate modal — content-sized, radii: control 12 / box 20 / modal 28 */
|
|
2
|
-
|
|
3
|
-
.memori--login-modal.memori-modal,
|
|
4
|
-
.memori--login-modal {
|
|
5
|
-
--memori-login-modal-radius: var(--memori-radius-overlay, 1.75rem);
|
|
6
|
-
--memori-login-control-radius: var(--memori-radius-control, 0.75rem);
|
|
7
|
-
--memori-login-box-radius: var(--memori-radius-surface, 1.25rem);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.memori--login-modal--content,
|
|
11
|
-
.memori--login-modal .memori-modal__popup {
|
|
12
|
-
max-width: min(420px, calc(100vw - 2rem));
|
|
13
|
-
padding: 1.5rem 1.5rem 1.25rem;
|
|
14
|
-
border-radius: var(--memori-login-modal-radius) !important;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.memori--login-modal .memori-modal__content {
|
|
18
|
-
overflow: visible;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.memori--login-modal--missing.memori--login-modal .memori-modal__popup {
|
|
22
|
-
display: flex;
|
|
23
|
-
max-width: min(480px, calc(100vw - 2rem));
|
|
24
|
-
max-height: min(90vh, 40rem);
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.memori--login-modal--missing .memori-modal__content {
|
|
29
|
-
display: flex;
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
min-height: 0;
|
|
32
|
-
max-height: none;
|
|
33
|
-
flex: 1 1 auto;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.memori--login-modal--title,
|
|
38
|
-
.memori--login-modal .memori-modal__title {
|
|
39
|
-
margin: 0;
|
|
40
|
-
color: var(--memori-text-color, #1a1a2e);
|
|
41
|
-
font-size: 1.625rem;
|
|
42
|
-
font-weight: var(--memori-text-weight-bold, 700);
|
|
43
|
-
line-height: 1.25;
|
|
44
|
-
text-align: left;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.memori--login-modal--step {
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
margin-top: 0.25rem;
|
|
51
|
-
gap: 1rem;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.memori--login-modal--benefit,
|
|
55
|
-
.memori--login-modal--sent-copy,
|
|
56
|
-
.memori--login-modal--footnote,
|
|
57
|
-
.memori--login-modal--resend {
|
|
58
|
-
margin: 0;
|
|
59
|
-
color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 35%);
|
|
60
|
-
font-size: 0.9375rem;
|
|
61
|
-
line-height: 1.45;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.memori--login-modal--footnote,
|
|
65
|
-
.memori--login-modal--resend {
|
|
66
|
-
font-size: 0.8125rem;
|
|
67
|
-
text-align: center;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.memori--login-modal--email-row {
|
|
71
|
-
margin: -0.35rem 0 0;
|
|
72
|
-
color: var(--memori-text-color, #1a1a2e);
|
|
73
|
-
font-size: 0.9375rem;
|
|
74
|
-
line-height: 1.4;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.memori--login-modal--email-value {
|
|
78
|
-
font-weight: var(--memori-text-weight-bold, 700);
|
|
79
|
-
overflow-wrap: anywhere;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.memori--login-modal--edit-link {
|
|
83
|
-
padding: 0;
|
|
84
|
-
border: none;
|
|
85
|
-
margin: 0;
|
|
86
|
-
background: none;
|
|
87
|
-
color: var(--memori-primary, #6b2d5c);
|
|
88
|
-
cursor: pointer;
|
|
89
|
-
font: inherit;
|
|
90
|
-
font-weight: var(--memori-text-weight-semibold, 600);
|
|
91
|
-
text-decoration: underline;
|
|
92
|
-
text-underline-offset: 2px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.memori--login-modal--edit-link:disabled {
|
|
96
|
-
cursor: not-allowed;
|
|
97
|
-
opacity: 0.55;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.memori--login-modal .memori-field.memori--login-modal--field {
|
|
101
|
-
display: flex;
|
|
102
|
-
width: calc(100% - 0.75rem);
|
|
103
|
-
max-width: calc(100% - 0.75rem);
|
|
104
|
-
box-sizing: border-box;
|
|
105
|
-
flex-direction: column;
|
|
106
|
-
margin-right: auto;
|
|
107
|
-
margin-left: auto;
|
|
108
|
-
gap: 0.375rem;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.memori--login-modal--email-input,
|
|
112
|
-
.memori--login-modal--form input {
|
|
113
|
-
width: 100%;
|
|
114
|
-
box-sizing: border-box;
|
|
115
|
-
border-radius: var(--memori-login-control-radius) !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.memori--login-modal--email-input.error,
|
|
119
|
-
.memori--login-modal--otp-digit.error {
|
|
120
|
-
border-color: var(--memori-error, #ef4444) !important;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.memori--login-modal .memori-button.memori--login-modal--primary {
|
|
124
|
-
width: calc(100% - 0.75rem);
|
|
125
|
-
max-width: calc(100% - 0.75rem);
|
|
126
|
-
min-height: 2.75rem;
|
|
127
|
-
box-sizing: border-box;
|
|
128
|
-
border-radius: var(--memori-login-control-radius) !important;
|
|
129
|
-
margin-right: auto;
|
|
130
|
-
margin-left: auto;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.memori--login-modal--otp-fieldset {
|
|
134
|
-
display: flex;
|
|
135
|
-
flex-direction: column;
|
|
136
|
-
padding: 0;
|
|
137
|
-
border: none;
|
|
138
|
-
margin: 0;
|
|
139
|
-
gap: 0.5rem;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.memori--login-modal--otp-label {
|
|
143
|
-
padding: 0;
|
|
144
|
-
color: var(--memori-text-color, #1a1a2e);
|
|
145
|
-
font-size: 0.875rem;
|
|
146
|
-
font-weight: var(--memori-text-weight-semibold, 600);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.memori--login-modal--otp-digits {
|
|
150
|
-
display: grid;
|
|
151
|
-
width: 100%;
|
|
152
|
-
max-width: 16rem;
|
|
153
|
-
gap: 0.625rem;
|
|
154
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.memori--login-modal--otp-digit {
|
|
158
|
-
width: 100%;
|
|
159
|
-
height: 3.25rem;
|
|
160
|
-
border-radius: var(--memori-login-box-radius) !important;
|
|
161
|
-
font-size: 1.375rem;
|
|
162
|
-
font-weight: var(--memori-text-weight-bold, 700);
|
|
163
|
-
text-align: center;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.memori--login-modal--otp-digit.active,
|
|
167
|
-
.memori--login-modal--otp-digit:focus {
|
|
168
|
-
border-color: var(--memori-primary, #6b2d5c) !important;
|
|
169
|
-
box-shadow: 0 0 0 3px color-mix(in oklch, var(--memori-primary, #6b2d5c), transparent 84%);
|
|
170
|
-
outline: none;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.memori--login-modal--inline-error {
|
|
174
|
-
margin: 0;
|
|
175
|
-
color: var(--memori-error, #b91c1c);
|
|
176
|
-
font-size: 0.875rem;
|
|
177
|
-
line-height: 1.35;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.memori--login-modal--missing-data {
|
|
181
|
-
display: flex;
|
|
182
|
-
min-height: 0;
|
|
183
|
-
flex: 1 1 auto;
|
|
184
|
-
flex-direction: column;
|
|
185
|
-
gap: 0.75rem;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.memori--login-modal--missing-helper {
|
|
189
|
-
margin: 0;
|
|
190
|
-
color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 30%);
|
|
191
|
-
font-size: 0.9375rem;
|
|
192
|
-
line-height: 1.45;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
form.memori--login-modal--form {
|
|
196
|
-
display: flex;
|
|
197
|
-
flex-direction: column;
|
|
198
|
-
gap: 0.75rem;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
form.memori--login-modal--form--missing {
|
|
202
|
-
min-height: 0;
|
|
203
|
-
flex: 1 1 auto;
|
|
204
|
-
gap: 0;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.memori--login-modal--form-body {
|
|
208
|
-
display: flex;
|
|
209
|
-
min-height: 0;
|
|
210
|
-
flex: 1 1 auto;
|
|
211
|
-
flex-direction: column;
|
|
212
|
-
padding: 0.25rem 0.375rem 0.75rem;
|
|
213
|
-
gap: 0.875rem;
|
|
214
|
-
-webkit-overflow-scrolling: touch;
|
|
215
|
-
overflow-x: hidden;
|
|
216
|
-
overflow-y: auto;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.memori--login-modal--form-footer {
|
|
220
|
-
flex-shrink: 0;
|
|
221
|
-
padding: 0.75rem 0.375rem 0.125rem;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.memori--login-modal--consent-block {
|
|
225
|
-
display: flex;
|
|
226
|
-
flex-direction: column;
|
|
227
|
-
gap: 0.75rem;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.memori-login-modal--consent {
|
|
231
|
-
width: 100%;
|
|
232
|
-
margin: 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.memori--login-modal--consent-note {
|
|
236
|
-
margin: 0;
|
|
237
|
-
color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 35%);
|
|
238
|
-
font-size: 0.8125rem;
|
|
239
|
-
line-height: 1.45;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.memori--login-modal--deep-thought {
|
|
243
|
-
padding: 0.625rem 0.75rem;
|
|
244
|
-
border-radius: var(--memori-login-box-radius);
|
|
245
|
-
background: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 96%);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
@media (max-width: 480px) {
|
|
249
|
-
.memori--login-modal--content,
|
|
250
|
-
.memori--login-modal .memori-modal__popup {
|
|
251
|
-
padding: 1.25rem 1rem 1rem;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.memori--login-modal--title,
|
|
255
|
-
.memori--login-modal .memori-modal__title {
|
|
256
|
-
font-size: 1.5rem;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.memori--login-modal--otp-digits {
|
|
260
|
-
max-width: 100%;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
@media (prefers-reduced-motion: reduce) {
|
|
265
|
-
.memori--login-modal * {
|
|
266
|
-
animation-duration: 0.01ms !important;
|
|
267
|
-
animation-iteration-count: 1 !important;
|
|
268
|
-
transition-duration: 0.01ms !important;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { User, Tenant } from '@memori.ai/memori-api-client/dist/types';
|
|
2
|
-
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
3
|
-
export interface Props {
|
|
4
|
-
open?: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
user?: User;
|
|
7
|
-
loginToken?: string;
|
|
8
|
-
onLogin: (user: User, token: string) => void;
|
|
9
|
-
onLogout: () => void;
|
|
10
|
-
tenant: Tenant;
|
|
11
|
-
apiClient: ReturnType<typeof memoriApiClient>;
|
|
12
|
-
__TEST__signup?: boolean;
|
|
13
|
-
__TEST__needMissingData?: boolean;
|
|
14
|
-
setUser: (user: User) => void;
|
|
15
|
-
modalClassName?: string;
|
|
16
|
-
memoriName?: string;
|
|
17
|
-
}
|
|
18
|
-
declare const LoginModal: ({ open, onClose, onLogin, user, loginToken: _loginToken, setUser, tenant, apiClient, __TEST__signup: _signup, __TEST__needMissingData, modalClassName, memoriName, onLogout: _onLogout, }: Props) => JSX.Element;
|
|
19
|
-
export default LoginModal;
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const ui_1 = require("@memori.ai/ui");
|
|
7
|
-
const react_i18next_1 = require("react-i18next");
|
|
8
|
-
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
|
-
const error_1 = require("../../helpers/error");
|
|
10
|
-
const utils_1 = require("../../helpers/utils");
|
|
11
|
-
const LoginModal = ({ open = false, onClose, onLogin, user, loginToken: _loginToken, setUser, tenant, apiClient, __TEST__signup: _signup = false, __TEST__needMissingData = false, modalClassName, memoriName, onLogout: _onLogout, }) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
14
|
-
const { add } = (0, ui_1.useAlertManager)();
|
|
15
|
-
const lang = i18n.language === 'it' ? 'it' : 'en';
|
|
16
|
-
const { pwlUpdateUser, loginWithOTP, validateOTPCode, pwlGetCurrentUser } = apiClient.backend;
|
|
17
|
-
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
18
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
19
|
-
const [otpCode, setOtpCode] = (0, react_1.useState)('');
|
|
20
|
-
const [otpEmail, setOtpEmail] = (0, react_1.useState)('');
|
|
21
|
-
const [otpError, setOtpError] = (0, react_1.useState)(null);
|
|
22
|
-
const [showOtpCodeForm, setShowOtpCodeForm] = (0, react_1.useState)(false);
|
|
23
|
-
const [otpResendCooldown, setOtpResendCooldown] = (0, react_1.useState)(null);
|
|
24
|
-
const [isResending, setIsResending] = (0, react_1.useState)(false);
|
|
25
|
-
const [otpFocusedIndex, setOtpFocusedIndex] = (0, react_1.useState)(0);
|
|
26
|
-
const [birthDate, setBirthDate] = (0, react_1.useState)('');
|
|
27
|
-
const [isBirthDateFocused, setIsBirthDateFocused] = (0, react_1.useState)(false);
|
|
28
|
-
const [isMobileViewport, setIsMobileViewport] = (0, react_1.useState)(false);
|
|
29
|
-
const [tnCAndPPAccepted, setTnCAndPPAccepted] = (0, react_1.useState)(false);
|
|
30
|
-
const [pAndCUAccepted, setPAndCUAccepted] = (0, react_1.useState)(false);
|
|
31
|
-
const otpInputRefs = (0, react_1.useRef)([]);
|
|
32
|
-
const validatingRef = (0, react_1.useRef)(false);
|
|
33
|
-
const [needsMissingData, setNeedsMissingData] = (0, react_1.useState)(__TEST__needMissingData
|
|
34
|
-
? {
|
|
35
|
-
token: 'token',
|
|
36
|
-
birthDate: true,
|
|
37
|
-
tnCAndPPAccepted: true,
|
|
38
|
-
}
|
|
39
|
-
: {});
|
|
40
|
-
(0, react_1.useEffect)(() => {
|
|
41
|
-
let interval;
|
|
42
|
-
if (otpResendCooldown != null && otpResendCooldown > 0) {
|
|
43
|
-
interval = setInterval(() => {
|
|
44
|
-
setOtpResendCooldown(prev => (prev != null && prev > 0 ? prev - 1 : 0));
|
|
45
|
-
}, 1000);
|
|
46
|
-
}
|
|
47
|
-
return () => {
|
|
48
|
-
if (interval)
|
|
49
|
-
clearInterval(interval);
|
|
50
|
-
};
|
|
51
|
-
}, [otpResendCooldown]);
|
|
52
|
-
(0, react_1.useEffect)(() => {
|
|
53
|
-
if (otpResendCooldown === 0) {
|
|
54
|
-
setOtpResendCooldown(null);
|
|
55
|
-
}
|
|
56
|
-
}, [otpResendCooldown]);
|
|
57
|
-
(0, react_1.useEffect)(() => {
|
|
58
|
-
const mediaQuery = window.matchMedia('(max-width: 768px)');
|
|
59
|
-
const onChange = () => setIsMobileViewport(mediaQuery.matches);
|
|
60
|
-
onChange();
|
|
61
|
-
mediaQuery.addEventListener('change', onChange);
|
|
62
|
-
return () => mediaQuery.removeEventListener('change', onChange);
|
|
63
|
-
}, []);
|
|
64
|
-
const sendOtpToEmail = async (email, isResend = false) => {
|
|
65
|
-
const trimmed = email.trim();
|
|
66
|
-
if (!trimmed) {
|
|
67
|
-
setOtpError(t('login.emailRequired'));
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (!utils_1.mailRegEx.test(trimmed)) {
|
|
71
|
-
setOtpError(t('login.emailInvalid'));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (isResend) {
|
|
75
|
-
setIsResending(true);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
setLoading(true);
|
|
79
|
-
}
|
|
80
|
-
setOtpError(null);
|
|
81
|
-
try {
|
|
82
|
-
const response = await loginWithOTP({
|
|
83
|
-
tenant: tenant.name,
|
|
84
|
-
eMail: trimmed,
|
|
85
|
-
});
|
|
86
|
-
if (response.resultCode === 0) {
|
|
87
|
-
setOtpEmail(trimmed);
|
|
88
|
-
setShowOtpCodeForm(true);
|
|
89
|
-
setOtpResendCooldown(60);
|
|
90
|
-
setOtpCode('');
|
|
91
|
-
setOtpFocusedIndex(0);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
setOtpError(response.resultMessage || t('login.otpSendError'));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
console.error('[OTP SEND]', err);
|
|
99
|
-
setOtpError(t('login.otpSendError'));
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
setLoading(false);
|
|
103
|
-
setIsResending(false);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const validateOtp = async (otp) => {
|
|
107
|
-
var _a, _b, _c;
|
|
108
|
-
if (validatingRef.current)
|
|
109
|
-
return;
|
|
110
|
-
if (!otp || otp.length !== 4) {
|
|
111
|
-
setOtpError(t('login.otpInvalidFormat'));
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (!otpEmail || otpEmail.trim().length === 0) {
|
|
115
|
-
setOtpError(t('login.emailRequired'));
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
validatingRef.current = true;
|
|
119
|
-
setLoading(true);
|
|
120
|
-
setOtpError(null);
|
|
121
|
-
try {
|
|
122
|
-
const response = await validateOTPCode(otp, tenant.name, undefined, otpEmail.trim());
|
|
123
|
-
if (response.resultCode === 0) {
|
|
124
|
-
try {
|
|
125
|
-
const { user: fetchedUser } = await pwlGetCurrentUser(response.newSessionToken);
|
|
126
|
-
if (!fetchedUser.age || !fetchedUser.tnCAndPPAccepted) {
|
|
127
|
-
setUser(fetchedUser);
|
|
128
|
-
setBirthDate((_a = fetchedUser === null || fetchedUser === void 0 ? void 0 : fetchedUser.birthDate) !== null && _a !== void 0 ? _a : '');
|
|
129
|
-
setTnCAndPPAccepted((_b = fetchedUser === null || fetchedUser === void 0 ? void 0 : fetchedUser.tnCAndPPAccepted) !== null && _b !== void 0 ? _b : false);
|
|
130
|
-
setPAndCUAccepted((_c = fetchedUser === null || fetchedUser === void 0 ? void 0 : fetchedUser.pAndCUAccepted) !== null && _c !== void 0 ? _c : false);
|
|
131
|
-
setNeedsMissingData({
|
|
132
|
-
token: response.newSessionToken,
|
|
133
|
-
birthDate: !fetchedUser.age,
|
|
134
|
-
tnCAndPPAccepted: !fetchedUser.tnCAndPPAccepted,
|
|
135
|
-
});
|
|
136
|
-
setShowOtpCodeForm(false);
|
|
137
|
-
setOtpCode('');
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
setShowOtpCodeForm(false);
|
|
141
|
-
setOtpCode('');
|
|
142
|
-
setOtpEmail('');
|
|
143
|
-
onLogin(fetchedUser, response.newSessionToken);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
console.error('[GET USER]', err);
|
|
148
|
-
setOtpError(t('login.userFetchError'));
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else if (response.resultCode === -107) {
|
|
152
|
-
setOtpError(t('login.otpNotFound'));
|
|
153
|
-
}
|
|
154
|
-
else if (response.resultCode === -108) {
|
|
155
|
-
setOtpError(t('login.otpExpired'));
|
|
156
|
-
setOtpResendCooldown(null);
|
|
157
|
-
}
|
|
158
|
-
else if (response.resultCode === -109) {
|
|
159
|
-
setOtpError(t('login.otpInvalid'));
|
|
160
|
-
setOtpCode('');
|
|
161
|
-
setOtpFocusedIndex(0);
|
|
162
|
-
window.setTimeout(() => {
|
|
163
|
-
var _a;
|
|
164
|
-
(_a = otpInputRefs.current[0]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
165
|
-
}, 50);
|
|
166
|
-
}
|
|
167
|
-
else if (response.resultCode === -110) {
|
|
168
|
-
setOtpError(t('login.otpAttemptsExceeded'));
|
|
169
|
-
setOtpCode('');
|
|
170
|
-
setOtpResendCooldown(null);
|
|
171
|
-
setShowOtpCodeForm(false);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
setOtpError(response.resultMessage || t('login.otpInvalid'));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (err) {
|
|
178
|
-
console.error('[OTP VALIDATION]', err);
|
|
179
|
-
setOtpError(t('login.otpError'));
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
setLoading(false);
|
|
183
|
-
validatingRef.current = false;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
(0, react_1.useEffect)(() => {
|
|
187
|
-
if (showOtpCodeForm && !loading) {
|
|
188
|
-
window.setTimeout(() => {
|
|
189
|
-
var _a;
|
|
190
|
-
(_a = otpInputRefs.current[0]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
191
|
-
}, 50);
|
|
192
|
-
}
|
|
193
|
-
}, [showOtpCodeForm, loading]);
|
|
194
|
-
const handleOtpDigitChange = (index, value) => {
|
|
195
|
-
var _a, _b;
|
|
196
|
-
const digits = value.replace(/\D/g, '');
|
|
197
|
-
const current = otpCode.padEnd(4, ' ').split('');
|
|
198
|
-
if (!digits.length) {
|
|
199
|
-
current[index] = ' ';
|
|
200
|
-
setOtpCode(current.join('').replace(/\s/g, ''));
|
|
201
|
-
setOtpError(null);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
if (digits.length > 1) {
|
|
205
|
-
const next = [...current];
|
|
206
|
-
digits
|
|
207
|
-
.slice(0, 4)
|
|
208
|
-
.split('')
|
|
209
|
-
.forEach((digit, i) => {
|
|
210
|
-
if (index + i < 4) {
|
|
211
|
-
next[index + i] = digit;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
const nextCode = next.join('').replace(/\s/g, '').slice(0, 4);
|
|
215
|
-
setOtpCode(nextCode);
|
|
216
|
-
setOtpError(null);
|
|
217
|
-
const nextFocus = Math.min(index + digits.length, 3);
|
|
218
|
-
(_a = otpInputRefs.current[nextFocus]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
219
|
-
setOtpFocusedIndex(nextFocus);
|
|
220
|
-
if (nextCode.length === 4 && otpEmail.trim().length > 0) {
|
|
221
|
-
validateOtp(nextCode);
|
|
222
|
-
}
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
current[index] = digits[0];
|
|
226
|
-
const nextCode = current.join('').replace(/\s/g, '').slice(0, 4);
|
|
227
|
-
setOtpCode(nextCode);
|
|
228
|
-
setOtpError(null);
|
|
229
|
-
if (nextCode.length === 4 && otpEmail.trim().length > 0) {
|
|
230
|
-
validateOtp(nextCode);
|
|
231
|
-
}
|
|
232
|
-
if (index < 3) {
|
|
233
|
-
(_b = otpInputRefs.current[index + 1]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
234
|
-
setOtpFocusedIndex(index + 1);
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
const handleOtpDigitKeyDown = (index, event) => {
|
|
238
|
-
var _a, _b, _c;
|
|
239
|
-
if (event.key === 'Backspace' && !otpCode[index] && index > 0) {
|
|
240
|
-
(_a = otpInputRefs.current[index - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
241
|
-
setOtpFocusedIndex(index - 1);
|
|
242
|
-
}
|
|
243
|
-
if (event.key === 'ArrowLeft' && index > 0) {
|
|
244
|
-
event.preventDefault();
|
|
245
|
-
(_b = otpInputRefs.current[index - 1]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
246
|
-
setOtpFocusedIndex(index - 1);
|
|
247
|
-
}
|
|
248
|
-
if (event.key === 'ArrowRight' && index < 3) {
|
|
249
|
-
event.preventDefault();
|
|
250
|
-
(_c = otpInputRefs.current[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
251
|
-
setOtpFocusedIndex(index + 1);
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
const handleOtpDigitPaste = (index, event) => {
|
|
255
|
-
var _a;
|
|
256
|
-
const pasted = event.clipboardData.getData('text');
|
|
257
|
-
const digits = pasted.replace(/\D/g, '').slice(0, 4);
|
|
258
|
-
if (!digits.length)
|
|
259
|
-
return;
|
|
260
|
-
event.preventDefault();
|
|
261
|
-
const current = otpCode.padEnd(4, ' ').split('');
|
|
262
|
-
digits.split('').forEach((digit, i) => {
|
|
263
|
-
if (index + i < 4) {
|
|
264
|
-
current[index + i] = digit;
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
const nextCode = current.join('').replace(/\s/g, '').slice(0, 4);
|
|
268
|
-
setOtpCode(nextCode);
|
|
269
|
-
setOtpError(null);
|
|
270
|
-
const nextFocus = Math.min(index + digits.length, 3);
|
|
271
|
-
(_a = otpInputRefs.current[nextFocus]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
272
|
-
setOtpFocusedIndex(nextFocus);
|
|
273
|
-
if (nextCode.length === 4 && otpEmail.trim().length > 0) {
|
|
274
|
-
validateOtp(nextCode);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
const handleEmailChange = (value) => {
|
|
278
|
-
setOtpEmail(value);
|
|
279
|
-
setOtpError(null);
|
|
280
|
-
};
|
|
281
|
-
const handleResendOtp = () => {
|
|
282
|
-
if (otpEmail && utils_1.mailRegEx.test(otpEmail)) {
|
|
283
|
-
sendOtpToEmail(otpEmail, true);
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
const goBackToEmail = () => {
|
|
287
|
-
setShowOtpCodeForm(false);
|
|
288
|
-
setOtpCode('');
|
|
289
|
-
setOtpError(null);
|
|
290
|
-
setOtpResendCooldown(null);
|
|
291
|
-
};
|
|
292
|
-
const updateMissingData = async (e) => {
|
|
293
|
-
e.preventDefault();
|
|
294
|
-
if (!(user === null || user === void 0 ? void 0 : user.userID) || !(needsMissingData === null || needsMissingData === void 0 ? void 0 : needsMissingData.token)) {
|
|
295
|
-
setError(t('login.userNotFound'));
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (!birthDate || !tnCAndPPAccepted) {
|
|
299
|
-
setError(t('missingData'));
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
let newUser = {
|
|
303
|
-
userID: user.userID,
|
|
304
|
-
birthDate: (user === null || user === void 0 ? void 0 : user.birthDate) || !needsMissingData.birthDate ? undefined : birthDate,
|
|
305
|
-
tnCAndPPAccepted: tnCAndPPAccepted || (user === null || user === void 0 ? void 0 : user.tnCAndPPAccepted),
|
|
306
|
-
tnCAndPPAcceptanceDate: tnCAndPPAccepted
|
|
307
|
-
? new Date().toISOString()
|
|
308
|
-
: undefined,
|
|
309
|
-
pAndCUAccepted: pAndCUAccepted || (user === null || user === void 0 ? void 0 : user.pAndCUAccepted),
|
|
310
|
-
pAndCUAcceptanceDate: pAndCUAccepted
|
|
311
|
-
? new Date().toISOString()
|
|
312
|
-
: undefined,
|
|
313
|
-
};
|
|
314
|
-
const { user: patchedUser, ...resp } = await pwlUpdateUser(needsMissingData.token, user.userID, newUser);
|
|
315
|
-
if (resp.resultCode !== 0) {
|
|
316
|
-
console.error(resp);
|
|
317
|
-
add((0, ui_1.createAlertOptions)({
|
|
318
|
-
description: t((0, error_1.getErrori18nKey)(resp.resultCode)),
|
|
319
|
-
severity: 'error',
|
|
320
|
-
}));
|
|
321
|
-
setError(resp.resultMessage);
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
onLogin(patchedUser || newUser, needsMissingData.token);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
const agentName = (memoriName === null || memoriName === void 0 ? void 0 : memoriName.trim()) || t('login.defaultAgentName') || 'AI';
|
|
328
|
-
const loginTitle = t('login.login') || 'Login';
|
|
329
|
-
const codeComplete = otpCode.length === 4;
|
|
330
|
-
const isMissingDataStep = !!((_a = needsMissingData === null || needsMissingData === void 0 ? void 0 : needsMissingData.token) === null || _a === void 0 ? void 0 : _a.length);
|
|
331
|
-
const emailStep = ((0, jsx_runtime_1.jsxs)("div", { className: "memori--login-modal--step", children: [(0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--benefit", children: t('login.loginBenefitLine1', { memoriName: agentName }) }), (0, jsx_runtime_1.jsxs)(ui_1.Field.Root, { className: "memori--login-modal--field", children: [(0, jsx_runtime_1.jsx)(ui_1.Field.Label, { htmlFor: "otp-email", children: t('login.email') }), (0, jsx_runtime_1.jsx)(ui_1.Input, { id: "otp-email", name: "email", type: "email", size: "lg", className: (0, classnames_1.default)('memori--login-modal--email-input', {
|
|
332
|
-
error: !!otpError,
|
|
333
|
-
}), value: otpEmail, onChange: e => handleEmailChange(e.target.value), placeholder: t('login.emailPlaceholder') || 'Enter your email…', autoComplete: "email", spellCheck: false, required: true, disabled: loading, "aria-invalid": !!otpError, "aria-describedby": otpError ? 'otp-email-error' : 'email-help' }), otpError ? ((0, jsx_runtime_1.jsx)(ui_1.Field.Error, { id: "otp-email-error", children: otpError })) : ((0, jsx_runtime_1.jsx)("p", { id: "email-help", className: "sr-only", children: t('login.otpEmailDescription') }))] }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "primary", className: "memori--login-modal--primary", onClick: () => sendOtpToEmail(otpEmail), disabled: loading, loading: loading, size: "lg", children: t('login.sendOtp') }), (0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--footnote", children: t('login.passwordlessHint') })] }));
|
|
334
|
-
const codeStep = ((0, jsx_runtime_1.jsxs)("div", { className: "memori--login-modal--step", children: [(0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--sent-copy", children: t('login.otpSentToPrefix') }), (0, jsx_runtime_1.jsxs)("p", { className: "memori--login-modal--email-row", children: [(0, jsx_runtime_1.jsx)("strong", { className: "memori--login-modal--email-value", children: otpEmail }), ' ', (0, jsx_runtime_1.jsx)("button", { type: "button", className: "memori--login-modal--edit-link", onClick: goBackToEmail, disabled: loading, children: t('login.editEmail') })] }), (0, jsx_runtime_1.jsxs)("fieldset", { className: "memori--login-modal--otp-fieldset", "aria-describedby": "otp-help", children: [(0, jsx_runtime_1.jsx)("legend", { className: "memori--login-modal--otp-label", children: t('login.otpCodeShort') }), (0, jsx_runtime_1.jsx)("div", { className: "memori--login-modal--otp-digits", children: [0, 1, 2, 3].map(index => ((0, jsx_runtime_1.jsx)(ui_1.Input, { id: index === 0 ? 'otp-code' : `otp-code-${index}`, name: `otp-code-${index}`, "aria-label": `${t('login.otpCode')} ${index + 1} / 4`, type: "text", inputMode: "numeric", pattern: "[0-9]*", enterKeyHint: index === 3 ? 'done' : 'next', autoComplete: index === 0 ? 'one-time-code' : 'off', spellCheck: false, className: (0, classnames_1.default)('memori--login-modal--otp-digit', {
|
|
335
|
-
active: otpFocusedIndex === index,
|
|
336
|
-
error: !!otpError,
|
|
337
|
-
}), value: otpCode[index] || '', onChange: e => handleOtpDigitChange(index, e.target.value), onFocus: () => setOtpFocusedIndex(index), onKeyDown: e => handleOtpDigitKeyDown(index, e), onPaste: e => handleOtpDigitPaste(index, e), maxLength: 1, required: true, disabled: loading, ref: el => {
|
|
338
|
-
otpInputRefs.current[index] = el;
|
|
339
|
-
} }, index))) }), (0, jsx_runtime_1.jsx)("p", { id: "otp-help", className: "sr-only", children: t('login.otpCodeDescription', { email: otpEmail }) })] }), otpError && ((0, jsx_runtime_1.jsx)("p", { role: "alert", className: "memori--login-modal--inline-error", children: otpError })), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "primary", className: "memori--login-modal--primary", onClick: () => validateOtp(otpCode), disabled: loading || !codeComplete, loading: loading, size: "lg", children: loginTitle }), (0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--resend", children: otpResendCooldown != null && otpResendCooldown > 0 ? (t('login.resendOtpPrompt', { seconds: otpResendCooldown })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('login.resendOtpQuestion'), ' ', (0, jsx_runtime_1.jsx)("button", { type: "button", className: "memori--login-modal--edit-link", onClick: handleResendOtp, disabled: loading || isResending || !otpEmail, children: isResending ? t('login.resending') : t('login.resendOtp') })] })) })] }));
|
|
340
|
-
const missingDataStep = ((0, jsx_runtime_1.jsxs)("div", { className: "memori--login-modal--missing-data", children: [(0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--missing-helper", children: t('login.missingDataHelper') }), (0, jsx_runtime_1.jsxs)(ui_1.Form, { name: "updateMissingData", className: "memori--login-modal--form memori--login-modal--form--missing", onSubmit: updateMissingData, children: [(0, jsx_runtime_1.jsxs)("div", { className: "memori--login-modal--form-body", children: [needsMissingData.birthDate && ((0, jsx_runtime_1.jsxs)(ui_1.Field.Root, { className: "memori--login-modal--field", children: [(0, jsx_runtime_1.jsx)(ui_1.Field.Label, { htmlFor: "birthDate", children: t('login.birthDate') }), (0, jsx_runtime_1.jsx)(ui_1.Input, { id: "birthDate", name: "birthDate", type: isMobileViewport && !birthDate && !isBirthDateFocused
|
|
341
|
-
? 'text'
|
|
342
|
-
: 'date', required: true, onChange: e => setBirthDate(e.target.value), value: birthDate, placeholder: isMobileViewport
|
|
343
|
-
? t('login.birthDatePlaceholder') || 'DD/MM/YYYY'
|
|
344
|
-
: undefined, onFocus: () => setIsBirthDateFocused(true), onBlur: () => setIsBirthDateFocused(false), autoComplete: "bday" }), (0, jsx_runtime_1.jsx)(ui_1.Field.Description, { children: t('login.birthDateHelper') })] })), (needsMissingData === null || needsMissingData === void 0 ? void 0 : needsMissingData.tnCAndPPAccepted) && ((0, jsx_runtime_1.jsxs)("div", { className: "memori--login-modal--consent-block", children: [(0, jsx_runtime_1.jsx)(ui_1.Checkbox, { name: "tnCAndPPAccepted", className: "memori-login-modal--consent", checked: tnCAndPPAccepted, onChange: checked => setTnCAndPPAccepted(checked), label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('login.privacyLabel'), ' ', (0, jsx_runtime_1.jsx)("a", { href: `https://memori.ai/${lang}/privacy_and_cookie`, target: "_blank", rel: "noopener noreferrer", children: t('login.privacyAndCookiePolicy') }), ' ', t('login.and'), ' ', (0, jsx_runtime_1.jsx)("a", { href: `https://memori.ai/${lang}/tos`, target: "_blank", rel: "noopener noreferrer", children: t('login.termsOfService') })] }) }), (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { name: "pAndCUAccepted", className: "memori-login-modal--consent", checked: pAndCUAccepted, onChange: checked => setPAndCUAccepted(checked), label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('login.pAndCUAccepted'), ' ', (0, jsx_runtime_1.jsx)("small", { children: (0, jsx_runtime_1.jsxs)("em", { children: ["(", t('login.optional'), ")"] }) })] }) }), (0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--consent-note", children: t('login.goToAccountToChangeYourPreferences') }), (0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--consent-note memori--login-modal--deep-thought", children: t('login.deepThoughtExplaination') })] })), error && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-modal--inline-error", children: error }))] }), (0, jsx_runtime_1.jsx)("div", { className: "memori--login-modal--form-footer", children: (0, jsx_runtime_1.jsx)(ui_1.Button, { type: "submit", variant: "primary", className: "memori--login-modal--primary", loading: loading, children: t('login.save') }) })] })] }));
|
|
345
|
-
return ((0, jsx_runtime_1.jsx)(ui_1.Modal, { open: open, onClose: onClose, onOpenChange: nextOpen => {
|
|
346
|
-
if (!nextOpen)
|
|
347
|
-
onClose();
|
|
348
|
-
}, className: (0, classnames_1.default)('memori--login-modal', { 'memori--login-modal--missing': isMissingDataStep }, modalClassName), contentClassName: "memori--login-modal--content", titleClassName: "memori--login-modal--title", title: isMissingDataStep ? t('login.missingData') : loginTitle, size: "sm", width: isMissingDataStep ? '480px' : '420px', widthMd: isMissingDataStep ? '480px' : '420px', centered: true, closable: true, children: isMissingDataStep
|
|
349
|
-
? missingDataStep
|
|
350
|
-
: showOtpCodeForm
|
|
351
|
-
? codeStep
|
|
352
|
-
: emailStep }));
|
|
353
|
-
};
|
|
354
|
-
exports.default = LoginModal;
|
|
355
|
-
//# sourceMappingURL=LoginModal.js.map
|