@mx-cartographer/experiences 9.3.1 → 9.3.2
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 +5 -0
- package/dist/core/api/SettingsApi.d.ts +4 -0
- package/dist/core/api/SettingsApi.es.js +5 -4
- package/dist/core/api/SettingsApi.es.js.map +1 -1
- package/dist/core/constants/ApiEndpoints.d.ts +1 -0
- package/dist/core/constants/ApiEndpoints.es.js +1 -0
- package/dist/core/constants/ApiEndpoints.es.js.map +1 -1
- package/dist/core/stores/SettingsStore.d.ts +4 -0
- package/dist/core/stores/SettingsStore.es.js +80 -73
- package/dist/core/stores/SettingsStore.es.js.map +1 -1
- package/dist/core/types/localization/SettingsCopy.d.ts +6 -0
- package/dist/dashboard/Greeting.es.js +18 -19
- package/dist/dashboard/Greeting.es.js.map +1 -1
- package/dist/settings/components/profile/ProfileTab.d.ts +1 -1
- package/dist/settings/components/profile/ProfileTab.es.js +115 -108
- package/dist/settings/components/profile/ProfileTab.es.js.map +1 -1
- package/dist/settings/components/profile/actions/ResetPasswordAction.d.ts +4 -0
- package/dist/settings/components/profile/actions/ResetPasswordAction.es.js +94 -0
- package/dist/settings/components/profile/actions/ResetPasswordAction.es.js.map +1 -0
- package/dist/settings/components/profile/actions/VerifyEmailAction.es.js +20 -37
- package/dist/settings/components/profile/actions/VerifyEmailAction.es.js.map +1 -1
- package/dist/settings/components/profile/actions/VerifyPhoneAction.es.js +11 -17
- package/dist/settings/components/profile/actions/VerifyPhoneAction.es.js.map +1 -1
- package/dist/settings/constants/Settings.d.ts +8 -0
- package/dist/settings/constants/Settings.es.js +10 -3
- package/dist/settings/constants/Settings.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,178 +1,185 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { useScreenSize as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { useAppConfig as B, useGlobalCopyStore as F, useSettingsStore as L, useUserStore as M } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { useScreenSize as R } from "../../../common/hooks/useScreenSize.es.js";
|
|
3
|
+
import z from "../../../common/components/dialog/Dialog.es.js";
|
|
4
|
+
import I from "./actions/ResetPasswordAction.es.js";
|
|
5
|
+
import N from "./actions/VerifyEmailAction.es.js";
|
|
6
|
+
import j from "./actions/VerifyPhoneAction.es.js";
|
|
6
7
|
import p from "react";
|
|
7
|
-
import { observer as
|
|
8
|
-
import
|
|
9
|
-
import { H3 as
|
|
10
|
-
import
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { alpha as b, useTheme as
|
|
13
|
-
import
|
|
14
|
-
import { getUnixTime as
|
|
15
|
-
import
|
|
16
|
-
import { AdapterDateFns as
|
|
17
|
-
import { DatePicker as
|
|
18
|
-
import { LocalizationProvider as
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
first_name:
|
|
22
|
-
last_name:
|
|
23
|
-
email:
|
|
24
|
-
phone:
|
|
25
|
-
birthday:
|
|
26
|
-
postal_code:
|
|
27
|
-
credit_score:
|
|
28
|
-
}), [
|
|
8
|
+
import { observer as H } from "mobx-react-lite";
|
|
9
|
+
import l from "@mui/material/Stack";
|
|
10
|
+
import { H3 as J, P as O } from "@mxenabled/mxui";
|
|
11
|
+
import $ from "@mui/material/Button";
|
|
12
|
+
import { Fragment as G, jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
13
|
+
import { alpha as b, useTheme as K } from "@mui/material/styles";
|
|
14
|
+
import Y from "@mui/material/Box";
|
|
15
|
+
import { getUnixTime as q } from "date-fns/getUnixTime";
|
|
16
|
+
import d from "@mui/material/TextField";
|
|
17
|
+
import { AdapterDateFns as Q } from "@mui/x-date-pickers/AdapterDateFnsV3";
|
|
18
|
+
import { DatePicker as W } from "@mui/x-date-pickers";
|
|
19
|
+
import { LocalizationProvider as X } from "@mui/x-date-pickers/LocalizationProvider";
|
|
20
|
+
var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
|
|
21
|
+
const u = K(), { common: w, settings: o } = F(), { isMobile: c } = R(C), { config: h } = B(), { updateUser: S } = L(), { user: r } = M(), [a, U] = p.useState({
|
|
22
|
+
first_name: r.first_name,
|
|
23
|
+
last_name: r.last_name,
|
|
24
|
+
email: r.email,
|
|
25
|
+
phone: r.phone,
|
|
26
|
+
birthday: r.birthday,
|
|
27
|
+
postal_code: r.postal_code,
|
|
28
|
+
credit_score: r.credit_score
|
|
29
|
+
}), [m, y] = p.useState(!1), [P, g] = p.useState(!1), _ = p.useRef(null), v = a.email && !r.email_is_verified && !m, x = a.phone && !r.phone_is_verified && !m;
|
|
29
30
|
p.useEffect(() => {
|
|
30
|
-
if (
|
|
31
|
-
const e = (
|
|
32
|
-
_.current && !_.current.contains(
|
|
31
|
+
if (f) {
|
|
32
|
+
const e = (s) => {
|
|
33
|
+
_.current && !_.current.contains(s.target) && m && g(!0);
|
|
33
34
|
};
|
|
34
35
|
return document.addEventListener("mousedown", e), () => {
|
|
35
36
|
document.removeEventListener("mousedown", e);
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const e = /* @__PURE__ */ new Date(
|
|
42
|
-
return new Date(
|
|
39
|
+
}, [m]);
|
|
40
|
+
const T = () => {
|
|
41
|
+
if (a.birthday) {
|
|
42
|
+
const e = /* @__PURE__ */ new Date(a.birthday * 1e3), s = e.getUTCFullYear(), A = e.getUTCMonth(), E = e.getUTCDate();
|
|
43
|
+
return new Date(s, A, E);
|
|
43
44
|
}
|
|
44
|
-
},
|
|
45
|
-
await
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
g(!1),
|
|
51
|
-
},
|
|
45
|
+
}, V = async () => {
|
|
46
|
+
await S({
|
|
47
|
+
...r,
|
|
48
|
+
...a
|
|
49
|
+
}), y(!1);
|
|
50
|
+
}, D = () => {
|
|
51
|
+
g(!1), f && f();
|
|
52
|
+
}, k = () => {
|
|
52
53
|
g(!1);
|
|
53
54
|
}, n = (e) => {
|
|
54
|
-
const
|
|
55
|
-
...
|
|
55
|
+
const s = {
|
|
56
|
+
...a,
|
|
56
57
|
...e
|
|
57
58
|
};
|
|
58
|
-
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
}) !== JSON.stringify(
|
|
59
|
+
U(s), y(JSON.stringify({
|
|
60
|
+
...r,
|
|
61
|
+
...s
|
|
62
|
+
}) !== JSON.stringify(r));
|
|
62
63
|
};
|
|
63
|
-
return /* @__PURE__ */ i(
|
|
64
|
+
return /* @__PURE__ */ i(G, { children: [/* @__PURE__ */ i(Y, {
|
|
64
65
|
component: "form",
|
|
65
66
|
ref: _,
|
|
66
67
|
sx: {
|
|
67
68
|
backgroundColor: "background.paper",
|
|
68
69
|
p: 24,
|
|
69
|
-
|
|
70
|
-
"& .MuiTextField-root": { width: h ? 272 : v ? 328 : y ? 483 : 352 }
|
|
70
|
+
"& .MuiTextField-root": { flex: 1 }
|
|
71
71
|
},
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */ t(
|
|
74
|
-
/* @__PURE__ */ t(
|
|
73
|
+
/* @__PURE__ */ t(J, { children: o.personal_details }),
|
|
74
|
+
/* @__PURE__ */ t(O, {
|
|
75
75
|
variant: "body1",
|
|
76
76
|
children: o.update_information
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */ i(
|
|
79
|
-
direction:
|
|
80
|
-
spacing:
|
|
78
|
+
/* @__PURE__ */ i(l, {
|
|
79
|
+
direction: c ? "column" : "row",
|
|
80
|
+
spacing: 24,
|
|
81
81
|
sx: {
|
|
82
|
-
mb:
|
|
83
|
-
pt:
|
|
82
|
+
mb: 24,
|
|
83
|
+
pt: 24
|
|
84
84
|
},
|
|
85
|
-
children: [/* @__PURE__ */ t(
|
|
86
|
-
defaultValue:
|
|
85
|
+
children: [/* @__PURE__ */ t(d, {
|
|
86
|
+
defaultValue: a.first_name,
|
|
87
87
|
label: o.first_name,
|
|
88
88
|
onChange: (e) => n({ first_name: e.target.value })
|
|
89
|
-
}), /* @__PURE__ */ t(
|
|
90
|
-
defaultValue:
|
|
89
|
+
}), /* @__PURE__ */ t(d, {
|
|
90
|
+
defaultValue: a.last_name,
|
|
91
91
|
label: o.last_name,
|
|
92
92
|
onChange: (e) => n({ last_name: e.target.value })
|
|
93
93
|
})]
|
|
94
94
|
}),
|
|
95
|
-
/* @__PURE__ */ i(
|
|
96
|
-
direction:
|
|
97
|
-
children: [
|
|
95
|
+
/* @__PURE__ */ i(l, {
|
|
96
|
+
direction: c ? "column" : "row",
|
|
97
|
+
children: [h.display_email_edit_field_in_settings && /* @__PURE__ */ i(l, {
|
|
98
98
|
sx: {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
flex: 1,
|
|
100
|
+
mb: v ? 20 : 24,
|
|
101
|
+
mr: c ? 0 : 24
|
|
101
102
|
},
|
|
102
|
-
children: [/* @__PURE__ */ t(
|
|
103
|
-
defaultValue:
|
|
103
|
+
children: [/* @__PURE__ */ t(d, {
|
|
104
|
+
defaultValue: a.email,
|
|
104
105
|
label: o.email_address,
|
|
105
106
|
onChange: (e) => n({ email: e.target.value })
|
|
106
|
-
}),
|
|
107
|
-
}),
|
|
108
|
-
sx: {
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
}), v && /* @__PURE__ */ t(N, {})]
|
|
108
|
+
}), h.display_sms_edit_field_in_settings && /* @__PURE__ */ i(l, {
|
|
109
|
+
sx: {
|
|
110
|
+
flex: 1,
|
|
111
|
+
mb: x ? 20 : 24
|
|
112
|
+
},
|
|
113
|
+
children: [/* @__PURE__ */ t(d, {
|
|
114
|
+
defaultValue: a.phone,
|
|
111
115
|
label: o.mobile_number,
|
|
112
116
|
onChange: (e) => n({ phone: e.target.value }),
|
|
113
117
|
type: "tel"
|
|
114
|
-
}),
|
|
118
|
+
}), x && /* @__PURE__ */ t(j, {})]
|
|
115
119
|
})]
|
|
116
120
|
}),
|
|
117
|
-
/* @__PURE__ */ i(
|
|
118
|
-
direction:
|
|
119
|
-
spacing:
|
|
120
|
-
sx: { mb:
|
|
121
|
-
children: [/* @__PURE__ */ t(
|
|
122
|
-
dateAdapter:
|
|
123
|
-
children: /* @__PURE__ */ t(
|
|
121
|
+
/* @__PURE__ */ i(l, {
|
|
122
|
+
direction: c ? "column" : "row",
|
|
123
|
+
spacing: 24,
|
|
124
|
+
sx: { mb: 24 },
|
|
125
|
+
children: [/* @__PURE__ */ t(X, {
|
|
126
|
+
dateAdapter: Q,
|
|
127
|
+
children: /* @__PURE__ */ t(W, {
|
|
124
128
|
label: o.birthdate,
|
|
125
|
-
onChange: (e) => n({ birthday:
|
|
129
|
+
onChange: (e) => n({ birthday: q(e) }),
|
|
126
130
|
slotProps: {
|
|
127
131
|
nextIconButton: { sx: {
|
|
128
132
|
color: "primary.main",
|
|
129
|
-
"&:hover": { backgroundColor: b(
|
|
133
|
+
"&:hover": { backgroundColor: b(u.palette.primary.light, 0.1) }
|
|
130
134
|
} },
|
|
131
135
|
previousIconButton: { sx: {
|
|
132
136
|
color: "primary.main",
|
|
133
|
-
"&:hover": { backgroundColor: b(
|
|
137
|
+
"&:hover": { backgroundColor: b(u.palette.primary.light, 0.1) }
|
|
134
138
|
} }
|
|
135
139
|
},
|
|
136
140
|
sx: {
|
|
137
141
|
width: "100%",
|
|
138
142
|
"& .MuiIconButton-edgeEnd": {
|
|
139
143
|
color: "primary.main",
|
|
140
|
-
"&:hover": { backgroundColor: b(
|
|
144
|
+
"&:hover": { backgroundColor: b(u.palette.primary.light, 0.1) }
|
|
141
145
|
}
|
|
142
146
|
},
|
|
143
|
-
value:
|
|
147
|
+
value: T()
|
|
144
148
|
})
|
|
145
|
-
}), /* @__PURE__ */ t(
|
|
146
|
-
defaultValue:
|
|
149
|
+
}), /* @__PURE__ */ t(d, {
|
|
150
|
+
defaultValue: a.postal_code,
|
|
147
151
|
label: o.zip_code,
|
|
148
152
|
onChange: (e) => n({ postal_code: e.target.value })
|
|
149
153
|
})]
|
|
150
154
|
}),
|
|
151
|
-
/* @__PURE__ */ i(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
/* @__PURE__ */ i(l, { children: [
|
|
156
|
+
/* @__PURE__ */ t(d, {
|
|
157
|
+
defaultValue: a.credit_score,
|
|
158
|
+
label: o.credit_score,
|
|
159
|
+
onChange: (e) => n({ credit_score: Number(e.target.value) })
|
|
160
|
+
}),
|
|
161
|
+
h.display_password_options_in_settings && /* @__PURE__ */ t(I, {}),
|
|
162
|
+
/* @__PURE__ */ t($, {
|
|
163
|
+
disabled: !m,
|
|
164
|
+
onClick: V,
|
|
165
|
+
sx: { width: c ? "100%" : 124 },
|
|
166
|
+
variant: "contained",
|
|
167
|
+
children: w.save_button
|
|
168
|
+
})
|
|
169
|
+
] })
|
|
163
170
|
]
|
|
164
|
-
}), /* @__PURE__ */ t(
|
|
171
|
+
}), /* @__PURE__ */ t(z, {
|
|
165
172
|
copy: { title: o.discard_changes },
|
|
166
|
-
isOpen:
|
|
167
|
-
onClose:
|
|
168
|
-
onSecondaryAction:
|
|
173
|
+
isOpen: P,
|
|
174
|
+
onClose: k,
|
|
175
|
+
onSecondaryAction: D,
|
|
169
176
|
primaryText: o.keep_editing,
|
|
170
177
|
secondaryText: o.leave,
|
|
171
178
|
children: o.discard_changes_message
|
|
172
179
|
})] });
|
|
173
|
-
},
|
|
180
|
+
}, ye = H(Z);
|
|
174
181
|
export {
|
|
175
|
-
|
|
182
|
+
ye as default
|
|
176
183
|
};
|
|
177
184
|
|
|
178
185
|
//# sourceMappingURL=ProfileTab.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileTab.es.js","names":[],"sources":["../../../../src/settings/components/profile/ProfileTab.tsx"],"sourcesContent":["/* eslint-disable no-nested-ternary */\n\nimport React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { getUnixTime } from 'date-fns/getUnixTime'\n\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'\nimport { DatePicker } from '@mui/x-date-pickers'\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'\n\nimport { alpha, useTheme } from '@mui/material/styles'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { H3, P } from '@mxenabled/mxui'\n\nimport {\n useAppConfig,\n useGlobalCopyStore,\n useScreenSize,\n useSettingsStore,\n useUserStore,\n Dialog,\n} from '../../../common'\nimport { type EditableUser } from '../../../core'\nimport VerifyEmailAction from './actions/VerifyEmailAction'\nimport VerifyPhoneAction from './actions/VerifyPhoneAction'\n\ninterface ProfileFormProps {\n availableWidth?: number\n handleOnLeavClick?: () => void\n}\n\ntype UserInput = {\n [U in keyof EditableUser]: EditableUser[U]\n}\n\nconst ProfileForm: React.FC<ProfileFormProps> = ({ availableWidth, handleOnLeavClick }) => {\n const theme = useTheme()\n const { common: commonCopy, settings: settingsCopy } = useGlobalCopyStore()\n const { isDesktop, isMobile, isSmallMobile, isTablet } = useScreenSize(availableWidth)\n const { config } = useAppConfig()\n const { updateUser } = useSettingsStore()\n const { user } = useUserStore()\n\n const [modifiedUser, setModifiedUser] = React.useState<EditableUser>({\n first_name: user.first_name,\n last_name: user.last_name,\n email: user.email,\n phone: user.phone,\n birthday: user.birthday,\n postal_code: user.postal_code,\n credit_score: user.credit_score,\n })\n const [hasUnsavedChanges, setHasUnsavedChanges] = React.useState(false)\n const [showLeaveDialog, setShowLeaveDialog] = React.useState(false)\n const boxRef = React.useRef<HTMLDivElement>(null)\n\n const showVerifyEmail = modifiedUser.email && !user.email_is_verified && !hasUnsavedChanges\n const showVerifyPhone = modifiedUser.phone && !user.phone_is_verified && !hasUnsavedChanges\n\n React.useEffect(() => {\n if (handleOnLeavClick) {\n const handleClickOutside = (event: MouseEvent) => {\n if (boxRef.current && !boxRef.current.contains(event.target as Node) && hasUnsavedChanges) {\n setShowLeaveDialog(true)\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n }\n }\n return undefined\n }, [hasUnsavedChanges])\n\n // eslint-disable-next-line consistent-return\n const formatReadableBirthday = () => {\n if (modifiedUser.birthday) {\n const utc = new Date(modifiedUser.birthday * 1000)\n const year = utc.getUTCFullYear()\n const month = utc.getUTCMonth()\n const day = utc.getUTCDate()\n return new Date(year, month, day)\n }\n }\n\n const handleSave = async () => {\n await updateUser({ ...user, ...modifiedUser })\n setHasUnsavedChanges(false)\n }\n\n const handleLeaveDialog = () => {\n setShowLeaveDialog(false)\n\n if (handleOnLeavClick) {\n handleOnLeavClick()\n }\n }\n\n const handleKeepEditing = () => {\n setShowLeaveDialog(false)\n }\n\n const handleInput = (update: UserInput) => {\n const changedUser = {\n ...modifiedUser,\n ...update,\n }\n setModifiedUser(changedUser)\n setHasUnsavedChanges(JSON.stringify({ ...user, ...changedUser }) !== JSON.stringify(user))\n }\n\n return (\n <>\n <Box\n component=\"form\"\n ref={boxRef}\n sx={{\n backgroundColor: 'background.paper',\n p: 24,\n width: isSmallMobile ? 320 : isTablet ? 680 : isDesktop ? 990 : 400,\n '& .MuiTextField-root': {\n width: isSmallMobile ? 272 : isTablet ? 328 : isDesktop ? 483 : 352,\n },\n }}\n >\n <H3>{settingsCopy.personal_details}</H3>\n <P variant=\"body1\">{settingsCopy.update_information}</P>\n <Stack\n direction={isMobile ? 'column' : 'row'}\n spacing={isMobile ? 44 : 24}\n sx={{ mb: 44, pt: 32 }}\n >\n <TextField\n defaultValue={modifiedUser.first_name}\n label={settingsCopy.first_name}\n onChange={(e) => handleInput({ first_name: e.target.value })}\n />\n <TextField\n defaultValue={modifiedUser.last_name}\n label={settingsCopy.last_name}\n onChange={(e) => handleInput({ last_name: e.target.value })}\n />\n </Stack>\n <Stack direction={isMobile ? 'column' : 'row'}>\n {config.display_email_edit_field_in_settings && (\n <Stack sx={{ mb: showVerifyEmail ? 20 : 44, mr: isMobile ? 0 : 24 }}>\n <TextField\n defaultValue={modifiedUser.email}\n label={settingsCopy.email_address}\n onChange={(e) => handleInput({ email: e.target.value })}\n />\n {showVerifyEmail && <VerifyEmailAction />}\n </Stack>\n )}\n {config.display_sms_edit_field_in_settings && (\n <Stack sx={{ mb: showVerifyPhone ? 20 : 44 }}>\n <TextField\n defaultValue={modifiedUser.phone}\n label={settingsCopy.mobile_number}\n onChange={(e) => handleInput({ phone: e.target.value })}\n type=\"tel\"\n />\n {showVerifyPhone && <VerifyPhoneAction />}\n </Stack>\n )}\n </Stack>\n <Stack direction={isMobile ? 'column' : 'row'} spacing={isMobile ? 44 : 24} sx={{ mb: 44 }}>\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <DatePicker\n label={settingsCopy.birthdate}\n onChange={(value) => handleInput({ birthday: getUnixTime(value as Date) })}\n slotProps={{\n nextIconButton: {\n sx: {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n previousIconButton: {\n sx: {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n }}\n sx={{\n width: '100%',\n '& .MuiIconButton-edgeEnd': {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n }}\n value={formatReadableBirthday()}\n />\n </LocalizationProvider>\n <TextField\n defaultValue={modifiedUser.postal_code}\n label={settingsCopy.zip_code}\n onChange={(e) => handleInput({ postal_code: e.target.value })}\n />\n </Stack>\n <Stack>\n <TextField\n defaultValue={modifiedUser.credit_score}\n label={settingsCopy.credit_score}\n onChange={(e) => handleInput({ credit_score: Number(e.target.value) })}\n sx={{ mb: 44 }}\n />\n <Button\n disabled={!hasUnsavedChanges}\n onClick={handleSave}\n sx={{ width: isSmallMobile ? 272 : 124 }}\n variant=\"contained\"\n >\n {commonCopy.save_button}\n </Button>\n </Stack>\n </Box>\n <Dialog\n copy={{ title: settingsCopy.discard_changes }}\n isOpen={showLeaveDialog}\n onClose={handleKeepEditing}\n onSecondaryAction={handleLeaveDialog}\n primaryText={settingsCopy.keep_editing}\n secondaryText={settingsCopy.leave}\n >\n {settingsCopy.discard_changes_message}\n </Dialog>\n </>\n )\n}\n\nexport default observer(ProfileForm)\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,IAAM,KAAA,CAA2C,EAAE,gBAAA,GAAgB,mBAAA,EAAA,MAAwB;AACzF,QAAM,IAAQ,EAAS,GACjB,EAAE,QAAQ,GAAY,UAAU,EAAA,IAAiB,EAAmB,GACpE,EAAE,WAAA,GAAW,UAAA,GAAU,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,CAAc,GAC/E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,YAAA,EAAA,IAAe,EAAiB,GAClC,EAAE,MAAA,EAAA,IAAS,EAAa,GAExB,CAAC,GAAc,CAAA,IAAmB,EAAM,SAAuB;AAAA,IACnE,YAAY,EAAK;AAAA,IACjB,WAAW,EAAK;AAAA,IAChB,OAAO,EAAK;AAAA,IACZ,OAAO,EAAK;AAAA,IACZ,UAAU,EAAK;AAAA,IACf,aAAa,EAAK;AAAA,IAClB,cAAc,EAAK;AAAA,EACrB,CAAC,GACK,CAAC,GAAmB,CAAA,IAAwB,EAAM,SAAS,EAAK,GAChE,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAK,GAC5D,IAAS,EAAM,OAAuB,IAAI,GAE1C,IAAkB,EAAa,SAAS,CAAC,EAAK,qBAAqB,CAAC,GACpE,IAAkB,EAAa,SAAS,CAAC,EAAK,qBAAqB,CAAC;AAE1E,EAAA,EAAM,UAAA,MAAgB;AACpB,QAAI,GAAmB;AACrB,YAAM,IAAA,CAAsB,MAAsB;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;AAAA,UAC3B,OAAO,EAAa;AAAA,UACpB,UAAA,CAAW,MAAM,EAAY,EAAE,aAAa,EAAE,OAAO,MAAM,CAAC;AAAA,QAC7D,CAAA,CACI;AAAA;MACP,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QACE,cAAc,EAAa;AAAA,QAC3B,OAAO,EAAa;AAAA,QACpB,UAAA,CAAW,MAAM,EAAY,EAAE,cAAc,OAAO,EAAE,OAAO,KAAK,EAAE,CAAC;AAAA,QACrE,IAAI,EAAE,IAAI,GAAG;AAAA,MACd,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,QACE,UAAU,CAAC;AAAA,QACX,SAAS;AAAA,QACT,IAAI,EAAE,OAAO,IAAgB,MAAM,IAAI;AAAA,QACvC,SAAQ;AAAA,QAEP,UAAA,EAAW;AAAA,MACN,CAAA,CACH,EAAA,CAAA;AAAA,IACJ;AAAA,EACL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM,EAAE,OAAO,EAAa,gBAAgB;AAAA,IAC5C,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,aAAa,EAAa;AAAA,IAC1B,eAAe,EAAa;AAAA,IAE3B,UAAA,EAAa;AAAA,EACR,CAAA,CACR,EAAA,CAAA;AAEN,GAEA,KAAe,EAAS,EAAW"}
|
|
1
|
+
{"version":3,"file":"ProfileTab.es.js","names":[],"sources":["../../../../src/settings/components/profile/ProfileTab.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { getUnixTime } from 'date-fns/getUnixTime'\n\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'\nimport { DatePicker } from '@mui/x-date-pickers'\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'\n\nimport { alpha, useTheme } from '@mui/material/styles'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { H3, P } from '@mxenabled/mxui'\n\nimport {\n useAppConfig,\n useGlobalCopyStore,\n useScreenSize,\n useSettingsStore,\n useUserStore,\n Dialog,\n} from '../../../common'\nimport { type EditableUser } from '../../../core'\nimport ResetPasswordAction from './actions/ResetPasswordAction'\nimport VerifyEmailAction from './actions/VerifyEmailAction'\nimport VerifyPhoneAction from './actions/VerifyPhoneAction'\n\ninterface ProfileFormProps {\n availableWidth?: number\n handleOnLeaveClick?: () => void\n}\n\ntype UserInput = {\n [U in keyof EditableUser]: EditableUser[U]\n}\n\nconst ProfileForm: React.FC<ProfileFormProps> = ({ availableWidth, handleOnLeaveClick }) => {\n const theme = useTheme()\n const { common: commonCopy, settings: settingsCopy } = useGlobalCopyStore()\n const { isMobile } = useScreenSize(availableWidth)\n const { config } = useAppConfig()\n const { updateUser } = useSettingsStore()\n const { user } = useUserStore()\n\n const [modifiedUser, setModifiedUser] = React.useState<EditableUser>({\n first_name: user.first_name,\n last_name: user.last_name,\n email: user.email,\n phone: user.phone,\n birthday: user.birthday,\n postal_code: user.postal_code,\n credit_score: user.credit_score,\n })\n const [hasUnsavedChanges, setHasUnsavedChanges] = React.useState(false)\n const [showLeaveDialog, setShowLeaveDialog] = React.useState(false)\n const boxRef = React.useRef<HTMLDivElement>(null)\n\n const showVerifyEmail = modifiedUser.email && !user.email_is_verified && !hasUnsavedChanges\n const showVerifyPhone = modifiedUser.phone && !user.phone_is_verified && !hasUnsavedChanges\n\n React.useEffect(() => {\n if (handleOnLeaveClick) {\n const handleClickOutside = (event: MouseEvent) => {\n if (boxRef.current && !boxRef.current.contains(event.target as Node) && hasUnsavedChanges) {\n setShowLeaveDialog(true)\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n }\n }\n return undefined\n }, [hasUnsavedChanges])\n\n // eslint-disable-next-line consistent-return\n const formatReadableBirthday = () => {\n if (modifiedUser.birthday) {\n const utc = new Date(modifiedUser.birthday * 1000)\n const year = utc.getUTCFullYear()\n const month = utc.getUTCMonth()\n const day = utc.getUTCDate()\n return new Date(year, month, day)\n }\n }\n\n const handleSave = async () => {\n await updateUser({ ...user, ...modifiedUser })\n setHasUnsavedChanges(false)\n }\n\n const handleLeaveDialog = () => {\n setShowLeaveDialog(false)\n\n if (handleOnLeaveClick) {\n handleOnLeaveClick()\n }\n }\n\n const handleKeepEditing = () => {\n setShowLeaveDialog(false)\n }\n\n const handleInput = (update: UserInput) => {\n const changedUser = {\n ...modifiedUser,\n ...update,\n }\n setModifiedUser(changedUser)\n setHasUnsavedChanges(JSON.stringify({ ...user, ...changedUser }) !== JSON.stringify(user))\n }\n\n return (\n <>\n <Box\n component=\"form\"\n ref={boxRef}\n sx={{\n backgroundColor: 'background.paper',\n p: 24,\n '& .MuiTextField-root': {\n flex: 1,\n },\n }}\n >\n <H3>{settingsCopy.personal_details}</H3>\n <P variant=\"body1\">{settingsCopy.update_information}</P>\n <Stack direction={isMobile ? 'column' : 'row'} spacing={24} sx={{ mb: 24, pt: 24 }}>\n <TextField\n defaultValue={modifiedUser.first_name}\n label={settingsCopy.first_name}\n onChange={(e) => handleInput({ first_name: e.target.value })}\n />\n <TextField\n defaultValue={modifiedUser.last_name}\n label={settingsCopy.last_name}\n onChange={(e) => handleInput({ last_name: e.target.value })}\n />\n </Stack>\n <Stack direction={isMobile ? 'column' : 'row'}>\n {config.display_email_edit_field_in_settings && (\n <Stack sx={{ flex: 1, mb: showVerifyEmail ? 20 : 24, mr: isMobile ? 0 : 24 }}>\n <TextField\n defaultValue={modifiedUser.email}\n label={settingsCopy.email_address}\n onChange={(e) => handleInput({ email: e.target.value })}\n />\n {showVerifyEmail && <VerifyEmailAction />}\n </Stack>\n )}\n {config.display_sms_edit_field_in_settings && (\n <Stack sx={{ flex: 1, mb: showVerifyPhone ? 20 : 24 }}>\n <TextField\n defaultValue={modifiedUser.phone}\n label={settingsCopy.mobile_number}\n onChange={(e) => handleInput({ phone: e.target.value })}\n type=\"tel\"\n />\n {showVerifyPhone && <VerifyPhoneAction />}\n </Stack>\n )}\n </Stack>\n <Stack direction={isMobile ? 'column' : 'row'} spacing={24} sx={{ mb: 24 }}>\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <DatePicker\n label={settingsCopy.birthdate}\n onChange={(value) => handleInput({ birthday: getUnixTime(value as Date) })}\n slotProps={{\n nextIconButton: {\n sx: {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n previousIconButton: {\n sx: {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n }}\n sx={{\n width: '100%',\n '& .MuiIconButton-edgeEnd': {\n color: 'primary.main',\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n }}\n value={formatReadableBirthday()}\n />\n </LocalizationProvider>\n <TextField\n defaultValue={modifiedUser.postal_code}\n label={settingsCopy.zip_code}\n onChange={(e) => handleInput({ postal_code: e.target.value })}\n />\n </Stack>\n <Stack>\n <TextField\n defaultValue={modifiedUser.credit_score}\n label={settingsCopy.credit_score}\n onChange={(e) => handleInput({ credit_score: Number(e.target.value) })}\n />\n {config.display_password_options_in_settings && <ResetPasswordAction />}\n <Button\n disabled={!hasUnsavedChanges}\n onClick={handleSave}\n sx={{ width: isMobile ? '100%' : 124 }}\n variant=\"contained\"\n >\n {commonCopy.save_button}\n </Button>\n </Stack>\n </Box>\n <Dialog\n copy={{ title: settingsCopy.discard_changes }}\n isOpen={showLeaveDialog}\n onClose={handleKeepEditing}\n onSecondaryAction={handleLeaveDialog}\n primaryText={settingsCopy.keep_editing}\n secondaryText={settingsCopy.leave}\n >\n {settingsCopy.discard_changes_message}\n </Dialog>\n </>\n )\n}\n\nexport default observer(ProfileForm)\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,IAAM,IAAA,CAA2C,EAAE,gBAAA,GAAgB,oBAAA,EA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AAS,IAAI;AAAA,UACrC,SAAQ;AAAA,UAEP,UAAA,EAAW;AAAA,QACN,CAAA;AAAA,MACH,EAAA,CAAA;AAAA,IACJ;AAAA,EACL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM,EAAE,OAAO,EAAa,gBAAgB;AAAA,IAC5C,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,aAAa,EAAa;AAAA,IAC1B,eAAe,EAAa;AAAA,IAE3B,UAAA,EAAa;AAAA,EACR,CAAA,CACR,EAAA,CAAA;AAEN,GAEA,KAAe,EAAS,CAAW"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useGlobalCopyStore as v, useSettingsStore as E } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import N from "../../../../common/components/dialog/Dialog.es.js";
|
|
3
|
+
import { HAS_LETTER as W, HAS_NUMBER as D, HIDE_CONFIRM_PASSWORD as I, HIDE_NEW_PASSWORD as T, PASSWORD_REQUIREMENTS as H, SHOW_CONFIRM_PASSWORD as M, SHOW_NEW_PASSWORD as k } from "../../../constants/Settings.es.js";
|
|
4
|
+
import s from "react";
|
|
5
|
+
import { observer as B } from "mobx-react-lite";
|
|
6
|
+
import S from "@mui/material/Stack";
|
|
7
|
+
import { Text as h } from "@mxenabled/mxui";
|
|
8
|
+
import j from "@mui/material/Button";
|
|
9
|
+
import { ChevronRight as F, Visibility as u, VisibilityOff as _ } from "@mxenabled/mx-icons";
|
|
10
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
import P from "@mui/material/IconButton";
|
|
12
|
+
import C from "@mui/material/InputAdornment";
|
|
13
|
+
import g from "@mui/material/TextField";
|
|
14
|
+
var ee = B(() => {
|
|
15
|
+
const { common: y, settings: t } = v(), { updatePassword: x } = E(), [A, l] = s.useState(!1), [o, p] = s.useState(""), [a, c] = s.useState(""), [r, m] = s.useState(!1), [n, w] = s.useState(!1), R = o.length >= 12 && W.test(o) && D.test(o) && o === a, f = () => {
|
|
16
|
+
l(!1), p(""), c(""), m(!1), w(!1);
|
|
17
|
+
}, b = () => {
|
|
18
|
+
l(!0);
|
|
19
|
+
}, O = () => {
|
|
20
|
+
x({
|
|
21
|
+
new_password: o,
|
|
22
|
+
new_password_again: a
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ d(S, { children: [/* @__PURE__ */ d(j, {
|
|
26
|
+
onClick: b,
|
|
27
|
+
children: [/* @__PURE__ */ e(h, {
|
|
28
|
+
variant: "body2",
|
|
29
|
+
children: t.reset_password
|
|
30
|
+
}), /* @__PURE__ */ e(F, {})]
|
|
31
|
+
}), /* @__PURE__ */ e(N, {
|
|
32
|
+
copy: { title: t.reset_password },
|
|
33
|
+
disablePrimaryButton: !R,
|
|
34
|
+
isOpen: A,
|
|
35
|
+
onClose: f,
|
|
36
|
+
onPrimaryAction: O,
|
|
37
|
+
onSecondaryAction: f,
|
|
38
|
+
primaryText: t.save_password,
|
|
39
|
+
secondaryText: y.cancel_button,
|
|
40
|
+
sx: { "& .MuiToolbar-root:last-child": {
|
|
41
|
+
padding: 24,
|
|
42
|
+
justifyContent: "flex-end"
|
|
43
|
+
} },
|
|
44
|
+
children: /* @__PURE__ */ d(S, {
|
|
45
|
+
spacing: 16,
|
|
46
|
+
sx: {
|
|
47
|
+
px: 40,
|
|
48
|
+
textAlign: "center",
|
|
49
|
+
width: "100%"
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ e(h, {
|
|
53
|
+
variant: "body1",
|
|
54
|
+
children: H
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ e(g, {
|
|
57
|
+
label: t.new_password,
|
|
58
|
+
onChange: (i) => p(i.target.value),
|
|
59
|
+
slotProps: { input: { endAdornment: /* @__PURE__ */ e(C, {
|
|
60
|
+
position: "end",
|
|
61
|
+
children: /* @__PURE__ */ e(P, {
|
|
62
|
+
"aria-label": r ? T : k,
|
|
63
|
+
edge: "end",
|
|
64
|
+
onClick: () => m(!r),
|
|
65
|
+
children: r ? /* @__PURE__ */ e(_, {}) : /* @__PURE__ */ e(u, {})
|
|
66
|
+
})
|
|
67
|
+
}) } },
|
|
68
|
+
type: r ? "text" : "password",
|
|
69
|
+
value: o
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ e(g, {
|
|
72
|
+
label: t.confirm_new_password,
|
|
73
|
+
onChange: (i) => c(i.target.value),
|
|
74
|
+
slotProps: { input: { endAdornment: /* @__PURE__ */ e(C, {
|
|
75
|
+
position: "end",
|
|
76
|
+
children: /* @__PURE__ */ e(P, {
|
|
77
|
+
"aria-label": n ? I : M,
|
|
78
|
+
edge: "end",
|
|
79
|
+
onClick: () => w(!n),
|
|
80
|
+
children: n ? /* @__PURE__ */ e(_, {}) : /* @__PURE__ */ e(u, {})
|
|
81
|
+
})
|
|
82
|
+
}) } },
|
|
83
|
+
type: n ? "text" : "password",
|
|
84
|
+
value: a
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
})] });
|
|
89
|
+
});
|
|
90
|
+
export {
|
|
91
|
+
ee as default
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=ResetPasswordAction.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResetPasswordAction.es.js","names":[],"sources":["../../../../../src/settings/components/profile/actions/ResetPasswordAction.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\nimport React from 'react'\n\nimport Button from '@mui/material/Button'\nimport IconButton from '@mui/material/IconButton'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { Text } from '@mxenabled/mxui'\nimport { ChevronRight, Visibility, VisibilityOff } from '@mxenabled/mx-icons'\n\nimport { Dialog, useGlobalCopyStore, useSettingsStore } from '../../../../common'\nimport {\n HAS_LETTER,\n HAS_NUMBER,\n HIDE_CONFIRM_PASSWORD,\n HIDE_NEW_PASSWORD,\n MIN_PASSWORD_LENGTH,\n PASSWORD_REQUIREMENTS,\n SHOW_CONFIRM_PASSWORD,\n SHOW_NEW_PASSWORD,\n} from '../../../constants/Settings'\n\nconst ResetPasswordAction = observer(() => {\n const { common: commonCopy, settings: settingsCopy } = useGlobalCopyStore()\n const { updatePassword } = useSettingsStore()\n\n const [isOpen, setIsOpen] = React.useState(false)\n const [newPassword, setNewPassword] = React.useState('')\n const [confirmPassword, setConfirmPassword] = React.useState('')\n const [showNewPassword, setShowNewPassword] = React.useState(false)\n const [showConfirmPassword, setShowConfirmPassword] = React.useState(false)\n const isValid =\n newPassword.length >= MIN_PASSWORD_LENGTH &&\n HAS_LETTER.test(newPassword) &&\n HAS_NUMBER.test(newPassword) &&\n newPassword === confirmPassword\n\n const handleClose = (): void => {\n setIsOpen(false)\n setNewPassword('')\n setConfirmPassword('')\n setShowNewPassword(false)\n setShowConfirmPassword(false)\n }\n\n const handleOpen = (): void => {\n setIsOpen(true)\n }\n\n const handleSave = () => {\n updatePassword({ new_password: newPassword, new_password_again: confirmPassword })\n }\n\n return (\n <Stack>\n <Button onClick={handleOpen}>\n <Text variant=\"body2\">{settingsCopy.reset_password}</Text>\n <ChevronRight />\n </Button>\n <Dialog\n copy={{ title: settingsCopy.reset_password }}\n disablePrimaryButton={!isValid}\n isOpen={isOpen}\n onClose={handleClose}\n onPrimaryAction={handleSave}\n onSecondaryAction={handleClose}\n primaryText={settingsCopy.save_password}\n secondaryText={commonCopy.cancel_button}\n sx={{\n '& .MuiToolbar-root:last-child': {\n padding: 24,\n justifyContent: 'flex-end',\n },\n }}\n >\n <Stack spacing={16} sx={{ px: 40, textAlign: 'center', width: '100%' }}>\n <Text variant=\"body1\">{PASSWORD_REQUIREMENTS}</Text>\n <TextField\n label={settingsCopy.new_password}\n onChange={(e) => setNewPassword(e.target.value)}\n slotProps={{\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={showNewPassword ? HIDE_NEW_PASSWORD : SHOW_NEW_PASSWORD}\n edge=\"end\"\n onClick={() => setShowNewPassword(!showNewPassword)}\n >\n {showNewPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }}\n type={showNewPassword ? 'text' : 'password'}\n value={newPassword}\n />\n <TextField\n label={settingsCopy.confirm_new_password}\n onChange={(e) => setConfirmPassword(e.target.value)}\n slotProps={{\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label={\n showConfirmPassword ? HIDE_CONFIRM_PASSWORD : SHOW_CONFIRM_PASSWORD\n }\n edge=\"end\"\n onClick={() => setShowConfirmPassword(!showConfirmPassword)}\n >\n {showConfirmPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }}\n type={showConfirmPassword ? 'text' : 'password'}\n value={confirmPassword}\n />\n </Stack>\n </Dialog>\n </Stack>\n )\n})\n\nexport default ResetPasswordAction\n"],"mappings":";;;;;;;;;;;;;AAwBA,IAAM,KAAsB,EAAA,MAAe;AACzC,QAAM,EAAE,QAAQ,GAAY,UAAU,EAAA,IAAiB,EAAmB,GACpE,EAAE,gBAAA,EAAA,IAAmB,EAAiB,GAEtC,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAK,GAC1C,CAAC,GAAa,CAAA,IAAkB,EAAM,SAAS,EAAE,GACjD,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAE,GACzD,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAK,GAC5D,CAAC,GAAqB,CAAA,IAA0B,EAAM,SAAS,EAAK,GACpE,IACJ,EAAY,UAAA,MACZ,EAAW,KAAK,CAAW,KAC3B,EAAW,KAAK,CAAW,KAC3B,MAAgB,GAEZ,IAAA,MAA0B;AAC9B,IAAA,EAAU,EAAK,GACf,EAAe,EAAE,GACjB,EAAmB,EAAE,GACrB,EAAmB,EAAK,GACxB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AAkB,IAAoB;AAAA,cAClD,MAAK;AAAA,cACL,SAAA,MAAe,EAAmB,CAAC,CAAe;AAAA,cAEjD,UAAA,IAAkB,gBAAA,EAAC,GAAD,CAAgB,CAAA,IAAI,gBAAA,EAAC,GAAD,CAAa,CAAA;AAAA,YAC1C,CAAA;AAAA,UACE,CAAA,EAEpB,EACF;AAAA,UACA,MAAM,IAAkB,SAAS;AAAA,UACjC,OAAO;AAAA,QACR,CAAA;AAAA,QACD,gBAAA,EAAC,GAAD;AAAA,UACE,OAAO,EAAa;AAAA,UACpB,UAAA,CAAW,MAAM,EAAmB,EAAE,OAAO,KAAK;AAAA,UAClD,WAAW,EACT,OAAO,EACL,cACE,gBAAA,EAAC,GAAD;AAAA,YAAgB,UAAS;AAAA,YACvB,UAAA,gBAAA,EAAC,GAAD;AAAA,cACE,cACE,IAAsB,IAAwB;AAAA,cAEhD,MAAK;AAAA,cACL,SAAA,MAAe,EAAuB,CAAC,CAAmB;AAAA,cAEzD,UAAA,IAAsB,gBAAA,EAAC,GAAD,CAAgB,CAAA,IAAI,gBAAA,EAAC,GAAD,CAAa,CAAA;AAAA,YAC9C,CAAA;AAAA,UACE,CAAA,EAEpB,EACF;AAAA,UACA,MAAM,IAAsB,SAAS;AAAA,UACrC,OAAO;AAAA,QACR,CAAA;AAAA,MACI;AAAA;EACD,CAAA,CACH,EAAA,CAAA;AAEX,CAAC"}
|
|
@@ -4,46 +4,35 @@ import a from "react";
|
|
|
4
4
|
import { observer as y } from "mobx-react-lite";
|
|
5
5
|
import g from "@mui/material/Stack";
|
|
6
6
|
import { Text as o } from "@mxenabled/mxui";
|
|
7
|
-
import
|
|
8
|
-
import { ChevronRight as
|
|
9
|
-
import { jsx as
|
|
7
|
+
import v from "@mui/material/Button";
|
|
8
|
+
import { ChevronRight as b } from "@mxenabled/mx-icons";
|
|
9
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
10
10
|
import { useTheme as C } from "@mui/material/styles";
|
|
11
|
-
var
|
|
12
|
-
const { common: s, settings:
|
|
11
|
+
var V = y(() => {
|
|
12
|
+
const { common: s, settings: t } = f(), { sendEmailVerification: c } = h(), { user: m } = u(), l = C(), [p, i] = a.useState(!1), n = () => {
|
|
13
13
|
i(!1);
|
|
14
14
|
}, d = () => {
|
|
15
15
|
i(!0);
|
|
16
16
|
};
|
|
17
|
-
return /* @__PURE__ */ r(a.Fragment, { children: [/* @__PURE__ */ r(
|
|
17
|
+
return /* @__PURE__ */ r(a.Fragment, { children: [/* @__PURE__ */ r(v, {
|
|
18
18
|
onClick: d,
|
|
19
19
|
sx: {
|
|
20
20
|
height: "auto",
|
|
21
21
|
p: 4,
|
|
22
22
|
width: "fit-content"
|
|
23
23
|
},
|
|
24
|
-
children: [/* @__PURE__ */
|
|
24
|
+
children: [/* @__PURE__ */ e(o, {
|
|
25
25
|
variant: "body2",
|
|
26
|
-
children:
|
|
27
|
-
}), /* @__PURE__ */
|
|
28
|
-
}), /* @__PURE__ */
|
|
29
|
-
copy: { title:
|
|
26
|
+
children: t.verify_email
|
|
27
|
+
}), /* @__PURE__ */ e(b, {})]
|
|
28
|
+
}), /* @__PURE__ */ e(x, {
|
|
29
|
+
copy: { title: t.confirm_your_email },
|
|
30
30
|
isOpen: p,
|
|
31
31
|
onClose: n,
|
|
32
32
|
onPrimaryAction: c,
|
|
33
33
|
onSecondaryAction: n,
|
|
34
|
-
primaryText:
|
|
34
|
+
primaryText: t.send_verification,
|
|
35
35
|
secondaryText: s.back,
|
|
36
|
-
sx: {
|
|
37
|
-
"& .MuiDialogContent-root": {
|
|
38
|
-
pt: 0,
|
|
39
|
-
width: 400
|
|
40
|
-
},
|
|
41
|
-
"& .MuiToolbar-root:last-child": {
|
|
42
|
-
gap: 16,
|
|
43
|
-
padding: "32px 60px 48px",
|
|
44
|
-
justifyContent: "center"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
36
|
children: /* @__PURE__ */ r(g, {
|
|
48
37
|
spacing: 16,
|
|
49
38
|
sx: {
|
|
@@ -52,37 +41,31 @@ var E = y(() => {
|
|
|
52
41
|
width: "100%"
|
|
53
42
|
},
|
|
54
43
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
bold: !0,
|
|
57
|
-
truncate: !1,
|
|
58
|
-
variant: "body1",
|
|
59
|
-
children: e.confirm_your_email
|
|
60
|
-
}),
|
|
61
|
-
/* @__PURE__ */ t(o, {
|
|
44
|
+
/* @__PURE__ */ e(o, {
|
|
62
45
|
truncate: !1,
|
|
63
46
|
variant: "body2",
|
|
64
|
-
children:
|
|
47
|
+
children: t.confirm_email
|
|
65
48
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ e(o, {
|
|
67
50
|
sx: {
|
|
68
|
-
border: `1px solid ${
|
|
51
|
+
border: `1px solid ${l.palette.neutral.light}`,
|
|
69
52
|
borderRadius: "4px",
|
|
70
53
|
p: "16px 32px"
|
|
71
54
|
},
|
|
72
55
|
variant: "h3",
|
|
73
|
-
children:
|
|
56
|
+
children: m.email
|
|
74
57
|
}),
|
|
75
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ e(o, {
|
|
76
59
|
truncate: !1,
|
|
77
60
|
variant: "body2",
|
|
78
|
-
children:
|
|
61
|
+
children: t.verification_notice_email
|
|
79
62
|
})
|
|
80
63
|
]
|
|
81
64
|
})
|
|
82
65
|
})] });
|
|
83
66
|
});
|
|
84
67
|
export {
|
|
85
|
-
|
|
68
|
+
V as default
|
|
86
69
|
};
|
|
87
70
|
|
|
88
71
|
//# sourceMappingURL=VerifyEmailAction.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerifyEmailAction.es.js","names":[],"sources":["../../../../../src/settings/components/profile/actions/VerifyEmailAction.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\nimport React from 'react'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { Dialog, useGlobalCopyStore, useSettingsStore, useUserStore } from '../../../../common'\n\nconst VerifyEmailAction = observer(() => {\n const { common: commonCopy, settings: settingsCopy } = useGlobalCopyStore()\n const { sendEmailVerification } = useSettingsStore()\n const { user } = useUserStore()\n const theme = useTheme()\n\n const [isOpen, setIsOpen] = React.useState(false)\n\n const handleClose = (): void => {\n setIsOpen(false)\n }\n\n const handleOpen = (): void => {\n setIsOpen(true)\n }\n\n return (\n <React.Fragment>\n <Button onClick={handleOpen} sx={{ height: 'auto', p: 4, width: 'fit-content' }}>\n <Text variant=\"body2\">{settingsCopy.verify_email}</Text>\n <ChevronRight />\n </Button>\n <Dialog\n copy={{ title:
|
|
1
|
+
{"version":3,"file":"VerifyEmailAction.es.js","names":[],"sources":["../../../../../src/settings/components/profile/actions/VerifyEmailAction.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\nimport React from 'react'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { Dialog, useGlobalCopyStore, useSettingsStore, useUserStore } from '../../../../common'\n\nconst VerifyEmailAction = observer(() => {\n const { common: commonCopy, settings: settingsCopy } = useGlobalCopyStore()\n const { sendEmailVerification } = useSettingsStore()\n const { user } = useUserStore()\n const theme = useTheme()\n\n const [isOpen, setIsOpen] = React.useState(false)\n\n const handleClose = (): void => {\n setIsOpen(false)\n }\n\n const handleOpen = (): void => {\n setIsOpen(true)\n }\n\n return (\n <React.Fragment>\n <Button onClick={handleOpen} sx={{ height: 'auto', p: 4, width: 'fit-content' }}>\n <Text variant=\"body2\">{settingsCopy.verify_email}</Text>\n <ChevronRight />\n </Button>\n <Dialog\n copy={{ title: settingsCopy.confirm_your_email }}\n isOpen={isOpen}\n onClose={handleClose}\n onPrimaryAction={sendEmailVerification}\n onSecondaryAction={handleClose}\n primaryText={settingsCopy.send_verification}\n secondaryText={commonCopy.back}\n >\n <Stack spacing={16} sx={{ px: 40, textAlign: 'center', width: '100%' }}>\n <Text truncate={false} variant=\"body2\">\n {settingsCopy.confirm_email}\n </Text>\n <Text\n sx={{\n border: `1px solid ${theme.palette.neutral.light}`,\n borderRadius: '4px',\n p: '16px 32px',\n }}\n variant=\"h3\"\n >\n {user.email}\n </Text>\n <Text truncate={false} variant=\"body2\">\n {settingsCopy.verification_notice_email}\n </Text>\n </Stack>\n </Dialog>\n </React.Fragment>\n )\n})\n\nexport default VerifyEmailAction\n"],"mappings":";;;;;;;;;;AAYA,IAAM,IAAoB,EAAA,MAAe;AACvC,QAAM,EAAE,QAAQ,GAAY,UAAU,EAAA,IAAiB,EAAmB,GACpE,EAAE,uBAAA,EAAA,IAA0B,EAAiB,GAC7C,EAAE,MAAA,EAAA,IAAS,EAAa,GACxB,IAAQ,EAAS,GAEjB,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAK,GAE1C,IAAA,MAA0B;AAC9B,IAAA,EAAU,EAAK;AAAA,EACjB,GAEM,IAAA,MAAyB;AAC7B,IAAA,EAAU,EAAI;AAAA,EAChB;AAEA,SACE,gBAAA,EAAC,EAAM,UAAP,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAQ,SAAS;AAAA,IAAY,IAAI;AAAA,MAAE,QAAQ;AAAA,MAAQ,GAAG;AAAA,MAAG,OAAO;AAAA,IAAc;AAAA,IAA9E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAM,SAAQ;AAAA,MAAS,UAAA,EAAa;AAAA,IAAmB,CAAA,GACvD,gBAAA,EAAC,GAAD,CAAe,CAAA,CACT;AAAA,EACR,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM,EAAE,OAAO,EAAa,mBAAmB;AAAA,IACvC,QAAA;AAAA,IACR,SAAS;AAAA,IACT,iBAAiB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