@fluid-app/portal-sdk 0.1.244 → 0.1.246
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/dist/{AppDownloadScreen-DQR40F0y.mjs → AppDownloadScreen-DPnbWP5G.mjs} +1 -1
- package/dist/{AppDownloadScreen-DQR40F0y.mjs.map → AppDownloadScreen-DPnbWP5G.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-BXnl23_d.cjs → AppDownloadScreen-Og_iMsw5.cjs} +1 -1
- package/dist/{AppDownloadScreen-BXnl23_d.cjs.map → AppDownloadScreen-Og_iMsw5.cjs.map} +1 -1
- package/dist/{AppNavigationContext-C1-hd9Rw.cjs → AppNavigationContext-BDs1cOuG.cjs} +1 -1
- package/dist/{AppNavigationContext-C1-hd9Rw.cjs.map → AppNavigationContext-BDs1cOuG.cjs.map} +1 -1
- package/dist/{AppNavigationContext-Dvc0yoZF.mjs → AppNavigationContext-DNod9mf6.mjs} +1 -1
- package/dist/{AppNavigationContext-Dvc0yoZF.mjs.map → AppNavigationContext-DNod9mf6.mjs.map} +1 -1
- package/dist/{ContactsScreen-Cj0_VI0d.cjs → ContactsScreen-CZ2hrMqf.cjs} +6 -6
- package/dist/{ContactsScreen-Cj0_VI0d.cjs.map → ContactsScreen-CZ2hrMqf.cjs.map} +1 -1
- package/dist/{ContactsScreen-CMBERzKU.mjs → ContactsScreen-DuhDzRtI.mjs} +6 -6
- package/dist/{ContactsScreen-CMBERzKU.mjs.map → ContactsScreen-DuhDzRtI.mjs.map} +1 -1
- package/dist/{ContactsScreen-CH_P8WxC.cjs → ContactsScreen-Dv1SJNBo.cjs} +5 -5
- package/dist/{InfiniteScrollSentinel-DeIL8UkW.cjs → InfiniteScrollSentinel-BaPx1tjC.cjs} +1 -1
- package/dist/{InfiniteScrollSentinel-DeIL8UkW.cjs.map → InfiniteScrollSentinel-BaPx1tjC.cjs.map} +1 -1
- package/dist/{InfiniteScrollSentinel-B_clNL9Y.mjs → InfiniteScrollSentinel-D0XRJi51.mjs} +1 -1
- package/dist/{InfiniteScrollSentinel-B_clNL9Y.mjs.map → InfiniteScrollSentinel-D0XRJi51.mjs.map} +1 -1
- package/dist/{MessagingScreen-KYx6DSMx.cjs → MessagingScreen-BwI0RShj.cjs} +3 -3
- package/dist/{MessagingScreen-vb5P-7jP.mjs → MessagingScreen-DiSZ7fyd.mjs} +3 -3
- package/dist/{MessagingScreen-vb5P-7jP.mjs.map → MessagingScreen-DiSZ7fyd.mjs.map} +1 -1
- package/dist/{MessagingScreen-CCbgNRp1.cjs → MessagingScreen-WCeHWGlX.cjs} +5 -5
- package/dist/{MessagingScreen-CCbgNRp1.cjs.map → MessagingScreen-WCeHWGlX.cjs.map} +1 -1
- package/dist/{MySiteScreen-B_16cPgD.cjs → MySiteScreen-Bdd7a6Hy.cjs} +3 -2
- package/dist/MySiteScreen-CK84vXa9.mjs +301 -0
- package/dist/MySiteScreen-CK84vXa9.mjs.map +1 -0
- package/dist/MySiteScreen-zfajm9da.cjs +309 -0
- package/dist/MySiteScreen-zfajm9da.cjs.map +1 -0
- package/dist/{OrdersScreen-CQGCZLYf.cjs → OrdersScreen-BLs1xTv7.cjs} +4 -4
- package/dist/{OrdersScreen-BxaJw-Kq.cjs → OrdersScreen-BbS7Alby.cjs} +3 -3
- package/dist/{OrdersScreen-BxaJw-Kq.cjs.map → OrdersScreen-BbS7Alby.cjs.map} +1 -1
- package/dist/{OrdersScreen-CPKRShbP.mjs → OrdersScreen-b-ZC4_NI.mjs} +3 -3
- package/dist/{OrdersScreen-CPKRShbP.mjs.map → OrdersScreen-b-ZC4_NI.mjs.map} +1 -1
- package/dist/{PortalProductsApiProvider-BIZg_c4Y.mjs → PortalProductsApiProvider-BFdHFvog.mjs} +1 -1
- package/dist/{PortalProductsApiProvider-BIZg_c4Y.mjs.map → PortalProductsApiProvider-BFdHFvog.mjs.map} +1 -1
- package/dist/{PortalProductsApiProvider-DL8nl7To.cjs → PortalProductsApiProvider-CkS7OIGt.cjs} +1 -1
- package/dist/{PortalProductsApiProvider-DL8nl7To.cjs.map → PortalProductsApiProvider-CkS7OIGt.cjs.map} +1 -1
- package/dist/{ProfileScreen-BT0iys-q.cjs → ProfileScreen-BfvdQa0q.cjs} +114 -33
- package/dist/ProfileScreen-BfvdQa0q.cjs.map +1 -0
- package/dist/{ProfileScreen-CZAIUM2a.mjs → ProfileScreen-CRLf8oDe.mjs} +116 -35
- package/dist/ProfileScreen-CRLf8oDe.mjs.map +1 -0
- package/dist/{ProfileScreen-CKcdtroU.cjs → ProfileScreen-Za3ZIWPO.cjs} +4 -2
- package/dist/{SearchSort-CeJqRK2c.cjs → SearchSort-BP2ktxyN.cjs} +1 -1
- package/dist/{SearchSort-CeJqRK2c.cjs.map → SearchSort-BP2ktxyN.cjs.map} +1 -1
- package/dist/{SearchSort-CFHU38Er.mjs → SearchSort-CokMCrhy.mjs} +1 -1
- package/dist/{SearchSort-CFHU38Er.mjs.map → SearchSort-CokMCrhy.mjs.map} +1 -1
- package/dist/{ShareablesScreen-sieWBlAl.mjs → ShareablesScreen-BZZ-RT71.mjs} +8 -8
- package/dist/{ShareablesScreen-sieWBlAl.mjs.map → ShareablesScreen-BZZ-RT71.mjs.map} +1 -1
- package/dist/{ShareablesScreen-A69L0Nok.cjs → ShareablesScreen-BxOKbuuU.cjs} +20 -20
- package/dist/{ShareablesScreen-A69L0Nok.cjs.map → ShareablesScreen-BxOKbuuU.cjs.map} +1 -1
- package/dist/{ShareablesScreen-BUYG-mjj.cjs → ShareablesScreen-CsDxLODp.cjs} +7 -7
- package/dist/{ShopScreen-sLUTgIcQ.mjs → ShopScreen-BG1pxd2D.mjs} +4 -4
- package/dist/{ShopScreen-sLUTgIcQ.mjs.map → ShopScreen-BG1pxd2D.mjs.map} +1 -1
- package/dist/{ShopScreen-DVpCo-OV.cjs → ShopScreen-BigHJ5wE.cjs} +3 -3
- package/dist/{ShopScreen-Dm85_rMp.cjs → ShopScreen-S6rBaoWM.cjs} +4 -4
- package/dist/{ShopScreen-Dm85_rMp.cjs.map → ShopScreen-S6rBaoWM.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DrDSwMXS.cjs → SubscriptionsScreen-B88_dLfE.cjs} +9 -9
- package/dist/{SubscriptionsScreen-DrDSwMXS.cjs.map → SubscriptionsScreen-B88_dLfE.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-CXM2zmF7.mjs → SubscriptionsScreen-DK9-h3Cz.mjs} +8 -8
- package/dist/{SubscriptionsScreen-CXM2zmF7.mjs.map → SubscriptionsScreen-DK9-h3Cz.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-t5wtDGfB.cjs → SubscriptionsScreen-dhnfYn4L.cjs} +5 -5
- package/dist/{UpgradeScreen-DUvg-WZv.cjs → UpgradeScreen-Bl9lb32K.cjs} +1 -1
- package/dist/{UpgradeScreen-DAKe_hiv.cjs → UpgradeScreen-C-hFDAR2.cjs} +1 -1
- package/dist/{UpgradeScreen-DAKe_hiv.cjs.map → UpgradeScreen-C-hFDAR2.cjs.map} +1 -1
- package/dist/{UpgradeScreen-DnGnWVTf.mjs → UpgradeScreen-X6j0_625.mjs} +1 -1
- package/dist/{UpgradeScreen-DnGnWVTf.mjs.map → UpgradeScreen-X6j0_625.mjs.map} +1 -1
- package/dist/{MySiteScreen-CUyJteDm.cjs → components-BKADyCYp.cjs} +42 -466
- package/dist/components-BKADyCYp.cjs.map +1 -0
- package/dist/{MySiteScreen-CN0ZDBgy.mjs → components-CjgEvBYG.mjs} +6 -470
- package/dist/components-CjgEvBYG.mjs.map +1 -0
- package/dist/{dist-PbA1vxAz.mjs → dist-BstXVe25.mjs} +1 -1
- package/dist/{dist-PbA1vxAz.mjs.map → dist-BstXVe25.mjs.map} +1 -1
- package/dist/{dist-o2cjwzIa.mjs → dist-CTLDCXCc.mjs} +2 -2
- package/dist/{dist-o2cjwzIa.mjs.map → dist-CTLDCXCc.mjs.map} +1 -1
- package/dist/{dist-BQZkLGL6.cjs → dist-DJAHGHHi.cjs} +1 -19
- package/dist/{dist-BQZkLGL6.cjs.map → dist-DJAHGHHi.cjs.map} +1 -1
- package/dist/{dist-DbRTQ2QF.cjs → dist-D_3_ZuC5.cjs} +1 -1
- package/dist/{dist-DbRTQ2QF.cjs.map → dist-D_3_ZuC5.cjs.map} +1 -1
- package/dist/{dist-myuZC8sf.cjs → dist-vhBaFZ9L.cjs} +2 -2
- package/dist/{dist-myuZC8sf.cjs.map → dist-vhBaFZ9L.cjs.map} +1 -1
- package/dist/{es-UfEBhcZD.cjs → es-B5heQ57j.cjs} +1 -1
- package/dist/{es-UfEBhcZD.cjs.map → es-B5heQ57j.cjs.map} +1 -1
- package/dist/{fluid-pay-api-adapter-eNT8m0xB.mjs → fluid-pay-api-adapter-CJ7-I8k-.mjs} +673 -381
- package/dist/fluid-pay-api-adapter-CJ7-I8k-.mjs.map +1 -0
- package/dist/{fluid-pay-api-adapter-BszgrFL6.cjs → fluid-pay-api-adapter-D63KLi5c.cjs} +700 -378
- package/dist/fluid-pay-api-adapter-D63KLi5c.cjs.map +1 -0
- package/dist/{format-CytB2M00.cjs → format-CLUjV1oR.cjs} +1 -1
- package/dist/{format-CytB2M00.cjs.map → format-CLUjV1oR.cjs.map} +1 -1
- package/dist/index.cjs +123 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +122 -171
- package/dist/index.mjs.map +1 -1
- package/dist/{order-status-badge-DHyaK6mU.cjs → order-status-badge-BKvLeVsM.cjs} +3 -3
- package/dist/{order-status-badge-DHyaK6mU.cjs.map → order-status-badge-BKvLeVsM.cjs.map} +1 -1
- package/dist/{order-status-badge-Dmo8lLnt.mjs → order-status-badge-xuJ732eH.mjs} +3 -3
- package/dist/{order-status-badge-Dmo8lLnt.mjs.map → order-status-badge-xuJ732eH.mjs.map} +1 -1
- package/dist/{query-keys-oQKvV4jp.mjs → query-keys-8SVs82aF.mjs} +1 -1
- package/dist/{query-keys-elu0svUd.cjs.map → query-keys-8SVs82aF.mjs.map} +1 -1
- package/dist/{query-keys-elu0svUd.cjs → query-keys-e9EEoWxN.cjs} +1 -1
- package/dist/{query-keys-oQKvV4jp.mjs.map → query-keys-e9EEoWxN.cjs.map} +1 -1
- package/dist/{sortable.esm-C8G00cCP.mjs → sortable.esm-C8riJ_zv.mjs} +2 -14
- package/dist/{sortable.esm-C8G00cCP.mjs.map → sortable.esm-C8riJ_zv.mjs.map} +1 -1
- package/dist/{use-account-C1X-VLY-.cjs → use-account-D6Z9hkDX.cjs} +2 -2
- package/dist/{use-account-C1X-VLY-.cjs.map → use-account-D6Z9hkDX.cjs.map} +1 -1
- package/dist/{use-account-C76sphlu.mjs → use-account-DsTz5BlS.mjs} +2 -2
- package/dist/{use-account-C76sphlu.mjs.map → use-account-DsTz5BlS.mjs.map} +1 -1
- package/package.json +18 -17
- package/styles/packages.css +1 -0
- package/dist/MySiteScreen-CN0ZDBgy.mjs.map +0 -1
- package/dist/MySiteScreen-CUyJteDm.cjs.map +0 -1
- package/dist/ProfileScreen-BT0iys-q.cjs.map +0 -1
- package/dist/ProfileScreen-CZAIUM2a.mjs.map +0 -1
- package/dist/fluid-pay-api-adapter-BszgrFL6.cjs.map +0 -1
- package/dist/fluid-pay-api-adapter-eNT8m0xB.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as parseApiErrors } from "./parse-api-errors-CVZhXH-a.mjs";
|
|
2
|
-
import { $ as DropdownMenuSeparator, A as Select, An as Accordion, C as Skeleton, Dn as Button, Fn as cn, J as DropdownMenuContent, K as Label, L as Input, M as SelectItem, Mn as AccordionItem, N as SelectTrigger, Nn as AccordionTrigger, P as SelectValue, Pn as useZodForm, Y as DropdownMenuItem, _n as AvatarFallback, at as DialogClose, b as fluidToast, ct as DialogFooter, ft as DialogTitle, gn as Avatar, it as Dialog, j as SelectContent, jn as AccordionContent, lt as DialogHeader, ot as DialogContent, q as DropdownMenu, rt as DropdownMenuTrigger } from "./src-pgBBOcJa.mjs";
|
|
2
|
+
import { $ as DropdownMenuSeparator, A as Select, An as Accordion, At as CardTitle, C as Skeleton, Dn as Button, Et as CardContent, Fn as cn, J as DropdownMenuContent, K as Label, L as Input, M as SelectItem, Mn as AccordionItem, N as SelectTrigger, Nn as AccordionTrigger, P as SelectValue, Pn as useZodForm, Tt as CardAction, Y as DropdownMenuItem, _n as AvatarFallback, at as DialogClose, b as fluidToast, ct as DialogFooter, ft as DialogTitle, gn as Avatar, it as Dialog, j as SelectContent, jn as AccordionContent, kt as CardHeader, lt as DialogHeader, ot as DialogContent, q as DropdownMenu, rt as DropdownMenuTrigger, s as Textarea, wt as Card } from "./src-pgBBOcJa.mjs";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import "@tanstack/react-query";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Info
|
|
6
|
+
import { Info } from "lucide-react";
|
|
7
7
|
import { Controller, useController, useWatch } from "react-hook-form";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
//#region ../../profile/core/src/context.ts
|
|
@@ -286,15 +286,14 @@ function useCountryStates() {
|
|
|
286
286
|
}
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region ../../profile/ui/src/components/ellipses-dropdown.tsx
|
|
289
|
-
function EllipsesDropdown({ onDelete, onEdit, editLabel = "Edit", deleteLabel = "Delete", disabled = false }) {
|
|
289
|
+
function EllipsesDropdown({ onDelete, onEdit, onMakeDefault, editLabel = "Edit", deleteLabel = "Delete", makeDefaultLabel = "Make Default", disabled = false }) {
|
|
290
290
|
if (disabled) return /* @__PURE__ */ jsx(Button, {
|
|
291
291
|
variant: "ghost",
|
|
292
292
|
disabled: true,
|
|
293
|
-
className: "cursor-not-allowed opacity-50",
|
|
294
293
|
children: /* @__PURE__ */ jsx("svg", {
|
|
295
294
|
xmlns: "http://www.w3.org/2000/svg",
|
|
296
295
|
viewBox: "0 0 128 512",
|
|
297
|
-
className: "h-4 w-1
|
|
296
|
+
className: "fill-muted-foreground h-4 w-1",
|
|
298
297
|
children: /* @__PURE__ */ jsx("path", { d: "M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z" })
|
|
299
298
|
})
|
|
300
299
|
});
|
|
@@ -305,37 +304,74 @@ function EllipsesDropdown({ onDelete, onEdit, editLabel = "Edit", deleteLabel =
|
|
|
305
304
|
children: /* @__PURE__ */ jsx("svg", {
|
|
306
305
|
xmlns: "http://www.w3.org/2000/svg",
|
|
307
306
|
viewBox: "0 0 128 512",
|
|
308
|
-
className: "h-4 w-1
|
|
307
|
+
className: "fill-muted-foreground h-4 w-1",
|
|
309
308
|
children: /* @__PURE__ */ jsx("path", { d: "M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z" })
|
|
310
309
|
})
|
|
311
310
|
})
|
|
312
311
|
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
313
|
-
className: "min-w-
|
|
314
|
-
children: [
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
e
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
312
|
+
className: "text-foreground min-w-28 space-y-1 text-sm",
|
|
313
|
+
children: [
|
|
314
|
+
onEdit && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
315
|
+
className: "hover:bg-muted flex cursor-pointer flex-row items-center gap-x-2 rounded px-2",
|
|
316
|
+
onClick: (e) => {
|
|
317
|
+
e.stopPropagation();
|
|
318
|
+
onEdit();
|
|
319
|
+
},
|
|
320
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
321
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
322
|
+
fill: "none",
|
|
323
|
+
viewBox: "0 0 24 24",
|
|
324
|
+
strokeWidth: 1.5,
|
|
325
|
+
stroke: "currentColor",
|
|
326
|
+
className: "h-3.5 w-3.5 flex-shrink-0",
|
|
327
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
328
|
+
strokeLinecap: "round",
|
|
329
|
+
strokeLinejoin: "round",
|
|
330
|
+
d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"
|
|
331
|
+
})
|
|
332
|
+
}), /* @__PURE__ */ jsx("span", { children: editLabel })]
|
|
333
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
334
|
+
onMakeDefault && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
335
|
+
className: "hover:bg-muted flex cursor-pointer flex-row items-center gap-x-2 rounded px-2",
|
|
336
|
+
onClick: (e) => {
|
|
337
|
+
e.stopPropagation();
|
|
338
|
+
onMakeDefault();
|
|
339
|
+
},
|
|
340
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
342
|
+
fill: "none",
|
|
343
|
+
viewBox: "0 0 24 24",
|
|
344
|
+
strokeWidth: 1.5,
|
|
345
|
+
stroke: "currentColor",
|
|
346
|
+
className: "h-3.5 w-3.5 flex-shrink-0",
|
|
347
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
348
|
+
strokeLinecap: "round",
|
|
349
|
+
strokeLinejoin: "round",
|
|
350
|
+
d: "m4.5 12.75 6 6 9-13.5"
|
|
351
|
+
})
|
|
352
|
+
}), /* @__PURE__ */ jsx("span", { children: makeDefaultLabel })]
|
|
353
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
354
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
355
|
+
className: "text-destructive hover:bg-destructive/10 flex cursor-pointer flex-row items-center gap-x-2 rounded px-2",
|
|
356
|
+
onClick: (e) => {
|
|
357
|
+
e.stopPropagation();
|
|
358
|
+
onDelete?.();
|
|
359
|
+
},
|
|
360
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
361
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
362
|
+
fill: "none",
|
|
363
|
+
viewBox: "0 0 24 24",
|
|
364
|
+
strokeWidth: 1.5,
|
|
365
|
+
stroke: "currentColor",
|
|
366
|
+
className: "h-3.5 w-3.5 flex-shrink-0",
|
|
367
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
368
|
+
strokeLinecap: "round",
|
|
369
|
+
strokeLinejoin: "round",
|
|
370
|
+
d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"
|
|
371
|
+
})
|
|
372
|
+
}), /* @__PURE__ */ jsx("span", { children: deleteLabel })]
|
|
373
|
+
})
|
|
374
|
+
]
|
|
339
375
|
})] });
|
|
340
376
|
}
|
|
341
377
|
//#endregion
|
|
@@ -346,24 +382,24 @@ function ConfirmActionDialog({ title, description, onAction, openDialog, setOpen
|
|
|
346
382
|
open: openDialog,
|
|
347
383
|
onOpenChange: setOpenDialog,
|
|
348
384
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
349
|
-
className: "max-w-sm
|
|
385
|
+
className: "max-w-sm md:w-90",
|
|
350
386
|
children: [
|
|
351
387
|
/* @__PURE__ */ jsx(DialogHeader, {
|
|
352
388
|
className: "flex flex-row justify-between",
|
|
353
389
|
children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
354
|
-
className: "
|
|
390
|
+
className: "w-full text-left",
|
|
355
391
|
children: title
|
|
356
392
|
})
|
|
357
393
|
}),
|
|
358
394
|
/* @__PURE__ */ jsx("div", {
|
|
359
395
|
className: "space-y-4",
|
|
360
396
|
children: /* @__PURE__ */ jsx("p", {
|
|
361
|
-
className: "text-
|
|
397
|
+
className: "text-muted-foreground text-left text-sm",
|
|
362
398
|
children: description
|
|
363
399
|
})
|
|
364
400
|
}),
|
|
365
401
|
errorMsg && /* @__PURE__ */ jsx("p", {
|
|
366
|
-
className: "text-
|
|
402
|
+
className: "text-destructive text-sm",
|
|
367
403
|
children: errorMsg
|
|
368
404
|
}),
|
|
369
405
|
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -371,16 +407,18 @@ function ConfirmActionDialog({ title, description, onAction, openDialog, setOpen
|
|
|
371
407
|
children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
372
408
|
asChild: true,
|
|
373
409
|
children: /* @__PURE__ */ jsx(Button, {
|
|
374
|
-
|
|
410
|
+
variant: "secondary",
|
|
411
|
+
className: "min-w-[70px]",
|
|
375
412
|
onClick: () => setOpenDialog(false),
|
|
376
413
|
children: t("cancel")
|
|
377
414
|
})
|
|
378
415
|
}), /* @__PURE__ */ jsx(Button, {
|
|
379
416
|
type: "button",
|
|
380
|
-
|
|
417
|
+
variant: "destructive",
|
|
418
|
+
className: "min-w-[70px]",
|
|
381
419
|
onClick: onAction,
|
|
382
420
|
disabled: isLoading,
|
|
383
|
-
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-
|
|
421
|
+
children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : actionText
|
|
384
422
|
})]
|
|
385
423
|
}) })
|
|
386
424
|
]
|
|
@@ -388,6 +426,34 @@ function ConfirmActionDialog({ title, description, onAction, openDialog, setOpen
|
|
|
388
426
|
});
|
|
389
427
|
}
|
|
390
428
|
//#endregion
|
|
429
|
+
//#region ../../profile/ui/src/components/animated-expand.tsx
|
|
430
|
+
const DEFAULT_DURATION_MS = 500;
|
|
431
|
+
function useReducedMotion() {
|
|
432
|
+
const [reduced, setReduced] = useState(() => typeof window !== "undefined" && window.matchMedia ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : false);
|
|
433
|
+
useEffect(() => {
|
|
434
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
435
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
436
|
+
const onChange = (e) => setReduced(e.matches);
|
|
437
|
+
mql.addEventListener("change", onChange);
|
|
438
|
+
return () => mql.removeEventListener("change", onChange);
|
|
439
|
+
}, []);
|
|
440
|
+
return reduced;
|
|
441
|
+
}
|
|
442
|
+
function AnimatedExpand({ open, durationMs = DEFAULT_DURATION_MS, children }) {
|
|
443
|
+
const effectiveDuration = useReducedMotion() ? 0 : durationMs;
|
|
444
|
+
return /* @__PURE__ */ jsx("div", {
|
|
445
|
+
style: {
|
|
446
|
+
display: "grid",
|
|
447
|
+
gridTemplateRows: open ? "1fr" : "0fr",
|
|
448
|
+
transition: `grid-template-rows ${effectiveDuration}ms cubic-bezier(0.4,0,0.2,1)`
|
|
449
|
+
},
|
|
450
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
451
|
+
style: { overflow: "hidden" },
|
|
452
|
+
children
|
|
453
|
+
})
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
391
457
|
//#region ../../profile/ui/src/components/customer-points-ledger.tsx
|
|
392
458
|
function formatTransactionType(ledger, t) {
|
|
393
459
|
const transactionType = ledger.metadata.transaction_type;
|
|
@@ -416,91 +482,65 @@ function CustomerPointsLedger({ pointsLedger, isLoading = false }) {
|
|
|
416
482
|
const [accordionValue, setAccordionValue] = useState("");
|
|
417
483
|
const { t } = useProfileUI();
|
|
418
484
|
const availablePoints = pointsLedger[0]?.total_balance ?? 0;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
className: "
|
|
485
|
+
const isExpanded = accordionValue === "points-history";
|
|
486
|
+
return /* @__PURE__ */ jsx(Accordion, {
|
|
487
|
+
type: "single",
|
|
488
|
+
collapsible: true,
|
|
489
|
+
value: accordionValue,
|
|
490
|
+
onValueChange: setAccordionValue,
|
|
491
|
+
children: /* @__PURE__ */ jsx(AccordionItem, {
|
|
492
|
+
value: "points-history",
|
|
493
|
+
className: "border-0",
|
|
494
|
+
children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: t("points_history") }), pointsLedger.length > 0 && /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(AccordionTrigger, { className: "[&>svg]:text-muted-foreground" }) })] }), /* @__PURE__ */ jsxs(CardContent, {
|
|
495
|
+
className: "flex flex-col gap-3",
|
|
430
496
|
children: [
|
|
431
|
-
/* @__PURE__ */ jsxs("div", {
|
|
432
|
-
className: "
|
|
433
|
-
children: [
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
!isLoading && !accordionValue && /* @__PURE__ */ jsx("div", {
|
|
440
|
-
className: "mb-2 flex w-full cursor-pointer flex-col",
|
|
441
|
-
onClick: () => setAccordionValue("points-history"),
|
|
442
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
443
|
-
className: "text-sm font-semibold text-gray-900",
|
|
444
|
-
children: [
|
|
445
|
-
availablePoints.toLocaleString(),
|
|
446
|
-
" ",
|
|
447
|
-
/* @__PURE__ */ jsx("span", {
|
|
448
|
-
className: "font-normal text-gray-500",
|
|
449
|
-
children: t("points_available").toLowerCase()
|
|
450
|
-
})
|
|
451
|
-
]
|
|
452
|
-
})
|
|
453
|
-
}),
|
|
454
|
-
/* @__PURE__ */ jsxs(AccordionContent, {
|
|
455
|
-
className: "max-h-[400px] overflow-y-auto pt-2",
|
|
456
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
457
|
-
className: "mb-3 flex w-full flex-col",
|
|
458
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
459
|
-
className: "text-sm font-semibold text-gray-900",
|
|
460
|
-
children: [
|
|
461
|
-
availablePoints.toLocaleString(),
|
|
462
|
-
" ",
|
|
463
|
-
/* @__PURE__ */ jsx("span", {
|
|
464
|
-
className: "font-normal text-gray-500",
|
|
465
|
-
children: t("points_available").toLowerCase()
|
|
466
|
-
})
|
|
467
|
-
]
|
|
497
|
+
isLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }) : /* @__PURE__ */ jsxs("div", {
|
|
498
|
+
className: "text-foreground text-sm font-semibold",
|
|
499
|
+
children: [
|
|
500
|
+
availablePoints.toLocaleString(),
|
|
501
|
+
" ",
|
|
502
|
+
/* @__PURE__ */ jsx("span", {
|
|
503
|
+
className: "text-muted-foreground font-normal",
|
|
504
|
+
children: t("points_available").toLowerCase()
|
|
468
505
|
})
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
className: "
|
|
480
|
-
children: /* @__PURE__ */
|
|
506
|
+
]
|
|
507
|
+
}),
|
|
508
|
+
pointsLedger.length > 0 && /* @__PURE__ */ jsx(AnimatedExpand, {
|
|
509
|
+
open: isExpanded,
|
|
510
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
511
|
+
className: "flex flex-col",
|
|
512
|
+
children: pointsLedger.map((ledger, index) => {
|
|
513
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
514
|
+
className: "flex flex-row items-stretch gap-3",
|
|
515
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
516
|
+
className: "relative flex w-2 flex-col items-center",
|
|
517
|
+
children: [!(index === pointsLedger.length - 1) && /* @__PURE__ */ jsx("div", { className: "bg-muted-foreground absolute top-3 -bottom-3 left-1/2 w-px -translate-x-1/2" }), /* @__PURE__ */ jsx("div", { className: "border-muted-foreground bg-card relative mt-3 h-2 w-2 shrink-0 rounded-full border" })]
|
|
518
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
519
|
+
className: "flex flex-1 flex-row items-start justify-between py-1.5",
|
|
520
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
481
521
|
className: "flex flex-col",
|
|
482
522
|
children: [/* @__PURE__ */ jsx("div", {
|
|
483
|
-
className: "text-sm font-medium
|
|
523
|
+
className: "text-foreground text-sm font-medium",
|
|
484
524
|
children: formatTransactionType(ledger, t)
|
|
485
525
|
}), /* @__PURE__ */ jsx("div", {
|
|
486
|
-
className: "text-
|
|
526
|
+
className: "text-muted-foreground text-sm",
|
|
487
527
|
children: formatDateTime(ledger.created_at)
|
|
488
528
|
})]
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
]
|
|
496
|
-
}, ledger.id)) : /* @__PURE__ */ jsx("div", {
|
|
497
|
-
className: "text-sm text-gray-500",
|
|
498
|
-
children: t("no_points_history_found")
|
|
529
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
530
|
+
className: cn("text-sm font-medium", ledger.amount >= 0 ? "text-primary" : "text-destructive"),
|
|
531
|
+
children: formatPoints(ledger.amount)
|
|
532
|
+
})]
|
|
533
|
+
})]
|
|
534
|
+
}, ledger.id);
|
|
499
535
|
})
|
|
500
|
-
})
|
|
536
|
+
})
|
|
537
|
+
}),
|
|
538
|
+
!isLoading && pointsLedger.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
539
|
+
className: "text-muted-foreground text-sm",
|
|
540
|
+
children: t("no_points_history_found")
|
|
501
541
|
})
|
|
502
542
|
]
|
|
503
|
-
})
|
|
543
|
+
})] })
|
|
504
544
|
})
|
|
505
545
|
});
|
|
506
546
|
}
|
|
@@ -524,10 +564,10 @@ function FormTextField$1({ control, name, label, containerClassName, ...props })
|
|
|
524
564
|
...props,
|
|
525
565
|
id: name,
|
|
526
566
|
value: field.value ?? "",
|
|
527
|
-
className: cn(error && "ring-
|
|
567
|
+
className: cn(error && "ring-destructive ring-1", props.className)
|
|
528
568
|
}),
|
|
529
569
|
error && /* @__PURE__ */ jsx("p", {
|
|
530
|
-
className: "text-
|
|
570
|
+
className: "text-destructive text-sm",
|
|
531
571
|
children: error.message
|
|
532
572
|
})
|
|
533
573
|
]
|
|
@@ -553,7 +593,7 @@ function FormSelectField$1({ control, name, label, options, placeholder, contain
|
|
|
553
593
|
onChange?.(val);
|
|
554
594
|
},
|
|
555
595
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
556
|
-
className: cn(error && "ring-
|
|
596
|
+
className: cn(error && "ring-destructive ring-1"),
|
|
557
597
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
558
598
|
}), /* @__PURE__ */ jsx(SelectContent, { children: options?.map((opt) => /* @__PURE__ */ jsx(SelectItem, {
|
|
559
599
|
value: opt.value.toString(),
|
|
@@ -561,7 +601,7 @@ function FormSelectField$1({ control, name, label, options, placeholder, contain
|
|
|
561
601
|
}, `${opt.name}-${opt.value}`)) })]
|
|
562
602
|
}),
|
|
563
603
|
error && /* @__PURE__ */ jsx("p", {
|
|
564
|
-
className: "text-
|
|
604
|
+
className: "text-destructive text-sm",
|
|
565
605
|
children: error.message
|
|
566
606
|
})
|
|
567
607
|
]
|
|
@@ -610,12 +650,9 @@ function UserInfoDialog({ control, isOpen, onSubmit, handleClose, languageOption
|
|
|
610
650
|
open: isOpen,
|
|
611
651
|
onOpenChange: (open) => !open && handleDialogClose(),
|
|
612
652
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
613
|
-
className: "max-w-sm
|
|
653
|
+
className: "max-w-sm md:max-w-lg",
|
|
614
654
|
children: [
|
|
615
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
616
|
-
className: "text-md font-medium text-gray-900",
|
|
617
|
-
children: t("edit_profile")
|
|
618
|
-
}) }),
|
|
655
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("edit_profile") }) }),
|
|
619
656
|
/* @__PURE__ */ jsxs("div", {
|
|
620
657
|
className: "space-y-4",
|
|
621
658
|
children: [
|
|
@@ -671,7 +708,7 @@ function UserInfoDialog({ control, isOpen, onSubmit, handleClose, languageOption
|
|
|
671
708
|
autoFocus: true
|
|
672
709
|
}),
|
|
673
710
|
emailError && /* @__PURE__ */ jsx("p", {
|
|
674
|
-
className: "text-
|
|
711
|
+
className: "text-destructive text-xs",
|
|
675
712
|
children: emailError
|
|
676
713
|
}),
|
|
677
714
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -688,14 +725,12 @@ function UserInfoDialog({ control, isOpen, onSubmit, handleClose, languageOption
|
|
|
688
725
|
variant: "outline",
|
|
689
726
|
size: "sm",
|
|
690
727
|
onClick: handleCancelEmailEdit,
|
|
691
|
-
className: "cursor-pointer",
|
|
692
728
|
children: "Cancel"
|
|
693
729
|
}), /* @__PURE__ */ jsxs(Button, {
|
|
694
730
|
type: "button",
|
|
695
731
|
size: "sm",
|
|
696
732
|
onClick: handleEmailSubmit,
|
|
697
733
|
disabled: !newEmail.trim() || isChangingEmail,
|
|
698
|
-
className: "cursor-pointer",
|
|
699
734
|
children: [isChangingEmail && /* @__PURE__ */ jsx("div", { className: "mr-2 h-3.5 w-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isChangingEmail ? "Sending..." : "Send verification"]
|
|
700
735
|
})]
|
|
701
736
|
})
|
|
@@ -730,13 +765,13 @@ function UserInfoDialog({ control, isOpen, onSubmit, handleClose, languageOption
|
|
|
730
765
|
variant: "outline",
|
|
731
766
|
size: "sm",
|
|
732
767
|
onClick: () => setIsEditingEmail(true),
|
|
733
|
-
className: "shrink-0
|
|
768
|
+
className: "shrink-0",
|
|
734
769
|
children: "Change"
|
|
735
770
|
})]
|
|
736
771
|
})]
|
|
737
772
|
}),
|
|
738
773
|
errorMsg && /* @__PURE__ */ jsx("p", {
|
|
739
|
-
className: "text-
|
|
774
|
+
className: "text-destructive text-sm",
|
|
740
775
|
children: errorMsg
|
|
741
776
|
}),
|
|
742
777
|
/* @__PURE__ */ jsx(DialogFooter, {
|
|
@@ -746,7 +781,6 @@ function UserInfoDialog({ control, isOpen, onSubmit, handleClose, languageOption
|
|
|
746
781
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
747
782
|
type: "button",
|
|
748
783
|
onClick: onSubmit,
|
|
749
|
-
className: "cursor-pointer",
|
|
750
784
|
children: [isSubmitting && /* @__PURE__ */ jsx("div", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isSubmitting ? t("saving") : t("save_changes")]
|
|
751
785
|
})
|
|
752
786
|
})
|
|
@@ -810,29 +844,27 @@ function CustomerInfo({ customerAccount, languages, onUpdateCustomer, isUpdating
|
|
|
810
844
|
}
|
|
811
845
|
});
|
|
812
846
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
813
|
-
/* @__PURE__ */ jsxs("
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
847
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: "Personal Information" }), /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(Button, {
|
|
848
|
+
variant: "link",
|
|
849
|
+
size: "sm",
|
|
850
|
+
onClick: handleOpenEditDialog,
|
|
851
|
+
children: "Edit"
|
|
852
|
+
}) })] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
853
|
+
className: "flex flex-row items-center space-x-2",
|
|
854
|
+
children: [/* @__PURE__ */ jsx(Avatar, {
|
|
855
|
+
className: "border-border border",
|
|
856
|
+
children: /* @__PURE__ */ jsx(AvatarFallback, { children: userInitial })
|
|
857
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
858
|
+
className: "flex flex-col",
|
|
859
|
+
children: [customerAccount.customer.full_name.trim() && /* @__PURE__ */ jsx("p", {
|
|
860
|
+
className: "text-sm font-medium",
|
|
861
|
+
children: customerAccount.customer.full_name
|
|
862
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
863
|
+
className: "text-muted-foreground text-sm",
|
|
864
|
+
children: customerAccount.customer.email
|
|
829
865
|
})]
|
|
830
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
831
|
-
className: "cursor-pointer rounded-md border border-gray-300 p-1 hover:bg-gray-50 disabled:opacity-50",
|
|
832
|
-
onClick: handleOpenEditDialog,
|
|
833
|
-
children: /* @__PURE__ */ jsx(Pencil, { className: "h-2.5 w-2.5 text-gray-400" })
|
|
834
866
|
})]
|
|
835
|
-
}),
|
|
867
|
+
}) })] }),
|
|
836
868
|
pendingEmailChange && /* @__PURE__ */ jsxs("div", {
|
|
837
869
|
className: "bg-muted mb-6 flex items-start gap-2.5 rounded-md px-3 py-3",
|
|
838
870
|
children: [/* @__PURE__ */ jsx(Info, { className: "text-primary mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ jsxs("div", {
|
|
@@ -892,9 +924,62 @@ function CustomerInfo({ customerAccount, languages, onUpdateCustomer, isUpdating
|
|
|
892
924
|
function formatAddressName(address) {
|
|
893
925
|
return address.name ?? "";
|
|
894
926
|
}
|
|
895
|
-
function AddressDropdown({ title, displayAddress, addressList, onAddAddressClick, onEditAddress, onDeleteAddress, accordionItemValue, addAddressLabel, showAddButton = true, borderStyle = "border-b border-
|
|
896
|
-
const [
|
|
927
|
+
function AddressDropdown({ title, displayAddress, addressList, onAddAddressClick, onEditAddress, onDeleteAddress, onMakeDefaultAddress, accordionItemValue, addAddressLabel, showAddButton = true, borderStyle = "border-b border-border pb-4 mb-6", className = "", showActions = true, isLoading = false, value, onValueChange, hideTrigger = false }) {
|
|
928
|
+
const [internalValue, setInternalValue] = useState("");
|
|
929
|
+
const addressesValue = value ?? internalValue;
|
|
930
|
+
const setAddressesValue = onValueChange ?? setInternalValue;
|
|
897
931
|
const { t } = useProfileUI();
|
|
932
|
+
const addressListContent = /* @__PURE__ */ jsx("div", {
|
|
933
|
+
className: "flex flex-col justify-between space-y-4 px-0.5",
|
|
934
|
+
children: isLoading ? /* @__PURE__ */ jsxs("div", {
|
|
935
|
+
className: "space-y-2",
|
|
936
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-2/3" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" })]
|
|
937
|
+
}) : addressList.length > 0 ? addressList.map((address, index) => /* @__PURE__ */ jsxs("div", {
|
|
938
|
+
className: cn("flex w-full flex-row items-start justify-between space-x-2 px-2", { "border-border border-b p-3": addressList.length - 1 !== index }),
|
|
939
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
940
|
+
className: "flex flex-col",
|
|
941
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
942
|
+
className: "text-foreground text-sm",
|
|
943
|
+
children: [
|
|
944
|
+
formatAddressName(address),
|
|
945
|
+
" ",
|
|
946
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
947
|
+
address.address1,
|
|
948
|
+
" ",
|
|
949
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
950
|
+
address.city,
|
|
951
|
+
", ",
|
|
952
|
+
address.state,
|
|
953
|
+
" ",
|
|
954
|
+
address.postal_code
|
|
955
|
+
]
|
|
956
|
+
})
|
|
957
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
958
|
+
className: "flex flex-row items-center space-x-2",
|
|
959
|
+
children: [address.default && /* @__PURE__ */ jsx("p", {
|
|
960
|
+
className: "bg-secondary text-secondary-foreground w-fit rounded px-2 py-0.5 text-xs font-medium",
|
|
961
|
+
children: t("default")
|
|
962
|
+
}), showActions && /* @__PURE__ */ jsx(EllipsesDropdown, {
|
|
963
|
+
onDelete: () => onDeleteAddress?.(address),
|
|
964
|
+
onEdit: () => onEditAddress?.(address),
|
|
965
|
+
onMakeDefault: !address.default && onMakeDefaultAddress ? () => onMakeDefaultAddress(address) : void 0,
|
|
966
|
+
editLabel: t("edit"),
|
|
967
|
+
deleteLabel: t("delete")
|
|
968
|
+
})]
|
|
969
|
+
})]
|
|
970
|
+
}, address.id)) : /* @__PURE__ */ jsx("div", {
|
|
971
|
+
className: "text-muted-foreground text-sm",
|
|
972
|
+
children: t("no_saved_addresses_found")
|
|
973
|
+
})
|
|
974
|
+
});
|
|
975
|
+
if (hideTrigger) return /* @__PURE__ */ jsxs("div", {
|
|
976
|
+
className: `${borderStyle} ${className}`,
|
|
977
|
+
children: [addressListContent, showAddButton && /* @__PURE__ */ jsx("button", {
|
|
978
|
+
className: "text-foreground mt-3 text-left text-sm",
|
|
979
|
+
onClick: onAddAddressClick,
|
|
980
|
+
children: addAddressLabel
|
|
981
|
+
})]
|
|
982
|
+
});
|
|
898
983
|
return /* @__PURE__ */ jsxs("div", {
|
|
899
984
|
className: `${borderStyle} ${className}`,
|
|
900
985
|
children: [/* @__PURE__ */ jsx(Accordion, {
|
|
@@ -909,15 +994,11 @@ function AddressDropdown({ title, displayAddress, addressList, onAddAddressClick
|
|
|
909
994
|
children: [
|
|
910
995
|
/* @__PURE__ */ jsxs("div", {
|
|
911
996
|
className: "flex flex-row items-center justify-between",
|
|
912
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
997
|
+
children: [title && /* @__PURE__ */ jsx("div", {
|
|
913
998
|
className: "text-muted-foreground mt-4 mb-1 text-sm",
|
|
914
999
|
children: title
|
|
915
1000
|
}), /* @__PURE__ */ jsx(AccordionTrigger, { className: "m-0 ml-2 flex h-auto min-h-0 w-auto py-0 hover:no-underline" })]
|
|
916
1001
|
}),
|
|
917
|
-
isLoading && /* @__PURE__ */ jsxs("div", {
|
|
918
|
-
className: "space-y-2",
|
|
919
|
-
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-2/3" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" })]
|
|
920
|
-
}),
|
|
921
1002
|
!isLoading && !addressesValue && displayAddress && /* @__PURE__ */ jsxs("div", {
|
|
922
1003
|
className: "mb-2 flex w-full cursor-pointer flex-col",
|
|
923
1004
|
onClick: () => setAddressesValue(accordionItemValue),
|
|
@@ -941,45 +1022,7 @@ function AddressDropdown({ title, displayAddress, addressList, onAddAddressClick
|
|
|
941
1022
|
}),
|
|
942
1023
|
/* @__PURE__ */ jsx(AccordionContent, {
|
|
943
1024
|
className: "max-h-[400px] overflow-y-auto pt-2",
|
|
944
|
-
children:
|
|
945
|
-
className: "mt-2 flex flex-col justify-between space-y-4 px-0.5",
|
|
946
|
-
children: addressList.length > 0 ? addressList.map((address, index) => /* @__PURE__ */ jsxs("div", {
|
|
947
|
-
className: cn("flex min-h-[48px] w-full flex-row items-center justify-between space-x-2 px-2", { "items-center border-b border-gray-300 p-3": addressList.length - 1 !== index }),
|
|
948
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
949
|
-
className: "flex flex-col",
|
|
950
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
951
|
-
className: "text-foreground text-sm",
|
|
952
|
-
children: [
|
|
953
|
-
formatAddressName(address),
|
|
954
|
-
" ",
|
|
955
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
956
|
-
address.address1,
|
|
957
|
-
" ",
|
|
958
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
959
|
-
address.city,
|
|
960
|
-
", ",
|
|
961
|
-
address.state,
|
|
962
|
-
" ",
|
|
963
|
-
address.postal_code
|
|
964
|
-
]
|
|
965
|
-
})
|
|
966
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
967
|
-
className: "flex flex-row items-center space-x-2",
|
|
968
|
-
children: [address.default && /* @__PURE__ */ jsx("p", {
|
|
969
|
-
className: "mt-1 w-fit rounded bg-gray-500 px-2 py-0.5 text-xs font-medium text-white",
|
|
970
|
-
children: t("default")
|
|
971
|
-
}), showActions && /* @__PURE__ */ jsx(EllipsesDropdown, {
|
|
972
|
-
onDelete: () => onDeleteAddress?.(address),
|
|
973
|
-
onEdit: () => onEditAddress?.(address),
|
|
974
|
-
editLabel: t("edit"),
|
|
975
|
-
deleteLabel: t("delete")
|
|
976
|
-
})]
|
|
977
|
-
})]
|
|
978
|
-
}, address.id)) : /* @__PURE__ */ jsx("div", {
|
|
979
|
-
className: "text-muted-foreground text-sm",
|
|
980
|
-
children: t("no_saved_addresses_found")
|
|
981
|
-
})
|
|
982
|
-
})
|
|
1025
|
+
children: addressListContent
|
|
983
1026
|
})
|
|
984
1027
|
]
|
|
985
1028
|
})
|
|
@@ -992,13 +1035,16 @@ function AddressDropdown({ title, displayAddress, addressList, onAddAddressClick
|
|
|
992
1035
|
}
|
|
993
1036
|
//#endregion
|
|
994
1037
|
//#region ../../profile/ui/src/components/addresses.tsx
|
|
995
|
-
function Addresses({ addresses, isLoading = false, onCreateAddress, onDeleteAddress, isDeletingAddress = false, renderAddressDialog }) {
|
|
996
|
-
const [
|
|
1038
|
+
function Addresses({ addresses, isLoading = false, onCreateAddress, onDeleteAddress, isDeletingAddress = false, onMakeDefaultAddress, renderAddressDialog }) {
|
|
1039
|
+
const [accordionValue, setAccordionValue] = useState("");
|
|
997
1040
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
|
998
1041
|
const [selectedAddress, setSelectedAddress] = useState(null);
|
|
999
1042
|
const [deleteAddressError, setDeleteAddressError] = useState(void 0);
|
|
1043
|
+
const [openAddressDialog, setOpenAddressDialog] = useState(false);
|
|
1000
1044
|
const { t } = useProfileUI();
|
|
1001
1045
|
const defaultAddress = addresses.find((addr) => addr.default) ?? addresses[0] ?? null;
|
|
1046
|
+
const extraAddresses = defaultAddress ? addresses.filter((a) => a.id !== defaultAddress.id) : addresses;
|
|
1047
|
+
const isExpanded = accordionValue === "addresses";
|
|
1002
1048
|
const handleDeleteClick = (address) => {
|
|
1003
1049
|
setSelectedAddress(address);
|
|
1004
1050
|
setDeleteAddressError(void 0);
|
|
@@ -1019,8 +1065,9 @@ function Addresses({ addresses, isLoading = false, onCreateAddress, onDeleteAddr
|
|
|
1019
1065
|
setDeleteAddressError(void 0);
|
|
1020
1066
|
setOpenDeleteDialog(false);
|
|
1021
1067
|
setSelectedAddress(null);
|
|
1022
|
-
} catch {
|
|
1023
|
-
|
|
1068
|
+
} catch (error) {
|
|
1069
|
+
console.error("Failed to delete address:", error);
|
|
1070
|
+
setDeleteAddressError(parseApiErrors(error) || (error instanceof Error ? error.message : "We were unable to delete this address. Please try again."));
|
|
1024
1071
|
}
|
|
1025
1072
|
};
|
|
1026
1073
|
const handleAddClick = () => {
|
|
@@ -1033,19 +1080,65 @@ function Addresses({ addresses, isLoading = false, onCreateAddress, onDeleteAddr
|
|
|
1033
1080
|
setSelectedAddress(null);
|
|
1034
1081
|
};
|
|
1035
1082
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1036
|
-
/* @__PURE__ */ jsx(
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1083
|
+
/* @__PURE__ */ jsx(Accordion, {
|
|
1084
|
+
type: "single",
|
|
1085
|
+
collapsible: true,
|
|
1086
|
+
value: accordionValue,
|
|
1087
|
+
onValueChange: setAccordionValue,
|
|
1088
|
+
children: /* @__PURE__ */ jsx(AccordionItem, {
|
|
1089
|
+
value: "addresses",
|
|
1090
|
+
className: "border-0",
|
|
1091
|
+
children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: "Shipping Addresses" }), extraAddresses.length > 0 && /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(AccordionTrigger, { className: "[&>svg]:text-muted-foreground" }) })] }), /* @__PURE__ */ jsxs(CardContent, {
|
|
1092
|
+
className: "flex flex-col gap-3",
|
|
1093
|
+
children: [
|
|
1094
|
+
defaultAddress && /* @__PURE__ */ jsx(AddressDropdown, {
|
|
1095
|
+
title: "",
|
|
1096
|
+
displayAddress: defaultAddress,
|
|
1097
|
+
addressList: [defaultAddress],
|
|
1098
|
+
onAddAddressClick: handleAddClick,
|
|
1099
|
+
onEditAddress: handleEditClick,
|
|
1100
|
+
onDeleteAddress: handleDeleteClick,
|
|
1101
|
+
onMakeDefaultAddress: onMakeDefaultAddress ? (addr) => onMakeDefaultAddress(addr.id) : void 0,
|
|
1102
|
+
accordionItemValue: "addresses-preview",
|
|
1103
|
+
addAddressLabel: "",
|
|
1104
|
+
showAddButton: false,
|
|
1105
|
+
borderStyle: "",
|
|
1106
|
+
showActions: true,
|
|
1107
|
+
isLoading,
|
|
1108
|
+
hideTrigger: true,
|
|
1109
|
+
value: "addresses-preview"
|
|
1110
|
+
}),
|
|
1111
|
+
extraAddresses.length > 0 && /* @__PURE__ */ jsx(AnimatedExpand, {
|
|
1112
|
+
open: isExpanded,
|
|
1113
|
+
children: /* @__PURE__ */ jsx(AddressDropdown, {
|
|
1114
|
+
title: "",
|
|
1115
|
+
displayAddress: null,
|
|
1116
|
+
addressList: extraAddresses,
|
|
1117
|
+
onAddAddressClick: handleAddClick,
|
|
1118
|
+
onEditAddress: handleEditClick,
|
|
1119
|
+
onDeleteAddress: handleDeleteClick,
|
|
1120
|
+
onMakeDefaultAddress: onMakeDefaultAddress ? (addr) => onMakeDefaultAddress(addr.id) : void 0,
|
|
1121
|
+
accordionItemValue: "addresses-inner",
|
|
1122
|
+
addAddressLabel: "",
|
|
1123
|
+
showAddButton: false,
|
|
1124
|
+
borderStyle: "",
|
|
1125
|
+
showActions: true,
|
|
1126
|
+
isLoading,
|
|
1127
|
+
hideTrigger: true,
|
|
1128
|
+
value: "addresses-inner"
|
|
1129
|
+
})
|
|
1130
|
+
}),
|
|
1131
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
1132
|
+
type: "button",
|
|
1133
|
+
variant: "link",
|
|
1134
|
+
size: "sm",
|
|
1135
|
+
className: "text-foreground mt-3 h-auto w-fit justify-start p-0 text-left",
|
|
1136
|
+
onClick: handleAddClick,
|
|
1137
|
+
children: ["+ ", t("add_an_address")]
|
|
1138
|
+
})
|
|
1139
|
+
]
|
|
1140
|
+
})] })
|
|
1141
|
+
})
|
|
1049
1142
|
}),
|
|
1050
1143
|
/* @__PURE__ */ jsx(ConfirmActionDialog, {
|
|
1051
1144
|
title: t("delete_address"),
|
|
@@ -1096,8 +1189,10 @@ function getCardExpiry(paymentMethod) {
|
|
|
1096
1189
|
}
|
|
1097
1190
|
//#endregion
|
|
1098
1191
|
//#region ../../profile/ui/src/components/payment-method-dropdown.tsx
|
|
1099
|
-
function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList, onAddPaymentMethodClick, onEditPaymentMethod, onDeletePaymentMethod, accordionItemValue = "paymentMethods", addPaymentMethodLabel = "+ Add a payment method", showAddButton = true, borderStyle = "border-b border-border pb-4 mb-6", className = "", showActions = true, isLoading = false }) {
|
|
1100
|
-
const [
|
|
1192
|
+
function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList, onAddPaymentMethodClick, onEditPaymentMethod, onDeletePaymentMethod, onMakeDefaultPaymentMethod, accordionItemValue = "paymentMethods", addPaymentMethodLabel = "+ Add a payment method", showAddButton = true, borderStyle = "border-b border-border pb-4 mb-6", className = "", showActions = true, isLoading = false, value, onValueChange, hideTrigger = false }) {
|
|
1193
|
+
const [internalValue, setInternalValue] = useState("");
|
|
1194
|
+
const paymentsValue = value ?? internalValue;
|
|
1195
|
+
const setPaymentsValue = onValueChange ?? setInternalValue;
|
|
1101
1196
|
const renderPaymentMethod = (paymentMethod) => /* @__PURE__ */ jsxs("div", {
|
|
1102
1197
|
className: "flex flex-row items-center space-x-2",
|
|
1103
1198
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -1118,6 +1213,64 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1118
1213
|
})]
|
|
1119
1214
|
})]
|
|
1120
1215
|
});
|
|
1216
|
+
const paymentMethodListContent = /* @__PURE__ */ jsx("div", {
|
|
1217
|
+
className: "flex flex-col justify-between space-y-4 px-0.5",
|
|
1218
|
+
children: isLoading ? /* @__PURE__ */ jsx(Fragment$1, { children: [1, 2].map((i) => /* @__PURE__ */ jsx("div", {
|
|
1219
|
+
className: "bg-muted items-center rounded p-3",
|
|
1220
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1221
|
+
className: "flex flex-row items-center justify-between",
|
|
1222
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1223
|
+
className: "flex flex-row items-center space-x-2",
|
|
1224
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-10" }), /* @__PURE__ */ jsxs("div", {
|
|
1225
|
+
className: "flex flex-col space-y-1",
|
|
1226
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })]
|
|
1227
|
+
})]
|
|
1228
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-6" })]
|
|
1229
|
+
})
|
|
1230
|
+
}, `skeleton-${i}`)) }) : paymentMethodList.map((paymentMethod, index) => /* @__PURE__ */ jsxs("div", {
|
|
1231
|
+
className: cn("flex min-h-[48px] w-full flex-row items-center justify-between space-x-2 px-2", { "border-border items-center border-b p-3": paymentMethodList.length - 1 !== index }),
|
|
1232
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1233
|
+
className: "flex flex-row items-center space-x-2",
|
|
1234
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1235
|
+
className: "flex h-6 w-10 flex-shrink-0 items-center justify-center",
|
|
1236
|
+
children: /* @__PURE__ */ jsx(PaymentIcon, {
|
|
1237
|
+
logoUrl: paymentMethod.details.logo_url,
|
|
1238
|
+
brand: paymentMethod.details.card_type,
|
|
1239
|
+
alt: paymentMethod.details.card_type ?? "Payment Method"
|
|
1240
|
+
})
|
|
1241
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1242
|
+
className: "flex flex-col",
|
|
1243
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1244
|
+
className: "text-foreground flex items-center text-sm font-medium capitalize",
|
|
1245
|
+
children: getCardDisplayName(paymentMethod)
|
|
1246
|
+
}), getCardExpiry(paymentMethod) && /* @__PURE__ */ jsx("div", {
|
|
1247
|
+
className: "text-muted-foreground text-sm",
|
|
1248
|
+
children: getCardExpiry(paymentMethod)
|
|
1249
|
+
})]
|
|
1250
|
+
})]
|
|
1251
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1252
|
+
className: "flex flex-row items-center space-x-2",
|
|
1253
|
+
children: [paymentMethod.default && /* @__PURE__ */ jsx("p", {
|
|
1254
|
+
className: "bg-secondary text-secondary-foreground mt-1 w-fit rounded px-2 py-0.5 text-xs font-medium",
|
|
1255
|
+
children: "Default"
|
|
1256
|
+
}), showActions && /* @__PURE__ */ jsx(EllipsesDropdown, {
|
|
1257
|
+
onDelete: () => onDeletePaymentMethod?.(paymentMethod),
|
|
1258
|
+
deleteLabel: "Delete",
|
|
1259
|
+
onEdit: () => onEditPaymentMethod?.(paymentMethod),
|
|
1260
|
+
editLabel: "Edit",
|
|
1261
|
+
onMakeDefault: !paymentMethod.default && onMakeDefaultPaymentMethod ? () => onMakeDefaultPaymentMethod(paymentMethod) : void 0
|
|
1262
|
+
})]
|
|
1263
|
+
})]
|
|
1264
|
+
}, paymentMethod.id))
|
|
1265
|
+
});
|
|
1266
|
+
if (hideTrigger) return /* @__PURE__ */ jsxs("div", {
|
|
1267
|
+
className: `${borderStyle} ${className}`,
|
|
1268
|
+
children: [paymentMethodListContent, showAddButton && /* @__PURE__ */ jsx("button", {
|
|
1269
|
+
className: "text-foreground mt-3 text-left text-sm",
|
|
1270
|
+
onClick: onAddPaymentMethodClick,
|
|
1271
|
+
children: addPaymentMethodLabel
|
|
1272
|
+
})]
|
|
1273
|
+
});
|
|
1121
1274
|
return /* @__PURE__ */ jsxs("div", {
|
|
1122
1275
|
className: `${borderStyle} ${className}`,
|
|
1123
1276
|
children: [/* @__PURE__ */ jsx(Accordion, {
|
|
@@ -1132,7 +1285,7 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1132
1285
|
children: [
|
|
1133
1286
|
/* @__PURE__ */ jsxs("div", {
|
|
1134
1287
|
className: "flex flex-row items-center justify-between",
|
|
1135
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1288
|
+
children: [title && /* @__PURE__ */ jsx("div", {
|
|
1136
1289
|
className: "text-muted-foreground mt-4 mb-1 text-sm",
|
|
1137
1290
|
children: title
|
|
1138
1291
|
}), /* @__PURE__ */ jsx(AccordionTrigger, { className: "m-0 ml-2 flex h-auto min-h-0 w-auto py-0 hover:no-underline" })]
|
|
@@ -1150,55 +1303,7 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1150
1303
|
}),
|
|
1151
1304
|
/* @__PURE__ */ jsx(AccordionContent, {
|
|
1152
1305
|
className: "max-h-[400px] overflow-y-auto pt-2",
|
|
1153
|
-
children:
|
|
1154
|
-
className: "mt-2 flex flex-col justify-between space-y-4 px-0.5",
|
|
1155
|
-
children: isLoading ? /* @__PURE__ */ jsx(Fragment$1, { children: [1, 2].map((i) => /* @__PURE__ */ jsx("div", {
|
|
1156
|
-
className: "bg-muted items-center rounded p-3",
|
|
1157
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1158
|
-
className: "flex flex-row items-center justify-between",
|
|
1159
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1160
|
-
className: "flex flex-row items-center space-x-2",
|
|
1161
|
-
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-10" }), /* @__PURE__ */ jsxs("div", {
|
|
1162
|
-
className: "flex flex-col space-y-1",
|
|
1163
|
-
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })]
|
|
1164
|
-
})]
|
|
1165
|
-
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-6" })]
|
|
1166
|
-
})
|
|
1167
|
-
}, `skeleton-${i}`)) }) : paymentMethodList.map((paymentMethod, index) => /* @__PURE__ */ jsxs("div", {
|
|
1168
|
-
className: cn("flex min-h-[48px] w-full flex-row items-center justify-between space-x-2 px-2", { "border-border items-center border-b p-3": paymentMethodList.length - 1 !== index }),
|
|
1169
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1170
|
-
className: "flex flex-row items-center space-x-2",
|
|
1171
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1172
|
-
className: "flex h-6 w-10 flex-shrink-0 items-center justify-center",
|
|
1173
|
-
children: /* @__PURE__ */ jsx(PaymentIcon, {
|
|
1174
|
-
logoUrl: paymentMethod.details.logo_url,
|
|
1175
|
-
brand: paymentMethod.details.card_type,
|
|
1176
|
-
alt: paymentMethod.details.card_type ?? "Payment Method"
|
|
1177
|
-
})
|
|
1178
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1179
|
-
className: "flex flex-col",
|
|
1180
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1181
|
-
className: "text-foreground flex items-center text-sm font-medium capitalize",
|
|
1182
|
-
children: getCardDisplayName(paymentMethod)
|
|
1183
|
-
}), getCardExpiry(paymentMethod) && /* @__PURE__ */ jsx("div", {
|
|
1184
|
-
className: "text-muted-foreground text-sm",
|
|
1185
|
-
children: getCardExpiry(paymentMethod)
|
|
1186
|
-
})]
|
|
1187
|
-
})]
|
|
1188
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1189
|
-
className: "flex flex-row items-center space-x-2",
|
|
1190
|
-
children: [paymentMethod.default && /* @__PURE__ */ jsx("p", {
|
|
1191
|
-
className: "bg-secondary text-secondary-foreground mt-1 w-fit rounded px-2 py-0.5 text-xs font-medium",
|
|
1192
|
-
children: "Default"
|
|
1193
|
-
}), showActions && /* @__PURE__ */ jsx(EllipsesDropdown, {
|
|
1194
|
-
onDelete: () => onDeletePaymentMethod?.(paymentMethod),
|
|
1195
|
-
deleteLabel: "Delete",
|
|
1196
|
-
onEdit: () => onEditPaymentMethod?.(paymentMethod),
|
|
1197
|
-
editLabel: "Edit"
|
|
1198
|
-
})]
|
|
1199
|
-
})]
|
|
1200
|
-
}, paymentMethod.id))
|
|
1201
|
-
})
|
|
1306
|
+
children: paymentMethodListContent
|
|
1202
1307
|
})
|
|
1203
1308
|
]
|
|
1204
1309
|
})
|
|
@@ -1223,16 +1328,13 @@ function ViewPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1223
1328
|
open: isOpen,
|
|
1224
1329
|
onOpenChange: (open) => !open && onClose(),
|
|
1225
1330
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
1226
|
-
className: "max-w-sm
|
|
1331
|
+
className: "max-w-sm md:max-w-lg",
|
|
1227
1332
|
children: [
|
|
1228
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
1229
|
-
className: "text-md font-medium",
|
|
1230
|
-
children: t("edit_card")
|
|
1231
|
-
}) }),
|
|
1333
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("edit_card") }) }),
|
|
1232
1334
|
/* @__PURE__ */ jsxs("div", {
|
|
1233
1335
|
className: "space-y-4",
|
|
1234
1336
|
children: [/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
1235
|
-
className: "rounded-lg
|
|
1337
|
+
className: "bg-muted rounded-lg p-4",
|
|
1236
1338
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1237
1339
|
className: "flex items-center space-x-3",
|
|
1238
1340
|
children: [details.logo_url && /* @__PURE__ */ jsx("div", {
|
|
@@ -1247,14 +1349,14 @@ function ViewPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1247
1349
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1248
1350
|
className: "flex flex-col",
|
|
1249
1351
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1250
|
-
className: "text-sm font-medium
|
|
1352
|
+
className: "text-foreground text-sm font-medium",
|
|
1251
1353
|
children: [
|
|
1252
1354
|
cardBrand,
|
|
1253
1355
|
" •••• ",
|
|
1254
1356
|
lastFour
|
|
1255
1357
|
]
|
|
1256
1358
|
}), expMonth != null && expYear != null && /* @__PURE__ */ jsxs("span", {
|
|
1257
|
-
className: "text-
|
|
1359
|
+
className: "text-muted-foreground text-sm",
|
|
1258
1360
|
children: [
|
|
1259
1361
|
t("card_expires"),
|
|
1260
1362
|
" ",
|
|
@@ -1265,25 +1367,24 @@ function ViewPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1265
1367
|
})]
|
|
1266
1368
|
})]
|
|
1267
1369
|
}), paymentMethod.default && /* @__PURE__ */ jsx("span", {
|
|
1268
|
-
className: "mt-2 inline-block rounded
|
|
1370
|
+
className: "bg-secondary text-secondary-foreground mt-2 inline-block rounded px-2 py-0.5 text-xs font-medium",
|
|
1269
1371
|
children: t("default")
|
|
1270
1372
|
})]
|
|
1271
1373
|
}) }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
1272
1374
|
className: "mb-2 flex items-center justify-between",
|
|
1273
1375
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
1274
|
-
className: "text-sm font-medium
|
|
1376
|
+
className: "text-foreground text-sm font-medium",
|
|
1275
1377
|
children: t("billing_address")
|
|
1276
1378
|
}), onEdit && /* @__PURE__ */ jsx(Button, {
|
|
1277
|
-
variant: "
|
|
1379
|
+
variant: "link",
|
|
1278
1380
|
size: "sm",
|
|
1279
|
-
className: "h-auto p-0 text-sm text-gray-600 underline hover:bg-transparent",
|
|
1280
1381
|
onClick: onEdit,
|
|
1281
1382
|
children: t("edit")
|
|
1282
1383
|
})]
|
|
1283
1384
|
}), /* @__PURE__ */ jsx("div", {
|
|
1284
|
-
className: "rounded-lg
|
|
1385
|
+
className: "bg-muted rounded-lg p-4",
|
|
1285
1386
|
children: billingAddress ? /* @__PURE__ */ jsxs("div", {
|
|
1286
|
-
className: "space-y-1 text-sm
|
|
1387
|
+
className: "text-foreground space-y-1 text-sm",
|
|
1287
1388
|
children: [
|
|
1288
1389
|
billingAddress.name && /* @__PURE__ */ jsx("p", { children: billingAddress.name }),
|
|
1289
1390
|
/* @__PURE__ */ jsx("p", { children: billingAddress.address1 }),
|
|
@@ -1298,7 +1399,7 @@ function ViewPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1298
1399
|
/* @__PURE__ */ jsx("p", { children: billingAddress.country_code })
|
|
1299
1400
|
]
|
|
1300
1401
|
}) : /* @__PURE__ */ jsx("p", {
|
|
1301
|
-
className: "text-
|
|
1402
|
+
className: "text-muted-foreground text-sm italic",
|
|
1302
1403
|
children: t("no_billing_address")
|
|
1303
1404
|
})
|
|
1304
1405
|
})] })]
|
|
@@ -1306,7 +1407,7 @@ function ViewPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1306
1407
|
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(DialogClose, {
|
|
1307
1408
|
asChild: true,
|
|
1308
1409
|
children: /* @__PURE__ */ jsx(Button, {
|
|
1309
|
-
|
|
1410
|
+
variant: "secondary",
|
|
1310
1411
|
onClick: onClose,
|
|
1311
1412
|
children: t("close")
|
|
1312
1413
|
})
|
|
@@ -1400,16 +1501,13 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1400
1501
|
open: isOpen,
|
|
1401
1502
|
onOpenChange: (open) => !open && onClose(),
|
|
1402
1503
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
1403
|
-
className: "max-h-[90vh] max-w-sm overflow-y-auto
|
|
1504
|
+
className: "max-h-[90vh] max-w-sm overflow-y-auto md:max-w-lg",
|
|
1404
1505
|
children: [
|
|
1405
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
1406
|
-
className: "text-md font-medium",
|
|
1407
|
-
children: t("edit_card")
|
|
1408
|
-
}) }),
|
|
1506
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("edit_card") }) }),
|
|
1409
1507
|
/* @__PURE__ */ jsxs("div", {
|
|
1410
1508
|
className: "space-y-4",
|
|
1411
1509
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1412
|
-
className: "rounded-lg
|
|
1510
|
+
className: "bg-muted rounded-lg p-4",
|
|
1413
1511
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1414
1512
|
className: "flex items-center space-x-3",
|
|
1415
1513
|
children: [details.logo_url && /* @__PURE__ */ jsx("div", {
|
|
@@ -1424,14 +1522,14 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1424
1522
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1425
1523
|
className: "flex flex-col",
|
|
1426
1524
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1427
|
-
className: "text-sm font-medium
|
|
1525
|
+
className: "text-foreground text-sm font-medium",
|
|
1428
1526
|
children: [
|
|
1429
1527
|
cardBrand,
|
|
1430
1528
|
" •••• ",
|
|
1431
1529
|
lastFour
|
|
1432
1530
|
]
|
|
1433
1531
|
}), expMonth != null && expYear != null && /* @__PURE__ */ jsxs("span", {
|
|
1434
|
-
className: "text-
|
|
1532
|
+
className: "text-muted-foreground text-sm",
|
|
1435
1533
|
children: [
|
|
1436
1534
|
t("card_expires"),
|
|
1437
1535
|
" ",
|
|
@@ -1443,7 +1541,7 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1443
1541
|
})]
|
|
1444
1542
|
})
|
|
1445
1543
|
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1446
|
-
className: "mb-1 text-sm font-medium
|
|
1544
|
+
className: "text-foreground mb-1 text-sm font-medium",
|
|
1447
1545
|
children: t("billing_address")
|
|
1448
1546
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1449
1547
|
className: "space-y-0",
|
|
@@ -1516,7 +1614,7 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1516
1614
|
})]
|
|
1517
1615
|
}),
|
|
1518
1616
|
error && /* @__PURE__ */ jsx("div", {
|
|
1519
|
-
className: "text-
|
|
1617
|
+
className: "text-destructive text-sm",
|
|
1520
1618
|
children: error
|
|
1521
1619
|
}),
|
|
1522
1620
|
/* @__PURE__ */ jsxs(DialogFooter, {
|
|
@@ -1525,19 +1623,18 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1525
1623
|
className: "flex-2",
|
|
1526
1624
|
children: /* @__PURE__ */ jsx(Button, {
|
|
1527
1625
|
type: "button",
|
|
1528
|
-
|
|
1626
|
+
variant: "secondary",
|
|
1529
1627
|
onClick: onClose,
|
|
1530
1628
|
disabled: isSubmitting,
|
|
1531
1629
|
children: t("cancel")
|
|
1532
1630
|
})
|
|
1533
1631
|
}), /* @__PURE__ */ jsx("div", {
|
|
1534
1632
|
className: "flex-1 text-right",
|
|
1535
|
-
children: /* @__PURE__ */
|
|
1536
|
-
type: "
|
|
1633
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
1634
|
+
type: "button",
|
|
1537
1635
|
onClick: handleFormSubmit,
|
|
1538
1636
|
disabled: isSubmitting,
|
|
1539
|
-
className: "
|
|
1540
|
-
children: isSubmitting ? /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-white border-t-transparent" }) : t("save")
|
|
1637
|
+
children: [isSubmitting && /* @__PURE__ */ jsx("div", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isSubmitting ? t("saving") : t("save_changes")]
|
|
1541
1638
|
})
|
|
1542
1639
|
})]
|
|
1543
1640
|
})
|
|
@@ -1547,7 +1644,8 @@ function EditPaymentMethodDialog({ isOpen, paymentMethod, billingAddress, onClos
|
|
|
1547
1644
|
}
|
|
1548
1645
|
//#endregion
|
|
1549
1646
|
//#region ../../profile/ui/src/components/payment-methods.tsx
|
|
1550
|
-
function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMethod, isDeletingPaymentMethod = false, onUpdatePaymentMethod, isUpdatingPaymentMethod = false, getBillingAddress, countries, renderCreditCardDialog }) {
|
|
1647
|
+
function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMethod, isDeletingPaymentMethod = false, onMakeDefaultPaymentMethod, onUpdatePaymentMethod, isUpdatingPaymentMethod = false, getBillingAddress, countries, renderCreditCardDialog }) {
|
|
1648
|
+
const [accordionValue, setAccordionValue] = useState("");
|
|
1551
1649
|
const [isOpen, setIsOpen] = useState(false);
|
|
1552
1650
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
|
1553
1651
|
const [deleteCardError, setDeleteCardError] = useState(void 0);
|
|
@@ -1558,6 +1656,7 @@ function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMeth
|
|
|
1558
1656
|
const [editError, setEditError] = useState(void 0);
|
|
1559
1657
|
const { t } = useProfileUI();
|
|
1560
1658
|
const defaultPaymentMethod = paymentMethods.find((method) => method.default) ?? paymentMethods[0] ?? null;
|
|
1659
|
+
const extraPaymentMethods = defaultPaymentMethod ? paymentMethods.filter((m) => m.id !== defaultPaymentMethod.id) : paymentMethods;
|
|
1561
1660
|
const handleDeleteCard = async (cardId) => {
|
|
1562
1661
|
if (!cardId) return;
|
|
1563
1662
|
try {
|
|
@@ -1565,8 +1664,9 @@ function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMeth
|
|
|
1565
1664
|
setSelectedCreditCard(void 0);
|
|
1566
1665
|
setDeleteCardError(void 0);
|
|
1567
1666
|
setOpenDeleteDialog(false);
|
|
1568
|
-
} catch {
|
|
1569
|
-
|
|
1667
|
+
} catch (error) {
|
|
1668
|
+
console.error("Failed to delete payment method:", error);
|
|
1669
|
+
setDeleteCardError(parseApiErrors(error) || (error instanceof Error ? error.message : "Unable to delete payment method. Please try again."));
|
|
1570
1670
|
}
|
|
1571
1671
|
};
|
|
1572
1672
|
const handleDeletePaymentMethod = (paymentMethod) => {
|
|
@@ -1617,27 +1717,70 @@ function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMeth
|
|
|
1617
1717
|
else setEditError("An unexpected error occurred. Please try again.");
|
|
1618
1718
|
}
|
|
1619
1719
|
};
|
|
1620
|
-
const handleOpenDialog = () => {
|
|
1621
|
-
setIsOpen(true);
|
|
1622
|
-
};
|
|
1623
|
-
const handleCloseDialog = () => {
|
|
1624
|
-
setIsOpen(false);
|
|
1625
|
-
};
|
|
1626
1720
|
const selectedBillingAddress = selectedPaymentMethod ? getBillingAddress?.(selectedPaymentMethod) ?? null : null;
|
|
1721
|
+
const isExpanded = accordionValue === "paymentMethods";
|
|
1627
1722
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1628
|
-
/* @__PURE__ */ jsx(
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1723
|
+
/* @__PURE__ */ jsx(Accordion, {
|
|
1724
|
+
type: "single",
|
|
1725
|
+
collapsible: true,
|
|
1726
|
+
value: accordionValue,
|
|
1727
|
+
onValueChange: setAccordionValue,
|
|
1728
|
+
children: /* @__PURE__ */ jsx(AccordionItem, {
|
|
1729
|
+
value: "paymentMethods",
|
|
1730
|
+
className: "border-0",
|
|
1731
|
+
children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: "Payment Methods" }), extraPaymentMethods.length > 0 && /* @__PURE__ */ jsx(CardAction, { children: /* @__PURE__ */ jsx(AccordionTrigger, { className: "[&>svg]:text-muted-foreground" }) })] }), /* @__PURE__ */ jsxs(CardContent, {
|
|
1732
|
+
className: "flex flex-col gap-3",
|
|
1733
|
+
children: [
|
|
1734
|
+
defaultPaymentMethod && /* @__PURE__ */ jsx(PaymentMethodDropdown, {
|
|
1735
|
+
title: "",
|
|
1736
|
+
displayPaymentMethod: defaultPaymentMethod,
|
|
1737
|
+
paymentMethodList: [defaultPaymentMethod],
|
|
1738
|
+
onAddPaymentMethodClick: () => setIsOpen(true),
|
|
1739
|
+
onEditPaymentMethod: handleViewPaymentMethod,
|
|
1740
|
+
onDeletePaymentMethod: handleDeletePaymentMethod,
|
|
1741
|
+
onMakeDefaultPaymentMethod: onMakeDefaultPaymentMethod ? (pm) => onMakeDefaultPaymentMethod(pm.id) : void 0,
|
|
1742
|
+
accordionItemValue: "paymentMethods-preview",
|
|
1743
|
+
addPaymentMethodLabel: "",
|
|
1744
|
+
showAddButton: false,
|
|
1745
|
+
isLoading,
|
|
1746
|
+
borderStyle: "",
|
|
1747
|
+
hideTrigger: true,
|
|
1748
|
+
value: "paymentMethods-preview"
|
|
1749
|
+
}),
|
|
1750
|
+
extraPaymentMethods.length > 0 && /* @__PURE__ */ jsx(AnimatedExpand, {
|
|
1751
|
+
open: isExpanded,
|
|
1752
|
+
children: /* @__PURE__ */ jsx(PaymentMethodDropdown, {
|
|
1753
|
+
title: "",
|
|
1754
|
+
displayPaymentMethod: null,
|
|
1755
|
+
paymentMethodList: extraPaymentMethods,
|
|
1756
|
+
onAddPaymentMethodClick: () => setIsOpen(true),
|
|
1757
|
+
onEditPaymentMethod: handleViewPaymentMethod,
|
|
1758
|
+
onDeletePaymentMethod: handleDeletePaymentMethod,
|
|
1759
|
+
onMakeDefaultPaymentMethod: onMakeDefaultPaymentMethod ? (pm) => onMakeDefaultPaymentMethod(pm.id) : void 0,
|
|
1760
|
+
accordionItemValue: "paymentMethods-inner",
|
|
1761
|
+
addPaymentMethodLabel: "",
|
|
1762
|
+
showAddButton: false,
|
|
1763
|
+
isLoading,
|
|
1764
|
+
borderStyle: "",
|
|
1765
|
+
hideTrigger: true,
|
|
1766
|
+
value: "paymentMethods-inner"
|
|
1767
|
+
})
|
|
1768
|
+
}),
|
|
1769
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
1770
|
+
type: "button",
|
|
1771
|
+
variant: "link",
|
|
1772
|
+
size: "sm",
|
|
1773
|
+
className: "text-foreground mt-3 h-auto w-fit justify-start p-0 text-left",
|
|
1774
|
+
onClick: () => setIsOpen(true),
|
|
1775
|
+
children: ["+ ", t("add_payment_method")]
|
|
1776
|
+
})
|
|
1777
|
+
]
|
|
1778
|
+
})] })
|
|
1779
|
+
})
|
|
1637
1780
|
}),
|
|
1638
1781
|
renderCreditCardDialog?.({
|
|
1639
1782
|
isOpen,
|
|
1640
|
-
onClose:
|
|
1783
|
+
onClose: () => setIsOpen(false)
|
|
1641
1784
|
}),
|
|
1642
1785
|
/* @__PURE__ */ jsx(ConfirmActionDialog, {
|
|
1643
1786
|
title: t("delete_credit_card"),
|
|
@@ -1670,48 +1813,187 @@ function PaymentMethods({ paymentMethods, isLoading = false, onDeletePaymentMeth
|
|
|
1670
1813
|
}
|
|
1671
1814
|
//#endregion
|
|
1672
1815
|
//#region ../../profile/ui/src/components/profile.tsx
|
|
1673
|
-
function Profile({ customerAccount, languages, onUpdateCustomer, isUpdatingCustomer, onChangeEmail, isChangingEmail, pendingEmailChange, onCancelEmailChange, pendingEmail, rewardsPointsEnabled = false, pointsLedger, isLoadingPointsLedger, addresses, isLoadingAddresses, onDeleteAddress, isDeletingAddress, renderAddressDialog, paymentMethods, isLoadingPaymentMethods, onDeletePaymentMethod, isDeletingPaymentMethod, onUpdatePaymentMethod, isUpdatingPaymentMethod, getBillingAddress, countries, renderCreditCardDialog }) {
|
|
1674
|
-
return /* @__PURE__ */ jsxs(
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1816
|
+
function Profile({ customerAccount, languages, onUpdateCustomer, isUpdatingCustomer, onChangeEmail, isChangingEmail, pendingEmailChange, onCancelEmailChange, pendingEmail, rewardsPointsEnabled = false, pointsLedger, isLoadingPointsLedger, addresses, isLoadingAddresses, onDeleteAddress, isDeletingAddress, onMakeDefaultAddress, renderAddressDialog, paymentMethods, isLoadingPaymentMethods, onDeletePaymentMethod, isDeletingPaymentMethod, onMakeDefaultPaymentMethod, onUpdatePaymentMethod, isUpdatingPaymentMethod, getBillingAddress, countries, renderCreditCardDialog, children, footer }) {
|
|
1817
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1818
|
+
className: "space-y-6",
|
|
1819
|
+
children: [
|
|
1820
|
+
children,
|
|
1821
|
+
/* @__PURE__ */ jsx(CustomerInfo, {
|
|
1822
|
+
customerAccount,
|
|
1823
|
+
languages,
|
|
1824
|
+
onUpdateCustomer,
|
|
1825
|
+
isUpdating: isUpdatingCustomer,
|
|
1826
|
+
onChangeEmail,
|
|
1827
|
+
isChangingEmail,
|
|
1828
|
+
pendingEmailChange,
|
|
1829
|
+
onCancelEmailChange,
|
|
1830
|
+
pendingEmail
|
|
1831
|
+
}),
|
|
1832
|
+
rewardsPointsEnabled && /* @__PURE__ */ jsx(CustomerPointsLedger, {
|
|
1833
|
+
pointsLedger: pointsLedger ?? [],
|
|
1834
|
+
isLoading: isLoadingPointsLedger
|
|
1835
|
+
}),
|
|
1836
|
+
/* @__PURE__ */ jsx(Addresses, {
|
|
1693
1837
|
addresses,
|
|
1694
1838
|
isLoading: isLoadingAddresses,
|
|
1695
1839
|
onDeleteAddress,
|
|
1696
1840
|
isDeletingAddress,
|
|
1841
|
+
onMakeDefaultAddress,
|
|
1697
1842
|
renderAddressDialog
|
|
1698
|
-
})
|
|
1699
|
-
|
|
1700
|
-
/* @__PURE__ */ jsx("div", {
|
|
1701
|
-
id: "profile-payment-methods",
|
|
1702
|
-
children: /* @__PURE__ */ jsx(PaymentMethods, {
|
|
1843
|
+
}),
|
|
1844
|
+
/* @__PURE__ */ jsx(PaymentMethods, {
|
|
1703
1845
|
paymentMethods,
|
|
1704
1846
|
isLoading: isLoadingPaymentMethods,
|
|
1705
1847
|
onDeletePaymentMethod,
|
|
1706
1848
|
isDeletingPaymentMethod,
|
|
1849
|
+
onMakeDefaultPaymentMethod,
|
|
1707
1850
|
onUpdatePaymentMethod,
|
|
1708
1851
|
isUpdatingPaymentMethod,
|
|
1709
1852
|
getBillingAddress,
|
|
1710
1853
|
countries,
|
|
1711
1854
|
renderCreditCardDialog
|
|
1855
|
+
}),
|
|
1856
|
+
footer
|
|
1857
|
+
]
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region ../../profile/ui/src/components/my-site-profile-section.tsx
|
|
1862
|
+
function normalizeUrl(value) {
|
|
1863
|
+
const trimmed = value.trim();
|
|
1864
|
+
if (!trimmed) return "";
|
|
1865
|
+
if (/^https?:\/\//i.test(trimmed)) return trimmed;
|
|
1866
|
+
return `https://${trimmed}`;
|
|
1867
|
+
}
|
|
1868
|
+
const urlField = z.string().transform(normalizeUrl).pipe(z.string().url().or(z.literal("")));
|
|
1869
|
+
const mySiteProfileSchema = z.object({
|
|
1870
|
+
bio: z.string().optional(),
|
|
1871
|
+
linkedin: urlField,
|
|
1872
|
+
facebook: urlField,
|
|
1873
|
+
twitter: urlField,
|
|
1874
|
+
instagram: urlField,
|
|
1875
|
+
youtube: urlField,
|
|
1876
|
+
pinterest: urlField,
|
|
1877
|
+
tiktok: urlField,
|
|
1878
|
+
whatsapp: z.string().optional(),
|
|
1879
|
+
wechat: z.string().optional()
|
|
1880
|
+
});
|
|
1881
|
+
const socialFields = [
|
|
1882
|
+
{
|
|
1883
|
+
name: "linkedin",
|
|
1884
|
+
label: "LinkedIn",
|
|
1885
|
+
placeholder: "linkedin.com/in/username"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
name: "facebook",
|
|
1889
|
+
label: "Facebook",
|
|
1890
|
+
placeholder: "facebook.com/username"
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
name: "twitter",
|
|
1894
|
+
label: "X (Twitter)",
|
|
1895
|
+
placeholder: "x.com/username"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
name: "instagram",
|
|
1899
|
+
label: "Instagram",
|
|
1900
|
+
placeholder: "instagram.com/username"
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
name: "youtube",
|
|
1904
|
+
label: "YouTube",
|
|
1905
|
+
placeholder: "youtube.com/@channel"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
name: "pinterest",
|
|
1909
|
+
label: "Pinterest",
|
|
1910
|
+
placeholder: "pinterest.com/username"
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
name: "tiktok",
|
|
1914
|
+
label: "TikTok",
|
|
1915
|
+
placeholder: "tiktok.com/@username"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
name: "whatsapp",
|
|
1919
|
+
label: "WhatsApp",
|
|
1920
|
+
placeholder: "Phone number or link"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
name: "wechat",
|
|
1924
|
+
label: "WeChat",
|
|
1925
|
+
placeholder: "WeChat ID"
|
|
1926
|
+
}
|
|
1927
|
+
];
|
|
1928
|
+
function BioField({ control }) {
|
|
1929
|
+
const { field, fieldState: { error } } = useController({
|
|
1930
|
+
name: "bio",
|
|
1931
|
+
control
|
|
1932
|
+
});
|
|
1933
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1934
|
+
className: "space-y-1",
|
|
1935
|
+
children: [
|
|
1936
|
+
/* @__PURE__ */ jsx(Label, {
|
|
1937
|
+
htmlFor: "mysite-bio",
|
|
1938
|
+
className: "block text-sm font-medium",
|
|
1939
|
+
children: "Bio"
|
|
1940
|
+
}),
|
|
1941
|
+
/* @__PURE__ */ jsx(Textarea, {
|
|
1942
|
+
id: "mysite-bio",
|
|
1943
|
+
rows: 4,
|
|
1944
|
+
placeholder: "Tell people a little about yourself...",
|
|
1945
|
+
className: cn(error && "ring-destructive ring-1"),
|
|
1946
|
+
...field,
|
|
1947
|
+
value: field.value ?? ""
|
|
1948
|
+
}),
|
|
1949
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
1950
|
+
className: "text-destructive text-sm",
|
|
1951
|
+
children: error.message
|
|
1952
|
+
})
|
|
1953
|
+
]
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
function MySiteProfileSection({ avatarUrl, initial, control }) {
|
|
1957
|
+
return /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "About Me" }) }), /* @__PURE__ */ jsxs(CardContent, {
|
|
1958
|
+
className: "flex flex-col gap-6 lg:flex-row lg:gap-10",
|
|
1959
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1960
|
+
className: "bg-muted relative h-[120px] w-[120px] shrink-0 self-center overflow-hidden rounded-full lg:self-auto",
|
|
1961
|
+
children: avatarUrl ? /* @__PURE__ */ jsx("img", {
|
|
1962
|
+
src: avatarUrl,
|
|
1963
|
+
alt: "Profile",
|
|
1964
|
+
className: "h-full w-full object-cover"
|
|
1965
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1966
|
+
className: "bg-background text-foreground flex h-full w-full items-center justify-center text-xl font-semibold",
|
|
1967
|
+
children: initial ?? "U"
|
|
1712
1968
|
})
|
|
1969
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1970
|
+
className: "min-w-0 flex-1",
|
|
1971
|
+
children: /* @__PURE__ */ jsx(BioField, { control })
|
|
1972
|
+
})]
|
|
1973
|
+
})] });
|
|
1974
|
+
}
|
|
1975
|
+
function MySiteProfileSocialSection({ control }) {
|
|
1976
|
+
return /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "Social Media Links" }) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
|
|
1977
|
+
className: "space-y-4",
|
|
1978
|
+
children: socialFields.map((field) => /* @__PURE__ */ jsx(FormTextField$1, {
|
|
1979
|
+
control,
|
|
1980
|
+
name: field.name,
|
|
1981
|
+
label: field.label,
|
|
1982
|
+
placeholder: field.placeholder
|
|
1983
|
+
}, field.name))
|
|
1984
|
+
}) })] });
|
|
1985
|
+
}
|
|
1986
|
+
function MySiteProfileSaveButton({ isDirty, isPending, onSubmit }) {
|
|
1987
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1988
|
+
className: "flex justify-end pb-6",
|
|
1989
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
1990
|
+
type: "button",
|
|
1991
|
+
onClick: onSubmit,
|
|
1992
|
+
disabled: !isDirty || isPending,
|
|
1993
|
+
className: "w-full sm:w-auto",
|
|
1994
|
+
children: [isPending && /* @__PURE__ */ jsx("div", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isPending ? "Saving..." : "Save"]
|
|
1713
1995
|
})
|
|
1714
|
-
|
|
1996
|
+
});
|
|
1715
1997
|
}
|
|
1716
1998
|
//#endregion
|
|
1717
1999
|
//#region ../../fluid-pay/ui/src/components/form-fields/FormTextField.tsx
|
|
@@ -1732,7 +2014,7 @@ function FormTextField({ control, name, placeholder, containerClassName, type, d
|
|
|
1732
2014
|
placeholder,
|
|
1733
2015
|
"aria-invalid": !!error
|
|
1734
2016
|
}), error?.message && /* @__PURE__ */ jsx("p", {
|
|
1735
|
-
className: "text-
|
|
2017
|
+
className: "text-destructive text-sm",
|
|
1736
2018
|
children: error.message
|
|
1737
2019
|
})]
|
|
1738
2020
|
});
|
|
@@ -1751,7 +2033,7 @@ function FormSelectField({ control, name, placeholder = "Select", options, conta
|
|
|
1751
2033
|
disabled,
|
|
1752
2034
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1753
2035
|
"aria-invalid": !!error,
|
|
1754
|
-
className:
|
|
2036
|
+
className: "w-full",
|
|
1755
2037
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
1756
2038
|
}), /* @__PURE__ */ jsx(SelectContent, { children: options && options.length > 0 ? options.map((opt) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1757
2039
|
value: opt.value.toString(),
|
|
@@ -1762,7 +2044,7 @@ function FormSelectField({ control, name, placeholder = "Select", options, conta
|
|
|
1762
2044
|
children: "No available options"
|
|
1763
2045
|
}) })]
|
|
1764
2046
|
}), error?.message && /* @__PURE__ */ jsx("p", {
|
|
1765
|
-
className: "text-
|
|
2047
|
+
className: "text-destructive text-sm",
|
|
1766
2048
|
children: error.message
|
|
1767
2049
|
})] })
|
|
1768
2050
|
})
|
|
@@ -1967,16 +2249,15 @@ function AddressFormDialog({ isOpen, onClose, selectedAddress, onSubmit, isSubmi
|
|
|
1967
2249
|
className: "text-sm",
|
|
1968
2250
|
children: t("set_as_default_address")
|
|
1969
2251
|
})]
|
|
1970
|
-
}), /* @__PURE__ */
|
|
2252
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
1971
2253
|
type: "submit",
|
|
1972
2254
|
onClick: handleFormSubmit,
|
|
1973
2255
|
disabled: isSubmitting,
|
|
1974
|
-
className: "
|
|
1975
|
-
children: isSubmitting ? /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-white border-t-transparent" }) : t("save_address")
|
|
2256
|
+
children: [isSubmitting && /* @__PURE__ */ jsx("div", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isSubmitting ? t("saving") : t("save_address")]
|
|
1976
2257
|
})]
|
|
1977
2258
|
}),
|
|
1978
2259
|
error && /* @__PURE__ */ jsx("div", {
|
|
1979
|
-
className: "mt-2 text-sm
|
|
2260
|
+
className: "text-destructive mt-2 text-sm",
|
|
1980
2261
|
children: error
|
|
1981
2262
|
})
|
|
1982
2263
|
]
|
|
@@ -2015,6 +2296,7 @@ function useVgsCollect() {
|
|
|
2015
2296
|
const [isFormReady, setIsFormReady] = useState(false);
|
|
2016
2297
|
const [isLoading, setIsLoading] = useState(false);
|
|
2017
2298
|
const [isScriptLoaded, setIsScriptLoaded] = useState(false);
|
|
2299
|
+
const [scriptLoadError, setScriptLoadError] = useState(void 0);
|
|
2018
2300
|
const [vgsFieldState, setVgsFieldState] = useState(DEFAULT_FIELD_STATE);
|
|
2019
2301
|
const formRef = useRef(null);
|
|
2020
2302
|
const onSuccessRef = useRef(null);
|
|
@@ -2032,7 +2314,11 @@ function useVgsCollect() {
|
|
|
2032
2314
|
script.src = "https://js.verygoodvault.com/vgs-collect/3.3.0/vgs-collect.js";
|
|
2033
2315
|
script.async = true;
|
|
2034
2316
|
script.onload = () => setIsScriptLoaded(true);
|
|
2035
|
-
script.onerror = () =>
|
|
2317
|
+
script.onerror = () => {
|
|
2318
|
+
const message = "Failed to load payment form";
|
|
2319
|
+
setScriptLoadError(message);
|
|
2320
|
+
onErrorRef.current?.(message);
|
|
2321
|
+
};
|
|
2036
2322
|
document.head.appendChild(script);
|
|
2037
2323
|
}, [isScriptLoaded]);
|
|
2038
2324
|
const updateFieldState = useCallback((state) => {
|
|
@@ -2100,20 +2386,25 @@ function useVgsCollect() {
|
|
|
2100
2386
|
return waitForDom();
|
|
2101
2387
|
};
|
|
2102
2388
|
if (!await waitForDom()) throw new Error("Payment form elements not ready");
|
|
2389
|
+
const themedNode = document.getElementById("vgs-card-number");
|
|
2390
|
+
const probeStyle = themedNode ? getComputedStyle(themedNode) : null;
|
|
2391
|
+
const foregroundColor = probeStyle?.getPropertyValue("--color-foreground").trim() || "#0a0a0a";
|
|
2392
|
+
const mutedForegroundColor = probeStyle?.getPropertyValue("--color-muted-foreground").trim() || "#737373";
|
|
2103
2393
|
const css = {
|
|
2104
2394
|
fontSize: "14px",
|
|
2105
2395
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
2106
|
-
color:
|
|
2396
|
+
color: foregroundColor,
|
|
2397
|
+
background: "transparent",
|
|
2107
2398
|
paddingTop: "0px",
|
|
2108
2399
|
paddingBottom: "0px",
|
|
2109
2400
|
paddingLeft: "0px",
|
|
2110
2401
|
paddingRight: "0px",
|
|
2111
2402
|
boxSizing: "border-box",
|
|
2112
|
-
lineHeight: "
|
|
2403
|
+
lineHeight: "26px",
|
|
2113
2404
|
height: "100%",
|
|
2114
2405
|
width: "100%",
|
|
2115
2406
|
"&::placeholder": {
|
|
2116
|
-
color:
|
|
2407
|
+
color: mutedForegroundColor,
|
|
2117
2408
|
opacity: 1
|
|
2118
2409
|
},
|
|
2119
2410
|
"&:focus": { outline: "none" }
|
|
@@ -2196,6 +2487,7 @@ function useVgsCollect() {
|
|
|
2196
2487
|
isFormReady,
|
|
2197
2488
|
isLoading,
|
|
2198
2489
|
isScriptLoaded,
|
|
2490
|
+
scriptLoadError,
|
|
2199
2491
|
initializeForm,
|
|
2200
2492
|
submitCard,
|
|
2201
2493
|
vgsFieldState,
|
|
@@ -2216,24 +2508,25 @@ const billingAddressSchema = z.object({
|
|
|
2216
2508
|
country_code: z.string().min(1, "Country is required"),
|
|
2217
2509
|
set_as_default: z.boolean()
|
|
2218
2510
|
});
|
|
2219
|
-
function VgsInputWrapper({ id, fieldState, className }) {
|
|
2511
|
+
function VgsInputWrapper({ id, label, fieldState, className }) {
|
|
2220
2512
|
const isInvalid = fieldState?.isValid === false && !fieldState?.isFocused && !fieldState?.isEmpty;
|
|
2221
|
-
const isFocused = fieldState?.isFocused;
|
|
2513
|
+
const isFocused = !!fieldState?.isFocused;
|
|
2222
2514
|
return /* @__PURE__ */ jsx("div", {
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2515
|
+
id,
|
|
2516
|
+
role: "group",
|
|
2517
|
+
"aria-label": label,
|
|
2518
|
+
"data-invalid": isInvalid ? "" : void 0,
|
|
2519
|
+
className: cn("border-input selection:bg-primary selection:text-primary-foreground file:text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "data-[invalid]:border-destructive data-[invalid]:ring-destructive/20", "[&_iframe]:block! [&_iframe]:h-full! [&_iframe]:w-full! [&_iframe]:border-0!", isFocused && "border-ring ring-ring/50 ring-[3px]", isFocused && isInvalid && "border-destructive ring-destructive/20", className)
|
|
2228
2520
|
});
|
|
2229
2521
|
}
|
|
2230
|
-
function VgsCardForm({
|
|
2522
|
+
function VgsCardForm({ vgsFieldState, networkError }) {
|
|
2231
2523
|
return /* @__PURE__ */ jsxs("div", {
|
|
2232
2524
|
className: "space-y-4",
|
|
2233
2525
|
"aria-label": "Credit card form",
|
|
2234
2526
|
children: [
|
|
2235
2527
|
/* @__PURE__ */ jsx(VgsInputWrapper, {
|
|
2236
2528
|
id: "vgs-card-number",
|
|
2529
|
+
label: "Card number",
|
|
2237
2530
|
fieldState: vgsFieldState["card_number"]
|
|
2238
2531
|
}),
|
|
2239
2532
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -2242,22 +2535,25 @@ function VgsCardForm({ isLoading, isFormReady, vgsFieldState, networkError, t })
|
|
|
2242
2535
|
className: "flex-1",
|
|
2243
2536
|
children: /* @__PURE__ */ jsx(VgsInputWrapper, {
|
|
2244
2537
|
id: "vgs-expiration-date",
|
|
2538
|
+
label: "Expiration date",
|
|
2245
2539
|
fieldState: vgsFieldState["card_exp"]
|
|
2246
2540
|
})
|
|
2247
2541
|
}), /* @__PURE__ */ jsx("div", {
|
|
2248
2542
|
className: "flex-1",
|
|
2249
2543
|
children: /* @__PURE__ */ jsx(VgsInputWrapper, {
|
|
2250
2544
|
id: "vgs-cvc",
|
|
2545
|
+
label: "CVC",
|
|
2251
2546
|
fieldState: vgsFieldState["card_cvc"]
|
|
2252
2547
|
})
|
|
2253
2548
|
})]
|
|
2254
2549
|
}),
|
|
2255
2550
|
/* @__PURE__ */ jsx(VgsInputWrapper, {
|
|
2256
2551
|
id: "vgs-card-holder",
|
|
2552
|
+
label: "Cardholder name",
|
|
2257
2553
|
fieldState: vgsFieldState["card_holder"]
|
|
2258
2554
|
}),
|
|
2259
2555
|
networkError && networkError.trim().length > 0 && /* @__PURE__ */ jsx("div", {
|
|
2260
|
-
className: "
|
|
2556
|
+
className: "bg-destructive/10 text-destructive rounded-md p-3 text-sm",
|
|
2261
2557
|
children: networkError
|
|
2262
2558
|
})
|
|
2263
2559
|
]
|
|
@@ -2267,7 +2563,7 @@ function CreditCardFormDialog({ isOpen, onClose, onSubmit, isSubmitting, countri
|
|
|
2267
2563
|
const api = useFluidPayApi();
|
|
2268
2564
|
const [cardError, setCardError] = useState(void 0);
|
|
2269
2565
|
const [isVgsSubmitting, setIsVgsSubmitting] = useState(false);
|
|
2270
|
-
const { isFormReady, isLoading: isVgsLoading, isScriptLoaded, initializeForm, submitCard, vgsFieldState, resetVgs, onSuccessRef, onErrorRef } = useVgsCollect();
|
|
2566
|
+
const { isFormReady, isLoading: isVgsLoading, isScriptLoaded, scriptLoadError, initializeForm, submitCard, vgsFieldState, resetVgs, onSuccessRef, onErrorRef } = useVgsCollect();
|
|
2271
2567
|
const { control, handleSubmit, reset, setValue } = useZodForm(billingAddressSchema, { defaultValues: {
|
|
2272
2568
|
name: "",
|
|
2273
2569
|
address1: "",
|
|
@@ -2369,6 +2665,9 @@ function CreditCardFormDialog({ isOpen, onClose, onSubmit, isSubmitting, countri
|
|
|
2369
2665
|
}
|
|
2370
2666
|
});
|
|
2371
2667
|
setIsVgsSubmitting(false);
|
|
2668
|
+
}, () => {
|
|
2669
|
+
setCardError("Please fix the errors in the billing address.");
|
|
2670
|
+
setIsVgsSubmitting(false);
|
|
2372
2671
|
})();
|
|
2373
2672
|
}, [handleSubmit, onSubmit]);
|
|
2374
2673
|
const handleVgsError = useCallback((err) => {
|
|
@@ -2401,37 +2700,31 @@ function CreditCardFormDialog({ isOpen, onClose, onSubmit, isSubmitting, countri
|
|
|
2401
2700
|
open: isOpen,
|
|
2402
2701
|
onOpenChange: (open) => !open && handleClose(),
|
|
2403
2702
|
children: /* @__PURE__ */ jsx(DialogContent, {
|
|
2404
|
-
className: "max-h-[90vh] max-w-md overflow-y-auto
|
|
2703
|
+
className: "max-h-[90vh] max-w-md overflow-y-auto p-0 md:max-w-xl",
|
|
2405
2704
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2406
2705
|
className: "relative p-6",
|
|
2407
2706
|
children: [
|
|
2408
|
-
(isVgsLoading || !isFormReady) && /* @__PURE__ */ jsx("div", {
|
|
2409
|
-
className: "absolute inset-0 z-10 flex items-center justify-center rounded
|
|
2707
|
+
(isVgsLoading || !isFormReady) && !scriptLoadError && /* @__PURE__ */ jsx("div", {
|
|
2708
|
+
className: "bg-background/80 absolute inset-0 z-10 flex items-center justify-center rounded backdrop-blur-[1px]",
|
|
2410
2709
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2411
2710
|
className: "flex items-center justify-center",
|
|
2412
|
-
children: [/* @__PURE__ */ jsx("div", { className: "mr-3 h-5 w-5 animate-spin rounded-full border-2 border-t-2 border-
|
|
2413
|
-
className: "text-sm font-medium
|
|
2711
|
+
children: [/* @__PURE__ */ jsx("div", { className: "border-primary mr-3 h-5 w-5 animate-spin rounded-full border-2 border-t-2 border-t-transparent" }), /* @__PURE__ */ jsx("p", {
|
|
2712
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
2414
2713
|
children: t("securing")
|
|
2415
2714
|
})]
|
|
2416
2715
|
})
|
|
2417
2716
|
}),
|
|
2418
|
-
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, {
|
|
2419
|
-
className: "text-lg font-medium",
|
|
2420
|
-
children: t("add_credit_card")
|
|
2421
|
-
}) }),
|
|
2717
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("add_credit_card") }) }),
|
|
2422
2718
|
/* @__PURE__ */ jsxs("div", {
|
|
2423
2719
|
className: "space-y-4 pt-6",
|
|
2424
2720
|
children: [/* @__PURE__ */ jsx(VgsCardForm, {
|
|
2425
|
-
isLoading: isVgsLoading,
|
|
2426
|
-
isFormReady,
|
|
2427
2721
|
vgsFieldState,
|
|
2428
|
-
networkError: cardError ?? error
|
|
2429
|
-
t
|
|
2722
|
+
networkError: cardError ?? scriptLoadError ?? error
|
|
2430
2723
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2431
2724
|
className: "space-y-3 pt-2",
|
|
2432
2725
|
children: [
|
|
2433
2726
|
/* @__PURE__ */ jsx("h3", {
|
|
2434
|
-
className: "text-sm font-medium
|
|
2727
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
2435
2728
|
children: t("billing_address")
|
|
2436
2729
|
}),
|
|
2437
2730
|
/* @__PURE__ */ jsx(FormSelectField, {
|
|
@@ -2509,12 +2802,11 @@ function CreditCardFormDialog({ isOpen, onClose, onSubmit, isSubmitting, countri
|
|
|
2509
2802
|
className: "text-sm",
|
|
2510
2803
|
children: t("set_as_default_payment_method")
|
|
2511
2804
|
})]
|
|
2512
|
-
}), /* @__PURE__ */
|
|
2513
|
-
type: "
|
|
2805
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
2806
|
+
type: "button",
|
|
2514
2807
|
onClick: handleFormSubmit,
|
|
2515
2808
|
disabled: isBusy,
|
|
2516
|
-
className: "
|
|
2517
|
-
children: isBusy ? /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-white border-t-transparent" }) : t("save_card")
|
|
2809
|
+
children: [isBusy && /* @__PURE__ */ jsx("div", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }), isBusy ? t("saving") : t("save_card")]
|
|
2518
2810
|
})]
|
|
2519
2811
|
})
|
|
2520
2812
|
]
|
|
@@ -2602,6 +2894,6 @@ function createFluidPayApiAdapter(payApi) {
|
|
|
2602
2894
|
};
|
|
2603
2895
|
}
|
|
2604
2896
|
//#endregion
|
|
2605
|
-
export {
|
|
2897
|
+
export { MySiteProfileSaveButton as a, mySiteProfileSchema as c, PaymentIcon as d, getCardDisplayName as f, ProfileUIProvider as h, AddressFormDialog as i, socialFields as l, FluidPayCoreProvider as m, mapToFluidPayPaymentMethod as n, MySiteProfileSection as o, getCardExpiry as p, CreditCardFormDialog as r, MySiteProfileSocialSection as s, createFluidPayApiAdapter as t, Profile as u };
|
|
2606
2898
|
|
|
2607
|
-
//# sourceMappingURL=fluid-pay-api-adapter-
|
|
2899
|
+
//# sourceMappingURL=fluid-pay-api-adapter-CJ7-I8k-.mjs.map
|