@blocklet/ui-react 3.0.8 → 3.0.10

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 (49) hide show
  1. package/lib/BlockletStudio/index.js +70 -71
  2. package/lib/ComponentInstaller/index.js +85 -88
  3. package/lib/ComponentInstaller/installer-item.js +47 -53
  4. package/lib/ComponentInstaller/use-component-installed.js +32 -38
  5. package/lib/ComponentManager/components/add-component.js +47 -50
  6. package/lib/ComponentManager/components/publish-component.js +30 -31
  7. package/lib/ComponentManager/components/resource-dialog.js +28 -30
  8. package/lib/Dashboard/index.js +59 -61
  9. package/lib/Footer/index.js +51 -52
  10. package/lib/Footer/internal-footer.js +43 -47
  11. package/lib/Footer/layout/standard.js +11 -12
  12. package/lib/Footer/links.js +25 -28
  13. package/lib/Footer/social-media.js +17 -17
  14. package/lib/Header/index.js +81 -83
  15. package/lib/Notifications/Snackbar.js +76 -77
  16. package/lib/Notifications/hooks/use-title.js +34 -34
  17. package/lib/Notifications/utils.js +56 -60
  18. package/lib/UserCenter/components/config-inviter.js +17 -18
  19. package/lib/UserCenter/components/danger-zone.js +49 -52
  20. package/lib/UserCenter/components/nft.js +44 -45
  21. package/lib/UserCenter/components/notification.js +92 -99
  22. package/lib/UserCenter/components/passport.js +22 -22
  23. package/lib/UserCenter/components/privacy.js +6 -6
  24. package/lib/UserCenter/components/settings.js +40 -43
  25. package/lib/UserCenter/components/status-dialog/date-picker.js +7 -8
  26. package/lib/UserCenter/components/status-dialog/index.js +112 -114
  27. package/lib/UserCenter/components/status-selector/duration-menu.js +35 -36
  28. package/lib/UserCenter/components/status-selector/index.js +13 -13
  29. package/lib/UserCenter/components/storage/action.js +21 -22
  30. package/lib/UserCenter/components/storage/delete.js +24 -24
  31. package/lib/UserCenter/components/third-party-login/index.js +53 -53
  32. package/lib/UserCenter/components/third-party-login/third-party-item.js +87 -89
  33. package/lib/UserCenter/components/user-center.js +198 -207
  34. package/lib/UserCenter/components/user-info/metadata.js +343 -353
  35. package/lib/UserCenter/components/user-info/switch-role.js +17 -20
  36. package/lib/UserCenter/components/user-info/user-basic-info.js +79 -82
  37. package/lib/UserCenter/components/user-info/user-info.js +40 -40
  38. package/lib/UserCenter/components/user-info/user-status.js +97 -99
  39. package/lib/UserCenter/components/user-info/utils.js +34 -35
  40. package/lib/UserSessions/components/user-session-info.js +25 -28
  41. package/lib/UserSessions/components/user-sessions.js +169 -181
  42. package/lib/blocklets.js +62 -72
  43. package/lib/common/domain-warning.js +31 -31
  44. package/lib/common/header-addons.js +49 -53
  45. package/lib/common/notification-addon.js +29 -32
  46. package/lib/common/ws.js +17 -18
  47. package/lib/contexts/config-user-space.js +16 -19
  48. package/lib/utils.js +44 -48
  49. package/package.json +9 -9
@@ -1,61 +1,60 @@
1
- import { jsxs as x, Fragment as A, jsx as a } from "react/jsx-runtime";
2
- import { lazy as P, memo as mo, createElement as ho, useState as H, useRef as fo, useEffect as so, useMemo as Q } from "react";
3
- import { Icon as yo } from "@iconify/react";
4
- import { Backdrop as xo, Box as f, useMediaQuery as bo, SwipeableDrawer as uo, Typography as S, Tooltip as go } from "@mui/material";
5
- import Co from "@emotion/styled";
6
- import O from "@arcblock/ux/lib/Button";
7
- import U, { detectCountryFromPhone as Y, getCountryNameByCountry as vo, validatePhoneNumber as wo, getDialCodeByCountry as ko } from "@arcblock/ux/lib/PhoneInput";
8
- import k from "lodash/cloneDeep";
9
- import Eo from "lodash/omit";
10
- import { mergeSx as Io } from "@arcblock/ux/lib/Util/style";
11
- import { LOGIN_PROVIDER as _ } from "@arcblock/ux/lib/Util/constant";
12
- import { useReactive as E, useCreation as I, useMemoizedFn as zo } from "ahooks";
13
- import { translate as Po } from "@arcblock/ux/lib/Locale/util";
14
- import Vo from "validator/lib/isEmail";
15
- import q from "validator/lib/isPostalCode";
16
- import { useLocaleContext as Bo } from "@arcblock/ux/lib/Locale/context";
17
- import { useBrowser as Lo } from "@arcblock/react-hooks";
18
- import No from "@arcblock/ux/lib/UserCard/Content/clock";
19
- import { translations as jo } from "../../libs/locales.js";
20
- import g, { inputFieldStyle as Ao, commonInputStyle as So } from "../editable-field.js";
21
- import { LinkPreviewInput as Oo } from "./link-preview-input.js";
22
- import { defaultButtonStyle as J, currentTimezone as R, primaryButtonStyle as Ro } from "./utils.js";
23
- import { TimezoneSelect as Do } from "./timezone-select.js";
24
- import Wo from "./address.js";
25
- const To = P(() => import("@arcblock/icons/lib/Location")), Fo = P(() => import("@arcblock/icons/lib/Timezone")), Mo = P(() => import("@arcblock/icons/lib/Email")), $o = P(() => import("@arcblock/icons/lib/Phone")), z = {
1
+ import { jsxs as y, Fragment as L, jsx as t } from "react/jsx-runtime";
2
+ import { lazy as I, memo as ie, createElement as ae, useState as T, useRef as le, useEffect as de, useMemo as F } from "react";
3
+ import { Icon as ce } from "@iconify/react";
4
+ import { Backdrop as se, Box as m, useMediaQuery as pe, SwipeableDrawer as me, Typography as N, Tooltip as ue } from "@mui/material";
5
+ import he from "@emotion/styled";
6
+ import j from "@arcblock/ux/lib/Button";
7
+ import M, { detectCountryFromPhone as $, getCountryNameByCountry as fe, validatePhoneNumber as ye, getDialCodeByCountry as xe } from "@arcblock/ux/lib/PhoneInput";
8
+ import v from "lodash/cloneDeep";
9
+ import be from "lodash/omit";
10
+ import { mergeSx as ge } from "@arcblock/ux/lib/Util/style";
11
+ import { LOGIN_PROVIDER as G } from "@arcblock/ux/lib/Util/constant";
12
+ import { useReactive as w, useCreation as k, useMemoizedFn as Ce } from "ahooks";
13
+ import { translate as ve } from "@arcblock/ux/lib/Locale/util";
14
+ import we from "validator/lib/isEmail";
15
+ import H from "validator/lib/isPostalCode";
16
+ import { useLocaleContext as ke } from "@arcblock/ux/lib/Locale/context";
17
+ import { useBrowser as Ee } from "@arcblock/react-hooks";
18
+ import Ie from "@arcblock/ux/lib/UserCard/Content/clock";
19
+ import { translations as ze } from "../../libs/locales.js";
20
+ import g, { inputFieldStyle as Pe, commonInputStyle as Ve } from "../editable-field.js";
21
+ import { LinkPreviewInput as Be } from "./link-preview-input.js";
22
+ import { defaultButtonStyle as Q, currentTimezone as A, primaryButtonStyle as Le } from "./utils.js";
23
+ import { TimezoneSelect as Ne } from "./timezone-select.js";
24
+ import je from "./address.js";
25
+ const Ae = I(() => import("@arcblock/icons/lib/Location")), Se = I(() => import("@arcblock/icons/lib/Timezone")), Oe = I(() => import("@arcblock/icons/lib/Email")), We = I(() => import("@arcblock/icons/lib/Phone")), E = {
26
26
  width: 20,
27
27
  height: 20
28
- }, K = 200, X = mo(function({
29
- ref: o,
30
- ...V
28
+ }, U = 200, Y = ie(function({
29
+ ref: r,
30
+ ...z
31
31
  }) {
32
- return /* @__PURE__ */ ho(
33
- xo,
32
+ return /* @__PURE__ */ ae(
33
+ se,
34
34
  {
35
- ref: o,
35
+ ref: r,
36
36
  component: "div",
37
37
  style: {
38
38
  backgroundColor: "rgba(0, 0, 0, 0.6)",
39
39
  backdropFilter: "blur(3px)",
40
40
  touchAction: "none"
41
41
  },
42
- ...V,
42
+ ...z,
43
43
  key: "background"
44
44
  }
45
45
  );
46
46
  });
47
- X.displayName = "BackdropWrap";
48
- function se({
49
- isMyself: m,
50
- user: o,
51
- onSave: V,
52
- isMobile: b
47
+ Y.displayName = "BackdropWrap";
48
+ function so({
49
+ isMyself: s,
50
+ user: r,
51
+ onSave: z,
52
+ isMobile: x
53
53
  }) {
54
- var $, G;
55
- const [Z, B] = H(!1), [oo, C] = H(!1), eo = fo(null), no = Lo(), u = bo("(max-width:640px)") || no.mobile.any, p = E({
54
+ const [_, P] = T(!1), [q, C] = T(!1), J = le(null), K = Ee(), b = pe("(max-width:640px)") || K.mobile.any, c = w({
56
55
  email: "",
57
56
  phone: ""
58
- }), s = E({
57
+ }), u = w({
59
58
  country: "",
60
59
  province: "",
61
60
  city: "",
@@ -63,20 +62,20 @@ function se({
63
62
  line2: "",
64
63
  postalCode: ""
65
64
  });
66
- so(() => {
67
- u || C(!1);
68
- }, [u]);
69
- const D = I(() => (o == null ? void 0 : o.phoneVerified) ?? !1, [o == null ? void 0 : o.phoneVerified]), W = I(() => (o == null ? void 0 : o.emailVerified) ?? !1, [o == null ? void 0 : o.emailVerified]), { locale: L } = Bo(), c = zo((n, i = {}) => Po(jo, n, L, "en", i)), l = E(
70
- o != null && o.metadata ? k(o.metadata) : {
71
- joinedAt: o == null ? void 0 : o.createdAt,
72
- email: o == null ? void 0 : o.email,
65
+ de(() => {
66
+ b || C(!1);
67
+ }, [b]);
68
+ const S = k(() => r?.phoneVerified ?? !1, [r?.phoneVerified]), O = k(() => r?.emailVerified ?? !1, [r?.emailVerified]), { locale: V } = ke(), d = Ce((o, n = {}) => ve(ze, o, V, "en", n)), a = w(
69
+ r?.metadata ? v(r.metadata) : {
70
+ joinedAt: r?.createdAt,
71
+ email: r?.email,
73
72
  phone: {
74
73
  country: "cn",
75
- phoneNumber: (o == null ? void 0 : o.phone) ?? ""
74
+ phoneNumber: r?.phone ?? ""
76
75
  }
77
76
  }
78
- ), r = E(
79
- o != null && o.address ? k(o.address) : {
77
+ ), l = w(
78
+ r?.address ? v(r.address) : {
80
79
  country: "",
81
80
  province: "",
82
81
  city: "",
@@ -84,337 +83,328 @@ function se({
84
83
  line2: "",
85
84
  postalCode: ""
86
85
  }
87
- ), to = I(() => !!(o != null && o.address), [($ = o == null ? void 0 : o.address) == null ? void 0 : $.country]), y = Q(() => {
88
- var n;
89
- return (n = o == null ? void 0 : o.address) != null && n.country ? o.address.country : L === "zh" ? "cn" : "us";
90
- }, [(G = o == null ? void 0 : o.address) == null ? void 0 : G.country, L]), N = I(() => {
91
- const n = l.phone ?? (o == null ? void 0 : o.phone) ?? {
92
- country: y,
86
+ ), X = k(() => !!r?.address, [r?.address?.country]), h = F(() => r?.address?.country ? r.address.country : V === "zh" ? "cn" : "us", [r?.address?.country, V]), B = k(() => {
87
+ const o = a.phone ?? r?.phone ?? {
88
+ country: h,
93
89
  phone: ""
94
90
  };
95
- if (n && typeof n == "string")
91
+ if (o && typeof o == "string")
96
92
  return {
97
- country: Y(n) || y,
98
- phone: n
93
+ country: $(o) || h,
94
+ phone: o
99
95
  };
100
- if (n && typeof n == "object") {
101
- const { country: i = "", phoneNumber: t = "" } = n;
96
+ if (o && typeof o == "object") {
97
+ const { country: n = "", phoneNumber: e = "" } = o;
102
98
  return {
103
- country: i || Y(t) || "",
104
- phone: t || ""
99
+ country: n || $(e) || "",
100
+ phone: e || ""
105
101
  };
106
102
  }
107
103
  return {
108
- country: y,
104
+ country: h,
109
105
  phone: ""
110
106
  };
111
- }, [l.phone, o == null ? void 0 : o.phone, y]), h = (n, i) => {
112
- l[i] = n;
113
- }, io = (n, i) => {
114
- r[n] = i, n === "city" && h(i, "location"), n === "postalCode" ? s.postalCode = i && !q(i, "any") ? c("profile.address.invalidPostalCode") : "" : s[n] = "";
115
- }, T = () => {
116
- u ? C(!0) : B(!0);
117
- }, F = () => {
118
- const n = k(o == null ? void 0 : o.metadata) ?? {};
119
- n && Object.keys(l).forEach((t) => {
120
- const e = t;
121
- l[e] = n[e];
107
+ }, [a.phone, r?.phone, h]), p = (o, n) => {
108
+ a[n] = o;
109
+ }, Z = (o, n) => {
110
+ l[o] = n, o === "city" && p(n, "location"), o === "postalCode" ? u.postalCode = n && !H(n, "any") ? d("profile.address.invalidPostalCode") : "" : u[o] = "";
111
+ }, W = () => {
112
+ b ? C(!0) : P(!0);
113
+ }, R = () => {
114
+ const o = v(r?.metadata) ?? {};
115
+ o && Object.keys(a).forEach((e) => {
116
+ const i = e;
117
+ a[i] = o[i];
122
118
  });
123
- const i = k(o == null ? void 0 : o.address) ?? {};
124
- i && Object.keys(r).forEach((t) => {
125
- const e = t;
126
- r[e] = i[e];
127
- }), [p, s].forEach((t) => {
128
- Object.keys(t).forEach((e) => {
129
- t[e] = "";
119
+ const n = v(r?.address) ?? {};
120
+ n && Object.keys(l).forEach((e) => {
121
+ const i = e;
122
+ l[i] = n[i];
123
+ }), [c, u].forEach((e) => {
124
+ Object.keys(e).forEach((i) => {
125
+ e[i] = "";
130
126
  });
131
- }), u ? C(!1) : B(!1);
132
- }, ao = Q(() => {
133
- var i;
134
- const n = ((i = l == null ? void 0 : l.links) == null ? void 0 : i.map((t) => t.url)) || [""];
135
- return n.length > 0 ? n : [""];
136
- }, [l.links]), lo = (n) => {
137
- const i = n.map((t) => {
138
- var d;
139
- if (!t)
127
+ }), b ? C(!1) : P(!1);
128
+ }, ee = F(() => {
129
+ const o = a?.links?.map((n) => n.url) || [""];
130
+ return o.length > 0 ? o : [""];
131
+ }, [a.links]), oe = (o) => {
132
+ const n = o.map((e) => {
133
+ if (!e)
140
134
  return {
141
- url: t
135
+ url: e
142
136
  };
143
- const e = (d = l.links) == null ? void 0 : d.find((v) => v.url === t);
144
- return e ? {
145
- ...e,
146
- url: t
137
+ const i = a.links?.find((f) => f.url === e);
138
+ return i ? {
139
+ ...i,
140
+ url: e
147
141
  } : {
148
- url: t,
149
- favicon: t
142
+ url: e,
143
+ favicon: e
150
144
  };
151
145
  });
152
- h(i, "links");
153
- }, ro = () => {
154
- if (Object.keys(l).forEach((i) => {
155
- var d, v;
156
- const t = i, e = l[t];
157
- if (e && typeof e == "string" && (l[t] = e.trim()), t === "bio" && (l[t] = (d = l[t]) == null ? void 0 : d.slice(0, K)), t === "timezone" && (l[t] = e || R), t === "phone" && e && typeof e == "object") {
158
- const w = e, co = ko(w.country), j = ((v = w.phoneNumber) == null ? void 0 : v.replace(new RegExp(`^\\+${co}`), "")) || "", po = (j == null ? void 0 : j.trim().length) > 0;
159
- l[t] = {
160
- country: w.country,
161
- ...po ? { phoneNumber: w.phoneNumber } : {}
146
+ p(n, "links");
147
+ }, ne = () => {
148
+ if (Object.keys(a).forEach((n) => {
149
+ const e = n, i = a[e];
150
+ if (i && typeof i == "string" && (a[e] = i.trim()), e === "bio" && (a[e] = a[e]?.slice(0, U)), e === "timezone" && (a[e] = i || A), e === "phone" && i && typeof i == "object") {
151
+ const f = i, te = xe(f.country), re = (f.phoneNumber?.replace(new RegExp(`^\\+${te}`), "") || "")?.trim().length > 0;
152
+ a[e] = {
153
+ country: f.country,
154
+ ...re ? { phoneNumber: f.phoneNumber } : {}
162
155
  };
163
156
  }
164
- }), r.postalCode && !q(r.postalCode, "any") && (s.postalCode = c("profile.address.invalidPostalCode")), [p, s].some((i) => Object.values(i).some((t) => t)))
157
+ }), l.postalCode && !H(l.postalCode, "any") && (u.postalCode = d("profile.address.invalidPostalCode")), [c, u].some((n) => Object.values(n).some((e) => e)))
165
158
  return;
166
- const n = Eo(r, "detailedAddress");
167
- n.country || (n.country = y), V({ metadata: l, address: n }), B(!1), C(!1);
168
- }, M = (n, i = "self") => {
169
- var t;
170
- return /* @__PURE__ */ x(
171
- Go,
172
- {
173
- pt: 2,
174
- display: "flex",
175
- flexDirection: "column",
176
- justifyContent: "space-between",
177
- alignItems: "flex-start",
178
- gap: b ? "4px" : "16px",
179
- children: [
180
- /* @__PURE__ */ a(
181
- g,
182
- {
183
- value: l.bio ?? "",
184
- onChange: (e) => h(e, "bio"),
185
- editable: n,
186
- placeholder: "Bio",
187
- component: "textarea",
188
- inline: !1,
189
- rows: 3,
190
- label: c("profile.bio"),
191
- maxLength: K,
192
- style: {
193
- ...n ? { marginBottom: 8 } : {}
194
- }
195
- }
196
- ),
197
- !n && m ? /* @__PURE__ */ a(
198
- O,
199
- {
200
- size: b ? "small" : "large",
201
- variant: "outlined",
202
- sx: {
203
- ...J,
204
- mb: b ? "4px" : 2,
205
- mt: b ? "4px" : 2,
206
- height: b ? "32px" : "40px"
207
- },
208
- onClick: T,
209
- fullWidth: !0,
210
- children: c("profile.editProfile")
211
- }
212
- ) : null,
213
- n && m && to ? /* @__PURE__ */ a(
214
- Wo,
215
- {
216
- address: r,
217
- errors: s,
218
- handleChange: io,
219
- defaultCountry: y
220
- }
221
- ) : /* @__PURE__ */ a(
222
- g,
223
- {
224
- value: l.location ?? ((t = o == null ? void 0 : o.address) == null ? void 0 : t.city) ?? "",
225
- onChange: (e) => h(e, "location"),
226
- editable: n,
227
- placeholder: "Location",
228
- label: c("profile.location"),
229
- tooltip: m && (r.line1 || r.line2) ? /* @__PURE__ */ a(A, { children: ["line1", "line2"].map((e) => r[e] ? /* @__PURE__ */ x(f, { children: [
230
- /* @__PURE__ */ a(
231
- S,
232
- {
233
- variant: "caption",
234
- component: "p",
235
- sx: {
236
- fontWeight: 600,
237
- mb: 0
238
- },
239
- children: c(`profile.address.${e}`)
240
- }
241
- ),
242
- /* @__PURE__ */ a(S, { variant: "caption", component: "span", children: r[e] })
243
- ] }, e) : null) }) : null,
244
- renderValue: () => {
245
- const d = [r != null && r.country ? vo(r == null ? void 0 : r.country) : "", r.province, r.city || l.location || ""].filter(Boolean).join(" ");
246
- return /* @__PURE__ */ a(S, { component: "span", children: d });
247
- },
248
- icon: /* @__PURE__ */ a(To, { ...z })
159
+ const o = be(l, "detailedAddress");
160
+ o.country || (o.country = h), z({ metadata: a, address: o }), P(!1), C(!1);
161
+ }, D = (o, n = "self") => /* @__PURE__ */ y(
162
+ Re,
163
+ {
164
+ pt: 2,
165
+ display: "flex",
166
+ flexDirection: "column",
167
+ justifyContent: "space-between",
168
+ alignItems: "flex-start",
169
+ gap: x ? "4px" : "16px",
170
+ children: [
171
+ /* @__PURE__ */ t(
172
+ g,
173
+ {
174
+ value: a.bio ?? "",
175
+ onChange: (e) => p(e, "bio"),
176
+ editable: o,
177
+ placeholder: "Bio",
178
+ component: "textarea",
179
+ inline: !1,
180
+ rows: 3,
181
+ label: d("profile.bio"),
182
+ maxLength: U,
183
+ style: {
184
+ ...o ? { marginBottom: 8 } : {}
249
185
  }
250
- ),
251
- /* @__PURE__ */ a(
252
- g,
253
- {
254
- value: l.timezone || R,
255
- onChange: (e) => h(e, "timezone"),
256
- editable: n,
257
- placeholder: "timezone",
258
- icon: /* @__PURE__ */ a(Fo, { ...z }),
259
- label: c("profile.timezone"),
260
- renderValue: (e) => /* @__PURE__ */ a(No, { value: e }),
261
- children: /* @__PURE__ */ a(
262
- Do,
186
+ }
187
+ ),
188
+ !o && s ? /* @__PURE__ */ t(
189
+ j,
190
+ {
191
+ size: x ? "small" : "large",
192
+ variant: "outlined",
193
+ sx: {
194
+ ...Q,
195
+ mb: x ? "4px" : 2,
196
+ mt: x ? "4px" : 2,
197
+ height: x ? "32px" : "40px"
198
+ },
199
+ onClick: W,
200
+ fullWidth: !0,
201
+ children: d("profile.editProfile")
202
+ }
203
+ ) : null,
204
+ o && s && X ? /* @__PURE__ */ t(
205
+ je,
206
+ {
207
+ address: l,
208
+ errors: u,
209
+ handleChange: Z,
210
+ defaultCountry: h
211
+ }
212
+ ) : /* @__PURE__ */ t(
213
+ g,
214
+ {
215
+ value: a.location ?? r?.address?.city ?? "",
216
+ onChange: (e) => p(e, "location"),
217
+ editable: o,
218
+ placeholder: "Location",
219
+ label: d("profile.location"),
220
+ tooltip: s && (l.line1 || l.line2) ? /* @__PURE__ */ t(L, { children: ["line1", "line2"].map((e) => l[e] ? /* @__PURE__ */ y(m, { children: [
221
+ /* @__PURE__ */ t(
222
+ N,
263
223
  {
264
- value: l.timezone || R,
265
- onChange: (e) => h(e, "timezone"),
266
- disabled: !n,
267
- mode: i
224
+ variant: "caption",
225
+ component: "p",
226
+ sx: {
227
+ fontWeight: 600,
228
+ mb: 0
229
+ },
230
+ children: d(`profile.address.${e}`)
268
231
  }
269
- )
270
- }
271
- ),
272
- /* @__PURE__ */ a(
273
- g,
274
- {
275
- value: l.email ?? (o == null ? void 0 : o.email) ?? "",
276
- editable: n,
277
- hidePreview: !m,
278
- disabled: (o == null ? void 0 : o.sourceProvider) === _.EMAIL,
279
- canEdit: !W,
280
- verified: W,
281
- placeholder: "Email",
282
- icon: /* @__PURE__ */ a(Mo, { ...z }),
283
- label: /* @__PURE__ */ x(A, { children: [
284
- c("profile.email"),
285
- (o == null ? void 0 : o.sourceProvider) === _.EMAIL ? /* @__PURE__ */ a(go, { title: c("profile.emailSourceProviderNotAllowEdit"), children: /* @__PURE__ */ a(
286
- f,
287
- {
288
- component: yo,
289
- icon: "mdi:info-outline",
290
- sx: {
291
- verticalAlign: "middle",
292
- ml: 0.25
293
- }
294
- }
295
- ) }) : null
296
- ] }),
297
- onChange: (e) => h(e, "email"),
298
- errorMsg: p.email,
299
- renderValue: (e) => m ? /* @__PURE__ */ a(
300
- "a",
232
+ ),
233
+ /* @__PURE__ */ t(N, { variant: "caption", component: "span", children: l[e] })
234
+ ] }, e) : null) }) : null,
235
+ renderValue: () => {
236
+ const i = [l?.country ? fe(l?.country) : "", l.province, l.city || a.location || ""].filter(Boolean).join(" ");
237
+ return /* @__PURE__ */ t(N, { component: "span", children: i });
238
+ },
239
+ icon: /* @__PURE__ */ t(Ae, { ...E })
240
+ }
241
+ ),
242
+ /* @__PURE__ */ t(
243
+ g,
244
+ {
245
+ value: a.timezone || A,
246
+ onChange: (e) => p(e, "timezone"),
247
+ editable: o,
248
+ placeholder: "timezone",
249
+ icon: /* @__PURE__ */ t(Se, { ...E }),
250
+ label: d("profile.timezone"),
251
+ renderValue: (e) => /* @__PURE__ */ t(Ie, { value: e }),
252
+ children: /* @__PURE__ */ t(
253
+ Ne,
254
+ {
255
+ value: a.timezone || A,
256
+ onChange: (e) => p(e, "timezone"),
257
+ disabled: !o,
258
+ mode: n
259
+ }
260
+ )
261
+ }
262
+ ),
263
+ /* @__PURE__ */ t(
264
+ g,
265
+ {
266
+ value: a.email ?? r?.email ?? "",
267
+ editable: o,
268
+ hidePreview: !s,
269
+ disabled: r?.sourceProvider === G.EMAIL,
270
+ canEdit: !O,
271
+ verified: O,
272
+ placeholder: "Email",
273
+ icon: /* @__PURE__ */ t(Oe, { ...E }),
274
+ label: /* @__PURE__ */ y(L, { children: [
275
+ d("profile.email"),
276
+ r?.sourceProvider === G.EMAIL ? /* @__PURE__ */ t(ue, { title: d("profile.emailSourceProviderNotAllowEdit"), children: /* @__PURE__ */ t(
277
+ m,
301
278
  {
302
- href: `mailto:${e}`,
303
- style: {
304
- color: "inherit",
305
- textDecoration: "none"
306
- },
307
- children: e
279
+ component: ce,
280
+ icon: "mdi:info-outline",
281
+ sx: {
282
+ verticalAlign: "middle",
283
+ ml: 0.25
284
+ }
308
285
  }
309
- ) : null,
310
- onValueValidate: (e) => {
311
- let d = "";
312
- e && !Vo(e) && (d = c("profile.emailInvalid")), p.email = d;
286
+ ) }) : null
287
+ ] }),
288
+ onChange: (e) => p(e, "email"),
289
+ errorMsg: c.email,
290
+ renderValue: (e) => s ? /* @__PURE__ */ t(
291
+ "a",
292
+ {
293
+ href: `mailto:${e}`,
294
+ style: {
295
+ color: "inherit",
296
+ textDecoration: "none"
297
+ },
298
+ children: e
313
299
  }
300
+ ) : null,
301
+ onValueValidate: (e) => {
302
+ let i = "";
303
+ e && !we(e) && (i = d("profile.emailInvalid")), c.email = i;
314
304
  }
315
- ),
316
- /* @__PURE__ */ a(
317
- g,
318
- {
319
- value: N.phone,
320
- editable: n,
321
- hidePreview: !m,
322
- canEdit: !D,
323
- verified: D,
324
- placeholder: "Phone",
325
- icon: /* @__PURE__ */ a($o, { ...z }),
326
- onChange: (e) => h(e, "phone"),
327
- label: c("profile.phone"),
328
- renderValue: () => m ? /* @__PURE__ */ a(U, { value: N, preview: !0 }) : null,
329
- children: /* @__PURE__ */ a(
330
- U,
305
+ }
306
+ ),
307
+ /* @__PURE__ */ t(
308
+ g,
309
+ {
310
+ value: B.phone,
311
+ editable: o,
312
+ hidePreview: !s,
313
+ canEdit: !S,
314
+ verified: S,
315
+ placeholder: "Phone",
316
+ icon: /* @__PURE__ */ t(We, { ...E }),
317
+ onChange: (e) => p(e, "phone"),
318
+ label: d("profile.phone"),
319
+ renderValue: () => s ? /* @__PURE__ */ t(M, { value: B, preview: !0 }) : null,
320
+ children: /* @__PURE__ */ t(
321
+ M,
322
+ {
323
+ variant: "outlined",
324
+ className: "editable-field",
325
+ InputProps: {
326
+ sx: { backgroundColor: "transparent" },
327
+ placeholder: "Phone"
328
+ },
329
+ value: B,
330
+ error: !!c.phone,
331
+ helperText: c.phone,
332
+ sx: ge(Pe, c.phone ? {} : Ve),
333
+ onChange: (e) => {
334
+ ye(e.phone, e.country) ? c.phone = "" : c.phone = d("profile.phoneInvalid"), p(
335
+ {
336
+ country: e.country,
337
+ phoneNumber: e.phone
338
+ },
339
+ "phone"
340
+ );
341
+ }
342
+ }
343
+ )
344
+ }
345
+ ),
346
+ /* @__PURE__ */ t(Be, { editable: o, links: ee, onChange: oe }),
347
+ o && s ? /* @__PURE__ */ y(
348
+ m,
349
+ {
350
+ style: { width: "100%" },
351
+ sx: {
352
+ display: "flex",
353
+ gap: 1,
354
+ justifyContent: "flex-end",
355
+ flexDirection: n === "drawer" ? "column" : "row"
356
+ },
357
+ children: [
358
+ /* @__PURE__ */ t(
359
+ j,
331
360
  {
361
+ fullWidth: n === "drawer",
362
+ size: "small",
332
363
  variant: "outlined",
333
- className: "editable-field",
334
- InputProps: {
335
- sx: { backgroundColor: "transparent" },
336
- placeholder: "Phone"
364
+ sx: { ...Q, minWidth: "54px" },
365
+ onClick: R,
366
+ children: d("common.cancel")
367
+ }
368
+ ),
369
+ /* @__PURE__ */ t(
370
+ j,
371
+ {
372
+ fullWidth: n === "drawer",
373
+ size: "small",
374
+ disabled: !!c.email || !!c.phone,
375
+ variant: "outlined",
376
+ sx: {
377
+ ...Le,
378
+ minWidth: "54px",
379
+ "&.Mui-disabled": {
380
+ backgroundColor: "rgba(0, 0, 0, 0.12)"
381
+ }
337
382
  },
338
- value: N,
339
- error: !!p.phone,
340
- helperText: p.phone,
341
- sx: Io(Ao, p.phone ? {} : So),
342
- onChange: (e) => {
343
- wo(e.phone, e.country) ? p.phone = "" : p.phone = c("profile.phoneInvalid"), h(
344
- {
345
- country: e.country,
346
- phoneNumber: e.phone
347
- },
348
- "phone"
349
- );
350
- }
383
+ onClick: ne,
384
+ children: d("common.save")
351
385
  }
352
386
  )
353
- }
354
- ),
355
- /* @__PURE__ */ a(Oo, { editable: n, links: ao, onChange: lo }),
356
- n && m ? /* @__PURE__ */ x(
357
- f,
358
- {
359
- style: { width: "100%" },
360
- sx: {
361
- display: "flex",
362
- gap: 1,
363
- justifyContent: "flex-end",
364
- flexDirection: i === "drawer" ? "column" : "row"
365
- },
366
- children: [
367
- /* @__PURE__ */ a(
368
- O,
369
- {
370
- fullWidth: i === "drawer",
371
- size: "small",
372
- variant: "outlined",
373
- sx: { ...J, minWidth: "54px" },
374
- onClick: F,
375
- children: c("common.cancel")
376
- }
377
- ),
378
- /* @__PURE__ */ a(
379
- O,
380
- {
381
- fullWidth: i === "drawer",
382
- size: "small",
383
- disabled: !!p.email || !!p.phone,
384
- variant: "outlined",
385
- sx: {
386
- ...Ro,
387
- minWidth: "54px",
388
- "&.Mui-disabled": {
389
- backgroundColor: "rgba(0, 0, 0, 0.12)"
390
- }
391
- },
392
- onClick: ro,
393
- children: c("common.save")
394
- }
395
- )
396
- ]
397
- }
398
- ) : null
399
- ]
400
- }
401
- );
402
- };
403
- return /* @__PURE__ */ x(A, { children: [
404
- M(Z),
405
- u && /* @__PURE__ */ x(
406
- uo,
387
+ ]
388
+ }
389
+ ) : null
390
+ ]
391
+ }
392
+ );
393
+ return /* @__PURE__ */ y(L, { children: [
394
+ D(_),
395
+ b && /* @__PURE__ */ y(
396
+ me,
407
397
  {
408
398
  sx: {
409
399
  zIndex: 9999
410
400
  },
411
401
  disableSwipeToOpen: !0,
412
- onOpen: T,
413
- open: oo,
402
+ onOpen: W,
403
+ open: q,
414
404
  anchor: "bottom",
415
- onClose: F,
405
+ onClose: R,
416
406
  slots: {
417
- backdrop: X
407
+ backdrop: Y
418
408
  },
419
409
  slotProps: {
420
410
  paper: {
@@ -428,17 +418,17 @@ function se({
428
418
  }
429
419
  },
430
420
  children: [
431
- /* @__PURE__ */ a(
432
- f,
421
+ /* @__PURE__ */ t(
422
+ m,
433
423
  {
434
- ref: eo,
424
+ ref: J,
435
425
  sx: {
436
426
  padding: "16px 32px",
437
427
  margin: "-8px auto -16px",
438
428
  zIndex: 1
439
429
  },
440
- children: /* @__PURE__ */ a(
441
- f,
430
+ children: /* @__PURE__ */ t(
431
+ m,
442
432
  {
443
433
  sx: {
444
434
  width: "48px",
@@ -450,15 +440,15 @@ function se({
450
440
  )
451
441
  }
452
442
  ),
453
- /* @__PURE__ */ a(
454
- f,
443
+ /* @__PURE__ */ t(
444
+ m,
455
445
  {
456
446
  sx: {
457
447
  p: 2,
458
448
  maxHeight: "500px",
459
449
  overflowY: "auto"
460
450
  },
461
- children: M(!0, "drawer")
451
+ children: D(!0, "drawer")
462
452
  }
463
453
  )
464
454
  ]
@@ -466,7 +456,7 @@ function se({
466
456
  )
467
457
  ] });
468
458
  }
469
- const Go = Co(f)`
459
+ const Re = he(m)`
470
460
  width: 100%;
471
461
 
472
462
  .MuiOutlinedInput-root {
@@ -505,5 +495,5 @@ const Go = Co(f)`
505
495
  }
506
496
  `;
507
497
  export {
508
- se as default
498
+ so as default
509
499
  };