@memori.ai/memori-react 9.0.5 → 9.0.7
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 +21 -0
- package/dist/components/ChatInputs/ChatInputs.js +4 -1
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +11 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/utils/inPageAnchors.d.ts +1 -0
- package/dist/components/MemoriArtifactSystem/utils/inPageAnchors.js +48 -0
- package/dist/components/MemoriArtifactSystem/utils/inPageAnchors.js.map +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +43 -23
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/ReasoningBlock/ReasoningBlock.js +2 -1
- package/dist/components/ReasoningBlock/ReasoningBlock.js.map +1 -1
- package/dist/components/layouts/Chat.js +1 -1
- package/dist/components/layouts/Chat.js.map +1 -1
- package/dist/components/layouts/HiddenChat.js +1 -1
- package/dist/components/layouts/HiddenChat.js.map +1 -1
- package/dist/helpers/sessionPassword.d.ts +2 -0
- package/dist/helpers/sessionPassword.js +16 -0
- package/dist/helpers/sessionPassword.js.map +1 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/locales/de.json +2 -0
- package/dist/locales/en.json +2 -0
- package/dist/locales/es.json +2 -0
- package/dist/locales/fr.json +2 -0
- package/dist/locales/it.json +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/ChatInputs/ChatInputs.js +4 -1
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +12 -3
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/utils/inPageAnchors.d.ts +1 -0
- package/esm/components/MemoriArtifactSystem/utils/inPageAnchors.js +44 -0
- package/esm/components/MemoriArtifactSystem/utils/inPageAnchors.js.map +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js +43 -23
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/ReasoningBlock/ReasoningBlock.js +3 -2
- package/esm/components/ReasoningBlock/ReasoningBlock.js.map +1 -1
- package/esm/components/layouts/Chat.js +1 -1
- package/esm/components/layouts/Chat.js.map +1 -1
- package/esm/components/layouts/HiddenChat.js +1 -1
- package/esm/components/layouts/HiddenChat.js.map +1 -1
- package/esm/helpers/sessionPassword.d.ts +2 -0
- package/esm/helpers/sessionPassword.js +12 -0
- package/esm/helpers/sessionPassword.js.map +1 -0
- package/esm/index.js +6 -5
- package/esm/index.js.map +1 -1
- package/esm/locales/de.json +2 -0
- package/esm/locales/en.json +2 -0
- package/esm/locales/es.json +2 -0
- package/esm/locales/fr.json +2 -0
- package/esm/locales/it.json +2 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ import { getTTSVoice } from '../../helpers/tts/ttsVoiceUtility';
|
|
|
35
35
|
import { getMuteSpeakerFallback, shouldPlayTtsAudio, } from '../../helpers/tts/muteSpeaker';
|
|
36
36
|
import { allowedMediaTypes, anonTag, uiLanguages, } from '../../helpers/constants';
|
|
37
37
|
import { getErrori18nKey } from '../../helpers/error';
|
|
38
|
+
import { isEmptyPasswordError, resolveSessionPassword, } from '../../helpers/sessionPassword';
|
|
38
39
|
import { CreditsCheckError, getCredits } from '../../helpers/credits';
|
|
39
40
|
import { sanitizeText } from '../../helpers/sanitizer';
|
|
40
41
|
import { useTTS } from '../../helpers/tts/useTTS';
|
|
@@ -419,6 +420,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
419
420
|
}, [enableAudio, integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio]);
|
|
420
421
|
const [memoriPwd, setMemoriPwd] = useState(secret);
|
|
421
422
|
const [memoriTokens, setMemoriTokens] = useState();
|
|
423
|
+
const sessionPassword = (...candidates) => resolveSessionPassword(...candidates, secret, memoriPwd, memoriPassword, memori.secretToken, memori.password);
|
|
422
424
|
const [authModalState, setAuthModalState] = useState(null);
|
|
423
425
|
const [position, _setPosition] = useState();
|
|
424
426
|
const hasUserProvidedPosition = useCallback((venue) => {
|
|
@@ -845,10 +847,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
845
847
|
setShowAgeVerification(true);
|
|
846
848
|
return;
|
|
847
849
|
}
|
|
850
|
+
const password = sessionPassword(params.password);
|
|
848
851
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
849
|
-
!
|
|
850
|
-
!memori.secretToken &&
|
|
851
|
-
!memoriPwd &&
|
|
852
|
+
!password &&
|
|
852
853
|
!((_b = params.recoveryTokens) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
853
854
|
!memoriTokens) {
|
|
854
855
|
setAuthModalState('password');
|
|
@@ -869,6 +870,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
869
870
|
}
|
|
870
871
|
const session = await initSession({
|
|
871
872
|
...params,
|
|
873
|
+
password,
|
|
872
874
|
birthDate: userBirthDate,
|
|
873
875
|
tag: (_c = params.tag) !== null && _c !== void 0 ? _c : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
874
876
|
pin: (_d = params.pin) !== null && _d !== void 0 ? _d : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
@@ -904,9 +906,21 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
904
906
|
}));
|
|
905
907
|
setGotErrorInOpening(true);
|
|
906
908
|
}
|
|
907
|
-
else if (
|
|
909
|
+
else if (memori.privacyType !== 'PUBLIC' &&
|
|
910
|
+
((session === null || session === void 0 ? void 0 : session.resultCode) === 403 ||
|
|
911
|
+
isEmptyPasswordError(session === null || session === void 0 ? void 0 : session.resultCode, session === null || session === void 0 ? void 0 : session.resultMessage))) {
|
|
908
912
|
setMemoriPwd(undefined);
|
|
913
|
+
memoriPassword = undefined;
|
|
909
914
|
setAuthModalState('password');
|
|
915
|
+
setLoading(false);
|
|
916
|
+
return session;
|
|
917
|
+
}
|
|
918
|
+
else if (isEmptyPasswordError(session === null || session === void 0 ? void 0 : session.resultCode, session === null || session === void 0 ? void 0 : session.resultMessage)) {
|
|
919
|
+
add(createAlertOptions({
|
|
920
|
+
description: t('error.emptyPasswordPublic'),
|
|
921
|
+
severity: 'error',
|
|
922
|
+
}));
|
|
923
|
+
setLoading(false);
|
|
910
924
|
return session;
|
|
911
925
|
}
|
|
912
926
|
else {
|
|
@@ -934,10 +948,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
934
948
|
setLoading(false);
|
|
935
949
|
return;
|
|
936
950
|
}
|
|
951
|
+
const resolvedPassword = sessionPassword(password);
|
|
937
952
|
if (memori.privacyType !== 'PUBLIC' &&
|
|
938
|
-
!
|
|
939
|
-
!memori.secretToken &&
|
|
940
|
-
!memoriPwd &&
|
|
953
|
+
!resolvedPassword &&
|
|
941
954
|
!(recoveryTokens === null || recoveryTokens === void 0 ? void 0 : recoveryTokens.length) &&
|
|
942
955
|
!memoriTokens) {
|
|
943
956
|
setAuthModalState('password');
|
|
@@ -958,7 +971,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
958
971
|
}
|
|
959
972
|
const { sessionID, currentState, ...response } = await initSession({
|
|
960
973
|
memoriID: (_a = memori.engineMemoriID) !== null && _a !== void 0 ? _a : '',
|
|
961
|
-
password:
|
|
974
|
+
password: resolvedPassword,
|
|
962
975
|
recoveryTokens: recoveryTokens || memoriTokens,
|
|
963
976
|
tag: tag !== null && tag !== void 0 ? tag : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
964
977
|
pin: pin !== null && pin !== void 0 ? pin : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
@@ -1056,11 +1069,19 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1056
1069
|
}));
|
|
1057
1070
|
setGotErrorInOpening(true);
|
|
1058
1071
|
}
|
|
1059
|
-
else if (
|
|
1060
|
-
|
|
1072
|
+
else if (memori.privacyType !== 'PUBLIC' &&
|
|
1073
|
+
((response === null || response === void 0 ? void 0 : response.resultCode) === 403 ||
|
|
1074
|
+
isEmptyPasswordError(response === null || response === void 0 ? void 0 : response.resultCode, response === null || response === void 0 ? void 0 : response.resultMessage))) {
|
|
1061
1075
|
setMemoriPwd(undefined);
|
|
1076
|
+
memoriPassword = undefined;
|
|
1062
1077
|
setAuthModalState('password');
|
|
1063
1078
|
}
|
|
1079
|
+
else if (isEmptyPasswordError(response === null || response === void 0 ? void 0 : response.resultCode, response === null || response === void 0 ? void 0 : response.resultMessage)) {
|
|
1080
|
+
add(createAlertOptions({
|
|
1081
|
+
description: t('error.emptyPasswordPublic'),
|
|
1082
|
+
severity: 'error',
|
|
1083
|
+
}));
|
|
1084
|
+
}
|
|
1064
1085
|
else {
|
|
1065
1086
|
console.error('[REOPEN_SESSION] Other error:', response);
|
|
1066
1087
|
add(createAlertOptions({
|
|
@@ -1083,7 +1104,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1083
1104
|
const continueFromChatLogID = continueFromChatLogIDParam !== null && continueFromChatLogIDParam !== void 0 ? continueFromChatLogIDParam : chatLogID;
|
|
1084
1105
|
const reopenAfterExpiry = () => {
|
|
1085
1106
|
var _a, _b;
|
|
1086
|
-
return reopenSession(true,
|
|
1107
|
+
return reopenSession(true, sessionPassword(), memoriTokens, undefined, undefined, {
|
|
1087
1108
|
LANG: userLang,
|
|
1088
1109
|
PATHNAME: window.location.pathname,
|
|
1089
1110
|
ROUTE: ((_b = (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.split('/')) === null || _b === void 0 ? void 0 : _b.pop()) || '',
|
|
@@ -1168,7 +1189,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1168
1189
|
}
|
|
1169
1190
|
fetchSession({
|
|
1170
1191
|
memoriID: (_b = memori.engineMemoriID) !== null && _b !== void 0 ? _b : '',
|
|
1171
|
-
password:
|
|
1192
|
+
password: sessionPassword(),
|
|
1172
1193
|
tag: tag !== null && tag !== void 0 ? tag : personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
1173
1194
|
pin: pin !== null && pin !== void 0 ? pin : personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
1174
1195
|
initialContextVars: {
|
|
@@ -1378,7 +1399,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1378
1399
|
speakerMuted,
|
|
1379
1400
|
]);
|
|
1380
1401
|
const processEnterTextDialogResponse = useCallback((event, pending) => {
|
|
1381
|
-
var _a
|
|
1402
|
+
var _a;
|
|
1382
1403
|
const { msg, typingText: pendingTypingText, useLoaderTextAsMsg, } = pending;
|
|
1383
1404
|
const currentState = event.currentState;
|
|
1384
1405
|
if (event.resultCode !== 0 || !currentState) {
|
|
@@ -1420,7 +1441,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1420
1441
|
setChatLogID(undefined);
|
|
1421
1442
|
const emission = useLoaderTextAsMsg && pendingTypingText
|
|
1422
1443
|
? pendingTypingText
|
|
1423
|
-
:
|
|
1444
|
+
: currentState.emission;
|
|
1424
1445
|
if (userLang.toLowerCase() !== language.toLowerCase() &&
|
|
1425
1446
|
emission &&
|
|
1426
1447
|
isMultilanguageEnabled) {
|
|
@@ -1440,7 +1461,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1440
1461
|
pushMessage({
|
|
1441
1462
|
text: emission,
|
|
1442
1463
|
emitter: currentState.emitter,
|
|
1443
|
-
media: (
|
|
1464
|
+
media: (_a = currentState.emittedMedia) !== null && _a !== void 0 ? _a : currentState.media,
|
|
1444
1465
|
llmUsage: currentState.llmUsage,
|
|
1445
1466
|
fromUser: false,
|
|
1446
1467
|
questionAnswered: msg,
|
|
@@ -1463,7 +1484,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1463
1484
|
userLang,
|
|
1464
1485
|
language,
|
|
1465
1486
|
isMultilanguageEnabled,
|
|
1466
|
-
currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission,
|
|
1467
1487
|
translateDialogState,
|
|
1468
1488
|
handleSpeak,
|
|
1469
1489
|
shouldPlayAudio,
|
|
@@ -1855,8 +1875,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1855
1875
|
}
|
|
1856
1876
|
else if ((!sessionID &&
|
|
1857
1877
|
memori.privacyType !== 'PUBLIC' &&
|
|
1858
|
-
!
|
|
1859
|
-
!memoriPwd &&
|
|
1878
|
+
!sessionPassword() &&
|
|
1860
1879
|
!memoriTokens) ||
|
|
1861
1880
|
(!sessionID && gotErrorInOpening)) {
|
|
1862
1881
|
setAuthModalState('password');
|
|
@@ -1872,7 +1891,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1872
1891
|
try {
|
|
1873
1892
|
const session = await fetchSession({
|
|
1874
1893
|
memoriID: memori.engineMemoriID,
|
|
1875
|
-
password:
|
|
1894
|
+
password: sessionPassword(),
|
|
1876
1895
|
tag: personification === null || personification === void 0 ? void 0 : personification.tag,
|
|
1877
1896
|
pin: personification === null || personification === void 0 ? void 0 : personification.pin,
|
|
1878
1897
|
continueFromChatLogID: chatLog === null || chatLog === void 0 ? void 0 : chatLog.chatLogID,
|
|
@@ -1986,7 +2005,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
1986
2005
|
}
|
|
1987
2006
|
}
|
|
1988
2007
|
catch (_v) {
|
|
1989
|
-
reopenSession(true,
|
|
2008
|
+
reopenSession(true, sessionPassword(), undefined, personification.tag, personification.pin, {
|
|
1990
2009
|
LANG: userLang,
|
|
1991
2010
|
PATHNAME: (_j = window.location.pathname) === null || _j === void 0 ? void 0 : _j.toUpperCase(),
|
|
1992
2011
|
ROUTE: ((_m = (_l = (_k = window.location.pathname) === null || _k === void 0 ? void 0 : _k.split('/')) === null || _l === void 0 ? void 0 : _l.pop()) === null || _m === void 0 ? void 0 : _m.toUpperCase()) ||
|
|
@@ -2014,7 +2033,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
2014
2033
|
}
|
|
2015
2034
|
}
|
|
2016
2035
|
catch (e) {
|
|
2017
|
-
reopenSession(true,
|
|
2036
|
+
reopenSession(true, sessionPassword(), undefined, undefined, undefined, {
|
|
2018
2037
|
LANG: userLang,
|
|
2019
2038
|
PATHNAME: (_o = window.location.pathname) === null || _o === void 0 ? void 0 : _o.toUpperCase(),
|
|
2020
2039
|
ROUTE: ((_r = (_q = (_p = window.location.pathname) === null || _p === void 0 ? void 0 : _p.split('/')) === null || _q === void 0 ? void 0 : _q.pop()) === null || _r === void 0 ? void 0 : _r.toUpperCase()) ||
|
|
@@ -2120,6 +2139,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
2120
2139
|
setClickedStart(false);
|
|
2121
2140
|
}
|
|
2122
2141
|
}, [
|
|
2142
|
+
secret,
|
|
2123
2143
|
memoriPwd,
|
|
2124
2144
|
memori,
|
|
2125
2145
|
memoriTokens,
|
|
@@ -2595,7 +2615,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
2595
2615
|
if (birthDate) {
|
|
2596
2616
|
setBirthDate(birthDate);
|
|
2597
2617
|
setLocalConfig('birthDate', birthDate);
|
|
2598
|
-
reopenSession(!sessionId,
|
|
2618
|
+
reopenSession(!sessionId, sessionPassword(), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
|
|
2599
2619
|
LANG: userLang,
|
|
2600
2620
|
PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
2601
2621
|
ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
|
|
@@ -2623,7 +2643,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, tenantID, memoriLang
|
|
|
2623
2643
|
? 'memori-modal--above-website-assistant'
|
|
2624
2644
|
: undefined, onLogin: (user, token) => {
|
|
2625
2645
|
var _a, _b, _c, _d;
|
|
2626
|
-
reopenSession(false,
|
|
2646
|
+
reopenSession(false, sessionPassword(), [], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
|
|
2627
2647
|
LANG: userLang,
|
|
2628
2648
|
PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
2629
2649
|
ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
|