@usethrottle/auth 0.3.0 → 0.4.0
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/{chunk-NCSTIPJF.js → chunk-HQP5QTHQ.js} +3 -1
- package/dist/{chunk-NCSTIPJF.js.map → chunk-HQP5QTHQ.js.map} +1 -1
- package/dist/{chunk-ST77QX7X.js → chunk-K7RCWADI.js} +18 -1
- package/dist/chunk-K7RCWADI.js.map +1 -0
- package/dist/{chunk-2DREGJUF.js → chunk-TKSBAC7W.js} +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/react/components/index.cjs +761 -471
- package/dist/react/components/index.cjs.map +1 -1
- package/dist/react/components/index.d.cts +62 -6
- package/dist/react/components/index.d.ts +62 -6
- package/dist/react/components/index.js +814 -543
- package/dist/react/components/index.js.map +1 -1
- package/dist/react/forms/index.cjs +17 -0
- package/dist/react/forms/index.cjs.map +1 -1
- package/dist/react/forms/index.js +2 -2
- package/dist/react/index.cjs +2 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +40 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.js +2 -2
- package/dist/styles.css +49 -3
- package/package.json +1 -1
- package/dist/chunk-ST77QX7X.js.map +0 -1
- /package/dist/{chunk-2DREGJUF.js.map → chunk-TKSBAC7W.js.map} +0 -0
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
useOrders,
|
|
9
9
|
useSavedCards,
|
|
10
10
|
useSubscriptions
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-TKSBAC7W.js";
|
|
12
12
|
import {
|
|
13
13
|
messageForError
|
|
14
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-K7RCWADI.js";
|
|
15
15
|
import {
|
|
16
16
|
ThrottleAuthError,
|
|
17
17
|
ThrottleAuthProvider,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
memoryStorage,
|
|
22
22
|
useAuth,
|
|
23
23
|
useAuthContext
|
|
24
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-HQP5QTHQ.js";
|
|
25
25
|
|
|
26
26
|
// src/react/components/provider.tsx
|
|
27
|
-
import { createContext as createContext6, useCallback as useCallback4, useContext as useContext6, useMemo as useMemo4, useRef as useRef9, useState as
|
|
27
|
+
import { createContext as createContext6, useCallback as useCallback4, useContext as useContext6, useMemo as useMemo4, useRef as useRef9, useState as useState21 } from "react";
|
|
28
28
|
|
|
29
29
|
// src/react/components/appearance.tsx
|
|
30
30
|
import { createContext, useContext, useMemo } from "react";
|
|
@@ -293,6 +293,24 @@ var THROTTLE_ELEMENT_KEYS = [
|
|
|
293
293
|
"orderDetail.payButton",
|
|
294
294
|
"orderDetail.trackButton",
|
|
295
295
|
"orderDetail.reorderButton",
|
|
296
|
+
// Two-column detail layout, shared by the order and invoice pages.
|
|
297
|
+
"orderDetail.layout",
|
|
298
|
+
"orderDetail.main",
|
|
299
|
+
"orderDetail.rail",
|
|
300
|
+
"orderDetail.cancelButton",
|
|
301
|
+
"orderDetail.returnButton",
|
|
302
|
+
"orderDetail.invoiceButton",
|
|
303
|
+
"orderDetail.actions",
|
|
304
|
+
"invoiceDetail.layout",
|
|
305
|
+
"invoiceDetail.main",
|
|
306
|
+
"invoiceDetail.rail",
|
|
307
|
+
"invoiceDetail.lineItems",
|
|
308
|
+
"invoiceDetail.lineItem",
|
|
309
|
+
"invoiceDetail.orderLink",
|
|
310
|
+
"invoiceDetail.subscriptionLink",
|
|
311
|
+
"invoiceDetail.payButton",
|
|
312
|
+
"invoiceDetail.actions",
|
|
313
|
+
"fieldRow",
|
|
296
314
|
"confirm.header",
|
|
297
315
|
"confirm.title",
|
|
298
316
|
"confirm.body",
|
|
@@ -555,6 +573,17 @@ var enUS = {
|
|
|
555
573
|
payNow: "Pay now",
|
|
556
574
|
track: "Track shipment",
|
|
557
575
|
reorder: "Order again",
|
|
576
|
+
cancelOrder: "Cancel order",
|
|
577
|
+
cancelOrderConfirm: "Cancel this order?",
|
|
578
|
+
cancelOrderBody: "This cannot be undone. Nothing has been charged, so there is nothing to refund.",
|
|
579
|
+
cancelOrderAction: "Cancel order",
|
|
580
|
+
requestReturn: "Request a return",
|
|
581
|
+
requestReturnConfirm: "Request a return for this order?",
|
|
582
|
+
requestReturnBody: "The merchant reviews your request and will be in touch. Nothing is refunded until they approve it.",
|
|
583
|
+
requestReturnAction: "Send request",
|
|
584
|
+
returnRequested: "Return requested. The merchant will be in touch.",
|
|
585
|
+
downloadInvoice: "Download invoice",
|
|
586
|
+
summary: "Summary",
|
|
558
587
|
empty: "No orders yet",
|
|
559
588
|
emptyDescription: "Orders you place will appear here.",
|
|
560
589
|
gatedDescription: "Verify your email to see your order history.",
|
|
@@ -618,6 +647,12 @@ var enUS = {
|
|
|
618
647
|
refunded: "Refunded",
|
|
619
648
|
period: "Period",
|
|
620
649
|
downloadButton: "Download PDF",
|
|
650
|
+
items: "Items",
|
|
651
|
+
summary: "Summary",
|
|
652
|
+
viewOrder: "View order",
|
|
653
|
+
viewSubscription: "View subscription",
|
|
654
|
+
payButton: "Pay this invoice",
|
|
655
|
+
billedTo: "Billed to",
|
|
621
656
|
/** Display copy for `invoice.status` — the wire values are paid|open|void. */
|
|
622
657
|
statusLabels: { paid: "Paid", open: "Open", void: "Void" },
|
|
623
658
|
downloadUnavailable: "This invoice is not available to download right now."
|
|
@@ -932,11 +967,13 @@ var THROTTLE_STYLES = `
|
|
|
932
967
|
align-items: center;
|
|
933
968
|
justify-content: center;
|
|
934
969
|
cursor: pointer;
|
|
970
|
+
/* A label that wraps turns a control into a two-line block of text. */
|
|
971
|
+
white-space: nowrap;
|
|
935
972
|
transition: opacity var(--throttle-transition), background-color var(--throttle-transition), border-color var(--throttle-transition), filter var(--throttle-transition), box-shadow var(--throttle-transition);
|
|
936
973
|
}
|
|
937
974
|
.throttle-button:disabled { opacity: .55; cursor: not-allowed; }
|
|
938
975
|
.throttle-button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--throttle-color-background), 0 0 0 4px var(--throttle-color-primary); }
|
|
939
|
-
.throttle-button--primary { background: var(--throttle-color-primary); color: var(--throttle-color-primary-foreground); width: 100
|
|
976
|
+
.throttle-button--primary { background: var(--throttle-color-primary); color: var(--throttle-color-primary-foreground); width: var(--throttle-button-width, 100%); }
|
|
940
977
|
.throttle-button--primary:hover:not(:disabled) { filter: brightness(0.92); }
|
|
941
978
|
.throttle-button--secondary { background: var(--throttle-color-surface); color: var(--throttle-color-foreground); border-color: var(--throttle-color-border-control); }
|
|
942
979
|
.throttle-button--secondary:hover:not(:disabled) { background: var(--throttle-color-muted); }
|
|
@@ -1055,6 +1092,7 @@ var THROTTLE_STYLES = `
|
|
|
1055
1092
|
is near-white, so on a light host page it was rendering white-on-white. */
|
|
1056
1093
|
.throttle-cardframe { width: 100%; min-height: 420px; border: 0; display: block; }
|
|
1057
1094
|
.throttle-centre { display: flex; align-items: center; justify-content: center; min-height: 160px; }
|
|
1095
|
+
.throttle-fieldrow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--throttle-space-4); align-items: start; }
|
|
1058
1096
|
.throttle-section__title { font-size: var(--throttle-font-size-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--throttle-color-muted-foreground); margin: 0 0 var(--throttle-space-2); font-weight: 600; }
|
|
1059
1097
|
.throttle-addresses { display: grid; grid-template-columns: 1fr 1fr; gap: var(--throttle-space-5); }
|
|
1060
1098
|
.throttle-addressblock__line { margin: 0 0 2px; }
|
|
@@ -1100,7 +1138,12 @@ var THROTTLE_STYLES = `
|
|
|
1100
1138
|
it span. Stretch it explicitly when stacked. */
|
|
1101
1139
|
.throttle-account { flex-direction: column; align-items: stretch; gap: var(--throttle-space-4); }
|
|
1102
1140
|
.throttle-addresses { grid-template-columns: 1fr; }
|
|
1141
|
+
.throttle-fieldrow { grid-template-columns: 1fr; }
|
|
1103
1142
|
.throttle-tabs__rail { width: 100%; }
|
|
1143
|
+
/* One column, and the rail stops sticking \u2014 on a phone a sticky summary
|
|
1144
|
+
covers the very line items it is summarising. */
|
|
1145
|
+
.throttle-detail { grid-template-columns: 1fr; }
|
|
1146
|
+
.throttle-detail__rail { position: static; }
|
|
1104
1147
|
}
|
|
1105
1148
|
|
|
1106
1149
|
.throttle-table { width: 100%; border-collapse: collapse; text-align: left; }
|
|
@@ -1178,12 +1221,50 @@ var THROTTLE_STYLES = `
|
|
|
1178
1221
|
padding: var(--throttle-space-3) 0;
|
|
1179
1222
|
}
|
|
1180
1223
|
.throttle-rowitem:first-child { border-top: none; padding-top: 0; }
|
|
1181
|
-
.throttle-actions {
|
|
1224
|
+
.throttle-actions {
|
|
1225
|
+
display: flex; gap: var(--throttle-space-2); flex-wrap: wrap; align-items: center;
|
|
1226
|
+
/* Primary buttons are full-width so a form's submit fills its card. In a row
|
|
1227
|
+
of sibling actions that same rule made every button claim 100% and then
|
|
1228
|
+
shrink to share the line, squeezing Resume to 59px so its label wrapped to
|
|
1229
|
+
two lines inside a 48px box. A custom property INHERITS to the buttons, so
|
|
1230
|
+
the row opts them back to content width without a descendant selector \u2014
|
|
1231
|
+
those outrank the merchant overrides in appearance.elements. */
|
|
1232
|
+
--throttle-button-width: auto;
|
|
1233
|
+
}
|
|
1182
1234
|
.throttle-table__money { display: block; text-align: right; font-variant-numeric: tabular-nums; }
|
|
1183
|
-
.throttle-lineitem { display: flex; align-items:
|
|
1235
|
+
.throttle-lineitem { display: flex; align-items: flex-start; gap: var(--throttle-space-3); padding: var(--throttle-space-2) 0; }
|
|
1236
|
+
/* The UA's 1em paragraph margins pushed a two-line item to 96px, so five
|
|
1237
|
+
items filled a screen with mostly whitespace. These carry the spacing
|
|
1238
|
+
instead. Separate classes, not a ".throttle-lineitem p" descendant
|
|
1239
|
+
selector -- those outrank the merchant's appearance.elements overrides. */
|
|
1240
|
+
.throttle-lineitem__desc { margin: var(--throttle-space-1) 0 0; color: var(--throttle-color-muted-foreground); }
|
|
1241
|
+
.throttle-lineitem__meta { margin: var(--throttle-space-1) 0 0; color: var(--throttle-color-muted-foreground); font-size: var(--throttle-font-size-sm); }
|
|
1184
1242
|
.throttle-lineitem__image { width: 48px; height: 48px; object-fit: cover; border-radius: var(--throttle-radius-sm); flex: none; }
|
|
1185
1243
|
.throttle-totals { display: flex; flex-direction: column; gap: var(--throttle-space-1); }
|
|
1186
1244
|
|
|
1245
|
+
/* Order and invoice detail: the record on the left, what it costs and what
|
|
1246
|
+
you can do about it on the right. The rail sticks so the total and the
|
|
1247
|
+
actions stay reachable on an order with thirty lines, which is exactly when
|
|
1248
|
+
a buyer most wants them. Collapses below, where a sticky rail would eat a
|
|
1249
|
+
phone screen. */
|
|
1250
|
+
.throttle-detail { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: var(--throttle-space-6); align-items: start; }
|
|
1251
|
+
.throttle-detail__main { display: flex; flex-direction: column; gap: var(--throttle-space-5); min-width: 0; }
|
|
1252
|
+
.throttle-detail__rail {
|
|
1253
|
+
display: flex; flex-direction: column; gap: var(--throttle-space-4);
|
|
1254
|
+
position: sticky; top: var(--throttle-space-4);
|
|
1255
|
+
padding: var(--throttle-space-4);
|
|
1256
|
+
border: var(--throttle-border-width) solid var(--throttle-color-border);
|
|
1257
|
+
border-radius: var(--throttle-radius-md);
|
|
1258
|
+
background: var(--throttle-color-surface);
|
|
1259
|
+
}
|
|
1260
|
+
/* The one number the buyer came for. */
|
|
1261
|
+
.throttle-detail__headline { font-size: var(--throttle-font-size-xl); font-weight: 600; line-height: 1.2; }
|
|
1262
|
+
.throttle-detail__section { display: flex; flex-direction: column; gap: var(--throttle-space-2); }
|
|
1263
|
+
.throttle-detail__label { font-size: var(--throttle-font-size-sm); font-weight: 500; color: var(--throttle-color-muted-foreground); letter-spacing: .04em; text-transform: uppercase; }
|
|
1264
|
+
/* A rail action column: full width, stacked, so the primary reads as primary. */
|
|
1265
|
+
.throttle-detail__actions { display: flex; flex-direction: column; gap: var(--throttle-space-2); --throttle-button-width: 100%; }
|
|
1266
|
+
.throttle-detail__link { display: inline-flex; align-items: center; gap: var(--throttle-space-1); }
|
|
1267
|
+
|
|
1187
1268
|
@media (prefers-reduced-motion: reduce) {
|
|
1188
1269
|
.throttle-button, .throttle-field__input, .throttle-dropdown__item, .throttle-dropdown__trigger, .throttle-tabs__tab, .throttle-table__row, .throttle-modal__close {
|
|
1189
1270
|
transition: none;
|
|
@@ -1302,13 +1383,20 @@ function FieldGroup(props) {
|
|
|
1302
1383
|
] }, i)) });
|
|
1303
1384
|
}
|
|
1304
1385
|
|
|
1305
|
-
// src/react/components/primitives/
|
|
1386
|
+
// src/react/components/primitives/FieldRow.tsx
|
|
1306
1387
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1388
|
+
function FieldRow({ children }) {
|
|
1389
|
+
const a = useAppearance();
|
|
1390
|
+
return /* @__PURE__ */ jsx8("div", { ...a.el("fieldRow", "throttle-fieldrow"), children });
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// src/react/components/primitives/Alert.tsx
|
|
1394
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1307
1395
|
function Alert(props) {
|
|
1308
1396
|
const a = useAppearance();
|
|
1309
1397
|
const Slot = a.slots.Alert;
|
|
1310
|
-
if (Slot) return /* @__PURE__ */
|
|
1311
|
-
return /* @__PURE__ */
|
|
1398
|
+
if (Slot) return /* @__PURE__ */ jsx9(Slot, { tone: props.tone, children: props.children });
|
|
1399
|
+
return /* @__PURE__ */ jsx9(
|
|
1312
1400
|
"p",
|
|
1313
1401
|
{
|
|
1314
1402
|
...a.el("alert", `throttle-alert throttle-alert--${props.tone}`),
|
|
@@ -1319,11 +1407,11 @@ function Alert(props) {
|
|
|
1319
1407
|
}
|
|
1320
1408
|
|
|
1321
1409
|
// src/react/components/primitives/Skeleton.tsx
|
|
1322
|
-
import { jsx as
|
|
1410
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1323
1411
|
function Skeleton(props) {
|
|
1324
1412
|
const a = useAppearance();
|
|
1325
1413
|
const rows = Array.from({ length: props.count ?? 1 });
|
|
1326
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx10("div", { "aria-hidden": "true", className: "throttle-stack", children: rows.map((_, i) => /* @__PURE__ */ jsx10("span", { ...a.el("skeleton", "throttle-skeleton") }, i)) });
|
|
1327
1415
|
}
|
|
1328
1416
|
|
|
1329
1417
|
// src/react/components/primitives/Modal.tsx
|
|
@@ -1332,10 +1420,10 @@ import { createPortal } from "react-dom";
|
|
|
1332
1420
|
|
|
1333
1421
|
// src/react/components/surface.tsx
|
|
1334
1422
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1335
|
-
import { jsx as
|
|
1423
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1336
1424
|
var Ctx4 = createContext4("standalone");
|
|
1337
1425
|
function SurfaceProvider(props) {
|
|
1338
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ jsx11(Ctx4.Provider, { value: props.value, children: props.children });
|
|
1339
1427
|
}
|
|
1340
1428
|
function useSurface() {
|
|
1341
1429
|
return useContext4(Ctx4);
|
|
@@ -1345,7 +1433,7 @@ function useCardClass() {
|
|
|
1345
1433
|
}
|
|
1346
1434
|
|
|
1347
1435
|
// src/react/components/primitives/Modal.tsx
|
|
1348
|
-
import { jsx as
|
|
1436
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1349
1437
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1350
1438
|
function Modal(props) {
|
|
1351
1439
|
const a = useAppearance();
|
|
@@ -1396,7 +1484,7 @@ function Modal(props) {
|
|
|
1396
1484
|
}, [props.open, mounted]);
|
|
1397
1485
|
if (!props.open || !mounted) return null;
|
|
1398
1486
|
return createPortal(
|
|
1399
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ jsx12("div", { ...a.rootProps, children: /* @__PURE__ */ jsx12(
|
|
1400
1488
|
"div",
|
|
1401
1489
|
{
|
|
1402
1490
|
...a.el(props.overlayKey ?? "modal.overlay", "throttle-modal__overlay"),
|
|
@@ -1414,7 +1502,7 @@ function Modal(props) {
|
|
|
1414
1502
|
"aria-labelledby": props.labelledBy,
|
|
1415
1503
|
tabIndex: -1,
|
|
1416
1504
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ jsx12(
|
|
1418
1506
|
"button",
|
|
1419
1507
|
{
|
|
1420
1508
|
...a.el("modal.closeButton", "throttle-modal__close"),
|
|
@@ -1424,7 +1512,7 @@ function Modal(props) {
|
|
|
1424
1512
|
children: "\xD7"
|
|
1425
1513
|
}
|
|
1426
1514
|
),
|
|
1427
|
-
/* @__PURE__ */
|
|
1515
|
+
/* @__PURE__ */ jsx12(SurfaceProvider, { value: "modal", children: props.children })
|
|
1428
1516
|
]
|
|
1429
1517
|
}
|
|
1430
1518
|
)
|
|
@@ -1435,15 +1523,23 @@ function Modal(props) {
|
|
|
1435
1523
|
}
|
|
1436
1524
|
|
|
1437
1525
|
// src/react/components/primitives/Confirm.tsx
|
|
1438
|
-
import { createContext as createContext5, useCallback, useContext as useContext5, useId as useId2, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
|
|
1439
|
-
import { jsx as
|
|
1526
|
+
import { createContext as createContext5, useCallback, useContext as useContext5, useEffect as useEffect2, useId as useId2, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
|
|
1527
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1440
1528
|
var ConfirmContext = createContext5(null);
|
|
1441
|
-
function ConfirmProvider({
|
|
1529
|
+
function ConfirmProvider({
|
|
1530
|
+
children,
|
|
1531
|
+
stepUpOpen = false,
|
|
1532
|
+
onStepUpResolve
|
|
1533
|
+
}) {
|
|
1442
1534
|
const [request, setRequest] = useState2(null);
|
|
1535
|
+
const [password, setPassword] = useState2("");
|
|
1443
1536
|
const { t } = useCopy();
|
|
1444
1537
|
const a = useAppearance();
|
|
1445
1538
|
const titleId = useId2();
|
|
1446
1539
|
const settle = useRef2(null);
|
|
1540
|
+
useEffect2(() => {
|
|
1541
|
+
if (!stepUpOpen) setPassword("");
|
|
1542
|
+
}, [stepUpOpen]);
|
|
1447
1543
|
const answer = useCallback((value) => {
|
|
1448
1544
|
settle.current?.(value);
|
|
1449
1545
|
settle.current = null;
|
|
@@ -1456,14 +1552,52 @@ function ConfirmProvider({ children }) {
|
|
|
1456
1552
|
settle.current = resolve;
|
|
1457
1553
|
});
|
|
1458
1554
|
}, []);
|
|
1555
|
+
const showStepUp = stepUpOpen && Boolean(onStepUpResolve);
|
|
1556
|
+
const open = showStepUp || request !== null;
|
|
1557
|
+
const close = () => {
|
|
1558
|
+
if (showStepUp) onStepUpResolve(null);
|
|
1559
|
+
else answer(false);
|
|
1560
|
+
};
|
|
1459
1561
|
return /* @__PURE__ */ jsxs5(ConfirmContext.Provider, { value: ask, children: [
|
|
1460
1562
|
children,
|
|
1461
|
-
|
|
1462
|
-
|
|
1563
|
+
open ? /* @__PURE__ */ jsx13(Modal, { open: true, onClose: close, labelledBy: titleId, size: "compact", children: showStepUp ? /* @__PURE__ */ jsxs5("form", { onSubmit: (e) => {
|
|
1564
|
+
e.preventDefault();
|
|
1565
|
+
onStepUpResolve(password);
|
|
1566
|
+
}, children: [
|
|
1567
|
+
/* @__PURE__ */ jsx13("div", { ...a.el("confirm.header", "throttle-modal__header"), children: /* @__PURE__ */ jsx13("h2", { id: titleId, ...a.el("stepUp.title", "throttle-modal__title"), children: t.stepUp.title }) }),
|
|
1463
1568
|
/* @__PURE__ */ jsxs5("div", { ...a.el("confirm.body", "throttle-modal__body"), children: [
|
|
1464
|
-
|
|
1569
|
+
/* @__PURE__ */ jsx13("p", { className: "throttle-muted", children: t.stepUp.description }),
|
|
1570
|
+
/* @__PURE__ */ jsx13(
|
|
1571
|
+
Field,
|
|
1572
|
+
{
|
|
1573
|
+
label: t.stepUp.password,
|
|
1574
|
+
type: "password",
|
|
1575
|
+
autoComplete: "current-password",
|
|
1576
|
+
value: password,
|
|
1577
|
+
onChange: setPassword,
|
|
1578
|
+
required: true,
|
|
1579
|
+
elementKey: "stepUp.passwordField"
|
|
1580
|
+
}
|
|
1581
|
+
),
|
|
1465
1582
|
/* @__PURE__ */ jsxs5("div", { className: "throttle-actions", children: [
|
|
1466
|
-
/* @__PURE__ */
|
|
1583
|
+
/* @__PURE__ */ jsx13(Button, { type: "submit", elementKey: "stepUp.submitButton", children: t.stepUp.submitButton }),
|
|
1584
|
+
/* @__PURE__ */ jsx13(
|
|
1585
|
+
Button,
|
|
1586
|
+
{
|
|
1587
|
+
variant: "secondary",
|
|
1588
|
+
elementKey: "stepUp.cancelButton",
|
|
1589
|
+
onClick: () => onStepUpResolve(null),
|
|
1590
|
+
children: t.stepUp.cancelButton
|
|
1591
|
+
}
|
|
1592
|
+
)
|
|
1593
|
+
] })
|
|
1594
|
+
] })
|
|
1595
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1596
|
+
/* @__PURE__ */ jsx13("div", { ...a.el("confirm.header", "throttle-modal__header"), children: /* @__PURE__ */ jsx13("h2", { id: titleId, ...a.el("confirm.title", "throttle-modal__title"), children: request.title }) }),
|
|
1597
|
+
/* @__PURE__ */ jsxs5("div", { ...a.el("confirm.body", "throttle-modal__body"), children: [
|
|
1598
|
+
request.body ? /* @__PURE__ */ jsx13("p", { className: "throttle-muted", children: request.body }) : null,
|
|
1599
|
+
/* @__PURE__ */ jsxs5("div", { className: "throttle-actions", children: [
|
|
1600
|
+
/* @__PURE__ */ jsx13(
|
|
1467
1601
|
Button,
|
|
1468
1602
|
{
|
|
1469
1603
|
elementKey: "confirm.confirmButton",
|
|
@@ -1472,10 +1606,10 @@ function ConfirmProvider({ children }) {
|
|
|
1472
1606
|
children: request.confirmLabel ?? t.common.delete
|
|
1473
1607
|
}
|
|
1474
1608
|
),
|
|
1475
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsx13(Button, { elementKey: "confirm.cancelButton", variant: "secondary", onClick: () => answer(false), children: request.cancelLabel ?? t.common.keepIt })
|
|
1476
1610
|
] })
|
|
1477
1611
|
] })
|
|
1478
|
-
] }) : null
|
|
1612
|
+
] }) }) : null
|
|
1479
1613
|
] });
|
|
1480
1614
|
}
|
|
1481
1615
|
function useConfirm() {
|
|
@@ -1488,15 +1622,15 @@ function useConfirm() {
|
|
|
1488
1622
|
}
|
|
1489
1623
|
|
|
1490
1624
|
// src/react/components/primitives/Dropdown.tsx
|
|
1491
|
-
import { useEffect as
|
|
1492
|
-
import { jsx as
|
|
1625
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
1626
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1493
1627
|
function Dropdown(props) {
|
|
1494
1628
|
const a = useAppearance();
|
|
1495
1629
|
const [open, setOpen] = useState3(false);
|
|
1496
1630
|
const root = useRef3(null);
|
|
1497
1631
|
const trigger = useRef3(null);
|
|
1498
1632
|
const menu = useRef3(null);
|
|
1499
|
-
|
|
1633
|
+
useEffect3(() => {
|
|
1500
1634
|
if (!open) return;
|
|
1501
1635
|
menu.current?.querySelector('[role="menuitem"]')?.focus();
|
|
1502
1636
|
const onDown = (e) => {
|
|
@@ -1523,7 +1657,7 @@ function Dropdown(props) {
|
|
|
1523
1657
|
items[next < 0 ? items.length - 1 : next].focus();
|
|
1524
1658
|
};
|
|
1525
1659
|
return /* @__PURE__ */ jsxs6("div", { ref: root, style: { position: "relative", display: "inline-block" }, children: [
|
|
1526
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ jsx14(
|
|
1527
1661
|
"button",
|
|
1528
1662
|
{
|
|
1529
1663
|
ref: trigger,
|
|
@@ -1536,7 +1670,7 @@ function Dropdown(props) {
|
|
|
1536
1670
|
children: props.trigger
|
|
1537
1671
|
}
|
|
1538
1672
|
),
|
|
1539
|
-
open ? /* @__PURE__ */
|
|
1673
|
+
open ? /* @__PURE__ */ jsx14(
|
|
1540
1674
|
"div",
|
|
1541
1675
|
{
|
|
1542
1676
|
ref: menu,
|
|
@@ -1562,24 +1696,24 @@ function DropdownItem(props) {
|
|
|
1562
1696
|
const a = useAppearance();
|
|
1563
1697
|
const attrs = a.el(props.itemKey ?? "dropdown.item", "throttle-dropdown__item");
|
|
1564
1698
|
if (props.href) {
|
|
1565
|
-
return /* @__PURE__ */
|
|
1699
|
+
return /* @__PURE__ */ jsx14("a", { ...attrs, role: "menuitem", href: props.href, tabIndex: -1, children: props.children });
|
|
1566
1700
|
}
|
|
1567
|
-
return /* @__PURE__ */
|
|
1701
|
+
return /* @__PURE__ */ jsx14("button", { ...attrs, role: "menuitem", type: "button", tabIndex: -1, onClick: props.onClick, children: props.children });
|
|
1568
1702
|
}
|
|
1569
1703
|
function DropdownSeparator() {
|
|
1570
1704
|
const a = useAppearance();
|
|
1571
|
-
return /* @__PURE__ */
|
|
1705
|
+
return /* @__PURE__ */ jsx14("hr", { ...a.el("dropdown.separator", "throttle-dropdown__separator") });
|
|
1572
1706
|
}
|
|
1573
1707
|
|
|
1574
1708
|
// src/react/components/primitives/Tabs.tsx
|
|
1575
|
-
import { jsx as
|
|
1709
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1576
1710
|
function Tabs(props) {
|
|
1577
1711
|
const a = useAppearance();
|
|
1578
1712
|
const at = props.tabs.findIndex((t) => t.id === props.active);
|
|
1579
1713
|
const vertical = props.orientation === "vertical";
|
|
1580
1714
|
const listClass = vertical ? "throttle-tabs__rail" : "throttle-tabs__list";
|
|
1581
1715
|
const itemClass = vertical ? "throttle-tabs__railitem" : "throttle-tabs__tab";
|
|
1582
|
-
return /* @__PURE__ */
|
|
1716
|
+
return /* @__PURE__ */ jsx15(
|
|
1583
1717
|
"div",
|
|
1584
1718
|
{
|
|
1585
1719
|
...a.el("tabs.list", listClass),
|
|
@@ -1623,16 +1757,16 @@ function Tabs(props) {
|
|
|
1623
1757
|
}
|
|
1624
1758
|
|
|
1625
1759
|
// src/react/components/primitives/DataTable.tsx
|
|
1626
|
-
import { jsx as
|
|
1760
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1627
1761
|
function DataTable(props) {
|
|
1628
1762
|
const a = useAppearance();
|
|
1629
1763
|
const clickable = Boolean(props.onRowClick);
|
|
1630
1764
|
return (
|
|
1631
1765
|
// Tables are the one thing allowed to be wider than the panel; it scrolls
|
|
1632
1766
|
// rather than forcing the whole page to.
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsx16("div", { className: "throttle-table__scroll", children: /* @__PURE__ */ jsxs8("table", { ...a.el(props.tableKey ?? "table", "throttle-table"), children: [
|
|
1768
|
+
/* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: props.columns.map((col) => /* @__PURE__ */ jsx16("th", { ...a.el("table.head", "throttle-table__head"), scope: "col", children: col.label }, col.key)) }) }),
|
|
1769
|
+
/* @__PURE__ */ jsx16("tbody", { children: props.rows.map((row) => /* @__PURE__ */ jsx16(
|
|
1636
1770
|
"tr",
|
|
1637
1771
|
{
|
|
1638
1772
|
...a.el(props.rowElementKey ?? "table.row", "throttle-table__row"),
|
|
@@ -1644,7 +1778,7 @@ function DataTable(props) {
|
|
|
1644
1778
|
props.onRowClick(row);
|
|
1645
1779
|
}
|
|
1646
1780
|
} : void 0,
|
|
1647
|
-
children: props.columns.map((col) => /* @__PURE__ */
|
|
1781
|
+
children: props.columns.map((col) => /* @__PURE__ */ jsx16("td", { ...a.el("table.cell", "throttle-table__cell"), children: col.render ? col.render(row) : String(row[col.key] ?? "") }, col.key))
|
|
1648
1782
|
},
|
|
1649
1783
|
props.rowKey(row)
|
|
1650
1784
|
)) })
|
|
@@ -1653,97 +1787,52 @@ function DataTable(props) {
|
|
|
1653
1787
|
}
|
|
1654
1788
|
|
|
1655
1789
|
// src/react/components/primitives/EmptyState.tsx
|
|
1656
|
-
import { jsx as
|
|
1790
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1657
1791
|
function EmptyState(props) {
|
|
1658
1792
|
const a = useAppearance();
|
|
1659
1793
|
const Slot = a.slots.EmptyState;
|
|
1660
|
-
if (Slot) return /* @__PURE__ */
|
|
1794
|
+
if (Slot) return /* @__PURE__ */ jsx17(Slot, { title: props.title, description: props.description });
|
|
1661
1795
|
return /* @__PURE__ */ jsxs9("div", { ...a.el("emptyState", "throttle-empty"), children: [
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
props.description ? /* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsx17("p", { ...a.el("emptyState.title", "throttle-empty__title"), children: props.title }),
|
|
1797
|
+
props.description ? /* @__PURE__ */ jsx17("p", { ...a.el("emptyState.description", "throttle-empty__description"), children: props.description }) : null
|
|
1664
1798
|
] });
|
|
1665
1799
|
}
|
|
1666
1800
|
|
|
1667
1801
|
// src/react/components/primitives/Avatar.tsx
|
|
1668
|
-
import { jsx as
|
|
1802
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1669
1803
|
function Avatar(props) {
|
|
1670
1804
|
const a = useAppearance();
|
|
1671
1805
|
const Slot = a.slots.Avatar;
|
|
1672
|
-
if (Slot) return /* @__PURE__ */
|
|
1806
|
+
if (Slot) return /* @__PURE__ */ jsx18(Slot, { name: props.name, email: props.email });
|
|
1673
1807
|
const initials = props.name.split(" ").map((part) => part.trim()[0]).filter(Boolean).slice(0, 2).join("") || props.email.trim()[0] || "?";
|
|
1674
|
-
return /* @__PURE__ */
|
|
1808
|
+
return /* @__PURE__ */ jsx18("span", { ...a.el("avatar", "throttle-avatar"), title: props.email, children: initials.toUpperCase() });
|
|
1675
1809
|
}
|
|
1676
1810
|
|
|
1677
1811
|
// src/react/components/primitives/Badge.tsx
|
|
1678
|
-
import { jsx as
|
|
1812
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1679
1813
|
function Badge(props) {
|
|
1680
1814
|
const a = useAppearance();
|
|
1681
1815
|
const tone = props.tone ?? "neutral";
|
|
1682
1816
|
const base = tone === "neutral" ? "throttle-badge" : `throttle-badge throttle-badge--${tone}`;
|
|
1683
|
-
return /* @__PURE__ */
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
// src/react/components/auth/StepUpDialog.tsx
|
|
1687
|
-
import { useEffect as useEffect3, useId as useId3, useState as useState4 } from "react";
|
|
1688
|
-
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1689
|
-
function StepUpDialog(props) {
|
|
1690
|
-
const a = useAppearance();
|
|
1691
|
-
const cardClass = useCardClass();
|
|
1692
|
-
const { t } = useCopy();
|
|
1693
|
-
const [password, setPassword] = useState4("");
|
|
1694
|
-
const titleId = useId3();
|
|
1695
|
-
useEffect3(() => {
|
|
1696
|
-
if (!props.open) setPassword("");
|
|
1697
|
-
}, [props.open]);
|
|
1698
|
-
return /* @__PURE__ */ jsx19(Modal, { open: props.open, onClose: () => props.onResolve(null), labelledBy: titleId, children: /* @__PURE__ */ jsx19("div", { ...a.el("stepUp.root", cardClass), children: /* @__PURE__ */ jsxs10(
|
|
1699
|
-
"form",
|
|
1700
|
-
{
|
|
1701
|
-
onSubmit: (e) => {
|
|
1702
|
-
e.preventDefault();
|
|
1703
|
-
props.onResolve(password);
|
|
1704
|
-
},
|
|
1705
|
-
children: [
|
|
1706
|
-
/* @__PURE__ */ jsxs10("div", { className: "throttle-card__header", children: [
|
|
1707
|
-
/* @__PURE__ */ jsx19("h2", { id: titleId, ...a.el("stepUp.title", "throttle-card__title"), children: t.stepUp.title }),
|
|
1708
|
-
/* @__PURE__ */ jsx19("p", { className: "throttle-card__description", children: t.stepUp.description })
|
|
1709
|
-
] }),
|
|
1710
|
-
/* @__PURE__ */ jsxs10(CardBody, { children: [
|
|
1711
|
-
/* @__PURE__ */ jsx19(
|
|
1712
|
-
Field,
|
|
1713
|
-
{
|
|
1714
|
-
label: t.stepUp.password,
|
|
1715
|
-
type: "password",
|
|
1716
|
-
autoComplete: "current-password",
|
|
1717
|
-
value: password,
|
|
1718
|
-
onChange: setPassword,
|
|
1719
|
-
required: true,
|
|
1720
|
-
elementKey: "stepUp.passwordField"
|
|
1721
|
-
}
|
|
1722
|
-
),
|
|
1723
|
-
/* @__PURE__ */ jsx19(Button, { type: "submit", elementKey: "stepUp.submitButton", children: t.stepUp.submitButton }),
|
|
1724
|
-
/* @__PURE__ */ jsx19(Button, { variant: "link", elementKey: "stepUp.cancelButton", onClick: () => props.onResolve(null), children: t.stepUp.cancelButton })
|
|
1725
|
-
] })
|
|
1726
|
-
]
|
|
1727
|
-
}
|
|
1728
|
-
) }) });
|
|
1817
|
+
return /* @__PURE__ */ jsx19("span", { ...a.el(props.elementKey ?? "badge", base), children: props.children });
|
|
1729
1818
|
}
|
|
1730
1819
|
|
|
1731
1820
|
// src/react/components/auth/AuthModal.tsx
|
|
1732
|
-
import { useId as
|
|
1821
|
+
import { useId as useId3 } from "react";
|
|
1733
1822
|
|
|
1734
1823
|
// src/react/components/auth/AuthFlow.tsx
|
|
1735
|
-
import { useEffect as useEffect5, useState as
|
|
1824
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
1736
1825
|
|
|
1737
1826
|
// src/react/components/auth/SignIn.tsx
|
|
1738
|
-
import { useState as
|
|
1827
|
+
import { useState as useState5 } from "react";
|
|
1739
1828
|
|
|
1740
1829
|
// src/react/components/useAction.ts
|
|
1741
|
-
import { useCallback as useCallback2, useRef as useRef4, useState as
|
|
1830
|
+
import { useCallback as useCallback2, useRef as useRef4, useState as useState4 } from "react";
|
|
1742
1831
|
function useAction() {
|
|
1743
1832
|
const { errorMessage } = useCopy();
|
|
1744
|
-
const [submitting, setSubmitting] =
|
|
1745
|
-
const [error, setError] =
|
|
1746
|
-
const [notice, setNotice] =
|
|
1833
|
+
const [submitting, setSubmitting] = useState4(false);
|
|
1834
|
+
const [error, setError] = useState4(null);
|
|
1835
|
+
const [notice, setNotice] = useState4(null);
|
|
1747
1836
|
const inFlight = useRef4(false);
|
|
1748
1837
|
const run = useCallback2(
|
|
1749
1838
|
async (fn) => {
|
|
@@ -1768,7 +1857,7 @@ function useAction() {
|
|
|
1768
1857
|
}
|
|
1769
1858
|
|
|
1770
1859
|
// src/react/components/auth/SignIn.tsx
|
|
1771
|
-
import { Fragment as
|
|
1860
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1772
1861
|
function SignIn(props) {
|
|
1773
1862
|
const a = useAppearance(props.appearance);
|
|
1774
1863
|
const cardClass = useCardClass();
|
|
@@ -1776,8 +1865,8 @@ function SignIn(props) {
|
|
|
1776
1865
|
const { t } = useCopy(props.localization);
|
|
1777
1866
|
const { auth } = useAuth();
|
|
1778
1867
|
const { submitting, error, run } = useAction();
|
|
1779
|
-
const [email, setEmail] =
|
|
1780
|
-
const [password, setPassword] =
|
|
1868
|
+
const [email, setEmail] = useState5("");
|
|
1869
|
+
const [password, setPassword] = useState5("");
|
|
1781
1870
|
const variant = props.variant ?? "quiet";
|
|
1782
1871
|
const branded = variant === "branded";
|
|
1783
1872
|
const grouped = variant === "grouped";
|
|
@@ -1810,7 +1899,7 @@ function SignIn(props) {
|
|
|
1810
1899
|
labelExtra: grouped ? void 0 : forgotLink
|
|
1811
1900
|
}
|
|
1812
1901
|
);
|
|
1813
|
-
return /* @__PURE__ */ jsx20(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx20("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx20(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx20("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs10(
|
|
1814
1903
|
"form",
|
|
1815
1904
|
{
|
|
1816
1905
|
...a.el("signIn.root", cardClass),
|
|
@@ -1833,11 +1922,11 @@ function SignIn(props) {
|
|
|
1833
1922
|
branded
|
|
1834
1923
|
}
|
|
1835
1924
|
),
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
grouped ? /* @__PURE__ */
|
|
1925
|
+
/* @__PURE__ */ jsxs10(CardBody, { children: [
|
|
1926
|
+
grouped ? /* @__PURE__ */ jsxs10(FieldGroup, { children: [
|
|
1838
1927
|
emailField,
|
|
1839
1928
|
passwordField
|
|
1840
|
-
] }) : /* @__PURE__ */
|
|
1929
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1841
1930
|
emailField,
|
|
1842
1931
|
passwordField
|
|
1843
1932
|
] }),
|
|
@@ -1845,8 +1934,8 @@ function SignIn(props) {
|
|
|
1845
1934
|
error ? /* @__PURE__ */ jsx20(Alert, { tone: "error", children: error }) : null,
|
|
1846
1935
|
/* @__PURE__ */ jsx20(Button, { type: "submit", loading: submitting, elementKey: "signIn.submitButton", children: t.signIn.submitButton })
|
|
1847
1936
|
] }),
|
|
1848
|
-
props.onSignUp ? /* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1937
|
+
props.onSignUp ? /* @__PURE__ */ jsxs10(CardFooter, { ruled: !branded, children: [
|
|
1938
|
+
/* @__PURE__ */ jsxs10("span", { className: "throttle-muted", children: [
|
|
1850
1939
|
t.signIn.switchPrompt,
|
|
1851
1940
|
" "
|
|
1852
1941
|
] }),
|
|
@@ -1858,8 +1947,8 @@ function SignIn(props) {
|
|
|
1858
1947
|
}
|
|
1859
1948
|
|
|
1860
1949
|
// src/react/components/auth/SignUp.tsx
|
|
1861
|
-
import { useState as
|
|
1862
|
-
import { Fragment as
|
|
1950
|
+
import { useState as useState6 } from "react";
|
|
1951
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1863
1952
|
function SignUp(props) {
|
|
1864
1953
|
const a = useAppearance(props.appearance);
|
|
1865
1954
|
const cardClass = useCardClass();
|
|
@@ -1867,8 +1956,8 @@ function SignUp(props) {
|
|
|
1867
1956
|
const { t } = useCopy(props.localization);
|
|
1868
1957
|
const { auth } = useAuth();
|
|
1869
1958
|
const { submitting, error, notice, run } = useAction();
|
|
1870
|
-
const [email, setEmail] =
|
|
1871
|
-
const [password, setPassword] =
|
|
1959
|
+
const [email, setEmail] = useState6("");
|
|
1960
|
+
const [password, setPassword] = useState6("");
|
|
1872
1961
|
const variant = props.variant ?? "quiet";
|
|
1873
1962
|
const branded = variant === "branded";
|
|
1874
1963
|
const grouped = variant === "grouped";
|
|
@@ -1899,7 +1988,7 @@ function SignUp(props) {
|
|
|
1899
1988
|
grouped
|
|
1900
1989
|
}
|
|
1901
1990
|
);
|
|
1902
|
-
return /* @__PURE__ */ jsx21(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx21("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsx21(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx21("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs11(
|
|
1903
1992
|
"form",
|
|
1904
1993
|
{
|
|
1905
1994
|
...a.el("signUp.root", cardClass),
|
|
@@ -1926,11 +2015,11 @@ function SignUp(props) {
|
|
|
1926
2015
|
branded
|
|
1927
2016
|
}
|
|
1928
2017
|
),
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
grouped ? /* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ jsxs11(CardBody, { children: [
|
|
2019
|
+
grouped ? /* @__PURE__ */ jsxs11(FieldGroup, { children: [
|
|
1931
2020
|
emailField,
|
|
1932
2021
|
passwordField
|
|
1933
|
-
] }) : /* @__PURE__ */
|
|
2022
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1934
2023
|
emailField,
|
|
1935
2024
|
passwordField
|
|
1936
2025
|
] }),
|
|
@@ -1938,8 +2027,8 @@ function SignUp(props) {
|
|
|
1938
2027
|
notice ? /* @__PURE__ */ jsx21(Alert, { tone: "info", children: notice }) : null,
|
|
1939
2028
|
/* @__PURE__ */ jsx21(Button, { type: "submit", loading: submitting, elementKey: "signUp.submitButton", children: t.signUp.submitButton })
|
|
1940
2029
|
] }),
|
|
1941
|
-
props.onSignIn ? /* @__PURE__ */
|
|
1942
|
-
/* @__PURE__ */
|
|
2030
|
+
props.onSignIn ? /* @__PURE__ */ jsxs11(CardFooter, { ruled: !branded, children: [
|
|
2031
|
+
/* @__PURE__ */ jsxs11("span", { className: "throttle-muted", children: [
|
|
1943
2032
|
t.signUp.switchPrompt,
|
|
1944
2033
|
" "
|
|
1945
2034
|
] }),
|
|
@@ -1951,8 +2040,8 @@ function SignUp(props) {
|
|
|
1951
2040
|
}
|
|
1952
2041
|
|
|
1953
2042
|
// src/react/components/auth/ForgotPassword.tsx
|
|
1954
|
-
import { useState as
|
|
1955
|
-
import { jsx as jsx22, jsxs as
|
|
2043
|
+
import { useState as useState7 } from "react";
|
|
2044
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1956
2045
|
function ForgotPassword(props) {
|
|
1957
2046
|
const a = useAppearance(props.appearance);
|
|
1958
2047
|
const cardClass = useCardClass();
|
|
@@ -1960,10 +2049,10 @@ function ForgotPassword(props) {
|
|
|
1960
2049
|
const { t } = useCopy(props.localization);
|
|
1961
2050
|
const { auth } = useAuth();
|
|
1962
2051
|
const { submitting, error, notice, run } = useAction();
|
|
1963
|
-
const [email, setEmail] =
|
|
2052
|
+
const [email, setEmail] = useState7("");
|
|
1964
2053
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
1965
2054
|
const logo = useBrandLogo(props.logo);
|
|
1966
|
-
return /* @__PURE__ */ jsx22(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx22("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2055
|
+
return /* @__PURE__ */ jsx22(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx22("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs12(
|
|
1967
2056
|
"form",
|
|
1968
2057
|
{
|
|
1969
2058
|
...a.el("forgotPassword.root", cardClass),
|
|
@@ -1986,7 +2075,7 @@ function ForgotPassword(props) {
|
|
|
1986
2075
|
branded
|
|
1987
2076
|
}
|
|
1988
2077
|
),
|
|
1989
|
-
/* @__PURE__ */
|
|
2078
|
+
/* @__PURE__ */ jsxs12(CardBody, { children: [
|
|
1990
2079
|
/* @__PURE__ */ jsx22(
|
|
1991
2080
|
Field,
|
|
1992
2081
|
{
|
|
@@ -2010,8 +2099,8 @@ function ForgotPassword(props) {
|
|
|
2010
2099
|
}
|
|
2011
2100
|
|
|
2012
2101
|
// src/react/components/auth/ResetPassword.tsx
|
|
2013
|
-
import { useState as
|
|
2014
|
-
import { jsx as jsx23, jsxs as
|
|
2102
|
+
import { useState as useState8 } from "react";
|
|
2103
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2015
2104
|
function ResetPassword(props) {
|
|
2016
2105
|
const a = useAppearance(props.appearance);
|
|
2017
2106
|
const cardClass = useCardClass();
|
|
@@ -2019,10 +2108,10 @@ function ResetPassword(props) {
|
|
|
2019
2108
|
const { t } = useCopy(props.localization);
|
|
2020
2109
|
const { auth } = useAuth();
|
|
2021
2110
|
const { submitting, error, notice, run } = useAction();
|
|
2022
|
-
const [password, setPassword] =
|
|
2111
|
+
const [password, setPassword] = useState8("");
|
|
2023
2112
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
2024
2113
|
const logo = useBrandLogo(props.logo);
|
|
2025
|
-
return /* @__PURE__ */ jsx23(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx23("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2114
|
+
return /* @__PURE__ */ jsx23(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx23("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs13("div", { ...a.el("resetPassword.root", cardClass), children: [
|
|
2026
2115
|
/* @__PURE__ */ jsx23(
|
|
2027
2116
|
CardHeader,
|
|
2028
2117
|
{
|
|
@@ -2048,7 +2137,7 @@ function ResetPassword(props) {
|
|
|
2048
2137
|
return t.resetPassword.doneNotice;
|
|
2049
2138
|
});
|
|
2050
2139
|
},
|
|
2051
|
-
children: /* @__PURE__ */
|
|
2140
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "throttle-stack", children: [
|
|
2052
2141
|
/* @__PURE__ */ jsx23(
|
|
2053
2142
|
Field,
|
|
2054
2143
|
{
|
|
@@ -2071,8 +2160,8 @@ function ResetPassword(props) {
|
|
|
2071
2160
|
}
|
|
2072
2161
|
|
|
2073
2162
|
// src/react/components/auth/VerifyEmail.tsx
|
|
2074
|
-
import { useEffect as useEffect4, useRef as useRef5, useState as
|
|
2075
|
-
import { jsx as jsx24, jsxs as
|
|
2163
|
+
import { useEffect as useEffect4, useRef as useRef5, useState as useState9 } from "react";
|
|
2164
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2076
2165
|
function VerifyEmail(props) {
|
|
2077
2166
|
const a = useAppearance(props.appearance);
|
|
2078
2167
|
const cardClass = useCardClass();
|
|
@@ -2080,8 +2169,8 @@ function VerifyEmail(props) {
|
|
|
2080
2169
|
const { t, errorMessage } = useCopy(props.localization);
|
|
2081
2170
|
const { auth } = useAuth();
|
|
2082
2171
|
const { submitting, notice, run } = useAction();
|
|
2083
|
-
const [state, setState] =
|
|
2084
|
-
const [error, setError] =
|
|
2172
|
+
const [state, setState] = useState9(props.token ? "verifying" : "idle");
|
|
2173
|
+
const [error, setError] = useState9(null);
|
|
2085
2174
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
2086
2175
|
const logo = useBrandLogo(props.logo);
|
|
2087
2176
|
const attempted = useRef5(null);
|
|
@@ -2098,7 +2187,7 @@ function VerifyEmail(props) {
|
|
|
2098
2187
|
setState("failed");
|
|
2099
2188
|
});
|
|
2100
2189
|
}, [props.token, auth]);
|
|
2101
|
-
return /* @__PURE__ */ jsx24(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx24("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2190
|
+
return /* @__PURE__ */ jsx24(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx24("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs14("div", { ...a.el("verifyEmail.root", cardClass), children: [
|
|
2102
2191
|
/* @__PURE__ */ jsx24(
|
|
2103
2192
|
CardHeader,
|
|
2104
2193
|
{
|
|
@@ -2109,8 +2198,8 @@ function VerifyEmail(props) {
|
|
|
2109
2198
|
branded
|
|
2110
2199
|
}
|
|
2111
2200
|
),
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
state === "verifying" ? /* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsxs14(CardBody, { children: [
|
|
2202
|
+
state === "verifying" ? /* @__PURE__ */ jsxs14("p", { children: [
|
|
2114
2203
|
/* @__PURE__ */ jsx24(Spinner, {}),
|
|
2115
2204
|
" ",
|
|
2116
2205
|
t.verifyEmail.verifying
|
|
@@ -2137,7 +2226,7 @@ function VerifyEmail(props) {
|
|
|
2137
2226
|
}
|
|
2138
2227
|
|
|
2139
2228
|
// src/react/components/auth/AuthFlow.tsx
|
|
2140
|
-
import { jsx as jsx25, jsxs as
|
|
2229
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2141
2230
|
var HASH_FOR = {
|
|
2142
2231
|
signIn: "#/sign-in",
|
|
2143
2232
|
signUp: "#/sign-up",
|
|
@@ -2163,8 +2252,8 @@ function readLocation() {
|
|
|
2163
2252
|
function AuthFlow(props) {
|
|
2164
2253
|
const a = useAppearance(props.appearance);
|
|
2165
2254
|
const controlled = props.view !== void 0;
|
|
2166
|
-
const [internal, setInternal] =
|
|
2167
|
-
const [urlToken, setUrlToken] =
|
|
2255
|
+
const [internal, setInternal] = useState10(props.initialView ?? "signIn");
|
|
2256
|
+
const [urlToken, setUrlToken] = useState10(void 0);
|
|
2168
2257
|
useEffect5(() => {
|
|
2169
2258
|
const found = readLocation();
|
|
2170
2259
|
if (found.token) setUrlToken(found.token);
|
|
@@ -2195,7 +2284,7 @@ function AuthFlow(props) {
|
|
|
2195
2284
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
2196
2285
|
}, [props.routing, controlled]);
|
|
2197
2286
|
const shared = { appearance: props.appearance, localization: props.localization };
|
|
2198
|
-
return /* @__PURE__ */ jsx25("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2287
|
+
return /* @__PURE__ */ jsx25("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs15("div", { ...a.el("authFlow.root"), children: [
|
|
2199
2288
|
view === "signIn" ? /* @__PURE__ */ jsx25(
|
|
2200
2289
|
SignIn,
|
|
2201
2290
|
{
|
|
@@ -2213,11 +2302,11 @@ function AuthFlow(props) {
|
|
|
2213
2302
|
}
|
|
2214
2303
|
|
|
2215
2304
|
// src/react/components/auth/AuthModal.tsx
|
|
2216
|
-
import { jsx as jsx26, jsxs as
|
|
2305
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2217
2306
|
function AuthModal(props) {
|
|
2218
2307
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
2219
|
-
const titleId =
|
|
2220
|
-
return /* @__PURE__ */ jsx26(AppearanceProvider, { value: scoped, children: /* @__PURE__ */
|
|
2308
|
+
const titleId = useId3();
|
|
2309
|
+
return /* @__PURE__ */ jsx26(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs16(
|
|
2221
2310
|
Modal,
|
|
2222
2311
|
{
|
|
2223
2312
|
open: props.open,
|
|
@@ -2244,14 +2333,14 @@ function AuthModal(props) {
|
|
|
2244
2333
|
}
|
|
2245
2334
|
|
|
2246
2335
|
// src/react/components/account/AccountModal.tsx
|
|
2247
|
-
import { useId as
|
|
2336
|
+
import { useId as useId6 } from "react";
|
|
2248
2337
|
|
|
2249
2338
|
// src/react/components/account/AccountDashboard.tsx
|
|
2250
|
-
import { useEffect as
|
|
2339
|
+
import { useEffect as useEffect11, useId as useId5, useState as useState20 } from "react";
|
|
2251
2340
|
|
|
2252
2341
|
// src/react/components/account/VerifyEmailBanner.tsx
|
|
2253
|
-
import { useState as
|
|
2254
|
-
import { jsx as jsx27, jsxs as
|
|
2342
|
+
import { useState as useState11 } from "react";
|
|
2343
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2255
2344
|
var DISMISS_KEY = "throttle-auth:verify-banner-dismissed";
|
|
2256
2345
|
function readDismissed() {
|
|
2257
2346
|
try {
|
|
@@ -2272,13 +2361,13 @@ function VerifyEmailBanner(props) {
|
|
|
2272
2361
|
const { t } = useCopy(props.localization);
|
|
2273
2362
|
const { auth, status, emailVerified } = useAuth();
|
|
2274
2363
|
const { submitting, notice, error, run } = useAction();
|
|
2275
|
-
const [dismissed, setDismissed] =
|
|
2364
|
+
const [dismissed, setDismissed] = useState11(readDismissed);
|
|
2276
2365
|
if (status !== "authenticated" || emailVerified || dismissed) return null;
|
|
2277
|
-
return /* @__PURE__ */ jsx27(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx27("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2366
|
+
return /* @__PURE__ */ jsx27(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx27("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs17("div", { ...a.el("verifyBanner.root", "throttle-banner"), children: [
|
|
2278
2367
|
/* @__PURE__ */ jsx27("span", { ...a.el("verifyBanner.message"), children: t.verifyBanner.message }),
|
|
2279
2368
|
notice ? /* @__PURE__ */ jsx27(Alert, { tone: "success", children: notice }) : null,
|
|
2280
2369
|
error ? /* @__PURE__ */ jsx27(Alert, { tone: "error", children: error }) : null,
|
|
2281
|
-
/* @__PURE__ */
|
|
2370
|
+
/* @__PURE__ */ jsxs17("span", { className: "throttle-actions", children: [
|
|
2282
2371
|
/* @__PURE__ */ jsx27(
|
|
2283
2372
|
Button,
|
|
2284
2373
|
{
|
|
@@ -2309,7 +2398,7 @@ function VerifyEmailBanner(props) {
|
|
|
2309
2398
|
}
|
|
2310
2399
|
|
|
2311
2400
|
// src/react/components/account/icons.tsx
|
|
2312
|
-
import { jsx as jsx28, jsxs as
|
|
2401
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2313
2402
|
function Glyph(props) {
|
|
2314
2403
|
return /* @__PURE__ */ jsx28(
|
|
2315
2404
|
"svg",
|
|
@@ -2330,49 +2419,49 @@ function Glyph(props) {
|
|
|
2330
2419
|
);
|
|
2331
2420
|
}
|
|
2332
2421
|
var ACCOUNT_ICONS = {
|
|
2333
|
-
profile: /* @__PURE__ */
|
|
2422
|
+
profile: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2334
2423
|
/* @__PURE__ */ jsx28("circle", { cx: "12", cy: "8", r: "4" }),
|
|
2335
2424
|
/* @__PURE__ */ jsx28("path", { d: "M4 21c0-4 3.6-6 8-6s8 2 8 6" })
|
|
2336
2425
|
] }),
|
|
2337
|
-
addresses: /* @__PURE__ */
|
|
2426
|
+
addresses: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2338
2427
|
/* @__PURE__ */ jsx28("path", { d: "M12 21s7-5.3 7-11a7 7 0 1 0-14 0c0 5.7 7 11 7 11Z" }),
|
|
2339
2428
|
/* @__PURE__ */ jsx28("circle", { cx: "12", cy: "10", r: "2.5" })
|
|
2340
2429
|
] }),
|
|
2341
|
-
paymentMethods: /* @__PURE__ */
|
|
2430
|
+
paymentMethods: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2342
2431
|
/* @__PURE__ */ jsx28("rect", { x: "2.5", y: "5.5", width: "19", height: "13", rx: "2.5" }),
|
|
2343
2432
|
/* @__PURE__ */ jsx28("path", { d: "M2.5 10h19" })
|
|
2344
2433
|
] }),
|
|
2345
|
-
orders: /* @__PURE__ */
|
|
2434
|
+
orders: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2346
2435
|
/* @__PURE__ */ jsx28("path", { d: "M4 7h16v13H4z" }),
|
|
2347
2436
|
/* @__PURE__ */ jsx28("path", { d: "M8 7V4h8v3" }),
|
|
2348
2437
|
/* @__PURE__ */ jsx28("path", { d: "M8 12h8" })
|
|
2349
2438
|
] }),
|
|
2350
|
-
invoices: /* @__PURE__ */
|
|
2439
|
+
invoices: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2351
2440
|
/* @__PURE__ */ jsx28("path", { d: "M6 3h12v18l-3-2-3 2-3-2-3 2Z" }),
|
|
2352
2441
|
/* @__PURE__ */ jsx28("path", { d: "M9 8h6M9 12h6" })
|
|
2353
2442
|
] }),
|
|
2354
|
-
subscriptions: /* @__PURE__ */
|
|
2443
|
+
subscriptions: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2355
2444
|
/* @__PURE__ */ jsx28("path", { d: "M3 12a9 9 0 0 1 15.5-6.2" }),
|
|
2356
2445
|
/* @__PURE__ */ jsx28("path", { d: "M21 12a9 9 0 0 1-15.5 6.2" }),
|
|
2357
2446
|
/* @__PURE__ */ jsx28("path", { d: "M18 3v4h-4M6 21v-4h4" })
|
|
2358
2447
|
] }),
|
|
2359
|
-
security: /* @__PURE__ */
|
|
2448
|
+
security: /* @__PURE__ */ jsxs18(Glyph, { children: [
|
|
2360
2449
|
/* @__PURE__ */ jsx28("path", { d: "M12 3 4 6.5V12c0 5 3.4 8.3 8 9 4.6-.7 8-4 8-9V6.5Z" }),
|
|
2361
2450
|
/* @__PURE__ */ jsx28("path", { d: "m9 12 2 2 4-4" })
|
|
2362
2451
|
] })
|
|
2363
2452
|
};
|
|
2364
2453
|
|
|
2365
2454
|
// src/react/components/account/ProfilePanel.tsx
|
|
2366
|
-
import { useEffect as useEffect6, useState as
|
|
2455
|
+
import { useEffect as useEffect6, useState as useState12, useRef as useRef6 } from "react";
|
|
2367
2456
|
|
|
2368
2457
|
// src/react/components/account/PanelState.tsx
|
|
2369
|
-
import { Fragment as
|
|
2458
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2370
2459
|
function PanelState(props) {
|
|
2371
2460
|
const { t, errorMessage } = useCopy();
|
|
2372
2461
|
const { data, isLoading, error, refetch } = props.resource;
|
|
2373
2462
|
const empty = props.isEmpty(data);
|
|
2374
2463
|
if (isLoading && empty) return /* @__PURE__ */ jsx29(Skeleton, { count: props.skeletonRows ?? 3 });
|
|
2375
|
-
const errorBanner = error ? /* @__PURE__ */
|
|
2464
|
+
const errorBanner = error ? /* @__PURE__ */ jsxs19("div", { className: "throttle-stack", children: [
|
|
2376
2465
|
/* @__PURE__ */ jsx29(Alert, { tone: "error", children: errorMessage(error) }),
|
|
2377
2466
|
/* @__PURE__ */ jsx29(Button, { variant: "secondary", onClick: () => void refetch(), children: t.common.retry })
|
|
2378
2467
|
] }) : null;
|
|
@@ -2384,14 +2473,14 @@ function PanelState(props) {
|
|
|
2384
2473
|
if (empty) {
|
|
2385
2474
|
return props.gated ? /* @__PURE__ */ jsx29(EmptyState, { title: props.emptyTitle, description: props.gatedDescription }) : /* @__PURE__ */ jsx29(EmptyState, { title: props.emptyTitle, description: props.emptyDescription });
|
|
2386
2475
|
}
|
|
2387
|
-
return /* @__PURE__ */
|
|
2476
|
+
return /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
2388
2477
|
errorBanner,
|
|
2389
2478
|
props.children(data)
|
|
2390
2479
|
] });
|
|
2391
2480
|
}
|
|
2392
2481
|
|
|
2393
2482
|
// src/react/components/account/ProfilePanel.tsx
|
|
2394
|
-
import { jsx as jsx30, jsxs as
|
|
2483
|
+
import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2395
2484
|
function ProfilePanel(props) {
|
|
2396
2485
|
const a = useAppearance(props.appearance);
|
|
2397
2486
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -2399,7 +2488,7 @@ function ProfilePanel(props) {
|
|
|
2399
2488
|
const { status } = useAuth();
|
|
2400
2489
|
const resource = useCustomer();
|
|
2401
2490
|
const { submitting, error, notice, run } = useAction();
|
|
2402
|
-
const [form, setForm] =
|
|
2491
|
+
const [form, setForm] = useState12({ firstName: "", lastName: "", phone: "", company: "" });
|
|
2403
2492
|
const edited = useRef6(false);
|
|
2404
2493
|
useEffect6(() => {
|
|
2405
2494
|
const c = resource.data;
|
|
@@ -2419,7 +2508,7 @@ function ProfilePanel(props) {
|
|
|
2419
2508
|
isEmpty: (c) => c === null,
|
|
2420
2509
|
emptyTitle: t.common.somethingWentWrong,
|
|
2421
2510
|
skeletonRows: 4,
|
|
2422
|
-
children: (customer) => /* @__PURE__ */
|
|
2511
|
+
children: (customer) => /* @__PURE__ */ jsxs20(
|
|
2423
2512
|
"form",
|
|
2424
2513
|
{
|
|
2425
2514
|
...a.el("profilePanel.form", "throttle-stack"),
|
|
@@ -2449,55 +2538,59 @@ function ProfilePanel(props) {
|
|
|
2449
2538
|
hint: t.profile.emailReadOnly
|
|
2450
2539
|
}
|
|
2451
2540
|
),
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2541
|
+
/* @__PURE__ */ jsxs20(FieldRow, { children: [
|
|
2542
|
+
/* @__PURE__ */ jsx30(
|
|
2543
|
+
Field,
|
|
2544
|
+
{
|
|
2545
|
+
label: t.profile.firstName,
|
|
2546
|
+
value: form.firstName,
|
|
2547
|
+
autoComplete: "given-name",
|
|
2548
|
+
onChange: (v) => {
|
|
2549
|
+
edited.current = true;
|
|
2550
|
+
setForm((f) => ({ ...f, firstName: v }));
|
|
2551
|
+
}
|
|
2461
2552
|
}
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2553
|
+
),
|
|
2554
|
+
/* @__PURE__ */ jsx30(
|
|
2555
|
+
Field,
|
|
2556
|
+
{
|
|
2557
|
+
label: t.profile.lastName,
|
|
2558
|
+
value: form.lastName,
|
|
2559
|
+
autoComplete: "family-name",
|
|
2560
|
+
onChange: (v) => {
|
|
2561
|
+
edited.current = true;
|
|
2562
|
+
setForm((f) => ({ ...f, lastName: v }));
|
|
2563
|
+
}
|
|
2473
2564
|
}
|
|
2474
|
-
|
|
2475
|
-
),
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2565
|
+
)
|
|
2566
|
+
] }),
|
|
2567
|
+
/* @__PURE__ */ jsxs20(FieldRow, { children: [
|
|
2568
|
+
/* @__PURE__ */ jsx30(
|
|
2569
|
+
Field,
|
|
2570
|
+
{
|
|
2571
|
+
label: t.profile.phone,
|
|
2572
|
+
type: "tel",
|
|
2573
|
+
value: form.phone,
|
|
2574
|
+
autoComplete: "tel",
|
|
2575
|
+
onChange: (v) => {
|
|
2576
|
+
edited.current = true;
|
|
2577
|
+
setForm((f) => ({ ...f, phone: v }));
|
|
2578
|
+
}
|
|
2486
2579
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2580
|
+
),
|
|
2581
|
+
/* @__PURE__ */ jsx30(
|
|
2582
|
+
Field,
|
|
2583
|
+
{
|
|
2584
|
+
label: t.profile.company,
|
|
2585
|
+
value: form.company,
|
|
2586
|
+
autoComplete: "organization",
|
|
2587
|
+
onChange: (v) => {
|
|
2588
|
+
edited.current = true;
|
|
2589
|
+
setForm((f) => ({ ...f, company: v }));
|
|
2590
|
+
}
|
|
2498
2591
|
}
|
|
2499
|
-
|
|
2500
|
-
),
|
|
2592
|
+
)
|
|
2593
|
+
] }),
|
|
2501
2594
|
error ? /* @__PURE__ */ jsx30(Alert, { tone: "error", children: error }) : null,
|
|
2502
2595
|
notice ? /* @__PURE__ */ jsx30(Alert, { tone: "success", children: notice }) : null,
|
|
2503
2596
|
/* @__PURE__ */ jsx30(Button, { type: "submit", loading: submitting, elementKey: "profilePanel.submitButton", children: t.profile.saveButton })
|
|
@@ -2509,16 +2602,16 @@ function ProfilePanel(props) {
|
|
|
2509
2602
|
}
|
|
2510
2603
|
|
|
2511
2604
|
// src/react/components/account/AddressesPanel.tsx
|
|
2512
|
-
import { useState as
|
|
2605
|
+
import { useState as useState14 } from "react";
|
|
2513
2606
|
|
|
2514
2607
|
// src/react/components/account/AddressForm.tsx
|
|
2515
|
-
import { useState as
|
|
2516
|
-
import { jsx as jsx31, jsxs as
|
|
2608
|
+
import { useState as useState13 } from "react";
|
|
2609
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2517
2610
|
function AddressForm(props) {
|
|
2518
2611
|
const a = useAppearance();
|
|
2519
2612
|
const { t } = useCopy();
|
|
2520
2613
|
const i = props.initial;
|
|
2521
|
-
const [form, setForm] =
|
|
2614
|
+
const [form, setForm] = useState13({
|
|
2522
2615
|
label: i?.label ?? "",
|
|
2523
2616
|
firstName: i?.firstName ?? "",
|
|
2524
2617
|
lastName: i?.lastName ?? "",
|
|
@@ -2532,7 +2625,7 @@ function AddressForm(props) {
|
|
|
2532
2625
|
phone: i?.phone ?? ""
|
|
2533
2626
|
});
|
|
2534
2627
|
const set = (key) => (value) => setForm((f) => ({ ...f, [key]: value }));
|
|
2535
|
-
return /* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ jsxs21(
|
|
2536
2629
|
"form",
|
|
2537
2630
|
{
|
|
2538
2631
|
...a.el("addressesPanel.form", "throttle-stack"),
|
|
@@ -2554,10 +2647,14 @@ function AddressForm(props) {
|
|
|
2554
2647
|
});
|
|
2555
2648
|
},
|
|
2556
2649
|
children: [
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2650
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2651
|
+
/* @__PURE__ */ jsx31(Field, { label: t.addresses.label, value: form.label, onChange: set("label") }),
|
|
2652
|
+
/* @__PURE__ */ jsx31(Field, { label: t.addresses.company, value: form.company, onChange: set("company"), autoComplete: "organization" })
|
|
2653
|
+
] }),
|
|
2654
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2655
|
+
/* @__PURE__ */ jsx31(Field, { label: t.addresses.firstName, value: form.firstName, onChange: set("firstName"), autoComplete: "given-name" }),
|
|
2656
|
+
/* @__PURE__ */ jsx31(Field, { label: t.addresses.lastName, value: form.lastName, onChange: set("lastName"), autoComplete: "family-name" })
|
|
2657
|
+
] }),
|
|
2561
2658
|
/* @__PURE__ */ jsx31(
|
|
2562
2659
|
Field,
|
|
2563
2660
|
{
|
|
@@ -2577,39 +2674,43 @@ function AddressForm(props) {
|
|
|
2577
2674
|
autoComplete: "address-line2"
|
|
2578
2675
|
}
|
|
2579
2676
|
),
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2677
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2678
|
+
/* @__PURE__ */ jsx31(Field, { label: t.addresses.city, value: form.city, onChange: set("city"), required: true, autoComplete: "address-level2" }),
|
|
2679
|
+
/* @__PURE__ */ jsx31(
|
|
2680
|
+
Field,
|
|
2681
|
+
{
|
|
2682
|
+
label: t.addresses.stateProvince,
|
|
2683
|
+
value: form.stateProvince,
|
|
2684
|
+
onChange: set("stateProvince"),
|
|
2685
|
+
autoComplete: "address-level1"
|
|
2686
|
+
}
|
|
2687
|
+
)
|
|
2688
|
+
] }),
|
|
2689
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2690
|
+
/* @__PURE__ */ jsx31(
|
|
2691
|
+
Field,
|
|
2692
|
+
{
|
|
2693
|
+
label: t.addresses.postalCode,
|
|
2694
|
+
value: form.postalCode,
|
|
2695
|
+
onChange: set("postalCode"),
|
|
2696
|
+
autoComplete: "postal-code"
|
|
2697
|
+
}
|
|
2698
|
+
),
|
|
2699
|
+
/* @__PURE__ */ jsx31(
|
|
2700
|
+
Field,
|
|
2701
|
+
{
|
|
2702
|
+
label: t.addresses.countryCode,
|
|
2703
|
+
value: form.countryCode,
|
|
2704
|
+
onChange: set("countryCode"),
|
|
2705
|
+
required: true,
|
|
2706
|
+
autoComplete: "country",
|
|
2707
|
+
hint: "ISO 3166-1 alpha-2, e.g. GB"
|
|
2708
|
+
}
|
|
2709
|
+
)
|
|
2710
|
+
] }),
|
|
2610
2711
|
/* @__PURE__ */ jsx31(Field, { label: t.addresses.phone, type: "tel", value: form.phone, onChange: set("phone"), autoComplete: "tel" }),
|
|
2611
2712
|
props.error ? /* @__PURE__ */ jsx31(Alert, { tone: "error", children: props.error }) : null,
|
|
2612
|
-
/* @__PURE__ */
|
|
2713
|
+
/* @__PURE__ */ jsxs21("div", { className: "throttle-actions", children: [
|
|
2613
2714
|
/* @__PURE__ */ jsx31(Button, { type: "submit", loading: props.submitting, children: t.common.save }),
|
|
2614
2715
|
/* @__PURE__ */ jsx31(Button, { variant: "link", onClick: props.onCancel, children: t.common.cancel })
|
|
2615
2716
|
] })
|
|
@@ -2619,7 +2720,7 @@ function AddressForm(props) {
|
|
|
2619
2720
|
}
|
|
2620
2721
|
|
|
2621
2722
|
// src/react/components/account/AddressesPanel.tsx
|
|
2622
|
-
import { Fragment as
|
|
2723
|
+
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2623
2724
|
function AddressesPanel(props) {
|
|
2624
2725
|
const a = useAppearance(props.appearance);
|
|
2625
2726
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -2627,7 +2728,7 @@ function AddressesPanel(props) {
|
|
|
2627
2728
|
const resource = useAddresses();
|
|
2628
2729
|
const { submitting, error, run } = useAction();
|
|
2629
2730
|
const confirm = useConfirm();
|
|
2630
|
-
const [editing, setEditing] =
|
|
2731
|
+
const [editing, setEditing] = useState14(null);
|
|
2631
2732
|
const variant = props.variant ?? "rows";
|
|
2632
2733
|
const rowsVariant = variant === "rows";
|
|
2633
2734
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -2635,7 +2736,7 @@ function AddressesPanel(props) {
|
|
|
2635
2736
|
const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
|
|
2636
2737
|
const close = () => setEditing(null);
|
|
2637
2738
|
const formatAddress = (address) => [address.addressLine2, address.city, address.stateProvince, address.postalCode, address.countryCode].filter(Boolean).join(", ");
|
|
2638
|
-
return /* @__PURE__ */ jsx32(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx32("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2739
|
+
return /* @__PURE__ */ jsx32(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx32("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs22("div", { ...a.el("addressesPanel.root", "throttle-panel"), children: [
|
|
2639
2740
|
!editing && error ? /* @__PURE__ */ jsx32(Alert, { tone: "error", children: error }) : null,
|
|
2640
2741
|
editing ? /* @__PURE__ */ jsx32(
|
|
2641
2742
|
AddressForm,
|
|
@@ -2650,7 +2751,7 @@ function AddressesPanel(props) {
|
|
|
2650
2751
|
close();
|
|
2651
2752
|
})
|
|
2652
2753
|
}
|
|
2653
|
-
) : /* @__PURE__ */
|
|
2754
|
+
) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
2654
2755
|
/* @__PURE__ */ jsx32("div", { children: /* @__PURE__ */ jsx32(Button, { elementKey: "addressesPanel.addButton", variant: "secondary", onClick: () => setEditing("new"), children: t.addresses.addButton }) }),
|
|
2655
2756
|
/* @__PURE__ */ jsx32(
|
|
2656
2757
|
PanelState,
|
|
@@ -2668,12 +2769,12 @@ function AddressesPanel(props) {
|
|
|
2668
2769
|
rows,
|
|
2669
2770
|
columns: [
|
|
2670
2771
|
{ key: "label", label: t.addresses.label, render: (address) => address.label || address.addressLine1 },
|
|
2671
|
-
{ key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */
|
|
2772
|
+
{ key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
2672
2773
|
address.addressLine1,
|
|
2673
2774
|
formatAddress(address) ? `, ${formatAddress(address)}` : ""
|
|
2674
2775
|
] }) },
|
|
2675
2776
|
{ key: "default", label: t.addresses.defaultBadge, render: (address) => address.isDefault ? /* @__PURE__ */ jsx32(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null },
|
|
2676
|
-
{ key: "actions", label: t.common.actions, render: (address) => /* @__PURE__ */
|
|
2777
|
+
{ key: "actions", label: t.common.actions, render: (address) => /* @__PURE__ */ jsxs22("div", { className: "throttle-actions", children: [
|
|
2677
2778
|
!address.isDefault ? /* @__PURE__ */ jsx32(
|
|
2678
2779
|
Button,
|
|
2679
2780
|
{
|
|
@@ -2708,16 +2809,16 @@ function AddressesPanel(props) {
|
|
|
2708
2809
|
] }) }
|
|
2709
2810
|
]
|
|
2710
2811
|
}
|
|
2711
|
-
) : /* @__PURE__ */ jsx32("div", { ...a.el("addressesPanel.list", listBase), children: rows.map((address) => /* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2812
|
+
) : /* @__PURE__ */ jsx32("div", { ...a.el("addressesPanel.list", listBase), children: rows.map((address) => /* @__PURE__ */ jsxs22("div", { ...a.el("addressesPanel.item", itemBase), children: [
|
|
2813
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
2814
|
+
/* @__PURE__ */ jsxs22("div", { className: "throttle-row", children: [
|
|
2714
2815
|
/* @__PURE__ */ jsx32("strong", { children: address.label || address.addressLine1 }),
|
|
2715
2816
|
address.isDefault ? /* @__PURE__ */ jsx32(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null
|
|
2716
2817
|
] }),
|
|
2717
2818
|
/* @__PURE__ */ jsx32("p", { className: "throttle-muted", children: address.addressLine1 }),
|
|
2718
2819
|
/* @__PURE__ */ jsx32("p", { className: "throttle-muted", children: formatAddress(address) })
|
|
2719
2820
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ jsxs22("div", { className: "throttle-actions", children: [
|
|
2721
2822
|
!address.isDefault ? /* @__PURE__ */ jsx32(
|
|
2722
2823
|
Button,
|
|
2723
2824
|
{
|
|
@@ -2758,18 +2859,18 @@ function AddressesPanel(props) {
|
|
|
2758
2859
|
}
|
|
2759
2860
|
|
|
2760
2861
|
// src/react/components/account/PaymentMethodsPanel.tsx
|
|
2761
|
-
import { useState as
|
|
2862
|
+
import { useState as useState16 } from "react";
|
|
2762
2863
|
|
|
2763
2864
|
// src/react/components/account/AddCardDialog.tsx
|
|
2764
|
-
import { useEffect as useEffect7, useId as
|
|
2765
|
-
import { jsx as jsx33, jsxs as
|
|
2865
|
+
import { useEffect as useEffect7, useId as useId4, useRef as useRef7, useState as useState15 } from "react";
|
|
2866
|
+
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2766
2867
|
function AddCardDialog(props) {
|
|
2767
2868
|
const { account } = useAuth();
|
|
2768
|
-
const titleId =
|
|
2869
|
+
const titleId = useId4();
|
|
2769
2870
|
const { t } = useCopy(props.localization);
|
|
2770
|
-
const [src, setSrc] =
|
|
2771
|
-
const [error, setError] =
|
|
2772
|
-
const [busy, setBusy] =
|
|
2871
|
+
const [src, setSrc] = useState15(null);
|
|
2872
|
+
const [error, setError] = useState15(null);
|
|
2873
|
+
const [busy, setBusy] = useState15(false);
|
|
2773
2874
|
const onAdded = useRef7(props.onAdded);
|
|
2774
2875
|
const onClose = useRef7(props.onClose);
|
|
2775
2876
|
onAdded.current = props.onAdded;
|
|
@@ -2837,9 +2938,9 @@ function AddCardDialog(props) {
|
|
|
2837
2938
|
return () => window.removeEventListener("message", onMessage);
|
|
2838
2939
|
}, [src, account, t]);
|
|
2839
2940
|
if (!props.open) return null;
|
|
2840
|
-
return /* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ jsxs23(Modal, { open: true, onClose: props.onClose, labelledBy: titleId, children: [
|
|
2841
2942
|
/* @__PURE__ */ jsx33("div", { className: "throttle-modal__header", children: /* @__PURE__ */ jsx33("h2", { id: titleId, className: "throttle-modal__title", children: t.paymentMethods.addTitle }) }),
|
|
2842
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsxs23("div", { className: "throttle-modal__body", children: [
|
|
2843
2944
|
error ? /* @__PURE__ */ jsx33(Alert, { tone: "error", children: error }) : null,
|
|
2844
2945
|
busy ? /* @__PURE__ */ jsx33("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx33(Spinner, {}) }) : src ? /* @__PURE__ */ jsx33(
|
|
2845
2946
|
"iframe",
|
|
@@ -2855,7 +2956,7 @@ function AddCardDialog(props) {
|
|
|
2855
2956
|
}
|
|
2856
2957
|
|
|
2857
2958
|
// src/react/components/account/PaymentMethodsPanel.tsx
|
|
2858
|
-
import { jsx as jsx34, jsxs as
|
|
2959
|
+
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2859
2960
|
function PaymentMethodsPanel(props) {
|
|
2860
2961
|
const a = useAppearance(props.appearance);
|
|
2861
2962
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -2864,7 +2965,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2864
2965
|
const resource = useSavedCards();
|
|
2865
2966
|
const { submitting, error, run } = useAction();
|
|
2866
2967
|
const confirm = useConfirm();
|
|
2867
|
-
const [adding, setAdding] =
|
|
2968
|
+
const [adding, setAdding] = useState16(false);
|
|
2868
2969
|
const variant = props.variant ?? "rows";
|
|
2869
2970
|
const rowsVariant = variant === "rows";
|
|
2870
2971
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -2872,7 +2973,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2872
2973
|
const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
|
|
2873
2974
|
const cardLabel = (card) => `${(card.cardBrand ?? card.methodType).toUpperCase()} \u2022\u2022\u2022\u2022 ${card.cardLastFour ?? "____"}`;
|
|
2874
2975
|
const expiryLabel = (card) => card.cardExpMonth && card.cardExpYear ? `${String(card.cardExpMonth).padStart(2, "0")}/${card.cardExpYear}` : "";
|
|
2875
|
-
return /* @__PURE__ */ jsx34(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx34("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
2976
|
+
return /* @__PURE__ */ jsx34(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx34("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs24("div", { ...a.el("paymentMethodsPanel.root", "throttle-panel"), children: [
|
|
2876
2977
|
error ? /* @__PURE__ */ jsx34(Alert, { tone: "error", children: error }) : null,
|
|
2877
2978
|
emailVerified ? /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(Button, { elementKey: "paymentMethodsPanel.addButton", variant: "secondary", onClick: () => setAdding(true), children: t.paymentMethods.addButton }) }) : null,
|
|
2878
2979
|
/* @__PURE__ */ jsx34(
|
|
@@ -2906,7 +3007,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2906
3007
|
{ key: "card", label: t.paymentMethods.columnCard, render: (card) => cardLabel(card) },
|
|
2907
3008
|
{ key: "expires", label: t.paymentMethods.expires, render: (card) => expiryLabel(card) },
|
|
2908
3009
|
{ key: "default", label: t.paymentMethods.defaultBadge, render: (card) => card.isDefault ? /* @__PURE__ */ jsx34(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null },
|
|
2909
|
-
{ key: "actions", label: t.common.actions, render: (card) => /* @__PURE__ */
|
|
3010
|
+
{ key: "actions", label: t.common.actions, render: (card) => /* @__PURE__ */ jsxs24("div", { className: "throttle-actions", children: [
|
|
2910
3011
|
!card.isDefault ? /* @__PURE__ */ jsx34(
|
|
2911
3012
|
Button,
|
|
2912
3013
|
{
|
|
@@ -2933,13 +3034,13 @@ function PaymentMethodsPanel(props) {
|
|
|
2933
3034
|
] }) }
|
|
2934
3035
|
]
|
|
2935
3036
|
}
|
|
2936
|
-
) : /* @__PURE__ */ jsx34("div", { ...a.el("paymentMethodsPanel.list", listBase), children: rows.map((card) => /* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
3037
|
+
) : /* @__PURE__ */ jsx34("div", { ...a.el("paymentMethodsPanel.list", listBase), children: rows.map((card) => /* @__PURE__ */ jsxs24("div", { ...a.el("paymentMethodsPanel.item", itemBase), children: [
|
|
3038
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
3039
|
+
/* @__PURE__ */ jsxs24("div", { className: "throttle-row", children: [
|
|
2939
3040
|
/* @__PURE__ */ jsx34("strong", { children: cardLabel(card) }),
|
|
2940
3041
|
card.isDefault ? /* @__PURE__ */ jsx34(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null
|
|
2941
3042
|
] }),
|
|
2942
|
-
card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */
|
|
3043
|
+
card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */ jsxs24("p", { className: "throttle-muted", children: [
|
|
2943
3044
|
t.paymentMethods.expires,
|
|
2944
3045
|
" ",
|
|
2945
3046
|
String(card.cardExpMonth).padStart(2, "0"),
|
|
@@ -2947,7 +3048,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2947
3048
|
card.cardExpYear
|
|
2948
3049
|
] }) : null
|
|
2949
3050
|
] }),
|
|
2950
|
-
/* @__PURE__ */
|
|
3051
|
+
/* @__PURE__ */ jsxs24("div", { className: "throttle-actions", children: [
|
|
2951
3052
|
!card.isDefault ? /* @__PURE__ */ jsx34(
|
|
2952
3053
|
Button,
|
|
2953
3054
|
{
|
|
@@ -2979,7 +3080,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2979
3080
|
}
|
|
2980
3081
|
|
|
2981
3082
|
// src/react/components/account/OrdersPanel.tsx
|
|
2982
|
-
import { useState as
|
|
3083
|
+
import { useEffect as useEffect8, useState as useState17 } from "react";
|
|
2983
3084
|
|
|
2984
3085
|
// src/react/components/format.ts
|
|
2985
3086
|
function formatMoney(minorUnits, currency, locale) {
|
|
@@ -3011,7 +3112,7 @@ function formatDate(value, locale) {
|
|
|
3011
3112
|
}
|
|
3012
3113
|
|
|
3013
3114
|
// src/react/components/account/OrderStatus.tsx
|
|
3014
|
-
import { Fragment as
|
|
3115
|
+
import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3015
3116
|
function copyKey(wire) {
|
|
3016
3117
|
return wire.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
3017
3118
|
}
|
|
@@ -3026,14 +3127,14 @@ function OrderStatus(props) {
|
|
|
3026
3127
|
const payLabels = props.t.orders.paymentLabels;
|
|
3027
3128
|
const lifecycle = labels[copyKey(props.status)] ?? props.status.replace(/_/g, " ");
|
|
3028
3129
|
const money = props.paymentStatus ? payLabels[copyKey(props.paymentStatus)] : void 0;
|
|
3029
|
-
return /* @__PURE__ */
|
|
3130
|
+
return /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
3030
3131
|
/* @__PURE__ */ jsx35(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: lifecycle }),
|
|
3031
3132
|
money ? /* @__PURE__ */ jsx35(Badge, { tone: ATTENTION_PAYMENT_STATES.has(props.paymentStatus) ? "warning" : "neutral", children: money }) : null
|
|
3032
3133
|
] });
|
|
3033
3134
|
}
|
|
3034
3135
|
|
|
3035
3136
|
// src/react/components/account/AddressBlock.tsx
|
|
3036
|
-
import { jsx as jsx36, jsxs as
|
|
3137
|
+
import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3037
3138
|
function addressLines(address) {
|
|
3038
3139
|
if (!address || typeof address !== "object") return [];
|
|
3039
3140
|
const a = address;
|
|
@@ -3053,14 +3154,14 @@ function AddressBlock(props) {
|
|
|
3053
3154
|
const a = useAppearance();
|
|
3054
3155
|
const lines = addressLines(props.address);
|
|
3055
3156
|
if (lines.length === 0) return null;
|
|
3056
|
-
return /* @__PURE__ */
|
|
3157
|
+
return /* @__PURE__ */ jsxs26("div", { ...a.el(props.elementKey ?? "orderDetail.address", "throttle-addressblock"), children: [
|
|
3057
3158
|
/* @__PURE__ */ jsx36("h4", { className: "throttle-section__title", children: props.heading }),
|
|
3058
3159
|
lines.map((l) => /* @__PURE__ */ jsx36("p", { className: "throttle-addressblock__line throttle-muted", children: l }, l))
|
|
3059
3160
|
] });
|
|
3060
3161
|
}
|
|
3061
3162
|
|
|
3062
3163
|
// src/react/components/account/OrderTimeline.tsx
|
|
3063
|
-
import { jsx as jsx37, jsxs as
|
|
3164
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3064
3165
|
function orderTimeline(order, labels) {
|
|
3065
3166
|
const entries = [{ label: labels.placed, at: order.createdAt }];
|
|
3066
3167
|
if (order.completedAt) entries.push({ label: labels.completed, at: order.completedAt });
|
|
@@ -3071,9 +3172,9 @@ function orderTimeline(order, labels) {
|
|
|
3071
3172
|
function OrderTimeline(props) {
|
|
3072
3173
|
const a = useAppearance();
|
|
3073
3174
|
if (props.entries.length <= 1) return null;
|
|
3074
|
-
return /* @__PURE__ */
|
|
3175
|
+
return /* @__PURE__ */ jsxs27("div", { ...a.el("orderDetail.timeline", "throttle-timeline"), children: [
|
|
3075
3176
|
/* @__PURE__ */ jsx37("h4", { className: "throttle-section__title", children: props.heading }),
|
|
3076
|
-
props.entries.map((e) => /* @__PURE__ */
|
|
3177
|
+
props.entries.map((e) => /* @__PURE__ */ jsxs27("div", { className: "throttle-timeline__row", children: [
|
|
3077
3178
|
/* @__PURE__ */ jsx37("span", { className: "throttle-timeline__dot", "aria-hidden": "true" }),
|
|
3078
3179
|
/* @__PURE__ */ jsx37("span", { className: "throttle-timeline__label", children: e.label }),
|
|
3079
3180
|
/* @__PURE__ */ jsx37("span", { className: "throttle-muted", children: formatDate(e.at, props.locale) })
|
|
@@ -3082,21 +3183,29 @@ function OrderTimeline(props) {
|
|
|
3082
3183
|
}
|
|
3083
3184
|
|
|
3084
3185
|
// src/react/components/account/OrderDetail.tsx
|
|
3085
|
-
import {
|
|
3186
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3086
3187
|
var CAN_PAY = /* @__PURE__ */ new Set(["draft", "pending"]);
|
|
3087
3188
|
var CAN_REORDER = /* @__PURE__ */ new Set(["fulfilled", "cancelled", "closed"]);
|
|
3189
|
+
var CAN_CANCEL = /* @__PURE__ */ new Set(["draft", "pending", "processing"]);
|
|
3190
|
+
var SETTLED_PAYMENT = /* @__PURE__ */ new Set(["captured", "paid", "partially_refunded", "refunded"]);
|
|
3191
|
+
var CAN_RETURN = /* @__PURE__ */ new Set(["fulfilled", "partially_fulfilled", "closed"]);
|
|
3088
3192
|
function Line(props) {
|
|
3089
|
-
return /* @__PURE__ */
|
|
3193
|
+
return /* @__PURE__ */ jsxs28("div", { className: "throttle-row", children: [
|
|
3090
3194
|
/* @__PURE__ */ jsx38("span", { className: "throttle-muted", children: props.label }),
|
|
3091
|
-
/* @__PURE__ */ jsx38("span", { children: props.value })
|
|
3195
|
+
/* @__PURE__ */ jsx38("span", { children: props.strong ? /* @__PURE__ */ jsx38("strong", { children: props.value }) : props.value })
|
|
3092
3196
|
] });
|
|
3093
3197
|
}
|
|
3094
3198
|
function OrderDetail(props) {
|
|
3095
3199
|
const a = useAppearance(props.appearance);
|
|
3096
3200
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3097
3201
|
const { t, locale } = useCopy(props.localization);
|
|
3202
|
+
const { account } = useAuth();
|
|
3098
3203
|
const resource = useOrder(props.orderId);
|
|
3099
|
-
|
|
3204
|
+
const { submitting, error, run } = useAction();
|
|
3205
|
+
const confirm = useConfirm();
|
|
3206
|
+
const allowCancel = props.allowCancel ?? true;
|
|
3207
|
+
const allowReturn = props.allowReturn ?? true;
|
|
3208
|
+
return /* @__PURE__ */ jsx38(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx38("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.root", "throttle-panel"), children: [
|
|
3100
3209
|
props.onBack ? (
|
|
3101
3210
|
// Wrapped on purpose. The panel is a column flex container, so a
|
|
3102
3211
|
// direct child stretches to its full width however `width: auto`
|
|
@@ -3106,6 +3215,7 @@ function OrderDetail(props) {
|
|
|
3106
3215
|
// those outrank the merchant overrides in `appearance.elements`.
|
|
3107
3216
|
/* @__PURE__ */ jsx38("div", { children: /* @__PURE__ */ jsx38(Button, { variant: "link", elementKey: "orderDetail.backButton", onClick: props.onBack, children: t.common.back }) })
|
|
3108
3217
|
) : null,
|
|
3218
|
+
error ? /* @__PURE__ */ jsx38(Alert, { tone: "error", children: error }) : null,
|
|
3109
3219
|
/* @__PURE__ */ jsx38(
|
|
3110
3220
|
PanelState,
|
|
3111
3221
|
{
|
|
@@ -3113,121 +3223,200 @@ function OrderDetail(props) {
|
|
|
3113
3223
|
isEmpty: (o) => o === null,
|
|
3114
3224
|
emptyTitle: t.orders.empty,
|
|
3115
3225
|
skeletonRows: 5,
|
|
3116
|
-
children: (order) =>
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
)
|
|
3161
|
-
] }),
|
|
3162
|
-
/* @__PURE__ */ jsx38(
|
|
3163
|
-
OrderTimeline,
|
|
3164
|
-
{
|
|
3165
|
-
heading: t.orders.history,
|
|
3166
|
-
locale,
|
|
3167
|
-
entries: orderTimeline(order, {
|
|
3168
|
-
placed: t.orders.placed,
|
|
3169
|
-
completed: t.orders.completed,
|
|
3170
|
-
cancelled: t.orders.cancelledAt,
|
|
3171
|
-
closed: t.orders.closedAt
|
|
3172
|
-
})
|
|
3173
|
-
}
|
|
3174
|
-
),
|
|
3175
|
-
(() => {
|
|
3176
|
-
const target = {
|
|
3177
|
-
id: order.id,
|
|
3178
|
-
orderNumber: order.orderNumber,
|
|
3179
|
-
currency: order.currency,
|
|
3180
|
-
lineItems: order.lineItems.map((li) => ({
|
|
3181
|
-
name: li.name,
|
|
3182
|
-
unitPrice: li.unitPrice,
|
|
3183
|
-
quantity: li.quantity
|
|
3184
|
-
}))
|
|
3185
|
-
};
|
|
3186
|
-
return /* @__PURE__ */ jsxs29("div", { className: "throttle-actions", children: [
|
|
3187
|
-
props.onPayNow && CAN_PAY.has(order.status) ? /* @__PURE__ */ jsx38(
|
|
3188
|
-
Button,
|
|
3189
|
-
{
|
|
3190
|
-
elementKey: "orderDetail.payButton",
|
|
3191
|
-
onClick: () => props.onPayNow(target),
|
|
3192
|
-
children: t.orders.payNow
|
|
3193
|
-
}
|
|
3194
|
-
) : null,
|
|
3195
|
-
props.onTrackShipment && order.status === "partially_fulfilled" ? /* @__PURE__ */ jsx38(
|
|
3196
|
-
Button,
|
|
3197
|
-
{
|
|
3198
|
-
variant: "secondary",
|
|
3199
|
-
elementKey: "orderDetail.trackButton",
|
|
3200
|
-
onClick: () => props.onTrackShipment(target),
|
|
3201
|
-
children: t.orders.track
|
|
3202
|
-
}
|
|
3203
|
-
) : null,
|
|
3204
|
-
props.onReorder && CAN_REORDER.has(order.status) ? /* @__PURE__ */ jsx38(
|
|
3205
|
-
Button,
|
|
3226
|
+
children: (order) => {
|
|
3227
|
+
const target = {
|
|
3228
|
+
id: order.id,
|
|
3229
|
+
orderNumber: order.orderNumber,
|
|
3230
|
+
currency: order.currency,
|
|
3231
|
+
lineItems: order.lineItems.map((li) => ({
|
|
3232
|
+
name: li.name,
|
|
3233
|
+
unitPrice: li.unitPrice,
|
|
3234
|
+
quantity: li.quantity
|
|
3235
|
+
}))
|
|
3236
|
+
};
|
|
3237
|
+
const money = (v) => formatMoney(v, order.currency, locale);
|
|
3238
|
+
const paid = SETTLED_PAYMENT.has(order.paymentStatus);
|
|
3239
|
+
const showCancel = allowCancel && CAN_CANCEL.has(order.status) && !paid;
|
|
3240
|
+
const showReturn = allowReturn && CAN_RETURN.has(order.status);
|
|
3241
|
+
return /* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.layout", "throttle-detail"), children: [
|
|
3242
|
+
/* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.main", "throttle-detail__main"), children: [
|
|
3243
|
+
/* @__PURE__ */ jsxs28("div", { className: "throttle-detail__section", children: [
|
|
3244
|
+
/* @__PURE__ */ jsxs28("div", { className: "throttle-row", children: [
|
|
3245
|
+
/* @__PURE__ */ jsx38("h3", { children: order.orderNumber }),
|
|
3246
|
+
/* @__PURE__ */ jsx38(OrderStatus, { status: order.status, paymentStatus: order.paymentStatus, t })
|
|
3247
|
+
] }),
|
|
3248
|
+
/* @__PURE__ */ jsx38("p", { className: "throttle-muted", children: formatDate(order.createdAt, locale) })
|
|
3249
|
+
] }),
|
|
3250
|
+
/* @__PURE__ */ jsxs28("div", { className: "throttle-detail__section", children: [
|
|
3251
|
+
/* @__PURE__ */ jsx38("span", { className: "throttle-detail__label", children: t.orders.items }),
|
|
3252
|
+
/* @__PURE__ */ jsx38("div", { ...a.el("orderDetail.lineItems", "throttle-stack"), children: order.lineItems.map((item) => /* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.lineItem", "throttle-lineitem"), children: [
|
|
3253
|
+
item.imageUrl ? /* @__PURE__ */ jsx38("img", { className: "throttle-lineitem__image", src: item.imageUrl, alt: "" }) : null,
|
|
3254
|
+
/* @__PURE__ */ jsxs28("div", { style: { flex: 1 }, children: [
|
|
3255
|
+
/* @__PURE__ */ jsx38("strong", { children: item.name }),
|
|
3256
|
+
item.description ? /* @__PURE__ */ jsx38("p", { className: "throttle-lineitem__desc", children: item.description }) : null,
|
|
3257
|
+
/* @__PURE__ */ jsxs28("p", { className: "throttle-lineitem__meta", children: [
|
|
3258
|
+
t.orders.quantity,
|
|
3259
|
+
" ",
|
|
3260
|
+
item.quantity,
|
|
3261
|
+
" \xD7 ",
|
|
3262
|
+
money(item.unitPrice)
|
|
3263
|
+
] })
|
|
3264
|
+
] }),
|
|
3265
|
+
/* @__PURE__ */ jsx38("span", { children: money(item.total) })
|
|
3266
|
+
] }, item.id)) })
|
|
3267
|
+
] }),
|
|
3268
|
+
/* @__PURE__ */ jsx38(
|
|
3269
|
+
OrderTimeline,
|
|
3206
3270
|
{
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3271
|
+
heading: t.orders.history,
|
|
3272
|
+
locale,
|
|
3273
|
+
entries: orderTimeline(order, {
|
|
3274
|
+
placed: t.orders.placed,
|
|
3275
|
+
completed: t.orders.completed,
|
|
3276
|
+
cancelled: t.orders.cancelledAt,
|
|
3277
|
+
closed: t.orders.closedAt
|
|
3278
|
+
})
|
|
3211
3279
|
}
|
|
3212
|
-
)
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3280
|
+
),
|
|
3281
|
+
/* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.addresses", "throttle-addresses"), children: [
|
|
3282
|
+
/* @__PURE__ */ jsx38(
|
|
3283
|
+
AddressBlock,
|
|
3284
|
+
{
|
|
3285
|
+
heading: t.orders.shipTo,
|
|
3286
|
+
address: order.shippingAddress,
|
|
3287
|
+
elementKey: "orderDetail.shippingAddress"
|
|
3288
|
+
}
|
|
3289
|
+
),
|
|
3290
|
+
/* @__PURE__ */ jsx38(
|
|
3291
|
+
AddressBlock,
|
|
3292
|
+
{
|
|
3293
|
+
heading: t.orders.billTo,
|
|
3294
|
+
address: order.billingAddress,
|
|
3295
|
+
elementKey: "orderDetail.billingAddress"
|
|
3296
|
+
}
|
|
3297
|
+
)
|
|
3298
|
+
] })
|
|
3299
|
+
] }),
|
|
3300
|
+
/* @__PURE__ */ jsxs28("aside", { ...a.el("orderDetail.rail", "throttle-detail__rail"), children: [
|
|
3301
|
+
/* @__PURE__ */ jsxs28("div", { className: "throttle-detail__section", children: [
|
|
3302
|
+
/* @__PURE__ */ jsx38("span", { className: "throttle-detail__label", children: t.orders.total }),
|
|
3303
|
+
/* @__PURE__ */ jsx38("span", { className: "throttle-detail__headline", children: money(order.total) })
|
|
3304
|
+
] }),
|
|
3305
|
+
/* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.totals", "throttle-totals"), children: [
|
|
3306
|
+
/* @__PURE__ */ jsx38(Line, { label: t.orders.subtotal, value: money(order.subtotal) }),
|
|
3307
|
+
order.discountTotal ? /* @__PURE__ */ jsx38(Line, { label: t.orders.discount, value: money(-order.discountTotal) }) : null,
|
|
3308
|
+
/* @__PURE__ */ jsx38(Line, { label: t.orders.shipping, value: money(order.shippingTotal) }),
|
|
3309
|
+
/* @__PURE__ */ jsx38(Line, { label: t.orders.tax, value: money(order.taxTotal) })
|
|
3310
|
+
] }),
|
|
3311
|
+
/* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.actions", "throttle-detail__actions"), children: [
|
|
3312
|
+
props.onPayNow && CAN_PAY.has(order.status) ? /* @__PURE__ */ jsx38(Button, { elementKey: "orderDetail.payButton", onClick: () => props.onPayNow(target), children: t.orders.payNow }) : null,
|
|
3313
|
+
order.invoiceId ? /* @__PURE__ */ jsx38(
|
|
3314
|
+
Button,
|
|
3315
|
+
{
|
|
3316
|
+
variant: "secondary",
|
|
3317
|
+
loading: submitting,
|
|
3318
|
+
elementKey: "orderDetail.invoiceButton",
|
|
3319
|
+
onClick: () => void run(async () => {
|
|
3320
|
+
const { url } = await account.getInvoicePdfUrl(order.invoiceId);
|
|
3321
|
+
const opened = window.open(url, "_blank", "noopener,noreferrer");
|
|
3322
|
+
if (!opened) window.location.assign(url);
|
|
3323
|
+
}),
|
|
3324
|
+
children: t.orders.downloadInvoice
|
|
3325
|
+
}
|
|
3326
|
+
) : null,
|
|
3327
|
+
props.onTrackShipment && order.status === "partially_fulfilled" ? /* @__PURE__ */ jsx38(
|
|
3328
|
+
Button,
|
|
3329
|
+
{
|
|
3330
|
+
variant: "secondary",
|
|
3331
|
+
elementKey: "orderDetail.trackButton",
|
|
3332
|
+
onClick: () => props.onTrackShipment(target),
|
|
3333
|
+
children: t.orders.track
|
|
3334
|
+
}
|
|
3335
|
+
) : null,
|
|
3336
|
+
props.onReorder && CAN_REORDER.has(order.status) ? /* @__PURE__ */ jsx38(
|
|
3337
|
+
Button,
|
|
3338
|
+
{
|
|
3339
|
+
variant: "secondary",
|
|
3340
|
+
elementKey: "orderDetail.reorderButton",
|
|
3341
|
+
onClick: () => props.onReorder(target),
|
|
3342
|
+
children: t.orders.reorder
|
|
3343
|
+
}
|
|
3344
|
+
) : null,
|
|
3345
|
+
order.subscriptionId && props.onViewSubscription ? /* @__PURE__ */ jsx38(
|
|
3346
|
+
Button,
|
|
3347
|
+
{
|
|
3348
|
+
variant: "secondary",
|
|
3349
|
+
onClick: () => props.onViewSubscription(order.subscriptionId),
|
|
3350
|
+
children: t.orders.viewSubscription
|
|
3351
|
+
}
|
|
3352
|
+
) : null,
|
|
3353
|
+
showReturn ? /* @__PURE__ */ jsx38(
|
|
3354
|
+
Button,
|
|
3355
|
+
{
|
|
3356
|
+
variant: "secondary",
|
|
3357
|
+
disabled: submitting,
|
|
3358
|
+
elementKey: "orderDetail.returnButton",
|
|
3359
|
+
onClick: () => void (async () => {
|
|
3360
|
+
if (!await confirm({
|
|
3361
|
+
title: t.orders.requestReturnConfirm,
|
|
3362
|
+
body: t.orders.requestReturnBody,
|
|
3363
|
+
confirmLabel: t.orders.requestReturnAction
|
|
3364
|
+
})) return;
|
|
3365
|
+
await run(async () => {
|
|
3366
|
+
await account.requestOrderReturn(order.id, {
|
|
3367
|
+
items: order.lineItems.map((li) => ({
|
|
3368
|
+
lineItemId: li.id,
|
|
3369
|
+
quantity: li.quantity
|
|
3370
|
+
}))
|
|
3371
|
+
});
|
|
3372
|
+
await resource.refetch();
|
|
3373
|
+
});
|
|
3374
|
+
})(),
|
|
3375
|
+
children: t.orders.requestReturn
|
|
3376
|
+
}
|
|
3377
|
+
) : null,
|
|
3378
|
+
showCancel ? /* @__PURE__ */ jsx38(
|
|
3379
|
+
Button,
|
|
3380
|
+
{
|
|
3381
|
+
variant: "danger",
|
|
3382
|
+
disabled: submitting,
|
|
3383
|
+
elementKey: "orderDetail.cancelButton",
|
|
3384
|
+
onClick: () => void (async () => {
|
|
3385
|
+
if (!await confirm({
|
|
3386
|
+
title: t.orders.cancelOrderConfirm,
|
|
3387
|
+
body: t.orders.cancelOrderBody,
|
|
3388
|
+
confirmLabel: t.orders.cancelOrderAction,
|
|
3389
|
+
tone: "danger"
|
|
3390
|
+
})) return;
|
|
3391
|
+
await run(async () => {
|
|
3392
|
+
await account.cancelOrder(order.id);
|
|
3393
|
+
await resource.refetch();
|
|
3394
|
+
});
|
|
3395
|
+
})(),
|
|
3396
|
+
children: t.orders.cancelOrder
|
|
3397
|
+
}
|
|
3398
|
+
) : null
|
|
3399
|
+
] })
|
|
3400
|
+
] })
|
|
3401
|
+
] });
|
|
3402
|
+
}
|
|
3217
3403
|
}
|
|
3218
3404
|
)
|
|
3219
3405
|
] }) }) });
|
|
3220
3406
|
}
|
|
3221
3407
|
|
|
3222
3408
|
// src/react/components/account/OrdersPanel.tsx
|
|
3223
|
-
import { jsx as jsx39, jsxs as
|
|
3409
|
+
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3224
3410
|
function OrdersPanel(props) {
|
|
3225
3411
|
const a = useAppearance(props.appearance);
|
|
3226
3412
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3227
3413
|
const { t, locale } = useCopy(props.localization);
|
|
3228
3414
|
const { emailVerified } = useAuth();
|
|
3229
3415
|
const resource = useOrders();
|
|
3230
|
-
const [openId, setOpenId] =
|
|
3416
|
+
const [openId, setOpenId] = useState17(props.initialOpenId ?? null);
|
|
3417
|
+
useEffect8(() => {
|
|
3418
|
+
if (props.initialOpenId) setOpenId(props.initialOpenId);
|
|
3419
|
+
}, [props.initialOpenId]);
|
|
3231
3420
|
const variant = props.variant ?? "table";
|
|
3232
3421
|
const rowsVariant = variant === "rows";
|
|
3233
3422
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -3242,6 +3431,8 @@ function OrdersPanel(props) {
|
|
|
3242
3431
|
onReorder: props.onReorder,
|
|
3243
3432
|
onTrackShipment: props.onTrackShipment,
|
|
3244
3433
|
onViewSubscription: props.onViewSubscription,
|
|
3434
|
+
allowCancel: props.allowCancel,
|
|
3435
|
+
allowReturn: props.allowReturn,
|
|
3245
3436
|
appearance: props.appearance,
|
|
3246
3437
|
localization: props.localization
|
|
3247
3438
|
}
|
|
@@ -3279,9 +3470,9 @@ function OrdersPanel(props) {
|
|
|
3279
3470
|
}
|
|
3280
3471
|
]
|
|
3281
3472
|
}
|
|
3282
|
-
) : /* @__PURE__ */ jsx39("div", { ...a.el("ordersPanel.list", listBase), children: rows.map((o) => /* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
/* @__PURE__ */
|
|
3473
|
+
) : /* @__PURE__ */ jsx39("div", { ...a.el("ordersPanel.list", listBase), children: rows.map((o) => /* @__PURE__ */ jsxs29("div", { ...a.el("ordersPanel.item", itemBase), children: [
|
|
3474
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
3475
|
+
/* @__PURE__ */ jsxs29("div", { className: "throttle-row", children: [
|
|
3285
3476
|
/* @__PURE__ */ jsx39("strong", { children: o.orderNumber }),
|
|
3286
3477
|
/* @__PURE__ */ jsx39(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
|
|
3287
3478
|
] }),
|
|
@@ -3303,12 +3494,13 @@ function OrdersPanel(props) {
|
|
|
3303
3494
|
}
|
|
3304
3495
|
|
|
3305
3496
|
// src/react/components/account/InvoicesPanel.tsx
|
|
3306
|
-
import { useState as
|
|
3497
|
+
import { useEffect as useEffect9, useState as useState18 } from "react";
|
|
3307
3498
|
|
|
3308
3499
|
// src/react/components/account/InvoiceDetail.tsx
|
|
3309
|
-
import {
|
|
3500
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3501
|
+
var PAYABLE = /* @__PURE__ */ new Set(["open"]);
|
|
3310
3502
|
function Line2(props) {
|
|
3311
|
-
return /* @__PURE__ */
|
|
3503
|
+
return /* @__PURE__ */ jsxs30("div", { className: "throttle-row", children: [
|
|
3312
3504
|
/* @__PURE__ */ jsx40("span", { className: "throttle-muted", children: props.label }),
|
|
3313
3505
|
/* @__PURE__ */ jsx40("span", { children: props.value })
|
|
3314
3506
|
] });
|
|
@@ -3320,68 +3512,128 @@ function InvoiceDetail(props) {
|
|
|
3320
3512
|
const { account } = useAuth();
|
|
3321
3513
|
const resource = useInvoice(props.invoiceId);
|
|
3322
3514
|
const { submitting, error, run } = useAction();
|
|
3323
|
-
return /* @__PURE__ */ jsx40(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx40("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
3515
|
+
return /* @__PURE__ */ jsx40(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx40("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.root", "throttle-panel"), children: [
|
|
3324
3516
|
props.onBack ? (
|
|
3325
|
-
// Wrapped on purpose
|
|
3326
|
-
// direct child
|
|
3327
|
-
// the link variant is — the control rendered 748px wide with a
|
|
3328
|
-
// centred label. The wrapper takes the stretch; the button keeps
|
|
3329
|
-
// its own width. A CSS fix would need a compound selector, and
|
|
3330
|
-
// those outrank the merchant overrides in `appearance.elements`.
|
|
3517
|
+
// Wrapped on purpose — see OrderDetail's back button for why a
|
|
3518
|
+
// direct flex child stretched to 748px.
|
|
3331
3519
|
/* @__PURE__ */ jsx40("div", { children: /* @__PURE__ */ jsx40(Button, { variant: "link", elementKey: "invoiceDetail.backButton", onClick: props.onBack, children: t.common.back }) })
|
|
3332
3520
|
) : null,
|
|
3333
|
-
/* @__PURE__ */ jsx40(
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
children:
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3521
|
+
error ? /* @__PURE__ */ jsx40(Alert, { tone: "error", children: error }) : null,
|
|
3522
|
+
/* @__PURE__ */ jsx40(PanelState, { resource, isEmpty: (i) => i === null, emptyTitle: t.invoices.empty, skeletonRows: 4, children: (invoice) => {
|
|
3523
|
+
const money = (v) => formatMoney(v, invoice.currency, locale);
|
|
3524
|
+
const lines = invoice.lineItems ?? [];
|
|
3525
|
+
return /* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.layout", "throttle-detail"), children: [
|
|
3526
|
+
/* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.main", "throttle-detail__main"), children: [
|
|
3527
|
+
/* @__PURE__ */ jsxs30("div", { className: "throttle-detail__section", children: [
|
|
3528
|
+
/* @__PURE__ */ jsxs30("div", { className: "throttle-row", children: [
|
|
3529
|
+
/* @__PURE__ */ jsx40("h3", { children: invoice.number }),
|
|
3530
|
+
/* @__PURE__ */ jsx40(StatusBadge, { status: invoice.status, labels: t.invoices.statusLabels })
|
|
3531
|
+
] }),
|
|
3532
|
+
/* @__PURE__ */ jsxs30("p", { className: "throttle-muted", children: [
|
|
3533
|
+
t.invoices.issued,
|
|
3534
|
+
" ",
|
|
3535
|
+
formatDate(invoice.issuedAt, locale)
|
|
3536
|
+
] })
|
|
3537
|
+
] }),
|
|
3538
|
+
lines.length > 0 ? /* @__PURE__ */ jsxs30("div", { className: "throttle-detail__section", children: [
|
|
3539
|
+
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__label", children: t.invoices.items }),
|
|
3540
|
+
/* @__PURE__ */ jsx40("div", { ...a.el("invoiceDetail.lineItems", "throttle-stack"), children: lines.map((item, i) => /* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.lineItem", "throttle-lineitem"), children: [
|
|
3541
|
+
/* @__PURE__ */ jsxs30("div", { style: { flex: 1 }, children: [
|
|
3542
|
+
/* @__PURE__ */ jsx40("strong", { children: item.name }),
|
|
3543
|
+
item.description ? /* @__PURE__ */ jsx40("p", { className: "throttle-lineitem__desc", children: item.description }) : null,
|
|
3544
|
+
/* @__PURE__ */ jsxs30("p", { className: "throttle-lineitem__meta", children: [
|
|
3545
|
+
t.orders.quantity,
|
|
3546
|
+
" ",
|
|
3547
|
+
item.quantity,
|
|
3548
|
+
" \xD7 ",
|
|
3549
|
+
money(item.unitPrice)
|
|
3550
|
+
] })
|
|
3551
|
+
] }),
|
|
3552
|
+
/* @__PURE__ */ jsx40("span", { children: money(item.total) })
|
|
3553
|
+
] }, i)) })
|
|
3554
|
+
] }) : null
|
|
3555
|
+
] }),
|
|
3556
|
+
/* @__PURE__ */ jsxs30("aside", { ...a.el("invoiceDetail.rail", "throttle-detail__rail"), children: [
|
|
3557
|
+
/* @__PURE__ */ jsxs30("div", { className: "throttle-detail__section", children: [
|
|
3558
|
+
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__label", children: t.invoices.total }),
|
|
3559
|
+
/* @__PURE__ */ jsx40("span", { className: "throttle-detail__headline", children: money(invoice.total) })
|
|
3560
|
+
] }),
|
|
3561
|
+
/* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.totals", "throttle-totals"), children: [
|
|
3562
|
+
invoice.dueAt ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.due, value: formatDate(invoice.dueAt, locale) }) : null,
|
|
3563
|
+
invoice.periodStart && invoice.periodEnd ? /* @__PURE__ */ jsx40(
|
|
3564
|
+
Line2,
|
|
3565
|
+
{
|
|
3566
|
+
label: t.invoices.period,
|
|
3567
|
+
value: `${formatDate(invoice.periodStart, locale)} \u2013 ${formatDate(invoice.periodEnd, locale)}`
|
|
3568
|
+
}
|
|
3569
|
+
) : null,
|
|
3570
|
+
invoice.amountRefunded ? /* @__PURE__ */ jsx40(Line2, { label: t.invoices.refunded, value: money(invoice.amountRefunded) }) : null
|
|
3571
|
+
] }),
|
|
3572
|
+
/* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.actions", "throttle-detail__actions"), children: [
|
|
3573
|
+
props.onPay && PAYABLE.has(invoice.status) ? /* @__PURE__ */ jsx40(
|
|
3574
|
+
Button,
|
|
3575
|
+
{
|
|
3576
|
+
elementKey: "invoiceDetail.payButton",
|
|
3577
|
+
onClick: () => props.onPay({
|
|
3578
|
+
id: invoice.id,
|
|
3579
|
+
number: invoice.number,
|
|
3580
|
+
total: invoice.total,
|
|
3581
|
+
currency: invoice.currency
|
|
3582
|
+
}),
|
|
3583
|
+
children: t.invoices.payButton
|
|
3584
|
+
}
|
|
3585
|
+
) : null,
|
|
3586
|
+
/* @__PURE__ */ jsx40(
|
|
3587
|
+
Button,
|
|
3588
|
+
{
|
|
3589
|
+
variant: "secondary",
|
|
3590
|
+
loading: submitting,
|
|
3591
|
+
elementKey: "invoiceDetail.downloadButton",
|
|
3592
|
+
onClick: () => void run(async () => {
|
|
3593
|
+
const { url } = await account.getInvoicePdfUrl(invoice.id);
|
|
3594
|
+
const opened = window.open(url, "_blank", "noopener,noreferrer");
|
|
3595
|
+
if (!opened) window.location.assign(url);
|
|
3596
|
+
}),
|
|
3597
|
+
children: t.invoices.downloadButton
|
|
3598
|
+
}
|
|
3599
|
+
),
|
|
3600
|
+
invoice.orderId && props.onViewOrder ? /* @__PURE__ */ jsx40(
|
|
3601
|
+
Button,
|
|
3602
|
+
{
|
|
3603
|
+
variant: "secondary",
|
|
3604
|
+
elementKey: "invoiceDetail.orderLink",
|
|
3605
|
+
onClick: () => props.onViewOrder(invoice.orderId),
|
|
3606
|
+
children: invoice.orderNumber ? `${t.invoices.viewOrder} ${invoice.orderNumber}` : t.invoices.viewOrder
|
|
3607
|
+
}
|
|
3608
|
+
) : null,
|
|
3609
|
+
invoice.subscriptionId && props.onViewSubscription ? /* @__PURE__ */ jsx40(
|
|
3610
|
+
Button,
|
|
3611
|
+
{
|
|
3612
|
+
variant: "secondary",
|
|
3613
|
+
elementKey: "invoiceDetail.subscriptionLink",
|
|
3614
|
+
onClick: () => props.onViewSubscription(invoice.subscriptionId),
|
|
3615
|
+
children: t.invoices.viewSubscription
|
|
3616
|
+
}
|
|
3617
|
+
) : null
|
|
3618
|
+
] })
|
|
3619
|
+
] })
|
|
3620
|
+
] });
|
|
3621
|
+
} })
|
|
3373
3622
|
] }) }) });
|
|
3374
3623
|
}
|
|
3375
3624
|
|
|
3376
3625
|
// src/react/components/account/InvoicesPanel.tsx
|
|
3377
|
-
import { jsx as jsx41, jsxs as
|
|
3626
|
+
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3378
3627
|
function InvoicesPanel(props) {
|
|
3379
3628
|
const a = useAppearance(props.appearance);
|
|
3380
3629
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3381
3630
|
const { t, locale } = useCopy(props.localization);
|
|
3382
3631
|
const { emailVerified } = useAuth();
|
|
3383
3632
|
const resource = useInvoices();
|
|
3384
|
-
const [openId, setOpenId] =
|
|
3633
|
+
const [openId, setOpenId] = useState18(props.initialOpenId ?? null);
|
|
3634
|
+
useEffect9(() => {
|
|
3635
|
+
if (props.initialOpenId) setOpenId(props.initialOpenId);
|
|
3636
|
+
}, [props.initialOpenId]);
|
|
3385
3637
|
const variant = props.variant ?? "table";
|
|
3386
3638
|
const rowsVariant = variant === "rows";
|
|
3387
3639
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -3392,6 +3644,9 @@ function InvoicesPanel(props) {
|
|
|
3392
3644
|
{
|
|
3393
3645
|
invoiceId: openId,
|
|
3394
3646
|
onBack: () => setOpenId(null),
|
|
3647
|
+
onViewOrder: props.onViewOrder,
|
|
3648
|
+
onViewSubscription: props.onViewSubscription,
|
|
3649
|
+
onPay: props.onPay,
|
|
3395
3650
|
appearance: props.appearance,
|
|
3396
3651
|
localization: props.localization
|
|
3397
3652
|
}
|
|
@@ -3425,9 +3680,9 @@ function InvoicesPanel(props) {
|
|
|
3425
3680
|
}
|
|
3426
3681
|
]
|
|
3427
3682
|
}
|
|
3428
|
-
) : /* @__PURE__ */ jsx41("div", { ...a.el("invoicesPanel.list", listBase), children: rows.map((i) => /* @__PURE__ */
|
|
3429
|
-
/* @__PURE__ */
|
|
3430
|
-
/* @__PURE__ */
|
|
3683
|
+
) : /* @__PURE__ */ jsx41("div", { ...a.el("invoicesPanel.list", listBase), children: rows.map((i) => /* @__PURE__ */ jsxs31("div", { ...a.el("invoicesPanel.item", itemBase), children: [
|
|
3684
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
3685
|
+
/* @__PURE__ */ jsxs31("div", { className: "throttle-row", children: [
|
|
3431
3686
|
/* @__PURE__ */ jsx41("strong", { children: i.number }),
|
|
3432
3687
|
/* @__PURE__ */ jsx41(StatusBadge, { status: i.status, labels: t.invoices.statusLabels })
|
|
3433
3688
|
] }),
|
|
@@ -3449,10 +3704,10 @@ function InvoicesPanel(props) {
|
|
|
3449
3704
|
}
|
|
3450
3705
|
|
|
3451
3706
|
// src/react/components/account/SubscriptionsPanel.tsx
|
|
3452
|
-
import { jsx as jsx42, jsxs as
|
|
3707
|
+
import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3453
3708
|
var CAN_PAUSE = /* @__PURE__ */ new Set(["active", "trialing"]);
|
|
3454
3709
|
var CAN_RESUME = /* @__PURE__ */ new Set(["paused"]);
|
|
3455
|
-
var
|
|
3710
|
+
var CAN_CANCEL2 = /* @__PURE__ */ new Set(["active", "trialing", "paused", "past_due", "unpaid"]);
|
|
3456
3711
|
function SubscriptionsPanel(props) {
|
|
3457
3712
|
const a = useAppearance(props.appearance);
|
|
3458
3713
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -3465,7 +3720,7 @@ function SubscriptionsPanel(props) {
|
|
|
3465
3720
|
const rowsVariant = variant === "rows";
|
|
3466
3721
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
3467
3722
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3468
|
-
const actionVariant = (base) =>
|
|
3723
|
+
const actionVariant = (base) => base;
|
|
3469
3724
|
const confirmThen = (fn, ask) => () => {
|
|
3470
3725
|
void (async () => {
|
|
3471
3726
|
if (!await confirm({ ...ask, tone: ask.tone ?? "neutral" })) return;
|
|
@@ -3474,7 +3729,7 @@ function SubscriptionsPanel(props) {
|
|
|
3474
3729
|
};
|
|
3475
3730
|
const priceLabel = (sub) => `${formatMoney(sub.amount, sub.currency, locale)} / ${sub.interval}${sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""}`;
|
|
3476
3731
|
const renewsLabel = (sub) => formatDate(sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd, locale);
|
|
3477
|
-
const lifecycleActions = (sub, variantFor) => /* @__PURE__ */
|
|
3732
|
+
const lifecycleActions = (sub, variantFor) => /* @__PURE__ */ jsxs32("div", { className: "throttle-actions", children: [
|
|
3478
3733
|
CAN_PAUSE.has(sub.status) ? /* @__PURE__ */ jsx42(
|
|
3479
3734
|
Button,
|
|
3480
3735
|
{
|
|
@@ -3501,7 +3756,7 @@ function SubscriptionsPanel(props) {
|
|
|
3501
3756
|
children: t.subscriptions.resumeButton
|
|
3502
3757
|
}
|
|
3503
3758
|
) : null,
|
|
3504
|
-
|
|
3759
|
+
CAN_CANCEL2.has(sub.status) && !sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx42(
|
|
3505
3760
|
Button,
|
|
3506
3761
|
{
|
|
3507
3762
|
variant: variantFor("secondary"),
|
|
@@ -3515,7 +3770,7 @@ function SubscriptionsPanel(props) {
|
|
|
3515
3770
|
children: t.subscriptions.cancelAtPeriodEnd
|
|
3516
3771
|
}
|
|
3517
3772
|
) : null,
|
|
3518
|
-
|
|
3773
|
+
CAN_CANCEL2.has(sub.status) ? /* @__PURE__ */ jsx42(
|
|
3519
3774
|
Button,
|
|
3520
3775
|
{
|
|
3521
3776
|
variant: variantFor("danger"),
|
|
@@ -3530,7 +3785,7 @@ function SubscriptionsPanel(props) {
|
|
|
3530
3785
|
}
|
|
3531
3786
|
) : null
|
|
3532
3787
|
] });
|
|
3533
|
-
return /* @__PURE__ */ jsx42(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx42("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
3788
|
+
return /* @__PURE__ */ jsx42(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx42("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs32("div", { ...a.el("subscriptionsPanel.root", "throttle-panel"), children: [
|
|
3534
3789
|
error ? /* @__PURE__ */ jsx42(Alert, { tone: "error", children: error }) : null,
|
|
3535
3790
|
/* @__PURE__ */ jsx42(
|
|
3536
3791
|
PanelState,
|
|
@@ -3552,35 +3807,35 @@ function SubscriptionsPanel(props) {
|
|
|
3552
3807
|
{ key: "plan", label: t.subscriptions.columnPlan, render: (sub) => sub.planName ?? sub.planReference },
|
|
3553
3808
|
{ key: "price", label: t.subscriptions.columnPrice, render: (sub) => /* @__PURE__ */ jsx42("span", { className: "throttle-table__money", children: priceLabel(sub) }) },
|
|
3554
3809
|
{ key: "renews", label: t.subscriptions.columnRenews, render: (sub) => renewsLabel(sub) },
|
|
3555
|
-
{ key: "status", label: t.subscriptions.columnStatus, render: (sub) => /* @__PURE__ */
|
|
3810
|
+
{ key: "status", label: t.subscriptions.columnStatus, render: (sub) => /* @__PURE__ */ jsxs32("div", { className: "throttle-row", children: [
|
|
3556
3811
|
/* @__PURE__ */ jsx42(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels }),
|
|
3557
3812
|
sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx42(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
|
|
3558
3813
|
] }) },
|
|
3559
3814
|
{ key: "actions", label: t.common.actions, render: (sub) => lifecycleActions(sub, (base) => base) }
|
|
3560
3815
|
]
|
|
3561
3816
|
}
|
|
3562
|
-
) : /* @__PURE__ */ jsx42("div", { ...a.el("subscriptionsPanel.list", listBase), children: rows.map((sub) => /* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3817
|
+
) : /* @__PURE__ */ jsx42("div", { ...a.el("subscriptionsPanel.list", listBase), children: rows.map((sub) => /* @__PURE__ */ jsxs32("div", { ...a.el("subscriptionsPanel.item", itemBase), children: [
|
|
3818
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
3819
|
+
/* @__PURE__ */ jsxs32("div", { className: "throttle-row", children: [
|
|
3565
3820
|
/* @__PURE__ */ jsx42("strong", { children: sub.planName ?? sub.planReference }),
|
|
3566
3821
|
/* @__PURE__ */ jsx42(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels })
|
|
3567
3822
|
] }),
|
|
3568
|
-
/* @__PURE__ */
|
|
3823
|
+
/* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
|
|
3569
3824
|
formatMoney(sub.amount, sub.currency, locale),
|
|
3570
3825
|
" / ",
|
|
3571
3826
|
sub.interval,
|
|
3572
3827
|
sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""
|
|
3573
3828
|
] }),
|
|
3574
|
-
sub.status === "cancelled" ? /* @__PURE__ */
|
|
3829
|
+
sub.status === "cancelled" ? /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
|
|
3575
3830
|
t.subscriptions.cancelledOn,
|
|
3576
3831
|
" ",
|
|
3577
3832
|
formatDate(sub.cancelledAt ?? sub.currentPeriodEnd, locale)
|
|
3578
|
-
] }) : /* @__PURE__ */
|
|
3833
|
+
] }) : /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
|
|
3579
3834
|
sub.cancelAtPeriodEnd ? t.subscriptions.endsOn : t.subscriptions.renewsOn,
|
|
3580
3835
|
" ",
|
|
3581
3836
|
formatDate(sub.currentPeriodEnd, locale)
|
|
3582
3837
|
] }),
|
|
3583
|
-
sub.trialEnd ? /* @__PURE__ */
|
|
3838
|
+
sub.trialEnd ? /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
|
|
3584
3839
|
t.subscriptions.trialEnds,
|
|
3585
3840
|
" ",
|
|
3586
3841
|
formatDate(sub.trialEnd, locale)
|
|
@@ -3595,7 +3850,7 @@ function SubscriptionsPanel(props) {
|
|
|
3595
3850
|
}
|
|
3596
3851
|
|
|
3597
3852
|
// src/react/components/account/SecurityPanel.tsx
|
|
3598
|
-
import { useCallback as useCallback3, useEffect as
|
|
3853
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef8, useState as useState19 } from "react";
|
|
3599
3854
|
|
|
3600
3855
|
// src/react/components/account/device.ts
|
|
3601
3856
|
var BROWSERS = [
|
|
@@ -3628,7 +3883,7 @@ function describeDevice(userAgent) {
|
|
|
3628
3883
|
}
|
|
3629
3884
|
|
|
3630
3885
|
// src/react/components/account/SecurityPanel.tsx
|
|
3631
|
-
import { Fragment as
|
|
3886
|
+
import { Fragment as Fragment8, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3632
3887
|
function SecurityPanel(props) {
|
|
3633
3888
|
const a = useAppearance(props.appearance);
|
|
3634
3889
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -3638,13 +3893,13 @@ function SecurityPanel(props) {
|
|
|
3638
3893
|
const rowsVariant = variant === "rows";
|
|
3639
3894
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3640
3895
|
const revokeVariant = rowsVariant ? "linkDanger" : "danger";
|
|
3641
|
-
const [password, setPassword] =
|
|
3896
|
+
const [password, setPassword] = useState19("");
|
|
3642
3897
|
const passwordAction = useAction();
|
|
3643
3898
|
const sessionAction = useAction();
|
|
3644
|
-
const [sessions, setSessions] =
|
|
3645
|
-
const [listError, setListError] =
|
|
3899
|
+
const [sessions, setSessions] = useState19(null);
|
|
3900
|
+
const [listError, setListError] = useState19(null);
|
|
3646
3901
|
const errorMessageRef = useRef8(errorMessage);
|
|
3647
|
-
|
|
3902
|
+
useEffect10(() => {
|
|
3648
3903
|
errorMessageRef.current = errorMessage;
|
|
3649
3904
|
});
|
|
3650
3905
|
const load = useCallback3(async () => {
|
|
@@ -3655,12 +3910,12 @@ function SecurityPanel(props) {
|
|
|
3655
3910
|
setListError(errorMessageRef.current(err));
|
|
3656
3911
|
}
|
|
3657
3912
|
}, [auth]);
|
|
3658
|
-
|
|
3913
|
+
useEffect10(() => {
|
|
3659
3914
|
void load();
|
|
3660
3915
|
}, [load]);
|
|
3661
3916
|
const others = (sessions ?? []).filter((s) => !s.current);
|
|
3662
|
-
return /* @__PURE__ */ jsx43(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx43("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3917
|
+
return /* @__PURE__ */ jsx43(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx43("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.root", "throttle-panel"), children: [
|
|
3918
|
+
/* @__PURE__ */ jsxs33(
|
|
3664
3919
|
"form",
|
|
3665
3920
|
{
|
|
3666
3921
|
...a.el("securityPanel.passwordForm", "throttle-stack"),
|
|
@@ -3691,9 +3946,9 @@ function SecurityPanel(props) {
|
|
|
3691
3946
|
]
|
|
3692
3947
|
}
|
|
3693
3948
|
),
|
|
3694
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.sessionList", "throttle-stack"), children: [
|
|
3695
3950
|
/* @__PURE__ */ jsx43("h3", { children: t.security.sessionsTitle }),
|
|
3696
|
-
listError ? /* @__PURE__ */
|
|
3951
|
+
listError ? /* @__PURE__ */ jsxs33(Fragment8, { children: [
|
|
3697
3952
|
/* @__PURE__ */ jsx43(Alert, { tone: "error", children: listError }),
|
|
3698
3953
|
/* @__PURE__ */ jsx43(Button, { variant: "secondary", onClick: () => void load(), children: t.common.retry })
|
|
3699
3954
|
] }) : null,
|
|
@@ -3707,7 +3962,7 @@ function SecurityPanel(props) {
|
|
|
3707
3962
|
rowKey: (session) => session.id,
|
|
3708
3963
|
rows: sessions,
|
|
3709
3964
|
columns: [
|
|
3710
|
-
{ key: "device", label: t.security.columnDevice, render: (session) => /* @__PURE__ */
|
|
3965
|
+
{ key: "device", label: t.security.columnDevice, render: (session) => /* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
|
|
3711
3966
|
/* @__PURE__ */ jsx43("span", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
|
|
3712
3967
|
session.current ? /* @__PURE__ */ jsx43(Badge, { tone: "success", children: t.security.thisDevice }) : null
|
|
3713
3968
|
] }) },
|
|
@@ -3727,13 +3982,13 @@ function SecurityPanel(props) {
|
|
|
3727
3982
|
) : null }
|
|
3728
3983
|
]
|
|
3729
3984
|
}
|
|
3730
|
-
) : (sessions ?? []).map((session) => /* @__PURE__ */
|
|
3731
|
-
/* @__PURE__ */
|
|
3732
|
-
/* @__PURE__ */
|
|
3985
|
+
) : (sessions ?? []).map((session) => /* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.sessionItem", itemBase), children: [
|
|
3986
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
3987
|
+
/* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
|
|
3733
3988
|
/* @__PURE__ */ jsx43("strong", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
|
|
3734
3989
|
session.current ? /* @__PURE__ */ jsx43(Badge, { tone: "success", children: t.security.thisDevice }) : null
|
|
3735
3990
|
] }),
|
|
3736
|
-
/* @__PURE__ */
|
|
3991
|
+
/* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
|
|
3737
3992
|
t.security.lastActive,
|
|
3738
3993
|
" ",
|
|
3739
3994
|
formatDate(session.lastUsedAt, locale)
|
|
@@ -3774,7 +4029,7 @@ function SecurityPanel(props) {
|
|
|
3774
4029
|
}
|
|
3775
4030
|
|
|
3776
4031
|
// src/react/components/account/AccountDashboard.tsx
|
|
3777
|
-
import { Fragment as
|
|
4032
|
+
import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3778
4033
|
var ACCOUNT_TABS = [
|
|
3779
4034
|
"profile",
|
|
3780
4035
|
"addresses",
|
|
@@ -3803,9 +4058,10 @@ function AccountDashboard(props) {
|
|
|
3803
4058
|
const { status } = useAuth();
|
|
3804
4059
|
const shown = props.tabs ?? [...ACCOUNT_TABS];
|
|
3805
4060
|
const controlled = props.tab !== void 0;
|
|
3806
|
-
const [internal, setInternal] =
|
|
3807
|
-
const
|
|
3808
|
-
|
|
4061
|
+
const [internal, setInternal] = useState20(shown[0] ?? "profile");
|
|
4062
|
+
const [openOrderId, setOpenOrderId] = useState20(null);
|
|
4063
|
+
const idBase = useId5();
|
|
4064
|
+
useEffect11(() => {
|
|
3809
4065
|
if (props.routing !== "hash" || typeof window === "undefined") return;
|
|
3810
4066
|
const apply = () => {
|
|
3811
4067
|
const next = TAB_FOR_HASH[window.location.hash] ?? shown[0];
|
|
@@ -3842,7 +4098,7 @@ function AccountDashboard(props) {
|
|
|
3842
4098
|
}))
|
|
3843
4099
|
}
|
|
3844
4100
|
);
|
|
3845
|
-
const panel = /* @__PURE__ */
|
|
4101
|
+
const panel = /* @__PURE__ */ jsxs34(
|
|
3846
4102
|
"div",
|
|
3847
4103
|
{
|
|
3848
4104
|
...a.el("accountDashboard.panel", sidebar ? "throttle-account__content" : "throttle-tabs__panel"),
|
|
@@ -3859,24 +4115,36 @@ function AccountDashboard(props) {
|
|
|
3859
4115
|
{
|
|
3860
4116
|
...shared,
|
|
3861
4117
|
variant: props.panelVariant,
|
|
4118
|
+
initialOpenId: openOrderId,
|
|
3862
4119
|
onViewSubscription: () => go("subscriptions"),
|
|
3863
4120
|
onPayNow: props.onPayNow,
|
|
3864
4121
|
onReorder: props.onReorder,
|
|
3865
4122
|
onTrackShipment: props.onTrackShipment
|
|
3866
4123
|
}
|
|
3867
4124
|
) : null,
|
|
3868
|
-
active === "invoices" ? /* @__PURE__ */ jsx44(
|
|
4125
|
+
active === "invoices" ? /* @__PURE__ */ jsx44(
|
|
4126
|
+
InvoicesPanel,
|
|
4127
|
+
{
|
|
4128
|
+
...shared,
|
|
4129
|
+
variant: props.panelVariant,
|
|
4130
|
+
onViewOrder: (orderId) => {
|
|
4131
|
+
setOpenOrderId(orderId);
|
|
4132
|
+
go("orders");
|
|
4133
|
+
},
|
|
4134
|
+
onViewSubscription: () => go("subscriptions")
|
|
4135
|
+
}
|
|
4136
|
+
) : null,
|
|
3869
4137
|
active === "subscriptions" ? /* @__PURE__ */ jsx44(SubscriptionsPanel, { ...shared, variant: props.panelVariant }) : null,
|
|
3870
4138
|
active === "security" ? /* @__PURE__ */ jsx44(SecurityPanel, { ...shared, variant: props.panelVariant }) : null
|
|
3871
4139
|
]
|
|
3872
4140
|
}
|
|
3873
4141
|
);
|
|
3874
|
-
return /* @__PURE__ */ jsx44(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx44("div", { ...a.rootProps, children: /* @__PURE__ */
|
|
4142
|
+
return /* @__PURE__ */ jsx44(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx44("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs34("div", { ...a.el("accountDashboard.root", "throttle-panel throttle-account-root"), children: [
|
|
3875
4143
|
/* @__PURE__ */ jsx44(VerifyEmailBanner, { ...shared }),
|
|
3876
|
-
sidebar ? /* @__PURE__ */
|
|
4144
|
+
sidebar ? /* @__PURE__ */ jsxs34("div", { className: "throttle-account", children: [
|
|
3877
4145
|
/* @__PURE__ */ jsx44("div", { ...a.el("accountDashboard.sidebar"), children: nav }),
|
|
3878
4146
|
panel
|
|
3879
|
-
] }) : /* @__PURE__ */
|
|
4147
|
+
] }) : /* @__PURE__ */ jsxs34(Fragment9, { children: [
|
|
3880
4148
|
/* @__PURE__ */ jsx44("div", { ...a.el("accountDashboard.tabs"), children: nav }),
|
|
3881
4149
|
panel
|
|
3882
4150
|
] })
|
|
@@ -3884,13 +4152,13 @@ function AccountDashboard(props) {
|
|
|
3884
4152
|
}
|
|
3885
4153
|
|
|
3886
4154
|
// src/react/components/account/AccountModal.tsx
|
|
3887
|
-
import { jsx as jsx45, jsxs as
|
|
4155
|
+
import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3888
4156
|
function AccountModal(props) {
|
|
3889
4157
|
const a = useAppearance(props.appearance);
|
|
3890
4158
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3891
4159
|
const { t } = useCopy(props.localization);
|
|
3892
|
-
const titleId =
|
|
3893
|
-
return /* @__PURE__ */ jsx45(AppearanceProvider, { value: scoped, children: /* @__PURE__ */
|
|
4160
|
+
const titleId = useId6();
|
|
4161
|
+
return /* @__PURE__ */ jsx45(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs35(
|
|
3894
4162
|
Modal,
|
|
3895
4163
|
{
|
|
3896
4164
|
open: props.open,
|
|
@@ -3908,7 +4176,7 @@ function AccountModal(props) {
|
|
|
3908
4176
|
}
|
|
3909
4177
|
|
|
3910
4178
|
// src/react/components/provider.tsx
|
|
3911
|
-
import { jsx as jsx46, jsxs as
|
|
4179
|
+
import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3912
4180
|
var warned = /* @__PURE__ */ new Set();
|
|
3913
4181
|
function warnOnce(key, message) {
|
|
3914
4182
|
if (process.env.NODE_ENV === "production") return;
|
|
@@ -3953,13 +4221,13 @@ function ThrottleProvider(props) {
|
|
|
3953
4221
|
__captureStepUp
|
|
3954
4222
|
} = props;
|
|
3955
4223
|
useInjectStyles(injectStyles);
|
|
3956
|
-
const [stepUpOpen, setStepUpOpen] =
|
|
4224
|
+
const [stepUpOpen, setStepUpOpen] = useState21(false);
|
|
3957
4225
|
const resolveStepUp = useRef9(null);
|
|
3958
4226
|
const claimRef = useRef9(claimCartOnSignIn);
|
|
3959
4227
|
claimRef.current = claimCartOnSignIn;
|
|
3960
|
-
const [overlay, setOverlay] =
|
|
4228
|
+
const [overlay, setOverlay] = useState21(null);
|
|
3961
4229
|
const overlayRestoreFocus = useRef9(null);
|
|
3962
|
-
const [accountTabs, setAccountTabs] =
|
|
4230
|
+
const [accountTabs, setAccountTabs] = useState21(void 0);
|
|
3963
4231
|
const onOverlaySuccess = useRef9(null);
|
|
3964
4232
|
const openSignIn = useCallback4((onSuccess) => {
|
|
3965
4233
|
onOverlaySuccess.current = onSuccess ?? null;
|
|
@@ -4030,9 +4298,8 @@ function ThrottleProvider(props) {
|
|
|
4030
4298
|
resolve?.(password);
|
|
4031
4299
|
};
|
|
4032
4300
|
const authOverlayOpen = overlay === "signIn" || overlay === "signUp";
|
|
4033
|
-
return /* @__PURE__ */ jsx46(AppearanceProvider, { value: appearance ?? {}, children: /* @__PURE__ */ jsx46(LocalizationProvider, { value: localization ?? {}, children: /* @__PURE__ */ jsx46(BrandLogoProvider, { value: logo ?? null, children: /* @__PURE__ */ jsx46(ThrottleAuthProvider, { auth, publishableKey, children: /* @__PURE__ */ jsx46(ConfirmProvider, { children: /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ jsx46(AppearanceProvider, { value: appearance ?? {}, children: /* @__PURE__ */ jsx46(LocalizationProvider, { value: localization ?? {}, children: /* @__PURE__ */ jsx46(BrandLogoProvider, { value: logo ?? null, children: /* @__PURE__ */ jsx46(ThrottleAuthProvider, { auth, publishableKey, children: /* @__PURE__ */ jsx46(ConfirmProvider, { stepUpOpen, onStepUpResolve: finishStepUp, children: /* @__PURE__ */ jsxs36(ThrottleUIContext.Provider, { value: ui, children: [
|
|
4034
4302
|
children,
|
|
4035
|
-
/* @__PURE__ */ jsx46(StepUpDialog, { open: stepUpOpen, onResolve: finishStepUp }),
|
|
4036
4303
|
/* @__PURE__ */ jsx46(
|
|
4037
4304
|
AuthModal,
|
|
4038
4305
|
{
|
|
@@ -4048,9 +4315,13 @@ function ThrottleProvider(props) {
|
|
|
4048
4315
|
] }) }) }) }) }) });
|
|
4049
4316
|
}
|
|
4050
4317
|
|
|
4318
|
+
// src/react/components/auth/StepUpDialog.tsx
|
|
4319
|
+
import { useEffect as useEffect12, useId as useId7, useState as useState22 } from "react";
|
|
4320
|
+
import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4321
|
+
|
|
4051
4322
|
// src/react/components/auth/SignInButton.tsx
|
|
4052
4323
|
import { cloneElement, isValidElement, useContext as useContext7, useState as useState23 } from "react";
|
|
4053
|
-
import { jsx as
|
|
4324
|
+
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4054
4325
|
function SignInButton(props) {
|
|
4055
4326
|
const a = useAppearance(props.appearance);
|
|
4056
4327
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -4060,7 +4331,7 @@ function SignInButton(props) {
|
|
|
4060
4331
|
const useShared = ui !== null && props.initialView === void 0;
|
|
4061
4332
|
const label = props.children ?? t.signIn.submitButton;
|
|
4062
4333
|
if (props.mode === "redirect") {
|
|
4063
|
-
return /* @__PURE__ */
|
|
4334
|
+
return /* @__PURE__ */ jsx48(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx48("span", { ...a.rootProps, children: /* @__PURE__ */ jsx48("a", { ...a.el("signInButton.root", "throttle-button throttle-button--primary"), href: props.url ?? "#", children: label }) }) });
|
|
4064
4335
|
}
|
|
4065
4336
|
const openModal = () => {
|
|
4066
4337
|
if (useShared) ui.openSignIn(props.afterSignIn);
|
|
@@ -4070,10 +4341,10 @@ function SignInButton(props) {
|
|
|
4070
4341
|
if (useShared) ui.close();
|
|
4071
4342
|
else setLocalOpen(false);
|
|
4072
4343
|
};
|
|
4073
|
-
const trigger = props.asChild && isValidElement(props.children) ? cloneElement(props.children, { onClick: openModal }) : /* @__PURE__ */
|
|
4344
|
+
const trigger = props.asChild && isValidElement(props.children) ? cloneElement(props.children, { onClick: openModal }) : /* @__PURE__ */ jsx48(Button, { elementKey: "signInButton.root", onClick: openModal, children: label });
|
|
4074
4345
|
return /* @__PURE__ */ jsxs38(AppearanceProvider, { value: scoped, children: [
|
|
4075
|
-
/* @__PURE__ */
|
|
4076
|
-
!useShared ? /* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx48("span", { ...a.rootProps, children: trigger }),
|
|
4347
|
+
!useShared ? /* @__PURE__ */ jsx48(
|
|
4077
4348
|
AuthModal,
|
|
4078
4349
|
{
|
|
4079
4350
|
open: localOpen,
|
|
@@ -4092,7 +4363,7 @@ function SignInButton(props) {
|
|
|
4092
4363
|
|
|
4093
4364
|
// src/react/components/auth/SignUpButton.tsx
|
|
4094
4365
|
import { cloneElement as cloneElement2, isValidElement as isValidElement2, useContext as useContext8, useState as useState24 } from "react";
|
|
4095
|
-
import { jsx as
|
|
4366
|
+
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4096
4367
|
function SignUpButton(props) {
|
|
4097
4368
|
const a = useAppearance(props.appearance);
|
|
4098
4369
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -4102,7 +4373,7 @@ function SignUpButton(props) {
|
|
|
4102
4373
|
const useShared = ui !== null && props.initialView === void 0;
|
|
4103
4374
|
const label = props.children ?? t.signUp.submitButton;
|
|
4104
4375
|
if (props.mode === "redirect") {
|
|
4105
|
-
return /* @__PURE__ */
|
|
4376
|
+
return /* @__PURE__ */ jsx49(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx49("span", { ...a.rootProps, children: /* @__PURE__ */ jsx49("a", { ...a.el("signUpButton.root", "throttle-button throttle-button--primary"), href: props.url ?? "#", children: label }) }) });
|
|
4106
4377
|
}
|
|
4107
4378
|
const openModal = () => {
|
|
4108
4379
|
if (useShared) ui.openSignUp(props.afterSignUp);
|
|
@@ -4112,10 +4383,10 @@ function SignUpButton(props) {
|
|
|
4112
4383
|
if (useShared) ui.close();
|
|
4113
4384
|
else setLocalOpen(false);
|
|
4114
4385
|
};
|
|
4115
|
-
const trigger = props.asChild && isValidElement2(props.children) ? cloneElement2(props.children, { onClick: openModal }) : /* @__PURE__ */
|
|
4386
|
+
const trigger = props.asChild && isValidElement2(props.children) ? cloneElement2(props.children, { onClick: openModal }) : /* @__PURE__ */ jsx49(Button, { elementKey: "signUpButton.root", onClick: openModal, children: label });
|
|
4116
4387
|
return /* @__PURE__ */ jsxs39(AppearanceProvider, { value: scoped, children: [
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
!useShared ? /* @__PURE__ */
|
|
4388
|
+
/* @__PURE__ */ jsx49("span", { ...a.rootProps, children: trigger }),
|
|
4389
|
+
!useShared ? /* @__PURE__ */ jsx49(
|
|
4119
4390
|
AuthModal,
|
|
4120
4391
|
{
|
|
4121
4392
|
open: localOpen,
|
|
@@ -4133,14 +4404,14 @@ function SignUpButton(props) {
|
|
|
4133
4404
|
}
|
|
4134
4405
|
|
|
4135
4406
|
// src/react/components/auth/SignOutButton.tsx
|
|
4136
|
-
import { jsx as
|
|
4407
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
4137
4408
|
function SignOutButton(props) {
|
|
4138
4409
|
const a = useAppearance();
|
|
4139
4410
|
const { auth } = useAuth();
|
|
4140
4411
|
const { t } = useCopy(props.localization);
|
|
4141
4412
|
const { submitting, run } = useAction();
|
|
4142
4413
|
const label = props.children ?? (props.everywhere ? t.userButton.signOutAll : t.userButton.signOut);
|
|
4143
|
-
return /* @__PURE__ */
|
|
4414
|
+
return /* @__PURE__ */ jsx50("span", { ...a.rootProps, children: /* @__PURE__ */ jsx50(
|
|
4144
4415
|
Button,
|
|
4145
4416
|
{
|
|
4146
4417
|
variant: "secondary",
|
|
@@ -4157,13 +4428,13 @@ function SignOutButton(props) {
|
|
|
4157
4428
|
}
|
|
4158
4429
|
|
|
4159
4430
|
// src/react/components/auth/SignInPage.tsx
|
|
4160
|
-
import { jsx as
|
|
4431
|
+
import { jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4161
4432
|
function SignInPage(props) {
|
|
4162
4433
|
const a = useAppearance(props.appearance);
|
|
4163
4434
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
4164
|
-
return /* @__PURE__ */
|
|
4165
|
-
props.logo ? /* @__PURE__ */
|
|
4166
|
-
/* @__PURE__ */
|
|
4435
|
+
return /* @__PURE__ */ jsx51(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx51("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs40("div", { ...a.el("signInPage.root", "throttle-page"), children: [
|
|
4436
|
+
props.logo ? /* @__PURE__ */ jsx51("div", { ...a.el("signInPage.logo", "throttle-page__logo"), children: props.logo }) : null,
|
|
4437
|
+
/* @__PURE__ */ jsx51(
|
|
4167
4438
|
SignIn,
|
|
4168
4439
|
{
|
|
4169
4440
|
onSuccess: props.onSuccess,
|
|
@@ -4173,18 +4444,18 @@ function SignInPage(props) {
|
|
|
4173
4444
|
localization: props.localization
|
|
4174
4445
|
}
|
|
4175
4446
|
),
|
|
4176
|
-
props.footer ? /* @__PURE__ */
|
|
4447
|
+
props.footer ? /* @__PURE__ */ jsx51("div", { ...a.el("signInPage.footer", "throttle-page__footer"), children: props.footer }) : null
|
|
4177
4448
|
] }) }) });
|
|
4178
4449
|
}
|
|
4179
4450
|
|
|
4180
4451
|
// src/react/components/auth/SignUpPage.tsx
|
|
4181
|
-
import { jsx as
|
|
4452
|
+
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4182
4453
|
function SignUpPage(props) {
|
|
4183
4454
|
const a = useAppearance(props.appearance);
|
|
4184
4455
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
4185
|
-
return /* @__PURE__ */
|
|
4186
|
-
props.logo ? /* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4456
|
+
return /* @__PURE__ */ jsx52(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx52("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs41("div", { ...a.el("signUpPage.root", "throttle-page"), children: [
|
|
4457
|
+
props.logo ? /* @__PURE__ */ jsx52("div", { ...a.el("signUpPage.logo", "throttle-page__logo"), children: props.logo }) : null,
|
|
4458
|
+
/* @__PURE__ */ jsx52(
|
|
4188
4459
|
SignUp,
|
|
4189
4460
|
{
|
|
4190
4461
|
onSuccess: props.onSuccess,
|
|
@@ -4193,31 +4464,31 @@ function SignUpPage(props) {
|
|
|
4193
4464
|
localization: props.localization
|
|
4194
4465
|
}
|
|
4195
4466
|
),
|
|
4196
|
-
props.footer ? /* @__PURE__ */
|
|
4467
|
+
props.footer ? /* @__PURE__ */ jsx52("div", { ...a.el("signUpPage.footer", "throttle-page__footer"), children: props.footer }) : null
|
|
4197
4468
|
] }) }) });
|
|
4198
4469
|
}
|
|
4199
4470
|
|
|
4200
4471
|
// src/react/components/guards.tsx
|
|
4201
|
-
import { Fragment as
|
|
4472
|
+
import { Fragment as Fragment10, jsx as jsx53 } from "react/jsx-runtime";
|
|
4202
4473
|
function SignedIn(props) {
|
|
4203
4474
|
const { status } = useAuth();
|
|
4204
|
-
return status === "authenticated" ? /* @__PURE__ */
|
|
4475
|
+
return status === "authenticated" ? /* @__PURE__ */ jsx53(Fragment10, { children: props.children }) : null;
|
|
4205
4476
|
}
|
|
4206
4477
|
function SignedOut(props) {
|
|
4207
4478
|
const { status } = useAuth();
|
|
4208
|
-
return status === "unauthenticated" ? /* @__PURE__ */
|
|
4479
|
+
return status === "unauthenticated" ? /* @__PURE__ */ jsx53(Fragment10, { children: props.children }) : null;
|
|
4209
4480
|
}
|
|
4210
4481
|
function Protect(props) {
|
|
4211
4482
|
const { status, emailVerified } = useAuth();
|
|
4212
4483
|
if (status === "loading") return null;
|
|
4213
|
-
if (status !== "authenticated") return /* @__PURE__ */
|
|
4214
|
-
if (props.requireVerified && !emailVerified) return /* @__PURE__ */
|
|
4215
|
-
return /* @__PURE__ */
|
|
4484
|
+
if (status !== "authenticated") return /* @__PURE__ */ jsx53(Fragment10, { children: props.fallback ?? null });
|
|
4485
|
+
if (props.requireVerified && !emailVerified) return /* @__PURE__ */ jsx53(Fragment10, { children: props.fallback ?? null });
|
|
4486
|
+
return /* @__PURE__ */ jsx53(Fragment10, { children: props.children });
|
|
4216
4487
|
}
|
|
4217
4488
|
|
|
4218
4489
|
// src/react/components/UserButton.tsx
|
|
4219
4490
|
import { useContext as useContext9, useId as useId8, useRef as useRef10, useState as useState25 } from "react";
|
|
4220
|
-
import { jsx as
|
|
4491
|
+
import { jsx as jsx54, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4221
4492
|
function UserButtonRoot(props) {
|
|
4222
4493
|
const a = useAppearance(props.appearance);
|
|
4223
4494
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -4237,25 +4508,25 @@ function UserButtonRoot(props) {
|
|
|
4237
4508
|
};
|
|
4238
4509
|
if (status !== "authenticated" || !customer) return null;
|
|
4239
4510
|
const name = [customer.firstName, customer.lastName].filter(Boolean).join(" ");
|
|
4240
|
-
return /* @__PURE__ */
|
|
4511
|
+
return /* @__PURE__ */ jsx54(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx54("span", { ...a.rootProps, children: /* @__PURE__ */ jsxs42("span", { ref: rootRef, ...a.el("userButton.root"), children: [
|
|
4241
4512
|
/* @__PURE__ */ jsxs42(
|
|
4242
4513
|
Dropdown,
|
|
4243
4514
|
{
|
|
4244
4515
|
label: t.userButton.openMenu,
|
|
4245
4516
|
triggerKey: "userButton.trigger",
|
|
4246
4517
|
menuKey: "userButton.menu",
|
|
4247
|
-
trigger: /* @__PURE__ */
|
|
4518
|
+
trigger: /* @__PURE__ */ jsx54(Avatar, { name, email: customer.email }),
|
|
4248
4519
|
children: [
|
|
4249
|
-
/* @__PURE__ */
|
|
4250
|
-
/* @__PURE__ */
|
|
4251
|
-
/* @__PURE__ */
|
|
4252
|
-
/* @__PURE__ */
|
|
4520
|
+
/* @__PURE__ */ jsx54("div", { ...a.el("userButton.identity", "throttle-dropdown__item"), children: /* @__PURE__ */ jsxs42("span", { children: [
|
|
4521
|
+
/* @__PURE__ */ jsx54("span", { ...a.el("userButton.email"), children: customer.email }),
|
|
4522
|
+
/* @__PURE__ */ jsx54("br", {}),
|
|
4523
|
+
/* @__PURE__ */ jsx54(Badge, { tone: emailVerified ? "success" : "warning", elementKey: "userButton.badge", children: emailVerified ? t.userButton.verified : t.userButton.unverified })
|
|
4253
4524
|
] }) }),
|
|
4254
|
-
/* @__PURE__ */
|
|
4255
|
-
props.mode === "navigate" ? /* @__PURE__ */
|
|
4525
|
+
/* @__PURE__ */ jsx54(DropdownSeparator, {}),
|
|
4526
|
+
props.mode === "navigate" ? /* @__PURE__ */ jsx54(DropdownItem, { itemKey: "userButton.manageButton", href: props.accountUrl ?? "#", children: t.userButton.manage }) : /* @__PURE__ */ jsx54(DropdownItem, { itemKey: "userButton.manageButton", onClick: openAccount, children: t.userButton.manage }),
|
|
4256
4527
|
props.children,
|
|
4257
|
-
/* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsx54(DropdownSeparator, {}),
|
|
4529
|
+
/* @__PURE__ */ jsx54(
|
|
4259
4530
|
DropdownItem,
|
|
4260
4531
|
{
|
|
4261
4532
|
itemKey: "userButton.signOutButton",
|
|
@@ -4263,7 +4534,7 @@ function UserButtonRoot(props) {
|
|
|
4263
4534
|
children: t.userButton.signOut
|
|
4264
4535
|
}
|
|
4265
4536
|
),
|
|
4266
|
-
/* @__PURE__ */
|
|
4537
|
+
/* @__PURE__ */ jsx54(
|
|
4267
4538
|
DropdownItem,
|
|
4268
4539
|
{
|
|
4269
4540
|
itemKey: "userButton.signOutAllButton",
|
|
@@ -4282,8 +4553,8 @@ function UserButtonRoot(props) {
|
|
|
4282
4553
|
labelledBy: titleId,
|
|
4283
4554
|
restoreFocusTo: openerRef.current,
|
|
4284
4555
|
children: [
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsx54("h2", { id: titleId, style: { padding: "16px 16px 0", margin: 0 }, children: t.account.title }),
|
|
4557
|
+
/* @__PURE__ */ jsx54("div", { style: { padding: 16 }, children: /* @__PURE__ */ jsx54(
|
|
4287
4558
|
AccountDashboard,
|
|
4288
4559
|
{
|
|
4289
4560
|
tabs: props.tabs,
|