@memori.ai/memori-react 8.7.9 → 8.8.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.
- package/CHANGELOG.md +29 -0
- package/dist/components/ChatBubble/ChatBubble.js +5 -1
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/Header/Header.js +28 -14
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +2 -9
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.css +36 -3
- package/dist/components/MicrophoneButton/MicrophoneButton.js +25 -6
- package/dist/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +1 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.js +2 -4
- package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/dist/helpers/stt/useSTT.d.ts +0 -6
- package/dist/helpers/stt/useSTT.js +7 -137
- package/dist/helpers/stt/useSTT.js.map +1 -1
- package/dist/helpers/tts/useTTS.d.ts +1 -3
- package/dist/helpers/tts/useTTS.js +69 -17
- package/dist/helpers/tts/useTTS.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +5 -1
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/Header/Header.js +28 -14
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +2 -9
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.css +36 -3
- package/esm/components/MicrophoneButton/MicrophoneButton.js +25 -6
- package/esm/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.js +2 -4
- package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/esm/helpers/stt/useSTT.d.ts +0 -6
- package/esm/helpers/stt/useSTT.js +7 -137
- package/esm/helpers/stt/useSTT.js.map +1 -1
- package/esm/helpers/tts/useTTS.d.ts +1 -3
- package/esm/helpers/tts/useTTS.js +69 -17
- package/esm/helpers/tts/useTTS.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatBubble/ChatBubble.tsx +8 -1
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +100 -90
- package/src/components/Header/Header.tsx +43 -30
- package/src/components/MemoriWidget/MemoriWidget.tsx +3 -19
- package/src/components/MicrophoneButton/MicrophoneButton.css +36 -3
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +44 -18
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +4 -11
- package/src/helpers/stt/useSTT.ts +43 -253
- package/src/helpers/tts/useTTS.ts +281 -201
- package/src/index.stories.tsx +15 -14
- package/dist/components/AccountForm/AccountForm.d.ts +0 -11
- package/dist/components/AccountForm/AccountForm.js +0 -121
- package/dist/components/AccountForm/AccountForm.js.map +0 -1
- package/esm/components/AccountForm/AccountForm.d.ts +0 -11
- package/esm/components/AccountForm/AccountForm.js +0 -118
- package/esm/components/AccountForm/AccountForm.js.map +0 -1
|
@@ -1,121 +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 Tooltip_1 = tslib_1.__importDefault(require("../ui/Tooltip"));
|
|
12
|
-
const imgMimeTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
|
|
13
|
-
const AccountForm = ({ user, loginToken, apiClient, onUserUpdate }) => {
|
|
14
|
-
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
15
|
-
const lang = i18n.language === 'it' ? 'it' : 'en';
|
|
16
|
-
const { updateUser, uploadAsset } = apiClient.backend;
|
|
17
|
-
const [email, setEmail] = (0, react_1.useState)();
|
|
18
|
-
const [password, setPassword] = (0, react_1.useState)();
|
|
19
|
-
const [confirmPassword, setConfirmPassword] = (0, react_1.useState)();
|
|
20
|
-
const pwdAcceptable = !password || (password && utils_1.pwdRegEx.test(password));
|
|
21
|
-
const pwdGreen = pwdAcceptable && password && password.length >= 24;
|
|
22
|
-
const pwdEmpty = !password || password.length === 0;
|
|
23
|
-
const pwdMeterValue = !pwdAcceptable || pwdEmpty
|
|
24
|
-
? 0
|
|
25
|
-
: password.length < 8
|
|
26
|
-
? 15
|
|
27
|
-
: password.length >= 32
|
|
28
|
-
? 100
|
|
29
|
-
: (password.length - 8) * (50 / 24) + 50;
|
|
30
|
-
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
31
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
32
|
-
const sendUserUpdate = async (userID, user) => {
|
|
33
|
-
try {
|
|
34
|
-
const { user: updatedUser, ...resp } = await updateUser(loginToken, userID, user);
|
|
35
|
-
if (resp.resultCode !== 0) {
|
|
36
|
-
console.error(resp);
|
|
37
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
38
|
-
}
|
|
39
|
-
else if (updatedUser) {
|
|
40
|
-
react_hot_toast_1.default.success(t('success'));
|
|
41
|
-
onUserUpdate(updatedUser);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
let err = e;
|
|
46
|
-
console.error('[signup]', err);
|
|
47
|
-
if (err === null || err === void 0 ? void 0 : err.message)
|
|
48
|
-
react_hot_toast_1.default.error(err.message);
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
setLoading(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const submitUserUpdate = async (e) => {
|
|
55
|
-
var _a, _b, _c, _d, _e;
|
|
56
|
-
e.preventDefault();
|
|
57
|
-
if (!user.userID)
|
|
58
|
-
return;
|
|
59
|
-
const userID = user.userID;
|
|
60
|
-
const form = e.currentTarget;
|
|
61
|
-
const eMail = (_a = form.eMail.value) !== null && _a !== void 0 ? _a : email;
|
|
62
|
-
const newPassword = (_b = form.newPassword.value) !== null && _b !== void 0 ? _b : password;
|
|
63
|
-
const currentPassword = form.password.value;
|
|
64
|
-
const confirmPassword = form.confirmPassword.value;
|
|
65
|
-
const pAndCUAccepted = (_c = form.pAndCUAccepted) === null || _c === void 0 ? void 0 : _c.checked;
|
|
66
|
-
const avatar = (_e = (_d = form.avatar) === null || _d === void 0 ? void 0 : _d.files) === null || _e === void 0 ? void 0 : _e[0];
|
|
67
|
-
setLoading(true);
|
|
68
|
-
setError(null);
|
|
69
|
-
if ((newPassword === null || newPassword === void 0 ? void 0 : newPassword.length) && newPassword !== confirmPassword) {
|
|
70
|
-
setError(t('login.passwordMatchingError'));
|
|
71
|
-
setLoading(false);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let patchedUser = {
|
|
75
|
-
...((eMail === null || eMail === void 0 ? void 0 : eMail.length) && eMail !== user.eMail ? { eMail } : {}),
|
|
76
|
-
...(newPassword ? { password: currentPassword, newPassword } : {}),
|
|
77
|
-
...(pAndCUAccepted !== undefined && pAndCUAccepted !== user.pAndCUAccepted
|
|
78
|
-
? { pAndCUAccepted, pAndCUAcceptanceDate: new Date().toISOString() }
|
|
79
|
-
: {}),
|
|
80
|
-
};
|
|
81
|
-
if (Object.values(patchedUser).length === 0 && !avatar) {
|
|
82
|
-
console.debug('No changes to submit');
|
|
83
|
-
setLoading(false);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (avatar) {
|
|
87
|
-
const reader = new FileReader();
|
|
88
|
-
reader.onload = async (e) => {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
try {
|
|
91
|
-
const { asset: avatarAsset, ...resp } = await uploadAsset((_a = avatar.name) !== null && _a !== void 0 ? _a : 'avatar', (_b = e.target) === null || _b === void 0 ? void 0 : _b.result, loginToken);
|
|
92
|
-
if (resp.resultCode !== 0) {
|
|
93
|
-
console.error(resp);
|
|
94
|
-
react_hot_toast_1.default.error(t((0, error_1.getErrori18nKey)(resp.resultCode)));
|
|
95
|
-
}
|
|
96
|
-
else if (avatarAsset) {
|
|
97
|
-
patchedUser.avatarURL = avatarAsset.assetURL;
|
|
98
|
-
await sendUserUpdate(userID, patchedUser);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
let err = e;
|
|
103
|
-
console.error('[avatar upload]', err);
|
|
104
|
-
if (err === null || err === void 0 ? void 0 : err.message)
|
|
105
|
-
react_hot_toast_1.default.error(err.message);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
reader.readAsDataURL(avatar);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
await sendUserUpdate(userID, patchedUser);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h3", { className: "memori--login-drawer--edit-account-title", children: t('login.editAccount') }), (0, jsx_runtime_1.jsxs)("form", { className: "memori--login-drawer--form memori--login-drawer--account-form", onSubmit: submitUserUpdate, children: [(0, jsx_runtime_1.jsxs)("details", { className: "memori--details", children: [(0, jsx_runtime_1.jsx)("summary", { children: t('login.emailChange') }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#eMail", children: [t('login.email'), (0, jsx_runtime_1.jsx)("input", { type: "email", name: "eMail", id: "eMail", autoComplete: "email", placeholder: user.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)("details", { className: "memori--details", children: [(0, jsx_runtime_1.jsx)("summary", { children: t('login.passwordChange') }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#password", children: [t('login.currentPassword'), (0, jsx_runtime_1.jsx)("input", { id: "password", name: "password", type: "password", autoComplete: "password", placeholder: t('login.currentPassword') || 'Password' })] }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#newPassword", children: [t('login.newPassword'), (0, jsx_runtime_1.jsx)("input", { id: "newPassword", name: "newPassword", type: "password", 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", 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) &&
|
|
115
|
-
!!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
|
|
116
|
-
password !== confirmPassword })] }), !!(password === null || password === void 0 ? void 0 : password.length) &&
|
|
117
|
-
!!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
|
|
118
|
-
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)("details", { className: "memori--details", children: [(0, jsx_runtime_1.jsx)("summary", { children: t('login.avatarChange') }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: "#avatar", children: ["Avatar", (0, jsx_runtime_1.jsx)("input", { type: "file", name: "avatar", id: "avatar", accept: imgMimeTypes.join(', '), placeholder: user.avatarURL })] })] }), (0, jsx_runtime_1.jsxs)("label", { className: "memori-checkbox memori-checkbox--disabled", children: [(0, jsx_runtime_1.jsxs)("span", { className: "memori-checkbox--input-wrapper", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", name: "tnCAndPPAccepted", disabled: true, defaultChecked: user.tnCAndPPAccepted, checked: user.tnCAndPPAccepted, 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", defaultChecked: user.pAndCUAccepted }), (0, jsx_runtime_1.jsx)("span", { className: "memori-checkbox--inner" })] }), (0, jsx_runtime_1.jsx)(Tooltip_1.default, { align: "left", content: t('login.deepThoughtExplaination'), children: (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)(Button_1.default, { htmlType: "submit", primary: true, loading: loading, children: t('login.save') })] }), error && ((0, jsx_runtime_1.jsx)("p", { role: "alert", className: "memori--login-drawer--error", children: error }))] }));
|
|
119
|
-
};
|
|
120
|
-
exports.default = AccountForm;
|
|
121
|
-
//# sourceMappingURL=AccountForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountForm.js","sourceRoot":"","sources":["../../../src/components/AccountForm/AccountForm.tsx"],"names":[],"mappings":";;;;AACA,iCAAmD;AACnD,kEAAkC;AAClC,iDAA+C;AAE/C,8EAAoC;AACpC,+CAAyE;AACzE,+CAAsD;AACtD,oEAAoC;AASpC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAE3E,MAAM,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAS,EAAE,EAAE;IAC3E,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,WAAW,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC;IAEtD,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,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,GA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AAC,EAAE,GAAG,EAC/B,4CACE,gDAAM,CAAC,CAAC,gBAAgB,CAAC,SAAO,GAC1B,IACH,GACC,IACJ,EAER,uBAAC,gBAAM,IAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,QAAC,OAAO,EAAE,OAAO,YAC/C,CAAC,CAAC,YAAY,CAAC,GACT,IACJ,EACN,KAAK,IAAI,CACR,8BAAG,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,6BAA6B,YACpD,KAAK,GACJ,CACL,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { User } from '@memori.ai/memori-api-client/dist/types';
|
|
3
|
-
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
4
|
-
export interface Props {
|
|
5
|
-
user: User;
|
|
6
|
-
loginToken: string;
|
|
7
|
-
apiClient: ReturnType<typeof memoriApiClient>;
|
|
8
|
-
onUserUpdate: (user: User) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const AccountForm: ({ user, loginToken, apiClient, onUserUpdate }: Props) => JSX.Element;
|
|
11
|
-
export default AccountForm;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import Button from '../ui/Button';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import toast from 'react-hot-toast';
|
|
6
|
-
import { mailRegEx, pwdRegEx } from '../../helpers/utils';
|
|
7
|
-
import { getErrori18nKey } from '../../helpers/error';
|
|
8
|
-
import Tooltip from '../ui/Tooltip';
|
|
9
|
-
const imgMimeTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
|
|
10
|
-
const AccountForm = ({ user, loginToken, apiClient, onUserUpdate }) => {
|
|
11
|
-
const { t, i18n } = useTranslation();
|
|
12
|
-
const lang = i18n.language === 'it' ? 'it' : 'en';
|
|
13
|
-
const { updateUser, uploadAsset } = apiClient.backend;
|
|
14
|
-
const [email, setEmail] = useState();
|
|
15
|
-
const [password, setPassword] = useState();
|
|
16
|
-
const [confirmPassword, setConfirmPassword] = useState();
|
|
17
|
-
const pwdAcceptable = !password || (password && pwdRegEx.test(password));
|
|
18
|
-
const pwdGreen = pwdAcceptable && password && password.length >= 24;
|
|
19
|
-
const pwdEmpty = !password || password.length === 0;
|
|
20
|
-
const pwdMeterValue = !pwdAcceptable || pwdEmpty
|
|
21
|
-
? 0
|
|
22
|
-
: password.length < 8
|
|
23
|
-
? 15
|
|
24
|
-
: password.length >= 32
|
|
25
|
-
? 100
|
|
26
|
-
: (password.length - 8) * (50 / 24) + 50;
|
|
27
|
-
const [loading, setLoading] = useState(false);
|
|
28
|
-
const [error, setError] = useState(null);
|
|
29
|
-
const sendUserUpdate = async (userID, user) => {
|
|
30
|
-
try {
|
|
31
|
-
const { user: updatedUser, ...resp } = await updateUser(loginToken, userID, user);
|
|
32
|
-
if (resp.resultCode !== 0) {
|
|
33
|
-
console.error(resp);
|
|
34
|
-
toast.error(t(getErrori18nKey(resp.resultCode)));
|
|
35
|
-
}
|
|
36
|
-
else if (updatedUser) {
|
|
37
|
-
toast.success(t('success'));
|
|
38
|
-
onUserUpdate(updatedUser);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
let err = e;
|
|
43
|
-
console.error('[signup]', err);
|
|
44
|
-
if (err === null || err === void 0 ? void 0 : err.message)
|
|
45
|
-
toast.error(err.message);
|
|
46
|
-
}
|
|
47
|
-
finally {
|
|
48
|
-
setLoading(false);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const submitUserUpdate = async (e) => {
|
|
52
|
-
var _a, _b, _c, _d, _e;
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
if (!user.userID)
|
|
55
|
-
return;
|
|
56
|
-
const userID = user.userID;
|
|
57
|
-
const form = e.currentTarget;
|
|
58
|
-
const eMail = (_a = form.eMail.value) !== null && _a !== void 0 ? _a : email;
|
|
59
|
-
const newPassword = (_b = form.newPassword.value) !== null && _b !== void 0 ? _b : password;
|
|
60
|
-
const currentPassword = form.password.value;
|
|
61
|
-
const confirmPassword = form.confirmPassword.value;
|
|
62
|
-
const pAndCUAccepted = (_c = form.pAndCUAccepted) === null || _c === void 0 ? void 0 : _c.checked;
|
|
63
|
-
const avatar = (_e = (_d = form.avatar) === null || _d === void 0 ? void 0 : _d.files) === null || _e === void 0 ? void 0 : _e[0];
|
|
64
|
-
setLoading(true);
|
|
65
|
-
setError(null);
|
|
66
|
-
if ((newPassword === null || newPassword === void 0 ? void 0 : newPassword.length) && newPassword !== confirmPassword) {
|
|
67
|
-
setError(t('login.passwordMatchingError'));
|
|
68
|
-
setLoading(false);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
let patchedUser = {
|
|
72
|
-
...((eMail === null || eMail === void 0 ? void 0 : eMail.length) && eMail !== user.eMail ? { eMail } : {}),
|
|
73
|
-
...(newPassword ? { password: currentPassword, newPassword } : {}),
|
|
74
|
-
...(pAndCUAccepted !== undefined && pAndCUAccepted !== user.pAndCUAccepted
|
|
75
|
-
? { pAndCUAccepted, pAndCUAcceptanceDate: new Date().toISOString() }
|
|
76
|
-
: {}),
|
|
77
|
-
};
|
|
78
|
-
if (Object.values(patchedUser).length === 0 && !avatar) {
|
|
79
|
-
console.debug('No changes to submit');
|
|
80
|
-
setLoading(false);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (avatar) {
|
|
84
|
-
const reader = new FileReader();
|
|
85
|
-
reader.onload = async (e) => {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
try {
|
|
88
|
-
const { asset: avatarAsset, ...resp } = await uploadAsset((_a = avatar.name) !== null && _a !== void 0 ? _a : 'avatar', (_b = e.target) === null || _b === void 0 ? void 0 : _b.result, loginToken);
|
|
89
|
-
if (resp.resultCode !== 0) {
|
|
90
|
-
console.error(resp);
|
|
91
|
-
toast.error(t(getErrori18nKey(resp.resultCode)));
|
|
92
|
-
}
|
|
93
|
-
else if (avatarAsset) {
|
|
94
|
-
patchedUser.avatarURL = avatarAsset.assetURL;
|
|
95
|
-
await sendUserUpdate(userID, patchedUser);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
let err = e;
|
|
100
|
-
console.error('[avatar upload]', err);
|
|
101
|
-
if (err === null || err === void 0 ? void 0 : err.message)
|
|
102
|
-
toast.error(err.message);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
reader.readAsDataURL(avatar);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
await sendUserUpdate(userID, patchedUser);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
return (_jsxs(_Fragment, { children: [_jsx("h3", { className: "memori--login-drawer--edit-account-title", children: t('login.editAccount') }), _jsxs("form", { className: "memori--login-drawer--form memori--login-drawer--account-form", onSubmit: submitUserUpdate, children: [_jsxs("details", { className: "memori--details", children: [_jsx("summary", { children: t('login.emailChange') }), _jsxs("label", { htmlFor: "#eMail", children: [t('login.email'), _jsx("input", { type: "email", name: "eMail", id: "eMail", autoComplete: "email", placeholder: user.eMail, onChange: e => setEmail(e.target.value), "aria-invalid": !!(email === null || email === void 0 ? void 0 : email.length) && !mailRegEx.test(email) })] }), !!(email === null || email === void 0 ? void 0 : email.length) && !mailRegEx.test(email) && (_jsx("p", { className: "memori--login-drawer--inline-error", children: t('login.emailFormatError') }))] }), _jsxs("details", { className: "memori--details", children: [_jsx("summary", { children: t('login.passwordChange') }), _jsxs("label", { htmlFor: "#password", children: [t('login.currentPassword'), _jsx("input", { id: "password", name: "password", type: "password", autoComplete: "password", placeholder: t('login.currentPassword') || 'Password' })] }), _jsxs("label", { htmlFor: "#newPassword", children: [t('login.newPassword'), _jsx("input", { id: "newPassword", name: "newPassword", type: "password", autoComplete: "new-password", placeholder: t('login.password') || 'Password', onChange: e => setPassword(e.target.value), "aria-invalid": !pwdAcceptable })] }), !pwdAcceptable && (_jsx("p", { className: "memori--login-drawer--inline-error", children: t('login.passwordFormatError') })), _jsxs("label", { htmlFor: "#confirm-password", children: [t('login.confirmPassword'), _jsx("input", { id: "confirm-password", name: "confirmPassword", type: "password", 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) &&
|
|
112
|
-
!!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
|
|
113
|
-
password !== confirmPassword })] }), !!(password === null || password === void 0 ? void 0 : password.length) &&
|
|
114
|
-
!!(confirmPassword === null || confirmPassword === void 0 ? void 0 : confirmPassword.length) &&
|
|
115
|
-
password !== confirmPassword && (_jsx("p", { className: "memori--login-drawer--inline-error", children: t('login.passwordMatchingError') })), _jsx("meter", { className: "memori--login-drawer--password-meter", min: 0, low: 33, high: 66, optimum: 80, max: 100, value: pwdMeterValue, id: "password-strength-meter" }), _jsx("small", { children: t(`login.pwd${pwdGreen ? 'Strong' : pwdAcceptable ? 'Acceptable' : 'Weak'}`) })] }), _jsxs("details", { className: "memori--details", children: [_jsx("summary", { children: t('login.avatarChange') }), _jsxs("label", { htmlFor: "#avatar", children: ["Avatar", _jsx("input", { type: "file", name: "avatar", id: "avatar", accept: imgMimeTypes.join(', '), placeholder: user.avatarURL })] })] }), _jsxs("label", { className: "memori-checkbox memori-checkbox--disabled", children: [_jsxs("span", { className: "memori-checkbox--input-wrapper", children: [_jsx("input", { type: "checkbox", name: "tnCAndPPAccepted", disabled: true, defaultChecked: user.tnCAndPPAccepted, checked: user.tnCAndPPAccepted, className: "memori-checkbox--input" }), _jsx("span", { className: "memori-checkbox--inner" })] }), _jsxs("span", { className: "memori-checkbox--text", children: [t('login.privacyLabel'), ' ', _jsx("a", { href: `https://memori.ai/${lang}/privacy_and_cookie`, target: "_blank", rel: "noopener noreferrer", children: t('login.privacyAndCookiePolicy') }), ' ', t('login.and'), ' ', _jsx("a", { href: `https://memori.ai/${lang}/tos`, target: "_blank", rel: "noopener noreferrer", children: t('login.termsOfService') })] })] }), _jsxs("label", { className: "memori-checkbox", children: [_jsxs("span", { className: "memori-checkbox--input-wrapper", children: [_jsx("input", { type: "checkbox", name: "pAndCUAccepted", className: "memori-checkbox--input", defaultChecked: user.pAndCUAccepted }), _jsx("span", { className: "memori-checkbox--inner" })] }), _jsx(Tooltip, { align: "left", content: t('login.deepThoughtExplaination'), children: _jsxs("span", { className: "memori-checkbox--text", children: [t('login.pAndCUAccepted'), ' ', _jsx("small", { children: _jsxs("em", { children: ["(", t('login.optional'), ")"] }) })] }) })] }), _jsx(Button, { htmlType: "submit", primary: true, loading: loading, children: t('login.save') })] }), error && (_jsx("p", { role: "alert", className: "memori--login-drawer--error", children: error }))] }));
|
|
116
|
-
};
|
|
117
|
-
export default AccountForm;
|
|
118
|
-
//# sourceMappingURL=AccountForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountForm.js","sourceRoot":"","sources":["../../../src/components/AccountForm/AccountForm.tsx"],"names":[],"mappings":";AACA,OAAc,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,OAAO,MAAM,eAAe,CAAC;AASpC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAE3E,MAAM,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS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