@fluid-app/fluid-cli-theme-dev 0.1.63 → 0.1.65
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/README.md +1 -1
- package/dist/dist-cli-preview/.vite/manifest.json +225 -225
- package/dist/dist-cli-preview/account-screens.js +1 -1
- package/dist/dist-cli-preview/chunks/{Breadcrumb-CZ-skiUy.js → Breadcrumb-BQKo8hPc.js} +1 -1
- package/dist/dist-cli-preview/chunks/{Combobox-BGiCYa56.js → Combobox-cf11L_T-.js} +4 -4
- package/dist/dist-cli-preview/chunks/{ContactsScreen-vsNgy_gn.js → ContactsScreen-gIiy4u7c.js} +1160 -1155
- package/dist/dist-cli-preview/chunks/{MemberManagementProviders-DMwkh3JW.js → MemberManagementProviders-C1bwc3tB.js} +258 -224
- package/dist/dist-cli-preview/chunks/{MessagingScreen-DzJOwPGH.js → MessagingScreen-B8ZxAE0L.js} +3904 -3927
- package/dist/dist-cli-preview/chunks/{MobileActionSheet-DqVPgFKI.js → MobileActionSheet-DMeTsLlK.js} +100 -100
- package/dist/dist-cli-preview/chunks/{MySiteScreen-BSmWlCKA.js → MySiteScreen-Dtw1rsF9.js} +69 -69
- package/dist/dist-cli-preview/chunks/OrdersScreen-C-b6i5jB.js +9 -0
- package/dist/dist-cli-preview/chunks/{OrdersScreen-CVEl9FnN.js → OrdersScreen-D9HfcTaa.js} +247 -249
- package/dist/dist-cli-preview/chunks/{ProfileScreen-BC5gyJDY.js → ProfileScreen-DwXozaLs.js} +1051 -965
- package/dist/dist-cli-preview/chunks/{SubscriptionsScreen-CFM4Pufg.js → SubscriptionsScreen-CIdYNpWT.js} +3 -3
- package/dist/dist-cli-preview/chunks/{account-screen-runtime-DxhJm6Qd.js → account-screen-runtime-DYMunv0A.js} +2482 -2407
- package/dist/dist-cli-preview/chunks/ar-DaN3xEy4.js +351 -0
- package/dist/dist-cli-preview/chunks/{arrow-left-UFKI-PQf.js → arrow-left-Bd7dJtIV.js} +1 -1
- package/dist/dist-cli-preview/chunks/bg-D3Np0de3.js +351 -0
- package/dist/dist-cli-preview/chunks/bn-BDSehnZ3.js +351 -0
- package/dist/dist-cli-preview/chunks/{cli-preview-DunPfnjU.js → cli-preview-BT_ARKjk.js} +13 -13
- package/dist/dist-cli-preview/chunks/{client.gen-CSTBgfxj.js → client.gen-Ck6Pm2jV.js} +246 -236
- package/dist/dist-cli-preview/chunks/contacts-ChSWj70z.js +4 -0
- package/dist/dist-cli-preview/chunks/{countries-api-adapter-B3usO25w.js → countries-api-adapter-lxSE748x.js} +2 -2
- package/dist/dist-cli-preview/chunks/{create-card-entry-container-DHgsbSyr.js → create-card-entry-container-D6kSC2Aw.js} +20726 -20509
- package/dist/dist-cli-preview/chunks/cs-CrmATj4L.js +351 -0
- package/dist/dist-cli-preview/chunks/da-CmJdErjd.js +351 -0
- package/dist/dist-cli-preview/chunks/de-C0KTNBZq.js +351 -0
- package/dist/dist-cli-preview/chunks/el-BOQs49GU.js +351 -0
- package/dist/dist-cli-preview/chunks/es-Dt3VSQPu.js +351 -0
- package/dist/dist-cli-preview/chunks/fi-B8UZ7eJL.js +351 -0
- package/dist/dist-cli-preview/chunks/fr-BomEiNL0.js +351 -0
- package/dist/dist-cli-preview/chunks/he-CfmnXjsr.js +351 -0
- package/dist/dist-cli-preview/chunks/{hey-api-client-DSvKWGPq.js → hey-api-client-DGRBsZ7Y.js} +3 -3
- package/dist/dist-cli-preview/chunks/hi-CTk5zGoJ.js +351 -0
- package/dist/dist-cli-preview/chunks/hr-DaNToqEm.js +351 -0
- package/dist/dist-cli-preview/chunks/hu-lcAuIwez.js +351 -0
- package/dist/dist-cli-preview/chunks/id-CEThcKZG.js +351 -0
- package/dist/dist-cli-preview/chunks/it-BCRCoDOg.js +351 -0
- package/dist/dist-cli-preview/chunks/ja-BIkFdIfq.js +351 -0
- package/dist/dist-cli-preview/chunks/ko-CD3bk6gv.js +351 -0
- package/dist/dist-cli-preview/chunks/{log-out-CBUq5Hd-.js → log-out-CSPZjXTK.js} +1 -1
- package/dist/dist-cli-preview/chunks/{map-pin-DHfjSyoR.js → map-pin-B2ScoijR.js} +1 -1
- package/dist/dist-cli-preview/chunks/messaging-Bq5UPkvG.js +4 -0
- package/dist/dist-cli-preview/chunks/{mount-account-screen-pc1VISwF.js → mount-account-screen-C_CdoGir.js} +2453 -2392
- package/dist/dist-cli-preview/chunks/ms-DI4mGa5X.js +351 -0
- package/dist/dist-cli-preview/chunks/mysite-DcpuKsuW.js +4 -0
- package/dist/dist-cli-preview/chunks/nl-B-XAD3Ra.js +351 -0
- package/dist/dist-cli-preview/chunks/no-C_NmYGbe.js +351 -0
- package/dist/dist-cli-preview/chunks/orders-B_57xKkq.js +4 -0
- package/dist/dist-cli-preview/chunks/pl-mQRzJZEW.js +351 -0
- package/dist/dist-cli-preview/chunks/{plus-C-lo0pFM.js → plus-CocoE5gC.js} +1 -1
- package/dist/dist-cli-preview/chunks/profile-BfM2KxKe.js +4 -0
- package/dist/dist-cli-preview/chunks/pt-BYMWPjog.js +351 -0
- package/dist/dist-cli-preview/chunks/ro-B98EuFQI.js +351 -0
- package/dist/dist-cli-preview/chunks/ru-DBO9IasC.js +351 -0
- package/dist/dist-cli-preview/chunks/schemas-D94nZk5x.js +5374 -0
- package/dist/dist-cli-preview/chunks/{screen-route-slug-utils-B254xI_J.js → screen-route-slug-utils-BDjSpDoe.js} +1 -1
- package/dist/dist-cli-preview/chunks/{sheet-haptics-context-D2WUiXJm.js → sheet-haptics-context-iOjKcNDj.js} +1 -1
- package/dist/dist-cli-preview/chunks/{sidebar-CMSWZCPS.js → sidebar-Ckzom4Xc.js} +12 -12
- package/dist/dist-cli-preview/chunks/sk-hRvNJfiN.js +351 -0
- package/dist/dist-cli-preview/chunks/{store-api-context-BIdILNWL.js → store-api-context-B96Ip2FB.js} +1 -1
- package/dist/dist-cli-preview/chunks/subscriptions-8VtIA4w9.js +4 -0
- package/dist/dist-cli-preview/chunks/sv-noYtTQbO.js +351 -0
- package/dist/dist-cli-preview/chunks/th-CJCAKsR-.js +351 -0
- package/dist/dist-cli-preview/chunks/tl-Bx8pJ7p7.js +351 -0
- package/dist/dist-cli-preview/chunks/tr-C4tCNiV7.js +351 -0
- package/dist/dist-cli-preview/chunks/{trash-2-Bq4IqH0j.js → trash-2-wVweQZMw.js} +4 -4
- package/dist/dist-cli-preview/chunks/uk-xFjXQDP3.js +351 -0
- package/dist/dist-cli-preview/chunks/{use-optional-store-Csor1Z3z.js → use-optional-store-lZUz976C.js} +2 -2
- package/dist/dist-cli-preview/chunks/use-store-DVmgsDXy.js +103 -0
- package/dist/dist-cli-preview/chunks/{useInfiniteQuery-BpFtQ7DH.js → useInfiniteQuery-Dtzov9uh.js} +1 -1
- package/dist/dist-cli-preview/chunks/{user-BGrQJ1GJ.js → user-B81IrSgp.js} +1 -1
- package/dist/dist-cli-preview/chunks/{users-DBL0isYy.js → users-BXTjoCUz.js} +1 -1
- package/dist/dist-cli-preview/chunks/vi-BAvhRTgb.js +351 -0
- package/dist/dist-cli-preview/chunks/zh_CN-Cyq9zeex.js +351 -0
- package/dist/dist-cli-preview/chunks/zh_TW-DFM5MhMA.js +351 -0
- package/dist/index.mjs +346 -32
- package/dist/index.mjs.map +1 -1
- package/dist/skills/themes-cart-feedback/SKILL.md +9 -14
- package/dist/skills/themes-review/SKILL.md +40 -34
- package/dist/skills/themes-review/references/blocks-vs-sections.md +2 -2
- package/dist/skills/themes-review/references/dead-code.md +1 -1
- package/dist/skills/themes-review/references/dynamism.md +9 -3
- package/dist/skills/themes-review/references/editor-attributes.md +25 -26
- package/dist/skills/themes-review/references/examples.md +3 -4
- package/dist/skills/themes-review/references/fairshare-attributes.md +5 -5
- package/dist/skills/themes-review/references/global-settings.md +56 -67
- package/dist/skills/themes-review/references/liquid-correctness.md +10 -15
- package/dist/skills/themes-review/references/media-tag.md +8 -7
- package/dist/skills/themes-review/references/navigation.md +18 -13
- package/dist/skills/themes-review/references/security-accessibility.md +11 -6
- package/dist/skills/themes-review/references/setting-types.md +136 -77
- package/dist/skills/themes-settings-schema/SKILL.md +15 -2
- package/package.json +2 -2
- package/dist/dist-cli-preview/chunks/OrdersScreen-d4fJE_dm.js +0 -9
- package/dist/dist-cli-preview/chunks/ar-B7NQmkZ1.js +0 -341
- package/dist/dist-cli-preview/chunks/bg-CxfL8rZN.js +0 -341
- package/dist/dist-cli-preview/chunks/bn-CdhHCK--.js +0 -341
- package/dist/dist-cli-preview/chunks/contacts-CpYlEgAq.js +0 -4
- package/dist/dist-cli-preview/chunks/cs-DTe-xGeI.js +0 -341
- package/dist/dist-cli-preview/chunks/da-B8Cl_vkl.js +0 -341
- package/dist/dist-cli-preview/chunks/de-D8cYy8G-.js +0 -341
- package/dist/dist-cli-preview/chunks/el-Chjin2JW.js +0 -341
- package/dist/dist-cli-preview/chunks/es-mp8RwFN4.js +0 -341
- package/dist/dist-cli-preview/chunks/fi-91gcpxoy.js +0 -341
- package/dist/dist-cli-preview/chunks/fr-ekvUCKTH.js +0 -341
- package/dist/dist-cli-preview/chunks/he-B7QiuquT.js +0 -341
- package/dist/dist-cli-preview/chunks/hi-DNNhi7ud.js +0 -341
- package/dist/dist-cli-preview/chunks/hr-CAwxMKX_.js +0 -341
- package/dist/dist-cli-preview/chunks/hu-D_oQwH4Q.js +0 -341
- package/dist/dist-cli-preview/chunks/id-oeAszBoo.js +0 -341
- package/dist/dist-cli-preview/chunks/isAfter-BUGgByEf.js +0 -1414
- package/dist/dist-cli-preview/chunks/it-Dme6GXSG.js +0 -341
- package/dist/dist-cli-preview/chunks/ja-CRnvQNCa.js +0 -341
- package/dist/dist-cli-preview/chunks/ko-8mk8A3_I.js +0 -341
- package/dist/dist-cli-preview/chunks/messaging-DkyH4CPP.js +0 -4
- package/dist/dist-cli-preview/chunks/ms-Bs0GvdOw.js +0 -341
- package/dist/dist-cli-preview/chunks/mysite-wvfITV7T.js +0 -4
- package/dist/dist-cli-preview/chunks/nl-tsI6lLxl.js +0 -341
- package/dist/dist-cli-preview/chunks/no-DMot6qX0.js +0 -341
- package/dist/dist-cli-preview/chunks/orders-c13r499A.js +0 -4
- package/dist/dist-cli-preview/chunks/pl-DmTxONNg.js +0 -341
- package/dist/dist-cli-preview/chunks/profile-CoWo9Sxe.js +0 -4
- package/dist/dist-cli-preview/chunks/pt-DgmwnAV-.js +0 -341
- package/dist/dist-cli-preview/chunks/ro-B4M17oRc.js +0 -341
- package/dist/dist-cli-preview/chunks/ru-BS2gZnbs.js +0 -341
- package/dist/dist-cli-preview/chunks/schemas-9_ZwC5nC.js +0 -3977
- package/dist/dist-cli-preview/chunks/sk-BdDjjHfn.js +0 -341
- package/dist/dist-cli-preview/chunks/subscriptions-BHALQrcU.js +0 -4
- package/dist/dist-cli-preview/chunks/sv-CW7FL5HA.js +0 -341
- package/dist/dist-cli-preview/chunks/th-BYBMKmSh.js +0 -341
- package/dist/dist-cli-preview/chunks/tl-CDigaLsK.js +0 -341
- package/dist/dist-cli-preview/chunks/tr-PxiurNCr.js +0 -341
- package/dist/dist-cli-preview/chunks/uk-B4aYnJ8t.js +0 -341
- package/dist/dist-cli-preview/chunks/vi-BoKSdzH3.js +0 -341
- package/dist/dist-cli-preview/chunks/zh_CN-DrCrXsZC.js +0 -341
- package/dist/dist-cli-preview/chunks/zh_TW-JmyC1W5K.js +0 -341
package/dist/dist-cli-preview/chunks/{ProfileScreen-BC5gyJDY.js → ProfileScreen-DwXozaLs.js}
RENAMED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { u as
|
|
3
|
-
import { O as
|
|
4
|
-
import { F as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { R as
|
|
8
|
-
import { I as
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
11
|
-
import { M as
|
|
12
|
-
import { A as
|
|
13
|
-
import { L as
|
|
1
|
+
import { c as Y, i as mt, l as v, j as n, G as ht, H as le, J as pt, K as ne, M as ce, N as gt, O as E, I as je, R as A, B as de, D as Ae, E as ue, x as xt, U as $, V as _t, W as H, X as T, Y as bt, Z as vt, _ as yt, P as jt, $ as J, z as fe, a0 as Me, q as wt, a1 as Ct, a2 as Nt } from "./account-screen-runtime-DYMunv0A.js";
|
|
2
|
+
import { u as R, a as St, b as B, c as Et, d as Pt, M as At } from "./MemberManagementProviders-C1bwc3tB.js";
|
|
3
|
+
import { O as Mt } from "./OrdersScreen-D9HfcTaa.js";
|
|
4
|
+
import { F as ee, e as Rt, f as Ft, S as It, P as Lt, a as kt, b as Dt, d as Ot, A as zt, B as Re, C as Fe, c as Tt, g as Bt, u as Ut, i as $t, h as qt, T as Qt, j as Vt, k as Ht, m as Kt, E as Gt, l as Ie } from "./create-card-entry-container-D6kSC2Aw.js";
|
|
5
|
+
import { u as me } from "./use-store-DVmgsDXy.js";
|
|
6
|
+
import { u as Yt } from "./trash-2-wVweQZMw.js";
|
|
7
|
+
import { R as Le, D as Wt, u as K, o as se, s as L } from "./schemas-D94nZk5x.js";
|
|
8
|
+
import { I as Xt } from "./sheet-haptics-context-iOjKcNDj.js";
|
|
9
|
+
import { u as W } from "./sidebar-Ckzom4Xc.js";
|
|
10
|
+
import { u as Zt } from "./countries-api-adapter-lxSE748x.js";
|
|
11
|
+
import { M as Jt } from "./map-pin-B2ScoijR.js";
|
|
12
|
+
import { A as we } from "./arrow-left-Bd7dJtIV.js";
|
|
13
|
+
import { L as er } from "./log-out-CSPZjXTK.js";
|
|
14
14
|
/**
|
|
15
15
|
* @license lucide-react v0.575.0 - ISC
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the ISC license.
|
|
18
18
|
* See the LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
20
|
+
const tr = [
|
|
21
21
|
["rect", { width: "20", height: "14", x: "2", y: "5", rx: "2", key: "ynyp8z" }],
|
|
22
22
|
["line", { x1: "2", x2: "22", y1: "10", y2: "10", key: "1b3vmo" }]
|
|
23
|
-
],
|
|
23
|
+
], ke = Y("credit-card", tr);
|
|
24
24
|
/**
|
|
25
25
|
* @license lucide-react v0.575.0 - ISC
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the ISC license.
|
|
28
28
|
* See the LICENSE file in the root directory of this source tree.
|
|
29
29
|
*/
|
|
30
|
-
const
|
|
30
|
+
const rr = [
|
|
31
31
|
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
32
32
|
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
33
33
|
["path", { d: "M2 5h12", key: "or177f" }],
|
|
34
34
|
["path", { d: "M7 2h1", key: "1t2jsx" }],
|
|
35
35
|
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
36
36
|
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
37
|
-
],
|
|
37
|
+
], nr = Y("languages", rr);
|
|
38
38
|
/**
|
|
39
39
|
* @license lucide-react v0.575.0 - ISC
|
|
40
40
|
*
|
|
41
41
|
* This source code is licensed under the ISC license.
|
|
42
42
|
* See the LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
const
|
|
44
|
+
const sr = [
|
|
45
45
|
["path", { d: "m2 9 3-3 3 3", key: "1ltn5i" }],
|
|
46
46
|
["path", { d: "M13 18H7a2 2 0 0 1-2-2V6", key: "1r6tfw" }],
|
|
47
47
|
["path", { d: "m22 15-3 3-3-3", key: "4rnwn2" }],
|
|
48
48
|
["path", { d: "M11 6h6a2 2 0 0 1 2 2v10", key: "2f72bc" }]
|
|
49
|
-
],
|
|
49
|
+
], De = Y("repeat-2", sr);
|
|
50
50
|
/**
|
|
51
51
|
* @license lucide-react v0.575.0 - ISC
|
|
52
52
|
*
|
|
53
53
|
* This source code is licensed under the ISC license.
|
|
54
54
|
* See the LICENSE file in the root directory of this source tree.
|
|
55
55
|
*/
|
|
56
|
-
const
|
|
56
|
+
const ar = [
|
|
57
57
|
[
|
|
58
58
|
"path",
|
|
59
59
|
{
|
|
@@ -61,18 +61,18 @@ const sr = [
|
|
|
61
61
|
key: "r04s7s"
|
|
62
62
|
}
|
|
63
63
|
]
|
|
64
|
-
],
|
|
64
|
+
], ir = Y("star", ar);
|
|
65
65
|
/**
|
|
66
66
|
* @license lucide-react v0.575.0 - ISC
|
|
67
67
|
*
|
|
68
68
|
* This source code is licensed under the ISC license.
|
|
69
69
|
* See the LICENSE file in the root directory of this source tree.
|
|
70
70
|
*/
|
|
71
|
-
const
|
|
71
|
+
const or = [
|
|
72
72
|
["circle", { cx: "12", cy: "8", r: "5", key: "1hypcn" }],
|
|
73
73
|
["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
|
|
74
|
-
],
|
|
75
|
-
var
|
|
74
|
+
], lr = Y("user-round", or);
|
|
75
|
+
var te = { exports: {} }, re = {};
|
|
76
76
|
/**
|
|
77
77
|
* @license React
|
|
78
78
|
* use-sync-external-store-shim.production.js
|
|
@@ -82,37 +82,37 @@ var X = { exports: {} }, Z = {};
|
|
|
82
82
|
* This source code is licensed under the MIT license found in the
|
|
83
83
|
* LICENSE file in the root directory of this source tree.
|
|
84
84
|
*/
|
|
85
|
-
var
|
|
86
|
-
function
|
|
87
|
-
if (
|
|
88
|
-
|
|
85
|
+
var Ce;
|
|
86
|
+
function cr() {
|
|
87
|
+
if (Ce) return re;
|
|
88
|
+
Ce = 1;
|
|
89
89
|
var e = mt();
|
|
90
90
|
function i(o, c) {
|
|
91
91
|
return o === c && (o !== 0 || 1 / o === 1 / c) || o !== o && c !== c;
|
|
92
92
|
}
|
|
93
|
-
var t = typeof Object.is == "function" ? Object.is : i, l = e.useState, d = e.useEffect, u = e.useLayoutEffect,
|
|
94
|
-
function
|
|
95
|
-
var
|
|
93
|
+
var t = typeof Object.is == "function" ? Object.is : i, l = e.useState, d = e.useEffect, u = e.useLayoutEffect, p = e.useDebugValue;
|
|
94
|
+
function g(o, c) {
|
|
95
|
+
var m = c(), f = l({ inst: { value: m, getSnapshot: c } }), h = f[0].inst, x = f[1];
|
|
96
96
|
return u(
|
|
97
97
|
function() {
|
|
98
|
-
|
|
98
|
+
h.value = m, h.getSnapshot = c, a(h) && x({ inst: h });
|
|
99
99
|
},
|
|
100
|
-
[o,
|
|
100
|
+
[o, m, c]
|
|
101
101
|
), d(
|
|
102
102
|
function() {
|
|
103
|
-
return
|
|
104
|
-
|
|
103
|
+
return a(h) && x({ inst: h }), o(function() {
|
|
104
|
+
a(h) && x({ inst: h });
|
|
105
105
|
});
|
|
106
106
|
},
|
|
107
107
|
[o]
|
|
108
|
-
),
|
|
108
|
+
), p(m), m;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function a(o) {
|
|
111
111
|
var c = o.getSnapshot;
|
|
112
112
|
o = o.value;
|
|
113
113
|
try {
|
|
114
|
-
var
|
|
115
|
-
return !t(o,
|
|
114
|
+
var m = c();
|
|
115
|
+
return !t(o, m);
|
|
116
116
|
} catch {
|
|
117
117
|
return !0;
|
|
118
118
|
}
|
|
@@ -120,96 +120,96 @@ function lr() {
|
|
|
120
120
|
function r(o, c) {
|
|
121
121
|
return c();
|
|
122
122
|
}
|
|
123
|
-
var
|
|
124
|
-
return
|
|
123
|
+
var s = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : g;
|
|
124
|
+
return re.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : s, re;
|
|
125
125
|
}
|
|
126
|
-
var
|
|
127
|
-
function
|
|
128
|
-
return
|
|
126
|
+
var Ne;
|
|
127
|
+
function dr() {
|
|
128
|
+
return Ne || (Ne = 1, te.exports = cr()), te.exports;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
132
|
-
return
|
|
133
|
-
|
|
130
|
+
var ur = dr();
|
|
131
|
+
function fr() {
|
|
132
|
+
return ur.useSyncExternalStore(
|
|
133
|
+
mr,
|
|
134
134
|
() => !0,
|
|
135
135
|
() => !1
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function mr() {
|
|
139
139
|
return () => {
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
var
|
|
142
|
+
var he = "Avatar", [hr] = ht(he), [pr, Oe] = hr(he), ze = v.forwardRef(
|
|
143
143
|
(e, i) => {
|
|
144
144
|
const { __scopeAvatar: t, ...l } = e, [d, u] = v.useState("idle");
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
|
|
145
|
+
return /* @__PURE__ */ n.jsx(
|
|
146
|
+
pr,
|
|
147
147
|
{
|
|
148
148
|
scope: t,
|
|
149
149
|
imageLoadingStatus: d,
|
|
150
150
|
onImageLoadingStatusChange: u,
|
|
151
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ n.jsx(le.span, { ...l, ref: i })
|
|
152
152
|
}
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
);
|
|
156
|
-
|
|
157
|
-
var
|
|
156
|
+
ze.displayName = he;
|
|
157
|
+
var Te = "AvatarImage", Be = v.forwardRef(
|
|
158
158
|
(e, i) => {
|
|
159
159
|
const { __scopeAvatar: t, src: l, onLoadingStatusChange: d = () => {
|
|
160
|
-
}, ...u } = e,
|
|
161
|
-
d(r),
|
|
160
|
+
}, ...u } = e, p = Oe(Te, t), g = gr(l, u), a = pt((r) => {
|
|
161
|
+
d(r), p.onImageLoadingStatusChange(r);
|
|
162
162
|
});
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
}, [
|
|
163
|
+
return ne(() => {
|
|
164
|
+
g !== "idle" && a(g);
|
|
165
|
+
}, [g, a]), g === "loaded" ? /* @__PURE__ */ n.jsx(le.img, { ...u, ref: i, src: l }) : null;
|
|
166
166
|
}
|
|
167
167
|
);
|
|
168
|
-
|
|
169
|
-
var
|
|
168
|
+
Be.displayName = Te;
|
|
169
|
+
var Ue = "AvatarFallback", $e = v.forwardRef(
|
|
170
170
|
(e, i) => {
|
|
171
|
-
const { __scopeAvatar: t, delayMs: l, ...d } = e, u =
|
|
171
|
+
const { __scopeAvatar: t, delayMs: l, ...d } = e, u = Oe(Ue, t), [p, g] = v.useState(l === void 0);
|
|
172
172
|
return v.useEffect(() => {
|
|
173
173
|
if (l !== void 0) {
|
|
174
|
-
const
|
|
175
|
-
return () => window.clearTimeout(
|
|
174
|
+
const a = window.setTimeout(() => g(!0), l);
|
|
175
|
+
return () => window.clearTimeout(a);
|
|
176
176
|
}
|
|
177
|
-
}, [l]),
|
|
177
|
+
}, [l]), p && u.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ n.jsx(le.span, { ...d, ref: i }) : null;
|
|
178
178
|
}
|
|
179
179
|
);
|
|
180
|
-
|
|
181
|
-
function
|
|
180
|
+
$e.displayName = Ue;
|
|
181
|
+
function Se(e, i) {
|
|
182
182
|
return e ? i ? (e.src !== i && (e.src = i), e.complete && e.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
const l =
|
|
186
|
-
() =>
|
|
184
|
+
function gr(e, { referrerPolicy: i, crossOrigin: t }) {
|
|
185
|
+
const l = fr(), d = v.useRef(null), u = l ? (d.current || (d.current = new window.Image()), d.current) : null, [p, g] = v.useState(
|
|
186
|
+
() => Se(u, e)
|
|
187
187
|
);
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
}, [u, e]),
|
|
191
|
-
const
|
|
192
|
-
|
|
188
|
+
return ne(() => {
|
|
189
|
+
g(Se(u, e));
|
|
190
|
+
}, [u, e]), ne(() => {
|
|
191
|
+
const a = (o) => () => {
|
|
192
|
+
g(o);
|
|
193
193
|
};
|
|
194
194
|
if (!u) return;
|
|
195
|
-
const r =
|
|
196
|
-
return u.addEventListener("load", r), u.addEventListener("error",
|
|
197
|
-
u.removeEventListener("load", r), u.removeEventListener("error",
|
|
195
|
+
const r = a("loaded"), s = a("error");
|
|
196
|
+
return u.addEventListener("load", r), u.addEventListener("error", s), i && (u.referrerPolicy = i), typeof t == "string" && (u.crossOrigin = t), () => {
|
|
197
|
+
u.removeEventListener("load", r), u.removeEventListener("error", s);
|
|
198
198
|
};
|
|
199
|
-
}, [u, t, i]),
|
|
199
|
+
}, [u, t, i]), p;
|
|
200
200
|
}
|
|
201
|
-
var
|
|
202
|
-
function
|
|
201
|
+
var xr = ze, _r = Be, br = $e;
|
|
202
|
+
function vr({
|
|
203
203
|
className: e,
|
|
204
204
|
size: i = "default",
|
|
205
205
|
...t
|
|
206
206
|
}) {
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
|
|
207
|
+
return /* @__PURE__ */ n.jsx(
|
|
208
|
+
xr,
|
|
209
209
|
{
|
|
210
210
|
"data-slot": "avatar",
|
|
211
211
|
"data-size": i,
|
|
212
|
-
className:
|
|
212
|
+
className: ce(
|
|
213
213
|
"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
|
|
214
214
|
e
|
|
215
215
|
),
|
|
@@ -221,24 +221,24 @@ function yr({
|
|
|
221
221
|
className: e,
|
|
222
222
|
...i
|
|
223
223
|
}) {
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
-
|
|
224
|
+
return /* @__PURE__ */ n.jsx(
|
|
225
|
+
_r,
|
|
226
226
|
{
|
|
227
227
|
"data-slot": "avatar-image",
|
|
228
|
-
className:
|
|
228
|
+
className: ce("aspect-square size-full", e),
|
|
229
229
|
...i
|
|
230
230
|
}
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function jr({
|
|
234
234
|
className: e,
|
|
235
235
|
...i
|
|
236
236
|
}) {
|
|
237
|
-
return /* @__PURE__ */
|
|
238
|
-
|
|
237
|
+
return /* @__PURE__ */ n.jsx(
|
|
238
|
+
br,
|
|
239
239
|
{
|
|
240
240
|
"data-slot": "avatar-fallback",
|
|
241
|
-
className:
|
|
241
|
+
className: ce(
|
|
242
242
|
"bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",
|
|
243
243
|
e
|
|
244
244
|
),
|
|
@@ -246,205 +246,291 @@ function vr({
|
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function wr({
|
|
250
250
|
control: e,
|
|
251
251
|
isOpen: i,
|
|
252
252
|
onSubmit: t,
|
|
253
253
|
handleClose: l,
|
|
254
254
|
languageOptions: d,
|
|
255
255
|
errorMsg: u,
|
|
256
|
-
isSubmitting:
|
|
257
|
-
email:
|
|
258
|
-
onChangeEmail:
|
|
256
|
+
isSubmitting: p,
|
|
257
|
+
email: g,
|
|
258
|
+
onChangeEmail: a,
|
|
259
259
|
isChangingEmail: r,
|
|
260
|
-
pendingEmail:
|
|
260
|
+
pendingEmail: s,
|
|
261
261
|
disableNameEdit: o = !1,
|
|
262
|
-
presentation: c = "dialog"
|
|
262
|
+
presentation: c = "dialog",
|
|
263
|
+
fullName: m,
|
|
264
|
+
onUploadAvatar: f
|
|
263
265
|
}) {
|
|
264
|
-
const { t:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
const { t: h } = R(), { field: x } = gt({ control: e, name: "avatar_url" }), [N, C] = v.useState(!1), _ = v.useRef(null), w = v.useRef(0);
|
|
267
|
+
v.useEffect(() => {
|
|
268
|
+
w.current += 1, C(!1);
|
|
269
|
+
}, [i]);
|
|
270
|
+
const M = async (j) => {
|
|
271
|
+
const Q = j.target.files?.[0];
|
|
272
|
+
if (j.target.value = "", !Q || !f) return;
|
|
273
|
+
const I = ++w.current;
|
|
274
|
+
C(!0);
|
|
275
|
+
try {
|
|
276
|
+
const G = await f(Q);
|
|
277
|
+
G && w.current === I && x.onChange(G);
|
|
278
|
+
} finally {
|
|
279
|
+
w.current === I && C(!1);
|
|
280
|
+
}
|
|
281
|
+
}, [k, z] = v.useState(!1), [F, y] = v.useState(""), [D, P] = v.useState(void 0), X = async () => {
|
|
282
|
+
P(void 0);
|
|
283
|
+
const j = F.trim();
|
|
284
|
+
if (!j) {
|
|
285
|
+
P(h("please_enter_new_email"));
|
|
269
286
|
return;
|
|
270
287
|
}
|
|
271
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(
|
|
272
|
-
|
|
288
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(j)) {
|
|
289
|
+
P(h("please_enter_valid_email"));
|
|
273
290
|
return;
|
|
274
291
|
}
|
|
275
|
-
if (
|
|
276
|
-
|
|
292
|
+
if (g && j.toLowerCase() === g.toLowerCase()) {
|
|
293
|
+
P(h("new_email_must_be_different"));
|
|
277
294
|
return;
|
|
278
295
|
}
|
|
279
296
|
try {
|
|
280
|
-
await
|
|
281
|
-
} catch (
|
|
282
|
-
|
|
283
|
-
|
|
297
|
+
await a?.(j), z(!1), y("");
|
|
298
|
+
} catch (I) {
|
|
299
|
+
P(
|
|
300
|
+
I instanceof Error ? I.message : h("failed_to_initiate_email_change")
|
|
284
301
|
);
|
|
285
302
|
}
|
|
286
|
-
},
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
|
|
303
|
+
}, q = () => {
|
|
304
|
+
z(!1), y(""), P(void 0);
|
|
305
|
+
}, O = () => {
|
|
306
|
+
q(), l();
|
|
290
307
|
};
|
|
291
|
-
return /* @__PURE__ */
|
|
292
|
-
|
|
308
|
+
return /* @__PURE__ */ n.jsxs(
|
|
309
|
+
Le,
|
|
293
310
|
{
|
|
294
311
|
open: i,
|
|
295
|
-
onOpenChange: (
|
|
296
|
-
title:
|
|
312
|
+
onOpenChange: (j) => !j && O(),
|
|
313
|
+
title: h("edit_profile"),
|
|
297
314
|
presentation: c,
|
|
298
315
|
children: [
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
|
|
316
|
+
/* @__PURE__ */ n.jsxs("div", { className: "space-y-4", children: [
|
|
317
|
+
f && /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
318
|
+
/* @__PURE__ */ n.jsx("div", { className: "ring-border relative size-16 shrink-0 overflow-hidden rounded-full ring-1", children: x.value ? /* @__PURE__ */ n.jsx(
|
|
319
|
+
"img",
|
|
320
|
+
{
|
|
321
|
+
src: x.value,
|
|
322
|
+
alt: h("profile_image_alt"),
|
|
323
|
+
className: "h-full w-full object-cover"
|
|
324
|
+
}
|
|
325
|
+
) : /* @__PURE__ */ n.jsx("div", { className: "bg-primary text-primary-foreground flex h-full w-full items-center justify-center text-xl font-semibold", children: (m ?? "").trim().charAt(0).toUpperCase() }) }),
|
|
326
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
327
|
+
/* @__PURE__ */ n.jsx(
|
|
328
|
+
"label",
|
|
329
|
+
{
|
|
330
|
+
htmlFor: "avatar-file-input",
|
|
331
|
+
className: "text-foreground text-sm font-medium",
|
|
332
|
+
children: h("profile_photo")
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
336
|
+
/* @__PURE__ */ n.jsxs(
|
|
337
|
+
E,
|
|
338
|
+
{
|
|
339
|
+
type: "button",
|
|
340
|
+
variant: "outline",
|
|
341
|
+
size: "sm",
|
|
342
|
+
disabled: N,
|
|
343
|
+
onClick: () => _.current?.click(),
|
|
344
|
+
children: [
|
|
345
|
+
N && /* @__PURE__ */ n.jsx("div", { className: "mr-2 size-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current" }),
|
|
346
|
+
h(N ? "uploading" : "change")
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
x.value && !N && /* @__PURE__ */ n.jsx(
|
|
351
|
+
E,
|
|
352
|
+
{
|
|
353
|
+
type: "button",
|
|
354
|
+
variant: "ghost",
|
|
355
|
+
size: "sm",
|
|
356
|
+
onClick: () => x.onChange(""),
|
|
357
|
+
children: h("remove")
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] }),
|
|
361
|
+
/* @__PURE__ */ n.jsx(
|
|
362
|
+
"input",
|
|
363
|
+
{
|
|
364
|
+
ref: _,
|
|
365
|
+
id: "avatar-file-input",
|
|
366
|
+
"aria-label": h("profile_photo"),
|
|
367
|
+
type: "file",
|
|
368
|
+
accept: "image/*",
|
|
369
|
+
disabled: N,
|
|
370
|
+
className: "hidden",
|
|
371
|
+
onChange: (j) => {
|
|
372
|
+
M(j);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ n.jsx(
|
|
379
|
+
ee,
|
|
302
380
|
{
|
|
303
381
|
control: e,
|
|
304
382
|
name: "first_name",
|
|
305
|
-
label:
|
|
383
|
+
label: h("first_name"),
|
|
306
384
|
disabled: o,
|
|
307
385
|
readOnly: o,
|
|
308
386
|
"aria-readonly": o || void 0,
|
|
309
387
|
"aria-describedby": o ? "name-edit-disabled-hint" : void 0
|
|
310
388
|
}
|
|
311
389
|
),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
|
|
390
|
+
/* @__PURE__ */ n.jsx(
|
|
391
|
+
ee,
|
|
314
392
|
{
|
|
315
393
|
control: e,
|
|
316
394
|
name: "last_name",
|
|
317
|
-
label:
|
|
395
|
+
label: h("last_name"),
|
|
318
396
|
disabled: o,
|
|
319
397
|
readOnly: o,
|
|
320
398
|
"aria-readonly": o || void 0,
|
|
321
399
|
"aria-describedby": o ? "name-edit-disabled-hint" : void 0
|
|
322
400
|
}
|
|
323
401
|
),
|
|
324
|
-
o && /* @__PURE__ */
|
|
402
|
+
o && /* @__PURE__ */ n.jsx(
|
|
325
403
|
"p",
|
|
326
404
|
{
|
|
327
405
|
id: "name-edit-disabled-hint",
|
|
328
406
|
className: "text-muted-foreground text-xs",
|
|
329
|
-
children:
|
|
407
|
+
children: h("name_change_disabled_hint")
|
|
330
408
|
}
|
|
331
409
|
),
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
|
|
410
|
+
/* @__PURE__ */ n.jsx(
|
|
411
|
+
ee,
|
|
334
412
|
{
|
|
335
413
|
control: e,
|
|
336
414
|
name: "phone_number",
|
|
337
|
-
label:
|
|
415
|
+
label: h("phone_number"),
|
|
338
416
|
type: "tel"
|
|
339
417
|
}
|
|
340
418
|
),
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
|
|
419
|
+
/* @__PURE__ */ n.jsx(
|
|
420
|
+
Rt,
|
|
343
421
|
{
|
|
344
422
|
control: e,
|
|
345
423
|
name: "bio",
|
|
346
|
-
label:
|
|
424
|
+
label: h("bio"),
|
|
347
425
|
rows: 3,
|
|
348
|
-
placeholder:
|
|
426
|
+
placeholder: h("add_a_short_bio")
|
|
349
427
|
}
|
|
350
428
|
),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
|
|
429
|
+
/* @__PURE__ */ n.jsx(
|
|
430
|
+
Ft,
|
|
353
431
|
{
|
|
354
432
|
control: e,
|
|
355
433
|
name: "language",
|
|
356
|
-
label:
|
|
434
|
+
label: h("language"),
|
|
357
435
|
options: d,
|
|
358
|
-
placeholder:
|
|
436
|
+
placeholder: h("select_an_option")
|
|
359
437
|
}
|
|
360
438
|
)
|
|
361
439
|
] }),
|
|
362
|
-
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
|
|
440
|
+
g && /* @__PURE__ */ n.jsxs("div", { className: "space-y-2", children: [
|
|
441
|
+
/* @__PURE__ */ n.jsx("label", { className: "text-foreground text-sm font-medium", children: h("email") }),
|
|
442
|
+
k ? /* @__PURE__ */ n.jsxs("div", { className: "space-y-2", children: [
|
|
443
|
+
/* @__PURE__ */ n.jsx(
|
|
444
|
+
Xt,
|
|
367
445
|
{
|
|
368
446
|
type: "email",
|
|
369
|
-
placeholder:
|
|
370
|
-
value:
|
|
371
|
-
onChange: (
|
|
372
|
-
|
|
447
|
+
placeholder: h("enter_new_email_placeholder"),
|
|
448
|
+
value: F,
|
|
449
|
+
onChange: (j) => {
|
|
450
|
+
y(j.target.value), P(void 0);
|
|
373
451
|
},
|
|
374
|
-
onKeyDown: (
|
|
375
|
-
|
|
452
|
+
onKeyDown: (j) => {
|
|
453
|
+
j.key === "Enter" && (j.preventDefault(), X()), j.key === "Escape" && q();
|
|
376
454
|
},
|
|
377
|
-
"aria-invalid": !!
|
|
455
|
+
"aria-invalid": !!D || void 0,
|
|
378
456
|
autoFocus: !0
|
|
379
457
|
}
|
|
380
458
|
),
|
|
381
|
-
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
459
|
+
D && /* @__PURE__ */ n.jsx("p", { className: "text-destructive text-xs", children: D }),
|
|
460
|
+
/* @__PURE__ */ n.jsxs("div", { className: "bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5", children: [
|
|
461
|
+
/* @__PURE__ */ n.jsx(je, { className: "text-primary mt-0.5 size-4 shrink-0" }),
|
|
462
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-xs", children: h("email_verification_hint") })
|
|
385
463
|
] }),
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
|
|
464
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex gap-2", children: [
|
|
465
|
+
/* @__PURE__ */ n.jsx(
|
|
466
|
+
E,
|
|
389
467
|
{
|
|
390
468
|
type: "button",
|
|
391
469
|
variant: "outline",
|
|
392
470
|
size: "sm",
|
|
393
|
-
onClick:
|
|
394
|
-
children:
|
|
471
|
+
onClick: q,
|
|
472
|
+
children: h("cancel")
|
|
395
473
|
}
|
|
396
474
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
|
|
475
|
+
/* @__PURE__ */ n.jsxs(
|
|
476
|
+
E,
|
|
399
477
|
{
|
|
400
478
|
type: "button",
|
|
401
479
|
size: "sm",
|
|
402
|
-
onClick:
|
|
403
|
-
disabled: !
|
|
480
|
+
onClick: X,
|
|
481
|
+
disabled: !F.trim() || r,
|
|
404
482
|
children: [
|
|
405
|
-
r && /* @__PURE__ */
|
|
406
|
-
|
|
483
|
+
r && /* @__PURE__ */ n.jsx("div", { className: "mr-2 size-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current" }),
|
|
484
|
+
h(r ? "sending" : "send_verification")
|
|
407
485
|
]
|
|
408
486
|
}
|
|
409
487
|
)
|
|
410
488
|
] })
|
|
411
|
-
] }) :
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
|
|
489
|
+
] }) : s ? /* @__PURE__ */ n.jsxs("div", { className: "space-y-2", children: [
|
|
490
|
+
/* @__PURE__ */ n.jsx("div", { className: "bg-muted text-muted-foreground min-w-0 rounded-md px-3 py-2 text-sm", children: g }),
|
|
491
|
+
/* @__PURE__ */ n.jsxs("div", { className: "bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5", children: [
|
|
492
|
+
/* @__PURE__ */ n.jsx(je, { className: "text-primary mt-0.5 size-4 shrink-0" }),
|
|
493
|
+
/* @__PURE__ */ n.jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
494
|
+
h("changing_email_to"),
|
|
417
495
|
" ",
|
|
418
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ n.jsx("span", { className: "text-foreground font-medium", children: s }),
|
|
419
497
|
". ",
|
|
420
|
-
|
|
498
|
+
h("check_new_email_verification")
|
|
421
499
|
] })
|
|
422
500
|
] })
|
|
423
|
-
] }) : /* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
|
|
426
|
-
|
|
501
|
+
] }) : /* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
502
|
+
/* @__PURE__ */ n.jsx("div", { className: "bg-muted text-muted-foreground min-w-0 flex-1 rounded-md px-3 py-2 text-sm", children: g }),
|
|
503
|
+
a && /* @__PURE__ */ n.jsx(
|
|
504
|
+
E,
|
|
427
505
|
{
|
|
428
506
|
type: "button",
|
|
429
507
|
variant: "outline",
|
|
430
508
|
size: "sm",
|
|
431
|
-
onClick: () =>
|
|
509
|
+
onClick: () => z(!0),
|
|
432
510
|
className: "shrink-0",
|
|
433
|
-
children:
|
|
511
|
+
children: h("change")
|
|
434
512
|
}
|
|
435
513
|
)
|
|
436
514
|
] })
|
|
437
515
|
] }),
|
|
438
|
-
u && /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
516
|
+
u && /* @__PURE__ */ n.jsx("p", { className: "text-destructive text-sm", children: u }),
|
|
517
|
+
/* @__PURE__ */ n.jsx(Wt, { className: "flex flex-row items-center justify-end", children: /* @__PURE__ */ n.jsx("div", { className: "flex-1 text-right", children: /* @__PURE__ */ n.jsxs(
|
|
518
|
+
E,
|
|
519
|
+
{
|
|
520
|
+
type: "button",
|
|
521
|
+
onClick: t,
|
|
522
|
+
disabled: N || p,
|
|
523
|
+
children: [
|
|
524
|
+
p && /* @__PURE__ */ n.jsx("div", { className: "mr-2 size-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }),
|
|
525
|
+
h(p ? "saving" : "save_changes")
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
) }) })
|
|
443
529
|
]
|
|
444
530
|
}
|
|
445
531
|
);
|
|
446
532
|
}
|
|
447
|
-
function
|
|
533
|
+
function Cr(e, i) {
|
|
448
534
|
if (!e) return !1;
|
|
449
535
|
const t = e.member_type_detail?.permissions;
|
|
450
536
|
if (t) {
|
|
@@ -453,23 +539,23 @@ function wr(e, i) {
|
|
|
453
539
|
}
|
|
454
540
|
return e.member_type !== "customer";
|
|
455
541
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
542
|
+
function Nr(e) {
|
|
543
|
+
return Cr(e, "rep_eligible");
|
|
458
544
|
}
|
|
459
|
-
var
|
|
545
|
+
var Sr = Object.defineProperty, Z = Object.getOwnPropertySymbols, qe = Object.prototype.hasOwnProperty, Qe = Object.prototype.propertyIsEnumerable, Ee = (e, i, t) => i in e ? Sr(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, ae = (e, i) => {
|
|
460
546
|
for (var t in i || (i = {}))
|
|
461
|
-
|
|
462
|
-
if (
|
|
463
|
-
for (var t of
|
|
464
|
-
|
|
547
|
+
qe.call(i, t) && Ee(e, t, i[t]);
|
|
548
|
+
if (Z)
|
|
549
|
+
for (var t of Z(i))
|
|
550
|
+
Qe.call(i, t) && Ee(e, t, i[t]);
|
|
465
551
|
return e;
|
|
466
|
-
},
|
|
552
|
+
}, ie = (e, i) => {
|
|
467
553
|
var t = {};
|
|
468
554
|
for (var l in e)
|
|
469
|
-
|
|
470
|
-
if (e != null &&
|
|
471
|
-
for (var l of
|
|
472
|
-
i.indexOf(l) < 0 &&
|
|
555
|
+
qe.call(e, l) && i.indexOf(l) < 0 && (t[l] = e[l]);
|
|
556
|
+
if (e != null && Z)
|
|
557
|
+
for (var l of Z(e))
|
|
558
|
+
i.indexOf(l) < 0 && Qe.call(e, l) && (t[l] = e[l]);
|
|
473
559
|
return t;
|
|
474
560
|
};
|
|
475
561
|
/**
|
|
@@ -477,7 +563,7 @@ var Nr = Object.defineProperty, G = Object.getOwnPropertySymbols, $e = Object.pr
|
|
|
477
563
|
* Copyright (c) Project Nayuki.
|
|
478
564
|
* SPDX-License-Identifier: MIT
|
|
479
565
|
*/
|
|
480
|
-
var
|
|
566
|
+
var U;
|
|
481
567
|
((e) => {
|
|
482
568
|
const i = class b {
|
|
483
569
|
/*-- Constructor (low level) and fields --*/
|
|
@@ -485,25 +571,25 @@ var T;
|
|
|
485
571
|
// error correction level, data codeword bytes, and mask number.
|
|
486
572
|
// This is a low-level API that most users should not use directly.
|
|
487
573
|
// A mid-level API is the encodeSegments() function.
|
|
488
|
-
constructor(
|
|
489
|
-
if (this.version =
|
|
574
|
+
constructor(a, r, s, o) {
|
|
575
|
+
if (this.version = a, this.errorCorrectionLevel = r, this.modules = [], this.isFunction = [], a < b.MIN_VERSION || a > b.MAX_VERSION)
|
|
490
576
|
throw new RangeError("Version value out of range");
|
|
491
577
|
if (o < -1 || o > 7)
|
|
492
578
|
throw new RangeError("Mask value out of range");
|
|
493
|
-
this.size =
|
|
579
|
+
this.size = a * 4 + 17;
|
|
494
580
|
let c = [];
|
|
495
|
-
for (let
|
|
581
|
+
for (let f = 0; f < this.size; f++)
|
|
496
582
|
c.push(!1);
|
|
497
|
-
for (let
|
|
583
|
+
for (let f = 0; f < this.size; f++)
|
|
498
584
|
this.modules.push(c.slice()), this.isFunction.push(c.slice());
|
|
499
585
|
this.drawFunctionPatterns();
|
|
500
|
-
const
|
|
501
|
-
if (this.drawCodewords(
|
|
502
|
-
let
|
|
503
|
-
for (let
|
|
504
|
-
this.applyMask(
|
|
586
|
+
const m = this.addEccAndInterleave(s);
|
|
587
|
+
if (this.drawCodewords(m), o == -1) {
|
|
588
|
+
let f = 1e9;
|
|
589
|
+
for (let h = 0; h < 8; h++) {
|
|
590
|
+
this.applyMask(h), this.drawFormatBits(h);
|
|
505
591
|
const x = this.getPenaltyScore();
|
|
506
|
-
x <
|
|
592
|
+
x < f && (o = h, f = x), this.applyMask(h);
|
|
507
593
|
}
|
|
508
594
|
}
|
|
509
595
|
d(0 <= o && o <= 7), this.mask = o, this.applyMask(o), this.drawFormatBits(o), this.isFunction = [];
|
|
@@ -514,17 +600,17 @@ var T;
|
|
|
514
600
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
515
601
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
516
602
|
// ecl argument if it can be done without increasing the version.
|
|
517
|
-
static encodeText(
|
|
518
|
-
const
|
|
519
|
-
return b.encodeSegments(
|
|
603
|
+
static encodeText(a, r) {
|
|
604
|
+
const s = e.QrSegment.makeSegments(a);
|
|
605
|
+
return b.encodeSegments(s, r);
|
|
520
606
|
}
|
|
521
607
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
522
608
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
523
609
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
524
610
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
525
|
-
static encodeBinary(
|
|
526
|
-
const
|
|
527
|
-
return b.encodeSegments([
|
|
611
|
+
static encodeBinary(a, r) {
|
|
612
|
+
const s = e.QrSegment.makeBytes(a);
|
|
613
|
+
return b.encodeSegments([s], r);
|
|
528
614
|
}
|
|
529
615
|
/*-- Static factory functions (mid level) --*/
|
|
530
616
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -536,43 +622,43 @@ var T;
|
|
|
536
622
|
// This function allows the user to create a custom sequence of segments that switches
|
|
537
623
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
538
624
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
539
|
-
static encodeSegments(
|
|
540
|
-
if (!(b.MIN_VERSION <=
|
|
625
|
+
static encodeSegments(a, r, s = 1, o = 40, c = -1, m = !0) {
|
|
626
|
+
if (!(b.MIN_VERSION <= s && s <= o && o <= b.MAX_VERSION) || c < -1 || c > 7)
|
|
541
627
|
throw new RangeError("Invalid value");
|
|
542
|
-
let
|
|
543
|
-
for (
|
|
544
|
-
const _ = b.getNumDataCodewords(
|
|
628
|
+
let f, h;
|
|
629
|
+
for (f = s; ; f++) {
|
|
630
|
+
const _ = b.getNumDataCodewords(f, r) * 8, w = p.getTotalBits(a, f);
|
|
545
631
|
if (w <= _) {
|
|
546
|
-
|
|
632
|
+
h = w;
|
|
547
633
|
break;
|
|
548
634
|
}
|
|
549
|
-
if (
|
|
635
|
+
if (f >= o)
|
|
550
636
|
throw new RangeError("Data too long");
|
|
551
637
|
}
|
|
552
638
|
for (const _ of [b.Ecc.MEDIUM, b.Ecc.QUARTILE, b.Ecc.HIGH])
|
|
553
|
-
|
|
639
|
+
m && h <= b.getNumDataCodewords(f, _) * 8 && (r = _);
|
|
554
640
|
let x = [];
|
|
555
|
-
for (const _ of
|
|
556
|
-
t(_.mode.modeBits, 4, x), t(_.numChars, _.mode.numCharCountBits(
|
|
641
|
+
for (const _ of a) {
|
|
642
|
+
t(_.mode.modeBits, 4, x), t(_.numChars, _.mode.numCharCountBits(f), x);
|
|
557
643
|
for (const w of _.getData())
|
|
558
644
|
x.push(w);
|
|
559
645
|
}
|
|
560
|
-
d(x.length ==
|
|
561
|
-
const N = b.getNumDataCodewords(
|
|
646
|
+
d(x.length == h);
|
|
647
|
+
const N = b.getNumDataCodewords(f, r) * 8;
|
|
562
648
|
d(x.length <= N), t(0, Math.min(4, N - x.length), x), t(0, (8 - x.length % 8) % 8, x), d(x.length % 8 == 0);
|
|
563
649
|
for (let _ = 236; x.length < N; _ ^= 253)
|
|
564
650
|
t(_, 8, x);
|
|
565
|
-
let
|
|
566
|
-
for (;
|
|
567
|
-
|
|
568
|
-
return x.forEach((_, w) =>
|
|
651
|
+
let C = [];
|
|
652
|
+
for (; C.length * 8 < x.length; )
|
|
653
|
+
C.push(0);
|
|
654
|
+
return x.forEach((_, w) => C[w >>> 3] |= _ << 7 - (w & 7)), new b(f, r, C, c);
|
|
569
655
|
}
|
|
570
656
|
/*-- Accessor methods --*/
|
|
571
657
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
572
658
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
|
573
659
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
|
574
|
-
getModule(
|
|
575
|
-
return 0 <=
|
|
660
|
+
getModule(a, r) {
|
|
661
|
+
return 0 <= a && a < this.size && 0 <= r && r < this.size && this.modules[r][a];
|
|
576
662
|
}
|
|
577
663
|
// Modified to expose modules for easy access
|
|
578
664
|
getModules() {
|
|
@@ -581,23 +667,23 @@ var T;
|
|
|
581
667
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
|
582
668
|
// Reads this object's version field, and draws and marks all function modules.
|
|
583
669
|
drawFunctionPatterns() {
|
|
584
|
-
for (let
|
|
585
|
-
this.setFunctionModule(6,
|
|
670
|
+
for (let s = 0; s < this.size; s++)
|
|
671
|
+
this.setFunctionModule(6, s, s % 2 == 0), this.setFunctionModule(s, 6, s % 2 == 0);
|
|
586
672
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
587
|
-
const
|
|
588
|
-
for (let
|
|
673
|
+
const a = this.getAlignmentPatternPositions(), r = a.length;
|
|
674
|
+
for (let s = 0; s < r; s++)
|
|
589
675
|
for (let o = 0; o < r; o++)
|
|
590
|
-
|
|
676
|
+
s == 0 && o == 0 || s == 0 && o == r - 1 || s == r - 1 && o == 0 || this.drawAlignmentPattern(a[s], a[o]);
|
|
591
677
|
this.drawFormatBits(0), this.drawVersion();
|
|
592
678
|
}
|
|
593
679
|
// Draws two copies of the format bits (with its own error correction code)
|
|
594
680
|
// based on the given mask and this object's error correction level field.
|
|
595
|
-
drawFormatBits(
|
|
596
|
-
const r = this.errorCorrectionLevel.formatBits << 3 |
|
|
597
|
-
let
|
|
681
|
+
drawFormatBits(a) {
|
|
682
|
+
const r = this.errorCorrectionLevel.formatBits << 3 | a;
|
|
683
|
+
let s = r;
|
|
598
684
|
for (let c = 0; c < 10; c++)
|
|
599
|
-
|
|
600
|
-
const o = (r << 10 |
|
|
685
|
+
s = s << 1 ^ (s >>> 9) * 1335;
|
|
686
|
+
const o = (r << 10 | s) ^ 21522;
|
|
601
687
|
d(o >>> 15 == 0);
|
|
602
688
|
for (let c = 0; c <= 5; c++)
|
|
603
689
|
this.setFunctionModule(8, c, l(o, c));
|
|
@@ -615,144 +701,144 @@ var T;
|
|
|
615
701
|
drawVersion() {
|
|
616
702
|
if (this.version < 7)
|
|
617
703
|
return;
|
|
618
|
-
let
|
|
619
|
-
for (let
|
|
620
|
-
|
|
621
|
-
const r = this.version << 12 |
|
|
704
|
+
let a = this.version;
|
|
705
|
+
for (let s = 0; s < 12; s++)
|
|
706
|
+
a = a << 1 ^ (a >>> 11) * 7973;
|
|
707
|
+
const r = this.version << 12 | a;
|
|
622
708
|
d(r >>> 18 == 0);
|
|
623
|
-
for (let
|
|
624
|
-
const o = l(r,
|
|
625
|
-
this.setFunctionModule(c,
|
|
709
|
+
for (let s = 0; s < 18; s++) {
|
|
710
|
+
const o = l(r, s), c = this.size - 11 + s % 3, m = Math.floor(s / 3);
|
|
711
|
+
this.setFunctionModule(c, m, o), this.setFunctionModule(m, c, o);
|
|
626
712
|
}
|
|
627
713
|
}
|
|
628
714
|
// Draws a 9*9 finder pattern including the border separator,
|
|
629
715
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
630
|
-
drawFinderPattern(
|
|
631
|
-
for (let
|
|
716
|
+
drawFinderPattern(a, r) {
|
|
717
|
+
for (let s = -4; s <= 4; s++)
|
|
632
718
|
for (let o = -4; o <= 4; o++) {
|
|
633
|
-
const c = Math.max(Math.abs(o), Math.abs(
|
|
634
|
-
0 <=
|
|
719
|
+
const c = Math.max(Math.abs(o), Math.abs(s)), m = a + o, f = r + s;
|
|
720
|
+
0 <= m && m < this.size && 0 <= f && f < this.size && this.setFunctionModule(m, f, c != 2 && c != 4);
|
|
635
721
|
}
|
|
636
722
|
}
|
|
637
723
|
// Draws a 5*5 alignment pattern, with the center module
|
|
638
724
|
// at (x, y). All modules must be in bounds.
|
|
639
|
-
drawAlignmentPattern(
|
|
640
|
-
for (let
|
|
725
|
+
drawAlignmentPattern(a, r) {
|
|
726
|
+
for (let s = -2; s <= 2; s++)
|
|
641
727
|
for (let o = -2; o <= 2; o++)
|
|
642
|
-
this.setFunctionModule(
|
|
728
|
+
this.setFunctionModule(a + o, r + s, Math.max(Math.abs(o), Math.abs(s)) != 1);
|
|
643
729
|
}
|
|
644
730
|
// Sets the color of a module and marks it as a function module.
|
|
645
731
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
646
|
-
setFunctionModule(
|
|
647
|
-
this.modules[r][
|
|
732
|
+
setFunctionModule(a, r, s) {
|
|
733
|
+
this.modules[r][a] = s, this.isFunction[r][a] = !0;
|
|
648
734
|
}
|
|
649
735
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
650
736
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
651
737
|
// codewords appended to it, based on this object's version and error correction level.
|
|
652
|
-
addEccAndInterleave(
|
|
653
|
-
const r = this.version,
|
|
654
|
-
if (
|
|
738
|
+
addEccAndInterleave(a) {
|
|
739
|
+
const r = this.version, s = this.errorCorrectionLevel;
|
|
740
|
+
if (a.length != b.getNumDataCodewords(r, s))
|
|
655
741
|
throw new RangeError("Invalid argument");
|
|
656
|
-
const o = b.NUM_ERROR_CORRECTION_BLOCKS[
|
|
742
|
+
const o = b.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][r], c = b.ECC_CODEWORDS_PER_BLOCK[s.ordinal][r], m = Math.floor(b.getNumRawDataModules(r) / 8), f = o - m % o, h = Math.floor(m / o);
|
|
657
743
|
let x = [];
|
|
658
744
|
const N = b.reedSolomonComputeDivisor(c);
|
|
659
745
|
for (let _ = 0, w = 0; _ < o; _++) {
|
|
660
|
-
let
|
|
661
|
-
w +=
|
|
662
|
-
const
|
|
663
|
-
_ <
|
|
746
|
+
let M = a.slice(w, w + h - c + (_ < f ? 0 : 1));
|
|
747
|
+
w += M.length;
|
|
748
|
+
const k = b.reedSolomonComputeRemainder(M, N);
|
|
749
|
+
_ < f && M.push(0), x.push(M.concat(k));
|
|
664
750
|
}
|
|
665
|
-
let
|
|
751
|
+
let C = [];
|
|
666
752
|
for (let _ = 0; _ < x[0].length; _++)
|
|
667
|
-
x.forEach((w,
|
|
668
|
-
(_ !=
|
|
753
|
+
x.forEach((w, M) => {
|
|
754
|
+
(_ != h - c || M >= f) && C.push(w[_]);
|
|
669
755
|
});
|
|
670
|
-
return d(
|
|
756
|
+
return d(C.length == m), C;
|
|
671
757
|
}
|
|
672
758
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
673
759
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
674
|
-
drawCodewords(
|
|
675
|
-
if (
|
|
760
|
+
drawCodewords(a) {
|
|
761
|
+
if (a.length != Math.floor(b.getNumRawDataModules(this.version) / 8))
|
|
676
762
|
throw new RangeError("Invalid argument");
|
|
677
763
|
let r = 0;
|
|
678
|
-
for (let
|
|
679
|
-
|
|
764
|
+
for (let s = this.size - 1; s >= 1; s -= 2) {
|
|
765
|
+
s == 6 && (s = 5);
|
|
680
766
|
for (let o = 0; o < this.size; o++)
|
|
681
767
|
for (let c = 0; c < 2; c++) {
|
|
682
|
-
const
|
|
683
|
-
!this.isFunction[
|
|
768
|
+
const m = s - c, h = (s + 1 & 2) == 0 ? this.size - 1 - o : o;
|
|
769
|
+
!this.isFunction[h][m] && r < a.length * 8 && (this.modules[h][m] = l(a[r >>> 3], 7 - (r & 7)), r++);
|
|
684
770
|
}
|
|
685
771
|
}
|
|
686
|
-
d(r ==
|
|
772
|
+
d(r == a.length * 8);
|
|
687
773
|
}
|
|
688
774
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
689
775
|
// The function modules must be marked and the codeword bits must be drawn
|
|
690
776
|
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
|
691
777
|
// the same mask value a second time will undo the mask. A final well-formed
|
|
692
778
|
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
|
693
|
-
applyMask(
|
|
694
|
-
if (
|
|
779
|
+
applyMask(a) {
|
|
780
|
+
if (a < 0 || a > 7)
|
|
695
781
|
throw new RangeError("Mask value out of range");
|
|
696
782
|
for (let r = 0; r < this.size; r++)
|
|
697
|
-
for (let
|
|
783
|
+
for (let s = 0; s < this.size; s++) {
|
|
698
784
|
let o;
|
|
699
|
-
switch (
|
|
785
|
+
switch (a) {
|
|
700
786
|
case 0:
|
|
701
|
-
o = (
|
|
787
|
+
o = (s + r) % 2 == 0;
|
|
702
788
|
break;
|
|
703
789
|
case 1:
|
|
704
790
|
o = r % 2 == 0;
|
|
705
791
|
break;
|
|
706
792
|
case 2:
|
|
707
|
-
o =
|
|
793
|
+
o = s % 3 == 0;
|
|
708
794
|
break;
|
|
709
795
|
case 3:
|
|
710
|
-
o = (
|
|
796
|
+
o = (s + r) % 3 == 0;
|
|
711
797
|
break;
|
|
712
798
|
case 4:
|
|
713
|
-
o = (Math.floor(
|
|
799
|
+
o = (Math.floor(s / 3) + Math.floor(r / 2)) % 2 == 0;
|
|
714
800
|
break;
|
|
715
801
|
case 5:
|
|
716
|
-
o =
|
|
802
|
+
o = s * r % 2 + s * r % 3 == 0;
|
|
717
803
|
break;
|
|
718
804
|
case 6:
|
|
719
|
-
o = (
|
|
805
|
+
o = (s * r % 2 + s * r % 3) % 2 == 0;
|
|
720
806
|
break;
|
|
721
807
|
case 7:
|
|
722
|
-
o = ((
|
|
808
|
+
o = ((s + r) % 2 + s * r % 3) % 2 == 0;
|
|
723
809
|
break;
|
|
724
810
|
default:
|
|
725
811
|
throw new Error("Unreachable");
|
|
726
812
|
}
|
|
727
|
-
!this.isFunction[r][
|
|
813
|
+
!this.isFunction[r][s] && o && (this.modules[r][s] = !this.modules[r][s]);
|
|
728
814
|
}
|
|
729
815
|
}
|
|
730
816
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
731
817
|
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
|
732
818
|
getPenaltyScore() {
|
|
733
|
-
let
|
|
819
|
+
let a = 0;
|
|
734
820
|
for (let c = 0; c < this.size; c++) {
|
|
735
|
-
let
|
|
821
|
+
let m = !1, f = 0, h = [0, 0, 0, 0, 0, 0, 0];
|
|
736
822
|
for (let x = 0; x < this.size; x++)
|
|
737
|
-
this.modules[c][x] ==
|
|
738
|
-
|
|
823
|
+
this.modules[c][x] == m ? (f++, f == 5 ? a += b.PENALTY_N1 : f > 5 && a++) : (this.finderPenaltyAddHistory(f, h), m || (a += this.finderPenaltyCountPatterns(h) * b.PENALTY_N3), m = this.modules[c][x], f = 1);
|
|
824
|
+
a += this.finderPenaltyTerminateAndCount(m, f, h) * b.PENALTY_N3;
|
|
739
825
|
}
|
|
740
826
|
for (let c = 0; c < this.size; c++) {
|
|
741
|
-
let
|
|
827
|
+
let m = !1, f = 0, h = [0, 0, 0, 0, 0, 0, 0];
|
|
742
828
|
for (let x = 0; x < this.size; x++)
|
|
743
|
-
this.modules[x][c] ==
|
|
744
|
-
|
|
829
|
+
this.modules[x][c] == m ? (f++, f == 5 ? a += b.PENALTY_N1 : f > 5 && a++) : (this.finderPenaltyAddHistory(f, h), m || (a += this.finderPenaltyCountPatterns(h) * b.PENALTY_N3), m = this.modules[x][c], f = 1);
|
|
830
|
+
a += this.finderPenaltyTerminateAndCount(m, f, h) * b.PENALTY_N3;
|
|
745
831
|
}
|
|
746
832
|
for (let c = 0; c < this.size - 1; c++)
|
|
747
|
-
for (let
|
|
748
|
-
const
|
|
749
|
-
|
|
833
|
+
for (let m = 0; m < this.size - 1; m++) {
|
|
834
|
+
const f = this.modules[c][m];
|
|
835
|
+
f == this.modules[c][m + 1] && f == this.modules[c + 1][m] && f == this.modules[c + 1][m + 1] && (a += b.PENALTY_N2);
|
|
750
836
|
}
|
|
751
837
|
let r = 0;
|
|
752
838
|
for (const c of this.modules)
|
|
753
|
-
r = c.reduce((
|
|
754
|
-
const
|
|
755
|
-
return d(0 <= o && o <= 9),
|
|
839
|
+
r = c.reduce((m, f) => m + (f ? 1 : 0), r);
|
|
840
|
+
const s = this.size * this.size, o = Math.ceil(Math.abs(r * 20 - s * 10) / s) - 1;
|
|
841
|
+
return d(0 <= o && o <= 9), a += o * b.PENALTY_N4, d(0 <= a && a <= 2568888), a;
|
|
756
842
|
}
|
|
757
843
|
/*-- Private helper functions --*/
|
|
758
844
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -762,83 +848,83 @@ var T;
|
|
|
762
848
|
if (this.version == 1)
|
|
763
849
|
return [];
|
|
764
850
|
{
|
|
765
|
-
const
|
|
766
|
-
let
|
|
767
|
-
for (let o = this.size - 7;
|
|
768
|
-
|
|
769
|
-
return
|
|
851
|
+
const a = Math.floor(this.version / 7) + 2, r = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (a * 2 - 2)) * 2;
|
|
852
|
+
let s = [6];
|
|
853
|
+
for (let o = this.size - 7; s.length < a; o -= r)
|
|
854
|
+
s.splice(1, 0, o);
|
|
855
|
+
return s;
|
|
770
856
|
}
|
|
771
857
|
}
|
|
772
858
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
773
859
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
774
860
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
775
|
-
static getNumRawDataModules(
|
|
776
|
-
if (
|
|
861
|
+
static getNumRawDataModules(a) {
|
|
862
|
+
if (a < b.MIN_VERSION || a > b.MAX_VERSION)
|
|
777
863
|
throw new RangeError("Version number out of range");
|
|
778
|
-
let r = (16 *
|
|
779
|
-
if (
|
|
780
|
-
const
|
|
781
|
-
r -= (25 *
|
|
864
|
+
let r = (16 * a + 128) * a + 64;
|
|
865
|
+
if (a >= 2) {
|
|
866
|
+
const s = Math.floor(a / 7) + 2;
|
|
867
|
+
r -= (25 * s - 10) * s - 55, a >= 7 && (r -= 36);
|
|
782
868
|
}
|
|
783
869
|
return d(208 <= r && r <= 29648), r;
|
|
784
870
|
}
|
|
785
871
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
786
872
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
787
873
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
788
|
-
static getNumDataCodewords(
|
|
789
|
-
return Math.floor(b.getNumRawDataModules(
|
|
874
|
+
static getNumDataCodewords(a, r) {
|
|
875
|
+
return Math.floor(b.getNumRawDataModules(a) / 8) - b.ECC_CODEWORDS_PER_BLOCK[r.ordinal][a] * b.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][a];
|
|
790
876
|
}
|
|
791
877
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
792
878
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
793
|
-
static reedSolomonComputeDivisor(
|
|
794
|
-
if (
|
|
879
|
+
static reedSolomonComputeDivisor(a) {
|
|
880
|
+
if (a < 1 || a > 255)
|
|
795
881
|
throw new RangeError("Degree out of range");
|
|
796
882
|
let r = [];
|
|
797
|
-
for (let o = 0; o <
|
|
883
|
+
for (let o = 0; o < a - 1; o++)
|
|
798
884
|
r.push(0);
|
|
799
885
|
r.push(1);
|
|
800
|
-
let
|
|
801
|
-
for (let o = 0; o <
|
|
886
|
+
let s = 1;
|
|
887
|
+
for (let o = 0; o < a; o++) {
|
|
802
888
|
for (let c = 0; c < r.length; c++)
|
|
803
|
-
r[c] = b.reedSolomonMultiply(r[c],
|
|
804
|
-
|
|
889
|
+
r[c] = b.reedSolomonMultiply(r[c], s), c + 1 < r.length && (r[c] ^= r[c + 1]);
|
|
890
|
+
s = b.reedSolomonMultiply(s, 2);
|
|
805
891
|
}
|
|
806
892
|
return r;
|
|
807
893
|
}
|
|
808
894
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
809
|
-
static reedSolomonComputeRemainder(
|
|
810
|
-
let
|
|
811
|
-
for (const o of
|
|
812
|
-
const c = o ^
|
|
813
|
-
|
|
895
|
+
static reedSolomonComputeRemainder(a, r) {
|
|
896
|
+
let s = r.map((o) => 0);
|
|
897
|
+
for (const o of a) {
|
|
898
|
+
const c = o ^ s.shift();
|
|
899
|
+
s.push(0), r.forEach((m, f) => s[f] ^= b.reedSolomonMultiply(m, c));
|
|
814
900
|
}
|
|
815
|
-
return
|
|
901
|
+
return s;
|
|
816
902
|
}
|
|
817
903
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
818
904
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
819
|
-
static reedSolomonMultiply(
|
|
820
|
-
if (
|
|
905
|
+
static reedSolomonMultiply(a, r) {
|
|
906
|
+
if (a >>> 8 || r >>> 8)
|
|
821
907
|
throw new RangeError("Byte out of range");
|
|
822
|
-
let
|
|
908
|
+
let s = 0;
|
|
823
909
|
for (let o = 7; o >= 0; o--)
|
|
824
|
-
|
|
825
|
-
return d(
|
|
910
|
+
s = s << 1 ^ (s >>> 7) * 285, s ^= (r >>> o & 1) * a;
|
|
911
|
+
return d(s >>> 8 == 0), s;
|
|
826
912
|
}
|
|
827
913
|
// Can only be called immediately after a light run is added, and
|
|
828
914
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
829
|
-
finderPenaltyCountPatterns(
|
|
830
|
-
const r =
|
|
915
|
+
finderPenaltyCountPatterns(a) {
|
|
916
|
+
const r = a[1];
|
|
831
917
|
d(r <= this.size * 3);
|
|
832
|
-
const
|
|
833
|
-
return (
|
|
918
|
+
const s = r > 0 && a[2] == r && a[3] == r * 3 && a[4] == r && a[5] == r;
|
|
919
|
+
return (s && a[0] >= r * 4 && a[6] >= r ? 1 : 0) + (s && a[6] >= r * 4 && a[0] >= r ? 1 : 0);
|
|
834
920
|
}
|
|
835
921
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
836
|
-
finderPenaltyTerminateAndCount(
|
|
837
|
-
return
|
|
922
|
+
finderPenaltyTerminateAndCount(a, r, s) {
|
|
923
|
+
return a && (this.finderPenaltyAddHistory(r, s), r = 0), r += this.size, this.finderPenaltyAddHistory(r, s), this.finderPenaltyCountPatterns(s);
|
|
838
924
|
}
|
|
839
925
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
840
|
-
finderPenaltyAddHistory(
|
|
841
|
-
r[0] == 0 && (
|
|
926
|
+
finderPenaltyAddHistory(a, r) {
|
|
927
|
+
r[0] == 0 && (a += this.size), r.pop(), r.unshift(a);
|
|
842
928
|
}
|
|
843
929
|
};
|
|
844
930
|
i.MIN_VERSION = 1, i.MAX_VERSION = 40, i.PENALTY_N1 = 3, i.PENALTY_N2 = 3, i.PENALTY_N3 = 40, i.PENALTY_N4 = 10, i.ECC_CODEWORDS_PER_BLOCK = [
|
|
@@ -864,94 +950,94 @@ var T;
|
|
|
864
950
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
865
951
|
// High
|
|
866
952
|
], e.QrCode = i;
|
|
867
|
-
function t(
|
|
868
|
-
if (
|
|
953
|
+
function t(g, a, r) {
|
|
954
|
+
if (a < 0 || a > 31 || g >>> a)
|
|
869
955
|
throw new RangeError("Value out of range");
|
|
870
|
-
for (let
|
|
871
|
-
r.push(
|
|
956
|
+
for (let s = a - 1; s >= 0; s--)
|
|
957
|
+
r.push(g >>> s & 1);
|
|
872
958
|
}
|
|
873
|
-
function l(
|
|
874
|
-
return (
|
|
959
|
+
function l(g, a) {
|
|
960
|
+
return (g >>> a & 1) != 0;
|
|
875
961
|
}
|
|
876
|
-
function d(
|
|
877
|
-
if (!
|
|
962
|
+
function d(g) {
|
|
963
|
+
if (!g)
|
|
878
964
|
throw new Error("Assertion error");
|
|
879
965
|
}
|
|
880
|
-
const u = class
|
|
966
|
+
const u = class S {
|
|
881
967
|
/*-- Constructor (low level) and fields --*/
|
|
882
968
|
// Creates a new QR Code segment with the given attributes and data.
|
|
883
969
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
884
970
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
885
|
-
constructor(
|
|
886
|
-
if (this.mode =
|
|
971
|
+
constructor(a, r, s) {
|
|
972
|
+
if (this.mode = a, this.numChars = r, this.bitData = s, r < 0)
|
|
887
973
|
throw new RangeError("Invalid argument");
|
|
888
|
-
this.bitData =
|
|
974
|
+
this.bitData = s.slice();
|
|
889
975
|
}
|
|
890
976
|
/*-- Static factory functions (mid level) --*/
|
|
891
977
|
// Returns a segment representing the given binary data encoded in
|
|
892
978
|
// byte mode. All input byte arrays are acceptable. Any text string
|
|
893
979
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
894
|
-
static makeBytes(
|
|
980
|
+
static makeBytes(a) {
|
|
895
981
|
let r = [];
|
|
896
|
-
for (const
|
|
897
|
-
t(
|
|
898
|
-
return new
|
|
982
|
+
for (const s of a)
|
|
983
|
+
t(s, 8, r);
|
|
984
|
+
return new S(S.Mode.BYTE, a.length, r);
|
|
899
985
|
}
|
|
900
986
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
901
|
-
static makeNumeric(
|
|
902
|
-
if (!
|
|
987
|
+
static makeNumeric(a) {
|
|
988
|
+
if (!S.isNumeric(a))
|
|
903
989
|
throw new RangeError("String contains non-numeric characters");
|
|
904
990
|
let r = [];
|
|
905
|
-
for (let
|
|
906
|
-
const o = Math.min(
|
|
907
|
-
t(parseInt(
|
|
991
|
+
for (let s = 0; s < a.length; ) {
|
|
992
|
+
const o = Math.min(a.length - s, 3);
|
|
993
|
+
t(parseInt(a.substring(s, s + o), 10), o * 3 + 1, r), s += o;
|
|
908
994
|
}
|
|
909
|
-
return new
|
|
995
|
+
return new S(S.Mode.NUMERIC, a.length, r);
|
|
910
996
|
}
|
|
911
997
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
912
998
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
913
999
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
914
|
-
static makeAlphanumeric(
|
|
915
|
-
if (!
|
|
1000
|
+
static makeAlphanumeric(a) {
|
|
1001
|
+
if (!S.isAlphanumeric(a))
|
|
916
1002
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
917
|
-
let r = [],
|
|
918
|
-
for (
|
|
919
|
-
let o =
|
|
920
|
-
o +=
|
|
1003
|
+
let r = [], s;
|
|
1004
|
+
for (s = 0; s + 2 <= a.length; s += 2) {
|
|
1005
|
+
let o = S.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s)) * 45;
|
|
1006
|
+
o += S.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s + 1)), t(o, 11, r);
|
|
921
1007
|
}
|
|
922
|
-
return
|
|
1008
|
+
return s < a.length && t(S.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s)), 6, r), new S(S.Mode.ALPHANUMERIC, a.length, r);
|
|
923
1009
|
}
|
|
924
1010
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
925
1011
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
926
|
-
static makeSegments(
|
|
927
|
-
return
|
|
1012
|
+
static makeSegments(a) {
|
|
1013
|
+
return a == "" ? [] : S.isNumeric(a) ? [S.makeNumeric(a)] : S.isAlphanumeric(a) ? [S.makeAlphanumeric(a)] : [S.makeBytes(S.toUtf8ByteArray(a))];
|
|
928
1014
|
}
|
|
929
1015
|
// Returns a segment representing an Extended Channel Interpretation
|
|
930
1016
|
// (ECI) designator with the given assignment value.
|
|
931
|
-
static makeEci(
|
|
1017
|
+
static makeEci(a) {
|
|
932
1018
|
let r = [];
|
|
933
|
-
if (
|
|
1019
|
+
if (a < 0)
|
|
934
1020
|
throw new RangeError("ECI assignment value out of range");
|
|
935
|
-
if (
|
|
936
|
-
t(
|
|
937
|
-
else if (
|
|
938
|
-
t(2, 2, r), t(
|
|
939
|
-
else if (
|
|
940
|
-
t(6, 3, r), t(
|
|
1021
|
+
if (a < 128)
|
|
1022
|
+
t(a, 8, r);
|
|
1023
|
+
else if (a < 16384)
|
|
1024
|
+
t(2, 2, r), t(a, 14, r);
|
|
1025
|
+
else if (a < 1e6)
|
|
1026
|
+
t(6, 3, r), t(a, 21, r);
|
|
941
1027
|
else
|
|
942
1028
|
throw new RangeError("ECI assignment value out of range");
|
|
943
|
-
return new
|
|
1029
|
+
return new S(S.Mode.ECI, 0, r);
|
|
944
1030
|
}
|
|
945
1031
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
946
1032
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
947
|
-
static isNumeric(
|
|
948
|
-
return
|
|
1033
|
+
static isNumeric(a) {
|
|
1034
|
+
return S.NUMERIC_REGEX.test(a);
|
|
949
1035
|
}
|
|
950
1036
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
951
1037
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
952
1038
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
953
|
-
static isAlphanumeric(
|
|
954
|
-
return
|
|
1039
|
+
static isAlphanumeric(a) {
|
|
1040
|
+
return S.ALPHANUMERIC_REGEX.test(a);
|
|
955
1041
|
}
|
|
956
1042
|
/*-- Methods --*/
|
|
957
1043
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -960,29 +1046,29 @@ var T;
|
|
|
960
1046
|
}
|
|
961
1047
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
962
1048
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
963
|
-
static getTotalBits(
|
|
964
|
-
let
|
|
965
|
-
for (const o of
|
|
1049
|
+
static getTotalBits(a, r) {
|
|
1050
|
+
let s = 0;
|
|
1051
|
+
for (const o of a) {
|
|
966
1052
|
const c = o.mode.numCharCountBits(r);
|
|
967
1053
|
if (o.numChars >= 1 << c)
|
|
968
1054
|
return 1 / 0;
|
|
969
|
-
|
|
1055
|
+
s += 4 + c + o.bitData.length;
|
|
970
1056
|
}
|
|
971
|
-
return
|
|
1057
|
+
return s;
|
|
972
1058
|
}
|
|
973
1059
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
974
|
-
static toUtf8ByteArray(
|
|
975
|
-
|
|
1060
|
+
static toUtf8ByteArray(a) {
|
|
1061
|
+
a = encodeURI(a);
|
|
976
1062
|
let r = [];
|
|
977
|
-
for (let
|
|
978
|
-
|
|
1063
|
+
for (let s = 0; s < a.length; s++)
|
|
1064
|
+
a.charAt(s) != "%" ? r.push(a.charCodeAt(s)) : (r.push(parseInt(a.substring(s + 1, s + 3), 16)), s += 2);
|
|
979
1065
|
return r;
|
|
980
1066
|
}
|
|
981
1067
|
};
|
|
982
1068
|
u.NUMERIC_REGEX = /^[0-9]*$/, u.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, u.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
983
|
-
let
|
|
1069
|
+
let p = u;
|
|
984
1070
|
e.QrSegment = u;
|
|
985
|
-
})(
|
|
1071
|
+
})(U || (U = {}));
|
|
986
1072
|
((e) => {
|
|
987
1073
|
((i) => {
|
|
988
1074
|
const t = class {
|
|
@@ -994,7 +1080,7 @@ var T;
|
|
|
994
1080
|
};
|
|
995
1081
|
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), i.Ecc = t;
|
|
996
1082
|
})(e.QrCode || (e.QrCode = {}));
|
|
997
|
-
})(
|
|
1083
|
+
})(U || (U = {}));
|
|
998
1084
|
((e) => {
|
|
999
1085
|
((i) => {
|
|
1000
1086
|
const t = class {
|
|
@@ -1011,125 +1097,125 @@ var T;
|
|
|
1011
1097
|
};
|
|
1012
1098
|
t.NUMERIC = new t(1, [10, 12, 14]), t.ALPHANUMERIC = new t(2, [9, 11, 13]), t.BYTE = new t(4, [8, 16, 16]), t.KANJI = new t(8, [8, 10, 12]), t.ECI = new t(7, [0, 0, 0]), i.Mode = t;
|
|
1013
1099
|
})(e.QrSegment || (e.QrSegment = {}));
|
|
1014
|
-
})(
|
|
1015
|
-
var
|
|
1100
|
+
})(U || (U = {}));
|
|
1101
|
+
var V = U;
|
|
1016
1102
|
/**
|
|
1017
1103
|
* @license qrcode.react
|
|
1018
1104
|
* Copyright (c) Paul O'Shannessy
|
|
1019
1105
|
* SPDX-License-Identifier: ISC
|
|
1020
1106
|
*/
|
|
1021
|
-
var
|
|
1022
|
-
L:
|
|
1023
|
-
M:
|
|
1024
|
-
Q:
|
|
1025
|
-
H:
|
|
1026
|
-
},
|
|
1027
|
-
function
|
|
1107
|
+
var Er = {
|
|
1108
|
+
L: V.QrCode.Ecc.LOW,
|
|
1109
|
+
M: V.QrCode.Ecc.MEDIUM,
|
|
1110
|
+
Q: V.QrCode.Ecc.QUARTILE,
|
|
1111
|
+
H: V.QrCode.Ecc.HIGH
|
|
1112
|
+
}, Ve = 128, He = "L", Ke = "#FFFFFF", Ge = "#000000", Ye = !1, We = 1, Pr = 4, Ar = 0, Mr = 0.1;
|
|
1113
|
+
function Xe(e, i = 0) {
|
|
1028
1114
|
const t = [];
|
|
1029
1115
|
return e.forEach(function(l, d) {
|
|
1030
1116
|
let u = null;
|
|
1031
|
-
l.forEach(function(
|
|
1032
|
-
if (!
|
|
1117
|
+
l.forEach(function(p, g) {
|
|
1118
|
+
if (!p && u !== null) {
|
|
1033
1119
|
t.push(
|
|
1034
|
-
`M${u + i} ${d + i}h${
|
|
1120
|
+
`M${u + i} ${d + i}h${g - u}v1H${u + i}z`
|
|
1035
1121
|
), u = null;
|
|
1036
1122
|
return;
|
|
1037
1123
|
}
|
|
1038
|
-
if (
|
|
1039
|
-
if (!
|
|
1124
|
+
if (g === l.length - 1) {
|
|
1125
|
+
if (!p)
|
|
1040
1126
|
return;
|
|
1041
|
-
u === null ? t.push(`M${
|
|
1042
|
-
`M${u + i},${d + i} h${
|
|
1127
|
+
u === null ? t.push(`M${g + i},${d + i} h1v1H${g + i}z`) : t.push(
|
|
1128
|
+
`M${u + i},${d + i} h${g + 1 - u}v1H${u + i}z`
|
|
1043
1129
|
);
|
|
1044
1130
|
return;
|
|
1045
1131
|
}
|
|
1046
|
-
|
|
1132
|
+
p && u === null && (u = g);
|
|
1047
1133
|
});
|
|
1048
1134
|
}), t.join("");
|
|
1049
1135
|
}
|
|
1050
|
-
function
|
|
1136
|
+
function Ze(e, i) {
|
|
1051
1137
|
return e.slice().map((t, l) => l < i.y || l >= i.y + i.h ? t : t.map((d, u) => u < i.x || u >= i.x + i.w ? d : !1));
|
|
1052
1138
|
}
|
|
1053
|
-
function
|
|
1139
|
+
function Rr(e, i, t, l) {
|
|
1054
1140
|
if (l == null)
|
|
1055
1141
|
return null;
|
|
1056
|
-
const d = e.length + t * 2, u = Math.floor(i *
|
|
1142
|
+
const d = e.length + t * 2, u = Math.floor(i * Mr), p = d / i, g = (l.width || u) * p, a = (l.height || u) * p, r = l.x == null ? e.length / 2 - g / 2 : l.x * p, s = l.y == null ? e.length / 2 - a / 2 : l.y * p, o = l.opacity == null ? 1 : l.opacity;
|
|
1057
1143
|
let c = null;
|
|
1058
1144
|
if (l.excavate) {
|
|
1059
|
-
let
|
|
1060
|
-
c = { x:
|
|
1145
|
+
let f = Math.floor(r), h = Math.floor(s), x = Math.ceil(g + r - f), N = Math.ceil(a + s - h);
|
|
1146
|
+
c = { x: f, y: h, w: x, h: N };
|
|
1061
1147
|
}
|
|
1062
|
-
const
|
|
1063
|
-
return { x: r, y:
|
|
1148
|
+
const m = l.crossOrigin;
|
|
1149
|
+
return { x: r, y: s, h: a, w: g, excavation: c, opacity: o, crossOrigin: m };
|
|
1064
1150
|
}
|
|
1065
|
-
function
|
|
1066
|
-
return i != null ? Math.max(Math.floor(i), 0) : e ?
|
|
1151
|
+
function Fr(e, i) {
|
|
1152
|
+
return i != null ? Math.max(Math.floor(i), 0) : e ? Pr : Ar;
|
|
1067
1153
|
}
|
|
1068
|
-
function
|
|
1154
|
+
function Je({
|
|
1069
1155
|
value: e,
|
|
1070
1156
|
level: i,
|
|
1071
1157
|
minVersion: t,
|
|
1072
1158
|
includeMargin: l,
|
|
1073
1159
|
marginSize: d,
|
|
1074
1160
|
imageSettings: u,
|
|
1075
|
-
size:
|
|
1076
|
-
boostLevel:
|
|
1161
|
+
size: p,
|
|
1162
|
+
boostLevel: g
|
|
1077
1163
|
}) {
|
|
1078
|
-
let
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
1081
|
-
|
|
1082
|
-
|
|
1164
|
+
let a = A.useMemo(() => {
|
|
1165
|
+
const f = (Array.isArray(e) ? e : [e]).reduce((h, x) => (h.push(...V.QrSegment.makeSegments(x)), h), []);
|
|
1166
|
+
return V.QrCode.encodeSegments(
|
|
1167
|
+
f,
|
|
1168
|
+
Er[i],
|
|
1083
1169
|
t,
|
|
1084
1170
|
void 0,
|
|
1085
1171
|
void 0,
|
|
1086
|
-
|
|
1172
|
+
g
|
|
1087
1173
|
);
|
|
1088
|
-
}, [e, i, t,
|
|
1089
|
-
const { cells: r, margin:
|
|
1090
|
-
let
|
|
1091
|
-
const
|
|
1092
|
-
f,
|
|
1093
|
-
h,
|
|
1174
|
+
}, [e, i, t, g]);
|
|
1175
|
+
const { cells: r, margin: s, numCells: o, calculatedImageSettings: c } = A.useMemo(() => {
|
|
1176
|
+
let m = a.getModules();
|
|
1177
|
+
const f = Fr(l, d), h = m.length + f * 2, x = Rr(
|
|
1094
1178
|
m,
|
|
1179
|
+
p,
|
|
1180
|
+
f,
|
|
1095
1181
|
u
|
|
1096
1182
|
);
|
|
1097
1183
|
return {
|
|
1098
|
-
cells:
|
|
1099
|
-
margin:
|
|
1100
|
-
numCells:
|
|
1184
|
+
cells: m,
|
|
1185
|
+
margin: f,
|
|
1186
|
+
numCells: h,
|
|
1101
1187
|
calculatedImageSettings: x
|
|
1102
1188
|
};
|
|
1103
|
-
}, [
|
|
1189
|
+
}, [a, p, u, l, d]);
|
|
1104
1190
|
return {
|
|
1105
|
-
qrcode:
|
|
1106
|
-
margin:
|
|
1191
|
+
qrcode: a,
|
|
1192
|
+
margin: s,
|
|
1107
1193
|
cells: r,
|
|
1108
1194
|
numCells: o,
|
|
1109
1195
|
calculatedImageSettings: c
|
|
1110
1196
|
};
|
|
1111
1197
|
}
|
|
1112
|
-
var
|
|
1198
|
+
var Ir = (function() {
|
|
1113
1199
|
try {
|
|
1114
1200
|
new Path2D().addPath(new Path2D());
|
|
1115
1201
|
} catch {
|
|
1116
1202
|
return !1;
|
|
1117
1203
|
}
|
|
1118
1204
|
return !0;
|
|
1119
|
-
})(),
|
|
1205
|
+
})(), Lr = A.forwardRef(
|
|
1120
1206
|
function(i, t) {
|
|
1121
1207
|
const l = i, {
|
|
1122
1208
|
value: d,
|
|
1123
|
-
size: u =
|
|
1124
|
-
level:
|
|
1125
|
-
bgColor:
|
|
1126
|
-
fgColor:
|
|
1127
|
-
includeMargin: r =
|
|
1128
|
-
minVersion:
|
|
1209
|
+
size: u = Ve,
|
|
1210
|
+
level: p = He,
|
|
1211
|
+
bgColor: g = Ke,
|
|
1212
|
+
fgColor: a = Ge,
|
|
1213
|
+
includeMargin: r = Ye,
|
|
1214
|
+
minVersion: s = We,
|
|
1129
1215
|
boostLevel: o,
|
|
1130
1216
|
marginSize: c,
|
|
1131
|
-
imageSettings:
|
|
1132
|
-
} = l,
|
|
1217
|
+
imageSettings: m
|
|
1218
|
+
} = l, h = ie(l, [
|
|
1133
1219
|
"value",
|
|
1134
1220
|
"size",
|
|
1135
1221
|
"level",
|
|
@@ -1140,92 +1226,92 @@ var Lr = (function() {
|
|
|
1140
1226
|
"boostLevel",
|
|
1141
1227
|
"marginSize",
|
|
1142
1228
|
"imageSettings"
|
|
1143
|
-
]), { style: x } =
|
|
1144
|
-
(
|
|
1145
|
-
_.current =
|
|
1229
|
+
]), { style: x } = h, N = ie(h, ["style"]), C = m?.src, _ = A.useRef(null), w = A.useRef(null), M = A.useCallback(
|
|
1230
|
+
(O) => {
|
|
1231
|
+
_.current = O, typeof t == "function" ? t(O) : t && (t.current = O);
|
|
1146
1232
|
},
|
|
1147
1233
|
[t]
|
|
1148
|
-
), [
|
|
1234
|
+
), [k, z] = A.useState(!1), { margin: F, cells: y, numCells: D, calculatedImageSettings: P } = Je({
|
|
1149
1235
|
value: d,
|
|
1150
|
-
level:
|
|
1151
|
-
minVersion:
|
|
1236
|
+
level: p,
|
|
1237
|
+
minVersion: s,
|
|
1152
1238
|
boostLevel: o,
|
|
1153
1239
|
includeMargin: r,
|
|
1154
1240
|
marginSize: c,
|
|
1155
|
-
imageSettings:
|
|
1241
|
+
imageSettings: m,
|
|
1156
1242
|
size: u
|
|
1157
1243
|
});
|
|
1158
|
-
|
|
1244
|
+
A.useEffect(() => {
|
|
1159
1245
|
if (_.current != null) {
|
|
1160
|
-
const
|
|
1161
|
-
if (!
|
|
1246
|
+
const O = _.current, j = O.getContext("2d");
|
|
1247
|
+
if (!j)
|
|
1162
1248
|
return;
|
|
1163
|
-
let
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1249
|
+
let Q = y;
|
|
1250
|
+
const I = w.current, G = P != null && I !== null && I.complete && I.naturalHeight !== 0 && I.naturalWidth !== 0;
|
|
1251
|
+
G && P.excavation != null && (Q = Ze(
|
|
1166
1252
|
y,
|
|
1167
|
-
|
|
1253
|
+
P.excavation
|
|
1168
1254
|
));
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
const ye = u /
|
|
1172
|
-
|
|
1255
|
+
const ve = window.devicePixelRatio || 1;
|
|
1256
|
+
O.height = O.width = u * ve;
|
|
1257
|
+
const ye = u / D * ve;
|
|
1258
|
+
j.scale(ye, ye), j.fillStyle = g, j.fillRect(0, 0, D, D), j.fillStyle = a, Ir ? j.fill(new Path2D(Xe(Q, F))) : y.forEach(function(ct, dt) {
|
|
1173
1259
|
ct.forEach(function(ut, ft) {
|
|
1174
|
-
ut &&
|
|
1260
|
+
ut && j.fillRect(ft + F, dt + F, 1, 1);
|
|
1175
1261
|
});
|
|
1176
|
-
}),
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1262
|
+
}), P && (j.globalAlpha = P.opacity), G && j.drawImage(
|
|
1263
|
+
I,
|
|
1264
|
+
P.x + F,
|
|
1265
|
+
P.y + F,
|
|
1266
|
+
P.w,
|
|
1267
|
+
P.h
|
|
1182
1268
|
);
|
|
1183
1269
|
}
|
|
1184
|
-
}),
|
|
1185
|
-
|
|
1186
|
-
}, [
|
|
1187
|
-
const
|
|
1188
|
-
let
|
|
1189
|
-
return
|
|
1270
|
+
}), A.useEffect(() => {
|
|
1271
|
+
z(!1);
|
|
1272
|
+
}, [C]);
|
|
1273
|
+
const X = ae({ height: u, width: u }, x);
|
|
1274
|
+
let q = null;
|
|
1275
|
+
return C != null && (q = /* @__PURE__ */ A.createElement(
|
|
1190
1276
|
"img",
|
|
1191
1277
|
{
|
|
1192
|
-
src:
|
|
1193
|
-
key:
|
|
1278
|
+
src: C,
|
|
1279
|
+
key: C,
|
|
1194
1280
|
style: { display: "none" },
|
|
1195
1281
|
onLoad: () => {
|
|
1196
|
-
|
|
1282
|
+
z(!0);
|
|
1197
1283
|
},
|
|
1198
1284
|
ref: w,
|
|
1199
|
-
crossOrigin:
|
|
1285
|
+
crossOrigin: P?.crossOrigin
|
|
1200
1286
|
}
|
|
1201
|
-
)), /* @__PURE__ */
|
|
1287
|
+
)), /* @__PURE__ */ A.createElement(A.Fragment, null, /* @__PURE__ */ A.createElement(
|
|
1202
1288
|
"canvas",
|
|
1203
|
-
|
|
1204
|
-
style:
|
|
1289
|
+
ae({
|
|
1290
|
+
style: X,
|
|
1205
1291
|
height: u,
|
|
1206
1292
|
width: u,
|
|
1207
|
-
ref:
|
|
1293
|
+
ref: M,
|
|
1208
1294
|
role: "img"
|
|
1209
1295
|
}, N)
|
|
1210
|
-
),
|
|
1296
|
+
), q);
|
|
1211
1297
|
}
|
|
1212
1298
|
);
|
|
1213
|
-
|
|
1214
|
-
var
|
|
1299
|
+
Lr.displayName = "QRCodeCanvas";
|
|
1300
|
+
var et = A.forwardRef(
|
|
1215
1301
|
function(i, t) {
|
|
1216
1302
|
const l = i, {
|
|
1217
1303
|
value: d,
|
|
1218
|
-
size: u =
|
|
1219
|
-
level:
|
|
1220
|
-
bgColor:
|
|
1221
|
-
fgColor:
|
|
1222
|
-
includeMargin: r =
|
|
1223
|
-
minVersion:
|
|
1304
|
+
size: u = Ve,
|
|
1305
|
+
level: p = He,
|
|
1306
|
+
bgColor: g = Ke,
|
|
1307
|
+
fgColor: a = Ge,
|
|
1308
|
+
includeMargin: r = Ye,
|
|
1309
|
+
minVersion: s = We,
|
|
1224
1310
|
boostLevel: o,
|
|
1225
1311
|
title: c,
|
|
1226
|
-
marginSize:
|
|
1227
|
-
imageSettings:
|
|
1228
|
-
} = l,
|
|
1312
|
+
marginSize: m,
|
|
1313
|
+
imageSettings: f
|
|
1314
|
+
} = l, h = ie(l, [
|
|
1229
1315
|
"value",
|
|
1230
1316
|
"size",
|
|
1231
1317
|
"level",
|
|
@@ -1237,24 +1323,24 @@ var Je = S.forwardRef(
|
|
|
1237
1323
|
"title",
|
|
1238
1324
|
"marginSize",
|
|
1239
1325
|
"imageSettings"
|
|
1240
|
-
]), { margin: x, cells: N, numCells:
|
|
1326
|
+
]), { margin: x, cells: N, numCells: C, calculatedImageSettings: _ } = Je({
|
|
1241
1327
|
value: d,
|
|
1242
|
-
level:
|
|
1243
|
-
minVersion:
|
|
1328
|
+
level: p,
|
|
1329
|
+
minVersion: s,
|
|
1244
1330
|
boostLevel: o,
|
|
1245
1331
|
includeMargin: r,
|
|
1246
|
-
marginSize:
|
|
1247
|
-
imageSettings:
|
|
1332
|
+
marginSize: m,
|
|
1333
|
+
imageSettings: f,
|
|
1248
1334
|
size: u
|
|
1249
1335
|
});
|
|
1250
|
-
let w = N,
|
|
1251
|
-
|
|
1336
|
+
let w = N, M = null;
|
|
1337
|
+
f != null && _ != null && (_.excavation != null && (w = Ze(
|
|
1252
1338
|
N,
|
|
1253
1339
|
_.excavation
|
|
1254
|
-
)),
|
|
1340
|
+
)), M = /* @__PURE__ */ A.createElement(
|
|
1255
1341
|
"image",
|
|
1256
1342
|
{
|
|
1257
|
-
href:
|
|
1343
|
+
href: f.src,
|
|
1258
1344
|
height: _.h,
|
|
1259
1345
|
width: _.w,
|
|
1260
1346
|
x: _.x + x,
|
|
@@ -1264,35 +1350,35 @@ var Je = S.forwardRef(
|
|
|
1264
1350
|
crossOrigin: _.crossOrigin
|
|
1265
1351
|
}
|
|
1266
1352
|
));
|
|
1267
|
-
const
|
|
1268
|
-
return /* @__PURE__ */
|
|
1353
|
+
const k = Xe(w, x);
|
|
1354
|
+
return /* @__PURE__ */ A.createElement(
|
|
1269
1355
|
"svg",
|
|
1270
|
-
|
|
1356
|
+
ae({
|
|
1271
1357
|
height: u,
|
|
1272
1358
|
width: u,
|
|
1273
|
-
viewBox: `0 0 ${
|
|
1359
|
+
viewBox: `0 0 ${C} ${C}`,
|
|
1274
1360
|
ref: t,
|
|
1275
1361
|
role: "img"
|
|
1276
|
-
},
|
|
1277
|
-
!!c && /* @__PURE__ */
|
|
1278
|
-
/* @__PURE__ */
|
|
1362
|
+
}, h),
|
|
1363
|
+
!!c && /* @__PURE__ */ A.createElement("title", null, c),
|
|
1364
|
+
/* @__PURE__ */ A.createElement(
|
|
1279
1365
|
"path",
|
|
1280
1366
|
{
|
|
1281
|
-
fill:
|
|
1282
|
-
d: `M0,0 h${
|
|
1367
|
+
fill: g,
|
|
1368
|
+
d: `M0,0 h${C}v${C}H0z`,
|
|
1283
1369
|
shapeRendering: "crispEdges"
|
|
1284
1370
|
}
|
|
1285
1371
|
),
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
|
|
1372
|
+
/* @__PURE__ */ A.createElement("path", { fill: a, d: k, shapeRendering: "crispEdges" }),
|
|
1373
|
+
M
|
|
1288
1374
|
);
|
|
1289
1375
|
}
|
|
1290
1376
|
);
|
|
1291
|
-
|
|
1292
|
-
function
|
|
1293
|
-
|
|
1377
|
+
et.displayName = "QRCodeSVG";
|
|
1378
|
+
function kr(e, i) {
|
|
1379
|
+
ue({ title: e, type: i });
|
|
1294
1380
|
}
|
|
1295
|
-
function
|
|
1381
|
+
function Dr({
|
|
1296
1382
|
onToast: e,
|
|
1297
1383
|
/* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */
|
|
1298
1384
|
background: i,
|
|
@@ -1301,41 +1387,41 @@ function kr({
|
|
|
1301
1387
|
padding: d,
|
|
1302
1388
|
borderRadius: u,
|
|
1303
1389
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1304
|
-
...
|
|
1390
|
+
...p
|
|
1305
1391
|
}) {
|
|
1306
|
-
const { currentSlug:
|
|
1307
|
-
return /* @__PURE__ */
|
|
1308
|
-
|
|
1392
|
+
const { currentSlug: g } = de(), a = e ?? kr, r = g.split("/")[1], s = r !== void 0, { data: o } = Ae(), c = o?.id, m = o === void 0;
|
|
1393
|
+
return /* @__PURE__ */ n.jsx("div", { ...p, children: /* @__PURE__ */ n.jsx(It, { children: /* @__PURE__ */ n.jsx(Lt, { children: /* @__PURE__ */ n.jsx(kt, { children: s ? /* @__PURE__ */ n.jsx(
|
|
1394
|
+
Dt,
|
|
1309
1395
|
{
|
|
1310
1396
|
token: r,
|
|
1311
|
-
onToast:
|
|
1397
|
+
onToast: a
|
|
1312
1398
|
}
|
|
1313
|
-
) : /* @__PURE__ */
|
|
1314
|
-
|
|
1399
|
+
) : /* @__PURE__ */ n.jsx(
|
|
1400
|
+
Ot,
|
|
1315
1401
|
{
|
|
1316
1402
|
customerId: c,
|
|
1317
|
-
isLoadingCustomer:
|
|
1318
|
-
onToast:
|
|
1403
|
+
isLoadingCustomer: m,
|
|
1404
|
+
onToast: a
|
|
1319
1405
|
}
|
|
1320
1406
|
) }) }) }) });
|
|
1321
1407
|
}
|
|
1322
|
-
const
|
|
1323
|
-
function
|
|
1324
|
-
return e.startsWith(
|
|
1408
|
+
const oe = "profile/", Or = /* @__PURE__ */ new Set(["orders", "subscriptions"]);
|
|
1409
|
+
function Pe(e) {
|
|
1410
|
+
return e.startsWith(oe) ? e.slice(oe.length) : e;
|
|
1325
1411
|
}
|
|
1326
|
-
function
|
|
1412
|
+
function zr({
|
|
1327
1413
|
children: e
|
|
1328
1414
|
}) {
|
|
1329
|
-
const { currentSlug: i, previousSlug: t, navigate: l } =
|
|
1415
|
+
const { currentSlug: i, previousSlug: t, navigate: l } = de();
|
|
1330
1416
|
function d(u) {
|
|
1331
|
-
const
|
|
1332
|
-
l(
|
|
1417
|
+
const p = u.split("/")[0] ?? "";
|
|
1418
|
+
l(Or.has(p) ? `${oe}${u}` : u);
|
|
1333
1419
|
}
|
|
1334
|
-
return /* @__PURE__ */
|
|
1335
|
-
|
|
1420
|
+
return /* @__PURE__ */ n.jsx(
|
|
1421
|
+
xt,
|
|
1336
1422
|
{
|
|
1337
|
-
currentSlug:
|
|
1338
|
-
previousSlug: t === null ? null :
|
|
1423
|
+
currentSlug: Pe(i),
|
|
1424
|
+
previousSlug: t === null ? null : Pe(t),
|
|
1339
1425
|
navItems: [],
|
|
1340
1426
|
basePath: "/profile",
|
|
1341
1427
|
navigate: d,
|
|
@@ -1343,10 +1429,10 @@ function Or({
|
|
|
1343
1429
|
}
|
|
1344
1430
|
);
|
|
1345
1431
|
}
|
|
1346
|
-
function
|
|
1347
|
-
const e =
|
|
1348
|
-
return
|
|
1349
|
-
queryKey:
|
|
1432
|
+
function tt() {
|
|
1433
|
+
const e = St();
|
|
1434
|
+
return $({
|
|
1435
|
+
queryKey: bt.languages(),
|
|
1350
1436
|
queryFn: async () => {
|
|
1351
1437
|
const i = [];
|
|
1352
1438
|
let t;
|
|
@@ -1364,26 +1450,26 @@ function et() {
|
|
|
1364
1450
|
}
|
|
1365
1451
|
});
|
|
1366
1452
|
}
|
|
1367
|
-
function
|
|
1368
|
-
const e =
|
|
1369
|
-
return
|
|
1453
|
+
function rt() {
|
|
1454
|
+
const e = _t(), i = H(), { setLocale: t } = T();
|
|
1455
|
+
return K({
|
|
1370
1456
|
mutationFn: (l) => e.updateAccount({ account: l }),
|
|
1371
1457
|
onSuccess: (l, d) => {
|
|
1372
|
-
i.setQueryData(
|
|
1458
|
+
i.setQueryData(vt.detail(), l.account), d.language_iso && l.account.language_iso && t(l.account.language_iso);
|
|
1373
1459
|
}
|
|
1374
1460
|
});
|
|
1375
1461
|
}
|
|
1376
|
-
function
|
|
1462
|
+
function Tr({
|
|
1377
1463
|
account: e,
|
|
1378
1464
|
onClose: i
|
|
1379
1465
|
}) {
|
|
1380
|
-
const { t } =
|
|
1381
|
-
|
|
1382
|
-
first_name:
|
|
1383
|
-
last_name:
|
|
1384
|
-
phone_number:
|
|
1385
|
-
bio:
|
|
1386
|
-
language:
|
|
1466
|
+
const { t } = R(), { isMobile: l } = W(), d = me(), u = tt(), p = rt(), g = d.data?.allow_name_edit === !1, a = Yt(
|
|
1467
|
+
se({
|
|
1468
|
+
first_name: g ? L() : L().min(1, t("first_name_is_required")),
|
|
1469
|
+
last_name: g ? L() : L().min(1, t("last_name_is_required")),
|
|
1470
|
+
phone_number: L().optional(),
|
|
1471
|
+
bio: L().optional(),
|
|
1472
|
+
language: L()
|
|
1387
1473
|
}),
|
|
1388
1474
|
{
|
|
1389
1475
|
defaultValues: {
|
|
@@ -1394,62 +1480,62 @@ function zr({
|
|
|
1394
1480
|
language: e.language_iso ?? ""
|
|
1395
1481
|
}
|
|
1396
1482
|
}
|
|
1397
|
-
), r =
|
|
1398
|
-
if (!
|
|
1483
|
+
), r = a.handleSubmit(async (s) => {
|
|
1484
|
+
if (!p.isPending)
|
|
1399
1485
|
try {
|
|
1400
1486
|
const o = await d.refetch({ throwOnError: !0 });
|
|
1401
|
-
await
|
|
1402
|
-
...o.data?.allow_name_edit !== !1 ? { first_name:
|
|
1403
|
-
phone:
|
|
1404
|
-
bio:
|
|
1405
|
-
...
|
|
1406
|
-
}),
|
|
1487
|
+
await p.mutateAsync({
|
|
1488
|
+
...o.data?.allow_name_edit !== !1 ? { first_name: s.first_name, last_name: s.last_name } : {},
|
|
1489
|
+
phone: s.phone_number ?? "",
|
|
1490
|
+
bio: s.bio ?? "",
|
|
1491
|
+
...s.language ? { language_iso: s.language } : {}
|
|
1492
|
+
}), ue({ title: t("profile_updated"), type: "success" }), i();
|
|
1407
1493
|
} catch {
|
|
1408
|
-
|
|
1494
|
+
a.setError("root", { message: t("failed_to_update_profile") });
|
|
1409
1495
|
}
|
|
1410
1496
|
});
|
|
1411
|
-
return /* @__PURE__ */
|
|
1412
|
-
|
|
1497
|
+
return /* @__PURE__ */ n.jsx(
|
|
1498
|
+
wr,
|
|
1413
1499
|
{
|
|
1414
|
-
control:
|
|
1500
|
+
control: a.control,
|
|
1415
1501
|
isOpen: !0,
|
|
1416
1502
|
onSubmit: () => {
|
|
1417
1503
|
r();
|
|
1418
1504
|
},
|
|
1419
1505
|
handleClose: () => {
|
|
1420
|
-
!
|
|
1506
|
+
!p.isPending && !a.formState.isSubmitting && i();
|
|
1421
1507
|
},
|
|
1422
1508
|
email: e.email,
|
|
1423
|
-
languageOptions: u.data?.map((
|
|
1424
|
-
name:
|
|
1425
|
-
value:
|
|
1509
|
+
languageOptions: u.data?.map((s) => ({
|
|
1510
|
+
name: s.name,
|
|
1511
|
+
value: s.code
|
|
1426
1512
|
})),
|
|
1427
|
-
errorMsg:
|
|
1428
|
-
isSubmitting:
|
|
1429
|
-
disableNameEdit:
|
|
1513
|
+
errorMsg: a.formState.errors.root?.message ?? (u.error ? t("profile_languages_unavailable") : void 0),
|
|
1514
|
+
isSubmitting: p.isPending || a.formState.isSubmitting,
|
|
1515
|
+
disableNameEdit: g,
|
|
1430
1516
|
presentation: l ? "bottom-sheet" : "dialog"
|
|
1431
1517
|
}
|
|
1432
1518
|
);
|
|
1433
1519
|
}
|
|
1434
|
-
const
|
|
1435
|
-
function
|
|
1436
|
-
const e =
|
|
1437
|
-
return
|
|
1438
|
-
queryKey:
|
|
1520
|
+
const pe = ["memberStorefront", "profile", "addresses"];
|
|
1521
|
+
function ge() {
|
|
1522
|
+
const e = B();
|
|
1523
|
+
return $({
|
|
1524
|
+
queryKey: pe,
|
|
1439
1525
|
queryFn: () => e.fetchAddresses()
|
|
1440
1526
|
});
|
|
1441
1527
|
}
|
|
1442
|
-
function
|
|
1443
|
-
const i =
|
|
1444
|
-
return
|
|
1528
|
+
function nt(e) {
|
|
1529
|
+
const i = Zt(), { locale: t } = T();
|
|
1530
|
+
return $({
|
|
1445
1531
|
queryKey: ["memberStorefront", "profile", "countries", t],
|
|
1446
1532
|
queryFn: () => i.listCountries({ languageIso: t }),
|
|
1447
1533
|
enabled: e
|
|
1448
1534
|
});
|
|
1449
1535
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const e =
|
|
1452
|
-
return
|
|
1536
|
+
function Br() {
|
|
1537
|
+
const e = B(), i = H();
|
|
1538
|
+
return K({
|
|
1453
1539
|
mutationFn: async ({
|
|
1454
1540
|
addressId: t,
|
|
1455
1541
|
body: l
|
|
@@ -1457,17 +1543,17 @@ function Tr() {
|
|
|
1457
1543
|
if (t === void 0) return e.createAddress(l);
|
|
1458
1544
|
await e.updateAddress(t, l);
|
|
1459
1545
|
},
|
|
1460
|
-
onSuccess: () => i.invalidateQueries({ queryKey:
|
|
1546
|
+
onSuccess: () => i.invalidateQueries({ queryKey: pe })
|
|
1461
1547
|
});
|
|
1462
1548
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const e =
|
|
1465
|
-
return
|
|
1549
|
+
function Ur() {
|
|
1550
|
+
const e = B(), i = H();
|
|
1551
|
+
return K({
|
|
1466
1552
|
mutationFn: (t) => e.deleteAddress(t),
|
|
1467
|
-
onSuccess: () => i.invalidateQueries({ queryKey:
|
|
1553
|
+
onSuccess: () => i.invalidateQueries({ queryKey: pe })
|
|
1468
1554
|
});
|
|
1469
1555
|
}
|
|
1470
|
-
function
|
|
1556
|
+
function xe(e) {
|
|
1471
1557
|
return {
|
|
1472
1558
|
id: e.id,
|
|
1473
1559
|
address1: e.street1,
|
|
@@ -1482,24 +1568,24 @@ function me(e) {
|
|
|
1482
1568
|
subdivision_code: null
|
|
1483
1569
|
};
|
|
1484
1570
|
}
|
|
1485
|
-
function
|
|
1571
|
+
function st({
|
|
1486
1572
|
isOpen: e,
|
|
1487
1573
|
onClose: i,
|
|
1488
1574
|
selectedAddress: t,
|
|
1489
1575
|
onAddressCreated: l
|
|
1490
1576
|
}) {
|
|
1491
|
-
const { t: d } =
|
|
1577
|
+
const { t: d } = R(), { isMobile: u } = W(), { locale: p } = T(), g = nt(e), a = ge(), r = Br(), s = v.useCallback(
|
|
1492
1578
|
(o) => Promise.resolve(
|
|
1493
|
-
|
|
1579
|
+
g.data?.countries.find((c) => c.code === o)?.states.map((c) => ({
|
|
1494
1580
|
name: c.name,
|
|
1495
1581
|
isoCode: c.code
|
|
1496
1582
|
})) ?? []
|
|
1497
1583
|
),
|
|
1498
|
-
[
|
|
1584
|
+
[g.data]
|
|
1499
1585
|
);
|
|
1500
|
-
if (e &&
|
|
1501
|
-
return e &&
|
|
1502
|
-
|
|
1586
|
+
if (e && g.error) throw g.error;
|
|
1587
|
+
return e && g.isPending ? /* @__PURE__ */ n.jsx("p", { role: "status", children: d("profile_loading") }) : /* @__PURE__ */ n.jsx(
|
|
1588
|
+
zt,
|
|
1503
1589
|
{
|
|
1504
1590
|
isOpen: e,
|
|
1505
1591
|
onClose: () => {
|
|
@@ -1507,18 +1593,18 @@ function nt({
|
|
|
1507
1593
|
},
|
|
1508
1594
|
selectedAddress: t,
|
|
1509
1595
|
presentation: u ? "bottom-sheet" : "dialog",
|
|
1510
|
-
defaultCountry: t?.country_code ??
|
|
1511
|
-
languageIso:
|
|
1512
|
-
countries:
|
|
1596
|
+
defaultCountry: t?.country_code ?? a.data?.addresses.find((o) => o.default)?.country ?? "US",
|
|
1597
|
+
languageIso: p,
|
|
1598
|
+
countries: g.data?.countries.map((o) => ({
|
|
1513
1599
|
iso: o.code,
|
|
1514
1600
|
name: o.name
|
|
1515
1601
|
})),
|
|
1516
|
-
fetchStates:
|
|
1602
|
+
fetchStates: s,
|
|
1517
1603
|
t: (o) => d(o),
|
|
1518
1604
|
isSubmitting: r.isPending,
|
|
1519
1605
|
error: r.error ? d(
|
|
1520
1606
|
t ? "failed_to_update_address" : "failed_to_create_address"
|
|
1521
|
-
) :
|
|
1607
|
+
) : g.error ? d("unexpected_error") : void 0,
|
|
1522
1608
|
onSubmit: (o) => {
|
|
1523
1609
|
if (r.isPending) return;
|
|
1524
1610
|
const c = o.address;
|
|
@@ -1540,8 +1626,8 @@ function nt({
|
|
|
1540
1626
|
}
|
|
1541
1627
|
},
|
|
1542
1628
|
{
|
|
1543
|
-
onSuccess: (
|
|
1544
|
-
|
|
1629
|
+
onSuccess: (m) => {
|
|
1630
|
+
m && l?.(xe(m)), r.reset(), i();
|
|
1545
1631
|
}
|
|
1546
1632
|
}
|
|
1547
1633
|
);
|
|
@@ -1549,13 +1635,13 @@ function nt({
|
|
|
1549
1635
|
}
|
|
1550
1636
|
);
|
|
1551
1637
|
}
|
|
1552
|
-
function
|
|
1553
|
-
const { t: e } =
|
|
1638
|
+
function $r() {
|
|
1639
|
+
const { t: e } = R(), i = ge(), t = Ur(), l = v.useRef(null), [d, u] = v.useState(), [p, g] = v.useState(null);
|
|
1554
1640
|
if (i.error) throw i.error;
|
|
1555
|
-
function
|
|
1641
|
+
function a() {
|
|
1556
1642
|
requestAnimationFrame(() => l.current?.focus());
|
|
1557
1643
|
}
|
|
1558
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ n.jsxs(
|
|
1559
1645
|
"div",
|
|
1560
1646
|
{
|
|
1561
1647
|
ref: l,
|
|
@@ -1564,27 +1650,27 @@ function Ur() {
|
|
|
1564
1650
|
"aria-label": e("shipping_addresses"),
|
|
1565
1651
|
className: "space-y-4 outline-none",
|
|
1566
1652
|
children: [
|
|
1567
|
-
i.isPending && /* @__PURE__ */
|
|
1568
|
-
!i.isPending && !i.data?.addresses.length && /* @__PURE__ */
|
|
1569
|
-
i.data?.addresses.map((r) => /* @__PURE__ */
|
|
1653
|
+
i.isPending && /* @__PURE__ */ n.jsx("p", { role: "status", className: "text-muted-foreground text-sm", children: e("profile_loading") }),
|
|
1654
|
+
!i.isPending && !i.data?.addresses.length && /* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-sm", children: e("no_saved_addresses_found") }),
|
|
1655
|
+
i.data?.addresses.map((r) => /* @__PURE__ */ n.jsxs(
|
|
1570
1656
|
"section",
|
|
1571
1657
|
{
|
|
1572
1658
|
"aria-label": r.street1,
|
|
1573
1659
|
className: "bg-card text-card-foreground border-border space-y-4 rounded-xl border p-5",
|
|
1574
1660
|
children: [
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
r.default && /* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ n.jsxs("div", { className: "space-y-1 text-sm", children: [
|
|
1662
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1663
|
+
/* @__PURE__ */ n.jsx("p", { className: "font-medium", children: r.name }),
|
|
1664
|
+
r.default && /* @__PURE__ */ n.jsx(Re, { variant: "secondary", children: e("default") })
|
|
1579
1665
|
] }),
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
r.street2 && /* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ n.jsx("p", { children: r.street1 }),
|
|
1667
|
+
r.street2 && /* @__PURE__ */ n.jsx("p", { children: r.street2 }),
|
|
1668
|
+
/* @__PURE__ */ n.jsx("p", { children: [r.city, r.state, r.zip].filter(Boolean).join(", ") }),
|
|
1669
|
+
/* @__PURE__ */ n.jsx("p", { children: r.country })
|
|
1584
1670
|
] }),
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
|
|
1671
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex gap-2", children: [
|
|
1672
|
+
/* @__PURE__ */ n.jsx(
|
|
1673
|
+
E,
|
|
1588
1674
|
{
|
|
1589
1675
|
variant: "outline",
|
|
1590
1676
|
size: "sm",
|
|
@@ -1592,13 +1678,13 @@ function Ur() {
|
|
|
1592
1678
|
children: e("edit_address")
|
|
1593
1679
|
}
|
|
1594
1680
|
),
|
|
1595
|
-
!r.default && /* @__PURE__ */
|
|
1596
|
-
|
|
1681
|
+
!r.default && /* @__PURE__ */ n.jsx(
|
|
1682
|
+
E,
|
|
1597
1683
|
{
|
|
1598
1684
|
variant: "ghost",
|
|
1599
1685
|
size: "sm",
|
|
1600
1686
|
onClick: () => {
|
|
1601
|
-
t.reset(),
|
|
1687
|
+
t.reset(), g(r);
|
|
1602
1688
|
},
|
|
1603
1689
|
children: e("delete_address")
|
|
1604
1690
|
}
|
|
@@ -1608,33 +1694,33 @@ function Ur() {
|
|
|
1608
1694
|
},
|
|
1609
1695
|
r.id
|
|
1610
1696
|
)),
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
d !== void 0 && /* @__PURE__ */
|
|
1613
|
-
|
|
1697
|
+
/* @__PURE__ */ n.jsx(E, { onClick: () => u(null), children: e("add_address") }),
|
|
1698
|
+
d !== void 0 && /* @__PURE__ */ n.jsx(
|
|
1699
|
+
st,
|
|
1614
1700
|
{
|
|
1615
1701
|
isOpen: !0,
|
|
1616
|
-
selectedAddress: d ?
|
|
1702
|
+
selectedAddress: d ? xe(d) : null,
|
|
1617
1703
|
onClose: () => {
|
|
1618
|
-
u(void 0),
|
|
1704
|
+
u(void 0), a();
|
|
1619
1705
|
}
|
|
1620
1706
|
}
|
|
1621
1707
|
),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
|
|
1708
|
+
/* @__PURE__ */ n.jsx(
|
|
1709
|
+
Fe,
|
|
1624
1710
|
{
|
|
1625
1711
|
title: e("delete_address"),
|
|
1626
1712
|
description: e("delete_address_message"),
|
|
1627
1713
|
actionText: e("delete"),
|
|
1628
|
-
openDialog:
|
|
1714
|
+
openDialog: p !== null,
|
|
1629
1715
|
setOpenDialog: (r) => {
|
|
1630
|
-
!r && !t.isPending && (
|
|
1716
|
+
!r && !t.isPending && (g(null), a());
|
|
1631
1717
|
},
|
|
1632
1718
|
isLoading: t.isPending,
|
|
1633
1719
|
errorMsg: t.error ? e("unable_to_delete_address") : void 0,
|
|
1634
1720
|
onAction: () => {
|
|
1635
|
-
!
|
|
1721
|
+
!p || t.isPending || t.mutate(p.id, {
|
|
1636
1722
|
onSuccess: () => {
|
|
1637
|
-
|
|
1723
|
+
g(null), a();
|
|
1638
1724
|
}
|
|
1639
1725
|
});
|
|
1640
1726
|
}
|
|
@@ -1644,9 +1730,9 @@ function Ur() {
|
|
|
1644
1730
|
}
|
|
1645
1731
|
);
|
|
1646
1732
|
}
|
|
1647
|
-
function
|
|
1648
|
-
const e =
|
|
1649
|
-
return
|
|
1733
|
+
function at() {
|
|
1734
|
+
const e = B();
|
|
1735
|
+
return $({
|
|
1650
1736
|
queryKey: ["memberStorefront", "profile", "points"],
|
|
1651
1737
|
queryFn: async () => {
|
|
1652
1738
|
try {
|
|
@@ -1659,32 +1745,32 @@ function st() {
|
|
|
1659
1745
|
}
|
|
1660
1746
|
});
|
|
1661
1747
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const { t: e } =
|
|
1748
|
+
function qr() {
|
|
1749
|
+
const { t: e } = R(), { locale: i } = T(), t = at(), l = me();
|
|
1664
1750
|
if (t.error) throw t.error;
|
|
1665
1751
|
if (t.isPending || !l.data)
|
|
1666
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ n.jsx("p", { role: "status", children: e("profile_loading") });
|
|
1667
1753
|
if (!t.data)
|
|
1668
|
-
return /* @__PURE__ */
|
|
1669
|
-
const d = t.data.points_ledgers, u = d[0]?.total_balance ?? 0,
|
|
1670
|
-
return /* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1754
|
+
return /* @__PURE__ */ n.jsx("p", { role: "status", children: e("profile_points_unavailable") });
|
|
1755
|
+
const d = t.data.points_ledgers, u = d[0]?.total_balance ?? 0, p = u === 1 ? l.data.reward_points_label_singular : l.data.reward_points_label_plural, g = l.data.reward_points_label_plural, a = p.charAt(0).toLocaleUpperCase(i) + p.slice(1), r = g.charAt(0).toLocaleUpperCase(i) + g.slice(1), s = new Intl.NumberFormat(i), o = new Intl.DateTimeFormat(i, { dateStyle: "medium" });
|
|
1756
|
+
return /* @__PURE__ */ n.jsxs("div", { className: "space-y-6", children: [
|
|
1757
|
+
/* @__PURE__ */ n.jsxs("section", { className: "bg-card text-card-foreground border-border space-y-2 rounded-xl border p-6", children: [
|
|
1758
|
+
/* @__PURE__ */ n.jsx("h2", { className: "text-muted-foreground text-sm", children: e("points_available", { label: a }) }),
|
|
1759
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-4xl font-semibold tabular-nums", children: s.format(u) })
|
|
1674
1760
|
] }),
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
d.length ? /* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ n.jsxs("section", { className: "space-y-3", children: [
|
|
1762
|
+
/* @__PURE__ */ n.jsx("h2", { className: "font-semibold", children: e("points_history", { label: r }) }),
|
|
1763
|
+
d.length ? /* @__PURE__ */ n.jsx("ol", { className: "border-border divide-border divide-y rounded-xl border", children: d.map((c) => /* @__PURE__ */ n.jsxs(
|
|
1678
1764
|
"li",
|
|
1679
1765
|
{
|
|
1680
1766
|
className: "flex items-center justify-between gap-4 p-4",
|
|
1681
1767
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1768
|
+
/* @__PURE__ */ n.jsxs("div", { className: "space-y-1", children: [
|
|
1769
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-sm font-medium", children: c.metadata?.transaction_type === "order_refund" ? e("profile_points_refunded", { label: r }) : e(
|
|
1684
1770
|
c.amount > 0 ? "points_awarded" : "points_redeemed",
|
|
1685
1771
|
{ label: r }
|
|
1686
1772
|
) }),
|
|
1687
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ n.jsx(
|
|
1688
1774
|
"time",
|
|
1689
1775
|
{
|
|
1690
1776
|
className: "text-muted-foreground text-xs",
|
|
@@ -1693,45 +1779,45 @@ function $r() {
|
|
|
1693
1779
|
}
|
|
1694
1780
|
)
|
|
1695
1781
|
] }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1782
|
+
/* @__PURE__ */ n.jsxs("span", { className: "font-medium tabular-nums", children: [
|
|
1697
1783
|
c.amount > 0 ? "+" : "",
|
|
1698
|
-
|
|
1784
|
+
s.format(c.amount)
|
|
1699
1785
|
] })
|
|
1700
1786
|
]
|
|
1701
1787
|
},
|
|
1702
1788
|
c.id
|
|
1703
|
-
)) }) : /* @__PURE__ */
|
|
1789
|
+
)) }) : /* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-sm", children: e("no_points_history_found", { label: r }) })
|
|
1704
1790
|
] })
|
|
1705
1791
|
] });
|
|
1706
1792
|
}
|
|
1707
|
-
function
|
|
1793
|
+
function Qr({
|
|
1708
1794
|
children: e
|
|
1709
1795
|
}) {
|
|
1710
1796
|
const i = v.useRef(null), [t, l] = v.useState(null);
|
|
1711
1797
|
return v.useEffect(() => {
|
|
1712
1798
|
if (!i.current) return;
|
|
1713
|
-
const d =
|
|
1799
|
+
const d = Tt(i.current);
|
|
1714
1800
|
return l(d), () => d.remove();
|
|
1715
|
-
}, []), /* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1801
|
+
}, []), /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
1802
|
+
/* @__PURE__ */ n.jsx("span", { ref: i, hidden: !0 }),
|
|
1717
1803
|
t && yt.createPortal(
|
|
1718
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ n.jsx(jt, { container: t, children: e }),
|
|
1719
1805
|
t
|
|
1720
1806
|
)
|
|
1721
1807
|
] });
|
|
1722
1808
|
}
|
|
1723
|
-
function
|
|
1809
|
+
function Vr({
|
|
1724
1810
|
onClose: e
|
|
1725
1811
|
}) {
|
|
1726
|
-
const i =
|
|
1727
|
-
return /* @__PURE__ */
|
|
1728
|
-
|
|
1812
|
+
const i = ge(), { t } = R(), { isMobile: l } = W();
|
|
1813
|
+
return /* @__PURE__ */ n.jsx(Qr, { children: i.data ? /* @__PURE__ */ n.jsx(
|
|
1814
|
+
Hr,
|
|
1729
1815
|
{
|
|
1730
1816
|
initialAddresses: i.data.addresses,
|
|
1731
1817
|
onClose: e
|
|
1732
1818
|
}
|
|
1733
|
-
) : /* @__PURE__ */
|
|
1734
|
-
|
|
1819
|
+
) : /* @__PURE__ */ n.jsxs(
|
|
1820
|
+
Le,
|
|
1735
1821
|
{
|
|
1736
1822
|
open: !0,
|
|
1737
1823
|
onOpenChange: (d) => {
|
|
@@ -1740,9 +1826,9 @@ function Qr({
|
|
|
1740
1826
|
title: t("add_payment_method"),
|
|
1741
1827
|
presentation: l ? "bottom-sheet" : "dialog",
|
|
1742
1828
|
children: [
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
i.error && /* @__PURE__ */
|
|
1745
|
-
|
|
1829
|
+
/* @__PURE__ */ n.jsx("p", { role: i.error ? "alert" : "status", children: t(i.error ? "unexpected_error" : "profile_loading") }),
|
|
1830
|
+
i.error && /* @__PURE__ */ n.jsx(
|
|
1831
|
+
E,
|
|
1746
1832
|
{
|
|
1747
1833
|
disabled: i.isFetching,
|
|
1748
1834
|
onClick: () => {
|
|
@@ -1755,69 +1841,69 @@ function Qr({
|
|
|
1755
1841
|
}
|
|
1756
1842
|
) });
|
|
1757
1843
|
}
|
|
1758
|
-
function
|
|
1844
|
+
function Hr({
|
|
1759
1845
|
initialAddresses: e,
|
|
1760
1846
|
onClose: i
|
|
1761
1847
|
}) {
|
|
1762
|
-
const { t } =
|
|
1763
|
-
() => e.map(
|
|
1848
|
+
const { t } = R(), { isMobile: l } = W(), d = B(), u = H(), [p, g] = v.useState(), a = v.useMemo(() => Bt(d), [d]), [r] = v.useState(
|
|
1849
|
+
() => e.map(xe)
|
|
1764
1850
|
);
|
|
1765
|
-
async function
|
|
1766
|
-
await u.invalidateQueries({ queryKey:
|
|
1851
|
+
async function s() {
|
|
1852
|
+
await u.invalidateQueries({ queryKey: J.paymentMethods.all }), i();
|
|
1767
1853
|
}
|
|
1768
|
-
const o =
|
|
1854
|
+
const o = Ut({
|
|
1769
1855
|
payApi: d,
|
|
1770
|
-
t: (
|
|
1771
|
-
onApproved:
|
|
1772
|
-
onFailed:
|
|
1856
|
+
t: (m) => t(m),
|
|
1857
|
+
onApproved: s,
|
|
1858
|
+
onFailed: g,
|
|
1773
1859
|
onCanceled: () => {
|
|
1774
1860
|
}
|
|
1775
|
-
}), c =
|
|
1776
|
-
mutationFn: (
|
|
1861
|
+
}), c = K({
|
|
1862
|
+
mutationFn: (m) => d.createPaymentMethod({
|
|
1777
1863
|
payment_method: {
|
|
1778
|
-
...
|
|
1864
|
+
...m.payment_method,
|
|
1779
1865
|
type: "card",
|
|
1780
|
-
token_provider:
|
|
1781
|
-
default:
|
|
1866
|
+
token_provider: Qt,
|
|
1867
|
+
default: m.set_as_default
|
|
1782
1868
|
},
|
|
1783
|
-
billing_address_id:
|
|
1784
|
-
browser_info:
|
|
1869
|
+
billing_address_id: m.billing_address_id,
|
|
1870
|
+
browser_info: qt()
|
|
1785
1871
|
}),
|
|
1786
|
-
onSuccess: async (
|
|
1787
|
-
|
|
1872
|
+
onSuccess: async (m) => {
|
|
1873
|
+
$t(m) ? await o.begin(m) : await s();
|
|
1788
1874
|
},
|
|
1789
|
-
onError: () =>
|
|
1875
|
+
onError: () => g(t("failed_to_add_payment_method"))
|
|
1790
1876
|
});
|
|
1791
|
-
return /* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
|
|
1877
|
+
return /* @__PURE__ */ n.jsxs(Vt, { api: a, children: [
|
|
1878
|
+
/* @__PURE__ */ n.jsx(
|
|
1879
|
+
Ht,
|
|
1794
1880
|
{
|
|
1795
1881
|
isOpen: !0,
|
|
1796
1882
|
jwt: "",
|
|
1797
1883
|
savedAddresses: r,
|
|
1798
|
-
defaultBillingAddressId: r.find((
|
|
1884
|
+
defaultBillingAddressId: r.find((m) => m.default)?.id,
|
|
1799
1885
|
presentation: l ? "bottom-sheet" : "dialog",
|
|
1800
|
-
t: (
|
|
1801
|
-
error:
|
|
1886
|
+
t: (m) => t(m),
|
|
1887
|
+
error: p,
|
|
1802
1888
|
isSubmitting: c.isPending || o.isActive,
|
|
1803
1889
|
preventClose: c.isPending || o.isActive,
|
|
1804
1890
|
onClose: () => {
|
|
1805
1891
|
!c.isPending && !o.isActive && i();
|
|
1806
1892
|
},
|
|
1807
|
-
onSubmit: (
|
|
1808
|
-
c.isPending || o.isActive || (
|
|
1893
|
+
onSubmit: (m) => {
|
|
1894
|
+
c.isPending || o.isActive || (g(void 0), c.mutate(m));
|
|
1809
1895
|
},
|
|
1810
1896
|
renderAddressFormDialog: ({
|
|
1811
|
-
isOpen:
|
|
1812
|
-
onClose:
|
|
1813
|
-
onAddressCreated:
|
|
1814
|
-
}) =>
|
|
1815
|
-
|
|
1897
|
+
isOpen: m,
|
|
1898
|
+
onClose: f,
|
|
1899
|
+
onAddressCreated: h
|
|
1900
|
+
}) => m ? /* @__PURE__ */ n.jsx(
|
|
1901
|
+
st,
|
|
1816
1902
|
{
|
|
1817
1903
|
isOpen: !0,
|
|
1818
|
-
onClose:
|
|
1904
|
+
onClose: f,
|
|
1819
1905
|
selectedAddress: null,
|
|
1820
|
-
onAddressCreated:
|
|
1906
|
+
onAddressCreated: h
|
|
1821
1907
|
}
|
|
1822
1908
|
) : null
|
|
1823
1909
|
}
|
|
@@ -1825,76 +1911,76 @@ function Vr({
|
|
|
1825
1911
|
o.modal
|
|
1826
1912
|
] });
|
|
1827
1913
|
}
|
|
1828
|
-
function
|
|
1829
|
-
const e =
|
|
1830
|
-
return
|
|
1831
|
-
queryKey:
|
|
1914
|
+
function it() {
|
|
1915
|
+
const e = B();
|
|
1916
|
+
return $({
|
|
1917
|
+
queryKey: J.paymentMethods.list(),
|
|
1832
1918
|
queryFn: () => e.fetchPaymentMethods()
|
|
1833
1919
|
});
|
|
1834
1920
|
}
|
|
1835
|
-
function
|
|
1836
|
-
const e =
|
|
1837
|
-
return
|
|
1921
|
+
function ot() {
|
|
1922
|
+
const e = B(), i = H();
|
|
1923
|
+
return K({
|
|
1838
1924
|
mutationFn: ({ id: t, body: l }) => e.updatePaymentMethod(t, l),
|
|
1839
|
-
onSuccess: () => i.invalidateQueries({ queryKey:
|
|
1925
|
+
onSuccess: () => i.invalidateQueries({ queryKey: J.paymentMethods.all })
|
|
1840
1926
|
});
|
|
1841
1927
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const e =
|
|
1844
|
-
return
|
|
1928
|
+
function Kr() {
|
|
1929
|
+
const e = B(), i = H();
|
|
1930
|
+
return K({
|
|
1845
1931
|
mutationFn: (t) => e.deletePaymentMethod(t),
|
|
1846
|
-
onSuccess: () => i.invalidateQueries({ queryKey:
|
|
1932
|
+
onSuccess: () => i.invalidateQueries({ queryKey: J.paymentMethods.all })
|
|
1847
1933
|
});
|
|
1848
1934
|
}
|
|
1849
|
-
function
|
|
1935
|
+
function Gr({
|
|
1850
1936
|
card: e,
|
|
1851
1937
|
onClose: i
|
|
1852
1938
|
}) {
|
|
1853
|
-
const { t } =
|
|
1939
|
+
const { t } = R(), { locale: l } = T(), { isMobile: d } = W(), u = nt(!0), p = ot(), g = v.useMemo(() => Kt(e), [e]), a = v.useCallback(
|
|
1854
1940
|
(r) => Promise.resolve(
|
|
1855
|
-
u.data?.countries.find((
|
|
1856
|
-
name:
|
|
1857
|
-
isoCode:
|
|
1941
|
+
u.data?.countries.find((s) => s.code === r)?.states.map((s) => ({
|
|
1942
|
+
name: s.name,
|
|
1943
|
+
isoCode: s.code
|
|
1858
1944
|
})) ?? []
|
|
1859
1945
|
),
|
|
1860
1946
|
[u.data]
|
|
1861
1947
|
);
|
|
1862
1948
|
if (u.error) throw u.error;
|
|
1863
|
-
return u.isPending ? /* @__PURE__ */
|
|
1864
|
-
|
|
1949
|
+
return u.isPending ? /* @__PURE__ */ n.jsx("p", { role: "status", children: t("profile_loading") }) : /* @__PURE__ */ n.jsx(
|
|
1950
|
+
Gt,
|
|
1865
1951
|
{
|
|
1866
1952
|
isOpen: !0,
|
|
1867
|
-
paymentMethod:
|
|
1868
|
-
billingAddress:
|
|
1953
|
+
paymentMethod: g,
|
|
1954
|
+
billingAddress: g.billing_address,
|
|
1869
1955
|
countries: u.data?.countries.map((r) => ({
|
|
1870
1956
|
iso: r.code,
|
|
1871
1957
|
name: r.name
|
|
1872
1958
|
})),
|
|
1873
|
-
fetchStates:
|
|
1959
|
+
fetchStates: a,
|
|
1874
1960
|
languageIso: l,
|
|
1875
1961
|
presentation: d ? "bottom-sheet" : "dialog",
|
|
1876
|
-
isSubmitting:
|
|
1877
|
-
error:
|
|
1962
|
+
isSubmitting: p.isPending,
|
|
1963
|
+
error: p.error ? t("failed_to_update_payment_method") : void 0,
|
|
1878
1964
|
onClose: () => {
|
|
1879
|
-
|
|
1965
|
+
p.isPending || i();
|
|
1880
1966
|
},
|
|
1881
1967
|
onSubmit: (r) => {
|
|
1882
|
-
if (
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1968
|
+
if (p.isPending) return;
|
|
1969
|
+
const s = r.billing_address;
|
|
1970
|
+
p.mutate(
|
|
1885
1971
|
{
|
|
1886
1972
|
id: e.id,
|
|
1887
1973
|
body: {
|
|
1888
1974
|
payment_method: {
|
|
1889
1975
|
default: r.set_as_default,
|
|
1890
1976
|
billing_address: {
|
|
1891
|
-
name:
|
|
1892
|
-
street1:
|
|
1893
|
-
street2:
|
|
1894
|
-
city:
|
|
1895
|
-
state:
|
|
1896
|
-
zip:
|
|
1897
|
-
country:
|
|
1977
|
+
name: s.name,
|
|
1978
|
+
street1: s.address1,
|
|
1979
|
+
street2: s.address2,
|
|
1980
|
+
city: s.city,
|
|
1981
|
+
state: s.state,
|
|
1982
|
+
zip: s.zip,
|
|
1983
|
+
country: s.country_code
|
|
1898
1984
|
}
|
|
1899
1985
|
}
|
|
1900
1986
|
}
|
|
@@ -1905,27 +1991,27 @@ function Kr({
|
|
|
1905
1991
|
}
|
|
1906
1992
|
);
|
|
1907
1993
|
}
|
|
1908
|
-
function
|
|
1909
|
-
const { t: e } =
|
|
1910
|
-
function
|
|
1994
|
+
function Yr() {
|
|
1995
|
+
const { t: e } = R(), { preview: i } = fe(), t = it(), l = ot(), d = Kr(), u = v.useRef(null), p = v.useRef(null), [g, a] = v.useState(!1), [r, s] = v.useState(null), [o, c] = v.useState(null);
|
|
1996
|
+
function m() {
|
|
1911
1997
|
requestAnimationFrame(() => {
|
|
1912
|
-
(u.current?.isConnected ? u.current :
|
|
1998
|
+
(u.current?.isConnected ? u.current : p.current?.querySelector("button") ?? p.current)?.focus();
|
|
1913
1999
|
});
|
|
1914
2000
|
}
|
|
1915
|
-
return /* @__PURE__ */
|
|
2001
|
+
return /* @__PURE__ */ n.jsxs(
|
|
1916
2002
|
"div",
|
|
1917
2003
|
{
|
|
1918
|
-
ref:
|
|
2004
|
+
ref: p,
|
|
1919
2005
|
role: "region",
|
|
1920
2006
|
tabIndex: -1,
|
|
1921
2007
|
"aria-label": e("payment_methods"),
|
|
1922
2008
|
className: "space-y-4 outline-none",
|
|
1923
2009
|
children: [
|
|
1924
|
-
t.isPending && /* @__PURE__ */
|
|
1925
|
-
t.error && /* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
1928
|
-
|
|
2010
|
+
t.isPending && /* @__PURE__ */ n.jsx("p", { role: "status", children: e("profile_loading") }),
|
|
2011
|
+
t.error && /* @__PURE__ */ n.jsxs("div", { role: "alert", className: "space-y-3", children: [
|
|
2012
|
+
/* @__PURE__ */ n.jsx("p", { children: e("profile_payments_load_failed") }),
|
|
2013
|
+
/* @__PURE__ */ n.jsx(
|
|
2014
|
+
E,
|
|
1929
2015
|
{
|
|
1930
2016
|
variant: "outline",
|
|
1931
2017
|
disabled: t.isFetching,
|
|
@@ -1936,62 +2022,62 @@ function Gr() {
|
|
|
1936
2022
|
}
|
|
1937
2023
|
)
|
|
1938
2024
|
] }),
|
|
1939
|
-
t.data?.payment_methods.length === 0 && /* @__PURE__ */
|
|
1940
|
-
t.data?.payment_methods.map((
|
|
2025
|
+
t.data?.payment_methods.length === 0 && /* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-sm", children: e("profile_no_saved_cards") }),
|
|
2026
|
+
t.data?.payment_methods.map((f) => /* @__PURE__ */ n.jsxs(
|
|
1941
2027
|
"section",
|
|
1942
2028
|
{
|
|
1943
2029
|
className: "bg-card text-card-foreground border-border space-y-4 rounded-xl border p-5",
|
|
1944
2030
|
children: [
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
brand:
|
|
1948
|
-
lastFour:
|
|
2031
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2032
|
+
/* @__PURE__ */ n.jsx("h2", { className: "font-medium", children: e("profile_card_ending", {
|
|
2033
|
+
brand: f.brand || e("card_fallback"),
|
|
2034
|
+
lastFour: f.last_four
|
|
1949
2035
|
}) }),
|
|
1950
|
-
|
|
2036
|
+
f.default && /* @__PURE__ */ n.jsx(Re, { variant: "secondary", children: e("default") })
|
|
1951
2037
|
] }),
|
|
1952
|
-
|
|
2038
|
+
f.exp_month !== null && f.exp_year !== null && /* @__PURE__ */ n.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
1953
2039
|
e("card_expires"),
|
|
1954
2040
|
" ",
|
|
1955
|
-
|
|
2041
|
+
f.exp_month,
|
|
1956
2042
|
"/",
|
|
1957
|
-
|
|
2043
|
+
f.exp_year
|
|
1958
2044
|
] }),
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
|
|
2045
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
2046
|
+
/* @__PURE__ */ n.jsx(
|
|
2047
|
+
E,
|
|
1962
2048
|
{
|
|
1963
2049
|
variant: "outline",
|
|
1964
2050
|
size: "sm",
|
|
1965
|
-
onClick: (
|
|
1966
|
-
u.current =
|
|
2051
|
+
onClick: (h) => {
|
|
2052
|
+
u.current = h.currentTarget, s(f);
|
|
1967
2053
|
},
|
|
1968
2054
|
disabled: i || l.isPending || d.isPending,
|
|
1969
2055
|
children: e("edit_card")
|
|
1970
2056
|
}
|
|
1971
2057
|
),
|
|
1972
|
-
!
|
|
1973
|
-
|
|
2058
|
+
!f.default && /* @__PURE__ */ n.jsx(
|
|
2059
|
+
E,
|
|
1974
2060
|
{
|
|
1975
2061
|
variant: "outline",
|
|
1976
2062
|
size: "sm",
|
|
1977
2063
|
disabled: i || l.isPending || d.isPending,
|
|
1978
2064
|
onClick: () => {
|
|
1979
2065
|
l.isPending || l.mutate({
|
|
1980
|
-
id:
|
|
2066
|
+
id: f.id,
|
|
1981
2067
|
body: { payment_method: { default: !0 } }
|
|
1982
2068
|
});
|
|
1983
2069
|
},
|
|
1984
2070
|
children: e("set_as_default_payment_method")
|
|
1985
2071
|
}
|
|
1986
2072
|
),
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
|
|
2073
|
+
/* @__PURE__ */ n.jsx(
|
|
2074
|
+
E,
|
|
1989
2075
|
{
|
|
1990
2076
|
variant: "ghost",
|
|
1991
2077
|
size: "sm",
|
|
1992
2078
|
disabled: i || l.isPending || d.isPending,
|
|
1993
|
-
onClick: (
|
|
1994
|
-
u.current =
|
|
2079
|
+
onClick: (h) => {
|
|
2080
|
+
u.current = h.currentTarget, d.reset(), c(f);
|
|
1995
2081
|
},
|
|
1996
2082
|
children: e("delete_card")
|
|
1997
2083
|
}
|
|
@@ -1999,52 +2085,52 @@ function Gr() {
|
|
|
1999
2085
|
] })
|
|
2000
2086
|
]
|
|
2001
2087
|
},
|
|
2002
|
-
|
|
2088
|
+
f.id
|
|
2003
2089
|
)),
|
|
2004
|
-
l.error && /* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
|
|
2090
|
+
l.error && /* @__PURE__ */ n.jsx("p", { role: "alert", className: "text-destructive text-sm", children: e("failed_to_set_default_payment_method") }),
|
|
2091
|
+
/* @__PURE__ */ n.jsx(
|
|
2092
|
+
E,
|
|
2007
2093
|
{
|
|
2008
|
-
onClick: (
|
|
2009
|
-
u.current =
|
|
2094
|
+
onClick: (f) => {
|
|
2095
|
+
u.current = f.currentTarget, a(!0);
|
|
2010
2096
|
},
|
|
2011
2097
|
disabled: i || l.isPending || d.isPending,
|
|
2012
2098
|
children: e("add_payment_method")
|
|
2013
2099
|
}
|
|
2014
2100
|
),
|
|
2015
|
-
|
|
2016
|
-
|
|
2101
|
+
g && /* @__PURE__ */ n.jsx(
|
|
2102
|
+
Vr,
|
|
2017
2103
|
{
|
|
2018
2104
|
onClose: () => {
|
|
2019
|
-
|
|
2105
|
+
a(!1), m();
|
|
2020
2106
|
}
|
|
2021
2107
|
}
|
|
2022
2108
|
),
|
|
2023
|
-
r && /* @__PURE__ */
|
|
2024
|
-
|
|
2109
|
+
r && /* @__PURE__ */ n.jsx(
|
|
2110
|
+
Gr,
|
|
2025
2111
|
{
|
|
2026
2112
|
card: r,
|
|
2027
2113
|
onClose: () => {
|
|
2028
|
-
|
|
2114
|
+
s(null), m();
|
|
2029
2115
|
}
|
|
2030
2116
|
}
|
|
2031
2117
|
),
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
|
|
2118
|
+
/* @__PURE__ */ n.jsx(
|
|
2119
|
+
Fe,
|
|
2034
2120
|
{
|
|
2035
2121
|
title: e("delete_credit_card"),
|
|
2036
2122
|
description: e("delete_credit_card_message"),
|
|
2037
2123
|
actionText: e("delete"),
|
|
2038
2124
|
openDialog: o !== null,
|
|
2039
|
-
setOpenDialog: (
|
|
2040
|
-
!
|
|
2125
|
+
setOpenDialog: (f) => {
|
|
2126
|
+
!f && !d.isPending && (c(null), m());
|
|
2041
2127
|
},
|
|
2042
2128
|
isLoading: d.isPending,
|
|
2043
2129
|
errorMsg: d.error ? e("unable_to_delete_payment_method") : void 0,
|
|
2044
2130
|
onAction: () => {
|
|
2045
2131
|
o && !d.isPending && d.mutate(o.id, {
|
|
2046
2132
|
onSuccess: () => {
|
|
2047
|
-
c(null),
|
|
2133
|
+
c(null), m();
|
|
2048
2134
|
}
|
|
2049
2135
|
});
|
|
2050
2136
|
}
|
|
@@ -2054,7 +2140,7 @@ function Gr() {
|
|
|
2054
2140
|
}
|
|
2055
2141
|
);
|
|
2056
2142
|
}
|
|
2057
|
-
function
|
|
2143
|
+
function _e({
|
|
2058
2144
|
icon: e,
|
|
2059
2145
|
label: i,
|
|
2060
2146
|
detail: t,
|
|
@@ -2062,7 +2148,7 @@ function he({
|
|
|
2062
2148
|
onOpen: d,
|
|
2063
2149
|
triggerRef: u
|
|
2064
2150
|
}) {
|
|
2065
|
-
return /* @__PURE__ */
|
|
2151
|
+
return /* @__PURE__ */ n.jsxs(
|
|
2066
2152
|
"button",
|
|
2067
2153
|
{
|
|
2068
2154
|
type: "button",
|
|
@@ -2070,10 +2156,10 @@ function he({
|
|
|
2070
2156
|
onClick: d,
|
|
2071
2157
|
className: "bg-card text-card-foreground border-border hover:bg-muted focus-visible:ring-ring flex min-h-20 w-full items-center gap-4 rounded-xl border p-5 text-left focus-visible:ring-2",
|
|
2072
2158
|
children: [
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ n.jsx(e, { "aria-hidden": "true", className: "size-5" }),
|
|
2160
|
+
/* @__PURE__ */ n.jsxs("span", { className: "flex-1 space-y-1", children: [
|
|
2161
|
+
/* @__PURE__ */ n.jsx("span", { className: "block font-medium", children: i }),
|
|
2162
|
+
/* @__PURE__ */ n.jsx(
|
|
2077
2163
|
"span",
|
|
2078
2164
|
{
|
|
2079
2165
|
className: "text-muted-foreground block text-sm",
|
|
@@ -2082,8 +2168,8 @@ function he({
|
|
|
2082
2168
|
}
|
|
2083
2169
|
)
|
|
2084
2170
|
] }),
|
|
2085
|
-
/* @__PURE__ */
|
|
2086
|
-
|
|
2171
|
+
/* @__PURE__ */ n.jsx(
|
|
2172
|
+
Me,
|
|
2087
2173
|
{
|
|
2088
2174
|
"aria-hidden": "true",
|
|
2089
2175
|
className: "text-muted-foreground size-4"
|
|
@@ -2093,16 +2179,16 @@ function he({
|
|
|
2093
2179
|
}
|
|
2094
2180
|
);
|
|
2095
2181
|
}
|
|
2096
|
-
function
|
|
2182
|
+
function be({
|
|
2097
2183
|
message: e,
|
|
2098
2184
|
retryLabel: i,
|
|
2099
2185
|
isRetrying: t,
|
|
2100
2186
|
onRetry: l
|
|
2101
2187
|
}) {
|
|
2102
|
-
return /* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
|
|
2188
|
+
return /* @__PURE__ */ n.jsxs("div", { role: "alert", className: "border-border space-y-3 rounded-xl border p-5", children: [
|
|
2189
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-sm", children: e }),
|
|
2190
|
+
/* @__PURE__ */ n.jsx(
|
|
2191
|
+
E,
|
|
2106
2192
|
{
|
|
2107
2193
|
variant: "outline",
|
|
2108
2194
|
size: "sm",
|
|
@@ -2113,23 +2199,23 @@ function pe({
|
|
|
2113
2199
|
)
|
|
2114
2200
|
] });
|
|
2115
2201
|
}
|
|
2116
|
-
function
|
|
2202
|
+
function Wr({
|
|
2117
2203
|
onOpen: e,
|
|
2118
2204
|
triggerRef: i
|
|
2119
2205
|
}) {
|
|
2120
|
-
const { t } =
|
|
2121
|
-
return l.error ? /* @__PURE__ */
|
|
2122
|
-
|
|
2206
|
+
const { t } = R(), l = it(), d = l.data?.payment_methods.find((u) => u.default);
|
|
2207
|
+
return l.error ? /* @__PURE__ */ n.jsx(
|
|
2208
|
+
be,
|
|
2123
2209
|
{
|
|
2124
2210
|
message: t("profile_payments_load_failed"),
|
|
2125
2211
|
retryLabel: t("profile_payments_retry"),
|
|
2126
2212
|
isRetrying: l.isFetching,
|
|
2127
2213
|
onRetry: () => void l.refetch()
|
|
2128
2214
|
}
|
|
2129
|
-
) : /* @__PURE__ */
|
|
2130
|
-
|
|
2215
|
+
) : /* @__PURE__ */ n.jsx(
|
|
2216
|
+
_e,
|
|
2131
2217
|
{
|
|
2132
|
-
icon:
|
|
2218
|
+
icon: ke,
|
|
2133
2219
|
label: t("profile_default_payment"),
|
|
2134
2220
|
detail: l.isPending ? t("profile_loading") : d ? t("profile_card_ending", {
|
|
2135
2221
|
brand: d.brand || t("card_fallback"),
|
|
@@ -2141,7 +2227,7 @@ function Yr({
|
|
|
2141
2227
|
}
|
|
2142
2228
|
);
|
|
2143
2229
|
}
|
|
2144
|
-
function
|
|
2230
|
+
function lt(e, i, t) {
|
|
2145
2231
|
const l = {
|
|
2146
2232
|
dateStyle: "medium",
|
|
2147
2233
|
...t ? { timeZone: t } : {}
|
|
@@ -2152,24 +2238,24 @@ function ot(e, i, t) {
|
|
|
2152
2238
|
return new Intl.DateTimeFormat("en-US", l).format(e);
|
|
2153
2239
|
}
|
|
2154
2240
|
}
|
|
2155
|
-
function
|
|
2241
|
+
function Xr(e, i) {
|
|
2156
2242
|
if (!e) return null;
|
|
2157
2243
|
const t = new Date(e);
|
|
2158
|
-
return Number.isNaN(t.getTime()) ? null :
|
|
2244
|
+
return Number.isNaN(t.getTime()) ? null : lt(t, i);
|
|
2159
2245
|
}
|
|
2160
|
-
function
|
|
2246
|
+
function Zr(e, i) {
|
|
2161
2247
|
if (!e) return null;
|
|
2162
2248
|
const t = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`);
|
|
2163
|
-
return Number.isNaN(t.getTime()) ? null :
|
|
2249
|
+
return Number.isNaN(t.getTime()) ? null : lt(t, i, "UTC");
|
|
2164
2250
|
}
|
|
2165
|
-
const
|
|
2166
|
-
subscription:
|
|
2167
|
-
token:
|
|
2168
|
-
plan_name:
|
|
2169
|
-
next_billing_date:
|
|
2251
|
+
const Jr = se({
|
|
2252
|
+
subscription: se({
|
|
2253
|
+
token: L(),
|
|
2254
|
+
plan_name: L().nullish(),
|
|
2255
|
+
next_billing_date: L().nullish()
|
|
2170
2256
|
}).nullish()
|
|
2171
2257
|
});
|
|
2172
|
-
async function
|
|
2258
|
+
async function en(e = wt) {
|
|
2173
2259
|
const i = await e(
|
|
2174
2260
|
"/api/member-storefront/subscriptions/next",
|
|
2175
2261
|
{
|
|
@@ -2179,35 +2265,35 @@ async function Jr(e = jt) {
|
|
|
2179
2265
|
);
|
|
2180
2266
|
if (!i.ok)
|
|
2181
2267
|
throw new Error(`Next subscription request failed (${i.status})`);
|
|
2182
|
-
const { subscription: t } =
|
|
2268
|
+
const { subscription: t } = Jr.parse(await i.json());
|
|
2183
2269
|
return t ? {
|
|
2184
2270
|
token: t.token,
|
|
2185
2271
|
planName: t.plan_name ?? null,
|
|
2186
2272
|
nextBillingDate: t.next_billing_date ?? null
|
|
2187
2273
|
} : null;
|
|
2188
2274
|
}
|
|
2189
|
-
function
|
|
2190
|
-
const e =
|
|
2191
|
-
return
|
|
2275
|
+
function tn() {
|
|
2276
|
+
const e = Et(), i = v.useMemo(() => Pt(e), [e]);
|
|
2277
|
+
return $({
|
|
2192
2278
|
queryKey: ["memberStorefront", "profile", "latest-order"],
|
|
2193
2279
|
queryFn: async () => (await i.fetchCustomerOrders({ limit: 1 })).orders[0] ?? null
|
|
2194
2280
|
});
|
|
2195
2281
|
}
|
|
2196
|
-
function
|
|
2197
|
-
const { fetch: e } =
|
|
2198
|
-
return
|
|
2282
|
+
function rn() {
|
|
2283
|
+
const { fetch: e } = fe();
|
|
2284
|
+
return $({
|
|
2199
2285
|
queryKey: ["memberStorefront", "profile", "next-subscription"],
|
|
2200
|
-
queryFn: () =>
|
|
2286
|
+
queryFn: () => en(e)
|
|
2201
2287
|
});
|
|
2202
2288
|
}
|
|
2203
|
-
function
|
|
2289
|
+
function nn({
|
|
2204
2290
|
onOpen: e,
|
|
2205
2291
|
triggerRef: i
|
|
2206
2292
|
}) {
|
|
2207
|
-
const { t } =
|
|
2293
|
+
const { t } = R(), { locale: l } = T(), d = tn();
|
|
2208
2294
|
if (d.error)
|
|
2209
|
-
return /* @__PURE__ */
|
|
2210
|
-
|
|
2295
|
+
return /* @__PURE__ */ n.jsx(
|
|
2296
|
+
be,
|
|
2211
2297
|
{
|
|
2212
2298
|
message: t("profile_orders_load_failed"),
|
|
2213
2299
|
retryLabel: t("profile_orders_retry"),
|
|
@@ -2215,30 +2301,30 @@ function rn({
|
|
|
2215
2301
|
onRetry: () => void d.refetch()
|
|
2216
2302
|
}
|
|
2217
2303
|
);
|
|
2218
|
-
const u = d.data,
|
|
2304
|
+
const u = d.data, p = d.isPending ? t("profile_loading") : u ? [
|
|
2219
2305
|
u.order_number ? `#${u.order_number}` : null,
|
|
2220
|
-
|
|
2306
|
+
Xr(u.created_at, l)
|
|
2221
2307
|
].filter(Boolean).join(" · ") || t("profile_view_orders") : t("profile_no_orders");
|
|
2222
|
-
return /* @__PURE__ */
|
|
2223
|
-
|
|
2308
|
+
return /* @__PURE__ */ n.jsx(
|
|
2309
|
+
_e,
|
|
2224
2310
|
{
|
|
2225
|
-
icon:
|
|
2311
|
+
icon: Ie,
|
|
2226
2312
|
label: t("profile_latest_order"),
|
|
2227
|
-
detail:
|
|
2313
|
+
detail: p,
|
|
2228
2314
|
busy: d.isPending,
|
|
2229
2315
|
onOpen: () => e(u?.token ?? null),
|
|
2230
2316
|
triggerRef: i
|
|
2231
2317
|
}
|
|
2232
2318
|
);
|
|
2233
2319
|
}
|
|
2234
|
-
function
|
|
2320
|
+
function sn({
|
|
2235
2321
|
onOpen: e,
|
|
2236
2322
|
triggerRef: i
|
|
2237
2323
|
}) {
|
|
2238
|
-
const { t } =
|
|
2324
|
+
const { t } = R(), { locale: l } = T(), d = rn();
|
|
2239
2325
|
if (d.error)
|
|
2240
|
-
return /* @__PURE__ */
|
|
2241
|
-
|
|
2326
|
+
return /* @__PURE__ */ n.jsx(
|
|
2327
|
+
be,
|
|
2242
2328
|
{
|
|
2243
2329
|
message: t("profile_subscription_load_failed"),
|
|
2244
2330
|
retryLabel: t("profile_subscription_retry"),
|
|
@@ -2246,23 +2332,23 @@ function nn({
|
|
|
2246
2332
|
onRetry: () => void d.refetch()
|
|
2247
2333
|
}
|
|
2248
2334
|
);
|
|
2249
|
-
const u = d.data,
|
|
2335
|
+
const u = d.data, p = Zr(u?.nextBillingDate, l), g = d.isPending ? t("profile_loading") : u ? [
|
|
2250
2336
|
u.planName,
|
|
2251
|
-
|
|
2337
|
+
p ? t("profile_next_bill_on", { date: p }) : null
|
|
2252
2338
|
].filter(Boolean).join(" · ") || t("profile_view_subscriptions") : t("profile_no_next_subscription");
|
|
2253
|
-
return /* @__PURE__ */
|
|
2254
|
-
|
|
2339
|
+
return /* @__PURE__ */ n.jsx(
|
|
2340
|
+
_e,
|
|
2255
2341
|
{
|
|
2256
|
-
icon:
|
|
2342
|
+
icon: De,
|
|
2257
2343
|
label: t("profile_next_subscription"),
|
|
2258
|
-
detail:
|
|
2344
|
+
detail: g,
|
|
2259
2345
|
busy: d.isPending,
|
|
2260
2346
|
onOpen: () => e(u?.token ?? null),
|
|
2261
2347
|
triggerRef: i
|
|
2262
2348
|
}
|
|
2263
2349
|
);
|
|
2264
2350
|
}
|
|
2265
|
-
function
|
|
2351
|
+
function an({
|
|
2266
2352
|
onOpenPayment: e,
|
|
2267
2353
|
paymentTriggerRef: i,
|
|
2268
2354
|
onOpenOrder: t,
|
|
@@ -2270,20 +2356,20 @@ function sn({
|
|
|
2270
2356
|
onOpenSubscription: d,
|
|
2271
2357
|
subscriptionTriggerRef: u
|
|
2272
2358
|
}) {
|
|
2273
|
-
const { t:
|
|
2274
|
-
return /* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
2278
|
-
|
|
2359
|
+
const { t: p } = R();
|
|
2360
|
+
return /* @__PURE__ */ n.jsxs("section", { "aria-label": p("profile_at_a_glance"), className: "space-y-3", children: [
|
|
2361
|
+
/* @__PURE__ */ n.jsx("h2", { className: "text-muted-foreground text-sm font-medium", children: p("profile_at_a_glance") }),
|
|
2362
|
+
/* @__PURE__ */ n.jsxs("div", { className: "space-y-3", children: [
|
|
2363
|
+
/* @__PURE__ */ n.jsx(
|
|
2364
|
+
Wr,
|
|
2279
2365
|
{
|
|
2280
2366
|
onOpen: e,
|
|
2281
2367
|
triggerRef: i
|
|
2282
2368
|
}
|
|
2283
2369
|
),
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
/* @__PURE__ */
|
|
2286
|
-
|
|
2370
|
+
/* @__PURE__ */ n.jsx(nn, { onOpen: t, triggerRef: l }),
|
|
2371
|
+
/* @__PURE__ */ n.jsx(
|
|
2372
|
+
sn,
|
|
2287
2373
|
{
|
|
2288
2374
|
onOpen: d,
|
|
2289
2375
|
triggerRef: u
|
|
@@ -2292,46 +2378,46 @@ function sn({
|
|
|
2292
2378
|
] })
|
|
2293
2379
|
] });
|
|
2294
2380
|
}
|
|
2295
|
-
function
|
|
2381
|
+
function on({
|
|
2296
2382
|
initialLanguage: e
|
|
2297
2383
|
}) {
|
|
2298
|
-
const { t: i } =
|
|
2384
|
+
const { t: i } = R(), t = tt(), l = rt(), [d, u] = v.useState(e);
|
|
2299
2385
|
if (t.error) throw t.error;
|
|
2300
|
-
return /* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ n.jsxs(
|
|
2301
2387
|
"form",
|
|
2302
2388
|
{
|
|
2303
2389
|
className: "bg-card border-border space-y-5 rounded-xl border p-6",
|
|
2304
|
-
onSubmit: (
|
|
2305
|
-
|
|
2390
|
+
onSubmit: (p) => {
|
|
2391
|
+
p.preventDefault(), !(!d || l.isPending) && l.mutate(
|
|
2306
2392
|
{ language_iso: d },
|
|
2307
2393
|
{
|
|
2308
|
-
onSuccess: () =>
|
|
2394
|
+
onSuccess: () => ue({ title: i("profile_updated"), type: "success" })
|
|
2309
2395
|
}
|
|
2310
2396
|
);
|
|
2311
2397
|
},
|
|
2312
2398
|
children: [
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2399
|
+
/* @__PURE__ */ n.jsxs("div", { className: "space-y-2", children: [
|
|
2400
|
+
/* @__PURE__ */ n.jsx(Ct, { htmlFor: "profile-language", children: i("language") }),
|
|
2401
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-sm", children: i("profile_language_hint") }),
|
|
2402
|
+
/* @__PURE__ */ n.jsxs(
|
|
2317
2403
|
"select",
|
|
2318
2404
|
{
|
|
2319
2405
|
id: "profile-language",
|
|
2320
2406
|
className: "border-input bg-background text-foreground focus-visible:ring-ring h-10 w-full rounded-md border px-3 text-sm focus-visible:ring-2",
|
|
2321
2407
|
value: d,
|
|
2322
|
-
onChange: (
|
|
2408
|
+
onChange: (p) => u(p.target.value),
|
|
2323
2409
|
disabled: t.isPending || l.isPending,
|
|
2324
2410
|
required: !0,
|
|
2325
2411
|
children: [
|
|
2326
|
-
/* @__PURE__ */
|
|
2327
|
-
t.data?.map((
|
|
2412
|
+
/* @__PURE__ */ n.jsx("option", { value: "", children: i("select_an_option") }),
|
|
2413
|
+
t.data?.map((p) => /* @__PURE__ */ n.jsx("option", { value: p.code, children: p.name }, p.code))
|
|
2328
2414
|
]
|
|
2329
2415
|
}
|
|
2330
2416
|
)
|
|
2331
2417
|
] }),
|
|
2332
|
-
l.error && /* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
|
|
2418
|
+
l.error && /* @__PURE__ */ n.jsx("p", { role: "alert", className: "text-destructive text-sm", children: i("failed_to_update_profile") }),
|
|
2419
|
+
/* @__PURE__ */ n.jsx(
|
|
2420
|
+
E,
|
|
2335
2421
|
{
|
|
2336
2422
|
type: "submit",
|
|
2337
2423
|
disabled: !d || t.isPending || l.isPending,
|
|
@@ -2342,113 +2428,113 @@ function an({
|
|
|
2342
2428
|
}
|
|
2343
2429
|
);
|
|
2344
2430
|
}
|
|
2345
|
-
function
|
|
2346
|
-
const { t: e } =
|
|
2431
|
+
function ln() {
|
|
2432
|
+
const { t: e } = R(), i = Ae(), t = me(), { currentSlug: l, navigate: d } = de(), { preview: u } = fe(), p = at(), { locale: g } = T(), a = v.useRef(""), r = v.useRef({});
|
|
2347
2433
|
if (i.error) throw i.error;
|
|
2348
2434
|
if (t.error) throw t.error;
|
|
2349
2435
|
if (!i.data || !t.data)
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
const
|
|
2436
|
+
return /* @__PURE__ */ n.jsx("p", { role: "status", className: "text-muted-foreground p-6", children: e("profile_loading") });
|
|
2437
|
+
const s = i.data, o = `${s.first_name} ${s.last_name}`.trim() || e("account_fallback"), c = Nr(s), m = l === "profile/language", f = l === "profile/addresses", h = l === "profile/payment-methods", x = l === "profile/points", N = l === "profile/orders" || l.startsWith("profile/orders/"), C = l === "profile/subscriptions" || l.startsWith("profile/subscriptions/"), _ = N || C, w = l === "profile/orders" || l === "profile/subscriptions", M = t.data.reward_points_label_plural, k = M.charAt(0).toLocaleUpperCase(g) + M.slice(1), z = [
|
|
2352
2438
|
{
|
|
2353
2439
|
slug: "profile/information",
|
|
2354
2440
|
label: e("personal_information"),
|
|
2355
|
-
icon:
|
|
2441
|
+
icon: lr,
|
|
2356
2442
|
dialog: !0
|
|
2357
2443
|
},
|
|
2358
2444
|
{
|
|
2359
2445
|
slug: "profile/payment-methods",
|
|
2360
2446
|
label: e("payment_methods"),
|
|
2361
|
-
icon:
|
|
2447
|
+
icon: ke
|
|
2362
2448
|
},
|
|
2363
|
-
{ slug: "profile/addresses", label: e("shipping_addresses"), icon:
|
|
2449
|
+
{ slug: "profile/addresses", label: e("shipping_addresses"), icon: Jt },
|
|
2364
2450
|
{
|
|
2365
2451
|
slug: "orders",
|
|
2366
2452
|
label: e("orders"),
|
|
2367
|
-
icon:
|
|
2453
|
+
icon: Ie
|
|
2368
2454
|
},
|
|
2369
2455
|
{
|
|
2370
2456
|
slug: "subscriptions",
|
|
2371
2457
|
label: e("subscriptions"),
|
|
2372
|
-
icon:
|
|
2458
|
+
icon: De
|
|
2373
2459
|
},
|
|
2374
2460
|
{
|
|
2375
2461
|
slug: "profile/language",
|
|
2376
2462
|
label: e("language"),
|
|
2377
|
-
icon:
|
|
2378
|
-
value:
|
|
2463
|
+
icon: nr,
|
|
2464
|
+
value: s.language_iso?.toUpperCase()
|
|
2379
2465
|
},
|
|
2380
|
-
...
|
|
2466
|
+
...p.data ? [
|
|
2381
2467
|
{
|
|
2382
2468
|
slug: "profile/points",
|
|
2383
|
-
label:
|
|
2384
|
-
icon:
|
|
2385
|
-
value: new Intl.NumberFormat(
|
|
2386
|
-
|
|
2469
|
+
label: k,
|
|
2470
|
+
icon: ir,
|
|
2471
|
+
value: new Intl.NumberFormat(g).format(
|
|
2472
|
+
p.data.points_ledgers[0]?.total_balance ?? 0
|
|
2387
2473
|
)
|
|
2388
2474
|
}
|
|
2389
2475
|
] : []
|
|
2390
2476
|
];
|
|
2391
|
-
function
|
|
2392
|
-
const y =
|
|
2477
|
+
function F() {
|
|
2478
|
+
const y = a.current || l;
|
|
2393
2479
|
d("profile"), requestAnimationFrame(
|
|
2394
2480
|
() => (r.current[y] ?? r.current[l])?.focus()
|
|
2395
2481
|
);
|
|
2396
2482
|
}
|
|
2397
|
-
return /* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
_ ? /* @__PURE__ */
|
|
2400
|
-
w && /* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2483
|
+
return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
2484
|
+
/* @__PURE__ */ n.jsx(Nt, { children: /* @__PURE__ */ n.jsx("span", { className: "text-lg font-semibold", children: e("breadcrumb") }) }),
|
|
2485
|
+
_ ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
2486
|
+
w && /* @__PURE__ */ n.jsx("div", { className: "px-5 pt-6 md:px-8", children: /* @__PURE__ */ n.jsxs(E, { variant: "ghost", onClick: F, children: [
|
|
2487
|
+
/* @__PURE__ */ n.jsx(we, { "aria-hidden": "true", className: "size-4" }),
|
|
2402
2488
|
e("profile_back")
|
|
2403
2489
|
] }) }),
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
] }) : /* @__PURE__ */
|
|
2406
|
-
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2490
|
+
/* @__PURE__ */ n.jsx(zr, { children: N ? /* @__PURE__ */ n.jsx(Mt, {}) : /* @__PURE__ */ n.jsx(Dr, {}) })
|
|
2491
|
+
] }) : /* @__PURE__ */ n.jsxs("main", { className: "mx-auto w-full max-w-3xl space-y-8 p-4 sm:p-8", children: [
|
|
2492
|
+
m || f || x || h ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
2493
|
+
/* @__PURE__ */ n.jsxs(E, { variant: "ghost", onClick: F, children: [
|
|
2494
|
+
/* @__PURE__ */ n.jsx(we, { "aria-hidden": "true", className: "size-4" }),
|
|
2409
2495
|
e("profile_back")
|
|
2410
2496
|
] }),
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
|
|
2497
|
+
/* @__PURE__ */ n.jsx("h1", { className: "text-2xl font-semibold", children: x ? k : e(
|
|
2498
|
+
h ? "payment_methods" : f ? "shipping_addresses" : "language"
|
|
2413
2499
|
) }),
|
|
2414
|
-
|
|
2415
|
-
] }) : /* @__PURE__ */
|
|
2416
|
-
/* @__PURE__ */
|
|
2500
|
+
h ? /* @__PURE__ */ n.jsx(Yr, {}) : f ? /* @__PURE__ */ n.jsx($r, {}) : x ? /* @__PURE__ */ n.jsx(qr, {}) : /* @__PURE__ */ n.jsx(on, { initialLanguage: s.language_iso ?? "" })
|
|
2501
|
+
] }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
2502
|
+
/* @__PURE__ */ n.jsxs(
|
|
2417
2503
|
"section",
|
|
2418
2504
|
{
|
|
2419
2505
|
"aria-label": e("personal_information"),
|
|
2420
2506
|
className: c ? "bg-card text-card-foreground border-border rounded-2xl border p-6" : "py-4",
|
|
2421
2507
|
children: [
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4 sm:gap-6", children: [
|
|
2509
|
+
/* @__PURE__ */ n.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
2510
|
+
/* @__PURE__ */ n.jsxs(vr, { className: "size-12 shrink-0 sm:size-16", children: [
|
|
2511
|
+
/* @__PURE__ */ n.jsx(
|
|
2426
2512
|
yr,
|
|
2427
2513
|
{
|
|
2428
|
-
src:
|
|
2514
|
+
src: s.avatar_url ?? void 0,
|
|
2429
2515
|
alt: ""
|
|
2430
2516
|
}
|
|
2431
2517
|
),
|
|
2432
|
-
/* @__PURE__ */
|
|
2518
|
+
/* @__PURE__ */ n.jsx(jr, { children: `${s.first_name[0] ?? ""}${s.last_name[0] ?? ""}` })
|
|
2433
2519
|
] }),
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
c && /* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2520
|
+
/* @__PURE__ */ n.jsxs("div", { className: "min-w-0 space-y-1", children: [
|
|
2521
|
+
c && /* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-xs font-medium", children: e("member_of", { company: t.data.name }) }),
|
|
2522
|
+
/* @__PURE__ */ n.jsx("h1", { className: "text-xl font-semibold tracking-tight break-words sm:text-2xl", children: o }),
|
|
2523
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground text-sm break-all", children: s.email })
|
|
2438
2524
|
] })
|
|
2439
2525
|
] }),
|
|
2440
|
-
c &&
|
|
2526
|
+
c && s.mysite_url && /* @__PURE__ */ n.jsx(
|
|
2441
2527
|
"a",
|
|
2442
2528
|
{
|
|
2443
|
-
href:
|
|
2529
|
+
href: s.mysite_url,
|
|
2444
2530
|
target: "_blank",
|
|
2445
2531
|
rel: "noopener noreferrer",
|
|
2446
2532
|
"aria-label": e("profile_qr_code"),
|
|
2447
2533
|
className: "bg-background text-foreground border-border focus-visible:ring-ring rounded-lg border p-2 focus-visible:ring-2",
|
|
2448
|
-
children: /* @__PURE__ */
|
|
2449
|
-
|
|
2534
|
+
children: /* @__PURE__ */ n.jsx(
|
|
2535
|
+
et,
|
|
2450
2536
|
{
|
|
2451
|
-
value:
|
|
2537
|
+
value: s.mysite_url,
|
|
2452
2538
|
size: 80,
|
|
2453
2539
|
bgColor: "var(--background)",
|
|
2454
2540
|
fgColor: "var(--foreground)"
|
|
@@ -2457,17 +2543,17 @@ function on() {
|
|
|
2457
2543
|
}
|
|
2458
2544
|
)
|
|
2459
2545
|
] }),
|
|
2460
|
-
|
|
2546
|
+
s.bio && /* @__PURE__ */ n.jsx("p", { className: "text-muted-foreground mt-5 text-sm leading-relaxed", children: s.bio })
|
|
2461
2547
|
]
|
|
2462
2548
|
}
|
|
2463
2549
|
),
|
|
2464
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ n.jsxs(
|
|
2465
2551
|
"section",
|
|
2466
2552
|
{
|
|
2467
2553
|
"aria-labelledby": "profile-preferences",
|
|
2468
2554
|
className: "space-y-3",
|
|
2469
2555
|
children: [
|
|
2470
|
-
/* @__PURE__ */
|
|
2556
|
+
/* @__PURE__ */ n.jsx(
|
|
2471
2557
|
"h2",
|
|
2472
2558
|
{
|
|
2473
2559
|
id: "profile-preferences",
|
|
@@ -2475,25 +2561,25 @@ function on() {
|
|
|
2475
2561
|
children: e("account_preferences")
|
|
2476
2562
|
}
|
|
2477
2563
|
),
|
|
2478
|
-
/* @__PURE__ */
|
|
2564
|
+
/* @__PURE__ */ n.jsx("div", { className: "border-border divide-border divide-y overflow-hidden rounded-xl border", children: z.map((y) => /* @__PURE__ */ n.jsxs(
|
|
2479
2565
|
"button",
|
|
2480
2566
|
{
|
|
2481
2567
|
type: "button",
|
|
2482
|
-
ref: (
|
|
2483
|
-
r.current[y.slug] =
|
|
2568
|
+
ref: (D) => {
|
|
2569
|
+
r.current[y.slug] = D;
|
|
2484
2570
|
},
|
|
2485
2571
|
"aria-haspopup": y.dialog ? "dialog" : void 0,
|
|
2486
2572
|
"aria-expanded": y.dialog ? l === y.slug : void 0,
|
|
2487
2573
|
onClick: () => {
|
|
2488
|
-
|
|
2574
|
+
a.current = y.slug, d(y.slug);
|
|
2489
2575
|
},
|
|
2490
2576
|
className: "bg-card text-card-foreground hover:bg-muted focus-visible:ring-ring flex min-h-16 w-full items-center gap-4 px-5 py-4 text-left focus-visible:ring-2",
|
|
2491
2577
|
children: [
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
y.value && /* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2496
|
-
|
|
2578
|
+
/* @__PURE__ */ n.jsx(y.icon, { "aria-hidden": "true", className: "size-5" }),
|
|
2579
|
+
/* @__PURE__ */ n.jsx("span", { className: "flex-1 font-medium", children: y.label }),
|
|
2580
|
+
y.value && /* @__PURE__ */ n.jsx("span", { className: "text-muted-foreground text-sm tabular-nums", children: y.value }),
|
|
2581
|
+
/* @__PURE__ */ n.jsx(
|
|
2582
|
+
Me,
|
|
2497
2583
|
{
|
|
2498
2584
|
"aria-hidden": "true",
|
|
2499
2585
|
className: "text-muted-foreground size-4"
|
|
@@ -2506,44 +2592,44 @@ function on() {
|
|
|
2506
2592
|
]
|
|
2507
2593
|
}
|
|
2508
2594
|
),
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
|
|
2595
|
+
/* @__PURE__ */ n.jsx(
|
|
2596
|
+
an,
|
|
2511
2597
|
{
|
|
2512
2598
|
paymentTriggerRef: (y) => {
|
|
2513
2599
|
r.current["profile/default-payment"] = y;
|
|
2514
2600
|
},
|
|
2515
2601
|
onOpenPayment: () => {
|
|
2516
|
-
|
|
2602
|
+
a.current = "profile/default-payment", d("profile/payment-methods");
|
|
2517
2603
|
},
|
|
2518
2604
|
orderTriggerRef: (y) => {
|
|
2519
2605
|
r.current["profile/latest-order"] = y;
|
|
2520
2606
|
},
|
|
2521
2607
|
onOpenOrder: (y) => {
|
|
2522
|
-
|
|
2608
|
+
a.current = "profile/latest-order", d(y ? `orders/${y}` : "orders");
|
|
2523
2609
|
},
|
|
2524
2610
|
subscriptionTriggerRef: (y) => {
|
|
2525
2611
|
r.current["profile/next-subscription"] = y;
|
|
2526
2612
|
},
|
|
2527
2613
|
onOpenSubscription: (y) => {
|
|
2528
|
-
|
|
2614
|
+
a.current = "profile/next-subscription", d(y ? `subscriptions/${y}` : "subscriptions");
|
|
2529
2615
|
}
|
|
2530
2616
|
}
|
|
2531
2617
|
),
|
|
2532
|
-
|
|
2618
|
+
p.error && /* @__PURE__ */ n.jsxs(
|
|
2533
2619
|
"div",
|
|
2534
2620
|
{
|
|
2535
2621
|
role: "alert",
|
|
2536
2622
|
className: "border-border space-y-3 rounded-xl border p-4",
|
|
2537
2623
|
children: [
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
|
|
2624
|
+
/* @__PURE__ */ n.jsx("p", { className: "text-sm", children: e("profile_points_load_failed") }),
|
|
2625
|
+
/* @__PURE__ */ n.jsx(
|
|
2626
|
+
E,
|
|
2541
2627
|
{
|
|
2542
2628
|
variant: "outline",
|
|
2543
2629
|
size: "sm",
|
|
2544
|
-
disabled:
|
|
2630
|
+
disabled: p.isFetching,
|
|
2545
2631
|
onClick: () => {
|
|
2546
|
-
|
|
2632
|
+
p.refetch().then((y) => {
|
|
2547
2633
|
y.isSuccess && requestAnimationFrame(
|
|
2548
2634
|
() => (r.current["profile/points"] ?? r.current["profile/information"])?.focus()
|
|
2549
2635
|
);
|
|
@@ -2555,7 +2641,7 @@ function on() {
|
|
|
2555
2641
|
]
|
|
2556
2642
|
}
|
|
2557
2643
|
),
|
|
2558
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ n.jsxs(
|
|
2559
2645
|
"a",
|
|
2560
2646
|
{
|
|
2561
2647
|
href: u ? void 0 : new URL("/auth/sign_out", window.location.origin).href,
|
|
@@ -2563,19 +2649,19 @@ function on() {
|
|
|
2563
2649
|
tabIndex: u ? -1 : void 0,
|
|
2564
2650
|
className: "text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-h-11 items-center gap-3 rounded-md px-1 text-sm focus-visible:ring-2",
|
|
2565
2651
|
children: [
|
|
2566
|
-
/* @__PURE__ */
|
|
2652
|
+
/* @__PURE__ */ n.jsx(er, { "aria-hidden": "true", className: "size-4" }),
|
|
2567
2653
|
e("sign_out")
|
|
2568
2654
|
]
|
|
2569
2655
|
}
|
|
2570
2656
|
)
|
|
2571
2657
|
] }),
|
|
2572
|
-
l === "profile/information" && /* @__PURE__ */
|
|
2658
|
+
l === "profile/information" && /* @__PURE__ */ n.jsx(Tr, { account: s, onClose: F })
|
|
2573
2659
|
] })
|
|
2574
2660
|
] });
|
|
2575
2661
|
}
|
|
2576
|
-
function
|
|
2577
|
-
return /* @__PURE__ */
|
|
2662
|
+
function Cn() {
|
|
2663
|
+
return /* @__PURE__ */ n.jsx(At, { children: /* @__PURE__ */ n.jsx(ln, {}) });
|
|
2578
2664
|
}
|
|
2579
2665
|
export {
|
|
2580
|
-
|
|
2666
|
+
Cn as default
|
|
2581
2667
|
};
|