@memori.ai/memori-react 9.0.0-alpha.21 → 9.0.0-alpha.23
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 +453 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Auth/Auth.css +12 -5
- package/dist/components/Auth/Auth.d.ts +1 -1
- package/dist/components/Auth/Auth.js +46 -32
- package/dist/components/Auth/Auth.js.map +1 -1
- package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/dist/components/Chat/Chat.css +1 -0
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +32 -5
- package/dist/components/ChatBubble/ChatBubble.js +14 -11
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.js +10 -1
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.css +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/dist/components/FeedbackButtons/FeedbackButtons.js +2 -2
- package/dist/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/dist/components/Header/Header.css +8 -3
- package/dist/components/Header/Header.js +15 -18
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/KnownFacts/KnownFacts.css +1 -1
- package/dist/components/KnownFacts/KnownFacts.js +2 -5
- package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +16 -14
- package/dist/components/LoginDrawer/LoginDrawer.js +19 -11
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +93 -32
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/dist/components/PositionPopover/PositionPopover.css +3 -3
- package/dist/components/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/Snippet/Snippet.css +1 -1
- package/dist/components/StartPanel/StartPanel.css +19 -3
- package/dist/components/StartPanel/StartPanel.js +12 -18
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/dist/components/layouts/chat.css +5 -2
- package/dist/components/layouts/totem.css +43 -9
- package/dist/helpers/nats/getNatsConfig.js.map +1 -1
- package/dist/helpers/nats/useNats.d.ts +2 -1
- package/dist/helpers/nats/useNats.js +87 -20
- package/dist/helpers/nats/useNats.js.map +1 -1
- package/dist/helpers/nats/useNatsSession.d.ts +6 -1
- package/dist/helpers/nats/useNatsSession.js +48 -7
- package/dist/helpers/nats/useNatsSession.js.map +1 -1
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +10 -2
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- package/dist/locales/de.json +4 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/styles.css +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Auth/Auth.css +12 -5
- package/esm/components/Auth/Auth.d.ts +1 -1
- package/esm/components/Auth/Auth.js +47 -33
- package/esm/components/Auth/Auth.js.map +1 -1
- package/esm/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/esm/components/Chat/Chat.css +1 -0
- package/esm/components/Chat/Chat.js +1 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +32 -5
- package/esm/components/ChatBubble/ChatBubble.js +14 -11
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +9 -59
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.js +11 -2
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.css +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/esm/components/FeedbackButtons/FeedbackButtons.js +2 -2
- package/esm/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/esm/components/Header/Header.css +8 -3
- package/esm/components/Header/Header.js +15 -18
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/IconButton/IconButton.d.ts +1 -1
- package/esm/components/KnownFacts/KnownFacts.css +1 -1
- package/esm/components/KnownFacts/KnownFacts.js +2 -5
- package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +16 -14
- package/esm/components/LoginDrawer/LoginDrawer.js +20 -12
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js +93 -33
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/esm/components/PositionPopover/PositionPopover.css +3 -3
- package/esm/components/PositionPopover/PositionPopover.js +39 -26
- package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
- package/esm/components/Snippet/Snippet.css +1 -1
- package/esm/components/StartPanel/StartPanel.css +19 -3
- package/esm/components/StartPanel/StartPanel.js +12 -18
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/esm/components/layouts/chat.css +5 -2
- package/esm/components/layouts/totem.css +43 -9
- package/esm/helpers/nats/getNatsConfig.js.map +1 -1
- package/esm/helpers/nats/useNats.d.ts +2 -1
- package/esm/helpers/nats/useNats.js +87 -20
- package/esm/helpers/nats/useNats.js.map +1 -1
- package/esm/helpers/nats/useNatsSession.d.ts +6 -1
- package/esm/helpers/nats/useNatsSession.js +48 -8
- package/esm/helpers/nats/useNatsSession.js.map +1 -1
- package/esm/helpers/positionPopover.d.ts +2 -1
- package/esm/helpers/positionPopover.js +9 -2
- package/esm/helpers/positionPopover.js.map +1 -1
- package/esm/icons/MemoriIcon.js +1 -1
- package/esm/icons/MemoriIcon.js.map +1 -1
- package/esm/locales/de.json +4 -1
- package/esm/locales/en.json +3 -1
- package/esm/locales/es.json +3 -1
- package/esm/locales/fr.json +3 -1
- package/esm/locales/it.json +3 -1
- package/esm/styles.css +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +8 -5
- package/src/Live/Agents.stories.tsx +49 -0
- package/src/Live/KnownFacts.stories.tsx +50 -0
- package/src/Showcase.stories.tsx +3 -14
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +1 -1
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +1 -0
- package/src/components/Auth/Auth.css +12 -5
- package/src/components/Auth/Auth.stories.tsx +1 -1
- package/src/components/Auth/Auth.test.tsx +68 -1
- package/src/components/Auth/Auth.tsx +69 -54
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +5 -6
- package/src/components/Avatar/Avatar.stories.tsx +1 -18
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +1 -103
- package/src/components/Blob/Blob.stories.tsx +1 -1
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +1 -1
- package/src/components/ChangeMode/ChangeMode.stories.tsx +1 -1
- package/src/components/Chat/Chat.css +1 -0
- package/src/components/Chat/Chat.stories.tsx +61 -7
- package/src/components/Chat/Chat.tsx +1 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +151 -151
- package/src/components/ChatBubble/ChatBubble.css +32 -5
- package/src/components/ChatBubble/ChatBubble.stories.tsx +24 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +37 -1
- package/src/components/ChatBubble/ChatBubble.tsx +308 -299
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +384 -264
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +1 -1
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +6 -0
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.tsx +24 -81
- package/src/components/ChatInputs/ChatInputs.stories.tsx +1 -39
- package/src/components/ChatInputs/ChatInputs.test.tsx +47 -0
- package/src/components/ChatInputs/ChatInputs.tsx +12 -2
- package/src/components/ChatTextArea/ChatTextArea.css +1 -1
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +1 -1
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +1 -1
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +1 -1
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +29 -10
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +2 -0
- package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +1 -1
- package/src/components/Header/Header.css +8 -3
- package/src/components/Header/Header.stories.tsx +1 -1
- package/src/components/Header/Header.tsx +146 -117
- package/src/components/KnownFacts/KnownFacts.css +1 -1
- package/src/components/KnownFacts/KnownFacts.stories.tsx +1 -23
- package/src/components/KnownFacts/KnownFacts.tsx +4 -9
- package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +6 -2
- package/src/components/LoginDrawer/LoginDrawer.css +16 -14
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +2 -52
- package/src/components/LoginDrawer/LoginDrawer.tsx +51 -39
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +33 -11
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +1 -15
- package/src/components/MediaWidget/MediaWidget.stories.tsx +1 -45
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +4 -6
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +1 -1
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +32 -28
- package/src/components/MemoriWidget/MemoriUIProvider.contract.test.tsx +55 -0
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +55 -77
- package/src/components/MemoriWidget/MemoriWidget.tsx +114 -45
- package/src/components/MemoriWidget/getChatStyles.test.ts +24 -0
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +1 -1
- package/src/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/src/components/PositionPopover/PositionPopover.css +3 -3
- package/src/components/PositionPopover/PositionPopover.stories.tsx +1 -1
- package/src/components/PositionPopover/PositionPopover.tsx +50 -28
- package/src/components/PoweredBy/PoweredBy.stories.tsx +1 -54
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +2 -2
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +1 -1
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +1 -1
- package/src/components/ShareButton/ShareButton.stories.tsx +1 -1
- package/src/components/Snippet/Snippet.css +1 -1
- package/src/components/Snippet/Snippet.stories.tsx +1 -1
- package/src/components/StartPanel/StartPanel.css +19 -3
- package/src/components/StartPanel/StartPanel.stories.tsx +2 -2
- package/src/components/StartPanel/StartPanel.tsx +22 -35
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +177 -121
- package/src/components/Typing/Typing.stories.tsx +1 -1
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +22 -44
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +9 -3
- package/src/components/layouts/FullBody/FullBody.stories.tsx +55 -68
- package/src/components/layouts/Totem/Totem.stories.tsx +69 -87
- package/src/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +69 -87
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +19 -41
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +39 -83
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +15 -11
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +116 -42
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +18 -40
- package/src/components/layouts/chat.css +5 -2
- package/src/components/layouts/layouts.stories.tsx +96 -179
- package/src/components/layouts/totem.css +43 -9
- package/src/helpers/nats/getNatsConfig.ts +4 -1
- package/src/helpers/nats/useNats.test.tsx +81 -0
- package/src/helpers/nats/useNats.ts +109 -29
- package/src/helpers/nats/useNatsSession.test.ts +16 -0
- package/src/helpers/nats/useNatsSession.ts +79 -13
- package/src/helpers/positionPopover.test.ts +36 -1
- package/src/helpers/positionPopover.ts +21 -4
- package/src/i18n.knownFacts.test.ts +40 -0
- package/src/icons/MemoriIcon.tsx +1 -1
- package/src/index.stories.tsx +1 -47
- package/src/locales/de.json +4 -1
- package/src/locales/en.json +3 -1
- package/src/locales/es.json +3 -1
- package/src/locales/fr.json +3 -1
- package/src/locales/it.json +3 -1
- package/src/styles.css +13 -27
- package/src/version.ts +1 -1
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -265
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -510
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -69
- package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.stories.tsx +0 -115
package/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "9.0.0-alpha.
|
|
1
|
+
export declare const version = "9.0.0-alpha.23";
|
package/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '9.0.0-alpha.
|
|
1
|
+
export const version = '9.0.0-alpha.23';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "9.0.0-alpha.
|
|
2
|
+
"version": "9.0.0-alpha.23",
|
|
3
3
|
"name": "@memori.ai/memori-react",
|
|
4
4
|
"author": "Memori Srl",
|
|
5
5
|
"main": "dist/index.js",
|
|
@@ -101,7 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"resolutions": {
|
|
103
103
|
"eslint-scope": "5.1.1",
|
|
104
|
-
"esbuild": "^0.24.0"
|
|
104
|
+
"esbuild": "^0.24.0",
|
|
105
|
+
"marked-katex-extension": "5.1.10"
|
|
105
106
|
},
|
|
106
107
|
"eslintIgnore": [
|
|
107
108
|
"/node_modules",
|
|
@@ -240,6 +241,7 @@
|
|
|
240
241
|
"@commitlint/config-conventional": "17.3.0",
|
|
241
242
|
"@release-it/conventional-changelog": "5.1.1",
|
|
242
243
|
"@size-limit/preset-small-lib": "8.1.0",
|
|
244
|
+
"@storybook/addon-a11y": "7.4.0",
|
|
243
245
|
"@storybook/addon-essentials": "7.4.0",
|
|
244
246
|
"@storybook/addon-links": "7.4.0",
|
|
245
247
|
"@storybook/addon-mdx-gfm": "7.4.0",
|
|
@@ -287,7 +289,7 @@
|
|
|
287
289
|
"release-it": "15.5.0",
|
|
288
290
|
"rimraf": "3.0.2",
|
|
289
291
|
"size-limit": "8.1.0",
|
|
290
|
-
"storybook": "7.
|
|
292
|
+
"storybook": "7.4.0",
|
|
291
293
|
"stylelint": "14.15.0",
|
|
292
294
|
"stylelint-config-idiomatic-order": "9.0.0",
|
|
293
295
|
"stylelint-config-prettier": "9.0.4",
|
|
@@ -302,11 +304,12 @@
|
|
|
302
304
|
},
|
|
303
305
|
"dependencies": {
|
|
304
306
|
"@memori.ai/memori-api-client": "6.24.1",
|
|
305
|
-
"@memori.ai/ui": "^1.
|
|
307
|
+
"@memori.ai/ui": "^1.17.0",
|
|
306
308
|
"@nats-io/jetstream": "^3.4.0",
|
|
307
309
|
"@nats-io/nats-core": "^3.4.0",
|
|
308
310
|
"@react-three/drei": "8.20.2",
|
|
309
311
|
"@react-three/fiber": "7.0.25",
|
|
312
|
+
"@tanstack/react-table": "^8.21.0",
|
|
310
313
|
"classnames": "2.5.1",
|
|
311
314
|
"dompurify": "^3.4.13",
|
|
312
315
|
"ellipsed": "1.6.0",
|
|
@@ -317,7 +320,7 @@
|
|
|
317
320
|
"lucide-react": "^0.460.0",
|
|
318
321
|
"luxon": "^3.5.0",
|
|
319
322
|
"marked": "^15.0.2",
|
|
320
|
-
"marked-katex-extension": "
|
|
323
|
+
"marked-katex-extension": "5.1.10",
|
|
321
324
|
"marked-linkify-it": "^3.1.12",
|
|
322
325
|
"qrcode.react": "3.1.0",
|
|
323
326
|
"react-hook-form": "7.39.5",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Memori from '../index';
|
|
3
|
+
import { withWidgetProviders } from '../../.storybook/decorators';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Live / staging / localhost agent demos. Not fixture-first — expect network.
|
|
7
|
+
* Keep out of Layouts canonical matrix.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Live/Agents',
|
|
11
|
+
component: Memori,
|
|
12
|
+
decorators: [withWidgetProviders],
|
|
13
|
+
parameters: {
|
|
14
|
+
controls: { expanded: true },
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Memori>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
const stagingBase = {
|
|
23
|
+
memoriName: 'Layout Storybook',
|
|
24
|
+
ownerUserName: 'Andrea-Patini',
|
|
25
|
+
memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
|
|
26
|
+
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
27
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
28
|
+
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
29
|
+
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
30
|
+
uiLang: 'IT' as const,
|
|
31
|
+
spokenLang: 'IT' as const,
|
|
32
|
+
integrationID: '32922e14-24d6-4f5f-a06b-d963da14a658',
|
|
33
|
+
showSettings: true,
|
|
34
|
+
autoStart: true,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const StagingFullPage: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
...stagingBase,
|
|
40
|
+
layout: 'FULLPAGE',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const StagingZoomedFullBody: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
...stagingBase,
|
|
47
|
+
layout: 'ZOOMED_FULL_BODY',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
4
|
+
import { AlertProvider } from '@memori.ai/ui';
|
|
5
|
+
import KnownFacts from '../components/KnownFacts/KnownFacts';
|
|
6
|
+
import '../components/KnownFacts/KnownFacts.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Localhost-only KnownFacts demo. Prefer Surfaces/Known Facts fixtures for review.
|
|
10
|
+
*/
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Live/Known Facts',
|
|
13
|
+
component: KnownFacts,
|
|
14
|
+
parameters: {
|
|
15
|
+
controls: { expanded: true },
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof KnownFacts>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const WithRealDataLocalhost: Story = {
|
|
23
|
+
render: args => (
|
|
24
|
+
<AlertProvider defaultDuration={5000}>
|
|
25
|
+
<KnownFacts
|
|
26
|
+
{...args}
|
|
27
|
+
// @ts-expect-error storybook live demo memori shape
|
|
28
|
+
memori={{
|
|
29
|
+
memoriName: 'test memori',
|
|
30
|
+
ownerUserName: 'nicola',
|
|
31
|
+
memoriID: '1a9c75e8-57aa-4ce3-8ea5-256185fa79a7',
|
|
32
|
+
ownerUserID: '04a8cff9-13d6-4367-9cb2-72b9af9ee494',
|
|
33
|
+
tenantID: 'app.memorytwin.com',
|
|
34
|
+
apiURL: 'http://localhost:7778',
|
|
35
|
+
baseURL: 'http://localhost:3000',
|
|
36
|
+
uiLang: 'EN',
|
|
37
|
+
lang: 'IT',
|
|
38
|
+
layout: 'FULLPAGE',
|
|
39
|
+
showShare: 'true',
|
|
40
|
+
}}
|
|
41
|
+
sessionID="5841f5f9-3315-4a5a-9b62-33b13d5a27fd"
|
|
42
|
+
closeDrawer={() => {}}
|
|
43
|
+
apiClient={memoriApiClient()}
|
|
44
|
+
/>
|
|
45
|
+
</AlertProvider>
|
|
46
|
+
),
|
|
47
|
+
args: {
|
|
48
|
+
visible: true,
|
|
49
|
+
},
|
|
50
|
+
};
|
package/src/Showcase.stories.tsx
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
dialogState,
|
|
17
17
|
knownFact,
|
|
18
18
|
expertReference,
|
|
19
|
-
venue,
|
|
20
19
|
} from './mocks/data';
|
|
21
20
|
|
|
22
21
|
// Components
|
|
@@ -36,14 +35,11 @@ import Blob from './components/Blob/Blob';
|
|
|
36
35
|
import MicrophoneButton from './components/MicrophoneButton/MicrophoneButton';
|
|
37
36
|
import Typing from './components/Typing/Typing';
|
|
38
37
|
import ChangeMode from './components/ChangeMode/ChangeMode';
|
|
39
|
-
import DateSelector from './components/DateSelector/DateSelector';
|
|
40
38
|
import AgeVerificationModal from './components/AgeVerificationModal/AgeVerificationModal';
|
|
41
|
-
import VenueWidget from './components/VenueWidget/VenueWidget';
|
|
42
39
|
import SendOnEnterMenu from './components/SendOnEnterMenu/SendOnEnterMenu';
|
|
43
40
|
import ExpertsDrawer from './components/ExpertsDrawer/ExpertsDrawer';
|
|
44
41
|
import SettingsDrawer from './components/SettingsDrawer/SettingsDrawer';
|
|
45
42
|
import LoginDrawer from './components/LoginDrawer/LoginDrawer';
|
|
46
|
-
import FilePreview from './components/FilePreview/FilePreview';
|
|
47
43
|
import MediaWidget from './components/MediaWidget/MediaWidget';
|
|
48
44
|
import MediaItemWidget from './components/MediaWidget/MediaItemWidget';
|
|
49
45
|
|
|
@@ -63,13 +59,10 @@ import './components/WhyThisAnswer/WhyThisAnswer.css';
|
|
|
63
59
|
import './components/Blob/Blob.css';
|
|
64
60
|
import './components/MicrophoneButton/MicrophoneButton.css';
|
|
65
61
|
import './components/ChangeMode/ChangeMode.css';
|
|
66
|
-
import './components/DateSelector/DateSelector.css';
|
|
67
|
-
import './components/VenueWidget/VenueWidget.css';
|
|
68
62
|
import './components/SendOnEnterMenu/SendOnEnterMenu.css';
|
|
69
63
|
import './components/ExpertsDrawer/ExpertsDrawer.css';
|
|
70
64
|
import './components/SettingsDrawer/SettingsDrawer.css';
|
|
71
65
|
import './components/LoginDrawer/LoginDrawer.css';
|
|
72
|
-
import './components/FilePreview/FilePreview.css';
|
|
73
66
|
import './components/MediaWidget/MediaWidget.css';
|
|
74
67
|
import './components/MediaWidget/MediaItemWidget.css';
|
|
75
68
|
|
|
@@ -90,7 +83,7 @@ const titleStyle: React.CSSProperties = {
|
|
|
90
83
|
|
|
91
84
|
|
|
92
85
|
const meta: Meta = {
|
|
93
|
-
title: 'Showcase
|
|
86
|
+
title: 'Internals/Showcase',
|
|
94
87
|
parameters: {
|
|
95
88
|
layout: 'fullscreen',
|
|
96
89
|
controls: { expanded: false },
|
|
@@ -110,14 +103,10 @@ export const AllComponentsWithAllPropsEnabled: Story = () => {
|
|
|
110
103
|
const [sendOnEnter, setSendOnEnter] = useState<'keypress' | 'click'>(
|
|
111
104
|
'keypress'
|
|
112
105
|
);
|
|
113
|
-
const [venueState, setVenueState] = useState(venue);
|
|
114
106
|
const [listening, setListening] = useState(false);
|
|
115
107
|
const [userMessage, setUserMessage] = useState(
|
|
116
108
|
'Sample message with all features enabled'
|
|
117
109
|
);
|
|
118
|
-
const [previewFiles, setPreviewFiles] = useState<
|
|
119
|
-
{ name: string; id: string; content: string }[]
|
|
120
|
-
>([]);
|
|
121
110
|
const [showAgeVerificationModal, setShowAgeVerificationModal] = useState(false);
|
|
122
111
|
|
|
123
112
|
const integrationConfig = integration?.customData
|
|
@@ -468,9 +457,9 @@ export const AllComponentsWithAllPropsEnabled: Story = () => {
|
|
|
468
457
|
/>
|
|
469
458
|
</section>
|
|
470
459
|
|
|
471
|
-
{/*
|
|
460
|
+
{/* AgeVerificationModal */}
|
|
472
461
|
<section style={sectionStyle}>
|
|
473
|
-
<h2 style={titleStyle}>
|
|
462
|
+
<h2 style={titleStyle}>AgeVerificationModal</h2>
|
|
474
463
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
475
464
|
<div>
|
|
476
465
|
<Button
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/*
|
|
2
|
-
.memori-modal__backdrop.age-verification-modal-backdrop,
|
|
3
|
-
.age-verification-modal.memori-modal__viewport,
|
|
4
|
-
.age-verification-modal {
|
|
5
|
-
z-index: 2147483647;
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
/* Age verification uses Modal stacking="stacked"; keep backdrop tint only. */
|
|
8
2
|
.memori-modal__backdrop.age-verification-modal-backdrop {
|
|
9
3
|
background: color-mix(in srgb, #000 45%, transparent);
|
|
10
4
|
}
|
|
@@ -7,7 +7,7 @@ import './AgeVerificationModal.css';
|
|
|
7
7
|
import { AlertProvider } from '@memori.ai/ui';
|
|
8
8
|
|
|
9
9
|
const meta: Meta = {
|
|
10
|
-
title: 'AgeVerificationModal',
|
|
10
|
+
title: 'Surfaces/AgeVerificationModal',
|
|
11
11
|
component: AgeVerificationModal,
|
|
12
12
|
parameters: {
|
|
13
13
|
controls: { expanded: true },
|
|
@@ -78,6 +78,7 @@ const AgeVerificationModal = ({ visible = false, onClose, minAge }: Props) => {
|
|
|
78
78
|
open={visible}
|
|
79
79
|
width="600px"
|
|
80
80
|
widthMd="600px"
|
|
81
|
+
stacking="stacked"
|
|
81
82
|
title={t('ageVerification')}
|
|
82
83
|
className="age-verification-modal"
|
|
83
84
|
backdropClassName="age-verification-modal-backdrop"
|
|
@@ -52,10 +52,17 @@ input.memori-auth-widget--input:focus {
|
|
|
52
52
|
|
|
53
53
|
.memori-auth-widget--error {
|
|
54
54
|
padding: var(--memori-spacing-lg) var(--memori-spacing-xl);
|
|
55
|
-
border: 1px solid
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
border: 1px solid #ef4444;
|
|
56
|
+
border-radius: var(--memori-radius-box);
|
|
57
|
+
margin-top: var(--memori-spacing-sm);
|
|
58
58
|
margin-bottom: var(--memori-spacing-lg);
|
|
59
|
-
background-color:
|
|
60
|
-
color:
|
|
59
|
+
background-color: #fee2e2;
|
|
60
|
+
color: #991b1b;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-theme='dark'] .memori-auth-widget--error,
|
|
64
|
+
.memori-widget[data-theme='dark'] .memori-auth-widget--error {
|
|
65
|
+
border-color: #f87171;
|
|
66
|
+
background-color: color-mix(in srgb, #ef4444 18%, var(--memori-main-background, #1f2937));
|
|
67
|
+
color: #fecaca;
|
|
61
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import Auth from './Auth';
|
|
4
4
|
|
|
5
5
|
it('renders Auth unchanged', () => {
|
|
@@ -61,3 +61,70 @@ it('renders Auth with modal unchanged', () => {
|
|
|
61
61
|
);
|
|
62
62
|
expect(container).toMatchSnapshot();
|
|
63
63
|
});
|
|
64
|
+
|
|
65
|
+
it('submits the password via onFinish', async () => {
|
|
66
|
+
const onFinish = jest.fn().mockResolvedValue(undefined);
|
|
67
|
+
const { container } = render(
|
|
68
|
+
<Auth
|
|
69
|
+
pwdOrTokens="password"
|
|
70
|
+
setPwdOrTokens={() => {}}
|
|
71
|
+
showTokens={false}
|
|
72
|
+
onFinish={onFinish}
|
|
73
|
+
withModal={false}
|
|
74
|
+
openModal
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const input = container.querySelector('#auth-password') as HTMLInputElement;
|
|
79
|
+
fireEvent.change(input, { target: { value: 'secret-pin' } });
|
|
80
|
+
fireEvent.click(screen.getByRole('button', { name: 'confirm' }));
|
|
81
|
+
|
|
82
|
+
await waitFor(() => {
|
|
83
|
+
expect(onFinish).toHaveBeenCalledWith(
|
|
84
|
+
expect.objectContaining({ password: 'secret-pin' })
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('shows a visible error when credentials are invalid', async () => {
|
|
90
|
+
const onFinish = jest.fn().mockRejectedValue(new Error('AUTH_FAILED'));
|
|
91
|
+
const { container } = render(
|
|
92
|
+
<Auth
|
|
93
|
+
pwdOrTokens="password"
|
|
94
|
+
setPwdOrTokens={() => {}}
|
|
95
|
+
showTokens={false}
|
|
96
|
+
onFinish={onFinish}
|
|
97
|
+
withModal={false}
|
|
98
|
+
openModal
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const input = container.querySelector('#auth-password') as HTMLInputElement;
|
|
103
|
+
fireEvent.change(input, { target: { value: 'wrong' } });
|
|
104
|
+
fireEvent.click(screen.getByRole('button', { name: 'confirm' }));
|
|
105
|
+
|
|
106
|
+
expect(await screen.findByRole('alert')).toHaveTextContent(
|
|
107
|
+
'auth.invalidCredentials'
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('shows a visible error when password is missing', async () => {
|
|
112
|
+
const onFinish = jest.fn();
|
|
113
|
+
const { container } = render(
|
|
114
|
+
<Auth
|
|
115
|
+
pwdOrTokens="password"
|
|
116
|
+
setPwdOrTokens={() => {}}
|
|
117
|
+
showTokens={false}
|
|
118
|
+
onFinish={onFinish}
|
|
119
|
+
withModal={false}
|
|
120
|
+
openModal
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
fireEvent.click(screen.getByRole('button', { name: 'confirm' }));
|
|
125
|
+
|
|
126
|
+
expect(await screen.findByRole('alert')).toHaveTextContent(
|
|
127
|
+
'auth.passwordRequired'
|
|
128
|
+
);
|
|
129
|
+
expect(onFinish).not.toHaveBeenCalled();
|
|
130
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button, Input, Modal
|
|
4
|
-
import { useForm, SubmitHandler } from 'react-hook-form';
|
|
3
|
+
import { Button, Input, Modal } from '@memori.ai/ui';
|
|
5
4
|
import { Plus } from 'lucide-react';
|
|
6
5
|
import { useWidgetSurfaceEl } from '../../context/widgetSurfaceContext';
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ export interface Props {
|
|
|
15
14
|
openModal?: boolean;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
type AuthInputs = {
|
|
17
|
+
export type AuthInputs = {
|
|
19
18
|
password?: string;
|
|
20
19
|
tokens?: string[];
|
|
21
20
|
};
|
|
@@ -35,57 +34,52 @@ export const AuthWidget = ({
|
|
|
35
34
|
}: Props) => {
|
|
36
35
|
const surfaceEl = useWidgetSurfaceEl();
|
|
37
36
|
const { t } = useTranslation();
|
|
38
|
-
const {
|
|
39
|
-
register,
|
|
40
|
-
handleSubmit,
|
|
41
|
-
formState: { errors },
|
|
42
|
-
setError,
|
|
43
|
-
} = useForm<AuthInputs>();
|
|
44
37
|
const [numTokens, setNumTokens] = useState(1);
|
|
45
|
-
|
|
38
|
+
const [passwordValue, setPasswordValue] = useState('');
|
|
39
|
+
const [tokenValues, setTokenValues] = useState<string[]>(['']);
|
|
46
40
|
const [showModal, setShowModal] = useState(!!pwdOrTokens);
|
|
47
41
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
42
|
+
const [passwordError, setPasswordError] = useState<string | null>(null);
|
|
43
|
+
const [tokensError, setTokensError] = useState<string | null>(null);
|
|
48
44
|
|
|
49
|
-
const onSubmit:
|
|
50
|
-
|
|
45
|
+
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
const missingPassword = pwdOrTokens === 'password' && !passwordValue.length;
|
|
48
|
+
const filledTokens = tokenValues.slice(0, numTokens);
|
|
51
49
|
const invalidTokens =
|
|
52
50
|
pwdOrTokens === 'tokens' &&
|
|
53
|
-
(
|
|
54
|
-
!
|
|
51
|
+
(filledTokens.length < minimumNumberOfRecoveryTokens ||
|
|
52
|
+
!filledTokens.every(tok => tok.length));
|
|
55
53
|
|
|
56
54
|
if (missingPassword) {
|
|
57
|
-
|
|
58
|
-
type: 'required',
|
|
59
|
-
message: t('auth.passwordRequired') || 'Password required',
|
|
60
|
-
});
|
|
55
|
+
setPasswordError(t('auth.passwordRequired') || 'Password required');
|
|
61
56
|
return;
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
if (invalidTokens) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
60
|
+
setTokensError(
|
|
61
|
+
`${t('auth.atLeast') || 'At least'} ${minimumNumberOfRecoveryTokens}`
|
|
62
|
+
);
|
|
69
63
|
return;
|
|
70
64
|
}
|
|
71
65
|
|
|
72
66
|
if (onFinish) {
|
|
73
67
|
setIsSubmitting(true);
|
|
74
|
-
|
|
68
|
+
setPasswordError(null);
|
|
69
|
+
setTokensError(null);
|
|
70
|
+
onFinish({
|
|
71
|
+
password: passwordValue,
|
|
72
|
+
tokens: pwdOrTokens === 'tokens' ? filledTokens : undefined,
|
|
73
|
+
})
|
|
75
74
|
.then(() => {
|
|
76
75
|
setShowModal(false);
|
|
77
76
|
})
|
|
78
77
|
.catch(() => {
|
|
78
|
+
const message = t('auth.invalidCredentials') || 'Invalid credentials';
|
|
79
79
|
if (pwdOrTokens === 'password') {
|
|
80
|
-
|
|
81
|
-
type: 'auth',
|
|
82
|
-
message: t('auth.invalidCredentials') || 'Invalid credentials',
|
|
83
|
-
});
|
|
80
|
+
setPasswordError(message);
|
|
84
81
|
} else if (pwdOrTokens === 'tokens') {
|
|
85
|
-
|
|
86
|
-
type: 'auth',
|
|
87
|
-
message: t('auth.invalidCredentials') || 'Invalid credentials',
|
|
88
|
-
});
|
|
82
|
+
setTokensError(message);
|
|
89
83
|
}
|
|
90
84
|
})
|
|
91
85
|
.finally(() => {
|
|
@@ -95,10 +89,11 @@ export const AuthWidget = ({
|
|
|
95
89
|
};
|
|
96
90
|
|
|
97
91
|
const form = (
|
|
98
|
-
<
|
|
92
|
+
<form
|
|
99
93
|
name="auth"
|
|
100
|
-
onSubmit={
|
|
94
|
+
onSubmit={onSubmit}
|
|
101
95
|
className="memori-auth-widget--form"
|
|
96
|
+
noValidate
|
|
102
97
|
>
|
|
103
98
|
{(pwdOrTokens === 'password' || !showTokens) && (
|
|
104
99
|
<fieldset className="memori-auth-widget--password-fieldset">
|
|
@@ -106,17 +101,26 @@ export const AuthWidget = ({
|
|
|
106
101
|
Password:{' '}
|
|
107
102
|
<Input
|
|
108
103
|
id="auth-password"
|
|
104
|
+
name="password"
|
|
109
105
|
className="memori-auth-widget--input"
|
|
110
|
-
required
|
|
111
106
|
type="password"
|
|
112
107
|
placeholder="Password"
|
|
113
|
-
|
|
108
|
+
autoComplete="current-password"
|
|
109
|
+
value={passwordValue}
|
|
110
|
+
onChange={e => {
|
|
111
|
+
setPasswordValue(e.target.value);
|
|
112
|
+
if (passwordError) setPasswordError(null);
|
|
113
|
+
}}
|
|
114
114
|
/>
|
|
115
115
|
</label>
|
|
116
116
|
{showTokens && (
|
|
117
117
|
<>
|
|
118
118
|
<hr />
|
|
119
|
-
<Button
|
|
119
|
+
<Button
|
|
120
|
+
type="button"
|
|
121
|
+
variant="outline"
|
|
122
|
+
onClick={() => setPwdOrTokens('tokens')}
|
|
123
|
+
>
|
|
120
124
|
{t('auth.useRecoveryTokens') || 'Recovery tokens'}
|
|
121
125
|
</Button>
|
|
122
126
|
</>
|
|
@@ -139,24 +143,35 @@ export const AuthWidget = ({
|
|
|
139
143
|
type="password"
|
|
140
144
|
className="memori-auth-widget--input"
|
|
141
145
|
placeholder="Recovery token"
|
|
142
|
-
required
|
|
143
146
|
autoComplete="off"
|
|
147
|
+
name={`tokens.${idx}`}
|
|
144
148
|
aria-label={String(
|
|
145
149
|
t('auth.tokenNumber', {
|
|
146
150
|
defaultValue: 'Recovery token {{number}}',
|
|
147
151
|
number: idx + 1,
|
|
148
152
|
})
|
|
149
153
|
)}
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
value={tokenValues[idx] ?? ''}
|
|
155
|
+
onChange={e => {
|
|
156
|
+
const value = e.target.value;
|
|
157
|
+
setTokenValues(prev => {
|
|
158
|
+
const next = [...prev];
|
|
159
|
+
next[idx] = value;
|
|
160
|
+
return next;
|
|
161
|
+
});
|
|
162
|
+
if (tokensError) setTokensError(null);
|
|
163
|
+
}}
|
|
153
164
|
/>
|
|
154
165
|
</label>
|
|
155
166
|
);
|
|
156
167
|
})}
|
|
157
168
|
|
|
158
169
|
<Button
|
|
159
|
-
|
|
170
|
+
type="button"
|
|
171
|
+
onClick={() => {
|
|
172
|
+
setNumTokens(n => n + 1);
|
|
173
|
+
setTokenValues(prev => [...prev, '']);
|
|
174
|
+
}}
|
|
160
175
|
className="memori-auth-widget--token-add"
|
|
161
176
|
icon={<Plus />}
|
|
162
177
|
>
|
|
@@ -164,26 +179,24 @@ export const AuthWidget = ({
|
|
|
164
179
|
</Button>
|
|
165
180
|
|
|
166
181
|
<hr />
|
|
167
|
-
<Button
|
|
182
|
+
<Button
|
|
183
|
+
type="button"
|
|
184
|
+
variant="outline"
|
|
185
|
+
onClick={() => setPwdOrTokens('password')}
|
|
186
|
+
>
|
|
168
187
|
{t('auth.usePassword') || 'Password'}
|
|
169
188
|
</Button>
|
|
170
189
|
</fieldset>
|
|
171
190
|
)}
|
|
172
191
|
|
|
173
|
-
{
|
|
174
|
-
<div role="alert" className="memori-auth-widget--error">
|
|
175
|
-
{t('auth.atLeast') || 'At least'} {minimumNumberOfRecoveryTokens}
|
|
176
|
-
</div>
|
|
177
|
-
)}
|
|
178
|
-
|
|
179
|
-
{errors.password?.type === 'auth' && (
|
|
192
|
+
{passwordError && (
|
|
180
193
|
<div role="alert" className="memori-auth-widget--error">
|
|
181
|
-
{
|
|
194
|
+
{passwordError}
|
|
182
195
|
</div>
|
|
183
196
|
)}
|
|
184
|
-
{
|
|
197
|
+
{tokensError && (
|
|
185
198
|
<div role="alert" className="memori-auth-widget--error">
|
|
186
|
-
{
|
|
199
|
+
{tokensError}
|
|
187
200
|
</div>
|
|
188
201
|
)}
|
|
189
202
|
|
|
@@ -195,7 +208,7 @@ export const AuthWidget = ({
|
|
|
195
208
|
>
|
|
196
209
|
{t('confirm') || 'Submit'}
|
|
197
210
|
</Button>
|
|
198
|
-
</
|
|
211
|
+
</form>
|
|
199
212
|
);
|
|
200
213
|
|
|
201
214
|
return withModal ? (
|
|
@@ -204,7 +217,9 @@ export const AuthWidget = ({
|
|
|
204
217
|
open={openModal || showModal}
|
|
205
218
|
title={t('auth.title') || 'Authentication'}
|
|
206
219
|
closable={true}
|
|
207
|
-
onOpenChange={
|
|
220
|
+
onOpenChange={open => {
|
|
221
|
+
if (!open) setPwdOrTokens(null);
|
|
222
|
+
}}
|
|
208
223
|
>
|
|
209
224
|
{form}
|
|
210
225
|
</Modal>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`renders Auth on tokens unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<form
|
|
6
|
-
class="memori-
|
|
6
|
+
class="memori-auth-widget--form"
|
|
7
7
|
name="auth"
|
|
8
8
|
novalidate=""
|
|
9
9
|
>
|
|
@@ -30,7 +30,6 @@ exports[`renders Auth on tokens unchanged 1`] = `
|
|
|
30
30
|
id="base-ui-:r2:"
|
|
31
31
|
name="tokens.0"
|
|
32
32
|
placeholder="Recovery token"
|
|
33
|
-
required=""
|
|
34
33
|
type="password"
|
|
35
34
|
value=""
|
|
36
35
|
/>
|
|
@@ -100,7 +99,7 @@ exports[`renders Auth on tokens unchanged 1`] = `
|
|
|
100
99
|
exports[`renders Auth unchanged 1`] = `
|
|
101
100
|
<div>
|
|
102
101
|
<form
|
|
103
|
-
class="memori-
|
|
102
|
+
class="memori-auth-widget--form"
|
|
104
103
|
name="auth"
|
|
105
104
|
novalidate=""
|
|
106
105
|
>
|
|
@@ -113,11 +112,11 @@ exports[`renders Auth unchanged 1`] = `
|
|
|
113
112
|
Password:
|
|
114
113
|
|
|
115
114
|
<input
|
|
115
|
+
autocomplete="current-password"
|
|
116
116
|
class="memori-input memori-input--default memori-input--md memori-auth-widget--input"
|
|
117
117
|
id="auth-password"
|
|
118
118
|
name="password"
|
|
119
119
|
placeholder="Password"
|
|
120
|
-
required=""
|
|
121
120
|
type="password"
|
|
122
121
|
value=""
|
|
123
122
|
/>
|
|
@@ -148,7 +147,7 @@ exports[`renders Auth with modal unchanged 1`] = `
|
|
|
148
147
|
exports[`renders Auth with tokens unchanged 1`] = `
|
|
149
148
|
<div>
|
|
150
149
|
<form
|
|
151
|
-
class="memori-
|
|
150
|
+
class="memori-auth-widget--form"
|
|
152
151
|
name="auth"
|
|
153
152
|
novalidate=""
|
|
154
153
|
>
|
|
@@ -161,11 +160,11 @@ exports[`renders Auth with tokens unchanged 1`] = `
|
|
|
161
160
|
Password:
|
|
162
161
|
|
|
163
162
|
<input
|
|
163
|
+
autocomplete="current-password"
|
|
164
164
|
class="memori-input memori-input--default memori-input--md memori-auth-widget--input"
|
|
165
165
|
id="auth-password"
|
|
166
166
|
name="password"
|
|
167
167
|
placeholder="Password"
|
|
168
|
-
required=""
|
|
169
168
|
type="password"
|
|
170
169
|
value=""
|
|
171
170
|
/>
|