@memori.ai/memori-react 8.12.0 → 8.13.1

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/Chat/Chat.css +37 -3
  3. package/dist/components/Chat/Chat.js +60 -22
  4. package/dist/components/Chat/Chat.js.map +1 -1
  5. package/dist/components/ChatBubble/ChatBubble.css +9 -5
  6. package/dist/components/ChatBubble/ChatBubble.js +54 -11
  7. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  8. package/dist/components/ChatInputs/ChatInputs.css +293 -17
  9. package/dist/components/ChatInputs/ChatInputs.js +41 -25
  10. package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
  11. package/dist/components/ChatTextArea/ChatTextArea.css +75 -31
  12. package/dist/components/ChatTextArea/ChatTextArea.js +47 -18
  13. package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
  14. package/dist/components/FilePreview/FilePreview.css +225 -146
  15. package/dist/components/FilePreview/FilePreview.d.ts +1 -2
  16. package/dist/components/FilePreview/FilePreview.js +20 -6
  17. package/dist/components/FilePreview/FilePreview.js.map +1 -1
  18. package/dist/components/Header/Header.css +2 -2
  19. package/dist/components/Header/Header.js.map +1 -1
  20. package/dist/components/MediaWidget/MediaItemWidget.js +2 -1
  21. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  22. package/dist/components/MediaWidget/MediaWidget.css +0 -4
  23. package/dist/components/MemoriWidget/MemoriWidget.css +11 -2
  24. package/dist/components/MemoriWidget/MemoriWidget.js +41 -5
  25. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  26. package/dist/components/MicrophoneButton/MicrophoneButton.css +2 -2
  27. package/dist/components/StartPanel/StartPanel.css +8 -0
  28. package/dist/components/UploadButton/UploadButton.css +20 -17
  29. package/dist/components/UploadButton/UploadButton.js +218 -89
  30. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  31. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
  32. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  33. package/dist/components/UploadButton/UploadImages/UploadImages.js +143 -16
  34. package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  35. package/dist/components/layouts/chat.css +1 -1
  36. package/dist/components/ui/Button.css +1 -0
  37. package/dist/helpers/constants.d.ts +1 -0
  38. package/dist/helpers/constants.js +2 -1
  39. package/dist/helpers/constants.js.map +1 -1
  40. package/dist/helpers/imageCompression.d.ts +7 -0
  41. package/dist/helpers/imageCompression.js +123 -0
  42. package/dist/helpers/imageCompression.js.map +1 -0
  43. package/dist/locales/de.json +7 -4
  44. package/dist/locales/en.json +8 -5
  45. package/dist/locales/es.json +7 -4
  46. package/dist/locales/fr.json +7 -4
  47. package/dist/locales/it.json +8 -5
  48. package/dist/styles.css +1 -2
  49. package/esm/components/Chat/Chat.css +37 -3
  50. package/esm/components/Chat/Chat.js +60 -22
  51. package/esm/components/Chat/Chat.js.map +1 -1
  52. package/esm/components/ChatBubble/ChatBubble.css +9 -5
  53. package/esm/components/ChatBubble/ChatBubble.js +54 -11
  54. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  55. package/esm/components/ChatInputs/ChatInputs.css +293 -17
  56. package/esm/components/ChatInputs/ChatInputs.js +42 -26
  57. package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
  58. package/esm/components/ChatTextArea/ChatTextArea.css +75 -31
  59. package/esm/components/ChatTextArea/ChatTextArea.js +49 -20
  60. package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
  61. package/esm/components/FilePreview/FilePreview.css +225 -146
  62. package/esm/components/FilePreview/FilePreview.d.ts +1 -2
  63. package/esm/components/FilePreview/FilePreview.js +21 -7
  64. package/esm/components/FilePreview/FilePreview.js.map +1 -1
  65. package/esm/components/Header/Header.css +2 -2
  66. package/esm/components/Header/Header.js.map +1 -1
  67. package/esm/components/MediaWidget/MediaItemWidget.js +2 -1
  68. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  69. package/esm/components/MediaWidget/MediaWidget.css +0 -4
  70. package/esm/components/MemoriWidget/MemoriWidget.css +11 -2
  71. package/esm/components/MemoriWidget/MemoriWidget.js +41 -5
  72. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  73. package/esm/components/MicrophoneButton/MicrophoneButton.css +2 -2
  74. package/esm/components/StartPanel/StartPanel.css +8 -0
  75. package/esm/components/UploadButton/UploadButton.css +20 -17
  76. package/esm/components/UploadButton/UploadButton.js +219 -90
  77. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  78. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
  79. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  80. package/esm/components/UploadButton/UploadImages/UploadImages.js +143 -16
  81. package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  82. package/esm/components/layouts/chat.css +1 -1
  83. package/esm/components/ui/Button.css +1 -0
  84. package/esm/helpers/constants.d.ts +1 -0
  85. package/esm/helpers/constants.js +1 -0
  86. package/esm/helpers/constants.js.map +1 -1
  87. package/esm/helpers/imageCompression.d.ts +7 -0
  88. package/esm/helpers/imageCompression.js +119 -0
  89. package/esm/helpers/imageCompression.js.map +1 -0
  90. package/esm/locales/de.json +7 -4
  91. package/esm/locales/en.json +8 -5
  92. package/esm/locales/es.json +7 -4
  93. package/esm/locales/fr.json +7 -4
  94. package/esm/locales/it.json +8 -5
  95. package/esm/styles.css +1 -2
  96. package/package.json +1 -1
  97. package/src/__snapshots__/index.test.tsx.snap +5 -5
  98. package/src/components/Chat/Chat.css +37 -3
  99. package/src/components/Chat/Chat.tsx +89 -21
  100. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +672 -732
  101. package/src/components/ChatBubble/ChatBubble.css +9 -5
  102. package/src/components/ChatBubble/ChatBubble.tsx +111 -20
  103. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +4 -4
  104. package/src/components/ChatInputs/ChatInputs.css +293 -17
  105. package/src/components/ChatInputs/ChatInputs.tsx +144 -87
  106. package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +430 -424
  107. package/src/components/ChatTextArea/ChatTextArea.css +75 -31
  108. package/src/components/ChatTextArea/ChatTextArea.test.tsx +1 -16
  109. package/src/components/ChatTextArea/ChatTextArea.tsx +51 -22
  110. package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +9 -72
  111. package/src/components/FilePreview/FilePreview.css +225 -146
  112. package/src/components/FilePreview/FilePreview.tsx +49 -36
  113. package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +2 -2
  114. package/src/components/Header/Header.css +2 -2
  115. package/src/components/Header/Header.tsx +1 -1
  116. package/src/components/MediaWidget/MediaItemWidget.tsx +2 -1
  117. package/src/components/MediaWidget/MediaWidget.css +0 -4
  118. package/src/components/MemoriWidget/MemoriWidget.css +11 -2
  119. package/src/components/MemoriWidget/MemoriWidget.tsx +61 -12
  120. package/src/components/MicrophoneButton/MicrophoneButton.css +2 -2
  121. package/src/components/StartPanel/StartPanel.css +8 -0
  122. package/src/components/UploadButton/UploadButton.css +20 -17
  123. package/src/components/UploadButton/UploadButton.stories.tsx +247 -35
  124. package/src/components/UploadButton/UploadButton.tsx +280 -175
  125. package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +19 -4
  126. package/src/components/UploadButton/UploadImages/UploadImages.tsx +195 -35
  127. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +10 -1
  128. package/src/components/layouts/chat.css +1 -1
  129. package/src/components/ui/Button.css +1 -0
  130. package/src/helpers/constants.ts +1 -1
  131. package/src/helpers/imageCompression.ts +230 -0
  132. package/src/locales/de.json +7 -4
  133. package/src/locales/en.json +8 -5
  134. package/src/locales/es.json +7 -4
  135. package/src/locales/fr.json +7 -4
  136. package/src/locales/it.json +8 -5
  137. package/src/styles.css +1 -2
  138. package/dist/components/SignupForm/SignupForm.d.ts +0 -12
  139. package/dist/components/SignupForm/SignupForm.js +0 -199
  140. package/dist/components/SignupForm/SignupForm.js.map +0 -1
  141. package/dist/components/UploadMenu/UploadMenu.css +0 -47
  142. package/dist/components/UploadMenu/UploadMenu.d.ts +0 -9
  143. package/dist/components/UploadMenu/UploadMenu.js +0 -15
  144. package/dist/components/UploadMenu/UploadMenu.js.map +0 -1
  145. package/esm/components/SignupForm/SignupForm.d.ts +0 -12
  146. package/esm/components/SignupForm/SignupForm.js +0 -196
  147. package/esm/components/SignupForm/SignupForm.js.map +0 -1
  148. package/esm/components/UploadMenu/UploadMenu.css +0 -47
  149. package/esm/components/UploadMenu/UploadMenu.d.ts +0 -9
  150. package/esm/components/UploadMenu/UploadMenu.js +0 -12
  151. package/esm/components/UploadMenu/UploadMenu.js.map +0 -1
  152. package/src/components/UploadMenu/UploadMenu.css +0 -47
  153. package/src/components/UploadMenu/UploadMenu.stories.tsx +0 -66
  154. package/src/components/UploadMenu/UploadMenu.test.tsx +0 -34
  155. package/src/components/UploadMenu/UploadMenu.tsx +0 -68
  156. package/src/components/UploadMenu/__snapshots__/UploadMenu.test.tsx.snap +0 -137
@@ -22,6 +22,7 @@
22
22
  "all": "All",
23
23
  "today": "Today",
24
24
  "yesterday": "Yesterday",
25
+ "placeholder": "Ask a question",
25
26
  "last_7_days": "Last 7 days",
26
27
  "last_30_days": "Last 30 days",
27
28
  "month": "Month",
@@ -250,14 +251,15 @@
250
251
  "upload": {
251
252
  "loginRequired": "Login required",
252
253
  "loginRequiredDescription": "Please login to upload images",
253
- "uploadFiles": "Upload files",
254
- "uploadImage": "Upload image",
254
+ "uploadFiles": "Upload files ({{shortcut}}+O to open file chooser)",
255
+ "uploadFilesWithShortcut": "{{shortcut}}+O to open file chooser",
256
+ "uploadImages": "Upload images",
255
257
  "replace": "Replace",
256
258
  "maxImagesReached": "You can upload up to {{max}} images",
257
259
  "maxDocumentsReached": "You can upload up to {{max}} documents",
258
260
  "remaining": "remaining",
259
261
  "lastDocumentSlot": "Upload last document",
260
- "uploadDocument": "Upload document",
262
+ "uploadDocuments": "Upload documents",
261
263
  "maxReached": "Max limit reached",
262
264
  "imageTitle": "Image title: {{title}}",
263
265
  "titleHelp": "Adding a descriptive title helps the AI provide more context and appropriate responses.",
@@ -266,12 +268,13 @@
266
268
  "fileReadingFailed": "File reading failed",
267
269
  "uploadFailed": "Upload failed",
268
270
  "uploadSuccess": "Upload success",
269
- "titleImage": "Image: {{title}}",
271
+ "titleImage": "Image title: {{title}}",
270
272
  "uploadSuccessDescription": "The file has been uploaded successfully",
271
273
  "titleImageUpload": "Upload images",
272
274
  "partialUpload": "Only {{uploaded}} images on {{total}} will be uploaded. Maximum {{max}} images allowed.",
273
275
  "maxImages": "Maximum {{max}} images allowed.",
274
- "upload": "Upload"
276
+ "upload": "Upload",
277
+ "dragAndDropFiles": "Drag and drop files here to add them to the chat"
275
278
  },
276
279
  "media": {
277
280
  "title": "Title",
@@ -24,6 +24,7 @@
24
24
  "yesterday": "Ayer",
25
25
  "last_7_days": "Últimos 7 días",
26
26
  "last_30_days": "Últimos 30 días",
27
+ "placeholder": "Haz una pregunta",
27
28
  "date": "Fecha de nacimiento",
28
29
  "month": "Mes",
29
30
  "copied": "¡Copiado!",
@@ -237,9 +238,10 @@
237
238
  "upload": {
238
239
  "loginRequired": "Connexion requise",
239
240
  "loginRequiredDescription": "Veuillez vous connecter pour télécharger des images",
240
- "uploadFiles": "Télécharger des fichiers",
241
- "uploadImage": "Télécharger une image",
242
- "uploadDocument": "Télécharger un document",
241
+ "uploadFiles": "Télécharger des fichiers ({{shortcut}}+O para abrir el selector de archivos)",
242
+ "uploadFilesWithShortcut": "{{shortcut}}+O para abrir el selector de archivos",
243
+ "uploadImages": "Télécharger des images",
244
+ "uploadDocuments": "Télécharger des documents",
243
245
  "apiClientNotConfigured": "API client non configuré correctement pour le téléchargement de médias",
244
246
  "fileReadingFailed": "Échec de la lecture du fichier",
245
247
  "uploadFailed": "Échec du téléchargement",
@@ -248,7 +250,8 @@
248
250
  "replace": "Remplacer",
249
251
  "maxImagesReached": "Vous pouvez télécharger jusqu'à {{max}} images",
250
252
  "remaining": "restant",
251
- "maxReached": "Limite atteinte"
253
+ "maxReached": "Limite atteinte",
254
+ "dragAndDropFiles": "Arrastre y suelte los archivos aquí para agregarlos a la chat"
252
255
  },
253
256
  "media": {
254
257
  "title": "Título",
@@ -21,6 +21,7 @@
21
21
  "day": "Jour",
22
22
  "month": "Mois",
23
23
  "year": "Année",
24
+ "placeholder": "Faites une question",
24
25
  "createdAt": "Date de création",
25
26
  "all": "Tous",
26
27
  "today": "Aujourd'hui",
@@ -245,9 +246,10 @@
245
246
  "upload": {
246
247
  "loginRequired": "Connexion requise",
247
248
  "loginRequiredDescription": "Veuillez vous connecter pour télécharger des images",
248
- "uploadFiles": "Télécharger des fichiers",
249
- "uploadImage": "Télécharger une image",
250
- "uploadDocument": "Télécharger un document",
249
+ "uploadFiles": "Télécharger des fichiers ({{shortcut}}+O pour ouvrir le sélecteur de fichiers)",
250
+ "uploadFilesWithShortcut": "{{shortcut}}+O pour ouvrir le sélecteur de fichiers",
251
+ "uploadImages": "Télécharger des images",
252
+ "uploadDocuments": "Télécharger des documents",
251
253
  "replace": "Remplacer",
252
254
  "remaining": "restant",
253
255
  "maxReached": "Limite atteinte",
@@ -256,7 +258,8 @@
256
258
  "fileReadingFailed": "Échec de la lecture du fichier",
257
259
  "uploadFailed": "Échec du téléchargement",
258
260
  "uploadSuccess": "Téléchargement réussi",
259
- "uploadSuccessDescription": "Le fichier a été téléchargé avec succès"
261
+ "uploadSuccessDescription": "Le fichier a été téléchargé avec succès",
262
+ "dragAndDropFiles": "Glissez et déposez les fichiers ici pour les ajouter à la chat"
260
263
  },
261
264
  "media": {
262
265
  "title": "Titre",
@@ -37,6 +37,7 @@
37
37
  "last_7_days": "Ultimi 7 giorni",
38
38
  "last_30_days": "Ultimi 30 giorni",
39
39
  "previous": "Precedente",
40
+ "placeholder": "Fai una domanda",
40
41
  "copy": "Copia",
41
42
  "copyRawCode": "Copia codice sorgente",
42
43
  "copyToClipboard": "Copia negli appunti",
@@ -274,10 +275,11 @@
274
275
  "upload": {
275
276
  "loginRequired": "Login richiesto",
276
277
  "loginRequiredDescription": "Per caricare immagini, devi prima accedere",
277
- "uploadFiles": "Carica file",
278
- "uploadImage": "Carica immagine",
278
+ "uploadFiles": "Carica file ({{shortcut}}+O per aprire il selettore file)",
279
+ "uploadFilesWithShortcut": "{{shortcut}}+O per aprire il selettore file",
280
+ "uploadImages": "Carica immagini",
279
281
  "lastDocumentSlot": "Carica ultimo documento",
280
- "uploadDocument": "Carica documento",
282
+ "uploadDocuments": "Carica documenti",
281
283
  "maxDocumentsReached": "Puoi caricare fino a {{max}} documenti",
282
284
  "replace": "Sostituisci documento",
283
285
  "maxImagesReached": "Puoi caricare fino a {{max}} immagini",
@@ -287,13 +289,14 @@
287
289
  "uploadSuccess": "Caricamento riuscito",
288
290
  "remaining": "rimanenti",
289
291
  "maxReached": "Limite raggiunto",
290
- "titleImage": "Immagine: {{title}}",
292
+ "titleImage": "Titolo immagine: {{title}}",
291
293
  "titleImageUpload": "Carica immagini",
292
294
  "titleHelp": "Aggiungi un titolo descrittivo per aiutare l'AI a fornire risposte più appropriate.",
293
295
  "titlePlaceholder": "Inserisci il titolo dell'immagine",
294
296
  "uploadSuccessDescription": "Il file è stato caricato con successo",
295
297
  "partialUpload": "Solo {{uploaded}} immagini su {{total}} immagini saranno caricate. Massimo {{max}} immagini consentite.",
296
- "cancel": "Annulla"
298
+ "cancel": "Annulla",
299
+ "dragAndDropFiles": "Trascina qui i file per aggiungerli alla chat"
297
300
  },
298
301
  "gamification": {
299
302
  "level": "Livello",
package/src/styles.css CHANGED
@@ -43,7 +43,6 @@
43
43
  @import url('./components/ShareButton/ShareButton.css');
44
44
  @import url('./components/Snippet/Snippet.css');
45
45
  @import url('./components/StartPanel/StartPanel.css');
46
- @import url('./components/UploadMenu/UploadMenu.css');
47
46
  @import url('./components/DateSelector/DateSelector.css');
48
47
  @import url('./components/AgeVerificationModal/AgeVerificationModal.css');
49
48
  @import url('./components/KnownFacts/KnownFacts.css');
@@ -97,7 +96,7 @@ body.sb-show-main #root,
97
96
  --memori-chat-bubble-bg: #fff;
98
97
  --memori-chat-user-bubble-bg: var(--memori-primary);
99
98
  --memori-text-color: #000;
100
- --memori-border-radius: 5px;
99
+ --memori-border-radius: 8px;
101
100
  --memori-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02);
102
101
  --memori-button-bg: #fff;
103
102
  --memori-button-text: #000;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import { User, Tenant } from '@memori.ai/memori-api-client/dist/types';
3
- import memoriApiClient from '@memori.ai/memori-api-client';
4
- export interface Props {
5
- tenant: Tenant;
6
- apiClient: ReturnType<typeof memoriApiClient>;
7
- onLogin: (user: User, token: string) => void;
8
- goToLogin: () => void;
9
- __TEST__waitingForOtp?: boolean;
10
- }
11
- declare const SignupForm: ({ tenant, apiClient, onLogin, goToLogin, __TEST__waitingForOtp, }: Props) => JSX.Element;
12
- export default SignupForm;
@@ -1,199 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
7
- const react_i18next_1 = require("react-i18next");
8
- const react_hot_toast_1 = tslib_1.__importDefault(require("react-hot-toast"));
9
- const utils_1 = require("../../helpers/utils");
10
- const error_1 = require("../../helpers/error");
11
- const reservedUserNames = [
12
- 'memori',
13
- 'private',
14
- 'public',
15
- 'api',
16
- '404',
17
- '500',
18
- 'it',
19
- 'en',
20
- 'account',
21
- 'auth',
22
- 'logout',
23
- 'privacy_and_cookie',
24
- 'unauthorized',
25
- 'users',
26
- 'virtual_spaces',
27
- ];
28
- const SignupForm = ({ tenant, apiClient, onLogin, goToLogin, __TEST__waitingForOtp = false, }) => {
29
- const { t, i18n } = (0, react_i18next_1.useTranslation)();
30
- const lang = i18n.language === 'it' ? 'it' : 'en';
31
- const { userSignUp, userConfirmSignUp, resendVerificationCode } = apiClient.backend;
32
- const [email, setEmail] = (0, react_1.useState)();
33
- const [username, setUsername] = (0, react_1.useState)();
34
- const [password, setPassword] = (0, react_1.useState)();
35
- const [confirmPassword, setConfirmPassword] = (0, react_1.useState)();
36
- const pwdAcceptable = !password || (password && utils_1.pwdRegEx.test(password));
37
- const pwdGreen = pwdAcceptable && password && password.length >= 24;
38
- const pwdEmpty = !password || password.length === 0;
39
- const pwdMeterValue = !pwdAcceptable || pwdEmpty
40
- ? 0
41
- : password.length < 8
42
- ? 15
43
- : password.length >= 32
44
- ? 100
45
- : (password.length - 8) * (50 / 24) + 50;
46
- const [loading, setLoading] = (0, react_1.useState)(false);
47
- const [loadingOtp, setLoadingOtp] = (0, react_1.useState)(false);
48
- const [waitingForOtp, setWaitingForOtp] = (0, react_1.useState)(__TEST__waitingForOtp);
49
- const [error, setError] = (0, react_1.useState)(null);
50
- const [referral, setReferral] = (0, react_1.useState)();
51
- (0, react_1.useEffect)(() => {
52
- setReferral(window.location.href);
53
- }, []);
54
- const generateUsernameFromEmail = (email) => email.split('@')[0].replace(/[^a-zA-Z0-9]/g, '');
55
- const signup = async (e) => {
56
- var _a, _b, _c, _d, _e, _f, _g;
57
- e.preventDefault();
58
- const form = e.currentTarget;
59
- const tenantID = (_a = form.tenant.value) !== null && _a !== void 0 ? _a : tenant.name;
60
- const eMail = ((_b = form.eMail.value) !== null && _b !== void 0 ? _b : email).toLowerCase();
61
- const userName = (_c = form.userName.value) !== null && _c !== void 0 ? _c : username;
62
- const password = form.password.value;
63
- const birthDate = new Date((_d = form.birthDate) === null || _d === void 0 ? void 0 : _d.value).toISOString();
64
- const tnCAndPPAccepted = (_e = form.tnCAndPPAccepted) === null || _e === void 0 ? void 0 : _e.checked;
65
- const pAndCUAccepted = (_f = form.pAndCUAccepted) === null || _f === void 0 ? void 0 : _f.checked;
66
- const referral = (_g = form.referral) === null || _g === void 0 ? void 0 : _g.value;
67
- if (!eMail || !userName || !password || !birthDate || !tnCAndPPAccepted) {
68
- setError(t('missingData'));
69
- return;
70
- }
71
- setLoading(true);
72
- setError(null);
73
- const age = (new Date().getTime() - new Date(birthDate).getTime()) /
74
- 1000 /
75
- 60 /
76
- 60 /
77
- 24 /
78
- 365;
79
- if (age < 14) {
80
- react_hot_toast_1.default.error(t('login.underage', { age: 14 }));
81
- setError(t('login.underage', { age: 14 }));
82
- return;
83
- }
84
- try {
85
- const { user, ...resp } = await userSignUp({
86
- tenant: tenantID,
87
- eMail,
88
- userName,
89
- password,
90
- birthDate,
91
- tnCAndPPAccepted,
92
- tnCAndPPAcceptanceDate: new Date().toISOString(),
93
- pAndCUAccepted,
94
- pAndCUAcceptanceDate: new Date().toISOString(),
95
- referral,
96
- });
97
- if (resp.resultCode !== 0) {
98
- console.error(resp);
99
- react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
100
- }
101
- else if (user) {
102
- react_hot_toast_1.default.success(t('success'));
103
- setWaitingForOtp(true);
104
- }
105
- }
106
- catch (e) {
107
- let err = e;
108
- console.error('[signup]', err);
109
- if (err === null || err === void 0 ? void 0 : err.message)
110
- react_hot_toast_1.default.error(err.message);
111
- }
112
- finally {
113
- setLoading(false);
114
- }
115
- };
116
- const resendOtp = async (e) => {
117
- e.preventDefault();
118
- if (!username)
119
- return;
120
- setLoadingOtp(true);
121
- try {
122
- const resp = await resendVerificationCode({
123
- tenant: tenant === null || tenant === void 0 ? void 0 : tenant.name,
124
- userName: username,
125
- });
126
- if (resp.resultCode === 0) {
127
- react_hot_toast_1.default.success(t('resentVerificationCode'));
128
- }
129
- else {
130
- console.error(resp);
131
- react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
132
- }
133
- }
134
- catch (e) {
135
- let err = e;
136
- console.error('[resend otp]', err);
137
- if (err === null || err === void 0 ? void 0 : err.message)
138
- react_hot_toast_1.default.error(err.message);
139
- }
140
- finally {
141
- setLoadingOtp(false);
142
- }
143
- };
144
- const validateOtp = async (e) => {
145
- var _a, _b, _c;
146
- e.preventDefault();
147
- const form = e.currentTarget;
148
- const tenantID = (_a = form.tenant.value) !== null && _a !== void 0 ? _a : tenant.name;
149
- const userName = (_b = form.userName.value) !== null && _b !== void 0 ? _b : username;
150
- const pwd = (_c = form.password.value) !== null && _c !== void 0 ? _c : password;
151
- const verificationCode = form.verificationCode.value;
152
- setLoading(true);
153
- setError(null);
154
- try {
155
- const { user, token, ...resp } = await userConfirmSignUp({
156
- tenant: tenantID,
157
- userName,
158
- password: pwd,
159
- verificationCode,
160
- });
161
- if (resp.resultCode !== 0) {
162
- console.error(resp);
163
- react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
164
- }
165
- else if (user && token) {
166
- react_hot_toast_1.default.success(t('success'));
167
- onLogin(user, token);
168
- }
169
- }
170
- catch (e) {
171
- let err = e;
172
- console.error('[validate otp]', err);
173
- if (err === null || err === void 0 ? void 0 : err.message)
174
- react_hot_toast_1.default.error(err.message);
175
- }
176
- finally {
177
- setLoading(false);
178
- }
179
- };
180
- return waitingForOtp ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { className: "memori--login-drawer--form", onSubmit: validateOtp, children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "userName", value: username }), (0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "password", value: password }), (0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "tenant", value: tenant.name }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#verificationCode", children: [t('login.otpCode'), (0, jsx_runtime_1.jsx)("input", { id: "verificationCode", name: "verificationCode", type: "text", required: true, autoComplete: "one-time-code", placeholder: t('login.otpCode') || 'OTP' })] }), (0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)(Button_1.default, { outlined: true, onClick: resendOtp, loading: loadingOtp, children: t('login.resendVerificationCode') }) }), (0, jsx_runtime_1.jsx)(Button_1.default, { htmlType: "submit", primary: true, loading: loading, children: t('confirm') })] }), error && ((0, jsx_runtime_1.jsx)("p", { role: "alert", className: "memori--login-drawer--error", children: error }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { className: "memori--login-drawer--form", onSubmit: signup, children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "tenant", value: tenant.name }), (0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "referral", value: referral }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#eMail", children: [t('login.email'), (0, jsx_runtime_1.jsx)("input", { type: "email", name: "eMail", id: "eMail", required: true, autoComplete: "email", placeholder: t('login.email') || 'Email', onChange: e => setEmail(e.target.value), "aria-invalid": !!(email === null || email === void 0 ? void 0 : email.length) && !utils_1.mailRegEx.test(email) })] }), !!(email === null || email === void 0 ? void 0 : email.length) && !utils_1.mailRegEx.test(email) && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-drawer--inline-error", children: t('login.emailFormatError') })), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "userName", children: [t('login.username'), (0, jsx_runtime_1.jsx)("input", { type: "text", name: "userName", id: "userName", required: true, autoComplete: "username", placeholder: t('login.username') || 'Username', onFocus: () => {
181
- if (!(username === null || username === void 0 ? void 0 : username.length) && !!(email === null || email === void 0 ? void 0 : email.length)) {
182
- let username = generateUsernameFromEmail(email);
183
- const field = document.getElementById('userName');
184
- if (field) {
185
- field.value = username;
186
- setUsername(username);
187
- }
188
- }
189
- }, onChange: e => setUsername(e.target.value), "aria-invalid": !!(username === null || username === void 0 ? void 0 : username.length) &&
190
- (reservedUserNames.includes(username.toLowerCase()) ||
191
- !utils_1.usernameRegEx.test(username)) })] }), !!(username === null || username === void 0 ? void 0 : username.length) &&
192
- reservedUserNames.includes(username.toLowerCase()) && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-drawer--inline-error", children: t('login.usernameContainsReservedWord') })), !!(username === null || username === void 0 ? void 0 : username.length) && !utils_1.usernameRegEx.test(username) && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-drawer--inline-error", children: t('login.usernameFormatError') })), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#birthDate", children: [t('login.birthDate'), (0, jsx_runtime_1.jsx)("input", { id: "birthDate", name: "birthDate", type: "date", required: true, autoComplete: "bday" })] }), (0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)("small", { children: t('login.birthDateHelper') }) }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#password", children: [t('login.password'), (0, jsx_runtime_1.jsx)("input", { id: "password", name: "password", type: "password", required: true, autoComplete: "new-password", placeholder: t('login.password') || 'Password', onChange: e => setPassword(e.target.value), "aria-invalid": !pwdAcceptable })] }), !pwdAcceptable && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-drawer--inline-error", children: t('login.passwordFormatError') })), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#confirm-password", children: [t('login.confirmPassword'), (0, jsx_runtime_1.jsx)("input", { id: "confirm-password", name: "confirmPassword", type: "password", required: true, autoComplete: "new-password", placeholder: t('login.confirmPassword') || 'Password', onChange: e => setConfirmPassword(e.target.value), "aria-invalid": !!(password === null || password === void 0 ? void 0 : password.length) &&
193
- !!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
194
- password !== confirmPassword })] }), !!(password === null || password === void 0 ? void 0 : password.length) &&
195
- !!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
196
- password !== confirmPassword && ((0, jsx_runtime_1.jsx)("p", { className: "memori--login-drawer--inline-error", children: t('login.passwordMatchingError') })), (0, jsx_runtime_1.jsx)("meter", { className: "memori--login-drawer--password-meter", min: 0, low: 33, high: 66, optimum: 80, max: 100, value: pwdMeterValue, id: "password-strength-meter" }), (0, jsx_runtime_1.jsx)("small", { children: t(`login.pwd${pwdGreen ? 'Strong' : pwdAcceptable ? 'Acceptable' : 'Weak'}`) }), (0, jsx_runtime_1.jsxs)("label", { className: "memori-checkbox", children: [(0, jsx_runtime_1.jsxs)("span", { className: "memori-checkbox--input-wrapper", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", name: "tnCAndPPAccepted", required: true, className: "memori-checkbox--input" }), (0, jsx_runtime_1.jsx)("span", { className: "memori-checkbox--inner" })] }), (0, jsx_runtime_1.jsxs)("span", { className: "memori-checkbox--text", children: [t('login.privacyLabel'), ' ', (0, jsx_runtime_1.jsx)("a", { href: `https://memori.ai/${lang}/privacy_and_cookie`, target: "_blank", rel: "noopener noreferrer", children: t('login.privacyAndCookiePolicy') }), ' ', t('login.and'), ' ', (0, jsx_runtime_1.jsx)("a", { href: `https://memori.ai/${lang}/tos`, target: "_blank", rel: "noopener noreferrer", children: t('login.termsOfService') })] })] }), (0, jsx_runtime_1.jsxs)("label", { className: "memori-checkbox", children: [(0, jsx_runtime_1.jsxs)("span", { className: "memori-checkbox--input-wrapper", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", name: "pAndCUAccepted", className: "memori-checkbox--input" }), (0, jsx_runtime_1.jsx)("span", { className: "memori-checkbox--inner" })] }), (0, jsx_runtime_1.jsxs)("span", { className: "memori-checkbox--text", children: [t('login.pAndCUAccepted'), ' ', (0, jsx_runtime_1.jsx)("small", { children: (0, jsx_runtime_1.jsxs)("em", { children: ["(", t('login.optional'), ")"] }) })] })] }), (0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)("small", { children: t('login.deepThoughtExplaination') }) }), (0, jsx_runtime_1.jsx)(Button_1.default, { htmlType: "submit", primary: true, loading: loading, children: t('login.signUp') }), (0, jsx_runtime_1.jsxs)("p", { className: "memori--login-drawer--signup", children: [t('login.alreadyHaveAnAccount'), ' ', (0, jsx_runtime_1.jsx)(Button_1.default, { outlined: true, onClick: goToLogin, children: t('login.backToLogin') })] })] }), error && ((0, jsx_runtime_1.jsx)("p", { role: "alert", className: "memori--login-drawer--error", children: error }))] }));
197
- };
198
- exports.default = SignupForm;
199
- //# sourceMappingURL=SignupForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignupForm.js","sourceRoot":"","sources":["../../../src/components/SignupForm/SignupForm.tsx"],"names":[],"mappings":";;;;AACA,iCAAmD;AACnD,kEAAkC;AAClC,iDAA+C;AAE/C,8EAAoC;AACpC,+CAAyE;AACzE,+CAAsD;AAEtD,MAAM,iBAAiB,GAAG;IACxB,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,KAAK;IACL,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,SAAS;IACT,MAAM;IACN,QAAQ;IACR,oBAAoB;IACpB,cAAc;IACd,OAAO;IACP,gBAAgB;CACjB,CAAC;AAUF,MAAM,UAAU,GAAG,CAAC,EAClB,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,qBAAqB,GAAG,KAAK,GACvB,EAAE,EAAE;IACV,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAElD,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GAC7D,SAAS,CAAC,OAAO,CAAC;IAEpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAU,CAAC;IAC7C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,GAAU,CAAC;IACnD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,GAAU,CAAC;IACnD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAA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CAAC,sBAAsB,CAAC,EAAE,GAAG,EAC/B,4CACE,gDAAM,CAAC,CAAC,gBAAgB,CAAC,SAAO,GAC1B,IACH,IACD,EACR,wCACE,4CAAQ,CAAC,CAAC,+BAA+B,CAAC,GAAS,GACjD,EAEJ,uBAAC,gBAAM,IAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,QAAC,OAAO,EAAE,OAAO,YAC/C,CAAC,CAAC,cAAc,CAAC,GACX,EAET,+BAAG,SAAS,EAAC,8BAA8B,aACxC,CAAC,CAAC,4BAA4B,CAAC,EAAE,GAAG,EACrC,uBAAC,gBAAM,IAAC,QAAQ,QAAC,OAAO,EAAE,SAAS,YAChC,CAAC,CAAC,mBAAmB,CAAC,GAChB,IACP,IACC,EAEN,KAAK,IAAI,CACR,8BAAG,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,6BAA6B,YACpD,KAAK,GACJ,CACL,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -1,47 +0,0 @@
1
- .memori-upload-menu {
2
- position: relative;
3
- display: inline-block;
4
- }
5
-
6
- .memori--conversation-button {
7
- cursor: pointer;
8
- }
9
-
10
- .memori-menu--overlay {
11
- position: absolute;
12
- top: 100%;
13
- right: 0;
14
- left: auto;
15
- display: flex;
16
- min-width: 12rem;
17
- flex-direction: column;
18
- padding: 0.5rem 0;
19
- border: 1px solid rgba(0, 0, 0, 0.1);
20
- border-radius: 0.375rem;
21
- margin: 0;
22
- margin-top: 0.5rem;
23
- background-color: #fff;
24
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.12);
25
- list-style: none;
26
- outline: none;
27
- transform-origin: top right;
28
- }
29
-
30
- .memori-menu--li {
31
- display: flex;
32
- align-items: center;
33
- justify-content: center;
34
- }
35
-
36
- a.memori-menu--button,
37
- button.memori-menu--button {
38
- width: 100%;
39
- justify-content: flex-start;
40
- color: #000;
41
- text-align: left;
42
- text-decoration: none;
43
- }
44
-
45
- .memori-menu--icon {
46
- width: 1em;
47
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export interface Props {
3
- attachmentsMenuOpen?: 'link' | 'media';
4
- setAttachmentsMenuOpen: (value: 'link' | 'media') => void;
5
- disabled?: boolean;
6
- authToken?: string;
7
- }
8
- declare const UploadMenu: React.FC<Props>;
9
- export default UploadMenu;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("@headlessui/react");
6
- const classnames_1 = tslib_1.__importDefault(require("classnames"));
7
- const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
8
- const Link_1 = tslib_1.__importDefault(require("../icons/Link"));
9
- const Picture_1 = tslib_1.__importDefault(require("../icons/Picture"));
10
- const PaperClip_1 = tslib_1.__importDefault(require("../icons/PaperClip"));
11
- const UploadMenu = ({ attachmentsMenuOpen, setAttachmentsMenuOpen, disabled = false, authToken, }) => {
12
- return ((0, jsx_runtime_1.jsxs)(react_1.Menu, { as: "div", className: "memori-upload-menu", children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Button, { disabled: disabled, className: (0, classnames_1.default)('memori-button', 'memori-button--circle', 'memori-button--icon-only', 'memori-share-button--button', 'memori--conversation-button'), children: (0, jsx_runtime_1.jsx)("div", { className: "memori-button--icon", children: (0, jsx_runtime_1.jsx)(PaperClip_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)(react_1.Menu.Items, { as: "ul", className: "memori-menu--overlay", children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { as: "li", className: "memori-menu--li", children: (0, jsx_runtime_1.jsx)(Button_1.default, { className: "memori-menu--button", ghost: true, icon: (0, jsx_runtime_1.jsx)(Link_1.default, {}), outlined: attachmentsMenuOpen === 'link', onClick: () => setAttachmentsMenuOpen('link'), children: "Link" }) }), !!(authToken === null || authToken === void 0 ? void 0 : authToken.length) && ((0, jsx_runtime_1.jsx)(react_1.Menu.Item, { children: (0, jsx_runtime_1.jsx)(Button_1.default, { className: "memori-menu--button", ghost: true, icon: (0, jsx_runtime_1.jsx)(Picture_1.default, {}), outlined: attachmentsMenuOpen === 'media', onClick: () => setAttachmentsMenuOpen('media'), children: "Media" }) }))] })] }));
13
- };
14
- exports.default = UploadMenu;
15
- //# sourceMappingURL=UploadMenu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadMenu.js","sourceRoot":"","sources":["../../../src/components/UploadMenu/UploadMenu.tsx"],"names":[],"mappings":";;;;AACA,6CAAyC;AACzC,oEAA4B;AAC5B,kEAAkC;AAClC,iEAAiC;AACjC,uEAAuC;AACvC,2EAA2C;AAS3C,MAAM,UAAU,GAAoB,CAAC,EACnC,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,GAAG,KAAK,EAChB,SAAS,GACV,EAAE,EAAE;IACH,OAAO,CACL,wBAAC,YAAI,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,oBAAoB,aAC3C,uBAAC,YAAI,CAAC,MAAM,IACV,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,IAAA,oBAAE,EACX,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,EAC7B,6BAA6B,CAC9B,YAED,gCAAK,SAAS,EAAC,qBAAqB,YAClC,uBAAC,mBAAS,KAAG,GACT,GACM,EACd,wBAAC,YAAI,CAAC,KAAK,IAAC,EAAE,EAAC,IAAI,EAAC,SAAS,EAAC,sBAAsB,aAClD,uBAAC,YAAI,CAAC,IAAI,IAAC,EAAE,EAAC,IAAI,EAAC,SAAS,EAAC,iBAAiB,YAC5C,uBAAC,gBAAM,IACL,SAAS,EAAC,qBAAqB,EAC/B,KAAK,QACL,IAAI,EAAE,uBAAC,cAAI,KAAG,EACd,QAAQ,EAAE,mBAAmB,KAAK,MAAM,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC,qBAGtC,GACC,EACX,CAAC,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAA,IAAI,CACtB,uBAAC,YAAI,CAAC,IAAI,cACR,uBAAC,gBAAM,IACL,SAAS,EAAC,qBAAqB,EAC/B,KAAK,QACL,IAAI,EAAE,uBAAC,iBAAO,KAAG,EACjB,QAAQ,EAAE,mBAAmB,KAAK,OAAO,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,sBAGvC,GACC,CACb,IACU,IACR,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import { User, Tenant } from '@memori.ai/memori-api-client/dist/types';
3
- import memoriApiClient from '@memori.ai/memori-api-client';
4
- export interface Props {
5
- tenant: Tenant;
6
- apiClient: ReturnType<typeof memoriApiClient>;
7
- onLogin: (user: User, token: string) => void;
8
- goToLogin: () => void;
9
- __TEST__waitingForOtp?: boolean;
10
- }
11
- declare const SignupForm: ({ tenant, apiClient, onLogin, goToLogin, __TEST__waitingForOtp, }: Props) => JSX.Element;
12
- export default SignupForm;