@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
|
@@ -24,6 +24,11 @@ export interface UseNatsOptions {
|
|
|
24
24
|
onDialogResponse?: (event: NatsDialogResponseEvent) => void;
|
|
25
25
|
/** `error` events (logging / user notification). */
|
|
26
26
|
onError?: (event: NatsErrorEvent) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Reconcile a pending turn from the engine after a resumed or reauthenticated
|
|
29
|
+
* subscription is installed.
|
|
30
|
+
*/
|
|
31
|
+
onCatchUp?: () => void | Promise<void>;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/**
|
|
@@ -38,6 +43,7 @@ export function useNats({
|
|
|
38
43
|
onProgress,
|
|
39
44
|
onDialogResponse,
|
|
40
45
|
onError,
|
|
46
|
+
onCatchUp,
|
|
41
47
|
}: UseNatsOptions) {
|
|
42
48
|
const [config, setConfig] = useState<NatsConfig | null>(null);
|
|
43
49
|
const [configError, setConfigError] = useState<Error | null>(null);
|
|
@@ -46,33 +52,42 @@ export function useNats({
|
|
|
46
52
|
const onProgressRef = useRef(onProgress);
|
|
47
53
|
const onDialogResponseRef = useRef(onDialogResponse);
|
|
48
54
|
const onErrorRef = useRef(onError);
|
|
55
|
+
const onCatchUpRef = useRef(onCatchUp);
|
|
56
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
57
|
+
const catchUpAfterConnectRef = useRef(false);
|
|
58
|
+
const refreshInFlightRef = useRef(false);
|
|
59
|
+
const lastAuthRefreshRef = useRef(0);
|
|
49
60
|
useEffect(() => {
|
|
50
61
|
onProgressRef.current = onProgress;
|
|
51
62
|
onDialogResponseRef.current = onDialogResponse;
|
|
52
63
|
onErrorRef.current = onError;
|
|
53
|
-
|
|
64
|
+
onCatchUpRef.current = onCatchUp;
|
|
65
|
+
}, [onProgress, onDialogResponse, onError, onCatchUp]);
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
67
|
+
const refreshConfig = useCallback(
|
|
68
|
+
async (reason: 'initial' | 'resume' | 'auth') => {
|
|
69
|
+
if (!sessionId || refreshInFlightRef.current) return;
|
|
70
|
+
if (reason === 'auth' && Date.now() - lastAuthRefreshRef.current < 5000) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
refreshInFlightRef.current = true;
|
|
75
|
+
if (reason === 'auth') lastAuthRefreshRef.current = Date.now();
|
|
76
|
+
abortRef.current?.abort();
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
abortRef.current = controller;
|
|
79
|
+
|
|
80
|
+
console.info(
|
|
81
|
+
'[NATS] fetching config from',
|
|
82
|
+
`${baseUrl}/api/nats`,
|
|
83
|
+
'for session',
|
|
84
|
+
sessionId,
|
|
85
|
+
`(${reason})`
|
|
86
|
+
);
|
|
87
|
+
try {
|
|
88
|
+
const cfg = await getNatsConfig(baseUrl, sessionId, controller.signal);
|
|
89
|
+
if (!controller.signal.aborted) {
|
|
90
|
+
catchUpAfterConnectRef.current = reason !== 'initial';
|
|
76
91
|
console.info('[NATS] config received', {
|
|
77
92
|
url: cfg.url,
|
|
78
93
|
jetStream: !!cfg.stream,
|
|
@@ -81,20 +96,65 @@ export function useNats({
|
|
|
81
96
|
setConfig(cfg);
|
|
82
97
|
setConfigError(null);
|
|
83
98
|
}
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
if (!cancelled && err?.name !== 'AbortError') {
|
|
99
|
+
} catch (err: any) {
|
|
100
|
+
if (!controller.signal.aborted && err?.name !== 'AbortError') {
|
|
87
101
|
console.error('[NATS] config error', err);
|
|
88
102
|
setConfig(null);
|
|
89
103
|
setConfigError(err instanceof Error ? err : new Error(String(err)));
|
|
90
104
|
}
|
|
91
|
-
}
|
|
105
|
+
} finally {
|
|
106
|
+
if (abortRef.current === controller) {
|
|
107
|
+
abortRef.current = null;
|
|
108
|
+
refreshInFlightRef.current = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[baseUrl, sessionId]
|
|
113
|
+
);
|
|
92
114
|
|
|
115
|
+
// Fetch connection config whenever the active session changes.
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!sessionId) {
|
|
118
|
+
console.debug('[NATS] no sessionId, skipping config fetch');
|
|
119
|
+
setConfig(null);
|
|
120
|
+
setConfigError(null);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void refreshConfig('initial');
|
|
93
125
|
return () => {
|
|
94
|
-
|
|
95
|
-
|
|
126
|
+
abortRef.current?.abort();
|
|
127
|
+
abortRef.current = null;
|
|
128
|
+
refreshInFlightRef.current = false;
|
|
96
129
|
};
|
|
97
|
-
}, [
|
|
130
|
+
}, [sessionId, refreshConfig]);
|
|
131
|
+
|
|
132
|
+
// A suspended browser may lose core NATS messages. Refresh the short-lived
|
|
133
|
+
// JWT, reconnect, then reconcile the pending turn from the engine.
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (!sessionId) return;
|
|
136
|
+
|
|
137
|
+
const requestResume = () => {
|
|
138
|
+
if (document.visibilityState === 'visible') {
|
|
139
|
+
void refreshConfig('resume');
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const onVisibilityChange = () => {
|
|
143
|
+
if (document.visibilityState === 'visible') requestResume();
|
|
144
|
+
};
|
|
145
|
+
const onPageShow = (event: PageTransitionEvent) => {
|
|
146
|
+
if (event.persisted) requestResume();
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
150
|
+
window.addEventListener('online', requestResume);
|
|
151
|
+
window.addEventListener('pageshow', onPageShow);
|
|
152
|
+
return () => {
|
|
153
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
154
|
+
window.removeEventListener('online', requestResume);
|
|
155
|
+
window.removeEventListener('pageshow', onPageShow);
|
|
156
|
+
};
|
|
157
|
+
}, [sessionId, refreshConfig]);
|
|
98
158
|
|
|
99
159
|
const handleMessage = useCallback((event: NatsSessionEvent) => {
|
|
100
160
|
console.debug('[NATS] dispatching event', { eventType: event.eventType });
|
|
@@ -113,7 +173,27 @@ export function useNats({
|
|
|
113
173
|
}
|
|
114
174
|
}, []);
|
|
115
175
|
|
|
116
|
-
|
|
176
|
+
const handleConnected = useCallback(() => {
|
|
177
|
+
if (!catchUpAfterConnectRef.current) return;
|
|
178
|
+
catchUpAfterConnectRef.current = false;
|
|
179
|
+
void onCatchUpRef.current?.();
|
|
180
|
+
}, []);
|
|
181
|
+
|
|
182
|
+
const handleAuthError = useCallback(
|
|
183
|
+
(error: Error) => {
|
|
184
|
+
console.warn(
|
|
185
|
+
'[NATS] JWT rejected or expired; refreshing credentials',
|
|
186
|
+
error
|
|
187
|
+
);
|
|
188
|
+
void refreshConfig('auth');
|
|
189
|
+
},
|
|
190
|
+
[refreshConfig]
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
useNatsSession(sessionId, config ?? undefined, handleMessage, {
|
|
194
|
+
onConnected: handleConnected,
|
|
195
|
+
onAuthError: handleAuthError,
|
|
196
|
+
});
|
|
117
197
|
|
|
118
198
|
return {
|
|
119
199
|
/** True once connection config has been retrieved. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AuthorizationError } from '@nats-io/nats-core';
|
|
2
|
+
import { isNatsAuthError } from './useNatsSession';
|
|
3
|
+
|
|
4
|
+
describe('isNatsAuthError', () => {
|
|
5
|
+
it('recognizes typed NATS authorization failures', () => {
|
|
6
|
+
expect(isNatsAuthError(new AuthorizationError('test'))).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('recognizes the server authorization violation message', () => {
|
|
10
|
+
expect(isNatsAuthError(new Error('Authorization Violation'))).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('does not classify unrelated connection failures as auth failures', () => {
|
|
14
|
+
expect(isNatsAuthError(new Error('connection refused'))).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
// The cleanup (`consumerMessages.stop()` + `nc.close()`) is essential: without
|
|
12
12
|
// it, every `sessionId` change would leave orphan connections / iterators.
|
|
13
13
|
import { useEffect, useRef, useState, type MutableRefObject } from 'react';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
wsconnect,
|
|
16
|
+
jwtAuthenticator,
|
|
17
|
+
AuthorizationError,
|
|
18
|
+
NatsConnection,
|
|
19
|
+
UserAuthenticationExpiredError,
|
|
20
|
+
} from '@nats-io/nats-core';
|
|
15
21
|
import {
|
|
16
22
|
jetstream,
|
|
17
23
|
DeliverPolicy,
|
|
@@ -66,6 +72,24 @@ export type NatsSessionEvent =
|
|
|
66
72
|
|
|
67
73
|
type JetStreamConsumeMode = 'live' | 'catch-up';
|
|
68
74
|
|
|
75
|
+
export interface NatsSessionLifecycle {
|
|
76
|
+
/** Called after the live subscription is installed. */
|
|
77
|
+
onConnected?: () => void;
|
|
78
|
+
/** Called once when this connection is rejected because its JWT expired. */
|
|
79
|
+
onAuthError?: (error: Error) => void;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function isNatsAuthError(error: unknown): error is Error {
|
|
83
|
+
return (
|
|
84
|
+
error instanceof AuthorizationError ||
|
|
85
|
+
error instanceof UserAuthenticationExpiredError ||
|
|
86
|
+
(error instanceof Error &&
|
|
87
|
+
/authorization violation|authentication expired|user authentication expired/i.test(
|
|
88
|
+
error.message
|
|
89
|
+
))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
69
93
|
function readString(
|
|
70
94
|
raw: Record<string, unknown>,
|
|
71
95
|
camelKey: string,
|
|
@@ -107,7 +131,9 @@ function unwrapDialogState(value: unknown): unknown {
|
|
|
107
131
|
/**
|
|
108
132
|
* Normalizes raw NATS payloads (snake_case or camelCase) into typed events.
|
|
109
133
|
*/
|
|
110
|
-
export function normalizeNatsEvent(
|
|
134
|
+
export function normalizeNatsEvent(
|
|
135
|
+
raw: Record<string, unknown>
|
|
136
|
+
): NatsSessionEvent {
|
|
111
137
|
const eventType = (readString(raw, 'eventType', 'event_type') ??
|
|
112
138
|
'unknown') as NatsSessionEvent['eventType'];
|
|
113
139
|
|
|
@@ -130,8 +156,7 @@ export function normalizeNatsEvent(raw: Record<string, unknown>): NatsSessionEve
|
|
|
130
156
|
if (eventType === 'dialog_text_entered_response') {
|
|
131
157
|
return {
|
|
132
158
|
eventType: 'dialog_text_entered_response',
|
|
133
|
-
requestID:
|
|
134
|
-
typeof raw.requestID === 'string' ? raw.requestID : undefined,
|
|
159
|
+
requestID: typeof raw.requestID === 'string' ? raw.requestID : undefined,
|
|
135
160
|
resultCode:
|
|
136
161
|
typeof raw.resultCode === 'number' ? raw.resultCode : undefined,
|
|
137
162
|
resultMessage:
|
|
@@ -144,7 +169,10 @@ export function normalizeNatsEvent(raw: Record<string, unknown>): NatsSessionEve
|
|
|
144
169
|
if (eventType === 'error') {
|
|
145
170
|
return {
|
|
146
171
|
eventType: 'error',
|
|
147
|
-
errorCode: (raw.errorCode ?? raw.error_code) as
|
|
172
|
+
errorCode: (raw.errorCode ?? raw.error_code) as
|
|
173
|
+
| string
|
|
174
|
+
| number
|
|
175
|
+
| undefined,
|
|
148
176
|
errorMessage: readString(raw, 'errorMessage', 'error_message'),
|
|
149
177
|
backtrace: typeof raw.backtrace === 'string' ? raw.backtrace : undefined,
|
|
150
178
|
correlationID,
|
|
@@ -174,10 +202,12 @@ function decodeMessage(
|
|
|
174
202
|
async function consumeCoreSubscription(
|
|
175
203
|
nc: NatsConnection,
|
|
176
204
|
subject: string,
|
|
177
|
-
onMessage: (event: NatsSessionEvent) => void
|
|
205
|
+
onMessage: (event: NatsSessionEvent) => void,
|
|
206
|
+
onReady: () => void
|
|
178
207
|
) {
|
|
179
208
|
const sub = nc.subscribe(subject);
|
|
180
209
|
console.info('[NATS] subscribed to subject', subject);
|
|
210
|
+
onReady();
|
|
181
211
|
let received = 0;
|
|
182
212
|
for await (const msg of sub) {
|
|
183
213
|
received += 1;
|
|
@@ -203,7 +233,8 @@ async function consumeJetStream(
|
|
|
203
233
|
subject: string,
|
|
204
234
|
mode: JetStreamConsumeMode,
|
|
205
235
|
onMessage: (event: NatsSessionEvent) => void,
|
|
206
|
-
setConsumerMessages: (messages: ConsumerMessages) => void
|
|
236
|
+
setConsumerMessages: (messages: ConsumerMessages) => void,
|
|
237
|
+
onReady: () => void
|
|
207
238
|
) {
|
|
208
239
|
const js = jetstream(nc);
|
|
209
240
|
const consumer = config.consumer
|
|
@@ -225,6 +256,7 @@ async function consumeJetStream(
|
|
|
225
256
|
|
|
226
257
|
const messages = await consumer.consume();
|
|
227
258
|
setConsumerMessages(messages);
|
|
259
|
+
onReady();
|
|
228
260
|
let received = 0;
|
|
229
261
|
for await (const msg of messages) {
|
|
230
262
|
received += 1;
|
|
@@ -258,17 +290,19 @@ function closeNatsSession(
|
|
|
258
290
|
* change.
|
|
259
291
|
*
|
|
260
292
|
* @param sessionId Current session UUID (subscription is skipped when falsy).
|
|
261
|
-
* @param config Connection config from `/api/nats` (url +
|
|
293
|
+
* @param config Connection config from `/api/nats` (url + per-session JWT).
|
|
262
294
|
* @param onMessage Callback invoked for each decoded event.
|
|
263
295
|
*/
|
|
264
296
|
export function useNatsSession(
|
|
265
297
|
sessionId: string | undefined,
|
|
266
298
|
config: NatsConfig | undefined,
|
|
267
|
-
onMessage: (event: NatsSessionEvent) => void
|
|
299
|
+
onMessage: (event: NatsSessionEvent) => void,
|
|
300
|
+
lifecycle: NatsSessionLifecycle = {}
|
|
268
301
|
) {
|
|
269
302
|
const connRef = useRef<NatsConnection | null>(null);
|
|
270
303
|
const consumerMessagesRef = useRef<ConsumerMessages | null>(null);
|
|
271
304
|
const onMessageRef = useRef(onMessage);
|
|
305
|
+
const lifecycleRef = useRef(lifecycle);
|
|
272
306
|
const wasHiddenRef = useRef(false);
|
|
273
307
|
const [resumeGeneration, setResumeGeneration] = useState(0);
|
|
274
308
|
|
|
@@ -277,6 +311,10 @@ export function useNatsSession(
|
|
|
277
311
|
onMessageRef.current = onMessage;
|
|
278
312
|
}, [onMessage]);
|
|
279
313
|
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
lifecycleRef.current = lifecycle;
|
|
316
|
+
}, [lifecycle]);
|
|
317
|
+
|
|
280
318
|
// Reconnect when the tab returns from background or the network comes back.
|
|
281
319
|
useEffect(() => {
|
|
282
320
|
if (!sessionId || !config?.stream) {
|
|
@@ -348,7 +386,7 @@ export function useNatsSession(
|
|
|
348
386
|
);
|
|
349
387
|
const nc = await wsconnect({
|
|
350
388
|
servers: [config.url],
|
|
351
|
-
|
|
389
|
+
authenticator: jwtAuthenticator(config.token),
|
|
352
390
|
});
|
|
353
391
|
if (closed) {
|
|
354
392
|
console.debug(
|
|
@@ -363,6 +401,28 @@ export function useNatsSession(
|
|
|
363
401
|
const dispatch = (event: NatsSessionEvent) => {
|
|
364
402
|
onMessageRef.current(event);
|
|
365
403
|
};
|
|
404
|
+
const ready = () => lifecycleRef.current.onConnected?.();
|
|
405
|
+
let authRefreshRequested = false;
|
|
406
|
+
const requestAuthRefresh = (error: Error) => {
|
|
407
|
+
if (closed || authRefreshRequested) return;
|
|
408
|
+
authRefreshRequested = true;
|
|
409
|
+
lifecycleRef.current.onAuthError?.(error);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
void (async () => {
|
|
413
|
+
for await (const status of nc.status()) {
|
|
414
|
+
if (status.type === 'error' && isNatsAuthError(status.error)) {
|
|
415
|
+
requestAuthRefresh(status.error);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
})();
|
|
420
|
+
|
|
421
|
+
void nc.closed().then(error => {
|
|
422
|
+
if (error && isNatsAuthError(error)) {
|
|
423
|
+
requestAuthRefresh(error);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
366
426
|
|
|
367
427
|
if (useJetStream) {
|
|
368
428
|
await consumeJetStream(
|
|
@@ -373,12 +433,18 @@ export function useNatsSession(
|
|
|
373
433
|
dispatch,
|
|
374
434
|
messages => {
|
|
375
435
|
consumerMessagesRef.current = messages;
|
|
376
|
-
}
|
|
436
|
+
},
|
|
437
|
+
ready
|
|
377
438
|
);
|
|
378
439
|
} else {
|
|
379
|
-
await consumeCoreSubscription(nc, subject, dispatch);
|
|
440
|
+
await consumeCoreSubscription(nc, subject, dispatch, ready);
|
|
441
|
+
}
|
|
442
|
+
})().catch(err => {
|
|
443
|
+
console.error('[NATS] connection error', err);
|
|
444
|
+
if (!closed && isNatsAuthError(err)) {
|
|
445
|
+
lifecycleRef.current.onAuthError?.(err);
|
|
380
446
|
}
|
|
381
|
-
})
|
|
447
|
+
});
|
|
382
448
|
|
|
383
449
|
return () => {
|
|
384
450
|
console.info('[NATS] cleanup: closing connection for subject', subject);
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
shouldHoldAutoStartForPosition,
|
|
3
|
+
shouldRestartSessionOnPositionPopoverClose,
|
|
4
|
+
} from './positionPopover';
|
|
5
|
+
|
|
6
|
+
describe('shouldHoldAutoStartForPosition', () => {
|
|
7
|
+
it('holds auto-start when position is required and none is stored', () => {
|
|
8
|
+
expect(shouldHoldAutoStartForPosition(true, false)).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('does not hold when a position (or skip) is already stored', () => {
|
|
12
|
+
expect(shouldHoldAutoStartForPosition(true, true)).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('does not hold when the agent does not require a position', () => {
|
|
16
|
+
expect(shouldHoldAutoStartForPosition(false, false)).toBe(false);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
2
19
|
|
|
3
20
|
describe('shouldRestartSessionOnPositionPopoverClose', () => {
|
|
4
21
|
it('restarts only when closing an open popover with autoStart and no session', () => {
|
|
@@ -36,4 +53,22 @@ describe('shouldRestartSessionOnPositionPopoverClose', () => {
|
|
|
36
53
|
false
|
|
37
54
|
);
|
|
38
55
|
});
|
|
56
|
+
|
|
57
|
+
it('does not restart when closing without a stored position', () => {
|
|
58
|
+
expect(
|
|
59
|
+
shouldRestartSessionOnPositionPopoverClose(
|
|
60
|
+
true,
|
|
61
|
+
false,
|
|
62
|
+
true,
|
|
63
|
+
false,
|
|
64
|
+
false
|
|
65
|
+
)
|
|
66
|
+
).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('restarts when closing after a position was stored', () => {
|
|
70
|
+
expect(
|
|
71
|
+
shouldRestartSessionOnPositionPopoverClose(true, false, true, false, true)
|
|
72
|
+
).toBe(true);
|
|
73
|
+
});
|
|
39
74
|
});
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-start must wait on the start panel when the agent requires a location
|
|
3
|
+
* and none has been stored yet (share or skip). The start panel is the place
|
|
4
|
+
* to collect that preference; do not open the header popover instead.
|
|
5
|
+
*/
|
|
6
|
+
export function shouldHoldAutoStartForPosition(
|
|
7
|
+
needsPosition: boolean,
|
|
8
|
+
hasPosition: boolean
|
|
9
|
+
): boolean {
|
|
10
|
+
return !!needsPosition && !hasPosition;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
/**
|
|
2
14
|
* Whether closing the position popover should re-run autoStart (`onClickStart`).
|
|
3
15
|
* Only true on a real open → closed transition when a session has not started yet
|
|
4
|
-
* (
|
|
5
|
-
* must not wipe chat history.
|
|
16
|
+
* and a position (or skip) is already stored. Closing during an active session
|
|
17
|
+
* must not wipe chat history. Closing without a position leaves the start panel.
|
|
6
18
|
*/
|
|
7
19
|
export function shouldRestartSessionOnPositionPopoverClose(
|
|
8
20
|
wasOpen: boolean,
|
|
9
21
|
nextOpen: boolean,
|
|
10
22
|
autoStart: boolean,
|
|
11
|
-
sessionAlreadyStarted = false
|
|
23
|
+
sessionAlreadyStarted = false,
|
|
24
|
+
hasPosition = true
|
|
12
25
|
): boolean {
|
|
13
26
|
return (
|
|
14
|
-
wasOpen &&
|
|
27
|
+
wasOpen &&
|
|
28
|
+
!nextOpen &&
|
|
29
|
+
!!autoStart &&
|
|
30
|
+
!sessionAlreadyStarted &&
|
|
31
|
+
hasPosition
|
|
15
32
|
);
|
|
16
33
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import i18n from './i18n';
|
|
2
|
+
|
|
3
|
+
describe('known facts bulk delete translations', () => {
|
|
4
|
+
afterEach(async () => {
|
|
5
|
+
await i18n.changeLanguage('en');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('keeps the selected-rows count in the same language as the confirm message', async () => {
|
|
9
|
+
await i18n.changeLanguage('it');
|
|
10
|
+
|
|
11
|
+
const selectedRows = i18n.t('knownFacts.selectedRows', { count: 10 });
|
|
12
|
+
const confirm = i18n.t('knownFacts.deleteSelectedConfirmMessage');
|
|
13
|
+
const message = `${selectedRows}. ${confirm}`;
|
|
14
|
+
|
|
15
|
+
expect(selectedRows).toBe('10 righe selezionate');
|
|
16
|
+
expect(message).not.toMatch(/rows selected/i);
|
|
17
|
+
expect(message).toBe(
|
|
18
|
+
'10 righe selezionate. Confermi di voler eliminare i fatti noti selezionati?'
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it.each([
|
|
23
|
+
['en', 1, '1 row selected'],
|
|
24
|
+
['en', 10, '10 rows selected'],
|
|
25
|
+
['it', 1, '1 riga selezionata'],
|
|
26
|
+
['it', 10, '10 righe selezionate'],
|
|
27
|
+
['fr', 1, '1 ligne sélectionnée'],
|
|
28
|
+
['fr', 10, '10 lignes sélectionnées'],
|
|
29
|
+
['de', 1, '1 Zeile ausgewählt'],
|
|
30
|
+
['de', 10, '10 Zeilen ausgewählt'],
|
|
31
|
+
['es', 1, '1 fila seleccionada'],
|
|
32
|
+
['es', 10, '10 filas seleccionadas'],
|
|
33
|
+
] as const)(
|
|
34
|
+
'translates %s selectedRows for count %i',
|
|
35
|
+
async (lng, count, expected) => {
|
|
36
|
+
await i18n.changeLanguage(lng);
|
|
37
|
+
expect(i18n.t('knownFacts.selectedRows', { count })).toBe(expected);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
});
|
package/src/icons/MemoriIcon.tsx
CHANGED
|
@@ -12,7 +12,7 @@ const MemoriIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
|
12
12
|
<defs>
|
|
13
13
|
<style>
|
|
14
14
|
{
|
|
15
|
-
"\n .cls-1 {\n fill: url(#Sfumatura_senza_nome_6);\n }\n\n .cls-1,\n .cls-2 {\n stroke-width: 0px;\n }\n\n .cls-2 {\n fill: var(--memori-
|
|
15
|
+
"\n .cls-1 {\n fill: url(#Sfumatura_senza_nome_6);\n }\n\n .cls-1,\n .cls-2 {\n stroke-width: 0px;\n }\n\n .cls-2 {\n fill: var(--memori-text-color, '#744c99');\n }\n "
|
|
16
16
|
}
|
|
17
17
|
</style>
|
|
18
18
|
<linearGradient
|
package/src/index.stories.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Meta, Story } from '@storybook/react';
|
|
|
3
3
|
import Memori, { Props } from './index';
|
|
4
4
|
|
|
5
5
|
const meta: Meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Live/Functionalities',
|
|
7
7
|
component: Memori,
|
|
8
8
|
argTypes: {
|
|
9
9
|
AZURE_COGNITIVE_SERVICES_TTS_KEY: {
|
|
@@ -88,21 +88,6 @@ WithChatHistory.args = {
|
|
|
88
88
|
showChatHistory: true,
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
export const WithUploadNoTotalPayloadLimit = Template.bind({});
|
|
92
|
-
WithUploadNoTotalPayloadLimit.args = {
|
|
93
|
-
ownerUserName: 'nzambello',
|
|
94
|
-
memoriName: 'Nicola',
|
|
95
|
-
tenantID: 'www.aisuru.com',
|
|
96
|
-
engineURL: 'https://engine.memori.ai',
|
|
97
|
-
apiURL: 'https://backend.memori.ai',
|
|
98
|
-
baseURL: 'https://www.aisuru.com',
|
|
99
|
-
layout: 'FULLPAGE',
|
|
100
|
-
uiLang: 'IT',
|
|
101
|
-
spokenLang: 'IT',
|
|
102
|
-
enableAudio: true,
|
|
103
|
-
showUpload: true,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
91
|
export const WithMaxTextareaCharacters = Template.bind({});
|
|
107
92
|
WithMaxTextareaCharacters.args = {
|
|
108
93
|
ownerUserName: 'nzambello',
|
|
@@ -193,34 +178,3 @@ WithPiiDetection.args = {
|
|
|
193
178
|
},
|
|
194
179
|
};
|
|
195
180
|
|
|
196
|
-
export const WithLocalNats = Template.bind({});
|
|
197
|
-
WithLocalNats.args = {
|
|
198
|
-
memoriName: 'test324',
|
|
199
|
-
ownerUserName: 'andrea.patini',
|
|
200
|
-
memoriID: 'd661a9ca-e907-4396-a986-5095ccd582d6',
|
|
201
|
-
ownerUserID: '69fcc557-9cb6-4e5e-b8ab-140cff975492',
|
|
202
|
-
tenantID: 'localhost:3000',
|
|
203
|
-
engineURL: 'http://localhost:7778/memori/v2',
|
|
204
|
-
apiURL: 'http://localhost:7778/api/v2',
|
|
205
|
-
baseURL: 'http://localhost:3000',
|
|
206
|
-
layout: 'FULLPAGE',
|
|
207
|
-
uiLang: 'IT',
|
|
208
|
-
spokenLang: 'IT',
|
|
209
|
-
integrationID: 'ee1c3d98-7819-4506-ba28-818e79ba86cb',
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export const WithFunctionalities = Template.bind({});
|
|
213
|
-
WithFunctionalities.args = {
|
|
214
|
-
memoriName: 'test324',
|
|
215
|
-
ownerUserName: 'andrea.patini',
|
|
216
|
-
memoriID: 'd661a9ca-e907-4396-a986-5095ccd582d6',
|
|
217
|
-
ownerUserID: '69fcc557-9cb6-4e5e-b8ab-140cff975492',
|
|
218
|
-
tenantID: 'localhost:3000',
|
|
219
|
-
engineURL: 'http://localhost:7778/memori/v2',
|
|
220
|
-
apiURL: 'http://localhost:7778/api/v2',
|
|
221
|
-
baseURL: 'http://localhost:3000',
|
|
222
|
-
layout: 'FULLPAGE',
|
|
223
|
-
uiLang: 'IT',
|
|
224
|
-
spokenLang: 'IT',
|
|
225
|
-
integrationID: 'ee1c3d98-7819-4506-ba28-818e79ba86cb',
|
|
226
|
-
};
|
package/src/locales/de.json
CHANGED
|
@@ -116,7 +116,9 @@
|
|
|
116
116
|
"deleteConfirmTitle": "Bekannte Tatsache löschen",
|
|
117
117
|
"deleteConfirmMessage": "Sind Sie sicher, dass Sie diese bekannte Tatsache löschen möchten?",
|
|
118
118
|
"deleteSelectedConfirmTitle": "Ausgewählte bekannte Fakten löschen",
|
|
119
|
-
"deleteSelectedConfirmMessage": "Sind Sie sicher, dass Sie die ausgewählten bekannten Fakten löschen möchten?"
|
|
119
|
+
"deleteSelectedConfirmMessage": "Sind Sie sicher, dass Sie die ausgewählten bekannten Fakten löschen möchten?",
|
|
120
|
+
"selectedRows_one": "{{count}} Zeile ausgewählt",
|
|
121
|
+
"selectedRows_other": "{{count}} Zeilen ausgewählt"
|
|
120
122
|
},
|
|
121
123
|
"auth": {
|
|
122
124
|
"title": "Authentifizierung",
|
|
@@ -411,6 +413,7 @@
|
|
|
411
413
|
"otpTimer": "Code läuft in {{seconds}} Sekunden ab",
|
|
412
414
|
"otpInvalidFormat": "Bitte geben Sie einen gültigen 4-stelligen Code ein",
|
|
413
415
|
"otpInvalid": "Ungültiger Bestätigungscode",
|
|
416
|
+
"otpExpired": "Der Bestätigungscode ist abgelaufen",
|
|
414
417
|
"otpError": "Fehler bei der Code-Validierung. Bitte versuchen Sie es erneut.",
|
|
415
418
|
"otpSuccess": "Anmeldung erfolgreich!",
|
|
416
419
|
"password": "Passwort",
|
package/src/locales/en.json
CHANGED
|
@@ -118,7 +118,9 @@
|
|
|
118
118
|
"deleteConfirmTitle": "Delete known fact",
|
|
119
119
|
"deleteConfirmMessage": "Are you sure you want to delete this known fact?",
|
|
120
120
|
"deleteSelectedConfirmTitle": "Delete selected known facts",
|
|
121
|
-
"deleteSelectedConfirmMessage": "Are you sure you want to delete the selected known facts?"
|
|
121
|
+
"deleteSelectedConfirmMessage": "Are you sure you want to delete the selected known facts?",
|
|
122
|
+
"selectedRows_one": "{{count}} row selected",
|
|
123
|
+
"selectedRows_other": "{{count}} rows selected"
|
|
122
124
|
},
|
|
123
125
|
"auth": {
|
|
124
126
|
"title": "Authentication",
|
package/src/locales/es.json
CHANGED
|
@@ -116,7 +116,9 @@
|
|
|
116
116
|
"deleteConfirmTitle": "Eliminar hecho conocido",
|
|
117
117
|
"deleteConfirmMessage": "¿Está seguro de que desea eliminar este hecho conocido?",
|
|
118
118
|
"deleteSelectedConfirmTitle": "Eliminar hechos conocidos seleccionados",
|
|
119
|
-
"deleteSelectedConfirmMessage": "¿Está seguro de que desea eliminar los hechos conocidos seleccionados?"
|
|
119
|
+
"deleteSelectedConfirmMessage": "¿Está seguro de que desea eliminar los hechos conocidos seleccionados?",
|
|
120
|
+
"selectedRows_one": "{{count}} fila seleccionada",
|
|
121
|
+
"selectedRows_other": "{{count}} filas seleccionadas"
|
|
120
122
|
},
|
|
121
123
|
"auth": {
|
|
122
124
|
"title": "Autenticación",
|
package/src/locales/fr.json
CHANGED
|
@@ -115,7 +115,9 @@
|
|
|
115
115
|
"deleteConfirmTitle": "Supprimer un fait connu",
|
|
116
116
|
"deleteConfirmMessage": "Êtes-vous sûr de vouloir supprimer ce fait connu ?",
|
|
117
117
|
"deleteSelectedConfirmTitle": "Supprimer les faits connus sélectionnés",
|
|
118
|
-
"deleteSelectedConfirmMessage": "Etes-vous sûr de vouloir supprimer les faits connus sélectionnés ?"
|
|
118
|
+
"deleteSelectedConfirmMessage": "Etes-vous sûr de vouloir supprimer les faits connus sélectionnés ?",
|
|
119
|
+
"selectedRows_one": "{{count}} ligne sélectionnée",
|
|
120
|
+
"selectedRows_other": "{{count}} lignes sélectionnées"
|
|
119
121
|
},
|
|
120
122
|
"auth": {
|
|
121
123
|
"title": "Authentification",
|
package/src/locales/it.json
CHANGED
|
@@ -119,7 +119,9 @@
|
|
|
119
119
|
"deleteConfirmTitle": "Elimina il fatto noto",
|
|
120
120
|
"deleteConfirmMessage": "Confermi di voler eliminare questo fatto noto?",
|
|
121
121
|
"deleteSelectedConfirmTitle": "Elimina i fatti noti selezionati",
|
|
122
|
-
"deleteSelectedConfirmMessage": "Confermi di voler eliminare i fatti noti selezionati?"
|
|
122
|
+
"deleteSelectedConfirmMessage": "Confermi di voler eliminare i fatti noti selezionati?",
|
|
123
|
+
"selectedRows_one": "{{count}} riga selezionata",
|
|
124
|
+
"selectedRows_other": "{{count}} righe selezionate"
|
|
123
125
|
},
|
|
124
126
|
"auth": {
|
|
125
127
|
"title": "Autenticazione",
|