@usethrottle/auth 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/components/index.cjs +961 -684
- package/dist/react/components/index.cjs.map +1 -1
- package/dist/react/components/index.d.cts +56 -10
- package/dist/react/components/index.d.ts +56 -10
- package/dist/react/components/index.js +933 -656
- package/dist/react/components/index.js.map +1 -1
- package/dist/styles.css +12 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "../../chunk-NCSTIPJF.js";
|
|
25
25
|
|
|
26
26
|
// src/react/components/provider.tsx
|
|
27
|
-
import { createContext as
|
|
27
|
+
import { createContext as createContext6, useCallback as useCallback4, useContext as useContext6, useMemo as useMemo4, useRef as useRef9, useState as useState22 } from "react";
|
|
28
28
|
|
|
29
29
|
// src/react/components/appearance.tsx
|
|
30
30
|
import { createContext, useContext, useMemo } from "react";
|
|
@@ -144,6 +144,10 @@ var VARIABLE_PROPERTY = {
|
|
|
144
144
|
// colorBackground/colorSurface because a merchant embedding the dashboard
|
|
145
145
|
// in their page usually wants it to paint nothing at all, while still
|
|
146
146
|
// theming the cards inside it.
|
|
147
|
+
// How wide the auth card (sign-in, sign-up, forgot-password) is allowed
|
|
148
|
+
// to grow. It was pinned at 400px, which is narrow for a page that is
|
|
149
|
+
// nothing but that card.
|
|
150
|
+
cardWidth: "--throttle-card-width",
|
|
147
151
|
accountSurface: "--throttle-color-account-surface",
|
|
148
152
|
accountPadding: "--throttle-account-padding",
|
|
149
153
|
shadowCard: "--throttle-shadow-card",
|
|
@@ -282,6 +286,19 @@ var THROTTLE_ELEMENT_KEYS = [
|
|
|
282
286
|
"paymentMethodsPanel.deleteButton",
|
|
283
287
|
"paymentMethodsPanel.addButton",
|
|
284
288
|
"paymentMethodsPanel.addDialog",
|
|
289
|
+
"orderDetail.addresses",
|
|
290
|
+
"orderDetail.shippingAddress",
|
|
291
|
+
"orderDetail.billingAddress",
|
|
292
|
+
"orderDetail.timeline",
|
|
293
|
+
"orderDetail.payButton",
|
|
294
|
+
"orderDetail.trackButton",
|
|
295
|
+
"orderDetail.reorderButton",
|
|
296
|
+
"fieldRow",
|
|
297
|
+
"confirm.header",
|
|
298
|
+
"confirm.title",
|
|
299
|
+
"confirm.body",
|
|
300
|
+
"confirm.confirmButton",
|
|
301
|
+
"confirm.cancelButton",
|
|
285
302
|
"paymentMethodsPanel.table",
|
|
286
303
|
"paymentMethodsPanel.row",
|
|
287
304
|
"ordersPanel.root",
|
|
@@ -395,6 +412,9 @@ var enUS = {
|
|
|
395
412
|
loading: "Loading\u2026",
|
|
396
413
|
close: "Close",
|
|
397
414
|
confirm: "Are you sure?",
|
|
415
|
+
// The dismissive half of a confirmation. "Cancel" is ambiguous next to
|
|
416
|
+
// "Cancel subscription" — one dismisses the dialog, the other ends the plan.
|
|
417
|
+
keepIt: "Keep it",
|
|
398
418
|
somethingWentWrong: "Something went wrong.",
|
|
399
419
|
actions: "Actions",
|
|
400
420
|
view: "View"
|
|
@@ -492,6 +512,7 @@ var enUS = {
|
|
|
492
512
|
addButton: "Add address",
|
|
493
513
|
defaultBadge: "Default",
|
|
494
514
|
makeDefault: "Make default",
|
|
515
|
+
deleteConfirmAction: "Delete address",
|
|
495
516
|
empty: "No saved addresses",
|
|
496
517
|
emptyDescription: "Addresses you use at checkout can be saved here.",
|
|
497
518
|
label: "Label",
|
|
@@ -521,9 +542,20 @@ var enUS = {
|
|
|
521
542
|
makeDefault: "Make default",
|
|
522
543
|
expires: "Expires",
|
|
523
544
|
deleteConfirm: "Remove this card?",
|
|
545
|
+
deleteConfirmAction: "Remove card",
|
|
524
546
|
columnCard: "Card"
|
|
525
547
|
},
|
|
526
548
|
orders: {
|
|
549
|
+
shipTo: "Ship to",
|
|
550
|
+
billTo: "Bill to",
|
|
551
|
+
history: "History",
|
|
552
|
+
placed: "Order placed",
|
|
553
|
+
completed: "Completed",
|
|
554
|
+
cancelledAt: "Cancelled",
|
|
555
|
+
closedAt: "Closed",
|
|
556
|
+
payNow: "Pay now",
|
|
557
|
+
track: "Track shipment",
|
|
558
|
+
reorder: "Order again",
|
|
527
559
|
empty: "No orders yet",
|
|
528
560
|
emptyDescription: "Orders you place will appear here.",
|
|
529
561
|
gatedDescription: "Verify your email to see your order history.",
|
|
@@ -592,6 +624,12 @@ var enUS = {
|
|
|
592
624
|
downloadUnavailable: "This invoice is not available to download right now."
|
|
593
625
|
},
|
|
594
626
|
subscriptions: {
|
|
627
|
+
cancelConfirmAction: "Cancel plan",
|
|
628
|
+
pauseConfirm: "Pause this subscription?",
|
|
629
|
+
resumeConfirm: "Resume this subscription?",
|
|
630
|
+
// Distinct from cancelConfirm: ending it now is not the same promise as
|
|
631
|
+
// letting it run to the end of a period the buyer already paid for.
|
|
632
|
+
cancelNowConfirm: "End this subscription immediately?",
|
|
595
633
|
empty: "No subscriptions",
|
|
596
634
|
emptyDescription: "Subscriptions will appear here.",
|
|
597
635
|
gatedDescription: "Verify your email to see your subscriptions.",
|
|
@@ -713,6 +751,7 @@ var THROTTLE_STYLES = `
|
|
|
713
751
|
merchant's page without fighting their background. The accountSurface and
|
|
714
752
|
accountPadding appearance variables opt back into a card.
|
|
715
753
|
No backticks in this comment: the sheet is a TS template literal. */
|
|
754
|
+
--throttle-card-width: 400px;
|
|
716
755
|
--throttle-color-account-surface: transparent;
|
|
717
756
|
--throttle-account-padding: 0;
|
|
718
757
|
--throttle-color-border-control: #8b93a1;
|
|
@@ -813,7 +852,7 @@ var THROTTLE_STYLES = `
|
|
|
813
852
|
box-shadow: var(--throttle-shadow-card);
|
|
814
853
|
padding: var(--throttle-space-5);
|
|
815
854
|
width: 100%;
|
|
816
|
-
max-width:
|
|
855
|
+
max-width: var(--throttle-card-width);
|
|
817
856
|
margin-inline: auto;
|
|
818
857
|
}
|
|
819
858
|
/* Inside a Modal the dialog already provides the surface \u2014 background, radius
|
|
@@ -1017,6 +1056,14 @@ var THROTTLE_STYLES = `
|
|
|
1017
1056
|
is near-white, so on a light host page it was rendering white-on-white. */
|
|
1018
1057
|
.throttle-cardframe { width: 100%; min-height: 420px; border: 0; display: block; }
|
|
1019
1058
|
.throttle-centre { display: flex; align-items: center; justify-content: center; min-height: 160px; }
|
|
1059
|
+
.throttle-fieldrow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--throttle-space-4); align-items: start; }
|
|
1060
|
+
.throttle-section__title { font-size: var(--throttle-font-size-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--throttle-color-muted-foreground); margin: 0 0 var(--throttle-space-2); font-weight: 600; }
|
|
1061
|
+
.throttle-addresses { display: grid; grid-template-columns: 1fr 1fr; gap: var(--throttle-space-5); }
|
|
1062
|
+
.throttle-addressblock__line { margin: 0 0 2px; }
|
|
1063
|
+
.throttle-timeline { display: flex; flex-direction: column; gap: var(--throttle-space-2); }
|
|
1064
|
+
.throttle-timeline__row { display: flex; align-items: center; gap: var(--throttle-space-2); }
|
|
1065
|
+
.throttle-timeline__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--throttle-color-border-control); flex: none; }
|
|
1066
|
+
.throttle-timeline__label { flex: 1; }
|
|
1020
1067
|
.throttle-account-root { container-type: inline-size; background: var(--throttle-color-account-surface); color: var(--throttle-color-foreground); padding: var(--throttle-account-padding); }
|
|
1021
1068
|
.throttle-account { display: flex; gap: var(--throttle-space-5); align-items: flex-start; }
|
|
1022
1069
|
.throttle-account__content { flex: 1; min-width: 0; }
|
|
@@ -1054,6 +1101,8 @@ var THROTTLE_STYLES = `
|
|
|
1054
1101
|
it shrinks the rail to its content width, so width:100% alone cannot make
|
|
1055
1102
|
it span. Stretch it explicitly when stacked. */
|
|
1056
1103
|
.throttle-account { flex-direction: column; align-items: stretch; gap: var(--throttle-space-4); }
|
|
1104
|
+
.throttle-addresses { grid-template-columns: 1fr; }
|
|
1105
|
+
.throttle-fieldrow { grid-template-columns: 1fr; }
|
|
1057
1106
|
.throttle-tabs__rail { width: 100%; }
|
|
1058
1107
|
}
|
|
1059
1108
|
|
|
@@ -1156,61 +1205,44 @@ function useInjectStyles(enabled) {
|
|
|
1156
1205
|
}, [enabled]);
|
|
1157
1206
|
}
|
|
1158
1207
|
|
|
1159
|
-
// src/react/components/auth/StepUpDialog.tsx
|
|
1160
|
-
import { useEffect as useEffect3, useId as useId2, useState as useState3 } from "react";
|
|
1161
|
-
|
|
1162
|
-
// src/react/components/surface.tsx
|
|
1163
|
-
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1164
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1165
|
-
var Ctx4 = createContext4("standalone");
|
|
1166
|
-
function SurfaceProvider(props) {
|
|
1167
|
-
return /* @__PURE__ */ jsx4(Ctx4.Provider, { value: props.value, children: props.children });
|
|
1168
|
-
}
|
|
1169
|
-
function useSurface() {
|
|
1170
|
-
return useContext4(Ctx4);
|
|
1171
|
-
}
|
|
1172
|
-
function useCardClass() {
|
|
1173
|
-
return useSurface() === "modal" ? "throttle-card throttle-card--bare" : "throttle-card";
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
1208
|
// src/react/components/primitives/Card.tsx
|
|
1177
|
-
import { jsx as
|
|
1209
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
1178
1210
|
function CardHeader(props) {
|
|
1179
1211
|
const a = useAppearance();
|
|
1180
1212
|
const headerClass = `throttle-card__header${props.branded ? " throttle-card__header--branded" : ""}`;
|
|
1181
1213
|
const titleClass = `throttle-card__title${props.branded ? " throttle-card__title--branded" : ""}`;
|
|
1182
1214
|
return /* @__PURE__ */ jsxs("div", { ...a.el("card.header", headerClass), children: [
|
|
1183
|
-
props.logo ? /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
props.description ? /* @__PURE__ */
|
|
1215
|
+
props.logo ? /* @__PURE__ */ jsx4("div", { ...a.el(props.logoKey ?? "card.logo", "throttle-card__logo"), children: props.logo }) : null,
|
|
1216
|
+
/* @__PURE__ */ jsx4("h2", { ...a.el(props.titleKey ?? "card.title", titleClass), children: props.title }),
|
|
1217
|
+
props.description ? /* @__PURE__ */ jsx4("p", { ...a.el("card.description", "throttle-card__description"), children: props.description }) : null
|
|
1186
1218
|
] });
|
|
1187
1219
|
}
|
|
1188
1220
|
function CardBody(props) {
|
|
1189
1221
|
const a = useAppearance();
|
|
1190
|
-
return /* @__PURE__ */
|
|
1222
|
+
return /* @__PURE__ */ jsx4("div", { ...a.el("card.body", "throttle-card__body"), children: props.children });
|
|
1191
1223
|
}
|
|
1192
1224
|
function CardFooter(props) {
|
|
1193
1225
|
const a = useAppearance();
|
|
1194
1226
|
const className = `throttle-card__footer${props.ruled ? " throttle-card__footer--ruled" : ""}`;
|
|
1195
|
-
return /* @__PURE__ */
|
|
1227
|
+
return /* @__PURE__ */ jsx4("div", { ...a.el("card.footer", className), children: props.children });
|
|
1196
1228
|
}
|
|
1197
1229
|
|
|
1198
1230
|
// src/react/components/primitives/Spinner.tsx
|
|
1199
|
-
import { jsx as
|
|
1231
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1200
1232
|
function Spinner({ centred } = {}) {
|
|
1201
1233
|
const a = useAppearance();
|
|
1202
1234
|
const Slot = a.slots.Spinner;
|
|
1203
|
-
if (Slot) return /* @__PURE__ */
|
|
1235
|
+
if (Slot) return /* @__PURE__ */ jsx5(Slot, {});
|
|
1204
1236
|
const cls = `throttle-spinner${centred ? " throttle-spinner--centred" : ""}`;
|
|
1205
|
-
return /* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ jsx5("span", { ...a.el("spinner", cls), "aria-hidden": "true" });
|
|
1206
1238
|
}
|
|
1207
1239
|
|
|
1208
1240
|
// src/react/components/primitives/Button.tsx
|
|
1209
|
-
import { jsx as
|
|
1241
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1210
1242
|
function Button({ variant = "primary", size = "default", elementKey, loading, children, ...rest }) {
|
|
1211
1243
|
const a = useAppearance();
|
|
1212
1244
|
const Slot = a.slots.Button;
|
|
1213
|
-
if (Slot) return /* @__PURE__ */
|
|
1245
|
+
if (Slot) return /* @__PURE__ */ jsx6(Slot, { variant, loading, ...rest, children });
|
|
1214
1246
|
const base = `throttle-button throttle-button--${variant}${size === "xs" ? " throttle-button--xs" : ""}${loading ? " throttle-button--loading" : ""}`;
|
|
1215
1247
|
return /* @__PURE__ */ jsxs2(
|
|
1216
1248
|
"button",
|
|
@@ -1221,8 +1253,8 @@ function Button({ variant = "primary", size = "default", elementKey, loading, ch
|
|
|
1221
1253
|
disabled: rest.disabled || loading,
|
|
1222
1254
|
"aria-busy": loading ? true : void 0,
|
|
1223
1255
|
children: [
|
|
1224
|
-
loading ? /* @__PURE__ */
|
|
1225
|
-
/* @__PURE__ */
|
|
1256
|
+
loading ? /* @__PURE__ */ jsx6(Spinner, { centred: true }) : null,
|
|
1257
|
+
/* @__PURE__ */ jsx6("span", { className: `throttle-button__label${loading ? " throttle-button__label--hidden" : ""}`, children })
|
|
1226
1258
|
]
|
|
1227
1259
|
}
|
|
1228
1260
|
);
|
|
@@ -1230,7 +1262,7 @@ function Button({ variant = "primary", size = "default", elementKey, loading, ch
|
|
|
1230
1262
|
|
|
1231
1263
|
// src/react/components/primitives/Field.tsx
|
|
1232
1264
|
import { Children, Fragment, useId } from "react";
|
|
1233
|
-
import { jsx as
|
|
1265
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1234
1266
|
function Field(props) {
|
|
1235
1267
|
const a = useAppearance();
|
|
1236
1268
|
const base = useId();
|
|
@@ -1238,13 +1270,13 @@ function Field(props) {
|
|
|
1238
1270
|
const hintId = `${base}-hint`;
|
|
1239
1271
|
const errorId = `${base}-error`;
|
|
1240
1272
|
const describedBy = [props.hint ? hintId : null, props.error ? errorId : null].filter(Boolean).join(" ");
|
|
1241
|
-
const label = /* @__PURE__ */
|
|
1273
|
+
const label = /* @__PURE__ */ jsx7("label", { ...a.el("field.label", "throttle-field__label"), htmlFor: inputId, children: props.label });
|
|
1242
1274
|
return /* @__PURE__ */ jsxs3("div", { ...a.el(props.elementKey ?? "field", "throttle-field"), children: [
|
|
1243
1275
|
props.labelExtra ? /* @__PURE__ */ jsxs3("div", { className: "throttle-field__labelrow", children: [
|
|
1244
1276
|
label,
|
|
1245
1277
|
props.labelExtra
|
|
1246
1278
|
] }) : label,
|
|
1247
|
-
/* @__PURE__ */
|
|
1279
|
+
/* @__PURE__ */ jsx7(
|
|
1248
1280
|
"input",
|
|
1249
1281
|
{
|
|
1250
1282
|
...a.el("field.input", `throttle-field__input${props.grouped ? " throttle-field__input--grouped" : ""}`),
|
|
@@ -1260,19 +1292,26 @@ function Field(props) {
|
|
|
1260
1292
|
onChange: (e) => props.onChange(e.target.value)
|
|
1261
1293
|
}
|
|
1262
1294
|
),
|
|
1263
|
-
props.hint ? /* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1295
|
+
props.hint ? /* @__PURE__ */ jsx7("span", { ...a.el("field.hint", "throttle-field__hint"), id: hintId, children: props.hint }) : null,
|
|
1296
|
+
/* @__PURE__ */ jsx7("span", { ...a.el("field.error", "throttle-field__error"), id: errorId, role: "alert", children: props.error ?? "" })
|
|
1265
1297
|
] });
|
|
1266
1298
|
}
|
|
1267
1299
|
function FieldGroup(props) {
|
|
1268
1300
|
const a = useAppearance();
|
|
1269
1301
|
const items = Children.toArray(props.children).filter(Boolean);
|
|
1270
|
-
return /* @__PURE__ */
|
|
1271
|
-
i > 0 ? /* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ jsx7("div", { ...a.el(props.elementKey ?? "field.group", "throttle-field-group"), children: items.map((child, i) => /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1303
|
+
i > 0 ? /* @__PURE__ */ jsx7("div", { className: "throttle-field-group__divider" }) : null,
|
|
1304
|
+
/* @__PURE__ */ jsx7("div", { className: "throttle-field-group__item", children: child })
|
|
1273
1305
|
] }, i)) });
|
|
1274
1306
|
}
|
|
1275
1307
|
|
|
1308
|
+
// src/react/components/primitives/FieldRow.tsx
|
|
1309
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1310
|
+
function FieldRow({ children }) {
|
|
1311
|
+
const a = useAppearance();
|
|
1312
|
+
return /* @__PURE__ */ jsx8("div", { ...a.el("fieldRow", "throttle-fieldrow"), children });
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1276
1315
|
// src/react/components/primitives/Alert.tsx
|
|
1277
1316
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1278
1317
|
function Alert(props) {
|
|
@@ -1300,7 +1339,23 @@ function Skeleton(props) {
|
|
|
1300
1339
|
// src/react/components/primitives/Modal.tsx
|
|
1301
1340
|
import { useEffect, useRef, useState } from "react";
|
|
1302
1341
|
import { createPortal } from "react-dom";
|
|
1303
|
-
|
|
1342
|
+
|
|
1343
|
+
// src/react/components/surface.tsx
|
|
1344
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1345
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1346
|
+
var Ctx4 = createContext4("standalone");
|
|
1347
|
+
function SurfaceProvider(props) {
|
|
1348
|
+
return /* @__PURE__ */ jsx11(Ctx4.Provider, { value: props.value, children: props.children });
|
|
1349
|
+
}
|
|
1350
|
+
function useSurface() {
|
|
1351
|
+
return useContext4(Ctx4);
|
|
1352
|
+
}
|
|
1353
|
+
function useCardClass() {
|
|
1354
|
+
return useSurface() === "modal" ? "throttle-card throttle-card--bare" : "throttle-card";
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
// src/react/components/primitives/Modal.tsx
|
|
1358
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1304
1359
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1305
1360
|
function Modal(props) {
|
|
1306
1361
|
const a = useAppearance();
|
|
@@ -1351,7 +1406,7 @@ function Modal(props) {
|
|
|
1351
1406
|
}, [props.open, mounted]);
|
|
1352
1407
|
if (!props.open || !mounted) return null;
|
|
1353
1408
|
return createPortal(
|
|
1354
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx12("div", { ...a.rootProps, children: /* @__PURE__ */ jsx12(
|
|
1355
1410
|
"div",
|
|
1356
1411
|
{
|
|
1357
1412
|
...a.el(props.overlayKey ?? "modal.overlay", "throttle-modal__overlay"),
|
|
@@ -1369,7 +1424,7 @@ function Modal(props) {
|
|
|
1369
1424
|
"aria-labelledby": props.labelledBy,
|
|
1370
1425
|
tabIndex: -1,
|
|
1371
1426
|
children: [
|
|
1372
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ jsx12(
|
|
1373
1428
|
"button",
|
|
1374
1429
|
{
|
|
1375
1430
|
...a.el("modal.closeButton", "throttle-modal__close"),
|
|
@@ -1379,7 +1434,7 @@ function Modal(props) {
|
|
|
1379
1434
|
children: "\xD7"
|
|
1380
1435
|
}
|
|
1381
1436
|
),
|
|
1382
|
-
/* @__PURE__ */
|
|
1437
|
+
/* @__PURE__ */ jsx12(SurfaceProvider, { value: "modal", children: props.children })
|
|
1383
1438
|
]
|
|
1384
1439
|
}
|
|
1385
1440
|
)
|
|
@@ -1389,15 +1444,68 @@ function Modal(props) {
|
|
|
1389
1444
|
);
|
|
1390
1445
|
}
|
|
1391
1446
|
|
|
1447
|
+
// 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";
|
|
1450
|
+
var ConfirmContext = createContext5(null);
|
|
1451
|
+
function ConfirmProvider({ children }) {
|
|
1452
|
+
const [request, setRequest] = useState2(null);
|
|
1453
|
+
const { t } = useCopy();
|
|
1454
|
+
const a = useAppearance();
|
|
1455
|
+
const titleId = useId2();
|
|
1456
|
+
const settle = useRef2(null);
|
|
1457
|
+
const answer = useCallback((value) => {
|
|
1458
|
+
settle.current?.(value);
|
|
1459
|
+
settle.current = null;
|
|
1460
|
+
setRequest(null);
|
|
1461
|
+
}, []);
|
|
1462
|
+
const ask = useCallback((next) => {
|
|
1463
|
+
settle.current?.(false);
|
|
1464
|
+
setRequest(next);
|
|
1465
|
+
return new Promise((resolve) => {
|
|
1466
|
+
settle.current = resolve;
|
|
1467
|
+
});
|
|
1468
|
+
}, []);
|
|
1469
|
+
return /* @__PURE__ */ jsxs5(ConfirmContext.Provider, { value: ask, children: [
|
|
1470
|
+
children,
|
|
1471
|
+
request ? /* @__PURE__ */ jsxs5(Modal, { open: true, onClose: () => answer(false), labelledBy: titleId, size: "compact", children: [
|
|
1472
|
+
/* @__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
|
+
/* @__PURE__ */ jsxs5("div", { ...a.el("confirm.body", "throttle-modal__body"), children: [
|
|
1474
|
+
request.body ? /* @__PURE__ */ jsx13("p", { className: "throttle-muted", children: request.body }) : null,
|
|
1475
|
+
/* @__PURE__ */ jsxs5("div", { className: "throttle-actions", children: [
|
|
1476
|
+
/* @__PURE__ */ jsx13(
|
|
1477
|
+
Button,
|
|
1478
|
+
{
|
|
1479
|
+
elementKey: "confirm.confirmButton",
|
|
1480
|
+
variant: request.tone === "danger" ? "danger" : "primary",
|
|
1481
|
+
onClick: () => answer(true),
|
|
1482
|
+
children: request.confirmLabel ?? t.common.delete
|
|
1483
|
+
}
|
|
1484
|
+
),
|
|
1485
|
+
/* @__PURE__ */ jsx13(Button, { elementKey: "confirm.cancelButton", variant: "secondary", onClick: () => answer(false), children: request.cancelLabel ?? t.common.keepIt })
|
|
1486
|
+
] })
|
|
1487
|
+
] })
|
|
1488
|
+
] }) : null
|
|
1489
|
+
] });
|
|
1490
|
+
}
|
|
1491
|
+
function useConfirm() {
|
|
1492
|
+
const ask = useContext5(ConfirmContext);
|
|
1493
|
+
const { t } = useCopy();
|
|
1494
|
+
return useMemo3(
|
|
1495
|
+
() => ask ?? (async (request) => window.confirm(request.title || t.common.confirm)),
|
|
1496
|
+
[ask, t]
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1392
1500
|
// src/react/components/primitives/Dropdown.tsx
|
|
1393
|
-
import { useEffect as useEffect2, useRef as
|
|
1394
|
-
import { jsx as
|
|
1501
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
1502
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1395
1503
|
function Dropdown(props) {
|
|
1396
1504
|
const a = useAppearance();
|
|
1397
|
-
const [open, setOpen] =
|
|
1398
|
-
const root =
|
|
1399
|
-
const trigger =
|
|
1400
|
-
const menu =
|
|
1505
|
+
const [open, setOpen] = useState3(false);
|
|
1506
|
+
const root = useRef3(null);
|
|
1507
|
+
const trigger = useRef3(null);
|
|
1508
|
+
const menu = useRef3(null);
|
|
1401
1509
|
useEffect2(() => {
|
|
1402
1510
|
if (!open) return;
|
|
1403
1511
|
menu.current?.querySelector('[role="menuitem"]')?.focus();
|
|
@@ -1424,8 +1532,8 @@ function Dropdown(props) {
|
|
|
1424
1532
|
const next = (at + delta + items.length) % items.length;
|
|
1425
1533
|
items[next < 0 ? items.length - 1 : next].focus();
|
|
1426
1534
|
};
|
|
1427
|
-
return /* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ jsxs6("div", { ref: root, style: { position: "relative", display: "inline-block" }, children: [
|
|
1536
|
+
/* @__PURE__ */ jsx14(
|
|
1429
1537
|
"button",
|
|
1430
1538
|
{
|
|
1431
1539
|
ref: trigger,
|
|
@@ -1438,7 +1546,7 @@ function Dropdown(props) {
|
|
|
1438
1546
|
children: props.trigger
|
|
1439
1547
|
}
|
|
1440
1548
|
),
|
|
1441
|
-
open ? /* @__PURE__ */
|
|
1549
|
+
open ? /* @__PURE__ */ jsx14(
|
|
1442
1550
|
"div",
|
|
1443
1551
|
{
|
|
1444
1552
|
ref: menu,
|
|
@@ -1464,24 +1572,24 @@ function DropdownItem(props) {
|
|
|
1464
1572
|
const a = useAppearance();
|
|
1465
1573
|
const attrs = a.el(props.itemKey ?? "dropdown.item", "throttle-dropdown__item");
|
|
1466
1574
|
if (props.href) {
|
|
1467
|
-
return /* @__PURE__ */
|
|
1575
|
+
return /* @__PURE__ */ jsx14("a", { ...attrs, role: "menuitem", href: props.href, tabIndex: -1, children: props.children });
|
|
1468
1576
|
}
|
|
1469
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ jsx14("button", { ...attrs, role: "menuitem", type: "button", tabIndex: -1, onClick: props.onClick, children: props.children });
|
|
1470
1578
|
}
|
|
1471
1579
|
function DropdownSeparator() {
|
|
1472
1580
|
const a = useAppearance();
|
|
1473
|
-
return /* @__PURE__ */
|
|
1581
|
+
return /* @__PURE__ */ jsx14("hr", { ...a.el("dropdown.separator", "throttle-dropdown__separator") });
|
|
1474
1582
|
}
|
|
1475
1583
|
|
|
1476
1584
|
// src/react/components/primitives/Tabs.tsx
|
|
1477
|
-
import { jsx as
|
|
1585
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1478
1586
|
function Tabs(props) {
|
|
1479
1587
|
const a = useAppearance();
|
|
1480
1588
|
const at = props.tabs.findIndex((t) => t.id === props.active);
|
|
1481
1589
|
const vertical = props.orientation === "vertical";
|
|
1482
1590
|
const listClass = vertical ? "throttle-tabs__rail" : "throttle-tabs__list";
|
|
1483
1591
|
const itemClass = vertical ? "throttle-tabs__railitem" : "throttle-tabs__tab";
|
|
1484
|
-
return /* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ jsx15(
|
|
1485
1593
|
"div",
|
|
1486
1594
|
{
|
|
1487
1595
|
...a.el("tabs.list", listClass),
|
|
@@ -1500,7 +1608,7 @@ function Tabs(props) {
|
|
|
1500
1608
|
children: props.tabs.map((tab) => {
|
|
1501
1609
|
const selected = tab.id === props.active;
|
|
1502
1610
|
const { className, ...rest } = a.el("tabs.tab", itemClass);
|
|
1503
|
-
return /* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ jsxs7(
|
|
1504
1612
|
"button",
|
|
1505
1613
|
{
|
|
1506
1614
|
...rest,
|
|
@@ -1525,16 +1633,16 @@ function Tabs(props) {
|
|
|
1525
1633
|
}
|
|
1526
1634
|
|
|
1527
1635
|
// src/react/components/primitives/DataTable.tsx
|
|
1528
|
-
import { jsx as
|
|
1636
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1529
1637
|
function DataTable(props) {
|
|
1530
1638
|
const a = useAppearance();
|
|
1531
1639
|
const clickable = Boolean(props.onRowClick);
|
|
1532
1640
|
return (
|
|
1533
1641
|
// Tables are the one thing allowed to be wider than the panel; it scrolls
|
|
1534
1642
|
// rather than forcing the whole page to.
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ jsx16("div", { className: "throttle-table__scroll", children: /* @__PURE__ */ jsxs8("table", { ...a.el(props.tableKey ?? "table", "throttle-table"), children: [
|
|
1644
|
+
/* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: props.columns.map((col) => /* @__PURE__ */ jsx16("th", { ...a.el("table.head", "throttle-table__head"), scope: "col", children: col.label }, col.key)) }) }),
|
|
1645
|
+
/* @__PURE__ */ jsx16("tbody", { children: props.rows.map((row) => /* @__PURE__ */ jsx16(
|
|
1538
1646
|
"tr",
|
|
1539
1647
|
{
|
|
1540
1648
|
...a.el(props.rowElementKey ?? "table.row", "throttle-table__row"),
|
|
@@ -1546,7 +1654,7 @@ function DataTable(props) {
|
|
|
1546
1654
|
props.onRowClick(row);
|
|
1547
1655
|
}
|
|
1548
1656
|
} : void 0,
|
|
1549
|
-
children: props.columns.map((col) => /* @__PURE__ */
|
|
1657
|
+
children: props.columns.map((col) => /* @__PURE__ */ jsx16("td", { ...a.el("table.cell", "throttle-table__cell"), children: col.render ? col.render(row) : String(row[col.key] ?? "") }, col.key))
|
|
1550
1658
|
},
|
|
1551
1659
|
props.rowKey(row)
|
|
1552
1660
|
)) })
|
|
@@ -1555,48 +1663,49 @@ function DataTable(props) {
|
|
|
1555
1663
|
}
|
|
1556
1664
|
|
|
1557
1665
|
// src/react/components/primitives/EmptyState.tsx
|
|
1558
|
-
import { jsx as
|
|
1666
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1559
1667
|
function EmptyState(props) {
|
|
1560
1668
|
const a = useAppearance();
|
|
1561
1669
|
const Slot = a.slots.EmptyState;
|
|
1562
|
-
if (Slot) return /* @__PURE__ */
|
|
1563
|
-
return /* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
props.description ? /* @__PURE__ */
|
|
1670
|
+
if (Slot) return /* @__PURE__ */ jsx17(Slot, { title: props.title, description: props.description });
|
|
1671
|
+
return /* @__PURE__ */ jsxs9("div", { ...a.el("emptyState", "throttle-empty"), children: [
|
|
1672
|
+
/* @__PURE__ */ jsx17("p", { ...a.el("emptyState.title", "throttle-empty__title"), children: props.title }),
|
|
1673
|
+
props.description ? /* @__PURE__ */ jsx17("p", { ...a.el("emptyState.description", "throttle-empty__description"), children: props.description }) : null
|
|
1566
1674
|
] });
|
|
1567
1675
|
}
|
|
1568
1676
|
|
|
1569
1677
|
// src/react/components/primitives/Avatar.tsx
|
|
1570
|
-
import { jsx as
|
|
1678
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1571
1679
|
function Avatar(props) {
|
|
1572
1680
|
const a = useAppearance();
|
|
1573
1681
|
const Slot = a.slots.Avatar;
|
|
1574
|
-
if (Slot) return /* @__PURE__ */
|
|
1682
|
+
if (Slot) return /* @__PURE__ */ jsx18(Slot, { name: props.name, email: props.email });
|
|
1575
1683
|
const initials = props.name.split(" ").map((part) => part.trim()[0]).filter(Boolean).slice(0, 2).join("") || props.email.trim()[0] || "?";
|
|
1576
|
-
return /* @__PURE__ */
|
|
1684
|
+
return /* @__PURE__ */ jsx18("span", { ...a.el("avatar", "throttle-avatar"), title: props.email, children: initials.toUpperCase() });
|
|
1577
1685
|
}
|
|
1578
1686
|
|
|
1579
1687
|
// src/react/components/primitives/Badge.tsx
|
|
1580
|
-
import { jsx as
|
|
1688
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1581
1689
|
function Badge(props) {
|
|
1582
1690
|
const a = useAppearance();
|
|
1583
1691
|
const tone = props.tone ?? "neutral";
|
|
1584
1692
|
const base = tone === "neutral" ? "throttle-badge" : `throttle-badge throttle-badge--${tone}`;
|
|
1585
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ jsx19("span", { ...a.el(props.elementKey ?? "badge", base), children: props.children });
|
|
1586
1694
|
}
|
|
1587
1695
|
|
|
1588
1696
|
// src/react/components/auth/StepUpDialog.tsx
|
|
1589
|
-
import {
|
|
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";
|
|
1590
1699
|
function StepUpDialog(props) {
|
|
1591
1700
|
const a = useAppearance();
|
|
1592
1701
|
const cardClass = useCardClass();
|
|
1593
1702
|
const { t } = useCopy();
|
|
1594
|
-
const [password, setPassword] =
|
|
1595
|
-
const titleId =
|
|
1703
|
+
const [password, setPassword] = useState4("");
|
|
1704
|
+
const titleId = useId3();
|
|
1596
1705
|
useEffect3(() => {
|
|
1597
1706
|
if (!props.open) setPassword("");
|
|
1598
1707
|
}, [props.open]);
|
|
1599
|
-
return /* @__PURE__ */
|
|
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(
|
|
1600
1709
|
"form",
|
|
1601
1710
|
{
|
|
1602
1711
|
onSubmit: (e) => {
|
|
@@ -1604,12 +1713,12 @@ function StepUpDialog(props) {
|
|
|
1604
1713
|
props.onResolve(password);
|
|
1605
1714
|
},
|
|
1606
1715
|
children: [
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
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 })
|
|
1610
1719
|
] }),
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxs10(CardBody, { children: [
|
|
1721
|
+
/* @__PURE__ */ jsx20(
|
|
1613
1722
|
Field,
|
|
1614
1723
|
{
|
|
1615
1724
|
label: t.stepUp.password,
|
|
@@ -1621,8 +1730,8 @@ function StepUpDialog(props) {
|
|
|
1621
1730
|
elementKey: "stepUp.passwordField"
|
|
1622
1731
|
}
|
|
1623
1732
|
),
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
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 })
|
|
1626
1735
|
] })
|
|
1627
1736
|
]
|
|
1628
1737
|
}
|
|
@@ -1630,23 +1739,23 @@ function StepUpDialog(props) {
|
|
|
1630
1739
|
}
|
|
1631
1740
|
|
|
1632
1741
|
// src/react/components/auth/AuthModal.tsx
|
|
1633
|
-
import { useId as
|
|
1742
|
+
import { useId as useId4 } from "react";
|
|
1634
1743
|
|
|
1635
1744
|
// src/react/components/auth/AuthFlow.tsx
|
|
1636
|
-
import { useEffect as useEffect5, useState as
|
|
1745
|
+
import { useEffect as useEffect5, useState as useState11 } from "react";
|
|
1637
1746
|
|
|
1638
1747
|
// src/react/components/auth/SignIn.tsx
|
|
1639
|
-
import { useState as
|
|
1748
|
+
import { useState as useState6 } from "react";
|
|
1640
1749
|
|
|
1641
1750
|
// src/react/components/useAction.ts
|
|
1642
|
-
import { useCallback, useRef as
|
|
1751
|
+
import { useCallback as useCallback2, useRef as useRef4, useState as useState5 } from "react";
|
|
1643
1752
|
function useAction() {
|
|
1644
1753
|
const { errorMessage } = useCopy();
|
|
1645
|
-
const [submitting, setSubmitting] =
|
|
1646
|
-
const [error, setError] =
|
|
1647
|
-
const [notice, setNotice] =
|
|
1648
|
-
const inFlight =
|
|
1649
|
-
const run =
|
|
1754
|
+
const [submitting, setSubmitting] = useState5(false);
|
|
1755
|
+
const [error, setError] = useState5(null);
|
|
1756
|
+
const [notice, setNotice] = useState5(null);
|
|
1757
|
+
const inFlight = useRef4(false);
|
|
1758
|
+
const run = useCallback2(
|
|
1650
1759
|
async (fn) => {
|
|
1651
1760
|
if (inFlight.current) return;
|
|
1652
1761
|
inFlight.current = true;
|
|
@@ -1669,7 +1778,7 @@ function useAction() {
|
|
|
1669
1778
|
}
|
|
1670
1779
|
|
|
1671
1780
|
// src/react/components/auth/SignIn.tsx
|
|
1672
|
-
import { Fragment as Fragment2, jsx as
|
|
1781
|
+
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1673
1782
|
function SignIn(props) {
|
|
1674
1783
|
const a = useAppearance(props.appearance);
|
|
1675
1784
|
const cardClass = useCardClass();
|
|
@@ -1677,14 +1786,14 @@ function SignIn(props) {
|
|
|
1677
1786
|
const { t } = useCopy(props.localization);
|
|
1678
1787
|
const { auth } = useAuth();
|
|
1679
1788
|
const { submitting, error, run } = useAction();
|
|
1680
|
-
const [email, setEmail] =
|
|
1681
|
-
const [password, setPassword] =
|
|
1789
|
+
const [email, setEmail] = useState6("");
|
|
1790
|
+
const [password, setPassword] = useState6("");
|
|
1682
1791
|
const variant = props.variant ?? "quiet";
|
|
1683
1792
|
const branded = variant === "branded";
|
|
1684
1793
|
const grouped = variant === "grouped";
|
|
1685
1794
|
const logo = useBrandLogo(props.logo);
|
|
1686
|
-
const forgotLink = props.onForgotPassword ? /* @__PURE__ */
|
|
1687
|
-
const emailField = /* @__PURE__ */
|
|
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(
|
|
1688
1797
|
Field,
|
|
1689
1798
|
{
|
|
1690
1799
|
label: t.signIn.email,
|
|
@@ -1697,7 +1806,7 @@ function SignIn(props) {
|
|
|
1697
1806
|
grouped
|
|
1698
1807
|
}
|
|
1699
1808
|
);
|
|
1700
|
-
const passwordField = /* @__PURE__ */
|
|
1809
|
+
const passwordField = /* @__PURE__ */ jsx21(
|
|
1701
1810
|
Field,
|
|
1702
1811
|
{
|
|
1703
1812
|
label: t.signIn.password,
|
|
@@ -1711,7 +1820,7 @@ function SignIn(props) {
|
|
|
1711
1820
|
labelExtra: grouped ? void 0 : forgotLink
|
|
1712
1821
|
}
|
|
1713
1822
|
);
|
|
1714
|
-
return /* @__PURE__ */
|
|
1823
|
+
return /* @__PURE__ */ jsx21(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx21("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs11(
|
|
1715
1824
|
"form",
|
|
1716
1825
|
{
|
|
1717
1826
|
...a.el("signIn.root", cardClass),
|
|
@@ -1723,7 +1832,7 @@ function SignIn(props) {
|
|
|
1723
1832
|
});
|
|
1724
1833
|
},
|
|
1725
1834
|
children: [
|
|
1726
|
-
/* @__PURE__ */
|
|
1835
|
+
/* @__PURE__ */ jsx21(
|
|
1727
1836
|
CardHeader,
|
|
1728
1837
|
{
|
|
1729
1838
|
title: t.signIn.title,
|
|
@@ -1734,24 +1843,24 @@ function SignIn(props) {
|
|
|
1734
1843
|
branded
|
|
1735
1844
|
}
|
|
1736
1845
|
),
|
|
1737
|
-
/* @__PURE__ */
|
|
1738
|
-
grouped ? /* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ jsxs11(CardBody, { children: [
|
|
1847
|
+
grouped ? /* @__PURE__ */ jsxs11(FieldGroup, { children: [
|
|
1739
1848
|
emailField,
|
|
1740
1849
|
passwordField
|
|
1741
|
-
] }) : /* @__PURE__ */
|
|
1850
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1742
1851
|
emailField,
|
|
1743
1852
|
passwordField
|
|
1744
1853
|
] }),
|
|
1745
|
-
grouped && forgotLink ? /* @__PURE__ */
|
|
1746
|
-
error ? /* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
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 })
|
|
1748
1857
|
] }),
|
|
1749
|
-
props.onSignUp ? /* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1858
|
+
props.onSignUp ? /* @__PURE__ */ jsxs11(CardFooter, { ruled: !branded, children: [
|
|
1859
|
+
/* @__PURE__ */ jsxs11("span", { className: "throttle-muted", children: [
|
|
1751
1860
|
t.signIn.switchPrompt,
|
|
1752
1861
|
" "
|
|
1753
1862
|
] }),
|
|
1754
|
-
/* @__PURE__ */
|
|
1863
|
+
/* @__PURE__ */ jsx21(Button, { variant: "link", elementKey: "signIn.switchLink", onClick: props.onSignUp, children: t.signIn.switchLink })
|
|
1755
1864
|
] }) : null
|
|
1756
1865
|
]
|
|
1757
1866
|
}
|
|
@@ -1759,8 +1868,8 @@ function SignIn(props) {
|
|
|
1759
1868
|
}
|
|
1760
1869
|
|
|
1761
1870
|
// src/react/components/auth/SignUp.tsx
|
|
1762
|
-
import { useState as
|
|
1763
|
-
import { Fragment as Fragment3, jsx as
|
|
1871
|
+
import { useState as useState7 } from "react";
|
|
1872
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1764
1873
|
function SignUp(props) {
|
|
1765
1874
|
const a = useAppearance(props.appearance);
|
|
1766
1875
|
const cardClass = useCardClass();
|
|
@@ -1768,13 +1877,13 @@ function SignUp(props) {
|
|
|
1768
1877
|
const { t } = useCopy(props.localization);
|
|
1769
1878
|
const { auth } = useAuth();
|
|
1770
1879
|
const { submitting, error, notice, run } = useAction();
|
|
1771
|
-
const [email, setEmail] =
|
|
1772
|
-
const [password, setPassword] =
|
|
1880
|
+
const [email, setEmail] = useState7("");
|
|
1881
|
+
const [password, setPassword] = useState7("");
|
|
1773
1882
|
const variant = props.variant ?? "quiet";
|
|
1774
1883
|
const branded = variant === "branded";
|
|
1775
1884
|
const grouped = variant === "grouped";
|
|
1776
1885
|
const logo = useBrandLogo(props.logo);
|
|
1777
|
-
const emailField = /* @__PURE__ */
|
|
1886
|
+
const emailField = /* @__PURE__ */ jsx22(
|
|
1778
1887
|
Field,
|
|
1779
1888
|
{
|
|
1780
1889
|
label: t.signUp.email,
|
|
@@ -1787,7 +1896,7 @@ function SignUp(props) {
|
|
|
1787
1896
|
grouped
|
|
1788
1897
|
}
|
|
1789
1898
|
);
|
|
1790
|
-
const passwordField = /* @__PURE__ */
|
|
1899
|
+
const passwordField = /* @__PURE__ */ jsx22(
|
|
1791
1900
|
Field,
|
|
1792
1901
|
{
|
|
1793
1902
|
label: t.signUp.password,
|
|
@@ -1800,7 +1909,7 @@ function SignUp(props) {
|
|
|
1800
1909
|
grouped
|
|
1801
1910
|
}
|
|
1802
1911
|
);
|
|
1803
|
-
return /* @__PURE__ */
|
|
1912
|
+
return /* @__PURE__ */ jsx22(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx22("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs12(
|
|
1804
1913
|
"form",
|
|
1805
1914
|
{
|
|
1806
1915
|
...a.el("signUp.root", cardClass),
|
|
@@ -1816,7 +1925,7 @@ function SignUp(props) {
|
|
|
1816
1925
|
});
|
|
1817
1926
|
},
|
|
1818
1927
|
children: [
|
|
1819
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsx22(
|
|
1820
1929
|
CardHeader,
|
|
1821
1930
|
{
|
|
1822
1931
|
title: t.signUp.title,
|
|
@@ -1827,24 +1936,24 @@ function SignUp(props) {
|
|
|
1827
1936
|
branded
|
|
1828
1937
|
}
|
|
1829
1938
|
),
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
grouped ? /* @__PURE__ */
|
|
1939
|
+
/* @__PURE__ */ jsxs12(CardBody, { children: [
|
|
1940
|
+
grouped ? /* @__PURE__ */ jsxs12(FieldGroup, { children: [
|
|
1832
1941
|
emailField,
|
|
1833
1942
|
passwordField
|
|
1834
|
-
] }) : /* @__PURE__ */
|
|
1943
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
1835
1944
|
emailField,
|
|
1836
1945
|
passwordField
|
|
1837
1946
|
] }),
|
|
1838
|
-
error ? /* @__PURE__ */
|
|
1839
|
-
notice ? /* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
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 })
|
|
1841
1950
|
] }),
|
|
1842
|
-
props.onSignIn ? /* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1951
|
+
props.onSignIn ? /* @__PURE__ */ jsxs12(CardFooter, { ruled: !branded, children: [
|
|
1952
|
+
/* @__PURE__ */ jsxs12("span", { className: "throttle-muted", children: [
|
|
1844
1953
|
t.signUp.switchPrompt,
|
|
1845
1954
|
" "
|
|
1846
1955
|
] }),
|
|
1847
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx22(Button, { variant: "link", elementKey: "signUp.switchLink", onClick: props.onSignIn, children: t.signUp.switchLink })
|
|
1848
1957
|
] }) : null
|
|
1849
1958
|
]
|
|
1850
1959
|
}
|
|
@@ -1852,8 +1961,8 @@ function SignUp(props) {
|
|
|
1852
1961
|
}
|
|
1853
1962
|
|
|
1854
1963
|
// src/react/components/auth/ForgotPassword.tsx
|
|
1855
|
-
import { useState as
|
|
1856
|
-
import { jsx as
|
|
1964
|
+
import { useState as useState8 } from "react";
|
|
1965
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1857
1966
|
function ForgotPassword(props) {
|
|
1858
1967
|
const a = useAppearance(props.appearance);
|
|
1859
1968
|
const cardClass = useCardClass();
|
|
@@ -1861,10 +1970,10 @@ function ForgotPassword(props) {
|
|
|
1861
1970
|
const { t } = useCopy(props.localization);
|
|
1862
1971
|
const { auth } = useAuth();
|
|
1863
1972
|
const { submitting, error, notice, run } = useAction();
|
|
1864
|
-
const [email, setEmail] =
|
|
1973
|
+
const [email, setEmail] = useState8("");
|
|
1865
1974
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
1866
1975
|
const logo = useBrandLogo(props.logo);
|
|
1867
|
-
return /* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ jsx23(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx23("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs13(
|
|
1868
1977
|
"form",
|
|
1869
1978
|
{
|
|
1870
1979
|
...a.el("forgotPassword.root", cardClass),
|
|
@@ -1876,7 +1985,7 @@ function ForgotPassword(props) {
|
|
|
1876
1985
|
});
|
|
1877
1986
|
},
|
|
1878
1987
|
children: [
|
|
1879
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx23(
|
|
1880
1989
|
CardHeader,
|
|
1881
1990
|
{
|
|
1882
1991
|
title: t.forgotPassword.title,
|
|
@@ -1887,8 +1996,8 @@ function ForgotPassword(props) {
|
|
|
1887
1996
|
branded
|
|
1888
1997
|
}
|
|
1889
1998
|
),
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsxs13(CardBody, { children: [
|
|
2000
|
+
/* @__PURE__ */ jsx23(
|
|
1892
2001
|
Field,
|
|
1893
2002
|
{
|
|
1894
2003
|
label: t.forgotPassword.email,
|
|
@@ -1900,19 +2009,19 @@ function ForgotPassword(props) {
|
|
|
1900
2009
|
elementKey: "forgotPassword.emailField"
|
|
1901
2010
|
}
|
|
1902
2011
|
),
|
|
1903
|
-
error ? /* @__PURE__ */
|
|
1904
|
-
notice ? /* @__PURE__ */
|
|
1905
|
-
/* @__PURE__ */
|
|
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 })
|
|
1906
2015
|
] }),
|
|
1907
|
-
props.onBack ? /* @__PURE__ */
|
|
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
|
|
1908
2017
|
]
|
|
1909
2018
|
}
|
|
1910
2019
|
) }) });
|
|
1911
2020
|
}
|
|
1912
2021
|
|
|
1913
2022
|
// src/react/components/auth/ResetPassword.tsx
|
|
1914
|
-
import { useState as
|
|
1915
|
-
import { jsx as
|
|
2023
|
+
import { useState as useState9 } from "react";
|
|
2024
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1916
2025
|
function ResetPassword(props) {
|
|
1917
2026
|
const a = useAppearance(props.appearance);
|
|
1918
2027
|
const cardClass = useCardClass();
|
|
@@ -1920,11 +2029,11 @@ function ResetPassword(props) {
|
|
|
1920
2029
|
const { t } = useCopy(props.localization);
|
|
1921
2030
|
const { auth } = useAuth();
|
|
1922
2031
|
const { submitting, error, notice, run } = useAction();
|
|
1923
|
-
const [password, setPassword] =
|
|
2032
|
+
const [password, setPassword] = useState9("");
|
|
1924
2033
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
1925
2034
|
const logo = useBrandLogo(props.logo);
|
|
1926
|
-
return /* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
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(
|
|
1928
2037
|
CardHeader,
|
|
1929
2038
|
{
|
|
1930
2039
|
title: t.resetPassword.title,
|
|
@@ -1934,11 +2043,11 @@ function ResetPassword(props) {
|
|
|
1934
2043
|
branded
|
|
1935
2044
|
}
|
|
1936
2045
|
),
|
|
1937
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ jsx24(CardBody, { children: !props.token ? (
|
|
1938
2047
|
// No form at all without a token. A submit button that can only
|
|
1939
2048
|
// fail is worse than an explanation.
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
) : /* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ jsx24(Alert, { tone: "error", children: t.resetPassword.missingToken })
|
|
2050
|
+
) : /* @__PURE__ */ jsx24(
|
|
1942
2051
|
"form",
|
|
1943
2052
|
{
|
|
1944
2053
|
onSubmit: (e) => {
|
|
@@ -1949,8 +2058,8 @@ function ResetPassword(props) {
|
|
|
1949
2058
|
return t.resetPassword.doneNotice;
|
|
1950
2059
|
});
|
|
1951
2060
|
},
|
|
1952
|
-
children: /* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
2061
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "throttle-stack", children: [
|
|
2062
|
+
/* @__PURE__ */ jsx24(
|
|
1954
2063
|
Field,
|
|
1955
2064
|
{
|
|
1956
2065
|
label: t.resetPassword.password,
|
|
@@ -1962,9 +2071,9 @@ function ResetPassword(props) {
|
|
|
1962
2071
|
elementKey: "resetPassword.passwordField"
|
|
1963
2072
|
}
|
|
1964
2073
|
),
|
|
1965
|
-
error ? /* @__PURE__ */
|
|
1966
|
-
notice ? /* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
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 })
|
|
1968
2077
|
] })
|
|
1969
2078
|
}
|
|
1970
2079
|
) })
|
|
@@ -1972,8 +2081,8 @@ function ResetPassword(props) {
|
|
|
1972
2081
|
}
|
|
1973
2082
|
|
|
1974
2083
|
// src/react/components/auth/VerifyEmail.tsx
|
|
1975
|
-
import { useEffect as useEffect4, useRef as
|
|
1976
|
-
import { jsx as
|
|
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";
|
|
1977
2086
|
function VerifyEmail(props) {
|
|
1978
2087
|
const a = useAppearance(props.appearance);
|
|
1979
2088
|
const cardClass = useCardClass();
|
|
@@ -1981,11 +2090,11 @@ function VerifyEmail(props) {
|
|
|
1981
2090
|
const { t, errorMessage } = useCopy(props.localization);
|
|
1982
2091
|
const { auth } = useAuth();
|
|
1983
2092
|
const { submitting, notice, run } = useAction();
|
|
1984
|
-
const [state, setState] =
|
|
1985
|
-
const [error, setError] =
|
|
2093
|
+
const [state, setState] = useState10(props.token ? "verifying" : "idle");
|
|
2094
|
+
const [error, setError] = useState10(null);
|
|
1986
2095
|
const branded = (props.variant ?? "quiet") === "branded";
|
|
1987
2096
|
const logo = useBrandLogo(props.logo);
|
|
1988
|
-
const attempted =
|
|
2097
|
+
const attempted = useRef5(null);
|
|
1989
2098
|
useEffect4(() => {
|
|
1990
2099
|
const token = props.token;
|
|
1991
2100
|
if (!token || attempted.current === token) return;
|
|
@@ -1999,8 +2108,8 @@ function VerifyEmail(props) {
|
|
|
1999
2108
|
setState("failed");
|
|
2000
2109
|
});
|
|
2001
2110
|
}, [props.token, auth]);
|
|
2002
|
-
return /* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
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(
|
|
2004
2113
|
CardHeader,
|
|
2005
2114
|
{
|
|
2006
2115
|
title: t.verifyEmail.title,
|
|
@@ -2010,17 +2119,17 @@ function VerifyEmail(props) {
|
|
|
2010
2119
|
branded
|
|
2011
2120
|
}
|
|
2012
2121
|
),
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
state === "verifying" ? /* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ jsxs15(CardBody, { children: [
|
|
2123
|
+
state === "verifying" ? /* @__PURE__ */ jsxs15("p", { children: [
|
|
2124
|
+
/* @__PURE__ */ jsx25(Spinner, {}),
|
|
2016
2125
|
" ",
|
|
2017
2126
|
t.verifyEmail.verifying
|
|
2018
2127
|
] }) : null,
|
|
2019
|
-
state === "done" ? /* @__PURE__ */
|
|
2020
|
-
state === "failed" && error ? /* @__PURE__ */
|
|
2021
|
-
state === "idle" ? /* @__PURE__ */
|
|
2022
|
-
notice ? /* @__PURE__ */
|
|
2023
|
-
state !== "done" ? /* @__PURE__ */
|
|
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(
|
|
2024
2133
|
Button,
|
|
2025
2134
|
{
|
|
2026
2135
|
variant: "secondary",
|
|
@@ -2038,7 +2147,7 @@ function VerifyEmail(props) {
|
|
|
2038
2147
|
}
|
|
2039
2148
|
|
|
2040
2149
|
// src/react/components/auth/AuthFlow.tsx
|
|
2041
|
-
import { jsx as
|
|
2150
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2042
2151
|
var HASH_FOR = {
|
|
2043
2152
|
signIn: "#/sign-in",
|
|
2044
2153
|
signUp: "#/sign-up",
|
|
@@ -2064,8 +2173,8 @@ function readLocation() {
|
|
|
2064
2173
|
function AuthFlow(props) {
|
|
2065
2174
|
const a = useAppearance(props.appearance);
|
|
2066
2175
|
const controlled = props.view !== void 0;
|
|
2067
|
-
const [internal, setInternal] =
|
|
2068
|
-
const [urlToken, setUrlToken] =
|
|
2176
|
+
const [internal, setInternal] = useState11(props.initialView ?? "signIn");
|
|
2177
|
+
const [urlToken, setUrlToken] = useState11(void 0);
|
|
2069
2178
|
useEffect5(() => {
|
|
2070
2179
|
const found = readLocation();
|
|
2071
2180
|
if (found.token) setUrlToken(found.token);
|
|
@@ -2096,8 +2205,8 @@ function AuthFlow(props) {
|
|
|
2096
2205
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
2097
2206
|
}, [props.routing, controlled]);
|
|
2098
2207
|
const shared = { appearance: props.appearance, localization: props.localization };
|
|
2099
|
-
return /* @__PURE__ */
|
|
2100
|
-
view === "signIn" ? /* @__PURE__ */
|
|
2208
|
+
return /* @__PURE__ */ jsx26("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs16("div", { ...a.el("authFlow.root"), children: [
|
|
2209
|
+
view === "signIn" ? /* @__PURE__ */ jsx26(
|
|
2101
2210
|
SignIn,
|
|
2102
2211
|
{
|
|
2103
2212
|
...shared,
|
|
@@ -2106,19 +2215,19 @@ function AuthFlow(props) {
|
|
|
2106
2215
|
onSignUp: () => go("signUp")
|
|
2107
2216
|
}
|
|
2108
2217
|
) : null,
|
|
2109
|
-
view === "signUp" ? /* @__PURE__ */
|
|
2110
|
-
view === "forgotPassword" ? /* @__PURE__ */
|
|
2111
|
-
view === "resetPassword" ? /* @__PURE__ */
|
|
2112
|
-
view === "verifyEmail" ? /* @__PURE__ */
|
|
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
|
|
2113
2222
|
] }) });
|
|
2114
2223
|
}
|
|
2115
2224
|
|
|
2116
2225
|
// src/react/components/auth/AuthModal.tsx
|
|
2117
|
-
import { jsx as
|
|
2226
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2118
2227
|
function AuthModal(props) {
|
|
2119
2228
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
2120
|
-
const titleId =
|
|
2121
|
-
return /* @__PURE__ */
|
|
2229
|
+
const titleId = useId4();
|
|
2230
|
+
return /* @__PURE__ */ jsx27(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs17(
|
|
2122
2231
|
Modal,
|
|
2123
2232
|
{
|
|
2124
2233
|
open: props.open,
|
|
@@ -2128,8 +2237,8 @@ function AuthModal(props) {
|
|
|
2128
2237
|
overlayKey: "authModal.overlay",
|
|
2129
2238
|
containerKey: "authModal.container",
|
|
2130
2239
|
children: [
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
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(
|
|
2133
2242
|
AuthFlow,
|
|
2134
2243
|
{
|
|
2135
2244
|
initialView: props.initialView,
|
|
@@ -2145,14 +2254,14 @@ function AuthModal(props) {
|
|
|
2145
2254
|
}
|
|
2146
2255
|
|
|
2147
2256
|
// src/react/components/account/AccountModal.tsx
|
|
2148
|
-
import { useId as
|
|
2257
|
+
import { useId as useId7 } from "react";
|
|
2149
2258
|
|
|
2150
2259
|
// src/react/components/account/AccountDashboard.tsx
|
|
2151
|
-
import { useEffect as useEffect9, useId as
|
|
2260
|
+
import { useEffect as useEffect9, useId as useId6, useState as useState21 } from "react";
|
|
2152
2261
|
|
|
2153
2262
|
// src/react/components/account/VerifyEmailBanner.tsx
|
|
2154
|
-
import { useState as
|
|
2155
|
-
import { jsx as
|
|
2263
|
+
import { useState as useState12 } from "react";
|
|
2264
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2156
2265
|
var DISMISS_KEY = "throttle-auth:verify-banner-dismissed";
|
|
2157
2266
|
function readDismissed() {
|
|
2158
2267
|
try {
|
|
@@ -2173,14 +2282,14 @@ function VerifyEmailBanner(props) {
|
|
|
2173
2282
|
const { t } = useCopy(props.localization);
|
|
2174
2283
|
const { auth, status, emailVerified } = useAuth();
|
|
2175
2284
|
const { submitting, notice, error, run } = useAction();
|
|
2176
|
-
const [dismissed, setDismissed] =
|
|
2285
|
+
const [dismissed, setDismissed] = useState12(readDismissed);
|
|
2177
2286
|
if (status !== "authenticated" || emailVerified || dismissed) return null;
|
|
2178
|
-
return /* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
notice ? /* @__PURE__ */
|
|
2181
|
-
error ? /* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
/* @__PURE__ */
|
|
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(
|
|
2184
2293
|
Button,
|
|
2185
2294
|
{
|
|
2186
2295
|
variant: "secondary",
|
|
@@ -2193,7 +2302,7 @@ function VerifyEmailBanner(props) {
|
|
|
2193
2302
|
children: t.verifyBanner.resendButton
|
|
2194
2303
|
}
|
|
2195
2304
|
),
|
|
2196
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsx28(
|
|
2197
2306
|
Button,
|
|
2198
2307
|
{
|
|
2199
2308
|
variant: "link",
|
|
@@ -2210,9 +2319,9 @@ function VerifyEmailBanner(props) {
|
|
|
2210
2319
|
}
|
|
2211
2320
|
|
|
2212
2321
|
// src/react/components/account/icons.tsx
|
|
2213
|
-
import { jsx as
|
|
2322
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2214
2323
|
function Glyph(props) {
|
|
2215
|
-
return /* @__PURE__ */
|
|
2324
|
+
return /* @__PURE__ */ jsx29(
|
|
2216
2325
|
"svg",
|
|
2217
2326
|
{
|
|
2218
2327
|
className: "throttle-tabs__railicon",
|
|
@@ -2231,68 +2340,68 @@ function Glyph(props) {
|
|
|
2231
2340
|
);
|
|
2232
2341
|
}
|
|
2233
2342
|
var ACCOUNT_ICONS = {
|
|
2234
|
-
profile: /* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
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" })
|
|
2237
2346
|
] }),
|
|
2238
|
-
addresses: /* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */
|
|
2240
|
-
/* @__PURE__ */
|
|
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" })
|
|
2241
2350
|
] }),
|
|
2242
|
-
paymentMethods: /* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
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" })
|
|
2245
2354
|
] }),
|
|
2246
|
-
orders: /* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
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" })
|
|
2250
2359
|
] }),
|
|
2251
|
-
invoices: /* @__PURE__ */
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
/* @__PURE__ */
|
|
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" })
|
|
2254
2363
|
] }),
|
|
2255
|
-
subscriptions: /* @__PURE__ */
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
/* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
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" })
|
|
2259
2368
|
] }),
|
|
2260
|
-
security: /* @__PURE__ */
|
|
2261
|
-
/* @__PURE__ */
|
|
2262
|
-
/* @__PURE__ */
|
|
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" })
|
|
2263
2372
|
] })
|
|
2264
2373
|
};
|
|
2265
2374
|
|
|
2266
2375
|
// src/react/components/account/ProfilePanel.tsx
|
|
2267
|
-
import { useEffect as useEffect6, useState as
|
|
2376
|
+
import { useEffect as useEffect6, useState as useState13, useRef as useRef6 } from "react";
|
|
2268
2377
|
|
|
2269
2378
|
// src/react/components/account/PanelState.tsx
|
|
2270
|
-
import { Fragment as Fragment4, jsx as
|
|
2379
|
+
import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2271
2380
|
function PanelState(props) {
|
|
2272
2381
|
const { t, errorMessage } = useCopy();
|
|
2273
2382
|
const { data, isLoading, error, refetch } = props.resource;
|
|
2274
2383
|
const empty = props.isEmpty(data);
|
|
2275
|
-
if (isLoading && empty) return /* @__PURE__ */
|
|
2276
|
-
const errorBanner = error ? /* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
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 })
|
|
2279
2388
|
] }) : null;
|
|
2280
2389
|
const gatedByVerification = error?.code === "verification_required";
|
|
2281
2390
|
if (gatedByVerification && empty) {
|
|
2282
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.gatedDescription ?? props.emptyDescription });
|
|
2283
2392
|
}
|
|
2284
2393
|
if (error && empty) return errorBanner;
|
|
2285
2394
|
if (empty) {
|
|
2286
|
-
return props.gated ? /* @__PURE__ */
|
|
2395
|
+
return props.gated ? /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.gatedDescription }) : /* @__PURE__ */ jsx30(EmptyState, { title: props.emptyTitle, description: props.emptyDescription });
|
|
2287
2396
|
}
|
|
2288
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2289
2398
|
errorBanner,
|
|
2290
2399
|
props.children(data)
|
|
2291
2400
|
] });
|
|
2292
2401
|
}
|
|
2293
2402
|
|
|
2294
2403
|
// src/react/components/account/ProfilePanel.tsx
|
|
2295
|
-
import { jsx as
|
|
2404
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2296
2405
|
function ProfilePanel(props) {
|
|
2297
2406
|
const a = useAppearance(props.appearance);
|
|
2298
2407
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -2300,8 +2409,8 @@ function ProfilePanel(props) {
|
|
|
2300
2409
|
const { status } = useAuth();
|
|
2301
2410
|
const resource = useCustomer();
|
|
2302
2411
|
const { submitting, error, notice, run } = useAction();
|
|
2303
|
-
const [form, setForm] =
|
|
2304
|
-
const edited =
|
|
2412
|
+
const [form, setForm] = useState13({ firstName: "", lastName: "", phone: "", company: "" });
|
|
2413
|
+
const edited = useRef6(false);
|
|
2305
2414
|
useEffect6(() => {
|
|
2306
2415
|
const c = resource.data;
|
|
2307
2416
|
if (!c || edited.current) return;
|
|
@@ -2313,14 +2422,14 @@ function ProfilePanel(props) {
|
|
|
2313
2422
|
});
|
|
2314
2423
|
}, [resource.data]);
|
|
2315
2424
|
if (status === "unauthenticated") return null;
|
|
2316
|
-
return /* @__PURE__ */
|
|
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(
|
|
2317
2426
|
PanelState,
|
|
2318
2427
|
{
|
|
2319
2428
|
resource,
|
|
2320
2429
|
isEmpty: (c) => c === null,
|
|
2321
2430
|
emptyTitle: t.common.somethingWentWrong,
|
|
2322
2431
|
skeletonRows: 4,
|
|
2323
|
-
children: (customer) => /* @__PURE__ */
|
|
2432
|
+
children: (customer) => /* @__PURE__ */ jsxs21(
|
|
2324
2433
|
"form",
|
|
2325
2434
|
{
|
|
2326
2435
|
...a.el("profilePanel.form", "throttle-stack"),
|
|
@@ -2338,7 +2447,7 @@ function ProfilePanel(props) {
|
|
|
2338
2447
|
});
|
|
2339
2448
|
},
|
|
2340
2449
|
children: [
|
|
2341
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ jsx31(
|
|
2342
2451
|
Field,
|
|
2343
2452
|
{
|
|
2344
2453
|
label: t.profile.email,
|
|
@@ -2350,58 +2459,62 @@ function ProfilePanel(props) {
|
|
|
2350
2459
|
hint: t.profile.emailReadOnly
|
|
2351
2460
|
}
|
|
2352
2461
|
),
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2462
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2463
|
+
/* @__PURE__ */ jsx31(
|
|
2464
|
+
Field,
|
|
2465
|
+
{
|
|
2466
|
+
label: t.profile.firstName,
|
|
2467
|
+
value: form.firstName,
|
|
2468
|
+
autoComplete: "given-name",
|
|
2469
|
+
onChange: (v) => {
|
|
2470
|
+
edited.current = true;
|
|
2471
|
+
setForm((f) => ({ ...f, firstName: v }));
|
|
2472
|
+
}
|
|
2362
2473
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2474
|
+
),
|
|
2475
|
+
/* @__PURE__ */ jsx31(
|
|
2476
|
+
Field,
|
|
2477
|
+
{
|
|
2478
|
+
label: t.profile.lastName,
|
|
2479
|
+
value: form.lastName,
|
|
2480
|
+
autoComplete: "family-name",
|
|
2481
|
+
onChange: (v) => {
|
|
2482
|
+
edited.current = true;
|
|
2483
|
+
setForm((f) => ({ ...f, lastName: v }));
|
|
2484
|
+
}
|
|
2374
2485
|
}
|
|
2375
|
-
|
|
2376
|
-
),
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2486
|
+
)
|
|
2487
|
+
] }),
|
|
2488
|
+
/* @__PURE__ */ jsxs21(FieldRow, { children: [
|
|
2489
|
+
/* @__PURE__ */ jsx31(
|
|
2490
|
+
Field,
|
|
2491
|
+
{
|
|
2492
|
+
label: t.profile.phone,
|
|
2493
|
+
type: "tel",
|
|
2494
|
+
value: form.phone,
|
|
2495
|
+
autoComplete: "tel",
|
|
2496
|
+
onChange: (v) => {
|
|
2497
|
+
edited.current = true;
|
|
2498
|
+
setForm((f) => ({ ...f, phone: v }));
|
|
2499
|
+
}
|
|
2387
2500
|
}
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2501
|
+
),
|
|
2502
|
+
/* @__PURE__ */ jsx31(
|
|
2503
|
+
Field,
|
|
2504
|
+
{
|
|
2505
|
+
label: t.profile.company,
|
|
2506
|
+
value: form.company,
|
|
2507
|
+
autoComplete: "organization",
|
|
2508
|
+
onChange: (v) => {
|
|
2509
|
+
edited.current = true;
|
|
2510
|
+
setForm((f) => ({ ...f, company: v }));
|
|
2511
|
+
}
|
|
2399
2512
|
}
|
|
2400
|
-
|
|
2401
|
-
),
|
|
2402
|
-
error ? /* @__PURE__ */
|
|
2403
|
-
notice ? /* @__PURE__ */
|
|
2404
|
-
/* @__PURE__ */
|
|
2513
|
+
)
|
|
2514
|
+
] }),
|
|
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 })
|
|
2405
2518
|
]
|
|
2406
2519
|
}
|
|
2407
2520
|
)
|
|
@@ -2410,16 +2523,16 @@ function ProfilePanel(props) {
|
|
|
2410
2523
|
}
|
|
2411
2524
|
|
|
2412
2525
|
// src/react/components/account/AddressesPanel.tsx
|
|
2413
|
-
import { useState as
|
|
2526
|
+
import { useState as useState15 } from "react";
|
|
2414
2527
|
|
|
2415
2528
|
// src/react/components/account/AddressForm.tsx
|
|
2416
|
-
import { useState as
|
|
2417
|
-
import { jsx as
|
|
2529
|
+
import { useState as useState14 } from "react";
|
|
2530
|
+
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2418
2531
|
function AddressForm(props) {
|
|
2419
2532
|
const a = useAppearance();
|
|
2420
2533
|
const { t } = useCopy();
|
|
2421
2534
|
const i = props.initial;
|
|
2422
|
-
const [form, setForm] =
|
|
2535
|
+
const [form, setForm] = useState14({
|
|
2423
2536
|
label: i?.label ?? "",
|
|
2424
2537
|
firstName: i?.firstName ?? "",
|
|
2425
2538
|
lastName: i?.lastName ?? "",
|
|
@@ -2433,7 +2546,7 @@ function AddressForm(props) {
|
|
|
2433
2546
|
phone: i?.phone ?? ""
|
|
2434
2547
|
});
|
|
2435
2548
|
const set = (key) => (value) => setForm((f) => ({ ...f, [key]: value }));
|
|
2436
|
-
return /* @__PURE__ */
|
|
2549
|
+
return /* @__PURE__ */ jsxs22(
|
|
2437
2550
|
"form",
|
|
2438
2551
|
{
|
|
2439
2552
|
...a.el("addressesPanel.form", "throttle-stack"),
|
|
@@ -2455,11 +2568,15 @@ function AddressForm(props) {
|
|
|
2455
2568
|
});
|
|
2456
2569
|
},
|
|
2457
2570
|
children: [
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
/* @__PURE__ */
|
|
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" })
|
|
2574
|
+
] }),
|
|
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" })
|
|
2578
|
+
] }),
|
|
2579
|
+
/* @__PURE__ */ jsx32(
|
|
2463
2580
|
Field,
|
|
2464
2581
|
{
|
|
2465
2582
|
label: t.addresses.addressLine1,
|
|
@@ -2469,7 +2586,7 @@ function AddressForm(props) {
|
|
|
2469
2586
|
autoComplete: "address-line1"
|
|
2470
2587
|
}
|
|
2471
2588
|
),
|
|
2472
|
-
/* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ jsx32(
|
|
2473
2590
|
Field,
|
|
2474
2591
|
{
|
|
2475
2592
|
label: t.addresses.addressLine2,
|
|
@@ -2478,41 +2595,45 @@ function AddressForm(props) {
|
|
|
2478
2595
|
autoComplete: "address-line2"
|
|
2479
2596
|
}
|
|
2480
2597
|
),
|
|
2481
|
-
/* @__PURE__ */
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
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(
|
|
2601
|
+
Field,
|
|
2602
|
+
{
|
|
2603
|
+
label: t.addresses.stateProvince,
|
|
2604
|
+
value: form.stateProvince,
|
|
2605
|
+
onChange: set("stateProvince"),
|
|
2606
|
+
autoComplete: "address-level1"
|
|
2607
|
+
}
|
|
2608
|
+
)
|
|
2609
|
+
] }),
|
|
2610
|
+
/* @__PURE__ */ jsxs22(FieldRow, { children: [
|
|
2611
|
+
/* @__PURE__ */ jsx32(
|
|
2612
|
+
Field,
|
|
2613
|
+
{
|
|
2614
|
+
label: t.addresses.postalCode,
|
|
2615
|
+
value: form.postalCode,
|
|
2616
|
+
onChange: set("postalCode"),
|
|
2617
|
+
autoComplete: "postal-code"
|
|
2618
|
+
}
|
|
2619
|
+
),
|
|
2620
|
+
/* @__PURE__ */ jsx32(
|
|
2621
|
+
Field,
|
|
2622
|
+
{
|
|
2623
|
+
label: t.addresses.countryCode,
|
|
2624
|
+
value: form.countryCode,
|
|
2625
|
+
onChange: set("countryCode"),
|
|
2626
|
+
required: true,
|
|
2627
|
+
autoComplete: "country",
|
|
2628
|
+
hint: "ISO 3166-1 alpha-2, e.g. GB"
|
|
2629
|
+
}
|
|
2630
|
+
)
|
|
2631
|
+
] }),
|
|
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 })
|
|
2516
2637
|
] })
|
|
2517
2638
|
]
|
|
2518
2639
|
}
|
|
@@ -2520,14 +2641,15 @@ function AddressForm(props) {
|
|
|
2520
2641
|
}
|
|
2521
2642
|
|
|
2522
2643
|
// src/react/components/account/AddressesPanel.tsx
|
|
2523
|
-
import { Fragment as Fragment5, jsx as
|
|
2644
|
+
import { Fragment as Fragment5, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2524
2645
|
function AddressesPanel(props) {
|
|
2525
2646
|
const a = useAppearance(props.appearance);
|
|
2526
2647
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
2527
2648
|
const { t } = useCopy(props.localization);
|
|
2528
2649
|
const resource = useAddresses();
|
|
2529
2650
|
const { submitting, error, run } = useAction();
|
|
2530
|
-
const
|
|
2651
|
+
const confirm = useConfirm();
|
|
2652
|
+
const [editing, setEditing] = useState15(null);
|
|
2531
2653
|
const variant = props.variant ?? "rows";
|
|
2532
2654
|
const rowsVariant = variant === "rows";
|
|
2533
2655
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -2535,9 +2657,9 @@ function AddressesPanel(props) {
|
|
|
2535
2657
|
const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
|
|
2536
2658
|
const close = () => setEditing(null);
|
|
2537
2659
|
const formatAddress = (address) => [address.addressLine2, address.city, address.stateProvince, address.postalCode, address.countryCode].filter(Boolean).join(", ");
|
|
2538
|
-
return /* @__PURE__ */
|
|
2539
|
-
!editing && error ? /* @__PURE__ */
|
|
2540
|
-
editing ? /* @__PURE__ */
|
|
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(
|
|
2541
2663
|
AddressForm,
|
|
2542
2664
|
{
|
|
2543
2665
|
initial: editing === "new" ? void 0 : editing,
|
|
@@ -2550,16 +2672,16 @@ function AddressesPanel(props) {
|
|
|
2550
2672
|
close();
|
|
2551
2673
|
})
|
|
2552
2674
|
}
|
|
2553
|
-
) : /* @__PURE__ */
|
|
2554
|
-
/* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
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(
|
|
2556
2678
|
PanelState,
|
|
2557
2679
|
{
|
|
2558
2680
|
resource,
|
|
2559
2681
|
isEmpty: (rows) => rows.length === 0,
|
|
2560
2682
|
emptyTitle: t.addresses.empty,
|
|
2561
2683
|
emptyDescription: t.addresses.emptyDescription,
|
|
2562
|
-
children: (rows) => variant === "table" ? /* @__PURE__ */
|
|
2684
|
+
children: (rows) => variant === "table" ? /* @__PURE__ */ jsx33(
|
|
2563
2685
|
DataTable,
|
|
2564
2686
|
{
|
|
2565
2687
|
tableKey: "addressesPanel.table",
|
|
@@ -2568,13 +2690,13 @@ function AddressesPanel(props) {
|
|
|
2568
2690
|
rows,
|
|
2569
2691
|
columns: [
|
|
2570
2692
|
{ key: "label", label: t.addresses.label, render: (address) => address.label || address.addressLine1 },
|
|
2571
|
-
{ key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */
|
|
2693
|
+
{ key: "address", label: t.addresses.columnAddress, render: (address) => /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
2572
2694
|
address.addressLine1,
|
|
2573
2695
|
formatAddress(address) ? `, ${formatAddress(address)}` : ""
|
|
2574
2696
|
] }) },
|
|
2575
|
-
{ key: "default", label: t.addresses.defaultBadge, render: (address) => address.isDefault ? /* @__PURE__ */
|
|
2576
|
-
{ key: "actions", label: t.common.actions, render: (address) => /* @__PURE__ */
|
|
2577
|
-
!address.isDefault ? /* @__PURE__ */
|
|
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(
|
|
2578
2700
|
Button,
|
|
2579
2701
|
{
|
|
2580
2702
|
variant: "secondary",
|
|
@@ -2583,7 +2705,7 @@ function AddressesPanel(props) {
|
|
|
2583
2705
|
children: t.addresses.makeDefault
|
|
2584
2706
|
}
|
|
2585
2707
|
) : null,
|
|
2586
|
-
/* @__PURE__ */
|
|
2708
|
+
/* @__PURE__ */ jsx33(
|
|
2587
2709
|
Button,
|
|
2588
2710
|
{
|
|
2589
2711
|
variant: "secondary",
|
|
@@ -2592,14 +2714,14 @@ function AddressesPanel(props) {
|
|
|
2592
2714
|
children: t.common.edit
|
|
2593
2715
|
}
|
|
2594
2716
|
),
|
|
2595
|
-
/* @__PURE__ */
|
|
2717
|
+
/* @__PURE__ */ jsx33(
|
|
2596
2718
|
Button,
|
|
2597
2719
|
{
|
|
2598
2720
|
variant: "danger",
|
|
2599
2721
|
elementKey: "addressesPanel.deleteButton",
|
|
2600
2722
|
disabled: submitting,
|
|
2601
|
-
onClick: () => {
|
|
2602
|
-
if (!
|
|
2723
|
+
onClick: async () => {
|
|
2724
|
+
if (!await confirm({ title: t.addresses.deleteConfirm, confirmLabel: t.addresses.deleteConfirmAction, tone: "danger" })) return;
|
|
2603
2725
|
void run(() => resource.remove(address.id));
|
|
2604
2726
|
},
|
|
2605
2727
|
children: t.common.delete
|
|
@@ -2608,17 +2730,17 @@ function AddressesPanel(props) {
|
|
|
2608
2730
|
] }) }
|
|
2609
2731
|
]
|
|
2610
2732
|
}
|
|
2611
|
-
) : /* @__PURE__ */
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
address.isDefault ? /* @__PURE__ */
|
|
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
|
|
2616
2738
|
] }),
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2739
|
+
/* @__PURE__ */ jsx33("p", { className: "throttle-muted", children: address.addressLine1 }),
|
|
2740
|
+
/* @__PURE__ */ jsx33("p", { className: "throttle-muted", children: formatAddress(address) })
|
|
2619
2741
|
] }),
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
!address.isDefault ? /* @__PURE__ */
|
|
2742
|
+
/* @__PURE__ */ jsxs23("div", { className: "throttle-actions", children: [
|
|
2743
|
+
!address.isDefault ? /* @__PURE__ */ jsx33(
|
|
2622
2744
|
Button,
|
|
2623
2745
|
{
|
|
2624
2746
|
variant: actionVariant("secondary"),
|
|
@@ -2627,7 +2749,7 @@ function AddressesPanel(props) {
|
|
|
2627
2749
|
children: t.addresses.makeDefault
|
|
2628
2750
|
}
|
|
2629
2751
|
) : null,
|
|
2630
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ jsx33(
|
|
2631
2753
|
Button,
|
|
2632
2754
|
{
|
|
2633
2755
|
variant: actionVariant("secondary"),
|
|
@@ -2636,14 +2758,14 @@ function AddressesPanel(props) {
|
|
|
2636
2758
|
children: t.common.edit
|
|
2637
2759
|
}
|
|
2638
2760
|
),
|
|
2639
|
-
/* @__PURE__ */
|
|
2761
|
+
/* @__PURE__ */ jsx33(
|
|
2640
2762
|
Button,
|
|
2641
2763
|
{
|
|
2642
2764
|
variant: actionVariant("danger"),
|
|
2643
2765
|
elementKey: "addressesPanel.deleteButton",
|
|
2644
2766
|
disabled: submitting,
|
|
2645
|
-
onClick: () => {
|
|
2646
|
-
if (!
|
|
2767
|
+
onClick: async () => {
|
|
2768
|
+
if (!await confirm({ title: t.addresses.deleteConfirm, confirmLabel: t.addresses.deleteConfirmAction, tone: "danger" })) return;
|
|
2647
2769
|
void run(() => resource.remove(address.id));
|
|
2648
2770
|
},
|
|
2649
2771
|
children: t.common.delete
|
|
@@ -2658,20 +2780,20 @@ function AddressesPanel(props) {
|
|
|
2658
2780
|
}
|
|
2659
2781
|
|
|
2660
2782
|
// src/react/components/account/PaymentMethodsPanel.tsx
|
|
2661
|
-
import { useState as
|
|
2783
|
+
import { useState as useState17 } from "react";
|
|
2662
2784
|
|
|
2663
2785
|
// src/react/components/account/AddCardDialog.tsx
|
|
2664
|
-
import { useEffect as useEffect7, useId as
|
|
2665
|
-
import { jsx as
|
|
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";
|
|
2666
2788
|
function AddCardDialog(props) {
|
|
2667
2789
|
const { account } = useAuth();
|
|
2668
|
-
const titleId =
|
|
2790
|
+
const titleId = useId5();
|
|
2669
2791
|
const { t } = useCopy(props.localization);
|
|
2670
|
-
const [src, setSrc] =
|
|
2671
|
-
const [error, setError] =
|
|
2672
|
-
const [busy, setBusy] =
|
|
2673
|
-
const onAdded =
|
|
2674
|
-
const onClose =
|
|
2792
|
+
const [src, setSrc] = useState16(null);
|
|
2793
|
+
const [error, setError] = useState16(null);
|
|
2794
|
+
const [busy, setBusy] = useState16(false);
|
|
2795
|
+
const onAdded = useRef7(props.onAdded);
|
|
2796
|
+
const onClose = useRef7(props.onClose);
|
|
2675
2797
|
onAdded.current = props.onAdded;
|
|
2676
2798
|
onClose.current = props.onClose;
|
|
2677
2799
|
useEffect7(() => {
|
|
@@ -2737,23 +2859,25 @@ function AddCardDialog(props) {
|
|
|
2737
2859
|
return () => window.removeEventListener("message", onMessage);
|
|
2738
2860
|
}, [src, account, t]);
|
|
2739
2861
|
if (!props.open) return null;
|
|
2740
|
-
return /* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
"
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
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(
|
|
2867
|
+
"iframe",
|
|
2868
|
+
{
|
|
2869
|
+
className: "throttle-cardframe",
|
|
2870
|
+
src,
|
|
2871
|
+
title: t.paymentMethods.addTitle,
|
|
2872
|
+
sandbox: "allow-scripts allow-forms allow-same-origin"
|
|
2873
|
+
}
|
|
2874
|
+
) : !error ? /* @__PURE__ */ jsx34("div", { className: "throttle-centre", children: /* @__PURE__ */ jsx34(Spinner, {}) }) : null
|
|
2875
|
+
] })
|
|
2752
2876
|
] });
|
|
2753
2877
|
}
|
|
2754
2878
|
|
|
2755
2879
|
// src/react/components/account/PaymentMethodsPanel.tsx
|
|
2756
|
-
import { jsx as
|
|
2880
|
+
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2757
2881
|
function PaymentMethodsPanel(props) {
|
|
2758
2882
|
const a = useAppearance(props.appearance);
|
|
2759
2883
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -2761,7 +2885,8 @@ function PaymentMethodsPanel(props) {
|
|
|
2761
2885
|
const { emailVerified } = useAuth();
|
|
2762
2886
|
const resource = useSavedCards();
|
|
2763
2887
|
const { submitting, error, run } = useAction();
|
|
2764
|
-
const
|
|
2888
|
+
const confirm = useConfirm();
|
|
2889
|
+
const [adding, setAdding] = useState17(false);
|
|
2765
2890
|
const variant = props.variant ?? "rows";
|
|
2766
2891
|
const rowsVariant = variant === "rows";
|
|
2767
2892
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
@@ -2769,10 +2894,10 @@ function PaymentMethodsPanel(props) {
|
|
|
2769
2894
|
const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
|
|
2770
2895
|
const cardLabel = (card) => `${(card.cardBrand ?? card.methodType).toUpperCase()} \u2022\u2022\u2022\u2022 ${card.cardLastFour ?? "____"}`;
|
|
2771
2896
|
const expiryLabel = (card) => card.cardExpMonth && card.cardExpYear ? `${String(card.cardExpMonth).padStart(2, "0")}/${card.cardExpYear}` : "";
|
|
2772
|
-
return /* @__PURE__ */
|
|
2773
|
-
error ? /* @__PURE__ */
|
|
2774
|
-
emailVerified ? /* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
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(
|
|
2776
2901
|
AddCardDialog,
|
|
2777
2902
|
{
|
|
2778
2903
|
open: adding,
|
|
@@ -2783,7 +2908,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2783
2908
|
localization: props.localization
|
|
2784
2909
|
}
|
|
2785
2910
|
),
|
|
2786
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ jsx35(
|
|
2787
2912
|
PanelState,
|
|
2788
2913
|
{
|
|
2789
2914
|
resource,
|
|
@@ -2792,7 +2917,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2792
2917
|
isEmpty: (rows) => rows.length === 0,
|
|
2793
2918
|
emptyTitle: t.paymentMethods.empty,
|
|
2794
2919
|
emptyDescription: t.paymentMethods.emptyDescription,
|
|
2795
|
-
children: (rows) => variant === "table" ? /* @__PURE__ */
|
|
2920
|
+
children: (rows) => variant === "table" ? /* @__PURE__ */ jsx35(
|
|
2796
2921
|
DataTable,
|
|
2797
2922
|
{
|
|
2798
2923
|
tableKey: "paymentMethodsPanel.table",
|
|
@@ -2802,9 +2927,9 @@ function PaymentMethodsPanel(props) {
|
|
|
2802
2927
|
columns: [
|
|
2803
2928
|
{ key: "card", label: t.paymentMethods.columnCard, render: (card) => cardLabel(card) },
|
|
2804
2929
|
{ key: "expires", label: t.paymentMethods.expires, render: (card) => expiryLabel(card) },
|
|
2805
|
-
{ key: "default", label: t.paymentMethods.defaultBadge, render: (card) => card.isDefault ? /* @__PURE__ */
|
|
2806
|
-
{ key: "actions", label: t.common.actions, render: (card) => /* @__PURE__ */
|
|
2807
|
-
!card.isDefault ? /* @__PURE__ */
|
|
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(
|
|
2808
2933
|
Button,
|
|
2809
2934
|
{
|
|
2810
2935
|
variant: "secondary",
|
|
@@ -2814,14 +2939,14 @@ function PaymentMethodsPanel(props) {
|
|
|
2814
2939
|
children: t.paymentMethods.makeDefault
|
|
2815
2940
|
}
|
|
2816
2941
|
) : null,
|
|
2817
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ jsx35(
|
|
2818
2943
|
Button,
|
|
2819
2944
|
{
|
|
2820
2945
|
variant: "danger",
|
|
2821
2946
|
elementKey: "paymentMethodsPanel.deleteButton",
|
|
2822
2947
|
disabled: submitting,
|
|
2823
|
-
onClick: () => {
|
|
2824
|
-
if (!
|
|
2948
|
+
onClick: async () => {
|
|
2949
|
+
if (!await confirm({ title: t.paymentMethods.deleteConfirm, confirmLabel: t.paymentMethods.deleteConfirmAction, tone: "danger" })) return;
|
|
2825
2950
|
void run(() => resource.remove(card.id));
|
|
2826
2951
|
},
|
|
2827
2952
|
children: t.common.delete
|
|
@@ -2830,13 +2955,13 @@ function PaymentMethodsPanel(props) {
|
|
|
2830
2955
|
] }) }
|
|
2831
2956
|
]
|
|
2832
2957
|
}
|
|
2833
|
-
) : /* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
card.isDefault ? /* @__PURE__ */
|
|
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
|
|
2838
2963
|
] }),
|
|
2839
|
-
card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */
|
|
2964
|
+
card.cardExpMonth && card.cardExpYear ? /* @__PURE__ */ jsxs25("p", { className: "throttle-muted", children: [
|
|
2840
2965
|
t.paymentMethods.expires,
|
|
2841
2966
|
" ",
|
|
2842
2967
|
String(card.cardExpMonth).padStart(2, "0"),
|
|
@@ -2844,8 +2969,8 @@ function PaymentMethodsPanel(props) {
|
|
|
2844
2969
|
card.cardExpYear
|
|
2845
2970
|
] }) : null
|
|
2846
2971
|
] }),
|
|
2847
|
-
/* @__PURE__ */
|
|
2848
|
-
!card.isDefault ? /* @__PURE__ */
|
|
2972
|
+
/* @__PURE__ */ jsxs25("div", { className: "throttle-actions", children: [
|
|
2973
|
+
!card.isDefault ? /* @__PURE__ */ jsx35(
|
|
2849
2974
|
Button,
|
|
2850
2975
|
{
|
|
2851
2976
|
variant: actionVariant("secondary"),
|
|
@@ -2855,14 +2980,14 @@ function PaymentMethodsPanel(props) {
|
|
|
2855
2980
|
children: t.paymentMethods.makeDefault
|
|
2856
2981
|
}
|
|
2857
2982
|
) : null,
|
|
2858
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsx35(
|
|
2859
2984
|
Button,
|
|
2860
2985
|
{
|
|
2861
2986
|
variant: actionVariant("danger"),
|
|
2862
2987
|
elementKey: "paymentMethodsPanel.deleteButton",
|
|
2863
2988
|
disabled: submitting,
|
|
2864
|
-
onClick: () => {
|
|
2865
|
-
if (!
|
|
2989
|
+
onClick: async () => {
|
|
2990
|
+
if (!await confirm({ title: t.paymentMethods.deleteConfirm, confirmLabel: t.paymentMethods.deleteConfirmAction, tone: "danger" })) return;
|
|
2866
2991
|
void run(() => resource.remove(card.id));
|
|
2867
2992
|
},
|
|
2868
2993
|
children: t.common.delete
|
|
@@ -2876,7 +3001,7 @@ function PaymentMethodsPanel(props) {
|
|
|
2876
3001
|
}
|
|
2877
3002
|
|
|
2878
3003
|
// src/react/components/account/OrdersPanel.tsx
|
|
2879
|
-
import { useState as
|
|
3004
|
+
import { useState as useState18 } from "react";
|
|
2880
3005
|
|
|
2881
3006
|
// src/react/components/format.ts
|
|
2882
3007
|
function formatMoney(minorUnits, currency, locale) {
|
|
@@ -2908,7 +3033,7 @@ function formatDate(value, locale) {
|
|
|
2908
3033
|
}
|
|
2909
3034
|
|
|
2910
3035
|
// src/react/components/account/OrderStatus.tsx
|
|
2911
|
-
import { Fragment as Fragment6, jsx as
|
|
3036
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2912
3037
|
function copyKey(wire) {
|
|
2913
3038
|
return wire.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
2914
3039
|
}
|
|
@@ -2916,25 +3041,76 @@ var ATTENTION_PAYMENT_STATES = /* @__PURE__ */ new Set(["pending", "failed", "di
|
|
|
2916
3041
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["cancelled", "closed", "void", "expired", "voided"]);
|
|
2917
3042
|
function StatusBadge(props) {
|
|
2918
3043
|
const label = props.labels[copyKey(props.status)] ?? props.status.replace(/_/g, " ");
|
|
2919
|
-
return /* @__PURE__ */
|
|
3044
|
+
return /* @__PURE__ */ jsx36(Badge, { tone: TERMINAL_STATUSES.has(props.status) ? "muted" : "neutral", children: label });
|
|
2920
3045
|
}
|
|
2921
3046
|
function OrderStatus(props) {
|
|
2922
3047
|
const labels = props.t.orders.statusLabels;
|
|
2923
3048
|
const payLabels = props.t.orders.paymentLabels;
|
|
2924
3049
|
const lifecycle = labels[copyKey(props.status)] ?? props.status.replace(/_/g, " ");
|
|
2925
3050
|
const money = props.paymentStatus ? payLabels[copyKey(props.paymentStatus)] : void 0;
|
|
2926
|
-
return /* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */
|
|
2928
|
-
money ? /* @__PURE__ */
|
|
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
|
|
3054
|
+
] });
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
// src/react/components/account/AddressBlock.tsx
|
|
3058
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3059
|
+
function addressLines(address) {
|
|
3060
|
+
if (!address || typeof address !== "object") return [];
|
|
3061
|
+
const a = address;
|
|
3062
|
+
const str = (k) => typeof a[k] === "string" && a[k].trim() ? a[k].trim() : null;
|
|
3063
|
+
const name = [str("firstName"), str("lastName")].filter(Boolean).join(" ");
|
|
3064
|
+
const cityLine = [str("city"), str("stateProvince"), str("postalCode")].filter(Boolean).join(", ");
|
|
3065
|
+
return [
|
|
3066
|
+
name || null,
|
|
3067
|
+
str("company"),
|
|
3068
|
+
str("addressLine1") ?? str("line1"),
|
|
3069
|
+
str("addressLine2") ?? str("line2"),
|
|
3070
|
+
cityLine || null,
|
|
3071
|
+
str("countryCode") ?? str("country")
|
|
3072
|
+
].filter((l) => Boolean(l));
|
|
3073
|
+
}
|
|
3074
|
+
function AddressBlock(props) {
|
|
3075
|
+
const a = useAppearance();
|
|
3076
|
+
const lines = addressLines(props.address);
|
|
3077
|
+
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))
|
|
3081
|
+
] });
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// src/react/components/account/OrderTimeline.tsx
|
|
3085
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3086
|
+
function orderTimeline(order, labels) {
|
|
3087
|
+
const entries = [{ label: labels.placed, at: order.createdAt }];
|
|
3088
|
+
if (order.completedAt) entries.push({ label: labels.completed, at: order.completedAt });
|
|
3089
|
+
if (order.cancelledAt) entries.push({ label: labels.cancelled, at: order.cancelledAt });
|
|
3090
|
+
if (order.closedAt) entries.push({ label: labels.closed, at: order.closedAt });
|
|
3091
|
+
return entries.sort((x, y) => new Date(x.at).getTime() - new Date(y.at).getTime());
|
|
3092
|
+
}
|
|
3093
|
+
function OrderTimeline(props) {
|
|
3094
|
+
const a = useAppearance();
|
|
3095
|
+
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) })
|
|
3102
|
+
] }, `${e.label}-${e.at}`))
|
|
2929
3103
|
] });
|
|
2930
3104
|
}
|
|
2931
3105
|
|
|
2932
3106
|
// src/react/components/account/OrderDetail.tsx
|
|
2933
|
-
import { Fragment as Fragment7, jsx as
|
|
3107
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3108
|
+
var CAN_PAY = /* @__PURE__ */ new Set(["draft", "pending"]);
|
|
3109
|
+
var CAN_REORDER = /* @__PURE__ */ new Set(["fulfilled", "cancelled", "closed"]);
|
|
2934
3110
|
function Line(props) {
|
|
2935
|
-
return /* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
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 })
|
|
2938
3114
|
] });
|
|
2939
3115
|
}
|
|
2940
3116
|
function OrderDetail(props) {
|
|
@@ -2942,7 +3118,7 @@ function OrderDetail(props) {
|
|
|
2942
3118
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
2943
3119
|
const { t, locale } = useCopy(props.localization);
|
|
2944
3120
|
const resource = useOrder(props.orderId);
|
|
2945
|
-
return /* @__PURE__ */
|
|
3121
|
+
return /* @__PURE__ */ jsx39(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx39("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs29("div", { ...a.el("orderDetail.root", "throttle-panel"), children: [
|
|
2946
3122
|
props.onBack ? (
|
|
2947
3123
|
// Wrapped on purpose. The panel is a column flex container, so a
|
|
2948
3124
|
// direct child stretches to its full width however `width: auto`
|
|
@@ -2950,27 +3126,27 @@ function OrderDetail(props) {
|
|
|
2950
3126
|
// centred label. The wrapper takes the stretch; the button keeps
|
|
2951
3127
|
// its own width. A CSS fix would need a compound selector, and
|
|
2952
3128
|
// those outrank the merchant overrides in `appearance.elements`.
|
|
2953
|
-
/* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(Button, { variant: "link", elementKey: "orderDetail.backButton", onClick: props.onBack, children: t.common.back }) })
|
|
2954
3130
|
) : null,
|
|
2955
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx39(
|
|
2956
3132
|
PanelState,
|
|
2957
3133
|
{
|
|
2958
3134
|
resource,
|
|
2959
3135
|
isEmpty: (o) => o === null,
|
|
2960
3136
|
emptyTitle: t.orders.empty,
|
|
2961
3137
|
skeletonRows: 5,
|
|
2962
|
-
children: (order) => /* @__PURE__ */
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
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 })
|
|
2966
3142
|
] }),
|
|
2967
|
-
/* @__PURE__ */
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
item.imageUrl ? /* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2972
|
-
item.description ? /* @__PURE__ */
|
|
2973
|
-
/* @__PURE__ */
|
|
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: [
|
|
2974
3150
|
t.orders.quantity,
|
|
2975
3151
|
" ",
|
|
2976
3152
|
item.quantity,
|
|
@@ -2978,16 +3154,87 @@ function OrderDetail(props) {
|
|
|
2978
3154
|
formatMoney(item.unitPrice, order.currency, locale)
|
|
2979
3155
|
] })
|
|
2980
3156
|
] }),
|
|
2981
|
-
/* @__PURE__ */
|
|
3157
|
+
/* @__PURE__ */ jsx39("span", { children: formatMoney(item.total, order.currency, locale) })
|
|
2982
3158
|
] }, item.id)) }),
|
|
2983
|
-
/* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
order.discountTotal ? /* @__PURE__ */
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
2988
|
-
/* @__PURE__ */
|
|
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
|
+
)
|
|
2989
3183
|
] }),
|
|
2990
|
-
|
|
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,
|
|
3228
|
+
{
|
|
3229
|
+
variant: "secondary",
|
|
3230
|
+
elementKey: "orderDetail.reorderButton",
|
|
3231
|
+
onClick: () => props.onReorder(target),
|
|
3232
|
+
children: t.orders.reorder
|
|
3233
|
+
}
|
|
3234
|
+
) : null,
|
|
3235
|
+
order.subscriptionId && props.onViewSubscription ? /* @__PURE__ */ jsx39(Button, { variant: "secondary", onClick: () => props.onViewSubscription(order.subscriptionId), children: t.orders.viewSubscription }) : null
|
|
3236
|
+
] });
|
|
3237
|
+
})()
|
|
2991
3238
|
] })
|
|
2992
3239
|
}
|
|
2993
3240
|
)
|
|
@@ -2995,31 +3242,34 @@ function OrderDetail(props) {
|
|
|
2995
3242
|
}
|
|
2996
3243
|
|
|
2997
3244
|
// src/react/components/account/OrdersPanel.tsx
|
|
2998
|
-
import { jsx as
|
|
3245
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2999
3246
|
function OrdersPanel(props) {
|
|
3000
3247
|
const a = useAppearance(props.appearance);
|
|
3001
3248
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3002
3249
|
const { t, locale } = useCopy(props.localization);
|
|
3003
3250
|
const { emailVerified } = useAuth();
|
|
3004
3251
|
const resource = useOrders();
|
|
3005
|
-
const [openId, setOpenId] =
|
|
3252
|
+
const [openId, setOpenId] = useState18(null);
|
|
3006
3253
|
const variant = props.variant ?? "table";
|
|
3007
3254
|
const rowsVariant = variant === "rows";
|
|
3008
3255
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
3009
3256
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3010
3257
|
if (openId) {
|
|
3011
|
-
return /* @__PURE__ */
|
|
3258
|
+
return /* @__PURE__ */ jsx40(
|
|
3012
3259
|
OrderDetail,
|
|
3013
3260
|
{
|
|
3014
3261
|
orderId: openId,
|
|
3015
3262
|
onBack: () => setOpenId(null),
|
|
3263
|
+
onPayNow: props.onPayNow,
|
|
3264
|
+
onReorder: props.onReorder,
|
|
3265
|
+
onTrackShipment: props.onTrackShipment,
|
|
3016
3266
|
onViewSubscription: props.onViewSubscription,
|
|
3017
3267
|
appearance: props.appearance,
|
|
3018
3268
|
localization: props.localization
|
|
3019
3269
|
}
|
|
3020
3270
|
);
|
|
3021
3271
|
}
|
|
3022
|
-
return /* @__PURE__ */
|
|
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(
|
|
3023
3273
|
PanelState,
|
|
3024
3274
|
{
|
|
3025
3275
|
resource,
|
|
@@ -3028,7 +3278,7 @@ function OrdersPanel(props) {
|
|
|
3028
3278
|
isEmpty: (rows) => rows.length === 0,
|
|
3029
3279
|
emptyTitle: t.orders.empty,
|
|
3030
3280
|
emptyDescription: t.orders.emptyDescription,
|
|
3031
|
-
children: (rows) => variant === "table" ? /* @__PURE__ */
|
|
3281
|
+
children: (rows) => variant === "table" ? /* @__PURE__ */ jsx40(
|
|
3032
3282
|
DataTable,
|
|
3033
3283
|
{
|
|
3034
3284
|
tableKey: "ordersPanel.table",
|
|
@@ -3042,25 +3292,25 @@ function OrdersPanel(props) {
|
|
|
3042
3292
|
{
|
|
3043
3293
|
key: "status",
|
|
3044
3294
|
label: t.orders.status,
|
|
3045
|
-
render: (o) => /* @__PURE__ */
|
|
3295
|
+
render: (o) => /* @__PURE__ */ jsx40(OrderStatus, { status: o.status, paymentStatus: o.paymentStatus, t })
|
|
3046
3296
|
},
|
|
3047
3297
|
{
|
|
3048
3298
|
key: "total",
|
|
3049
3299
|
label: t.orders.total,
|
|
3050
|
-
render: (o) => /* @__PURE__ */
|
|
3300
|
+
render: (o) => /* @__PURE__ */ jsx40("span", { className: "throttle-table__money", children: formatMoney(o.total, o.currency, locale) })
|
|
3051
3301
|
}
|
|
3052
3302
|
]
|
|
3053
3303
|
}
|
|
3054
|
-
) : /* @__PURE__ */
|
|
3055
|
-
/* @__PURE__ */
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
/* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
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 })
|
|
3059
3309
|
] }),
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
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) })
|
|
3062
3312
|
] }),
|
|
3063
|
-
/* @__PURE__ */
|
|
3313
|
+
/* @__PURE__ */ jsx40("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx40(
|
|
3064
3314
|
Button,
|
|
3065
3315
|
{
|
|
3066
3316
|
variant: rowsVariant ? "link" : "secondary",
|
|
@@ -3075,14 +3325,14 @@ function OrdersPanel(props) {
|
|
|
3075
3325
|
}
|
|
3076
3326
|
|
|
3077
3327
|
// src/react/components/account/InvoicesPanel.tsx
|
|
3078
|
-
import { useState as
|
|
3328
|
+
import { useState as useState19 } from "react";
|
|
3079
3329
|
|
|
3080
3330
|
// src/react/components/account/InvoiceDetail.tsx
|
|
3081
|
-
import { Fragment as Fragment8, jsx as
|
|
3331
|
+
import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3082
3332
|
function Line2(props) {
|
|
3083
|
-
return /* @__PURE__ */
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
/* @__PURE__ */
|
|
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 })
|
|
3086
3336
|
] });
|
|
3087
3337
|
}
|
|
3088
3338
|
function InvoiceDetail(props) {
|
|
@@ -3092,7 +3342,7 @@ function InvoiceDetail(props) {
|
|
|
3092
3342
|
const { account } = useAuth();
|
|
3093
3343
|
const resource = useInvoice(props.invoiceId);
|
|
3094
3344
|
const { submitting, error, run } = useAction();
|
|
3095
|
-
return /* @__PURE__ */
|
|
3345
|
+
return /* @__PURE__ */ jsx41(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx41("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs31("div", { ...a.el("invoiceDetail.root", "throttle-panel"), children: [
|
|
3096
3346
|
props.onBack ? (
|
|
3097
3347
|
// Wrapped on purpose. The panel is a column flex container, so a
|
|
3098
3348
|
// direct child stretches to its full width however `width: auto`
|
|
@@ -3100,25 +3350,25 @@ function InvoiceDetail(props) {
|
|
|
3100
3350
|
// centred label. The wrapper takes the stretch; the button keeps
|
|
3101
3351
|
// its own width. A CSS fix would need a compound selector, and
|
|
3102
3352
|
// those outrank the merchant overrides in `appearance.elements`.
|
|
3103
|
-
/* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ jsx41("div", { children: /* @__PURE__ */ jsx41(Button, { variant: "link", elementKey: "invoiceDetail.backButton", onClick: props.onBack, children: t.common.back }) })
|
|
3104
3354
|
) : null,
|
|
3105
|
-
/* @__PURE__ */
|
|
3106
|
-
/* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
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 })
|
|
3109
3359
|
] }),
|
|
3110
|
-
/* @__PURE__ */
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
invoice.dueAt ? /* @__PURE__ */
|
|
3113
|
-
invoice.periodStart && invoice.periodEnd ? /* @__PURE__ */
|
|
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(
|
|
3114
3364
|
Line2,
|
|
3115
3365
|
{
|
|
3116
3366
|
label: t.invoices.period,
|
|
3117
3367
|
value: `${formatDate(invoice.periodStart, locale)} \u2013 ${formatDate(invoice.periodEnd, locale)}`
|
|
3118
3368
|
}
|
|
3119
3369
|
) : null,
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
invoice.amountRefunded ? /* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ jsx41(Line2, { label: t.invoices.total, value: formatMoney(invoice.total, invoice.currency, locale) }),
|
|
3371
|
+
invoice.amountRefunded ? /* @__PURE__ */ jsx41(
|
|
3122
3372
|
Line2,
|
|
3123
3373
|
{
|
|
3124
3374
|
label: t.invoices.refunded,
|
|
@@ -3126,8 +3376,8 @@ function InvoiceDetail(props) {
|
|
|
3126
3376
|
}
|
|
3127
3377
|
) : null
|
|
3128
3378
|
] }),
|
|
3129
|
-
error ? /* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3379
|
+
error ? /* @__PURE__ */ jsx41(Alert, { tone: "error", children: error }) : null,
|
|
3380
|
+
/* @__PURE__ */ jsx41(
|
|
3131
3381
|
Button,
|
|
3132
3382
|
{
|
|
3133
3383
|
variant: "secondary",
|
|
@@ -3146,20 +3396,20 @@ function InvoiceDetail(props) {
|
|
|
3146
3396
|
}
|
|
3147
3397
|
|
|
3148
3398
|
// src/react/components/account/InvoicesPanel.tsx
|
|
3149
|
-
import { jsx as
|
|
3399
|
+
import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3150
3400
|
function InvoicesPanel(props) {
|
|
3151
3401
|
const a = useAppearance(props.appearance);
|
|
3152
3402
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3153
3403
|
const { t, locale } = useCopy(props.localization);
|
|
3154
3404
|
const { emailVerified } = useAuth();
|
|
3155
3405
|
const resource = useInvoices();
|
|
3156
|
-
const [openId, setOpenId] =
|
|
3406
|
+
const [openId, setOpenId] = useState19(null);
|
|
3157
3407
|
const variant = props.variant ?? "table";
|
|
3158
3408
|
const rowsVariant = variant === "rows";
|
|
3159
3409
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
3160
3410
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3161
3411
|
if (openId) {
|
|
3162
|
-
return /* @__PURE__ */
|
|
3412
|
+
return /* @__PURE__ */ jsx42(
|
|
3163
3413
|
InvoiceDetail,
|
|
3164
3414
|
{
|
|
3165
3415
|
invoiceId: openId,
|
|
@@ -3169,7 +3419,7 @@ function InvoicesPanel(props) {
|
|
|
3169
3419
|
}
|
|
3170
3420
|
);
|
|
3171
3421
|
}
|
|
3172
|
-
return /* @__PURE__ */
|
|
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(
|
|
3173
3423
|
PanelState,
|
|
3174
3424
|
{
|
|
3175
3425
|
resource,
|
|
@@ -3178,7 +3428,7 @@ function InvoicesPanel(props) {
|
|
|
3178
3428
|
isEmpty: (rows) => rows.length === 0,
|
|
3179
3429
|
emptyTitle: t.invoices.empty,
|
|
3180
3430
|
emptyDescription: t.invoices.emptyDescription,
|
|
3181
|
-
children: (rows) => variant === "table" ? /* @__PURE__ */
|
|
3431
|
+
children: (rows) => variant === "table" ? /* @__PURE__ */ jsx42(
|
|
3182
3432
|
DataTable,
|
|
3183
3433
|
{
|
|
3184
3434
|
tableKey: "invoicesPanel.table",
|
|
@@ -3189,24 +3439,24 @@ function InvoicesPanel(props) {
|
|
|
3189
3439
|
columns: [
|
|
3190
3440
|
{ key: "number", label: t.invoices.number },
|
|
3191
3441
|
{ key: "issuedAt", label: t.invoices.issued, render: (i) => formatDate(i.issuedAt, locale) },
|
|
3192
|
-
{ key: "status", label: t.invoices.status, render: (i) => /* @__PURE__ */
|
|
3442
|
+
{ key: "status", label: t.invoices.status, render: (i) => /* @__PURE__ */ jsx42(StatusBadge, { status: i.status, labels: t.invoices.statusLabels }) },
|
|
3193
3443
|
{
|
|
3194
3444
|
key: "total",
|
|
3195
3445
|
label: t.invoices.total,
|
|
3196
|
-
render: (i) => /* @__PURE__ */
|
|
3446
|
+
render: (i) => /* @__PURE__ */ jsx42("span", { className: "throttle-table__money", children: formatMoney(i.total, i.currency, locale) })
|
|
3197
3447
|
}
|
|
3198
3448
|
]
|
|
3199
3449
|
}
|
|
3200
|
-
) : /* @__PURE__ */
|
|
3201
|
-
/* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
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 })
|
|
3205
3455
|
] }),
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
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) })
|
|
3208
3458
|
] }),
|
|
3209
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsx42("div", { className: "throttle-actions", children: /* @__PURE__ */ jsx42(
|
|
3210
3460
|
Button,
|
|
3211
3461
|
{
|
|
3212
3462
|
variant: rowsVariant ? "link" : "secondary",
|
|
@@ -3221,7 +3471,7 @@ function InvoicesPanel(props) {
|
|
|
3221
3471
|
}
|
|
3222
3472
|
|
|
3223
3473
|
// src/react/components/account/SubscriptionsPanel.tsx
|
|
3224
|
-
import { jsx as
|
|
3474
|
+
import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3225
3475
|
var CAN_PAUSE = /* @__PURE__ */ new Set(["active", "trialing"]);
|
|
3226
3476
|
var CAN_RESUME = /* @__PURE__ */ new Set(["paused"]);
|
|
3227
3477
|
var CAN_CANCEL = /* @__PURE__ */ new Set(["active", "trialing", "paused", "past_due", "unpaid"]);
|
|
@@ -3232,62 +3482,79 @@ function SubscriptionsPanel(props) {
|
|
|
3232
3482
|
const { emailVerified } = useAuth();
|
|
3233
3483
|
const resource = useSubscriptions();
|
|
3234
3484
|
const { submitting, error, run } = useAction();
|
|
3485
|
+
const confirm = useConfirm();
|
|
3235
3486
|
const variant = props.variant ?? "rows";
|
|
3236
3487
|
const rowsVariant = variant === "rows";
|
|
3237
3488
|
const listBase = rowsVariant ? "throttle-rows" : "throttle-stack";
|
|
3238
3489
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3239
3490
|
const actionVariant = (base) => rowsVariant ? base === "danger" ? "linkDanger" : "link" : base;
|
|
3240
|
-
const confirmThen = (fn) => () => {
|
|
3241
|
-
|
|
3242
|
-
|
|
3491
|
+
const confirmThen = (fn, ask) => () => {
|
|
3492
|
+
void (async () => {
|
|
3493
|
+
if (!await confirm({ ...ask, tone: ask.tone ?? "neutral" })) return;
|
|
3494
|
+
await run(fn);
|
|
3495
|
+
})();
|
|
3243
3496
|
};
|
|
3244
3497
|
const priceLabel = (sub) => `${formatMoney(sub.amount, sub.currency, locale)} / ${sub.interval}${sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""}`;
|
|
3245
3498
|
const renewsLabel = (sub) => formatDate(sub.status === "cancelled" ? sub.cancelledAt ?? sub.currentPeriodEnd : sub.currentPeriodEnd, locale);
|
|
3246
|
-
const lifecycleActions = (sub, variantFor) => /* @__PURE__ */
|
|
3247
|
-
CAN_PAUSE.has(sub.status) ? /* @__PURE__ */
|
|
3499
|
+
const lifecycleActions = (sub, variantFor) => /* @__PURE__ */ jsxs33("div", { className: "throttle-actions", children: [
|
|
3500
|
+
CAN_PAUSE.has(sub.status) ? /* @__PURE__ */ jsx43(
|
|
3248
3501
|
Button,
|
|
3249
3502
|
{
|
|
3250
3503
|
variant: variantFor("secondary"),
|
|
3251
3504
|
loading: submitting,
|
|
3252
3505
|
elementKey: "subscriptionsPanel.pauseButton",
|
|
3253
|
-
onClick: (
|
|
3506
|
+
onClick: confirmThen(() => resource.pause(sub.id), {
|
|
3507
|
+
title: t.subscriptions.pauseConfirm,
|
|
3508
|
+
confirmLabel: t.subscriptions.pauseButton
|
|
3509
|
+
}),
|
|
3254
3510
|
children: t.subscriptions.pauseButton
|
|
3255
3511
|
}
|
|
3256
3512
|
) : null,
|
|
3257
|
-
CAN_RESUME.has(sub.status) ? /* @__PURE__ */
|
|
3513
|
+
CAN_RESUME.has(sub.status) ? /* @__PURE__ */ jsx43(
|
|
3258
3514
|
Button,
|
|
3259
3515
|
{
|
|
3260
3516
|
variant: variantFor("secondary"),
|
|
3261
3517
|
loading: submitting,
|
|
3262
3518
|
elementKey: "subscriptionsPanel.resumeButton",
|
|
3263
|
-
onClick: (
|
|
3519
|
+
onClick: confirmThen(() => resource.resume(sub.id), {
|
|
3520
|
+
title: t.subscriptions.resumeConfirm,
|
|
3521
|
+
confirmLabel: t.subscriptions.resumeButton
|
|
3522
|
+
}),
|
|
3264
3523
|
children: t.subscriptions.resumeButton
|
|
3265
3524
|
}
|
|
3266
3525
|
) : null,
|
|
3267
|
-
CAN_CANCEL.has(sub.status) && !sub.cancelAtPeriodEnd ? /* @__PURE__ */
|
|
3526
|
+
CAN_CANCEL.has(sub.status) && !sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx43(
|
|
3268
3527
|
Button,
|
|
3269
3528
|
{
|
|
3270
3529
|
variant: variantFor("secondary"),
|
|
3271
3530
|
elementKey: "subscriptionsPanel.cancelButton",
|
|
3272
3531
|
disabled: submitting,
|
|
3273
|
-
onClick: confirmThen(() => resource.cancel(sub.id, { atPeriodEnd: true })
|
|
3532
|
+
onClick: confirmThen(() => resource.cancel(sub.id, { atPeriodEnd: true }), {
|
|
3533
|
+
title: t.subscriptions.cancelConfirm,
|
|
3534
|
+
confirmLabel: t.subscriptions.cancelConfirmAction,
|
|
3535
|
+
tone: "danger"
|
|
3536
|
+
}),
|
|
3274
3537
|
children: t.subscriptions.cancelAtPeriodEnd
|
|
3275
3538
|
}
|
|
3276
3539
|
) : null,
|
|
3277
|
-
CAN_CANCEL.has(sub.status) ? /* @__PURE__ */
|
|
3540
|
+
CAN_CANCEL.has(sub.status) ? /* @__PURE__ */ jsx43(
|
|
3278
3541
|
Button,
|
|
3279
3542
|
{
|
|
3280
3543
|
variant: variantFor("danger"),
|
|
3281
3544
|
elementKey: "subscriptionsPanel.cancelNowButton",
|
|
3282
3545
|
disabled: submitting,
|
|
3283
|
-
onClick: confirmThen(() => resource.cancel(sub.id, { atPeriodEnd: false })
|
|
3546
|
+
onClick: confirmThen(() => resource.cancel(sub.id, { atPeriodEnd: false }), {
|
|
3547
|
+
title: t.subscriptions.cancelNowConfirm,
|
|
3548
|
+
confirmLabel: t.subscriptions.cancelConfirmAction,
|
|
3549
|
+
tone: "danger"
|
|
3550
|
+
}),
|
|
3284
3551
|
children: t.subscriptions.cancelNow
|
|
3285
3552
|
}
|
|
3286
3553
|
) : null
|
|
3287
3554
|
] });
|
|
3288
|
-
return /* @__PURE__ */
|
|
3289
|
-
error ? /* @__PURE__ */
|
|
3290
|
-
/* @__PURE__ */
|
|
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(
|
|
3291
3558
|
PanelState,
|
|
3292
3559
|
{
|
|
3293
3560
|
resource,
|
|
@@ -3296,7 +3563,7 @@ function SubscriptionsPanel(props) {
|
|
|
3296
3563
|
isEmpty: (rows) => rows.length === 0,
|
|
3297
3564
|
emptyTitle: t.subscriptions.empty,
|
|
3298
3565
|
emptyDescription: t.subscriptions.emptyDescription,
|
|
3299
|
-
children: (rows) => variant === "table" ? /* @__PURE__ */
|
|
3566
|
+
children: (rows) => variant === "table" ? /* @__PURE__ */ jsx43(
|
|
3300
3567
|
DataTable,
|
|
3301
3568
|
{
|
|
3302
3569
|
tableKey: "subscriptionsPanel.table",
|
|
@@ -3305,42 +3572,42 @@ function SubscriptionsPanel(props) {
|
|
|
3305
3572
|
rows,
|
|
3306
3573
|
columns: [
|
|
3307
3574
|
{ key: "plan", label: t.subscriptions.columnPlan, render: (sub) => sub.planName ?? sub.planReference },
|
|
3308
|
-
{ key: "price", label: t.subscriptions.columnPrice, render: (sub) => /* @__PURE__ */
|
|
3575
|
+
{ key: "price", label: t.subscriptions.columnPrice, render: (sub) => /* @__PURE__ */ jsx43("span", { className: "throttle-table__money", children: priceLabel(sub) }) },
|
|
3309
3576
|
{ key: "renews", label: t.subscriptions.columnRenews, render: (sub) => renewsLabel(sub) },
|
|
3310
|
-
{ key: "status", label: t.subscriptions.columnStatus, render: (sub) => /* @__PURE__ */
|
|
3311
|
-
/* @__PURE__ */
|
|
3312
|
-
sub.cancelAtPeriodEnd ? /* @__PURE__ */
|
|
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
|
|
3313
3580
|
] }) },
|
|
3314
3581
|
{ key: "actions", label: t.common.actions, render: (sub) => lifecycleActions(sub, (base) => base) }
|
|
3315
3582
|
]
|
|
3316
3583
|
}
|
|
3317
|
-
) : /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
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 })
|
|
3322
3589
|
] }),
|
|
3323
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
|
|
3324
3591
|
formatMoney(sub.amount, sub.currency, locale),
|
|
3325
3592
|
" / ",
|
|
3326
3593
|
sub.interval,
|
|
3327
3594
|
sub.quantity > 1 ? ` \xD7 ${sub.quantity}` : ""
|
|
3328
3595
|
] }),
|
|
3329
|
-
sub.status === "cancelled" ? /* @__PURE__ */
|
|
3596
|
+
sub.status === "cancelled" ? /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
|
|
3330
3597
|
t.subscriptions.cancelledOn,
|
|
3331
3598
|
" ",
|
|
3332
3599
|
formatDate(sub.cancelledAt ?? sub.currentPeriodEnd, locale)
|
|
3333
|
-
] }) : /* @__PURE__ */
|
|
3600
|
+
] }) : /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
|
|
3334
3601
|
sub.cancelAtPeriodEnd ? t.subscriptions.endsOn : t.subscriptions.renewsOn,
|
|
3335
3602
|
" ",
|
|
3336
3603
|
formatDate(sub.currentPeriodEnd, locale)
|
|
3337
3604
|
] }),
|
|
3338
|
-
sub.trialEnd ? /* @__PURE__ */
|
|
3605
|
+
sub.trialEnd ? /* @__PURE__ */ jsxs33("p", { className: "throttle-muted", children: [
|
|
3339
3606
|
t.subscriptions.trialEnds,
|
|
3340
3607
|
" ",
|
|
3341
3608
|
formatDate(sub.trialEnd, locale)
|
|
3342
3609
|
] }) : null,
|
|
3343
|
-
sub.cancelAtPeriodEnd ? /* @__PURE__ */
|
|
3610
|
+
sub.cancelAtPeriodEnd ? /* @__PURE__ */ jsx43(Badge, { tone: "warning", children: t.subscriptions.cancelScheduled }) : null
|
|
3344
3611
|
] }),
|
|
3345
3612
|
lifecycleActions(sub, actionVariant)
|
|
3346
3613
|
] }, sub.id)) })
|
|
@@ -3350,7 +3617,7 @@ function SubscriptionsPanel(props) {
|
|
|
3350
3617
|
}
|
|
3351
3618
|
|
|
3352
3619
|
// src/react/components/account/SecurityPanel.tsx
|
|
3353
|
-
import { useCallback as
|
|
3620
|
+
import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef8, useState as useState20 } from "react";
|
|
3354
3621
|
|
|
3355
3622
|
// src/react/components/account/device.ts
|
|
3356
3623
|
var BROWSERS = [
|
|
@@ -3383,7 +3650,7 @@ function describeDevice(userAgent) {
|
|
|
3383
3650
|
}
|
|
3384
3651
|
|
|
3385
3652
|
// src/react/components/account/SecurityPanel.tsx
|
|
3386
|
-
import { Fragment as Fragment9, jsx as
|
|
3653
|
+
import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3387
3654
|
function SecurityPanel(props) {
|
|
3388
3655
|
const a = useAppearance(props.appearance);
|
|
3389
3656
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
@@ -3393,16 +3660,16 @@ function SecurityPanel(props) {
|
|
|
3393
3660
|
const rowsVariant = variant === "rows";
|
|
3394
3661
|
const itemBase = rowsVariant ? "throttle-rowitem" : "throttle-listitem";
|
|
3395
3662
|
const revokeVariant = rowsVariant ? "linkDanger" : "danger";
|
|
3396
|
-
const [password, setPassword] =
|
|
3663
|
+
const [password, setPassword] = useState20("");
|
|
3397
3664
|
const passwordAction = useAction();
|
|
3398
3665
|
const sessionAction = useAction();
|
|
3399
|
-
const [sessions, setSessions] =
|
|
3400
|
-
const [listError, setListError] =
|
|
3401
|
-
const errorMessageRef =
|
|
3666
|
+
const [sessions, setSessions] = useState20(null);
|
|
3667
|
+
const [listError, setListError] = useState20(null);
|
|
3668
|
+
const errorMessageRef = useRef8(errorMessage);
|
|
3402
3669
|
useEffect8(() => {
|
|
3403
3670
|
errorMessageRef.current = errorMessage;
|
|
3404
3671
|
});
|
|
3405
|
-
const load =
|
|
3672
|
+
const load = useCallback3(async () => {
|
|
3406
3673
|
try {
|
|
3407
3674
|
setSessions(await auth.listSessions());
|
|
3408
3675
|
setListError(null);
|
|
@@ -3414,8 +3681,8 @@ function SecurityPanel(props) {
|
|
|
3414
3681
|
void load();
|
|
3415
3682
|
}, [load]);
|
|
3416
3683
|
const others = (sessions ?? []).filter((s) => !s.current);
|
|
3417
|
-
return /* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
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(
|
|
3419
3686
|
"form",
|
|
3420
3687
|
{
|
|
3421
3688
|
...a.el("securityPanel.passwordForm", "throttle-stack"),
|
|
@@ -3428,8 +3695,8 @@ function SecurityPanel(props) {
|
|
|
3428
3695
|
});
|
|
3429
3696
|
},
|
|
3430
3697
|
children: [
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3698
|
+
/* @__PURE__ */ jsx44("h3", { children: t.security.passwordTitle }),
|
|
3699
|
+
/* @__PURE__ */ jsx44(
|
|
3433
3700
|
Field,
|
|
3434
3701
|
{
|
|
3435
3702
|
label: t.security.newPassword,
|
|
@@ -3440,21 +3707,21 @@ function SecurityPanel(props) {
|
|
|
3440
3707
|
onChange: setPassword
|
|
3441
3708
|
}
|
|
3442
3709
|
),
|
|
3443
|
-
passwordAction.error ? /* @__PURE__ */
|
|
3444
|
-
passwordAction.notice ? /* @__PURE__ */
|
|
3445
|
-
/* @__PURE__ */
|
|
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 })
|
|
3446
3713
|
]
|
|
3447
3714
|
}
|
|
3448
3715
|
),
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
listError ? /* @__PURE__ */
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
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 })
|
|
3454
3721
|
] }) : null,
|
|
3455
|
-
sessionAction.error ? /* @__PURE__ */
|
|
3456
|
-
sessions === null && !listError ? /* @__PURE__ */
|
|
3457
|
-
sessions !== null && !listError && variant === "table" ? /* @__PURE__ */
|
|
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(
|
|
3458
3725
|
DataTable,
|
|
3459
3726
|
{
|
|
3460
3727
|
tableKey: "securityPanel.table",
|
|
@@ -3462,12 +3729,12 @@ function SecurityPanel(props) {
|
|
|
3462
3729
|
rowKey: (session) => session.id,
|
|
3463
3730
|
rows: sessions,
|
|
3464
3731
|
columns: [
|
|
3465
|
-
{ key: "device", label: t.security.columnDevice, render: (session) => /* @__PURE__ */
|
|
3466
|
-
/* @__PURE__ */
|
|
3467
|
-
session.current ? /* @__PURE__ */
|
|
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
|
|
3468
3735
|
] }) },
|
|
3469
3736
|
{ key: "lastActive", label: t.security.lastActive, render: (session) => formatDate(session.lastUsedAt, locale) },
|
|
3470
|
-
{ key: "actions", label: t.common.actions, render: (session) => !session.current ? /* @__PURE__ */
|
|
3737
|
+
{ key: "actions", label: t.common.actions, render: (session) => !session.current ? /* @__PURE__ */ jsx44(
|
|
3471
3738
|
Button,
|
|
3472
3739
|
{
|
|
3473
3740
|
variant: "danger",
|
|
@@ -3482,19 +3749,19 @@ function SecurityPanel(props) {
|
|
|
3482
3749
|
) : null }
|
|
3483
3750
|
]
|
|
3484
3751
|
}
|
|
3485
|
-
) : (sessions ?? []).map((session) => /* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
session.current ? /* @__PURE__ */
|
|
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
|
|
3490
3757
|
] }),
|
|
3491
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ jsxs34("p", { className: "throttle-muted", children: [
|
|
3492
3759
|
t.security.lastActive,
|
|
3493
3760
|
" ",
|
|
3494
3761
|
formatDate(session.lastUsedAt, locale)
|
|
3495
3762
|
] })
|
|
3496
3763
|
] }),
|
|
3497
|
-
!session.current ? /* @__PURE__ */
|
|
3764
|
+
!session.current ? /* @__PURE__ */ jsx44(
|
|
3498
3765
|
Button,
|
|
3499
3766
|
{
|
|
3500
3767
|
variant: revokeVariant,
|
|
@@ -3508,8 +3775,8 @@ function SecurityPanel(props) {
|
|
|
3508
3775
|
}
|
|
3509
3776
|
) : null
|
|
3510
3777
|
] }, session.id)),
|
|
3511
|
-
sessions !== null && others.length === 0 ? /* @__PURE__ */
|
|
3512
|
-
others.length > 0 ? /* @__PURE__ */
|
|
3778
|
+
sessions !== null && others.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "throttle-muted", children: t.security.sessionsEmpty }) : null,
|
|
3779
|
+
others.length > 0 ? /* @__PURE__ */ jsx44(
|
|
3513
3780
|
Button,
|
|
3514
3781
|
{
|
|
3515
3782
|
variant: "danger",
|
|
@@ -3529,7 +3796,7 @@ function SecurityPanel(props) {
|
|
|
3529
3796
|
}
|
|
3530
3797
|
|
|
3531
3798
|
// src/react/components/account/AccountDashboard.tsx
|
|
3532
|
-
import { Fragment as Fragment10, jsx as
|
|
3799
|
+
import { Fragment as Fragment10, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3533
3800
|
var ACCOUNT_TABS = [
|
|
3534
3801
|
"profile",
|
|
3535
3802
|
"addresses",
|
|
@@ -3558,8 +3825,8 @@ function AccountDashboard(props) {
|
|
|
3558
3825
|
const { status } = useAuth();
|
|
3559
3826
|
const shown = props.tabs ?? [...ACCOUNT_TABS];
|
|
3560
3827
|
const controlled = props.tab !== void 0;
|
|
3561
|
-
const [internal, setInternal] =
|
|
3562
|
-
const idBase =
|
|
3828
|
+
const [internal, setInternal] = useState21(shown[0] ?? "profile");
|
|
3829
|
+
const idBase = useId6();
|
|
3563
3830
|
useEffect9(() => {
|
|
3564
3831
|
if (props.routing !== "hash" || typeof window === "undefined") return;
|
|
3565
3832
|
const apply = () => {
|
|
@@ -3581,7 +3848,7 @@ function AccountDashboard(props) {
|
|
|
3581
3848
|
};
|
|
3582
3849
|
const shared = { appearance: props.appearance, localization: props.localization };
|
|
3583
3850
|
const sidebar = (props.layout ?? "sidebar") === "sidebar";
|
|
3584
|
-
const nav = /* @__PURE__ */
|
|
3851
|
+
const nav = /* @__PURE__ */ jsx45(
|
|
3585
3852
|
Tabs,
|
|
3586
3853
|
{
|
|
3587
3854
|
idBase,
|
|
@@ -3597,7 +3864,7 @@ function AccountDashboard(props) {
|
|
|
3597
3864
|
}))
|
|
3598
3865
|
}
|
|
3599
3866
|
);
|
|
3600
|
-
const panel = /* @__PURE__ */
|
|
3867
|
+
const panel = /* @__PURE__ */ jsxs35(
|
|
3601
3868
|
"div",
|
|
3602
3869
|
{
|
|
3603
3870
|
...a.el("accountDashboard.panel", sidebar ? "throttle-account__content" : "throttle-tabs__panel"),
|
|
@@ -3606,36 +3873,46 @@ function AccountDashboard(props) {
|
|
|
3606
3873
|
"aria-labelledby": `${idBase}-tab-${active}`,
|
|
3607
3874
|
tabIndex: 0,
|
|
3608
3875
|
children: [
|
|
3609
|
-
active === "profile" ? /* @__PURE__ */
|
|
3610
|
-
active === "addresses" ? /* @__PURE__ */
|
|
3611
|
-
active === "paymentMethods" ? /* @__PURE__ */
|
|
3612
|
-
active === "orders" ? /* @__PURE__ */
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
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(
|
|
3880
|
+
OrdersPanel,
|
|
3881
|
+
{
|
|
3882
|
+
...shared,
|
|
3883
|
+
variant: props.panelVariant,
|
|
3884
|
+
onViewSubscription: () => go("subscriptions"),
|
|
3885
|
+
onPayNow: props.onPayNow,
|
|
3886
|
+
onReorder: props.onReorder,
|
|
3887
|
+
onTrackShipment: props.onTrackShipment
|
|
3888
|
+
}
|
|
3889
|
+
) : 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
|
|
3616
3893
|
]
|
|
3617
3894
|
}
|
|
3618
3895
|
);
|
|
3619
|
-
return /* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
sidebar ? /* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
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 }),
|
|
3623
3900
|
panel
|
|
3624
|
-
] }) : /* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3901
|
+
] }) : /* @__PURE__ */ jsxs35(Fragment10, { children: [
|
|
3902
|
+
/* @__PURE__ */ jsx45("div", { ...a.el("accountDashboard.tabs"), children: nav }),
|
|
3626
3903
|
panel
|
|
3627
3904
|
] })
|
|
3628
3905
|
] }) }) });
|
|
3629
3906
|
}
|
|
3630
3907
|
|
|
3631
3908
|
// src/react/components/account/AccountModal.tsx
|
|
3632
|
-
import { jsx as
|
|
3909
|
+
import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3633
3910
|
function AccountModal(props) {
|
|
3634
3911
|
const a = useAppearance(props.appearance);
|
|
3635
3912
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3636
3913
|
const { t } = useCopy(props.localization);
|
|
3637
|
-
const titleId =
|
|
3638
|
-
return /* @__PURE__ */
|
|
3914
|
+
const titleId = useId7();
|
|
3915
|
+
return /* @__PURE__ */ jsx46(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsxs36(
|
|
3639
3916
|
Modal,
|
|
3640
3917
|
{
|
|
3641
3918
|
open: props.open,
|
|
@@ -3645,15 +3922,15 @@ function AccountModal(props) {
|
|
|
3645
3922
|
overlayKey: "accountModal.overlay",
|
|
3646
3923
|
containerKey: "accountModal.container",
|
|
3647
3924
|
children: [
|
|
3648
|
-
/* @__PURE__ */
|
|
3649
|
-
/* @__PURE__ */
|
|
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 }) })
|
|
3650
3927
|
]
|
|
3651
3928
|
}
|
|
3652
3929
|
) });
|
|
3653
3930
|
}
|
|
3654
3931
|
|
|
3655
3932
|
// src/react/components/provider.tsx
|
|
3656
|
-
import { jsx as
|
|
3933
|
+
import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3657
3934
|
var warned = /* @__PURE__ */ new Set();
|
|
3658
3935
|
function warnOnce(key, message) {
|
|
3659
3936
|
if (process.env.NODE_ENV === "production") return;
|
|
@@ -3661,9 +3938,9 @@ function warnOnce(key, message) {
|
|
|
3661
3938
|
warned.add(key);
|
|
3662
3939
|
console.warn(`[@usethrottle/auth] ${message}`);
|
|
3663
3940
|
}
|
|
3664
|
-
var ThrottleUIContext =
|
|
3941
|
+
var ThrottleUIContext = createContext6(null);
|
|
3665
3942
|
function useThrottle() {
|
|
3666
|
-
const ctx =
|
|
3943
|
+
const ctx = useContext6(ThrottleUIContext);
|
|
3667
3944
|
if (!ctx) {
|
|
3668
3945
|
warnOnce(
|
|
3669
3946
|
"use-throttle-no-provider",
|
|
@@ -3698,51 +3975,51 @@ function ThrottleProvider(props) {
|
|
|
3698
3975
|
__captureStepUp
|
|
3699
3976
|
} = props;
|
|
3700
3977
|
useInjectStyles(injectStyles);
|
|
3701
|
-
const [stepUpOpen, setStepUpOpen] =
|
|
3702
|
-
const resolveStepUp =
|
|
3703
|
-
const claimRef =
|
|
3978
|
+
const [stepUpOpen, setStepUpOpen] = useState22(false);
|
|
3979
|
+
const resolveStepUp = useRef9(null);
|
|
3980
|
+
const claimRef = useRef9(claimCartOnSignIn);
|
|
3704
3981
|
claimRef.current = claimCartOnSignIn;
|
|
3705
|
-
const [overlay, setOverlay] =
|
|
3706
|
-
const overlayRestoreFocus =
|
|
3707
|
-
const [accountTabs, setAccountTabs] =
|
|
3708
|
-
const onOverlaySuccess =
|
|
3709
|
-
const openSignIn =
|
|
3982
|
+
const [overlay, setOverlay] = useState22(null);
|
|
3983
|
+
const overlayRestoreFocus = useRef9(null);
|
|
3984
|
+
const [accountTabs, setAccountTabs] = useState22(void 0);
|
|
3985
|
+
const onOverlaySuccess = useRef9(null);
|
|
3986
|
+
const openSignIn = useCallback4((onSuccess) => {
|
|
3710
3987
|
onOverlaySuccess.current = onSuccess ?? null;
|
|
3711
3988
|
setOverlay("signIn");
|
|
3712
3989
|
}, []);
|
|
3713
|
-
const openSignUp =
|
|
3990
|
+
const openSignUp = useCallback4((onSuccess) => {
|
|
3714
3991
|
onOverlaySuccess.current = onSuccess ?? null;
|
|
3715
3992
|
setOverlay("signUp");
|
|
3716
3993
|
}, []);
|
|
3717
|
-
const openAccount =
|
|
3994
|
+
const openAccount = useCallback4((opts) => {
|
|
3718
3995
|
onOverlaySuccess.current = null;
|
|
3719
3996
|
overlayRestoreFocus.current = opts?.restoreFocusTo ?? null;
|
|
3720
3997
|
setAccountTabs(opts?.tabs);
|
|
3721
3998
|
setOverlay("account");
|
|
3722
3999
|
}, []);
|
|
3723
|
-
const closeOverlay =
|
|
4000
|
+
const closeOverlay = useCallback4(() => {
|
|
3724
4001
|
onOverlaySuccess.current = null;
|
|
3725
4002
|
overlayRestoreFocus.current = null;
|
|
3726
4003
|
setOverlay(null);
|
|
3727
4004
|
}, []);
|
|
3728
|
-
const handleOverlaySuccess =
|
|
4005
|
+
const handleOverlaySuccess = useCallback4(() => {
|
|
3729
4006
|
const fn = onOverlaySuccess.current;
|
|
3730
4007
|
onOverlaySuccess.current = null;
|
|
3731
4008
|
setOverlay(null);
|
|
3732
4009
|
fn?.();
|
|
3733
4010
|
}, []);
|
|
3734
|
-
const ui =
|
|
4011
|
+
const ui = useMemo4(
|
|
3735
4012
|
() => ({ overlay, openSignIn, openSignUp, openAccount, close: closeOverlay }),
|
|
3736
4013
|
[overlay, openSignIn, openSignUp, openAccount, closeOverlay]
|
|
3737
4014
|
);
|
|
3738
|
-
const askForStepUp =
|
|
4015
|
+
const askForStepUp = useCallback4(
|
|
3739
4016
|
() => new Promise((resolve) => {
|
|
3740
4017
|
resolveStepUp.current = resolve;
|
|
3741
4018
|
setStepUpOpen(true);
|
|
3742
4019
|
}),
|
|
3743
4020
|
[]
|
|
3744
4021
|
);
|
|
3745
|
-
const auth =
|
|
4022
|
+
const auth = useMemo4(() => {
|
|
3746
4023
|
__captureStepUp?.(askForStepUp);
|
|
3747
4024
|
const client = injected ?? createThrottleAuth({ publishableKey, baseUrl, storage, onStepUpRequired: askForStepUp });
|
|
3748
4025
|
const account = createAccount(client);
|
|
@@ -3775,10 +4052,10 @@ function ThrottleProvider(props) {
|
|
|
3775
4052
|
resolve?.(password);
|
|
3776
4053
|
};
|
|
3777
4054
|
const authOverlayOpen = overlay === "signIn" || overlay === "signUp";
|
|
3778
|
-
return /* @__PURE__ */
|
|
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: [
|
|
3779
4056
|
children,
|
|
3780
|
-
/* @__PURE__ */
|
|
3781
|
-
/* @__PURE__ */
|
|
4057
|
+
/* @__PURE__ */ jsx47(StepUpDialog, { open: stepUpOpen, onResolve: finishStepUp }),
|
|
4058
|
+
/* @__PURE__ */ jsx47(
|
|
3782
4059
|
AuthModal,
|
|
3783
4060
|
{
|
|
3784
4061
|
open: authOverlayOpen,
|
|
@@ -3789,23 +4066,23 @@ function ThrottleProvider(props) {
|
|
|
3789
4066
|
},
|
|
3790
4067
|
overlay === "signUp" ? "signUp" : "signIn"
|
|
3791
4068
|
),
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
] }) }) }) }) });
|
|
4069
|
+
/* @__PURE__ */ jsx47(AccountModal, { open: overlay === "account", onClose: closeOverlay, tabs: accountTabs, restoreFocusTo: overlayRestoreFocus.current })
|
|
4070
|
+
] }) }) }) }) }) });
|
|
3794
4071
|
}
|
|
3795
4072
|
|
|
3796
4073
|
// src/react/components/auth/SignInButton.tsx
|
|
3797
|
-
import { cloneElement, isValidElement, useContext as
|
|
3798
|
-
import { jsx as
|
|
4074
|
+
import { cloneElement, isValidElement, useContext as useContext7, useState as useState23 } from "react";
|
|
4075
|
+
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3799
4076
|
function SignInButton(props) {
|
|
3800
4077
|
const a = useAppearance(props.appearance);
|
|
3801
4078
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3802
4079
|
const { t } = useCopy(props.localization);
|
|
3803
|
-
const ui =
|
|
3804
|
-
const [localOpen, setLocalOpen] =
|
|
4080
|
+
const ui = useContext7(ThrottleUIContext);
|
|
4081
|
+
const [localOpen, setLocalOpen] = useState23(false);
|
|
3805
4082
|
const useShared = ui !== null && props.initialView === void 0;
|
|
3806
4083
|
const label = props.children ?? t.signIn.submitButton;
|
|
3807
4084
|
if (props.mode === "redirect") {
|
|
3808
|
-
return /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ jsx48(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx48("span", { ...a.rootProps, children: /* @__PURE__ */ jsx48("a", { ...a.el("signInButton.root", "throttle-button throttle-button--primary"), href: props.url ?? "#", children: label }) }) });
|
|
3809
4086
|
}
|
|
3810
4087
|
const openModal = () => {
|
|
3811
4088
|
if (useShared) ui.openSignIn(props.afterSignIn);
|
|
@@ -3815,10 +4092,10 @@ function SignInButton(props) {
|
|
|
3815
4092
|
if (useShared) ui.close();
|
|
3816
4093
|
else setLocalOpen(false);
|
|
3817
4094
|
};
|
|
3818
|
-
const trigger = props.asChild && isValidElement(props.children) ? cloneElement(props.children, { onClick: openModal }) : /* @__PURE__ */
|
|
3819
|
-
return /* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
!useShared ? /* @__PURE__ */
|
|
4095
|
+
const trigger = props.asChild && isValidElement(props.children) ? cloneElement(props.children, { onClick: openModal }) : /* @__PURE__ */ jsx48(Button, { elementKey: "signInButton.root", onClick: openModal, children: label });
|
|
4096
|
+
return /* @__PURE__ */ jsxs38(AppearanceProvider, { value: scoped, children: [
|
|
4097
|
+
/* @__PURE__ */ jsx48("span", { ...a.rootProps, children: trigger }),
|
|
4098
|
+
!useShared ? /* @__PURE__ */ jsx48(
|
|
3822
4099
|
AuthModal,
|
|
3823
4100
|
{
|
|
3824
4101
|
open: localOpen,
|
|
@@ -3836,18 +4113,18 @@ function SignInButton(props) {
|
|
|
3836
4113
|
}
|
|
3837
4114
|
|
|
3838
4115
|
// src/react/components/auth/SignUpButton.tsx
|
|
3839
|
-
import { cloneElement as cloneElement2, isValidElement as isValidElement2, useContext as
|
|
3840
|
-
import { jsx as
|
|
4116
|
+
import { cloneElement as cloneElement2, isValidElement as isValidElement2, useContext as useContext8, useState as useState24 } from "react";
|
|
4117
|
+
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3841
4118
|
function SignUpButton(props) {
|
|
3842
4119
|
const a = useAppearance(props.appearance);
|
|
3843
4120
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3844
4121
|
const { t } = useCopy(props.localization);
|
|
3845
|
-
const ui =
|
|
3846
|
-
const [localOpen, setLocalOpen] =
|
|
4122
|
+
const ui = useContext8(ThrottleUIContext);
|
|
4123
|
+
const [localOpen, setLocalOpen] = useState24(false);
|
|
3847
4124
|
const useShared = ui !== null && props.initialView === void 0;
|
|
3848
4125
|
const label = props.children ?? t.signUp.submitButton;
|
|
3849
4126
|
if (props.mode === "redirect") {
|
|
3850
|
-
return /* @__PURE__ */
|
|
4127
|
+
return /* @__PURE__ */ jsx49(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx49("span", { ...a.rootProps, children: /* @__PURE__ */ jsx49("a", { ...a.el("signUpButton.root", "throttle-button throttle-button--primary"), href: props.url ?? "#", children: label }) }) });
|
|
3851
4128
|
}
|
|
3852
4129
|
const openModal = () => {
|
|
3853
4130
|
if (useShared) ui.openSignUp(props.afterSignUp);
|
|
@@ -3857,10 +4134,10 @@ function SignUpButton(props) {
|
|
|
3857
4134
|
if (useShared) ui.close();
|
|
3858
4135
|
else setLocalOpen(false);
|
|
3859
4136
|
};
|
|
3860
|
-
const trigger = props.asChild && isValidElement2(props.children) ? cloneElement2(props.children, { onClick: openModal }) : /* @__PURE__ */
|
|
3861
|
-
return /* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
3863
|
-
!useShared ? /* @__PURE__ */
|
|
4137
|
+
const trigger = props.asChild && isValidElement2(props.children) ? cloneElement2(props.children, { onClick: openModal }) : /* @__PURE__ */ jsx49(Button, { elementKey: "signUpButton.root", onClick: openModal, children: label });
|
|
4138
|
+
return /* @__PURE__ */ jsxs39(AppearanceProvider, { value: scoped, children: [
|
|
4139
|
+
/* @__PURE__ */ jsx49("span", { ...a.rootProps, children: trigger }),
|
|
4140
|
+
!useShared ? /* @__PURE__ */ jsx49(
|
|
3864
4141
|
AuthModal,
|
|
3865
4142
|
{
|
|
3866
4143
|
open: localOpen,
|
|
@@ -3878,14 +4155,14 @@ function SignUpButton(props) {
|
|
|
3878
4155
|
}
|
|
3879
4156
|
|
|
3880
4157
|
// src/react/components/auth/SignOutButton.tsx
|
|
3881
|
-
import { jsx as
|
|
4158
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
3882
4159
|
function SignOutButton(props) {
|
|
3883
4160
|
const a = useAppearance();
|
|
3884
4161
|
const { auth } = useAuth();
|
|
3885
4162
|
const { t } = useCopy(props.localization);
|
|
3886
4163
|
const { submitting, run } = useAction();
|
|
3887
4164
|
const label = props.children ?? (props.everywhere ? t.userButton.signOutAll : t.userButton.signOut);
|
|
3888
|
-
return /* @__PURE__ */
|
|
4165
|
+
return /* @__PURE__ */ jsx50("span", { ...a.rootProps, children: /* @__PURE__ */ jsx50(
|
|
3889
4166
|
Button,
|
|
3890
4167
|
{
|
|
3891
4168
|
variant: "secondary",
|
|
@@ -3902,13 +4179,13 @@ function SignOutButton(props) {
|
|
|
3902
4179
|
}
|
|
3903
4180
|
|
|
3904
4181
|
// src/react/components/auth/SignInPage.tsx
|
|
3905
|
-
import { jsx as
|
|
4182
|
+
import { jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3906
4183
|
function SignInPage(props) {
|
|
3907
4184
|
const a = useAppearance(props.appearance);
|
|
3908
4185
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3909
|
-
return /* @__PURE__ */
|
|
3910
|
-
props.logo ? /* @__PURE__ */
|
|
3911
|
-
/* @__PURE__ */
|
|
4186
|
+
return /* @__PURE__ */ jsx51(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx51("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs40("div", { ...a.el("signInPage.root", "throttle-page"), children: [
|
|
4187
|
+
props.logo ? /* @__PURE__ */ jsx51("div", { ...a.el("signInPage.logo", "throttle-page__logo"), children: props.logo }) : null,
|
|
4188
|
+
/* @__PURE__ */ jsx51(
|
|
3912
4189
|
SignIn,
|
|
3913
4190
|
{
|
|
3914
4191
|
onSuccess: props.onSuccess,
|
|
@@ -3918,18 +4195,18 @@ function SignInPage(props) {
|
|
|
3918
4195
|
localization: props.localization
|
|
3919
4196
|
}
|
|
3920
4197
|
),
|
|
3921
|
-
props.footer ? /* @__PURE__ */
|
|
4198
|
+
props.footer ? /* @__PURE__ */ jsx51("div", { ...a.el("signInPage.footer", "throttle-page__footer"), children: props.footer }) : null
|
|
3922
4199
|
] }) }) });
|
|
3923
4200
|
}
|
|
3924
4201
|
|
|
3925
4202
|
// src/react/components/auth/SignUpPage.tsx
|
|
3926
|
-
import { jsx as
|
|
4203
|
+
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3927
4204
|
function SignUpPage(props) {
|
|
3928
4205
|
const a = useAppearance(props.appearance);
|
|
3929
4206
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3930
|
-
return /* @__PURE__ */
|
|
3931
|
-
props.logo ? /* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ jsx52(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx52("div", { ...a.rootProps, children: /* @__PURE__ */ jsxs41("div", { ...a.el("signUpPage.root", "throttle-page"), children: [
|
|
4208
|
+
props.logo ? /* @__PURE__ */ jsx52("div", { ...a.el("signUpPage.logo", "throttle-page__logo"), children: props.logo }) : null,
|
|
4209
|
+
/* @__PURE__ */ jsx52(
|
|
3933
4210
|
SignUp,
|
|
3934
4211
|
{
|
|
3935
4212
|
onSuccess: props.onSuccess,
|
|
@@ -3938,42 +4215,42 @@ function SignUpPage(props) {
|
|
|
3938
4215
|
localization: props.localization
|
|
3939
4216
|
}
|
|
3940
4217
|
),
|
|
3941
|
-
props.footer ? /* @__PURE__ */
|
|
4218
|
+
props.footer ? /* @__PURE__ */ jsx52("div", { ...a.el("signUpPage.footer", "throttle-page__footer"), children: props.footer }) : null
|
|
3942
4219
|
] }) }) });
|
|
3943
4220
|
}
|
|
3944
4221
|
|
|
3945
4222
|
// src/react/components/guards.tsx
|
|
3946
|
-
import { Fragment as Fragment11, jsx as
|
|
4223
|
+
import { Fragment as Fragment11, jsx as jsx53 } from "react/jsx-runtime";
|
|
3947
4224
|
function SignedIn(props) {
|
|
3948
4225
|
const { status } = useAuth();
|
|
3949
|
-
return status === "authenticated" ? /* @__PURE__ */
|
|
4226
|
+
return status === "authenticated" ? /* @__PURE__ */ jsx53(Fragment11, { children: props.children }) : null;
|
|
3950
4227
|
}
|
|
3951
4228
|
function SignedOut(props) {
|
|
3952
4229
|
const { status } = useAuth();
|
|
3953
|
-
return status === "unauthenticated" ? /* @__PURE__ */
|
|
4230
|
+
return status === "unauthenticated" ? /* @__PURE__ */ jsx53(Fragment11, { children: props.children }) : null;
|
|
3954
4231
|
}
|
|
3955
4232
|
function Protect(props) {
|
|
3956
4233
|
const { status, emailVerified } = useAuth();
|
|
3957
4234
|
if (status === "loading") return null;
|
|
3958
|
-
if (status !== "authenticated") return /* @__PURE__ */
|
|
3959
|
-
if (props.requireVerified && !emailVerified) return /* @__PURE__ */
|
|
3960
|
-
return /* @__PURE__ */
|
|
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 });
|
|
3961
4238
|
}
|
|
3962
4239
|
|
|
3963
4240
|
// src/react/components/UserButton.tsx
|
|
3964
|
-
import { useContext as
|
|
3965
|
-
import { jsx as
|
|
4241
|
+
import { useContext as useContext9, useId as useId8, useRef as useRef10, useState as useState25 } from "react";
|
|
4242
|
+
import { jsx as jsx54, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3966
4243
|
function UserButtonRoot(props) {
|
|
3967
4244
|
const a = useAppearance(props.appearance);
|
|
3968
4245
|
const scoped = useAppearanceProviderValue(props.appearance);
|
|
3969
4246
|
const { t } = useCopy(props.localization);
|
|
3970
4247
|
const { auth, status, customer, emailVerified } = useAuth();
|
|
3971
|
-
const ui =
|
|
3972
|
-
const [localOpen, setLocalOpen] =
|
|
4248
|
+
const ui = useContext9(ThrottleUIContext);
|
|
4249
|
+
const [localOpen, setLocalOpen] = useState25(false);
|
|
3973
4250
|
const accountOpen = ui ? false : localOpen;
|
|
3974
|
-
const titleId =
|
|
3975
|
-
const rootRef =
|
|
3976
|
-
const openerRef =
|
|
4251
|
+
const titleId = useId8();
|
|
4252
|
+
const rootRef = useRef10(null);
|
|
4253
|
+
const openerRef = useRef10(null);
|
|
3977
4254
|
const openAccount = () => {
|
|
3978
4255
|
const opener = rootRef.current?.querySelector('button[aria-haspopup="menu"]') ?? null;
|
|
3979
4256
|
openerRef.current = opener;
|
|
@@ -3982,25 +4259,25 @@ function UserButtonRoot(props) {
|
|
|
3982
4259
|
};
|
|
3983
4260
|
if (status !== "authenticated" || !customer) return null;
|
|
3984
4261
|
const name = [customer.firstName, customer.lastName].filter(Boolean).join(" ");
|
|
3985
|
-
return /* @__PURE__ */
|
|
3986
|
-
/* @__PURE__ */
|
|
4262
|
+
return /* @__PURE__ */ jsx54(AppearanceProvider, { value: scoped, children: /* @__PURE__ */ jsx54("span", { ...a.rootProps, children: /* @__PURE__ */ jsxs42("span", { ref: rootRef, ...a.el("userButton.root"), children: [
|
|
4263
|
+
/* @__PURE__ */ jsxs42(
|
|
3987
4264
|
Dropdown,
|
|
3988
4265
|
{
|
|
3989
4266
|
label: t.userButton.openMenu,
|
|
3990
4267
|
triggerKey: "userButton.trigger",
|
|
3991
4268
|
menuKey: "userButton.menu",
|
|
3992
|
-
trigger: /* @__PURE__ */
|
|
4269
|
+
trigger: /* @__PURE__ */ jsx54(Avatar, { name, email: customer.email }),
|
|
3993
4270
|
children: [
|
|
3994
|
-
/* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
3997
|
-
/* @__PURE__ */
|
|
4271
|
+
/* @__PURE__ */ jsx54("div", { ...a.el("userButton.identity", "throttle-dropdown__item"), children: /* @__PURE__ */ jsxs42("span", { children: [
|
|
4272
|
+
/* @__PURE__ */ jsx54("span", { ...a.el("userButton.email"), children: customer.email }),
|
|
4273
|
+
/* @__PURE__ */ jsx54("br", {}),
|
|
4274
|
+
/* @__PURE__ */ jsx54(Badge, { tone: emailVerified ? "success" : "warning", elementKey: "userButton.badge", children: emailVerified ? t.userButton.verified : t.userButton.unverified })
|
|
3998
4275
|
] }) }),
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
props.mode === "navigate" ? /* @__PURE__ */
|
|
4276
|
+
/* @__PURE__ */ jsx54(DropdownSeparator, {}),
|
|
4277
|
+
props.mode === "navigate" ? /* @__PURE__ */ jsx54(DropdownItem, { itemKey: "userButton.manageButton", href: props.accountUrl ?? "#", children: t.userButton.manage }) : /* @__PURE__ */ jsx54(DropdownItem, { itemKey: "userButton.manageButton", onClick: openAccount, children: t.userButton.manage }),
|
|
4001
4278
|
props.children,
|
|
4002
|
-
/* @__PURE__ */
|
|
4003
|
-
/* @__PURE__ */
|
|
4279
|
+
/* @__PURE__ */ jsx54(DropdownSeparator, {}),
|
|
4280
|
+
/* @__PURE__ */ jsx54(
|
|
4004
4281
|
DropdownItem,
|
|
4005
4282
|
{
|
|
4006
4283
|
itemKey: "userButton.signOutButton",
|
|
@@ -4008,7 +4285,7 @@ function UserButtonRoot(props) {
|
|
|
4008
4285
|
children: t.userButton.signOut
|
|
4009
4286
|
}
|
|
4010
4287
|
),
|
|
4011
|
-
/* @__PURE__ */
|
|
4288
|
+
/* @__PURE__ */ jsx54(
|
|
4012
4289
|
DropdownItem,
|
|
4013
4290
|
{
|
|
4014
4291
|
itemKey: "userButton.signOutAllButton",
|
|
@@ -4019,7 +4296,7 @@ function UserButtonRoot(props) {
|
|
|
4019
4296
|
]
|
|
4020
4297
|
}
|
|
4021
4298
|
),
|
|
4022
|
-
props.mode !== "navigate" && !ui ? /* @__PURE__ */
|
|
4299
|
+
props.mode !== "navigate" && !ui ? /* @__PURE__ */ jsxs42(
|
|
4023
4300
|
Modal,
|
|
4024
4301
|
{
|
|
4025
4302
|
open: accountOpen,
|
|
@@ -4027,8 +4304,8 @@ function UserButtonRoot(props) {
|
|
|
4027
4304
|
labelledBy: titleId,
|
|
4028
4305
|
restoreFocusTo: openerRef.current,
|
|
4029
4306
|
children: [
|
|
4030
|
-
/* @__PURE__ */
|
|
4031
|
-
/* @__PURE__ */
|
|
4307
|
+
/* @__PURE__ */ jsx54("h2", { id: titleId, style: { padding: "16px 16px 0", margin: 0 }, children: t.account.title }),
|
|
4308
|
+
/* @__PURE__ */ jsx54("div", { style: { padding: 16 }, children: /* @__PURE__ */ jsx54(
|
|
4032
4309
|
AccountDashboard,
|
|
4033
4310
|
{
|
|
4034
4311
|
tabs: props.tabs,
|
|
@@ -4042,13 +4319,13 @@ function UserButtonRoot(props) {
|
|
|
4042
4319
|
] }) }) });
|
|
4043
4320
|
}
|
|
4044
4321
|
function UserButtonLink(props) {
|
|
4045
|
-
return /* @__PURE__ */
|
|
4322
|
+
return /* @__PURE__ */ jsxs42(DropdownItem, { itemKey: "userButton.item", href: props.href, children: [
|
|
4046
4323
|
props.icon,
|
|
4047
4324
|
props.label
|
|
4048
4325
|
] });
|
|
4049
4326
|
}
|
|
4050
4327
|
function UserButtonAction(props) {
|
|
4051
|
-
return /* @__PURE__ */
|
|
4328
|
+
return /* @__PURE__ */ jsxs42(DropdownItem, { itemKey: "userButton.item", onClick: props.onClick, children: [
|
|
4052
4329
|
props.icon,
|
|
4053
4330
|
props.label
|
|
4054
4331
|
] });
|