@usethrottle/auth 0.3.1 → 0.5.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.
@@ -8,10 +8,10 @@ import {
8
8
  useOrders,
9
9
  useSavedCards,
10
10
  useSubscriptions
11
- } from "../../chunk-2DREGJUF.js";
11
+ } from "../../chunk-TKSBAC7W.js";
12
12
  import {
13
13
  messageForError
14
- } from "../../chunk-ST77QX7X.js";
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-NCSTIPJF.js";
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 useState22 } from "react";
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,23 @@ 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",
296
313
  "fieldRow",
297
314
  "confirm.header",
298
315
  "confirm.title",
@@ -556,6 +573,17 @@ var enUS = {
556
573
  payNow: "Pay now",
557
574
  track: "Track shipment",
558
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",
559
587
  empty: "No orders yet",
560
588
  emptyDescription: "Orders you place will appear here.",
561
589
  gatedDescription: "Verify your email to see your order history.",
@@ -619,6 +647,12 @@ var enUS = {
619
647
  refunded: "Refunded",
620
648
  period: "Period",
621
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",
622
656
  /** Display copy for `invoice.status` — the wire values are paid|open|void. */
623
657
  statusLabels: { paid: "Paid", open: "Open", void: "Void" },
624
658
  downloadUnavailable: "This invoice is not available to download right now."
@@ -933,11 +967,13 @@ var THROTTLE_STYLES = `
933
967
  align-items: center;
934
968
  justify-content: center;
935
969
  cursor: pointer;
970
+ /* A label that wraps turns a control into a two-line block of text. */
971
+ white-space: nowrap;
936
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);
937
973
  }
938
974
  .throttle-button:disabled { opacity: .55; cursor: not-allowed; }
939
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); }
940
- .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%); }
941
977
  .throttle-button--primary:hover:not(:disabled) { filter: brightness(0.92); }
942
978
  .throttle-button--secondary { background: var(--throttle-color-surface); color: var(--throttle-color-foreground); border-color: var(--throttle-color-border-control); }
943
979
  .throttle-button--secondary:hover:not(:disabled) { background: var(--throttle-color-muted); }
@@ -1104,6 +1140,10 @@ var THROTTLE_STYLES = `
1104
1140
  .throttle-addresses { grid-template-columns: 1fr; }
1105
1141
  .throttle-fieldrow { grid-template-columns: 1fr; }
1106
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; }
1107
1147
  }
1108
1148
 
1109
1149
  .throttle-table { width: 100%; border-collapse: collapse; text-align: left; }
@@ -1181,12 +1221,50 @@ var THROTTLE_STYLES = `
1181
1221
  padding: var(--throttle-space-3) 0;
1182
1222
  }
1183
1223
  .throttle-rowitem:first-child { border-top: none; padding-top: 0; }
1184
- .throttle-actions { display: flex; gap: var(--throttle-space-2); flex-wrap: wrap; }
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
+ }
1185
1234
  .throttle-table__money { display: block; text-align: right; font-variant-numeric: tabular-nums; }
1186
- .throttle-lineitem { display: flex; align-items: center; gap: var(--throttle-space-3); padding: var(--throttle-space-2) 0; }
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); }
1187
1242
  .throttle-lineitem__image { width: 48px; height: 48px; object-fit: cover; border-radius: var(--throttle-radius-sm); flex: none; }
1188
1243
  .throttle-totals { display: flex; flex-direction: column; gap: var(--throttle-space-1); }
1189
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
+
1190
1268
  @media (prefers-reduced-motion: reduce) {
1191
1269
  .throttle-button, .throttle-field__input, .throttle-dropdown__item, .throttle-dropdown__trigger, .throttle-tabs__tab, .throttle-table__row, .throttle-modal__close {
1192
1270
  transition: none;
@@ -1445,15 +1523,23 @@ function Modal(props) {
1445
1523
  }
1446
1524
 
1447
1525
  // src/react/components/primitives/Confirm.tsx
1448
- import { createContext as createContext5, useCallback, useContext as useContext5, useId as useId2, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
1449
- import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
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";
1450
1528
  var ConfirmContext = createContext5(null);
1451
- function ConfirmProvider({ children }) {
1529
+ function ConfirmProvider({
1530
+ children,
1531
+ stepUpOpen = false,
1532
+ onStepUpResolve
1533
+ }) {
1452
1534
  const [request, setRequest] = useState2(null);
1535
+ const [password, setPassword] = useState2("");
1453
1536
  const { t } = useCopy();
1454
1537
  const a = useAppearance();
1455
1538
  const titleId = useId2();
1456
1539
  const settle = useRef2(null);
1540
+ useEffect2(() => {
1541
+ if (!stepUpOpen) setPassword("");
1542
+ }, [stepUpOpen]);
1457
1543
  const answer = useCallback((value) => {
1458
1544
  settle.current?.(value);
1459
1545
  settle.current = null;
@@ -1466,9 +1552,47 @@ function ConfirmProvider({ children }) {
1466
1552
  settle.current = resolve;
1467
1553
  });
1468
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
+ };
1469
1561
  return /* @__PURE__ */ jsxs5(ConfirmContext.Provider, { value: ask, children: [
1470
1562
  children,
1471
- request ? /* @__PURE__ */ jsxs5(Modal, { open: true, onClose: () => answer(false), labelledBy: titleId, size: "compact", children: [
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 }) }),
1568
+ /* @__PURE__ */ jsxs5("div", { ...a.el("confirm.body", "throttle-modal__body"), children: [
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
+ ),
1582
+ /* @__PURE__ */ jsxs5("div", { className: "throttle-actions", children: [
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: [
1472
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 }) }),
1473
1597
  /* @__PURE__ */ jsxs5("div", { ...a.el("confirm.body", "throttle-modal__body"), children: [
1474
1598
  request.body ? /* @__PURE__ */ jsx13("p", { className: "throttle-muted", children: request.body }) : null,
@@ -1485,7 +1609,7 @@ function ConfirmProvider({ children }) {
1485
1609
  /* @__PURE__ */ jsx13(Button, { elementKey: "confirm.cancelButton", variant: "secondary", onClick: () => answer(false), children: request.cancelLabel ?? t.common.keepIt })
1486
1610
  ] })
1487
1611
  ] })
1488
- ] }) : null
1612
+ ] }) }) : null
1489
1613
  ] });
1490
1614
  }
1491
1615
  function useConfirm() {
@@ -1498,7 +1622,7 @@ function useConfirm() {
1498
1622
  }
1499
1623
 
1500
1624
  // src/react/components/primitives/Dropdown.tsx
1501
- import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
1625
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
1502
1626
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1503
1627
  function Dropdown(props) {
1504
1628
  const a = useAppearance();
@@ -1506,7 +1630,7 @@ function Dropdown(props) {
1506
1630
  const root = useRef3(null);
1507
1631
  const trigger = useRef3(null);
1508
1632
  const menu = useRef3(null);
1509
- useEffect2(() => {
1633
+ useEffect3(() => {
1510
1634
  if (!open) return;
1511
1635
  menu.current?.querySelector('[role="menuitem"]')?.focus();
1512
1636
  const onDown = (e) => {
@@ -1693,67 +1817,22 @@ function Badge(props) {
1693
1817
  return /* @__PURE__ */ jsx19("span", { ...a.el(props.elementKey ?? "badge", base), children: props.children });
1694
1818
  }
1695
1819
 
1696
- // src/react/components/auth/StepUpDialog.tsx
1697
- import { useEffect as useEffect3, useId as useId3, useState as useState4 } from "react";
1698
- import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1699
- function StepUpDialog(props) {
1700
- const a = useAppearance();
1701
- const cardClass = useCardClass();
1702
- const { t } = useCopy();
1703
- const [password, setPassword] = useState4("");
1704
- const titleId = useId3();
1705
- useEffect3(() => {
1706
- if (!props.open) setPassword("");
1707
- }, [props.open]);
1708
- return /* @__PURE__ */ jsx20(Modal, { open: props.open, onClose: () => props.onResolve(null), labelledBy: titleId, children: /* @__PURE__ */ jsx20("div", { ...a.el("stepUp.root", cardClass), children: /* @__PURE__ */ jsxs10(
1709
- "form",
1710
- {
1711
- onSubmit: (e) => {
1712
- e.preventDefault();
1713
- props.onResolve(password);
1714
- },
1715
- children: [
1716
- /* @__PURE__ */ jsxs10("div", { className: "throttle-card__header", children: [
1717
- /* @__PURE__ */ jsx20("h2", { id: titleId, ...a.el("stepUp.title", "throttle-card__title"), children: t.stepUp.title }),
1718
- /* @__PURE__ */ jsx20("p", { className: "throttle-card__description", children: t.stepUp.description })
1719
- ] }),
1720
- /* @__PURE__ */ jsxs10(CardBody, { children: [
1721
- /* @__PURE__ */ jsx20(
1722
- Field,
1723
- {
1724
- label: t.stepUp.password,
1725
- type: "password",
1726
- autoComplete: "current-password",
1727
- value: password,
1728
- onChange: setPassword,
1729
- required: true,
1730
- elementKey: "stepUp.passwordField"
1731
- }
1732
- ),
1733
- /* @__PURE__ */ jsx20(Button, { type: "submit", elementKey: "stepUp.submitButton", children: t.stepUp.submitButton }),
1734
- /* @__PURE__ */ jsx20(Button, { variant: "link", elementKey: "stepUp.cancelButton", onClick: () => props.onResolve(null), children: t.stepUp.cancelButton })
1735
- ] })
1736
- ]
1737
- }
1738
- ) }) });
1739
- }
1740
-
1741
1820
  // src/react/components/auth/AuthModal.tsx
1742
- import { useId as useId4 } from "react";
1821
+ import { useId as useId3 } from "react";
1743
1822
 
1744
1823
  // src/react/components/auth/AuthFlow.tsx
1745
- import { useEffect as useEffect5, useState as useState11 } from "react";
1824
+ import { useEffect as useEffect5, useState as useState10 } from "react";
1746
1825
 
1747
1826
  // src/react/components/auth/SignIn.tsx
1748
- import { useState as useState6 } from "react";
1827
+ import { useState as useState5 } from "react";
1749
1828
 
1750
1829
  // src/react/components/useAction.ts
1751
- import { useCallback as useCallback2, useRef as useRef4, useState as useState5 } from "react";
1830
+ import { useCallback as useCallback2, useRef as useRef4, useState as useState4 } from "react";
1752
1831
  function useAction() {
1753
1832
  const { errorMessage } = useCopy();
1754
- const [submitting, setSubmitting] = useState5(false);
1755
- const [error, setError] = useState5(null);
1756
- const [notice, setNotice] = useState5(null);
1833
+ const [submitting, setSubmitting] = useState4(false);
1834
+ const [error, setError] = useState4(null);
1835
+ const [notice, setNotice] = useState4(null);
1757
1836
  const inFlight = useRef4(false);
1758
1837
  const run = useCallback2(
1759
1838
  async (fn) => {
@@ -1778,7 +1857,7 @@ function useAction() {
1778
1857
  }
1779
1858
 
1780
1859
  // src/react/components/auth/SignIn.tsx
1781
- import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1860
+ import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1782
1861
  function SignIn(props) {
1783
1862
  const a = useAppearance(props.appearance);
1784
1863
  const cardClass = useCardClass();
@@ -1786,14 +1865,14 @@ function SignIn(props) {
1786
1865
  const { t } = useCopy(props.localization);
1787
1866
  const { auth } = useAuth();
1788
1867
  const { submitting, error, run } = useAction();
1789
- const [email, setEmail] = useState6("");
1790
- const [password, setPassword] = useState6("");
1868
+ const [email, setEmail] = useState5("");
1869
+ const [password, setPassword] = useState5("");
1791
1870
  const variant = props.variant ?? "quiet";
1792
1871
  const branded = variant === "branded";
1793
1872
  const grouped = variant === "grouped";
1794
1873
  const logo = useBrandLogo(props.logo);
1795
- const forgotLink = props.onForgotPassword ? /* @__PURE__ */ jsx21(Button, { variant: "link", size: "xs", elementKey: "signIn.forgotLink", onClick: props.onForgotPassword, children: t.signIn.forgotLink }) : null;
1796
- const emailField = /* @__PURE__ */ jsx21(
1874
+ const forgotLink = props.onForgotPassword ? /* @__PURE__ */ jsx20(Button, { variant: "link", size: "xs", elementKey: "signIn.forgotLink", onClick: props.onForgotPassword, children: t.signIn.forgotLink }) : null;
1875
+ const emailField = /* @__PURE__ */ jsx20(
1797
1876
  Field,
1798
1877
  {
1799
1878
  label: t.signIn.email,
@@ -1806,7 +1885,7 @@ function SignIn(props) {
1806
1885
  grouped
1807
1886
  }
1808
1887
  );
1809
- const passwordField = /* @__PURE__ */ jsx21(
1888
+ const passwordField = /* @__PURE__ */ jsx20(
1810
1889
  Field,
1811
1890
  {
1812
1891
  label: t.signIn.password,
@@ -1820,7 +1899,7 @@ function SignIn(props) {
1820
1899
  labelExtra: grouped ? void 0 : forgotLink
1821
1900
  }
1822
1901
  );
1823
- return /* @__PURE__ */ jsx21(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx21("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs11(
1902
+ return /* @__PURE__ */ jsx20(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx20("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs10(
1824
1903
  "form",
1825
1904
  {
1826
1905
  ...a.el("signIn.root", cardClass),
@@ -1832,7 +1911,7 @@ function SignIn(props) {
1832
1911
  });
1833
1912
  },
1834
1913
  children: [
1835
- /* @__PURE__ */ jsx21(
1914
+ /* @__PURE__ */ jsx20(
1836
1915
  CardHeader,
1837
1916
  {
1838
1917
  title: t.signIn.title,
@@ -1843,24 +1922,24 @@ function SignIn(props) {
1843
1922
  branded
1844
1923
  }
1845
1924
  ),
1846
- /* @__PURE__ */ jsxs11(CardBody, { children: [
1847
- grouped ? /* @__PURE__ */ jsxs11(FieldGroup, { children: [
1925
+ /* @__PURE__ */ jsxs10(CardBody, { children: [
1926
+ grouped ? /* @__PURE__ */ jsxs10(FieldGroup, { children: [
1848
1927
  emailField,
1849
1928
  passwordField
1850
- ] }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
1929
+ ] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
1851
1930
  emailField,
1852
1931
  passwordField
1853
1932
  ] }),
1854
- grouped && forgotLink ? /* @__PURE__ */ jsx21("div", { className: "throttle-field-group__forgot", children: forgotLink }) : null,
1855
- error ? /* @__PURE__ */ jsx21(Alert, { tone: "error", children: error }) : null,
1856
- /* @__PURE__ */ jsx21(Button, { type: "submit", loading: submitting, elementKey: "signIn.submitButton", children: t.signIn.submitButton })
1933
+ grouped && forgotLink ? /* @__PURE__ */ jsx20("div", { className: "throttle-field-group__forgot", children: forgotLink }) : null,
1934
+ error ? /* @__PURE__ */ jsx20(Alert, { tone: "error", children: error }) : null,
1935
+ /* @__PURE__ */ jsx20(Button, { type: "submit", loading: submitting, elementKey: "signIn.submitButton", children: t.signIn.submitButton })
1857
1936
  ] }),
1858
- props.onSignUp ? /* @__PURE__ */ jsxs11(CardFooter, { ruled: !branded, children: [
1859
- /* @__PURE__ */ jsxs11("span", { className: "throttle-muted", children: [
1937
+ props.onSignUp ? /* @__PURE__ */ jsxs10(CardFooter, { ruled: !branded, children: [
1938
+ /* @__PURE__ */ jsxs10("span", { className: "throttle-muted", children: [
1860
1939
  t.signIn.switchPrompt,
1861
1940
  " "
1862
1941
  ] }),
1863
- /* @__PURE__ */ jsx21(Button, { variant: "link", elementKey: "signIn.switchLink", onClick: props.onSignUp, children: t.signIn.switchLink })
1942
+ /* @__PURE__ */ jsx20(Button, { variant: "link", elementKey: "signIn.switchLink", onClick: props.onSignUp, children: t.signIn.switchLink })
1864
1943
  ] }) : null
1865
1944
  ]
1866
1945
  }
@@ -1868,8 +1947,8 @@ function SignIn(props) {
1868
1947
  }
1869
1948
 
1870
1949
  // src/react/components/auth/SignUp.tsx
1871
- import { useState as useState7 } from "react";
1872
- import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1950
+ import { useState as useState6 } from "react";
1951
+ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1873
1952
  function SignUp(props) {
1874
1953
  const a = useAppearance(props.appearance);
1875
1954
  const cardClass = useCardClass();
@@ -1877,13 +1956,13 @@ function SignUp(props) {
1877
1956
  const { t } = useCopy(props.localization);
1878
1957
  const { auth } = useAuth();
1879
1958
  const { submitting, error, notice, run } = useAction();
1880
- const [email, setEmail] = useState7("");
1881
- const [password, setPassword] = useState7("");
1959
+ const [email, setEmail] = useState6("");
1960
+ const [password, setPassword] = useState6("");
1882
1961
  const variant = props.variant ?? "quiet";
1883
1962
  const branded = variant === "branded";
1884
1963
  const grouped = variant === "grouped";
1885
1964
  const logo = useBrandLogo(props.logo);
1886
- const emailField = /* @__PURE__ */ jsx22(
1965
+ const emailField = /* @__PURE__ */ jsx21(
1887
1966
  Field,
1888
1967
  {
1889
1968
  label: t.signUp.email,
@@ -1896,7 +1975,7 @@ function SignUp(props) {
1896
1975
  grouped
1897
1976
  }
1898
1977
  );
1899
- const passwordField = /* @__PURE__ */ jsx22(
1978
+ const passwordField = /* @__PURE__ */ jsx21(
1900
1979
  Field,
1901
1980
  {
1902
1981
  label: t.signUp.password,
@@ -1909,7 +1988,7 @@ function SignUp(props) {
1909
1988
  grouped
1910
1989
  }
1911
1990
  );
1912
- return /* @__PURE__ */ jsx22(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx22("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs12(
1991
+ return /* @__PURE__ */ jsx21(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx21("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs11(
1913
1992
  "form",
1914
1993
  {
1915
1994
  ...a.el("signUp.root", cardClass),
@@ -1925,7 +2004,7 @@ function SignUp(props) {
1925
2004
  });
1926
2005
  },
1927
2006
  children: [
1928
- /* @__PURE__ */ jsx22(
2007
+ /* @__PURE__ */ jsx21(
1929
2008
  CardHeader,
1930
2009
  {
1931
2010
  title: t.signUp.title,
@@ -1936,24 +2015,24 @@ function SignUp(props) {
1936
2015
  branded
1937
2016
  }
1938
2017
  ),
1939
- /* @__PURE__ */ jsxs12(CardBody, { children: [
1940
- grouped ? /* @__PURE__ */ jsxs12(FieldGroup, { children: [
2018
+ /* @__PURE__ */ jsxs11(CardBody, { children: [
2019
+ grouped ? /* @__PURE__ */ jsxs11(FieldGroup, { children: [
1941
2020
  emailField,
1942
2021
  passwordField
1943
- ] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
2022
+ ] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
1944
2023
  emailField,
1945
2024
  passwordField
1946
2025
  ] }),
1947
- error ? /* @__PURE__ */ jsx22(Alert, { tone: "error", children: error }) : null,
1948
- notice ? /* @__PURE__ */ jsx22(Alert, { tone: "info", children: notice }) : null,
1949
- /* @__PURE__ */ jsx22(Button, { type: "submit", loading: submitting, elementKey: "signUp.submitButton", children: t.signUp.submitButton })
2026
+ error ? /* @__PURE__ */ jsx21(Alert, { tone: "error", children: error }) : null,
2027
+ notice ? /* @__PURE__ */ jsx21(Alert, { tone: "info", children: notice }) : null,
2028
+ /* @__PURE__ */ jsx21(Button, { type: "submit", loading: submitting, elementKey: "signUp.submitButton", children: t.signUp.submitButton })
1950
2029
  ] }),
1951
- props.onSignIn ? /* @__PURE__ */ jsxs12(CardFooter, { ruled: !branded, children: [
1952
- /* @__PURE__ */ jsxs12("span", { className: "throttle-muted", children: [
2030
+ props.onSignIn ? /* @__PURE__ */ jsxs11(CardFooter, { ruled: !branded, children: [
2031
+ /* @__PURE__ */ jsxs11("span", { className: "throttle-muted", children: [
1953
2032
  t.signUp.switchPrompt,
1954
2033
  " "
1955
2034
  ] }),
1956
- /* @__PURE__ */ jsx22(Button, { variant: "link", elementKey: "signUp.switchLink", onClick: props.onSignIn, children: t.signUp.switchLink })
2035
+ /* @__PURE__ */ jsx21(Button, { variant: "link", elementKey: "signUp.switchLink", onClick: props.onSignIn, children: t.signUp.switchLink })
1957
2036
  ] }) : null
1958
2037
  ]
1959
2038
  }
@@ -1961,8 +2040,8 @@ function SignUp(props) {
1961
2040
  }
1962
2041
 
1963
2042
  // src/react/components/auth/ForgotPassword.tsx
1964
- import { useState as useState8 } from "react";
1965
- import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
2043
+ import { useState as useState7 } from "react";
2044
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1966
2045
  function ForgotPassword(props) {
1967
2046
  const a = useAppearance(props.appearance);
1968
2047
  const cardClass = useCardClass();
@@ -1970,10 +2049,10 @@ function ForgotPassword(props) {
1970
2049
  const { t } = useCopy(props.localization);
1971
2050
  const { auth } = useAuth();
1972
2051
  const { submitting, error, notice, run } = useAction();
1973
- const [email, setEmail] = useState8("");
2052
+ const [email, setEmail] = useState7("");
1974
2053
  const branded = (props.variant ?? "quiet") === "branded";
1975
2054
  const logo = useBrandLogo(props.logo);
1976
- return /* @__PURE__ */ jsx23(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx23("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs13(
2055
+ return /* @__PURE__ */ jsx22(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx22("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs12(
1977
2056
  "form",
1978
2057
  {
1979
2058
  ...a.el("forgotPassword.root", cardClass),
@@ -1985,7 +2064,7 @@ function ForgotPassword(props) {
1985
2064
  });
1986
2065
  },
1987
2066
  children: [
1988
- /* @__PURE__ */ jsx23(
2067
+ /* @__PURE__ */ jsx22(
1989
2068
  CardHeader,
1990
2069
  {
1991
2070
  title: t.forgotPassword.title,
@@ -1996,8 +2075,8 @@ function ForgotPassword(props) {
1996
2075
  branded
1997
2076
  }
1998
2077
  ),
1999
- /* @__PURE__ */ jsxs13(CardBody, { children: [
2000
- /* @__PURE__ */ jsx23(
2078
+ /* @__PURE__ */ jsxs12(CardBody, { children: [
2079
+ /* @__PURE__ */ jsx22(
2001
2080
  Field,
2002
2081
  {
2003
2082
  label: t.forgotPassword.email,
@@ -2009,19 +2088,19 @@ function ForgotPassword(props) {
2009
2088
  elementKey: "forgotPassword.emailField"
2010
2089
  }
2011
2090
  ),
2012
- error ? /* @__PURE__ */ jsx23(Alert, { tone: "error", children: error }) : null,
2013
- notice ? /* @__PURE__ */ jsx23(Alert, { tone: "success", children: notice }) : null,
2014
- /* @__PURE__ */ jsx23(Button, { type: "submit", loading: submitting, elementKey: "forgotPassword.submitButton", children: t.forgotPassword.submitButton })
2091
+ error ? /* @__PURE__ */ jsx22(Alert, { tone: "error", children: error }) : null,
2092
+ notice ? /* @__PURE__ */ jsx22(Alert, { tone: "success", children: notice }) : null,
2093
+ /* @__PURE__ */ jsx22(Button, { type: "submit", loading: submitting, elementKey: "forgotPassword.submitButton", children: t.forgotPassword.submitButton })
2015
2094
  ] }),
2016
- props.onBack ? /* @__PURE__ */ jsx23(CardFooter, { ruled: !branded, children: /* @__PURE__ */ jsx23(Button, { variant: "link", elementKey: "forgotPassword.backLink", onClick: props.onBack, children: t.forgotPassword.backLink }) }) : null
2095
+ props.onBack ? /* @__PURE__ */ jsx22(CardFooter, { ruled: !branded, children: /* @__PURE__ */ jsx22(Button, { variant: "link", elementKey: "forgotPassword.backLink", onClick: props.onBack, children: t.forgotPassword.backLink }) }) : null
2017
2096
  ]
2018
2097
  }
2019
2098
  ) }) });
2020
2099
  }
2021
2100
 
2022
2101
  // src/react/components/auth/ResetPassword.tsx
2023
- import { useState as useState9 } from "react";
2024
- import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
2102
+ import { useState as useState8 } from "react";
2103
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
2025
2104
  function ResetPassword(props) {
2026
2105
  const a = useAppearance(props.appearance);
2027
2106
  const cardClass = useCardClass();
@@ -2029,11 +2108,11 @@ function ResetPassword(props) {
2029
2108
  const { t } = useCopy(props.localization);
2030
2109
  const { auth } = useAuth();
2031
2110
  const { submitting, error, notice, run } = useAction();
2032
- const [password, setPassword] = useState9("");
2111
+ const [password, setPassword] = useState8("");
2033
2112
  const branded = (props.variant ?? "quiet") === "branded";
2034
2113
  const logo = useBrandLogo(props.logo);
2035
- return /* @__PURE__ */ jsx24(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx24("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs14("div", { ...a.el("resetPassword.root", cardClass), children: [
2036
- /* @__PURE__ */ jsx24(
2114
+ return /* @__PURE__ */ jsx23(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx23("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs13("div", { ...a.el("resetPassword.root", cardClass), children: [
2115
+ /* @__PURE__ */ jsx23(
2037
2116
  CardHeader,
2038
2117
  {
2039
2118
  title: t.resetPassword.title,
@@ -2043,11 +2122,11 @@ function ResetPassword(props) {
2043
2122
  branded
2044
2123
  }
2045
2124
  ),
2046
- /* @__PURE__ */ jsx24(CardBody, { children: !props.token ? (
2125
+ /* @__PURE__ */ jsx23(CardBody, { children: !props.token ? (
2047
2126
  // No form at all without a token. A submit button that can only
2048
2127
  // fail is worse than an explanation.
2049
- /* @__PURE__ */ jsx24(Alert, { tone: "error", children: t.resetPassword.missingToken })
2050
- ) : /* @__PURE__ */ jsx24(
2128
+ /* @__PURE__ */ jsx23(Alert, { tone: "error", children: t.resetPassword.missingToken })
2129
+ ) : /* @__PURE__ */ jsx23(
2051
2130
  "form",
2052
2131
  {
2053
2132
  onSubmit: (e) => {
@@ -2058,8 +2137,8 @@ function ResetPassword(props) {
2058
2137
  return t.resetPassword.doneNotice;
2059
2138
  });
2060
2139
  },
2061
- children: /* @__PURE__ */ jsxs14("div", { className: "throttle-stack", children: [
2062
- /* @__PURE__ */ jsx24(
2140
+ children: /* @__PURE__ */ jsxs13("div", { className: "throttle-stack", children: [
2141
+ /* @__PURE__ */ jsx23(
2063
2142
  Field,
2064
2143
  {
2065
2144
  label: t.resetPassword.password,
@@ -2071,9 +2150,9 @@ function ResetPassword(props) {
2071
2150
  elementKey: "resetPassword.passwordField"
2072
2151
  }
2073
2152
  ),
2074
- error ? /* @__PURE__ */ jsx24(Alert, { tone: "error", children: error }) : null,
2075
- notice ? /* @__PURE__ */ jsx24(Alert, { tone: "success", children: notice }) : null,
2076
- /* @__PURE__ */ jsx24(Button, { type: "submit", loading: submitting, elementKey: "resetPassword.submitButton", children: t.resetPassword.submitButton })
2153
+ error ? /* @__PURE__ */ jsx23(Alert, { tone: "error", children: error }) : null,
2154
+ notice ? /* @__PURE__ */ jsx23(Alert, { tone: "success", children: notice }) : null,
2155
+ /* @__PURE__ */ jsx23(Button, { type: "submit", loading: submitting, elementKey: "resetPassword.submitButton", children: t.resetPassword.submitButton })
2077
2156
  ] })
2078
2157
  }
2079
2158
  ) })
@@ -2081,8 +2160,8 @@ function ResetPassword(props) {
2081
2160
  }
2082
2161
 
2083
2162
  // src/react/components/auth/VerifyEmail.tsx
2084
- import { useEffect as useEffect4, useRef as useRef5, useState as useState10 } from "react";
2085
- import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
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";
2086
2165
  function VerifyEmail(props) {
2087
2166
  const a = useAppearance(props.appearance);
2088
2167
  const cardClass = useCardClass();
@@ -2090,8 +2169,8 @@ function VerifyEmail(props) {
2090
2169
  const { t, errorMessage } = useCopy(props.localization);
2091
2170
  const { auth } = useAuth();
2092
2171
  const { submitting, notice, run } = useAction();
2093
- const [state, setState] = useState10(props.token ? "verifying" : "idle");
2094
- const [error, setError] = useState10(null);
2172
+ const [state, setState] = useState9(props.token ? "verifying" : "idle");
2173
+ const [error, setError] = useState9(null);
2095
2174
  const branded = (props.variant ?? "quiet") === "branded";
2096
2175
  const logo = useBrandLogo(props.logo);
2097
2176
  const attempted = useRef5(null);
@@ -2108,8 +2187,8 @@ function VerifyEmail(props) {
2108
2187
  setState("failed");
2109
2188
  });
2110
2189
  }, [props.token, auth]);
2111
- return /* @__PURE__ */ jsx25(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx25("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs15("div", { ...a.el("verifyEmail.root", cardClass), children: [
2112
- /* @__PURE__ */ jsx25(
2190
+ return /* @__PURE__ */ jsx24(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx24("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs14("div", { ...a.el("verifyEmail.root", cardClass), children: [
2191
+ /* @__PURE__ */ jsx24(
2113
2192
  CardHeader,
2114
2193
  {
2115
2194
  title: t.verifyEmail.title,
@@ -2119,17 +2198,17 @@ function VerifyEmail(props) {
2119
2198
  branded
2120
2199
  }
2121
2200
  ),
2122
- /* @__PURE__ */ jsxs15(CardBody, { children: [
2123
- state === "verifying" ? /* @__PURE__ */ jsxs15("p", { children: [
2124
- /* @__PURE__ */ jsx25(Spinner, {}),
2201
+ /* @__PURE__ */ jsxs14(CardBody, { children: [
2202
+ state === "verifying" ? /* @__PURE__ */ jsxs14("p", { children: [
2203
+ /* @__PURE__ */ jsx24(Spinner, {}),
2125
2204
  " ",
2126
2205
  t.verifyEmail.verifying
2127
2206
  ] }) : null,
2128
- state === "done" ? /* @__PURE__ */ jsx25(Alert, { tone: "success", children: t.verifyEmail.success }) : null,
2129
- state === "failed" && error ? /* @__PURE__ */ jsx25(Alert, { tone: "error", children: error }) : null,
2130
- state === "idle" ? /* @__PURE__ */ jsx25("p", { className: "throttle-muted", children: t.verifyEmail.instructions }) : null,
2131
- notice ? /* @__PURE__ */ jsx25(Alert, { tone: "success", children: notice }) : null,
2132
- state !== "done" ? /* @__PURE__ */ jsx25(
2207
+ state === "done" ? /* @__PURE__ */ jsx24(Alert, { tone: "success", children: t.verifyEmail.success }) : null,
2208
+ state === "failed" && error ? /* @__PURE__ */ jsx24(Alert, { tone: "error", children: error }) : null,
2209
+ state === "idle" ? /* @__PURE__ */ jsx24("p", { className: "throttle-muted", children: t.verifyEmail.instructions }) : null,
2210
+ notice ? /* @__PURE__ */ jsx24(Alert, { tone: "success", children: notice }) : null,
2211
+ state !== "done" ? /* @__PURE__ */ jsx24(
2133
2212
  Button,
2134
2213
  {
2135
2214
  variant: "secondary",
@@ -2147,7 +2226,7 @@ function VerifyEmail(props) {
2147
2226
  }
2148
2227
 
2149
2228
  // src/react/components/auth/AuthFlow.tsx
2150
- import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
2229
+ import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
2151
2230
  var HASH_FOR = {
2152
2231
  signIn: "#/sign-in",
2153
2232
  signUp: "#/sign-up",
@@ -2173,8 +2252,8 @@ function readLocation() {
2173
2252
  function AuthFlow(props) {
2174
2253
  const a = useAppearance(props.appearance);
2175
2254
  const controlled = props.view !== void 0;
2176
- const [internal, setInternal] = useState11(props.initialView ?? "signIn");
2177
- const [urlToken, setUrlToken] = useState11(void 0);
2255
+ const [internal, setInternal] = useState10(props.initialView ?? "signIn");
2256
+ const [urlToken, setUrlToken] = useState10(void 0);
2178
2257
  useEffect5(() => {
2179
2258
  const found = readLocation();
2180
2259
  if (found.token) setUrlToken(found.token);
@@ -2205,8 +2284,8 @@ function AuthFlow(props) {
2205
2284
  return () => window.removeEventListener("hashchange", onHashChange);
2206
2285
  }, [props.routing, controlled]);
2207
2286
  const shared = { appearance: props.appearance, localization: props.localization };
2208
- return /* @__PURE__ */ jsx26("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs16("div", { ...a.el("authFlow.root"), children: [
2209
- view === "signIn" ? /* @__PURE__ */ jsx26(
2287
+ return /* @__PURE__ */ jsx25("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs15("div", { ...a.el("authFlow.root"), children: [
2288
+ view === "signIn" ? /* @__PURE__ */ jsx25(
2210
2289
  SignIn,
2211
2290
  {
2212
2291
  ...shared,
@@ -2215,19 +2294,19 @@ function AuthFlow(props) {
2215
2294
  onSignUp: () => go("signUp")
2216
2295
  }
2217
2296
  ) : null,
2218
- view === "signUp" ? /* @__PURE__ */ jsx26(SignUp, { ...shared, onSuccess: props.afterSignUp, onSignIn: () => go("signIn") }) : null,
2219
- view === "forgotPassword" ? /* @__PURE__ */ jsx26(ForgotPassword, { ...shared, onBack: () => go("signIn") }) : null,
2220
- view === "resetPassword" ? /* @__PURE__ */ jsx26(ResetPassword, { ...shared, token, onSuccess: () => go("signIn") }) : null,
2221
- view === "verifyEmail" ? /* @__PURE__ */ jsx26(VerifyEmail, { ...shared, token }) : null
2297
+ view === "signUp" ? /* @__PURE__ */ jsx25(SignUp, { ...shared, onSuccess: props.afterSignUp, onSignIn: () => go("signIn") }) : null,
2298
+ view === "forgotPassword" ? /* @__PURE__ */ jsx25(ForgotPassword, { ...shared, onBack: () => go("signIn") }) : null,
2299
+ view === "resetPassword" ? /* @__PURE__ */ jsx25(ResetPassword, { ...shared, token, onSuccess: () => go("signIn") }) : null,
2300
+ view === "verifyEmail" ? /* @__PURE__ */ jsx25(VerifyEmail, { ...shared, token }) : null
2222
2301
  ] }) });
2223
2302
  }
2224
2303
 
2225
2304
  // src/react/components/auth/AuthModal.tsx
2226
- import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
2305
+ import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
2227
2306
  function AuthModal(props) {
2228
2307
  const scoped = useAppearanceProviderValue(props.appearance);
2229
- const titleId = useId4();
2230
- return /* @__PURE__ */ jsx27(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs17(
2308
+ const titleId = useId3();
2309
+ return /* @__PURE__ */ jsx26(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs16(
2231
2310
  Modal,
2232
2311
  {
2233
2312
  open: props.open,
@@ -2237,8 +2316,8 @@ function AuthModal(props) {
2237
2316
  overlayKey: "authModal.overlay",
2238
2317
  containerKey: "authModal.container",
2239
2318
  children: [
2240
- /* @__PURE__ */ jsx27("h2", { id: titleId, style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }, children: "Account" }),
2241
- /* @__PURE__ */ jsx27(
2319
+ /* @__PURE__ */ jsx26("h2", { id: titleId, style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }, children: "Account" }),
2320
+ /* @__PURE__ */ jsx26(
2242
2321
  AuthFlow,
2243
2322
  {
2244
2323
  initialView: props.initialView,
@@ -2254,14 +2333,14 @@ function AuthModal(props) {
2254
2333
  }
2255
2334
 
2256
2335
  // src/react/components/account/AccountModal.tsx
2257
- import { useId as useId7 } from "react";
2336
+ import { useId as useId6 } from "react";
2258
2337
 
2259
2338
  // src/react/components/account/AccountDashboard.tsx
2260
- import { useEffect as useEffect9, useId as useId6, useState as useState21 } from "react";
2339
+ import { useEffect as useEffect11, useId as useId5, useState as useState20 } from "react";
2261
2340
 
2262
2341
  // src/react/components/account/VerifyEmailBanner.tsx
2263
- import { useState as useState12 } from "react";
2264
- import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
2342
+ import { useState as useState11 } from "react";
2343
+ import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
2265
2344
  var DISMISS_KEY = "throttle-auth:verify-banner-dismissed";
2266
2345
  function readDismissed() {
2267
2346
  try {
@@ -2282,14 +2361,14 @@ function VerifyEmailBanner(props) {
2282
2361
  const { t } = useCopy(props.localization);
2283
2362
  const { auth, status, emailVerified } = useAuth();
2284
2363
  const { submitting, notice, error, run } = useAction();
2285
- const [dismissed, setDismissed] = useState12(readDismissed);
2364
+ const [dismissed, setDismissed] = useState11(readDismissed);
2286
2365
  if (status !== "authenticated" || emailVerified || dismissed) return null;
2287
- return /* @__PURE__ */ jsx28(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx28("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs18("div", { ...a.el("verifyBanner.root", "throttle-banner"), children: [
2288
- /* @__PURE__ */ jsx28("span", { ...a.el("verifyBanner.message"), children: t.verifyBanner.message }),
2289
- notice ? /* @__PURE__ */ jsx28(Alert, { tone: "success", children: notice }) : null,
2290
- error ? /* @__PURE__ */ jsx28(Alert, { tone: "error", children: error }) : null,
2291
- /* @__PURE__ */ jsxs18("span", { className: "throttle-actions", children: [
2292
- /* @__PURE__ */ jsx28(
2366
+ return /* @__PURE__ */ jsx27(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx27("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs17("div", { ...a.el("verifyBanner.root", "throttle-banner"), children: [
2367
+ /* @__PURE__ */ jsx27("span", { ...a.el("verifyBanner.message"), children: t.verifyBanner.message }),
2368
+ notice ? /* @__PURE__ */ jsx27(Alert, { tone: "success", children: notice }) : null,
2369
+ error ? /* @__PURE__ */ jsx27(Alert, { tone: "error", children: error }) : null,
2370
+ /* @__PURE__ */ jsxs17("span", { className: "throttle-actions", children: [
2371
+ /* @__PURE__ */ jsx27(
2293
2372
  Button,
2294
2373
  {
2295
2374
  variant: "secondary",
@@ -2302,7 +2381,7 @@ function VerifyEmailBanner(props) {
2302
2381
  children: t.verifyBanner.resendButton
2303
2382
  }
2304
2383
  ),
2305
- /* @__PURE__ */ jsx28(
2384
+ /* @__PURE__ */ jsx27(
2306
2385
  Button,
2307
2386
  {
2308
2387
  variant: "link",
@@ -2319,9 +2398,9 @@ function VerifyEmailBanner(props) {
2319
2398
  }
2320
2399
 
2321
2400
  // src/react/components/account/icons.tsx
2322
- import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
2401
+ import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
2323
2402
  function Glyph(props) {
2324
- return /* @__PURE__ */ jsx29(
2403
+ return /* @__PURE__ */ jsx28(
2325
2404
  "svg",
2326
2405
  {
2327
2406
  className: "throttle-tabs__railicon",
@@ -2340,68 +2419,68 @@ function Glyph(props) {
2340
2419
  );
2341
2420
  }
2342
2421
  var ACCOUNT_ICONS = {
2343
- profile: /* @__PURE__ */ jsxs19(Glyph, { children: [
2344
- /* @__PURE__ */ jsx29("circle", { cx: "12", cy: "8", r: "4" }),
2345
- /* @__PURE__ */ jsx29("path", { d: "M4 21c0-4 3.6-6 8-6s8 2 8 6" })
2422
+ profile: /* @__PURE__ */ jsxs18(Glyph, { children: [
2423
+ /* @__PURE__ */ jsx28("circle", { cx: "12", cy: "8", r: "4" }),
2424
+ /* @__PURE__ */ jsx28("path", { d: "M4 21c0-4 3.6-6 8-6s8 2 8 6" })
2346
2425
  ] }),
2347
- addresses: /* @__PURE__ */ jsxs19(Glyph, { children: [
2348
- /* @__PURE__ */ jsx29("path", { d: "M12 21s7-5.3 7-11a7 7 0 1 0-14 0c0 5.7 7 11 7 11Z" }),
2349
- /* @__PURE__ */ jsx29("circle", { cx: "12", cy: "10", r: "2.5" })
2426
+ addresses: /* @__PURE__ */ jsxs18(Glyph, { children: [
2427
+ /* @__PURE__ */ jsx28("path", { d: "M12 21s7-5.3 7-11a7 7 0 1 0-14 0c0 5.7 7 11 7 11Z" }),
2428
+ /* @__PURE__ */ jsx28("circle", { cx: "12", cy: "10", r: "2.5" })
2350
2429
  ] }),
2351
- paymentMethods: /* @__PURE__ */ jsxs19(Glyph, { children: [
2352
- /* @__PURE__ */ jsx29("rect", { x: "2.5", y: "5.5", width: "19", height: "13", rx: "2.5" }),
2353
- /* @__PURE__ */ jsx29("path", { d: "M2.5 10h19" })
2430
+ paymentMethods: /* @__PURE__ */ jsxs18(Glyph, { children: [
2431
+ /* @__PURE__ */ jsx28("rect", { x: "2.5", y: "5.5", width: "19", height: "13", rx: "2.5" }),
2432
+ /* @__PURE__ */ jsx28("path", { d: "M2.5 10h19" })
2354
2433
  ] }),
2355
- orders: /* @__PURE__ */ jsxs19(Glyph, { children: [
2356
- /* @__PURE__ */ jsx29("path", { d: "M4 7h16v13H4z" }),
2357
- /* @__PURE__ */ jsx29("path", { d: "M8 7V4h8v3" }),
2358
- /* @__PURE__ */ jsx29("path", { d: "M8 12h8" })
2434
+ orders: /* @__PURE__ */ jsxs18(Glyph, { children: [
2435
+ /* @__PURE__ */ jsx28("path", { d: "M4 7h16v13H4z" }),
2436
+ /* @__PURE__ */ jsx28("path", { d: "M8 7V4h8v3" }),
2437
+ /* @__PURE__ */ jsx28("path", { d: "M8 12h8" })
2359
2438
  ] }),
2360
- invoices: /* @__PURE__ */ jsxs19(Glyph, { children: [
2361
- /* @__PURE__ */ jsx29("path", { d: "M6 3h12v18l-3-2-3 2-3-2-3 2Z" }),
2362
- /* @__PURE__ */ jsx29("path", { d: "M9 8h6M9 12h6" })
2439
+ invoices: /* @__PURE__ */ jsxs18(Glyph, { children: [
2440
+ /* @__PURE__ */ jsx28("path", { d: "M6 3h12v18l-3-2-3 2-3-2-3 2Z" }),
2441
+ /* @__PURE__ */ jsx28("path", { d: "M9 8h6M9 12h6" })
2363
2442
  ] }),
2364
- subscriptions: /* @__PURE__ */ jsxs19(Glyph, { children: [
2365
- /* @__PURE__ */ jsx29("path", { d: "M3 12a9 9 0 0 1 15.5-6.2" }),
2366
- /* @__PURE__ */ jsx29("path", { d: "M21 12a9 9 0 0 1-15.5 6.2" }),
2367
- /* @__PURE__ */ jsx29("path", { d: "M18 3v4h-4M6 21v-4h4" })
2443
+ subscriptions: /* @__PURE__ */ jsxs18(Glyph, { children: [
2444
+ /* @__PURE__ */ jsx28("path", { d: "M3 12a9 9 0 0 1 15.5-6.2" }),
2445
+ /* @__PURE__ */ jsx28("path", { d: "M21 12a9 9 0 0 1-15.5 6.2" }),
2446
+ /* @__PURE__ */ jsx28("path", { d: "M18 3v4h-4M6 21v-4h4" })
2368
2447
  ] }),
2369
- security: /* @__PURE__ */ jsxs19(Glyph, { children: [
2370
- /* @__PURE__ */ jsx29("path", { d: "M12 3 4 6.5V12c0 5 3.4 8.3 8 9 4.6-.7 8-4 8-9V6.5Z" }),
2371
- /* @__PURE__ */ jsx29("path", { d: "m9 12 2 2 4-4" })
2448
+ security: /* @__PURE__ */ jsxs18(Glyph, { children: [
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" }),
2450
+ /* @__PURE__ */ jsx28("path", { d: "m9 12 2 2 4-4" })
2372
2451
  ] })
2373
2452
  };
2374
2453
 
2375
2454
  // src/react/components/account/ProfilePanel.tsx
2376
- import { useEffect as useEffect6, useState as useState13, useRef as useRef6 } from "react";
2455
+ import { useEffect as useEffect6, useState as useState12, useRef as useRef6 } from "react";
2377
2456
 
2378
2457
  // src/react/components/account/PanelState.tsx
2379
- import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
2458
+ import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
2380
2459
  function PanelState(props) {
2381
2460
  const { t, errorMessage } = useCopy();
2382
2461
  const { data, isLoading, error, refetch } = props.resource;
2383
2462
  const empty = props.isEmpty(data);
2384
- if (isLoading && empty) return /* @__PURE__ */ jsx30(Skeleton, { count: props.skeletonRows ?? 3 });
2385
- const errorBanner = error ? /* @__PURE__ */ jsxs20("div", { className: "throttle-stack", children: [
2386
- /* @__PURE__ */ jsx30(Alert, { tone: "error", children: errorMessage(error) }),
2387
- /* @__PURE__ */ jsx30(Button, { variant: "secondary", onClick: () => void refetch(), children: t.common.retry })
2463
+ if (isLoading && empty) return /* @__PURE__ */ jsx29(Skeleton, { count: props.skeletonRows ?? 3 });
2464
+ const errorBanner = error ? /* @__PURE__ */ jsxs19("div", { className: "throttle-stack", children: [
2465
+ /* @__PURE__ */ jsx29(Alert, { tone: "error", children: errorMessage(error) }),
2466
+ /* @__PURE__ */ jsx29(Button, { variant: "secondary", onClick: () => void refetch(), children: t.common.retry })
2388
2467
  ] }) : null;
2389
2468
  const gatedByVerification = error?.code === "verification_required";
2390
2469
  if (gatedByVerification && empty) {
2391
- return /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.gatedDescription ?? props.emptyDescription });
2470
+ return /* @__PURE__ */ jsx29(EmptyState, { title: props.emptyTitle, description: props.gatedDescription ?? props.emptyDescription });
2392
2471
  }
2393
2472
  if (error && empty) return errorBanner;
2394
2473
  if (empty) {
2395
- return props.gated ? /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.gatedDescription }) : /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.emptyDescription });
2474
+ return props.gated ? /* @__PURE__ */ jsx29(EmptyState, { title: props.emptyTitle, description: props.gatedDescription }) : /* @__PURE__ */ jsx29(EmptyState, { title: props.emptyTitle, description: props.emptyDescription });
2396
2475
  }
2397
- return /* @__PURE__ */ jsxs20(Fragment4, { children: [
2476
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
2398
2477
  errorBanner,
2399
2478
  props.children(data)
2400
2479
  ] });
2401
2480
  }
2402
2481
 
2403
2482
  // src/react/components/account/ProfilePanel.tsx
2404
- import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
2483
+ import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
2405
2484
  function ProfilePanel(props) {
2406
2485
  const a = useAppearance(props.appearance);
2407
2486
  const scoped = useAppearanceProviderValue(props.appearance);
@@ -2409,7 +2488,7 @@ function ProfilePanel(props) {
2409
2488
  const { status } = useAuth();
2410
2489
  const resource = useCustomer();
2411
2490
  const { submitting, error, notice, run } = useAction();
2412
- const [form, setForm] = useState13({ firstName: "", lastName: "", phone: "", company: "" });
2491
+ const [form, setForm] = useState12({ firstName: "", lastName: "", phone: "", company: "" });
2413
2492
  const edited = useRef6(false);
2414
2493
  useEffect6(() => {
2415
2494
  const c = resource.data;
@@ -2422,14 +2501,14 @@ function ProfilePanel(props) {
2422
2501
  });
2423
2502
  }, [resource.data]);
2424
2503
  if (status === "unauthenticated") return null;
2425
- return /* @__PURE__ */ jsx31(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx31("div", { ...a.rootProps, children: /* @__PURE__ */ jsx31("div", { ...a.el("profilePanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx31(
2504
+ return /* @__PURE__ */ jsx30(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx30("div", { ...a.rootProps, children: /* @__PURE__ */ jsx30("div", { ...a.el("profilePanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx30(
2426
2505
  PanelState,
2427
2506
  {
2428
2507
  resource,
2429
2508
  isEmpty: (c) => c === null,
2430
2509
  emptyTitle: t.common.somethingWentWrong,
2431
2510
  skeletonRows: 4,
2432
- children: (customer) => /* @__PURE__ */ jsxs21(
2511
+ children: (customer) => /* @__PURE__ */ jsxs20(
2433
2512
  "form",
2434
2513
  {
2435
2514
  ...a.el("profilePanel.form", "throttle-stack"),
@@ -2447,7 +2526,7 @@ function ProfilePanel(props) {
2447
2526
  });
2448
2527
  },
2449
2528
  children: [
2450
- /* @__PURE__ */ jsx31(
2529
+ /* @__PURE__ */ jsx30(
2451
2530
  Field,
2452
2531
  {
2453
2532
  label: t.profile.email,
@@ -2459,8 +2538,8 @@ function ProfilePanel(props) {
2459
2538
  hint: t.profile.emailReadOnly
2460
2539
  }
2461
2540
  ),
2462
- /* @__PURE__ */ jsxs21(FieldRow, { children: [
2463
- /* @__PURE__ */ jsx31(
2541
+ /* @__PURE__ */ jsxs20(FieldRow, { children: [
2542
+ /* @__PURE__ */ jsx30(
2464
2543
  Field,
2465
2544
  {
2466
2545
  label: t.profile.firstName,
@@ -2472,7 +2551,7 @@ function ProfilePanel(props) {
2472
2551
  }
2473
2552
  }
2474
2553
  ),
2475
- /* @__PURE__ */ jsx31(
2554
+ /* @__PURE__ */ jsx30(
2476
2555
  Field,
2477
2556
  {
2478
2557
  label: t.profile.lastName,
@@ -2485,8 +2564,8 @@ function ProfilePanel(props) {
2485
2564
  }
2486
2565
  )
2487
2566
  ] }),
2488
- /* @__PURE__ */ jsxs21(FieldRow, { children: [
2489
- /* @__PURE__ */ jsx31(
2567
+ /* @__PURE__ */ jsxs20(FieldRow, { children: [
2568
+ /* @__PURE__ */ jsx30(
2490
2569
  Field,
2491
2570
  {
2492
2571
  label: t.profile.phone,
@@ -2499,7 +2578,7 @@ function ProfilePanel(props) {
2499
2578
  }
2500
2579
  }
2501
2580
  ),
2502
- /* @__PURE__ */ jsx31(
2581
+ /* @__PURE__ */ jsx30(
2503
2582
  Field,
2504
2583
  {
2505
2584
  label: t.profile.company,
@@ -2512,9 +2591,9 @@ function ProfilePanel(props) {
2512
2591
  }
2513
2592
  )
2514
2593
  ] }),
2515
- error ? /* @__PURE__ */ jsx31(Alert, { tone: "error", children: error }) : null,
2516
- notice ? /* @__PURE__ */ jsx31(Alert, { tone: "success", children: notice }) : null,
2517
- /* @__PURE__ */ jsx31(Button, { type: "submit", loading: submitting, elementKey: "profilePanel.submitButton", children: t.profile.saveButton })
2594
+ error ? /* @__PURE__ */ jsx30(Alert, { tone: "error", children: error }) : null,
2595
+ notice ? /* @__PURE__ */ jsx30(Alert, { tone: "success", children: notice }) : null,
2596
+ /* @__PURE__ */ jsx30(Button, { type: "submit", loading: submitting, elementKey: "profilePanel.submitButton", children: t.profile.saveButton })
2518
2597
  ]
2519
2598
  }
2520
2599
  )
@@ -2523,16 +2602,16 @@ function ProfilePanel(props) {
2523
2602
  }
2524
2603
 
2525
2604
  // src/react/components/account/AddressesPanel.tsx
2526
- import { useState as useState15 } from "react";
2605
+ import { useState as useState14 } from "react";
2527
2606
 
2528
2607
  // src/react/components/account/AddressForm.tsx
2529
- import { useState as useState14 } from "react";
2530
- import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
2608
+ import { useState as useState13 } from "react";
2609
+ import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
2531
2610
  function AddressForm(props) {
2532
2611
  const a = useAppearance();
2533
2612
  const { t } = useCopy();
2534
2613
  const i = props.initial;
2535
- const [form, setForm] = useState14({
2614
+ const [form, setForm] = useState13({
2536
2615
  label: i?.label ?? "",
2537
2616
  firstName: i?.firstName ?? "",
2538
2617
  lastName: i?.lastName ?? "",
@@ -2546,7 +2625,7 @@ function AddressForm(props) {
2546
2625
  phone: i?.phone ?? ""
2547
2626
  });
2548
2627
  const set = (key) => (value) => setForm((f) => ({ ...f, [key]: value }));
2549
- return /* @__PURE__ */ jsxs22(
2628
+ return /* @__PURE__ */ jsxs21(
2550
2629
  "form",
2551
2630
  {
2552
2631
  ...a.el("addressesPanel.form", "throttle-stack"),
@@ -2568,15 +2647,15 @@ function AddressForm(props) {
2568
2647
  });
2569
2648
  },
2570
2649
  children: [
2571
- /* @__PURE__ */ jsxs22(FieldRow, { children: [
2572
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.label, value: form.label, onChange: set("label") }),
2573
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.company, value: form.company, onChange: set("company"), autoComplete: "organization" })
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" })
2574
2653
  ] }),
2575
- /* @__PURE__ */ jsxs22(FieldRow, { children: [
2576
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.firstName, value: form.firstName, onChange: set("firstName"), autoComplete: "given-name" }),
2577
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.lastName, value: form.lastName, onChange: set("lastName"), autoComplete: "family-name" })
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" })
2578
2657
  ] }),
2579
- /* @__PURE__ */ jsx32(
2658
+ /* @__PURE__ */ jsx31(
2580
2659
  Field,
2581
2660
  {
2582
2661
  label: t.addresses.addressLine1,
@@ -2586,7 +2665,7 @@ function AddressForm(props) {
2586
2665
  autoComplete: "address-line1"
2587
2666
  }
2588
2667
  ),
2589
- /* @__PURE__ */ jsx32(
2668
+ /* @__PURE__ */ jsx31(
2590
2669
  Field,
2591
2670
  {
2592
2671
  label: t.addresses.addressLine2,
@@ -2595,9 +2674,9 @@ function AddressForm(props) {
2595
2674
  autoComplete: "address-line2"
2596
2675
  }
2597
2676
  ),
2598
- /* @__PURE__ */ jsxs22(FieldRow, { children: [
2599
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.city, value: form.city, onChange: set("city"), required: true, autoComplete: "address-level2" }),
2600
- /* @__PURE__ */ jsx32(
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(
2601
2680
  Field,
2602
2681
  {
2603
2682
  label: t.addresses.stateProvince,
@@ -2607,8 +2686,8 @@ function AddressForm(props) {
2607
2686
  }
2608
2687
  )
2609
2688
  ] }),
2610
- /* @__PURE__ */ jsxs22(FieldRow, { children: [
2611
- /* @__PURE__ */ jsx32(
2689
+ /* @__PURE__ */ jsxs21(FieldRow, { children: [
2690
+ /* @__PURE__ */ jsx31(
2612
2691
  Field,
2613
2692
  {
2614
2693
  label: t.addresses.postalCode,
@@ -2617,7 +2696,7 @@ function AddressForm(props) {
2617
2696
  autoComplete: "postal-code"
2618
2697
  }
2619
2698
  ),
2620
- /* @__PURE__ */ jsx32(
2699
+ /* @__PURE__ */ jsx31(
2621
2700
  Field,
2622
2701
  {
2623
2702
  label: t.addresses.countryCode,
@@ -2629,11 +2708,11 @@ function AddressForm(props) {
2629
2708
  }
2630
2709
  )
2631
2710
  ] }),
2632
- /* @__PURE__ */ jsx32(Field, { label: t.addresses.phone, type: "tel", value: form.phone, onChange: set("phone"), autoComplete: "tel" }),
2633
- props.error ? /* @__PURE__ */ jsx32(Alert, { tone: "error", children: props.error }) : null,
2634
- /* @__PURE__ */ jsxs22("div", { className: "throttle-actions", children: [
2635
- /* @__PURE__ */ jsx32(Button, { type: "submit", loading: props.submitting, children: t.common.save }),
2636
- /* @__PURE__ */ jsx32(Button, { variant: "link", onClick: props.onCancel, children: t.common.cancel })
2711
+ /* @__PURE__ */ jsx31(Field, { label: t.addresses.phone, type: "tel", value: form.phone, onChange: set("phone"), autoComplete: "tel" }),
2712
+ props.error ? /* @__PURE__ */ jsx31(Alert, { tone: "error", children: props.error }) : null,
2713
+ /* @__PURE__ */ jsxs21("div", { className: "throttle-actions", children: [
2714
+ /* @__PURE__ */ jsx31(Button, { type: "submit", loading: props.submitting, children: t.common.save }),
2715
+ /* @__PURE__ */ jsx31(Button, { variant: "link", onClick: props.onCancel, children: t.common.cancel })
2637
2716
  ] })
2638
2717
  ]
2639
2718
  }
@@ -2641,7 +2720,7 @@ function AddressForm(props) {
2641
2720
  }
2642
2721
 
2643
2722
  // src/react/components/account/AddressesPanel.tsx
2644
- import { Fragment as Fragment5, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
2723
+ import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
2645
2724
  function AddressesPanel(props) {
2646
2725
  const a = useAppearance(props.appearance);
2647
2726
  const scoped = useAppearanceProviderValue(props.appearance);
@@ -2649,7 +2728,7 @@ function AddressesPanel(props) {
2649
2728
  const resource = useAddresses();
2650
2729
  const { submitting, error, run } = useAction();
2651
2730
  const confirm = useConfirm();
2652
- const [editing, setEditing] = useState15(null);
2731
+ const [editing, setEditing] = useState14(null);
2653
2732
  const variant = props.variant ?? "rows";
2654
2733
  const rowsVariant = variant === "rows";
2655
2734
  const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
@@ -2657,9 +2736,9 @@ function AddressesPanel(props) {
2657
2736
  const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
2658
2737
  const close = () => setEditing(null);
2659
2738
  const formatAddress = (address) => [address.addressLine2, address.city, address.stateProvince, address.postalCode, address.countryCode].filter(Boolean).join(", ");
2660
- return /* @__PURE__ */ jsx33(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx33("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs23("div", { ...a.el("addressesPanel.root", "throttle-panel"), children: [
2661
- !editing && error ? /* @__PURE__ */ jsx33(Alert, { tone: "error", children: error }) : null,
2662
- editing ? /* @__PURE__ */ jsx33(
2739
+ return /* @__PURE__ */ jsx32(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx32("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs22("div", { ...a.el("addressesPanel.root", "throttle-panel"), children: [
2740
+ !editing && error ? /* @__PURE__ */ jsx32(Alert, { tone: "error", children: error }) : null,
2741
+ editing ? /* @__PURE__ */ jsx32(
2663
2742
  AddressForm,
2664
2743
  {
2665
2744
  initial: editing === "new" ? void 0 : editing,
@@ -2672,16 +2751,16 @@ function AddressesPanel(props) {
2672
2751
  close();
2673
2752
  })
2674
2753
  }
2675
- ) : /* @__PURE__ */ jsxs23(Fragment5, { children: [
2676
- /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33(Button, { elementKey: "addressesPanel.addButton", variant: "secondary", onClick: () => setEditing("new"), children: t.addresses.addButton }) }),
2677
- /* @__PURE__ */ jsx33(
2754
+ ) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
2755
+ /* @__PURE__ */ jsx32("div", { children: /* @__PURE__ */ jsx32(Button, { elementKey: "addressesPanel.addButton", variant: "secondary", onClick: () => setEditing("new"), children: t.addresses.addButton }) }),
2756
+ /* @__PURE__ */ jsx32(
2678
2757
  PanelState,
2679
2758
  {
2680
2759
  resource,
2681
2760
  isEmpty: (rows) => rows.length === 0,
2682
2761
  emptyTitle: t.addresses.empty,
2683
2762
  emptyDescription: t.addresses.emptyDescription,
2684
- children: (rows) => variant === "table" ? /* @__PURE__ */ jsx33(
2763
+ children: (rows) => variant === "table" ? /* @__PURE__ */ jsx32(
2685
2764
  DataTable,
2686
2765
  {
2687
2766
  tableKey: "addressesPanel.table",
@@ -2690,13 +2769,13 @@ function AddressesPanel(props) {
2690
2769
  rows,
2691
2770
  columns: [
2692
2771
  { key: "label", label: t.addresses.label, render: (address) => address.label || address.addressLine1 },
2693
- { key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */ jsxs23(Fragment5, { children: [
2772
+ { key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */ jsxs22(Fragment6, { children: [
2694
2773
  address.addressLine1,
2695
2774
  formatAddress(address) ? `, ${formatAddress(address)}` : ""
2696
2775
  ] }) },
2697
- { key: "default", label: t.addresses.defaultBadge, render: (address) => address.isDefault ? /* @__PURE__ */ jsx33(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null },
2698
- { key: "actions", label: t.common.actions, render: (address) => /* @__PURE__ */ jsxs23("div", { className: "throttle-actions", children: [
2699
- !address.isDefault ? /* @__PURE__ */ jsx33(
2776
+ { key: "default", label: t.addresses.defaultBadge, render: (address) => address.isDefault ? /* @__PURE__ */ jsx32(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null },
2777
+ { key: "actions", label: t.common.actions, render: (address) => /* @__PURE__ */ jsxs22("div", { className: "throttle-actions", children: [
2778
+ !address.isDefault ? /* @__PURE__ */ jsx32(
2700
2779
  Button,
2701
2780
  {
2702
2781
  variant: "secondary",
@@ -2705,7 +2784,7 @@ function AddressesPanel(props) {
2705
2784
  children: t.addresses.makeDefault
2706
2785
  }
2707
2786
  ) : null,
2708
- /* @__PURE__ */ jsx33(
2787
+ /* @__PURE__ */ jsx32(
2709
2788
  Button,
2710
2789
  {
2711
2790
  variant: "secondary",
@@ -2714,7 +2793,7 @@ function AddressesPanel(props) {
2714
2793
  children: t.common.edit
2715
2794
  }
2716
2795
  ),
2717
- /* @__PURE__ */ jsx33(
2796
+ /* @__PURE__ */ jsx32(
2718
2797
  Button,
2719
2798
  {
2720
2799
  variant: "danger",
@@ -2730,17 +2809,17 @@ function AddressesPanel(props) {
2730
2809
  ] }) }
2731
2810
  ]
2732
2811
  }
2733
- ) : /* @__PURE__ */ jsx33("div", { ...a.el("addressesPanel.list", listBase), children: rows.map((address) => /* @__PURE__ */ jsxs23("div", { ...a.el("addressesPanel.item", itemBase), children: [
2734
- /* @__PURE__ */ jsxs23("div", { children: [
2735
- /* @__PURE__ */ jsxs23("div", { className: "throttle-row", children: [
2736
- /* @__PURE__ */ jsx33("strong", { children: address.label || address.addressLine1 }),
2737
- address.isDefault ? /* @__PURE__ */ jsx33(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null
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: [
2815
+ /* @__PURE__ */ jsx32("strong", { children: address.label || address.addressLine1 }),
2816
+ address.isDefault ? /* @__PURE__ */ jsx32(Badge, { tone: "success", children: t.addresses.defaultBadge }) : null
2738
2817
  ] }),
2739
- /* @__PURE__ */ jsx33("p", { className: "throttle-muted", children: address.addressLine1 }),
2740
- /* @__PURE__ */ jsx33("p", { className: "throttle-muted", children: formatAddress(address) })
2818
+ /* @__PURE__ */ jsx32("p", { className: "throttle-muted", children: address.addressLine1 }),
2819
+ /* @__PURE__ */ jsx32("p", { className: "throttle-muted", children: formatAddress(address) })
2741
2820
  ] }),
2742
- /* @__PURE__ */ jsxs23("div", { className: "throttle-actions", children: [
2743
- !address.isDefault ? /* @__PURE__ */ jsx33(
2821
+ /* @__PURE__ */ jsxs22("div", { className: "throttle-actions", children: [
2822
+ !address.isDefault ? /* @__PURE__ */ jsx32(
2744
2823
  Button,
2745
2824
  {
2746
2825
  variant: actionVariant("secondary"),
@@ -2749,7 +2828,7 @@ function AddressesPanel(props) {
2749
2828
  children: t.addresses.makeDefault
2750
2829
  }
2751
2830
  ) : null,
2752
- /* @__PURE__ */ jsx33(
2831
+ /* @__PURE__ */ jsx32(
2753
2832
  Button,
2754
2833
  {
2755
2834
  variant: actionVariant("secondary"),
@@ -2758,7 +2837,7 @@ function AddressesPanel(props) {
2758
2837
  children: t.common.edit
2759
2838
  }
2760
2839
  ),
2761
- /* @__PURE__ */ jsx33(
2840
+ /* @__PURE__ */ jsx32(
2762
2841
  Button,
2763
2842
  {
2764
2843
  variant: actionVariant("danger"),
@@ -2780,18 +2859,18 @@ function AddressesPanel(props) {
2780
2859
  }
2781
2860
 
2782
2861
  // src/react/components/account/PaymentMethodsPanel.tsx
2783
- import { useState as useState17 } from "react";
2862
+ import { useState as useState16 } from "react";
2784
2863
 
2785
2864
  // src/react/components/account/AddCardDialog.tsx
2786
- import { useEffect as useEffect7, useId as useId5, useRef as useRef7, useState as useState16 } from "react";
2787
- import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
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";
2788
2867
  function AddCardDialog(props) {
2789
2868
  const { account } = useAuth();
2790
- const titleId = useId5();
2869
+ const titleId = useId4();
2791
2870
  const { t } = useCopy(props.localization);
2792
- const [src, setSrc] = useState16(null);
2793
- const [error, setError] = useState16(null);
2794
- const [busy, setBusy] = useState16(false);
2871
+ const [src, setSrc] = useState15(null);
2872
+ const [error, setError] = useState15(null);
2873
+ const [busy, setBusy] = useState15(false);
2795
2874
  const onAdded = useRef7(props.onAdded);
2796
2875
  const onClose = useRef7(props.onClose);
2797
2876
  onAdded.current = props.onAdded;
@@ -2859,11 +2938,11 @@ function AddCardDialog(props) {
2859
2938
  return () => window.removeEventListener("message", onMessage);
2860
2939
  }, [src, account, t]);
2861
2940
  if (!props.open) return null;
2862
- return /* @__PURE__ */ jsxs24(Modal, { open: true, onClose: props.onClose, labelledBy: titleId, children: [
2863
- /* @__PURE__ */ jsx34("div", { className: "throttle-modal__header", children: /* @__PURE__ */ jsx34("h2", { id: titleId, className: "throttle-modal__title", children: t.paymentMethods.addTitle }) }),
2864
- /* @__PURE__ */ jsxs24("div", { className: "throttle-modal__body", children: [
2865
- error ? /* @__PURE__ */ jsx34(Alert, { tone: "error", children: error }) : null,
2866
- busy ? /* @__PURE__ */ jsx34("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx34(Spinner, {}) }) : src ? /* @__PURE__ */ jsx34(
2941
+ return /* @__PURE__ */ jsxs23(Modal, { open: true, onClose: props.onClose, labelledBy: titleId, children: [
2942
+ /* @__PURE__ */ jsx33("div", { className: "throttle-modal__header", children: /* @__PURE__ */ jsx33("h2", { id: titleId, className: "throttle-modal__title", children: t.paymentMethods.addTitle }) }),
2943
+ /* @__PURE__ */ jsxs23("div", { className: "throttle-modal__body", children: [
2944
+ error ? /* @__PURE__ */ jsx33(Alert, { tone: "error", children: error }) : null,
2945
+ busy ? /* @__PURE__ */ jsx33("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx33(Spinner, {}) }) : src ? /* @__PURE__ */ jsx33(
2867
2946
  "iframe",
2868
2947
  {
2869
2948
  className: "throttle-cardframe",
@@ -2871,13 +2950,13 @@ function AddCardDialog(props) {
2871
2950
  title: t.paymentMethods.addTitle,
2872
2951
  sandbox: "allow-scripts allow-forms allow-same-origin"
2873
2952
  }
2874
- ) : !error ? /* @__PURE__ */ jsx34("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx34(Spinner, {}) }) : null
2953
+ ) : !error ? /* @__PURE__ */ jsx33("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx33(Spinner, {}) }) : null
2875
2954
  ] })
2876
2955
  ] });
2877
2956
  }
2878
2957
 
2879
2958
  // src/react/components/account/PaymentMethodsPanel.tsx
2880
- import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
2959
+ import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
2881
2960
  function PaymentMethodsPanel(props) {
2882
2961
  const a = useAppearance(props.appearance);
2883
2962
  const scoped = useAppearanceProviderValue(props.appearance);
@@ -2886,7 +2965,7 @@ function PaymentMethodsPanel(props) {
2886
2965
  const resource = useSavedCards();
2887
2966
  const { submitting, error, run } = useAction();
2888
2967
  const confirm = useConfirm();
2889
- const [adding, setAdding] = useState17(false);
2968
+ const [adding, setAdding] = useState16(false);
2890
2969
  const variant = props.variant ?? "rows";
2891
2970
  const rowsVariant = variant === "rows";
2892
2971
  const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
@@ -2894,10 +2973,10 @@ function PaymentMethodsPanel(props) {
2894
2973
  const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
2895
2974
  const cardLabel = (card) => `${(card.cardBrand ?? card.methodType).toUpperCase()} \u2022\u2022\u2022\u2022 ${card.cardLastFour ?? "____"}`;
2896
2975
  const expiryLabel = (card) => card.cardExpMonth && card.cardExpYear ? `${String(card.cardExpMonth).padStart(2, "0")}/${card.cardExpYear}` : "";
2897
- return /* @__PURE__ */ jsx35(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx35("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs25("div", { ...a.el("paymentMethodsPanel.root", "throttle-panel"), children: [
2898
- error ? /* @__PURE__ */ jsx35(Alert, { tone: "error", children: error }) : null,
2899
- emailVerified ? /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(Button, { elementKey: "paymentMethodsPanel.addButton", variant: "secondary", onClick: () => setAdding(true), children: t.paymentMethods.addButton }) }) : null,
2900
- /* @__PURE__ */ jsx35(
2976
+ return /* @__PURE__ */ jsx34(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx34("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs24("div", { ...a.el("paymentMethodsPanel.root", "throttle-panel"), children: [
2977
+ error ? /* @__PURE__ */ jsx34(Alert, { tone: "error", children: error }) : null,
2978
+ emailVerified ? /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(Button, { elementKey: "paymentMethodsPanel.addButton", variant: "secondary", onClick: () => setAdding(true), children: t.paymentMethods.addButton }) }) : null,
2979
+ /* @__PURE__ */ jsx34(
2901
2980
  AddCardDialog,
2902
2981
  {
2903
2982
  open: adding,
@@ -2908,7 +2987,7 @@ function PaymentMethodsPanel(props) {
2908
2987
  localization: props.localization
2909
2988
  }
2910
2989
  ),
2911
- /* @__PURE__ */ jsx35(
2990
+ /* @__PURE__ */ jsx34(
2912
2991
  PanelState,
2913
2992
  {
2914
2993
  resource,
@@ -2917,7 +2996,7 @@ function PaymentMethodsPanel(props) {
2917
2996
  isEmpty: (rows) => rows.length === 0,
2918
2997
  emptyTitle: t.paymentMethods.empty,
2919
2998
  emptyDescription: t.paymentMethods.emptyDescription,
2920
- children: (rows) => variant === "table" ? /* @__PURE__ */ jsx35(
2999
+ children: (rows) => variant === "table" ? /* @__PURE__ */ jsx34(
2921
3000
  DataTable,
2922
3001
  {
2923
3002
  tableKey: "paymentMethodsPanel.table",
@@ -2927,9 +3006,9 @@ function PaymentMethodsPanel(props) {
2927
3006
  columns: [
2928
3007
  { key: "card", label: t.paymentMethods.columnCard, render: (card) => cardLabel(card) },
2929
3008
  { key: "expires", label: t.paymentMethods.expires, render: (card) => expiryLabel(card) },
2930
- { key: "default", label: t.paymentMethods.defaultBadge, render: (card) => card.isDefault ? /* @__PURE__ */ jsx35(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null },
2931
- { key: "actions", label: t.common.actions, render: (card) => /* @__PURE__ */ jsxs25("div", { className: "throttle-actions", children: [
2932
- !card.isDefault ? /* @__PURE__ */ jsx35(
3009
+ { key: "default", label: t.paymentMethods.defaultBadge, render: (card) => card.isDefault ? /* @__PURE__ */ jsx34(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null },
3010
+ { key: "actions", label: t.common.actions, render: (card) => /* @__PURE__ */ jsxs24("div", { className: "throttle-actions", children: [
3011
+ !card.isDefault ? /* @__PURE__ */ jsx34(
2933
3012
  Button,
2934
3013
  {
2935
3014
  variant: "secondary",
@@ -2939,7 +3018,7 @@ function PaymentMethodsPanel(props) {
2939
3018
  children: t.paymentMethods.makeDefault
2940
3019
  }
2941
3020
  ) : null,
2942
- /* @__PURE__ */ jsx35(
3021
+ /* @__PURE__ */ jsx34(
2943
3022
  Button,
2944
3023
  {
2945
3024
  variant: "danger",
@@ -2955,13 +3034,13 @@ function PaymentMethodsPanel(props) {
2955
3034
  ] }) }
2956
3035
  ]
2957
3036
  }
2958
- ) : /* @__PURE__ */ jsx35("div", { ...a.el("paymentMethodsPanel.list", listBase), children: rows.map((card) => /* @__PURE__ */ jsxs25("div", { ...a.el("paymentMethodsPanel.item", itemBase), children: [
2959
- /* @__PURE__ */ jsxs25("div", { children: [
2960
- /* @__PURE__ */ jsxs25("div", { className: "throttle-row", children: [
2961
- /* @__PURE__ */ jsx35("strong", { children: cardLabel(card) }),
2962
- card.isDefault ? /* @__PURE__ */ jsx35(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null
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: [
3040
+ /* @__PURE__ */ jsx34("strong", { children: cardLabel(card) }),
3041
+ card.isDefault ? /* @__PURE__ */ jsx34(Badge, { tone: "success", children: t.paymentMethods.defaultBadge }) : null
2963
3042
  ] }),
2964
- card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */ jsxs25("p", { className: "throttle-muted", children: [
3043
+ card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */ jsxs24("p", { className: "throttle-muted", children: [
2965
3044
  t.paymentMethods.expires,
2966
3045
  " ",
2967
3046
  String(card.cardExpMonth).padStart(2, "0"),
@@ -2969,8 +3048,8 @@ function PaymentMethodsPanel(props) {
2969
3048
  card.cardExpYear
2970
3049
  ] }) : null
2971
3050
  ] }),
2972
- /* @__PURE__ */ jsxs25("div", { className: "throttle-actions", children: [
2973
- !card.isDefault ? /* @__PURE__ */ jsx35(
3051
+ /* @__PURE__ */ jsxs24("div", { className: "throttle-actions", children: [
3052
+ !card.isDefault ? /* @__PURE__ */ jsx34(
2974
3053
  Button,
2975
3054
  {
2976
3055
  variant: actionVariant("secondary"),
@@ -2980,7 +3059,7 @@ function PaymentMethodsPanel(props) {
2980
3059
  children: t.paymentMethods.makeDefault
2981
3060
  }
2982
3061
  ) : null,
2983
- /* @__PURE__ */ jsx35(
3062
+ /* @__PURE__ */ jsx34(
2984
3063
  Button,
2985
3064
  {
2986
3065
  variant: actionVariant("danger"),
@@ -3001,7 +3080,7 @@ function PaymentMethodsPanel(props) {
3001
3080
  }
3002
3081
 
3003
3082
  // src/react/components/account/OrdersPanel.tsx
3004
- import { useState as useState18 } from "react";
3083
+ import { useEffect as useEffect8, useState as useState17 } from "react";
3005
3084
 
3006
3085
  // src/react/components/format.ts
3007
3086
  function formatMoney(minorUnits, currency, locale) {
@@ -3033,7 +3112,7 @@ function formatDate(value, locale) {
3033
3112
  }
3034
3113
 
3035
3114
  // src/react/components/account/OrderStatus.tsx
3036
- import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
3115
+ import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
3037
3116
  function copyKey(wire) {
3038
3117
  return wire.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
3039
3118
  }
@@ -3041,21 +3120,21 @@ var ATTENTION_PAYMENT_STATES = /* @__PURE__ */ new Set(["pending", "failed", "di
3041
3120
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["cancelled", "closed", "void", "expired", "voided"]);
3042
3121
  function StatusBadge(props) {
3043
3122
  const label = props.labels[copyKey(props.status)] ?? props.status.replace(/_/g, " ");
3044
- return /* @__PURE__ */ jsx36(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: label });
3123
+ return /* @__PURE__ */ jsx35(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: label });
3045
3124
  }
3046
3125
  function OrderStatus(props) {
3047
3126
  const labels = props.t.orders.statusLabels;
3048
3127
  const payLabels = props.t.orders.paymentLabels;
3049
3128
  const lifecycle = labels[copyKey(props.status)] ?? props.status.replace(/_/g, " ");
3050
3129
  const money = props.paymentStatus ? payLabels[copyKey(props.paymentStatus)] : void 0;
3051
- return /* @__PURE__ */ jsxs26(Fragment6, { children: [
3052
- /* @__PURE__ */ jsx36(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: lifecycle }),
3053
- money ? /* @__PURE__ */ jsx36(Badge, { tone: ATTENTION_PAYMENT_STATES.has(props.paymentStatus) ? "warning" : "neutral", children: money }) : null
3130
+ return /* @__PURE__ */ jsxs25(Fragment7, { children: [
3131
+ /* @__PURE__ */ jsx35(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: lifecycle }),
3132
+ money ? /* @__PURE__ */ jsx35(Badge, { tone: ATTENTION_PAYMENT_STATES.has(props.paymentStatus) ? "warning" : "neutral", children: money }) : null
3054
3133
  ] });
3055
3134
  }
3056
3135
 
3057
3136
  // src/react/components/account/AddressBlock.tsx
3058
- import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
3137
+ import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
3059
3138
  function addressLines(address) {
3060
3139
  if (!address || typeof address !== "object") return [];
3061
3140
  const a = address;
@@ -3075,14 +3154,14 @@ function AddressBlock(props) {
3075
3154
  const a = useAppearance();
3076
3155
  const lines = addressLines(props.address);
3077
3156
  if (lines.length === 0) return null;
3078
- return /* @__PURE__ */ jsxs27("div", { ...a.el(props.elementKey ?? "orderDetail.address", "throttle-addressblock"), children: [
3079
- /* @__PURE__ */ jsx37("h4", { className: "throttle-section__title", children: props.heading }),
3080
- lines.map((l) => /* @__PURE__ */ jsx37("p", { className: "throttle-addressblock__line throttle-muted", children: l }, l))
3157
+ return /* @__PURE__ */ jsxs26("div", { ...a.el(props.elementKey ?? "orderDetail.address", "throttle-addressblock"), children: [
3158
+ /* @__PURE__ */ jsx36("h4", { className: "throttle-section__title", children: props.heading }),
3159
+ lines.map((l) => /* @__PURE__ */ jsx36("p", { className: "throttle-addressblock__line throttle-muted", children: l }, l))
3081
3160
  ] });
3082
3161
  }
3083
3162
 
3084
3163
  // src/react/components/account/OrderTimeline.tsx
3085
- import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
3164
+ import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
3086
3165
  function orderTimeline(order, labels) {
3087
3166
  const entries = [{ label: labels.placed, at: order.createdAt }];
3088
3167
  if (order.completedAt) entries.push({ label: labels.completed, at: order.completedAt });
@@ -3093,32 +3172,40 @@ function orderTimeline(order, labels) {
3093
3172
  function OrderTimeline(props) {
3094
3173
  const a = useAppearance();
3095
3174
  if (props.entries.length <= 1) return null;
3096
- return /* @__PURE__ */ jsxs28("div", { ...a.el("orderDetail.timeline", "throttle-timeline"), children: [
3097
- /* @__PURE__ */ jsx38("h4", { className: "throttle-section__title", children: props.heading }),
3098
- props.entries.map((e) => /* @__PURE__ */ jsxs28("div", { className: "throttle-timeline__row", children: [
3099
- /* @__PURE__ */ jsx38("span", { className: "throttle-timeline__dot", "aria-hidden": "true" }),
3100
- /* @__PURE__ */ jsx38("span", { className: "throttle-timeline__label", children: e.label }),
3101
- /* @__PURE__ */ jsx38("span", { className: "throttle-muted", children: formatDate(e.at, props.locale) })
3175
+ return /* @__PURE__ */ jsxs27("div", { ...a.el("orderDetail.timeline", "throttle-timeline"), children: [
3176
+ /* @__PURE__ */ jsx37("h4", { className: "throttle-section__title", children: props.heading }),
3177
+ props.entries.map((e) => /* @__PURE__ */ jsxs27("div", { className: "throttle-timeline__row", children: [
3178
+ /* @__PURE__ */ jsx37("span", { className: "throttle-timeline__dot", "aria-hidden": "true" }),
3179
+ /* @__PURE__ */ jsx37("span", { className: "throttle-timeline__label", children: e.label }),
3180
+ /* @__PURE__ */ jsx37("span", { className: "throttle-muted", children: formatDate(e.at, props.locale) })
3102
3181
  ] }, `${e.label}-${e.at}`))
3103
3182
  ] });
3104
3183
  }
3105
3184
 
3106
3185
  // src/react/components/account/OrderDetail.tsx
3107
- import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
3186
+ import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
3108
3187
  var CAN_PAY = /* @__PURE__ */ new Set(["draft", "pending"]);
3109
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"]);
3110
3192
  function Line(props) {
3111
- return /* @__PURE__ */ jsxs29("div", { className: "throttle-row", children: [
3112
- /* @__PURE__ */ jsx39("span", { className: "throttle-muted", children: props.label }),
3113
- /* @__PURE__ */ jsx39("span", { children: props.value })
3193
+ return /* @__PURE__ */ jsxs28("div", { className: "throttle-row", children: [
3194
+ /* @__PURE__ */ jsx38("span", { className: "throttle-muted", children: props.label }),
3195
+ /* @__PURE__ */ jsx38("span", { children: props.strong ? /* @__PURE__ */ jsx38("strong", { children: props.value }) : props.value })
3114
3196
  ] });
3115
3197
  }
3116
3198
  function OrderDetail(props) {
3117
3199
  const a = useAppearance(props.appearance);
3118
3200
  const scoped = useAppearanceProviderValue(props.appearance);
3119
3201
  const { t, locale } = useCopy(props.localization);
3202
+ const { account } = useAuth();
3120
3203
  const resource = useOrder(props.orderId);
3121
- return /* @__PURE__ */ jsx39(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx39("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs29("div", { ...a.el("orderDetail.root", "throttle-panel"), children: [
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: [
3122
3209
  props.onBack ? (
3123
3210
  // Wrapped on purpose. The panel is a column flex container, so a
3124
3211
  // direct child stretches to its full width however `width: auto`
@@ -3126,136 +3213,216 @@ function OrderDetail(props) {
3126
3213
  // centred label. The wrapper takes the stretch; the button keeps
3127
3214
  // its own width. A CSS fix would need a compound selector, and
3128
3215
  // those outrank the merchant overrides in `appearance.elements`.
3129
- /* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(Button, { variant: "link", elementKey: "orderDetail.backButton", onClick: props.onBack, children: t.common.back }) })
3216
+ /* @__PURE__ */ jsx38("div", { children: /* @__PURE__ */ jsx38(Button, { variant: "link", elementKey: "orderDetail.backButton", onClick: props.onBack, children: t.common.back }) })
3130
3217
  ) : null,
3131
- /* @__PURE__ */ jsx39(
3218
+ error ? /* @__PURE__ */ jsx38(Alert, { tone: "error", children: error }) : null,
3219
+ /* @__PURE__ */ jsx38(
3132
3220
  PanelState,
3133
3221
  {
3134
3222
  resource,
3135
3223
  isEmpty: (o) => o === null,
3136
3224
  emptyTitle: t.orders.empty,
3137
3225
  skeletonRows: 5,
3138
- children: (order) => /* @__PURE__ */ jsxs29(Fragment7, { children: [
3139
- /* @__PURE__ */ jsxs29("div", { className: "throttle-row", children: [
3140
- /* @__PURE__ */ jsx39("h3", { children: order.orderNumber }),
3141
- /* @__PURE__ */ jsx39(OrderStatus, { status: order.status, paymentStatus: order.paymentStatus, t })
3142
- ] }),
3143
- /* @__PURE__ */ jsx39("p", { className: "throttle-muted", children: formatDate(order.createdAt, locale) }),
3144
- /* @__PURE__ */ jsx39("div", { ...a.el("orderDetail.lineItems", "throttle-stack"), children: order.lineItems.map((item) => /* @__PURE__ */ jsxs29("div", { ...a.el("orderDetail.lineItem", "throttle-lineitem"), children: [
3145
- item.imageUrl ? /* @__PURE__ */ jsx39("img", { className: "throttle-lineitem__image", src: item.imageUrl, alt: "" }) : null,
3146
- /* @__PURE__ */ jsxs29("div", { style: { flex: 1 }, children: [
3147
- /* @__PURE__ */ jsx39("strong", { children: item.name }),
3148
- item.description ? /* @__PURE__ */ jsx39("p", { className: "throttle-muted", children: item.description }) : null,
3149
- /* @__PURE__ */ jsxs29("p", { className: "throttle-muted", children: [
3150
- t.orders.quantity,
3151
- " ",
3152
- item.quantity,
3153
- " \xD7 ",
3154
- formatMoney(item.unitPrice, order.currency, locale)
3155
- ] })
3156
- ] }),
3157
- /* @__PURE__ */ jsx39("span", { children: formatMoney(item.total, order.currency, locale) })
3158
- ] }, item.id)) }),
3159
- /* @__PURE__ */ jsxs29("div", { ...a.el("orderDetail.totals", "throttle-totals"), children: [
3160
- /* @__PURE__ */ jsx39(Line, { label: t.orders.subtotal, value: formatMoney(order.subtotal, order.currency, locale) }),
3161
- order.discountTotal ? /* @__PURE__ */ jsx39(Line, { label: t.orders.discount, value: formatMoney(-order.discountTotal, order.currency, locale) }) : null,
3162
- /* @__PURE__ */ jsx39(Line, { label: t.orders.shipping, value: formatMoney(order.shippingTotal, order.currency, locale) }),
3163
- /* @__PURE__ */ jsx39(Line, { label: t.orders.tax, value: formatMoney(order.taxTotal, order.currency, locale) }),
3164
- /* @__PURE__ */ jsx39(Line, { label: t.orders.total, value: formatMoney(order.total, order.currency, locale) })
3165
- ] }),
3166
- /* @__PURE__ */ jsxs29("div", { ...a.el("orderDetail.addresses", "throttle-addresses"), children: [
3167
- /* @__PURE__ */ jsx39(
3168
- AddressBlock,
3169
- {
3170
- heading: t.orders.shipTo,
3171
- address: order.shippingAddress,
3172
- elementKey: "orderDetail.shippingAddress"
3173
- }
3174
- ),
3175
- /* @__PURE__ */ jsx39(
3176
- AddressBlock,
3177
- {
3178
- heading: t.orders.billTo,
3179
- address: order.billingAddress,
3180
- elementKey: "orderDetail.billingAddress"
3181
- }
3182
- )
3183
- ] }),
3184
- /* @__PURE__ */ jsx39(
3185
- OrderTimeline,
3186
- {
3187
- heading: t.orders.history,
3188
- locale,
3189
- entries: orderTimeline(order, {
3190
- placed: t.orders.placed,
3191
- completed: t.orders.completed,
3192
- cancelled: t.orders.cancelledAt,
3193
- closed: t.orders.closedAt
3194
- })
3195
- }
3196
- ),
3197
- (() => {
3198
- const target = {
3199
- id: order.id,
3200
- orderNumber: order.orderNumber,
3201
- currency: order.currency,
3202
- lineItems: order.lineItems.map((li) => ({
3203
- name: li.name,
3204
- unitPrice: li.unitPrice,
3205
- quantity: li.quantity
3206
- }))
3207
- };
3208
- return /* @__PURE__ */ jsxs29("div", { className: "throttle-actions", children: [
3209
- props.onPayNow && CAN_PAY.has(order.status) ? /* @__PURE__ */ jsx39(
3210
- Button,
3211
- {
3212
- elementKey: "orderDetail.payButton",
3213
- onClick: () => props.onPayNow(target),
3214
- children: t.orders.payNow
3215
- }
3216
- ) : null,
3217
- props.onTrackShipment && order.status === "partially_fulfilled" ? /* @__PURE__ */ jsx39(
3218
- Button,
3219
- {
3220
- variant: "secondary",
3221
- elementKey: "orderDetail.trackButton",
3222
- onClick: () => props.onTrackShipment(target),
3223
- children: t.orders.track
3224
- }
3225
- ) : null,
3226
- props.onReorder && CAN_REORDER.has(order.status) ? /* @__PURE__ */ jsx39(
3227
- 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,
3228
3270
  {
3229
- variant: "secondary",
3230
- elementKey: "orderDetail.reorderButton",
3231
- onClick: () => props.onReorder(target),
3232
- children: t.orders.reorder
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
+ })
3233
3279
  }
3234
- ) : null,
3235
- order.subscriptionId && props.onViewSubscription ? /* @__PURE__ */ jsx39(Button, { variant: "secondary", onClick: () => props.onViewSubscription(order.subscriptionId), children: t.orders.viewSubscription }) : null
3236
- ] });
3237
- })()
3238
- ] })
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
+ }
3239
3403
  }
3240
3404
  )
3241
3405
  ] }) }) });
3242
3406
  }
3243
3407
 
3244
3408
  // src/react/components/account/OrdersPanel.tsx
3245
- import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
3409
+ import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
3246
3410
  function OrdersPanel(props) {
3247
3411
  const a = useAppearance(props.appearance);
3248
3412
  const scoped = useAppearanceProviderValue(props.appearance);
3249
3413
  const { t, locale } = useCopy(props.localization);
3250
3414
  const { emailVerified } = useAuth();
3251
3415
  const resource = useOrders();
3252
- const [openId, setOpenId] = useState18(null);
3416
+ const [openId, setOpenId] = useState17(props.initialOpenId ?? null);
3417
+ useEffect8(() => {
3418
+ if (props.initialOpenId) setOpenId(props.initialOpenId);
3419
+ }, [props.initialOpenId]);
3253
3420
  const variant = props.variant ?? "table";
3254
3421
  const rowsVariant = variant === "rows";
3255
3422
  const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
3256
3423
  const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
3257
3424
  if (openId) {
3258
- return /* @__PURE__ */ jsx40(
3425
+ return /* @__PURE__ */ jsx39(
3259
3426
  OrderDetail,
3260
3427
  {
3261
3428
  orderId: openId,
@@ -3264,12 +3431,14 @@ function OrdersPanel(props) {
3264
3431
  onReorder: props.onReorder,
3265
3432
  onTrackShipment: props.onTrackShipment,
3266
3433
  onViewSubscription: props.onViewSubscription,
3434
+ allowCancel: props.allowCancel,
3435
+ allowReturn: props.allowReturn,
3267
3436
  appearance: props.appearance,
3268
3437
  localization: props.localization
3269
3438
  }
3270
3439
  );
3271
3440
  }
3272
- return /* @__PURE__ */ jsx40(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx40("div", { ...a.rootProps, children: /* @__PURE__ */ jsx40("div", { ...a.el("ordersPanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx40(
3441
+ return /* @__PURE__ */ jsx39(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx39("div", { ...a.rootProps, children: /* @__PURE__ */ jsx39("div", { ...a.el("ordersPanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx39(
3273
3442
  PanelState,
3274
3443
  {
3275
3444
  resource,
@@ -3278,7 +3447,7 @@ function OrdersPanel(props) {
3278
3447
  isEmpty: (rows) => rows.length === 0,
3279
3448
  emptyTitle: t.orders.empty,
3280
3449
  emptyDescription: t.orders.emptyDescription,
3281
- children: (rows) => variant === "table" ? /* @__PURE__ */ jsx40(
3450
+ children: (rows) => variant === "table" ? /* @__PURE__ */ jsx39(
3282
3451
  DataTable,
3283
3452
  {
3284
3453
  tableKey: "ordersPanel.table",
@@ -3292,25 +3461,25 @@ function OrdersPanel(props) {
3292
3461
  {
3293
3462
  key: "status",
3294
3463
  label: t.orders.status,
3295
- render: (o) => /* @__PURE__ */ jsx40(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
3464
+ render: (o) => /* @__PURE__ */ jsx39(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
3296
3465
  },
3297
3466
  {
3298
3467
  key: "total",
3299
3468
  label: t.orders.total,
3300
- render: (o) => /* @__PURE__ */ jsx40("span", { className: "throttle-table__money", children: formatMoney(o.total, o.currency, locale) })
3469
+ render: (o) => /* @__PURE__ */ jsx39("span", { className: "throttle-table__money", children: formatMoney(o.total, o.currency, locale) })
3301
3470
  }
3302
3471
  ]
3303
3472
  }
3304
- ) : /* @__PURE__ */ jsx40("div", { ...a.el("ordersPanel.list", listBase), children: rows.map((o) => /* @__PURE__ */ jsxs30("div", { ...a.el("ordersPanel.item", itemBase), children: [
3305
- /* @__PURE__ */ jsxs30("div", { children: [
3306
- /* @__PURE__ */ jsxs30("div", { className: "throttle-row", children: [
3307
- /* @__PURE__ */ jsx40("strong", { children: o.orderNumber }),
3308
- /* @__PURE__ */ jsx40(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
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: [
3476
+ /* @__PURE__ */ jsx39("strong", { children: o.orderNumber }),
3477
+ /* @__PURE__ */ jsx39(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
3309
3478
  ] }),
3310
- /* @__PURE__ */ jsx40("p", { className: "throttle-muted", children: formatDate(o.createdAt, locale) }),
3311
- /* @__PURE__ */ jsx40("p", { className: "throttle-muted", children: formatMoney(o.total, o.currency, locale) })
3479
+ /* @__PURE__ */ jsx39("p", { className: "throttle-muted", children: formatDate(o.createdAt, locale) }),
3480
+ /* @__PURE__ */ jsx39("p", { className: "throttle-muted", children: formatMoney(o.total, o.currency, locale) })
3312
3481
  ] }),
3313
- /* @__PURE__ */ jsx40("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx40(
3482
+ /* @__PURE__ */ jsx39("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx39(
3314
3483
  Button,
3315
3484
  {
3316
3485
  variant: rowsVariant ? "link" : "secondary",
@@ -3325,14 +3494,15 @@ function OrdersPanel(props) {
3325
3494
  }
3326
3495
 
3327
3496
  // src/react/components/account/InvoicesPanel.tsx
3328
- import { useState as useState19 } from "react";
3497
+ import { useEffect as useEffect9, useState as useState18 } from "react";
3329
3498
 
3330
3499
  // src/react/components/account/InvoiceDetail.tsx
3331
- import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
3500
+ import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
3501
+ var PAYABLE = /* @__PURE__ */ new Set(["open"]);
3332
3502
  function Line2(props) {
3333
- return /* @__PURE__ */ jsxs31("div", { className: "throttle-row", children: [
3334
- /* @__PURE__ */ jsx41("span", { className: "throttle-muted", children: props.label }),
3335
- /* @__PURE__ */ jsx41("span", { children: props.value })
3503
+ return /* @__PURE__ */ jsxs30("div", { className: "throttle-row", children: [
3504
+ /* @__PURE__ */ jsx40("span", { className: "throttle-muted", children: props.label }),
3505
+ /* @__PURE__ */ jsx40("span", { children: props.value })
3336
3506
  ] });
3337
3507
  }
3338
3508
  function InvoiceDetail(props) {
@@ -3342,84 +3512,147 @@ function InvoiceDetail(props) {
3342
3512
  const { account } = useAuth();
3343
3513
  const resource = useInvoice(props.invoiceId);
3344
3514
  const { submitting, error, run } = useAction();
3345
- return /* @__PURE__ */ jsx41(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx41("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs31("div", { ...a.el("invoiceDetail.root", "throttle-panel"), children: [
3515
+ return /* @__PURE__ */ jsx40(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx40("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs30("div", { ...a.el("invoiceDetail.root", "throttle-panel"), children: [
3346
3516
  props.onBack ? (
3347
- // Wrapped on purpose. The panel is a column flex container, so a
3348
- // direct child stretches to its full width however `width: auto`
3349
- // the link variant is — the control rendered 748px wide with a
3350
- // centred label. The wrapper takes the stretch; the button keeps
3351
- // its own width. A CSS fix would need a compound selector, and
3352
- // those outrank the merchant overrides in `appearance.elements`.
3353
- /* @__PURE__ */ jsx41("div", { children: /* @__PURE__ */ jsx41(Button, { variant: "link", elementKey: "invoiceDetail.backButton", onClick: props.onBack, children: t.common.back }) })
3517
+ // Wrapped on purpose — see OrderDetail's back button for why a
3518
+ // direct flex child stretched to 748px.
3519
+ /* @__PURE__ */ jsx40("div", { children: /* @__PURE__ */ jsx40(Button, { variant: "link", elementKey: "invoiceDetail.backButton", onClick: props.onBack, children: t.common.back }) })
3354
3520
  ) : null,
3355
- /* @__PURE__ */ jsx41(PanelState, { resource, isEmpty: (i) => i === null, emptyTitle: t.invoices.empty, skeletonRows: 4, children: (invoice) => /* @__PURE__ */ jsxs31(Fragment8, { children: [
3356
- /* @__PURE__ */ jsxs31("div", { className: "throttle-row", children: [
3357
- /* @__PURE__ */ jsx41("h3", { children: invoice.number }),
3358
- /* @__PURE__ */ jsx41(StatusBadge, { status: invoice.status, labels: t.invoices.statusLabels })
3359
- ] }),
3360
- /* @__PURE__ */ jsxs31("div", { ...a.el("invoiceDetail.totals", "throttle-totals"), children: [
3361
- /* @__PURE__ */ jsx41(Line2, { label: t.invoices.issued, value: formatDate(invoice.issuedAt, locale) }),
3362
- invoice.dueAt ? /* @__PURE__ */ jsx41(Line2, { label: t.invoices.due, value: formatDate(invoice.dueAt, locale) }) : null,
3363
- invoice.periodStart && invoice.periodEnd ? /* @__PURE__ */ jsx41(
3364
- Line2,
3365
- {
3366
- label: t.invoices.period,
3367
- value: `${formatDate(invoice.periodStart, locale)} \u2013 ${formatDate(invoice.periodEnd, locale)}`
3368
- }
3369
- ) : null,
3370
- /* @__PURE__ */ jsx41(Line2, { label: t.invoices.total, value: formatMoney(invoice.total, invoice.currency, locale) }),
3371
- invoice.amountRefunded ? /* @__PURE__ */ jsx41(
3372
- Line2,
3373
- {
3374
- label: t.invoices.refunded,
3375
- value: formatMoney(invoice.amountRefunded, invoice.currency, locale)
3376
- }
3377
- ) : null
3378
- ] }),
3379
- error ? /* @__PURE__ */ jsx41(Alert, { tone: "error", children: error }) : null,
3380
- /* @__PURE__ */ jsx41(
3381
- Button,
3382
- {
3383
- variant: "secondary",
3384
- loading: submitting,
3385
- elementKey: "invoiceDetail.downloadButton",
3386
- onClick: () => void run(async () => {
3387
- const { url } = await account.getInvoicePdfUrl(invoice.id);
3388
- const opened = window.open(url, "_blank", "noopener,noreferrer");
3389
- if (!opened) window.location.assign(url);
3390
- }),
3391
- children: t.invoices.downloadButton
3392
- }
3393
- )
3394
- ] }) })
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
+ } })
3395
3622
  ] }) }) });
3396
3623
  }
3397
3624
 
3398
3625
  // src/react/components/account/InvoicesPanel.tsx
3399
- import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
3626
+ import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
3400
3627
  function InvoicesPanel(props) {
3401
3628
  const a = useAppearance(props.appearance);
3402
3629
  const scoped = useAppearanceProviderValue(props.appearance);
3403
3630
  const { t, locale } = useCopy(props.localization);
3404
3631
  const { emailVerified } = useAuth();
3405
3632
  const resource = useInvoices();
3406
- const [openId, setOpenId] = useState19(null);
3633
+ const [openId, setOpenId] = useState18(props.initialOpenId ?? null);
3634
+ useEffect9(() => {
3635
+ if (props.initialOpenId) setOpenId(props.initialOpenId);
3636
+ }, [props.initialOpenId]);
3407
3637
  const variant = props.variant ?? "table";
3408
3638
  const rowsVariant = variant === "rows";
3409
3639
  const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
3410
3640
  const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
3411
3641
  if (openId) {
3412
- return /* @__PURE__ */ jsx42(
3642
+ return /* @__PURE__ */ jsx41(
3413
3643
  InvoiceDetail,
3414
3644
  {
3415
3645
  invoiceId: openId,
3416
3646
  onBack: () => setOpenId(null),
3647
+ onViewOrder: props.onViewOrder,
3648
+ onViewSubscription: props.onViewSubscription,
3649
+ onPay: props.onPay,
3417
3650
  appearance: props.appearance,
3418
3651
  localization: props.localization
3419
3652
  }
3420
3653
  );
3421
3654
  }
3422
- return /* @__PURE__ */ jsx42(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx42("div", { ...a.rootProps, children: /* @__PURE__ */ jsx42("div", { ...a.el("invoicesPanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx42(
3655
+ return /* @__PURE__ */ jsx41(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx41("div", { ...a.rootProps, children: /* @__PURE__ */ jsx41("div", { ...a.el("invoicesPanel.root", "throttle-panel"), children: /* @__PURE__ */ jsx41(
3423
3656
  PanelState,
3424
3657
  {
3425
3658
  resource,
@@ -3428,7 +3661,7 @@ function InvoicesPanel(props) {
3428
3661
  isEmpty: (rows) => rows.length === 0,
3429
3662
  emptyTitle: t.invoices.empty,
3430
3663
  emptyDescription: t.invoices.emptyDescription,
3431
- children: (rows) => variant === "table" ? /* @__PURE__ */ jsx42(
3664
+ children: (rows) => variant === "table" ? /* @__PURE__ */ jsx41(
3432
3665
  DataTable,
3433
3666
  {
3434
3667
  tableKey: "invoicesPanel.table",
@@ -3439,24 +3672,24 @@ function InvoicesPanel(props) {
3439
3672
  columns: [
3440
3673
  { key: "number", label: t.invoices.number },
3441
3674
  { key: "issuedAt", label: t.invoices.issued, render: (i) => formatDate(i.issuedAt, locale) },
3442
- { key: "status", label: t.invoices.status, render: (i) => /* @__PURE__ */ jsx42(StatusBadge, { status: i.status, labels: t.invoices.statusLabels }) },
3675
+ { key: "status", label: t.invoices.status, render: (i) => /* @__PURE__ */ jsx41(StatusBadge, { status: i.status, labels: t.invoices.statusLabels }) },
3443
3676
  {
3444
3677
  key: "total",
3445
3678
  label: t.invoices.total,
3446
- render: (i) => /* @__PURE__ */ jsx42("span", { className: "throttle-table__money", children: formatMoney(i.total, i.currency, locale) })
3679
+ render: (i) => /* @__PURE__ */ jsx41("span", { className: "throttle-table__money", children: formatMoney(i.total, i.currency, locale) })
3447
3680
  }
3448
3681
  ]
3449
3682
  }
3450
- ) : /* @__PURE__ */ jsx42("div", { ...a.el("invoicesPanel.list", listBase), children: rows.map((i) => /* @__PURE__ */ jsxs32("div", { ...a.el("invoicesPanel.item", itemBase), children: [
3451
- /* @__PURE__ */ jsxs32("div", { children: [
3452
- /* @__PURE__ */ jsxs32("div", { className: "throttle-row", children: [
3453
- /* @__PURE__ */ jsx42("strong", { children: i.number }),
3454
- /* @__PURE__ */ jsx42(StatusBadge, { status: i.status, labels: t.invoices.statusLabels })
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: [
3686
+ /* @__PURE__ */ jsx41("strong", { children: i.number }),
3687
+ /* @__PURE__ */ jsx41(StatusBadge, { status: i.status, labels: t.invoices.statusLabels })
3455
3688
  ] }),
3456
- /* @__PURE__ */ jsx42("p", { className: "throttle-muted", children: formatDate(i.issuedAt, locale) }),
3457
- /* @__PURE__ */ jsx42("p", { className: "throttle-muted", children: formatMoney(i.total, i.currency, locale) })
3689
+ /* @__PURE__ */ jsx41("p", { className: "throttle-muted", children: formatDate(i.issuedAt, locale) }),
3690
+ /* @__PURE__ */ jsx41("p", { className: "throttle-muted", children: formatMoney(i.total, i.currency, locale) })
3458
3691
  ] }),
3459
- /* @__PURE__ */ jsx42("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx42(
3692
+ /* @__PURE__ */ jsx41("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx41(
3460
3693
  Button,
3461
3694
  {
3462
3695
  variant: rowsVariant ? "link" : "secondary",
@@ -3471,10 +3704,18 @@ function InvoicesPanel(props) {
3471
3704
  }
3472
3705
 
3473
3706
  // src/react/components/account/SubscriptionsPanel.tsx
3474
- import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
3707
+ import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
3475
3708
  var CAN_PAUSE = /* @__PURE__ */ new Set(["active", "trialing"]);
3476
3709
  var CAN_RESUME = /* @__PURE__ */ new Set(["paused"]);
3477
- var CAN_CANCEL = /* @__PURE__ */ new Set(["active", "trialing", "paused", "past_due", "unpaid"]);
3710
+ var CAN_CANCEL2 = /* @__PURE__ */ new Set(["active", "trialing", "paused", "past_due", "unpaid"]);
3711
+ var INTERVAL_WORD = {
3712
+ weekly: "week",
3713
+ biweekly: "2 weeks",
3714
+ monthly: "month",
3715
+ quarterly: "quarter",
3716
+ yearly: "year"
3717
+ };
3718
+ var intervalWord = (interval) => INTERVAL_WORD[interval] ?? interval;
3478
3719
  function SubscriptionsPanel(props) {
3479
3720
  const a = useAppearance(props.appearance);
3480
3721
  const scoped = useAppearanceProviderValue(props.appearance);
@@ -3487,17 +3728,17 @@ function SubscriptionsPanel(props) {
3487
3728
  const rowsVariant = variant === "rows";
3488
3729
  const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
3489
3730
  const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
3490
- const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
3731
+ const actionVariant = (base) => base;
3491
3732
  const confirmThen = (fn, ask) => () => {
3492
3733
  void (async () => {
3493
3734
  if (!await confirm({ ...ask, tone: ask.tone ?? "neutral" })) return;
3494
3735
  await run(fn);
3495
3736
  })();
3496
3737
  };
3497
- const priceLabel = (sub) => `${formatMoney(sub.amount, sub.currency, locale)} / ${sub.interval}${sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""}`;
3738
+ const priceLabel = (sub) => `${formatMoney(sub.amount, sub.currency, locale)} / ${intervalWord(sub.interval)}${sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""}`;
3498
3739
  const renewsLabel = (sub) => formatDate(sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd, locale);
3499
- const lifecycleActions = (sub, variantFor) => /* @__PURE__ */ jsxs33("div", { className: "throttle-actions", children: [
3500
- CAN_PAUSE.has(sub.status) ? /* @__PURE__ */ jsx43(
3740
+ const lifecycleActions = (sub, variantFor) => /* @__PURE__ */ jsxs32("div", { className: "throttle-actions", children: [
3741
+ CAN_PAUSE.has(sub.status) ? /* @__PURE__ */ jsx42(
3501
3742
  Button,
3502
3743
  {
3503
3744
  variant: variantFor("secondary"),
@@ -3510,7 +3751,7 @@ function SubscriptionsPanel(props) {
3510
3751
  children: t.subscriptions.pauseButton
3511
3752
  }
3512
3753
  ) : null,
3513
- CAN_RESUME.has(sub.status) ? /* @__PURE__ */ jsx43(
3754
+ CAN_RESUME.has(sub.status) ? /* @__PURE__ */ jsx42(
3514
3755
  Button,
3515
3756
  {
3516
3757
  variant: variantFor("secondary"),
@@ -3523,7 +3764,7 @@ function SubscriptionsPanel(props) {
3523
3764
  children: t.subscriptions.resumeButton
3524
3765
  }
3525
3766
  ) : null,
3526
- CAN_CANCEL.has(sub.status) && !sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx43(
3767
+ CAN_CANCEL2.has(sub.status) && !sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx42(
3527
3768
  Button,
3528
3769
  {
3529
3770
  variant: variantFor("secondary"),
@@ -3537,7 +3778,7 @@ function SubscriptionsPanel(props) {
3537
3778
  children: t.subscriptions.cancelAtPeriodEnd
3538
3779
  }
3539
3780
  ) : null,
3540
- CAN_CANCEL.has(sub.status) ? /* @__PURE__ */ jsx43(
3781
+ CAN_CANCEL2.has(sub.status) ? /* @__PURE__ */ jsx42(
3541
3782
  Button,
3542
3783
  {
3543
3784
  variant: variantFor("danger"),
@@ -3552,9 +3793,9 @@ function SubscriptionsPanel(props) {
3552
3793
  }
3553
3794
  ) : null
3554
3795
  ] });
3555
- return /* @__PURE__ */ jsx43(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx43("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs33("div", { ...a.el("subscriptionsPanel.root", "throttle-panel"), children: [
3556
- error ? /* @__PURE__ */ jsx43(Alert, { tone: "error", children: error }) : null,
3557
- /* @__PURE__ */ jsx43(
3796
+ return /* @__PURE__ */ jsx42(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx42("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs32("div", { ...a.el("subscriptionsPanel.root", "throttle-panel"), children: [
3797
+ error ? /* @__PURE__ */ jsx42(Alert, { tone: "error", children: error }) : null,
3798
+ /* @__PURE__ */ jsx42(
3558
3799
  PanelState,
3559
3800
  {
3560
3801
  resource,
@@ -3563,7 +3804,7 @@ function SubscriptionsPanel(props) {
3563
3804
  isEmpty: (rows) => rows.length === 0,
3564
3805
  emptyTitle: t.subscriptions.empty,
3565
3806
  emptyDescription: t.subscriptions.emptyDescription,
3566
- children: (rows) => variant === "table" ? /* @__PURE__ */ jsx43(
3807
+ children: (rows) => variant === "table" ? /* @__PURE__ */ jsx42(
3567
3808
  DataTable,
3568
3809
  {
3569
3810
  tableKey: "subscriptionsPanel.table",
@@ -3572,42 +3813,42 @@ function SubscriptionsPanel(props) {
3572
3813
  rows,
3573
3814
  columns: [
3574
3815
  { key: "plan", label: t.subscriptions.columnPlan, render: (sub) => sub.planName ?? sub.planReference },
3575
- { key: "price", label: t.subscriptions.columnPrice, render: (sub) => /* @__PURE__ */ jsx43("span", { className: "throttle-table__money", children: priceLabel(sub) }) },
3816
+ { key: "price", label: t.subscriptions.columnPrice, render: (sub) => /* @__PURE__ */ jsx42("span", { className: "throttle-table__money", children: priceLabel(sub) }) },
3576
3817
  { key: "renews", label: t.subscriptions.columnRenews, render: (sub) => renewsLabel(sub) },
3577
- { key: "status", label: t.subscriptions.columnStatus, render: (sub) => /* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
3578
- /* @__PURE__ */ jsx43(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels }),
3579
- sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx43(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
3818
+ { key: "status", label: t.subscriptions.columnStatus, render: (sub) => /* @__PURE__ */ jsxs32("div", { className: "throttle-row", children: [
3819
+ /* @__PURE__ */ jsx42(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels }),
3820
+ sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx42(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
3580
3821
  ] }) },
3581
3822
  { key: "actions", label: t.common.actions, render: (sub) => lifecycleActions(sub, (base) => base) }
3582
3823
  ]
3583
3824
  }
3584
- ) : /* @__PURE__ */ jsx43("div", { ...a.el("subscriptionsPanel.list", listBase), children: rows.map((sub) => /* @__PURE__ */ jsxs33("div", { ...a.el("subscriptionsPanel.item", itemBase), children: [
3585
- /* @__PURE__ */ jsxs33("div", { children: [
3586
- /* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
3587
- /* @__PURE__ */ jsx43("strong", { children: sub.planName ?? sub.planReference }),
3588
- /* @__PURE__ */ jsx43(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels })
3825
+ ) : /* @__PURE__ */ jsx42("div", { ...a.el("subscriptionsPanel.list", listBase), children: rows.map((sub) => /* @__PURE__ */ jsxs32("div", { ...a.el("subscriptionsPanel.item", itemBase), children: [
3826
+ /* @__PURE__ */ jsxs32("div", { children: [
3827
+ /* @__PURE__ */ jsxs32("div", { className: "throttle-row", children: [
3828
+ /* @__PURE__ */ jsx42("strong", { children: sub.planName ?? sub.planReference }),
3829
+ /* @__PURE__ */ jsx42(StatusBadge, { status: sub.status, labels: t.subscriptions.statusLabels })
3589
3830
  ] }),
3590
- /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
3831
+ /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
3591
3832
  formatMoney(sub.amount, sub.currency, locale),
3592
3833
  " / ",
3593
- sub.interval,
3834
+ intervalWord(sub.interval),
3594
3835
  sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""
3595
3836
  ] }),
3596
- sub.status === "cancelled" ? /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
3837
+ sub.status === "cancelled" ? /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
3597
3838
  t.subscriptions.cancelledOn,
3598
3839
  " ",
3599
3840
  formatDate(sub.cancelledAt ?? sub.currentPeriodEnd, locale)
3600
- ] }) : /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
3841
+ ] }) : /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
3601
3842
  sub.cancelAtPeriodEnd ? t.subscriptions.endsOn : t.subscriptions.renewsOn,
3602
3843
  " ",
3603
3844
  formatDate(sub.currentPeriodEnd, locale)
3604
3845
  ] }),
3605
- sub.trialEnd ? /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
3846
+ sub.trialEnd ? /* @__PURE__ */ jsxs32("p", { className: "throttle-muted", children: [
3606
3847
  t.subscriptions.trialEnds,
3607
3848
  " ",
3608
3849
  formatDate(sub.trialEnd, locale)
3609
3850
  ] }) : null,
3610
- sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx43(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
3851
+ sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx42(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
3611
3852
  ] }),
3612
3853
  lifecycleActions(sub, actionVariant)
3613
3854
  ] }, sub.id)) })
@@ -3617,7 +3858,7 @@ function SubscriptionsPanel(props) {
3617
3858
  }
3618
3859
 
3619
3860
  // src/react/components/account/SecurityPanel.tsx
3620
- import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef8, useState as useState20 } from "react";
3861
+ import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef8, useState as useState19 } from "react";
3621
3862
 
3622
3863
  // src/react/components/account/device.ts
3623
3864
  var BROWSERS = [
@@ -3650,7 +3891,7 @@ function describeDevice(userAgent) {
3650
3891
  }
3651
3892
 
3652
3893
  // src/react/components/account/SecurityPanel.tsx
3653
- import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
3894
+ import { Fragment as Fragment8, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
3654
3895
  function SecurityPanel(props) {
3655
3896
  const a = useAppearance(props.appearance);
3656
3897
  const scoped = useAppearanceProviderValue(props.appearance);
@@ -3660,13 +3901,13 @@ function SecurityPanel(props) {
3660
3901
  const rowsVariant = variant === "rows";
3661
3902
  const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
3662
3903
  const revokeVariant = rowsVariant ? "linkDanger" : "danger";
3663
- const [password, setPassword] = useState20("");
3904
+ const [password, setPassword] = useState19("");
3664
3905
  const passwordAction = useAction();
3665
3906
  const sessionAction = useAction();
3666
- const [sessions, setSessions] = useState20(null);
3667
- const [listError, setListError] = useState20(null);
3907
+ const [sessions, setSessions] = useState19(null);
3908
+ const [listError, setListError] = useState19(null);
3668
3909
  const errorMessageRef = useRef8(errorMessage);
3669
- useEffect8(() => {
3910
+ useEffect10(() => {
3670
3911
  errorMessageRef.current = errorMessage;
3671
3912
  });
3672
3913
  const load = useCallback3(async () => {
@@ -3677,12 +3918,12 @@ function SecurityPanel(props) {
3677
3918
  setListError(errorMessageRef.current(err));
3678
3919
  }
3679
3920
  }, [auth]);
3680
- useEffect8(() => {
3921
+ useEffect10(() => {
3681
3922
  void load();
3682
3923
  }, [load]);
3683
3924
  const others = (sessions ?? []).filter((s) => !s.current);
3684
- return /* @__PURE__ */ jsx44(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx44("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs34("div", { ...a.el("securityPanel.root", "throttle-panel"), children: [
3685
- /* @__PURE__ */ jsxs34(
3925
+ return /* @__PURE__ */ jsx43(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx43("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.root", "throttle-panel"), children: [
3926
+ /* @__PURE__ */ jsxs33(
3686
3927
  "form",
3687
3928
  {
3688
3929
  ...a.el("securityPanel.passwordForm", "throttle-stack"),
@@ -3695,8 +3936,8 @@ function SecurityPanel(props) {
3695
3936
  });
3696
3937
  },
3697
3938
  children: [
3698
- /* @__PURE__ */ jsx44("h3", { children: t.security.passwordTitle }),
3699
- /* @__PURE__ */ jsx44(
3939
+ /* @__PURE__ */ jsx43("h3", { children: t.security.passwordTitle }),
3940
+ /* @__PURE__ */ jsx43(
3700
3941
  Field,
3701
3942
  {
3702
3943
  label: t.security.newPassword,
@@ -3707,21 +3948,21 @@ function SecurityPanel(props) {
3707
3948
  onChange: setPassword
3708
3949
  }
3709
3950
  ),
3710
- passwordAction.error ? /* @__PURE__ */ jsx44(Alert, { tone: "error", children: passwordAction.error }) : null,
3711
- passwordAction.notice ? /* @__PURE__ */ jsx44(Alert, { tone: "success", children: passwordAction.notice }) : null,
3712
- /* @__PURE__ */ jsx44(Button, { type: "submit", loading: passwordAction.submitting, elementKey: "securityPanel.passwordButton", children: t.security.changeButton })
3951
+ passwordAction.error ? /* @__PURE__ */ jsx43(Alert, { tone: "error", children: passwordAction.error }) : null,
3952
+ passwordAction.notice ? /* @__PURE__ */ jsx43(Alert, { tone: "success", children: passwordAction.notice }) : null,
3953
+ /* @__PURE__ */ jsx43(Button, { type: "submit", loading: passwordAction.submitting, elementKey: "securityPanel.passwordButton", children: t.security.changeButton })
3713
3954
  ]
3714
3955
  }
3715
3956
  ),
3716
- /* @__PURE__ */ jsxs34("div", { ...a.el("securityPanel.sessionList", "throttle-stack"), children: [
3717
- /* @__PURE__ */ jsx44("h3", { children: t.security.sessionsTitle }),
3718
- listError ? /* @__PURE__ */ jsxs34(Fragment9, { children: [
3719
- /* @__PURE__ */ jsx44(Alert, { tone: "error", children: listError }),
3720
- /* @__PURE__ */ jsx44(Button, { variant: "secondary", onClick: () => void load(), children: t.common.retry })
3957
+ /* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.sessionList", "throttle-stack"), children: [
3958
+ /* @__PURE__ */ jsx43("h3", { children: t.security.sessionsTitle }),
3959
+ listError ? /* @__PURE__ */ jsxs33(Fragment8, { children: [
3960
+ /* @__PURE__ */ jsx43(Alert, { tone: "error", children: listError }),
3961
+ /* @__PURE__ */ jsx43(Button, { variant: "secondary", onClick: () => void load(), children: t.common.retry })
3721
3962
  ] }) : null,
3722
- sessionAction.error ? /* @__PURE__ */ jsx44(Alert, { tone: "error", children: sessionAction.error }) : null,
3723
- sessions === null && !listError ? /* @__PURE__ */ jsx44(Skeleton, { count: 2 }) : null,
3724
- sessions !== null && !listError && variant === "table" ? /* @__PURE__ */ jsx44(
3963
+ sessionAction.error ? /* @__PURE__ */ jsx43(Alert, { tone: "error", children: sessionAction.error }) : null,
3964
+ sessions === null && !listError ? /* @__PURE__ */ jsx43(Skeleton, { count: 2 }) : null,
3965
+ sessions !== null && !listError && variant === "table" ? /* @__PURE__ */ jsx43(
3725
3966
  DataTable,
3726
3967
  {
3727
3968
  tableKey: "securityPanel.table",
@@ -3729,12 +3970,12 @@ function SecurityPanel(props) {
3729
3970
  rowKey: (session) => session.id,
3730
3971
  rows: sessions,
3731
3972
  columns: [
3732
- { key: "device", label: t.security.columnDevice, render: (session) => /* @__PURE__ */ jsxs34("div", { className: "throttle-row", children: [
3733
- /* @__PURE__ */ jsx44("span", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
3734
- session.current ? /* @__PURE__ */ jsx44(Badge, { tone: "success", children: t.security.thisDevice }) : null
3973
+ { key: "device", label: t.security.columnDevice, render: (session) => /* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
3974
+ /* @__PURE__ */ jsx43("span", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
3975
+ session.current ? /* @__PURE__ */ jsx43(Badge, { tone: "success", children: t.security.thisDevice }) : null
3735
3976
  ] }) },
3736
3977
  { key: "lastActive", label: t.security.lastActive, render: (session) => formatDate(session.lastUsedAt, locale) },
3737
- { key: "actions", label: t.common.actions, render: (session) => !session.current ? /* @__PURE__ */ jsx44(
3978
+ { key: "actions", label: t.common.actions, render: (session) => !session.current ? /* @__PURE__ */ jsx43(
3738
3979
  Button,
3739
3980
  {
3740
3981
  variant: "danger",
@@ -3749,19 +3990,19 @@ function SecurityPanel(props) {
3749
3990
  ) : null }
3750
3991
  ]
3751
3992
  }
3752
- ) : (sessions ?? []).map((session) => /* @__PURE__ */ jsxs34("div", { ...a.el("securityPanel.sessionItem", itemBase), children: [
3753
- /* @__PURE__ */ jsxs34("div", { children: [
3754
- /* @__PURE__ */ jsxs34("div", { className: "throttle-row", children: [
3755
- /* @__PURE__ */ jsx44("strong", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
3756
- session.current ? /* @__PURE__ */ jsx44(Badge, { tone: "success", children: t.security.thisDevice }) : null
3993
+ ) : (sessions ?? []).map((session) => /* @__PURE__ */ jsxs33("div", { ...a.el("securityPanel.sessionItem", itemBase), children: [
3994
+ /* @__PURE__ */ jsxs33("div", { children: [
3995
+ /* @__PURE__ */ jsxs33("div", { className: "throttle-row", children: [
3996
+ /* @__PURE__ */ jsx43("strong", { children: describeDevice(session.userAgent) || session.ipPrefix || session.id }),
3997
+ session.current ? /* @__PURE__ */ jsx43(Badge, { tone: "success", children: t.security.thisDevice }) : null
3757
3998
  ] }),
3758
- /* @__PURE__ */ jsxs34("p", { className: "throttle-muted", children: [
3999
+ /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
3759
4000
  t.security.lastActive,
3760
4001
  " ",
3761
4002
  formatDate(session.lastUsedAt, locale)
3762
4003
  ] })
3763
4004
  ] }),
3764
- !session.current ? /* @__PURE__ */ jsx44(
4005
+ !session.current ? /* @__PURE__ */ jsx43(
3765
4006
  Button,
3766
4007
  {
3767
4008
  variant: revokeVariant,
@@ -3775,8 +4016,8 @@ function SecurityPanel(props) {
3775
4016
  }
3776
4017
  ) : null
3777
4018
  ] }, session.id)),
3778
- sessions !== null && others.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "throttle-muted", children: t.security.sessionsEmpty }) : null,
3779
- others.length > 0 ? /* @__PURE__ */ jsx44(
4019
+ sessions !== null && others.length === 0 ? /* @__PURE__ */ jsx43("p", { className: "throttle-muted", children: t.security.sessionsEmpty }) : null,
4020
+ others.length > 0 ? /* @__PURE__ */ jsx43(
3780
4021
  Button,
3781
4022
  {
3782
4023
  variant: "danger",
@@ -3796,7 +4037,7 @@ function SecurityPanel(props) {
3796
4037
  }
3797
4038
 
3798
4039
  // src/react/components/account/AccountDashboard.tsx
3799
- import { Fragment as Fragment10, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
4040
+ import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
3800
4041
  var ACCOUNT_TABS = [
3801
4042
  "profile",
3802
4043
  "addresses",
@@ -3825,9 +4066,10 @@ function AccountDashboard(props) {
3825
4066
  const { status } = useAuth();
3826
4067
  const shown = props.tabs ?? [...ACCOUNT_TABS];
3827
4068
  const controlled = props.tab !== void 0;
3828
- const [internal, setInternal] = useState21(shown[0] ?? "profile");
3829
- const idBase = useId6();
3830
- useEffect9(() => {
4069
+ const [internal, setInternal] = useState20(shown[0] ?? "profile");
4070
+ const [openOrderId, setOpenOrderId] = useState20(null);
4071
+ const idBase = useId5();
4072
+ useEffect11(() => {
3831
4073
  if (props.routing !== "hash" || typeof window === "undefined") return;
3832
4074
  const apply = () => {
3833
4075
  const next = TAB_FOR_HASH[window.location.hash] ?? shown[0];
@@ -3848,7 +4090,7 @@ function AccountDashboard(props) {
3848
4090
  };
3849
4091
  const shared = { appearance: props.appearance, localization: props.localization };
3850
4092
  const sidebar = (props.layout ?? "sidebar") === "sidebar";
3851
- const nav = /* @__PURE__ */ jsx45(
4093
+ const nav = /* @__PURE__ */ jsx44(
3852
4094
  Tabs,
3853
4095
  {
3854
4096
  idBase,
@@ -3864,7 +4106,7 @@ function AccountDashboard(props) {
3864
4106
  }))
3865
4107
  }
3866
4108
  );
3867
- const panel = /* @__PURE__ */ jsxs35(
4109
+ const panel = /* @__PURE__ */ jsxs34(
3868
4110
  "div",
3869
4111
  {
3870
4112
  ...a.el("accountDashboard.panel", sidebar ? "throttle-account__content" : "throttle-tabs__panel"),
@@ -3873,46 +4115,58 @@ function AccountDashboard(props) {
3873
4115
  "aria-labelledby": `${idBase}-tab-${active}`,
3874
4116
  tabIndex: 0,
3875
4117
  children: [
3876
- active === "profile" ? /* @__PURE__ */ jsx45(ProfilePanel, { ...shared }) : null,
3877
- active === "addresses" ? /* @__PURE__ */ jsx45(AddressesPanel, { ...shared, variant: props.panelVariant }) : null,
3878
- active === "paymentMethods" ? /* @__PURE__ */ jsx45(PaymentMethodsPanel, { ...shared, variant: props.panelVariant }) : null,
3879
- active === "orders" ? /* @__PURE__ */ jsx45(
4118
+ active === "profile" ? /* @__PURE__ */ jsx44(ProfilePanel, { ...shared }) : null,
4119
+ active === "addresses" ? /* @__PURE__ */ jsx44(AddressesPanel, { ...shared, variant: props.panelVariant }) : null,
4120
+ active === "paymentMethods" ? /* @__PURE__ */ jsx44(PaymentMethodsPanel, { ...shared, variant: props.panelVariant }) : null,
4121
+ active === "orders" ? /* @__PURE__ */ jsx44(
3880
4122
  OrdersPanel,
3881
4123
  {
3882
4124
  ...shared,
3883
4125
  variant: props.panelVariant,
4126
+ initialOpenId: openOrderId,
3884
4127
  onViewSubscription: () => go("subscriptions"),
3885
4128
  onPayNow: props.onPayNow,
3886
4129
  onReorder: props.onReorder,
3887
4130
  onTrackShipment: props.onTrackShipment
3888
4131
  }
3889
4132
  ) : null,
3890
- active === "invoices" ? /* @__PURE__ */ jsx45(InvoicesPanel, { ...shared, variant: props.panelVariant }) : null,
3891
- active === "subscriptions" ? /* @__PURE__ */ jsx45(SubscriptionsPanel, { ...shared, variant: props.panelVariant }) : null,
3892
- active === "security" ? /* @__PURE__ */ jsx45(SecurityPanel, { ...shared, variant: props.panelVariant }) : null
4133
+ active === "invoices" ? /* @__PURE__ */ jsx44(
4134
+ InvoicesPanel,
4135
+ {
4136
+ ...shared,
4137
+ variant: props.panelVariant,
4138
+ onViewOrder: (orderId) => {
4139
+ setOpenOrderId(orderId);
4140
+ go("orders");
4141
+ },
4142
+ onViewSubscription: () => go("subscriptions")
4143
+ }
4144
+ ) : null,
4145
+ active === "subscriptions" ? /* @__PURE__ */ jsx44(SubscriptionsPanel, { ...shared, variant: props.panelVariant }) : null,
4146
+ active === "security" ? /* @__PURE__ */ jsx44(SecurityPanel, { ...shared, variant: props.panelVariant }) : null
3893
4147
  ]
3894
4148
  }
3895
4149
  );
3896
- return /* @__PURE__ */ jsx45(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx45("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs35("div", { ...a.el("accountDashboard.root", "throttle-panel throttle-account-root"), children: [
3897
- /* @__PURE__ */ jsx45(VerifyEmailBanner, { ...shared }),
3898
- sidebar ? /* @__PURE__ */ jsxs35("div", { className: "throttle-account", children: [
3899
- /* @__PURE__ */ jsx45("div", { ...a.el("accountDashboard.sidebar"), children: nav }),
4150
+ 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: [
4151
+ /* @__PURE__ */ jsx44(VerifyEmailBanner, { ...shared }),
4152
+ sidebar ? /* @__PURE__ */ jsxs34("div", { className: "throttle-account", children: [
4153
+ /* @__PURE__ */ jsx44("div", { ...a.el("accountDashboard.sidebar"), children: nav }),
3900
4154
  panel
3901
- ] }) : /* @__PURE__ */ jsxs35(Fragment10, { children: [
3902
- /* @__PURE__ */ jsx45("div", { ...a.el("accountDashboard.tabs"), children: nav }),
4155
+ ] }) : /* @__PURE__ */ jsxs34(Fragment9, { children: [
4156
+ /* @__PURE__ */ jsx44("div", { ...a.el("accountDashboard.tabs"), children: nav }),
3903
4157
  panel
3904
4158
  ] })
3905
4159
  ] }) }) });
3906
4160
  }
3907
4161
 
3908
4162
  // src/react/components/account/AccountModal.tsx
3909
- import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
4163
+ import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
3910
4164
  function AccountModal(props) {
3911
4165
  const a = useAppearance(props.appearance);
3912
4166
  const scoped = useAppearanceProviderValue(props.appearance);
3913
4167
  const { t } = useCopy(props.localization);
3914
- const titleId = useId7();
3915
- return /* @__PURE__ */ jsx46(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs36(
4168
+ const titleId = useId6();
4169
+ return /* @__PURE__ */ jsx45(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs35(
3916
4170
  Modal,
3917
4171
  {
3918
4172
  open: props.open,
@@ -3922,15 +4176,15 @@ function AccountModal(props) {
3922
4176
  overlayKey: "accountModal.overlay",
3923
4177
  containerKey: "accountModal.container",
3924
4178
  children: [
3925
- /* @__PURE__ */ jsx46("div", { ...a.el("accountModal.header", "throttle-modal__header"), children: /* @__PURE__ */ jsx46("h2", { id: titleId, ...a.el("accountModal.title", "throttle-modal__title"), children: t.account.title }) }),
3926
- /* @__PURE__ */ jsx46("div", { ...a.el("accountModal.body", "throttle-modal__body"), children: /* @__PURE__ */ jsx46(AccountDashboard, { tabs: props.tabs, appearance: props.appearance, localization: props.localization }) })
4179
+ /* @__PURE__ */ jsx45("div", { ...a.el("accountModal.header", "throttle-modal__header"), children: /* @__PURE__ */ jsx45("h2", { id: titleId, ...a.el("accountModal.title", "throttle-modal__title"), children: t.account.title }) }),
4180
+ /* @__PURE__ */ jsx45("div", { ...a.el("accountModal.body", "throttle-modal__body"), children: /* @__PURE__ */ jsx45(AccountDashboard, { tabs: props.tabs, appearance: props.appearance, localization: props.localization }) })
3927
4181
  ]
3928
4182
  }
3929
4183
  ) });
3930
4184
  }
3931
4185
 
3932
4186
  // src/react/components/provider.tsx
3933
- import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
4187
+ import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
3934
4188
  var warned = /* @__PURE__ */ new Set();
3935
4189
  function warnOnce(key, message) {
3936
4190
  if (process.env.NODE_ENV === "production") return;
@@ -3975,13 +4229,13 @@ function ThrottleProvider(props) {
3975
4229
  __captureStepUp
3976
4230
  } = props;
3977
4231
  useInjectStyles(injectStyles);
3978
- const [stepUpOpen, setStepUpOpen] = useState22(false);
4232
+ const [stepUpOpen, setStepUpOpen] = useState21(false);
3979
4233
  const resolveStepUp = useRef9(null);
3980
4234
  const claimRef = useRef9(claimCartOnSignIn);
3981
4235
  claimRef.current = claimCartOnSignIn;
3982
- const [overlay, setOverlay] = useState22(null);
4236
+ const [overlay, setOverlay] = useState21(null);
3983
4237
  const overlayRestoreFocus = useRef9(null);
3984
- const [accountTabs, setAccountTabs] = useState22(void 0);
4238
+ const [accountTabs, setAccountTabs] = useState21(void 0);
3985
4239
  const onOverlaySuccess = useRef9(null);
3986
4240
  const openSignIn = useCallback4((onSuccess) => {
3987
4241
  onOverlaySuccess.current = onSuccess ?? null;
@@ -4052,10 +4306,9 @@ function ThrottleProvider(props) {
4052
4306
  resolve?.(password);
4053
4307
  };
4054
4308
  const authOverlayOpen = overlay === "signIn" || overlay === "signUp";
4055
- return /* @__PURE__ */ jsx47(AppearanceProvider, { value: appearance ?? {}, children: /* @__PURE__ */ jsx47(LocalizationProvider, { value: localization ?? {}, children: /* @__PURE__ */ jsx47(BrandLogoProvider, { value: logo ?? null, children: /* @__PURE__ */ jsx47(ThrottleAuthProvider, { auth, publishableKey, children: /* @__PURE__ */ jsx47(ConfirmProvider, { children: /* @__PURE__ */ jsxs37(ThrottleUIContext.Provider, { value: ui, children: [
4309
+ 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: [
4056
4310
  children,
4057
- /* @__PURE__ */ jsx47(StepUpDialog, { open: stepUpOpen, onResolve: finishStepUp }),
4058
- /* @__PURE__ */ jsx47(
4311
+ /* @__PURE__ */ jsx46(
4059
4312
  AuthModal,
4060
4313
  {
4061
4314
  open: authOverlayOpen,
@@ -4066,10 +4319,14 @@ function ThrottleProvider(props) {
4066
4319
  },
4067
4320
  overlay === "signUp" ? "signUp" : "signIn"
4068
4321
  ),
4069
- /* @__PURE__ */ jsx47(AccountModal, { open: overlay === "account", onClose: closeOverlay, tabs: accountTabs, restoreFocusTo: overlayRestoreFocus.current })
4322
+ /* @__PURE__ */ jsx46(AccountModal, { open: overlay === "account", onClose: closeOverlay, tabs: accountTabs, restoreFocusTo: overlayRestoreFocus.current })
4070
4323
  ] }) }) }) }) }) });
4071
4324
  }
4072
4325
 
4326
+ // src/react/components/auth/StepUpDialog.tsx
4327
+ import { useEffect as useEffect12, useId as useId7, useState as useState22 } from "react";
4328
+ import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
4329
+
4073
4330
  // src/react/components/auth/SignInButton.tsx
4074
4331
  import { cloneElement, isValidElement, useContext as useContext7, useState as useState23 } from "react";
4075
4332
  import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -4220,21 +4477,21 @@ function SignUpPage(props) {
4220
4477
  }
4221
4478
 
4222
4479
  // src/react/components/guards.tsx
4223
- import { Fragment as Fragment11, jsx as jsx53 } from "react/jsx-runtime";
4480
+ import { Fragment as Fragment10, jsx as jsx53 } from "react/jsx-runtime";
4224
4481
  function SignedIn(props) {
4225
4482
  const { status } = useAuth();
4226
- return status === "authenticated" ? /* @__PURE__ */ jsx53(Fragment11, { children: props.children }) : null;
4483
+ return status === "authenticated" ? /* @__PURE__ */ jsx53(Fragment10, { children: props.children }) : null;
4227
4484
  }
4228
4485
  function SignedOut(props) {
4229
4486
  const { status } = useAuth();
4230
- return status === "unauthenticated" ? /* @__PURE__ */ jsx53(Fragment11, { children: props.children }) : null;
4487
+ return status === "unauthenticated" ? /* @__PURE__ */ jsx53(Fragment10, { children: props.children }) : null;
4231
4488
  }
4232
4489
  function Protect(props) {
4233
4490
  const { status, emailVerified } = useAuth();
4234
4491
  if (status === "loading") return null;
4235
- if (status !== "authenticated") return /* @__PURE__ */ jsx53(Fragment11, { children: props.fallback ?? null });
4236
- if (props.requireVerified && !emailVerified) return /* @__PURE__ */ jsx53(Fragment11, { children: props.fallback ?? null });
4237
- return /* @__PURE__ */ jsx53(Fragment11, { children: props.children });
4492
+ if (status !== "authenticated") return /* @__PURE__ */ jsx53(Fragment10, { children: props.fallback ?? null });
4493
+ if (props.requireVerified && !emailVerified) return /* @__PURE__ */ jsx53(Fragment10, { children: props.fallback ?? null });
4494
+ return /* @__PURE__ */ jsx53(Fragment10, { children: props.children });
4238
4495
  }
4239
4496
 
4240
4497
  // src/react/components/UserButton.tsx