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