@burdenoff/microfe-atheletebridge 2026.1107.1 → 2026.1108.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.
Files changed (36) hide show
  1. package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts +11 -0
  2. package/dist/atheletebridge/components/registration/OnlineCheckout.d.ts.map +1 -0
  3. package/dist/atheletebridge/components/registration/OnlineCheckout.js +102 -0
  4. package/dist/atheletebridge/components/registration/OnlineCheckout.js.map +1 -0
  5. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts +4 -0
  6. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.d.ts.map +1 -0
  7. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js +150 -0
  8. package/dist/atheletebridge/components/registration/OnlinePaymentsCard.js.map +1 -0
  9. package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +18 -1
  10. package/dist/atheletebridge/hooks/useRegistrationApi.d.ts.map +1 -1
  11. package/dist/atheletebridge/hooks/useRegistrationApi.js +76 -33
  12. package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
  13. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts +3 -1
  14. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.d.ts.map +1 -1
  15. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js +71 -64
  16. package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js.map +1 -1
  17. package/dist/atheletebridge/pages/registrations/RegisterPage.d.ts.map +1 -1
  18. package/dist/atheletebridge/pages/registrations/RegisterPage.js +81 -78
  19. package/dist/atheletebridge/pages/registrations/RegisterPage.js.map +1 -1
  20. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.d.ts.map +1 -1
  21. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js +49 -47
  22. package/dist/atheletebridge/pages/registrations/RegistrationFormsListPage.js.map +1 -1
  23. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.d.ts.map +1 -1
  24. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +120 -114
  25. package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
  26. package/dist/atheletebridge/types/registration.d.ts +38 -0
  27. package/dist/atheletebridge/types/registration.d.ts.map +1 -1
  28. package/dist/atheletebridge/utils/onlineCheckout.d.ts +69 -0
  29. package/dist/atheletebridge/utils/onlineCheckout.d.ts.map +1 -0
  30. package/dist/atheletebridge/utils/onlineCheckout.js +61 -0
  31. package/dist/atheletebridge/utils/onlineCheckout.js.map +1 -0
  32. package/dist/generated/global-types.d.ts +6164 -1907
  33. package/dist/generated/global-types.d.ts.map +1 -1
  34. package/dist/generated/wspace-types.d.ts +60796 -3422
  35. package/dist/generated/wspace-types.d.ts.map +1 -1
  36. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { AthMyRegistration } from '../../types/registration';
3
+
4
+ /** Page the processor sends the family back to. */
5
+ export declare const MY_REGISTRATIONS_PATH = "/my-registrations";
6
+ export declare const PayOnlineButton: FC<{
7
+ registration: Pick<AthMyRegistration, 'id' | 'amountOutstanding' | 'currency'>;
8
+ className?: string;
9
+ }>;
10
+ export declare const CheckoutReturnNotice: FC;
11
+ //# sourceMappingURL=OnlineCheckout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnlineCheckout.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/components/registration/OnlineCheckout.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAc7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAKlE,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC;IAC/B,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,mBAAmB,GAAG,UAAU,CAAC,CAAC;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CA4CA,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAiFlC,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { useAthleteBridge as e } from "../../context/AthleteBridgeContext.js";
2
+ import { useConfirmRegistrationCheckout as t, useStartRegistrationCheckout as n } from "../../hooks/useRegistrationApi.js";
3
+ import { formatMoney as r } from "../../utils/money.js";
4
+ import { appPageUrl as i, checkoutResultMessage as a, parseCheckoutReturn as o, withoutReturnParams as s } from "../../utils/onlineCheckout.js";
5
+ import { useEffect as c, useRef as l, useState as u } from "react";
6
+ import { CheckCircle2 as d, CreditCard as f, Info as p, Loader2 as m } from "lucide-react";
7
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
8
+ //#region src/atheletebridge/components/registration/OnlineCheckout.tsx
9
+ var _ = (e, t) => e instanceof Error ? e.message : t, v = "/my-registrations", y = ({ registration: t, className: a }) => {
10
+ let { basePath: o } = e(), s = n(), [c, l] = u(null), d = async () => {
11
+ l(null);
12
+ try {
13
+ let e = await s.mutateAsync({
14
+ submissionId: t.id,
15
+ returnUrl: i(window.location.origin, o ?? "/", v)
16
+ });
17
+ window.location.assign(e.url);
18
+ } catch (e) {
19
+ l(_(e, "Could not open the online payment."));
20
+ }
21
+ };
22
+ return /* @__PURE__ */ g("span", {
23
+ className: "inline-flex flex-col items-end gap-1",
24
+ children: [/* @__PURE__ */ g("button", {
25
+ type: "button",
26
+ "data-testid": "pay-online",
27
+ disabled: s.isPending,
28
+ onClick: () => void d(),
29
+ className: a ?? "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50",
30
+ children: [
31
+ s.isPending ? /* @__PURE__ */ h(m, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ h(f, { className: "h-4 w-4" }),
32
+ " ",
33
+ "Pay ",
34
+ r(t.amountOutstanding, t.currency),
35
+ " online"
36
+ ]
37
+ }), c && /* @__PURE__ */ h("span", {
38
+ role: "alert",
39
+ className: "text-xs text-status-error-text",
40
+ children: c
41
+ })]
42
+ });
43
+ }, b = () => {
44
+ let e = t(), n = e.mutateAsync, i = l(!1), [f, v] = u(null);
45
+ if (c(() => {
46
+ if (i.current) return;
47
+ let e = o(window.location.search);
48
+ e && (i.current = !0, window.history.replaceState(window.history.state, "", s(window.location.href)), n(e.checkoutId).then((t) => {
49
+ v({
50
+ ...a(e, t),
51
+ registration: t
52
+ });
53
+ }).catch((e) => {
54
+ v({
55
+ tone: "error",
56
+ message: _(e, "We could not check the payment. Refresh to try again."),
57
+ registration: null
58
+ });
59
+ }));
60
+ }, [n]), e.isPending) return /* @__PURE__ */ g("p", {
61
+ role: "status",
62
+ className: "mb-4 flex items-center gap-2 text-sm text-text-secondary",
63
+ "data-testid": "checkout-return",
64
+ children: [/* @__PURE__ */ h(m, { className: "h-4 w-4 animate-spin" }), " Checking your payment…"]
65
+ });
66
+ if (!f) return null;
67
+ let y = f.tone === "success" ? "border-status-success-border bg-status-success-bg-subtle text-status-success-text" : f.tone === "error" ? "border-status-error-border bg-status-error-bg-subtle text-status-error-text" : "border-border-seam bg-bg-sunken text-text-primary", b = f.registration;
68
+ return /* @__PURE__ */ g("div", {
69
+ role: f.tone === "error" ? "alert" : "status",
70
+ "data-testid": "checkout-return",
71
+ "data-tone": f.tone,
72
+ className: `mb-4 space-y-1 rounded-lg border p-3 text-sm ${y}`,
73
+ children: [/* @__PURE__ */ g("p", {
74
+ className: "flex items-start gap-2",
75
+ children: [f.tone === "success" ? /* @__PURE__ */ h(d, {
76
+ className: "mt-0.5 h-4 w-4 shrink-0",
77
+ "aria-hidden": "true"
78
+ }) : /* @__PURE__ */ h(p, {
79
+ className: "mt-0.5 h-4 w-4 shrink-0",
80
+ "aria-hidden": "true"
81
+ }), /* @__PURE__ */ h("span", { children: f.message })]
82
+ }), b && /* @__PURE__ */ g("p", {
83
+ className: "pl-6 text-xs tabular-nums",
84
+ "data-testid": "checkout-return-balance",
85
+ children: [
86
+ b.participantName,
87
+ " · ",
88
+ b.formTitle,
89
+ ": paid ",
90
+ r(b.amountPaid, b.currency),
91
+ " ",
92
+ "of ",
93
+ r(b.amountDue, b.currency),
94
+ b.amountOutstanding > 0 ? `, ${r(b.amountOutstanding, b.currency)} still due` : ""
95
+ ]
96
+ })]
97
+ });
98
+ };
99
+ //#endregion
100
+ export { b as CheckoutReturnNotice, y as PayOnlineButton };
101
+
102
+ //# sourceMappingURL=OnlineCheckout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnlineCheckout.js","names":[],"sources":["../../../../src/atheletebridge/components/registration/OnlineCheckout.tsx"],"sourcesContent":["/**\n * Family online checkout (BOFF-10902)\n * @module atheletebridge/components/registration\n *\n * `PayOnlineButton` opens the club's processor checkout for the outstanding\n * balance of one of the family's own registrations and sends the browser to\n * it. The processor returns the family to \"My registrations\" with\n * `?athCheckout=<id>&athStatus=…`; `CheckoutReturnNotice` settles that\n * checkout with the server (which re-reads it from the processor, never\n * trusting the browser) and reports the updated balance.\n */\n\nimport { useEffect, useRef, useState, type FC } from 'react';\nimport { CheckCircle2, CreditCard, Info, Loader2 } from 'lucide-react';\nimport { useAthleteBridge } from '../../context/AthleteBridgeContext';\nimport {\n useConfirmRegistrationCheckout,\n useStartRegistrationCheckout,\n} from '../../hooks/useRegistrationApi';\nimport { formatMoney } from '../../utils/money';\nimport {\n appPageUrl,\n checkoutResultMessage,\n parseCheckoutReturn,\n withoutReturnParams,\n} from '../../utils/onlineCheckout';\nimport type { AthMyRegistration } from '../../types/registration';\n\nconst errorMessage = (err: unknown, fallback: string) =>\n err instanceof Error ? err.message : fallback;\n\n/** Page the processor sends the family back to. */\nexport const MY_REGISTRATIONS_PATH = '/my-registrations';\n\nexport const PayOnlineButton: FC<{\n registration: Pick<AthMyRegistration, 'id' | 'amountOutstanding' | 'currency'>;\n className?: string;\n}> = ({ registration, className }) => {\n const { basePath } = useAthleteBridge();\n const start = useStartRegistrationCheckout();\n const [error, setError] = useState<string | null>(null);\n\n const onPay = async () => {\n setError(null);\n try {\n const session = await start.mutateAsync({\n submissionId: registration.id,\n returnUrl: appPageUrl(window.location.origin, basePath ?? '/', MY_REGISTRATIONS_PATH),\n });\n window.location.assign(session.url);\n } catch (err) {\n setError(errorMessage(err, 'Could not open the online payment.'));\n }\n };\n\n return (\n <span className=\"inline-flex flex-col items-end gap-1\">\n <button\n type=\"button\"\n data-testid=\"pay-online\"\n disabled={start.isPending}\n onClick={() => void onPay()}\n className={\n className ??\n 'inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50'\n }\n >\n {start.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <CreditCard className=\"h-4 w-4\" />\n )}{' '}\n Pay {formatMoney(registration.amountOutstanding, registration.currency)} online\n </button>\n {error && (\n <span role=\"alert\" className=\"text-xs text-status-error-text\">\n {error}\n </span>\n )}\n </span>\n );\n};\n\nexport const CheckoutReturnNotice: FC = () => {\n const confirm = useConfirmRegistrationCheckout();\n const confirmAsync = confirm.mutateAsync;\n const handled = useRef(false);\n const [notice, setNotice] = useState<{\n tone: 'success' | 'info' | 'error';\n message: string;\n registration: AthMyRegistration | null;\n } | null>(null);\n\n useEffect(() => {\n if (handled.current) return;\n const result = parseCheckoutReturn(window.location.search);\n if (!result) return;\n handled.current = true;\n window.history.replaceState(\n window.history.state,\n '',\n withoutReturnParams(window.location.href)\n );\n // Settle even a cancelled checkout: the server expires it so it can no\n // longer be paid on top of a newer one.\n confirmAsync(result.checkoutId)\n .then((registration) => {\n setNotice({ ...checkoutResultMessage(result, registration), registration });\n })\n .catch((err: unknown) => {\n setNotice({\n tone: 'error',\n message: errorMessage(err, 'We could not check the payment. Refresh to try again.'),\n registration: null,\n });\n });\n }, [confirmAsync]);\n\n if (confirm.isPending) {\n return (\n <p\n role=\"status\"\n className=\"mb-4 flex items-center gap-2 text-sm text-text-secondary\"\n data-testid=\"checkout-return\"\n >\n <Loader2 className=\"h-4 w-4 animate-spin\" /> Checking your payment…\n </p>\n );\n }\n if (!notice) return null;\n\n const toneClass =\n notice.tone === 'success'\n ? 'border-status-success-border bg-status-success-bg-subtle text-status-success-text'\n : notice.tone === 'error'\n ? 'border-status-error-border bg-status-error-bg-subtle text-status-error-text'\n : 'border-border-seam bg-bg-sunken text-text-primary';\n const reg = notice.registration;\n return (\n <div\n role={notice.tone === 'error' ? 'alert' : 'status'}\n data-testid=\"checkout-return\"\n data-tone={notice.tone}\n className={`mb-4 space-y-1 rounded-lg border p-3 text-sm ${toneClass}`}\n >\n <p className=\"flex items-start gap-2\">\n {notice.tone === 'success' ? (\n <CheckCircle2 className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n ) : (\n <Info className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n )}\n <span>{notice.message}</span>\n </p>\n {reg && (\n <p className=\"pl-6 text-xs tabular-nums\" data-testid=\"checkout-return-balance\">\n {reg.participantName} · {reg.formTitle}: paid {formatMoney(reg.amountPaid, reg.currency)}{' '}\n of {formatMoney(reg.amountDue, reg.currency)}\n {reg.amountOutstanding > 0\n ? `, ${formatMoney(reg.amountOutstanding, reg.currency)} still due`\n : ''}\n </p>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;AA4BA,IAAM,KAAgB,GAAc,MAClC,aAAe,QAAQ,EAAI,UAAU,GAG1B,IAAwB,qBAExB,KAGP,EAAE,iBAAc,mBAAgB;CACpC,IAAM,EAAE,gBAAa,EAAiB,GAChC,IAAQ,EAA6B,GACrC,CAAC,GAAO,KAAY,EAAwB,IAAI,GAEhD,IAAQ,YAAY;EACxB,EAAS,IAAI;EACb,IAAI;GACF,IAAM,IAAU,MAAM,EA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Y;YAHd,CAKE,kBAAC,GAAD,EAAS,WAAU,uBAAwB,CAAA,GAAC,yBAC3C;;CAGP,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAM,IACJ,EAAO,SAAS,YACZ,sFACA,EAAO,SAAS,UACd,gFACA,qDACF,IAAM,EAAO;CACnB,OACE,kBAAC,OAAD;EACE,MAAM,EAAO,SAAS,UAAU,UAAU;EAC1C,eAAY;EACZ,aAAW,EAAO;EAClB,WAAW,gDAAgD;YAJ7D,CAME,kBAAC,KAAD;GAAG,WAAU;aAAb,CACG,EAAO,SAAS,YACf,kBAAC,GAAD;IAAc,WAAU;IAA0B,eAAY;GAAQ,CAAA,IAEtE,kBAAC,GAAD;IAAM,WAAU;IAA0B,eAAY;GAAQ,CAAA,GAEhE,kBAAC,QAAD,EAAA,UAAO,EAAO,QAAc,CAAA,CAC3B;MACF,KACC,kBAAC,KAAD;GAAG,WAAU;GAA4B,eAAY;aAArD;IACG,EAAI;IAAgB;IAAI,EAAI;IAAU;IAAQ,EAAY,EAAI,YAAY,EAAI,QAAQ;IAAG;IAAI;IAC1F,EAAY,EAAI,WAAW,EAAI,QAAQ;IAC1C,EAAI,oBAAoB,IACrB,KAAK,EAAY,EAAI,mBAAmB,EAAI,QAAQ,EAAE,cACtD;GACH;IAEF;;AAET"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+
3
+ export declare const OnlinePaymentsCard: FC;
4
+ //# sourceMappingURL=OnlinePaymentsCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnlinePaymentsCard.d.ts","sourceRoot":"","sources":["../../../../src/atheletebridge/components/registration/OnlinePaymentsCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAiD1E,eAAO,MAAM,kBAAkB,EAAE,EAwIhC,CAAC"}
@@ -0,0 +1,150 @@
1
+ import { StatusBadge as e } from "../StatusBadge.js";
2
+ import { formatDate as t } from "../../utils/formatters.js";
3
+ import { useConnectPaymentAccount as n, useOnlinePaymentsStatus as r, useRefreshPaymentAccount as i } from "../../hooks/useRegistrationApi.js";
4
+ import { onlinePaymentsState as a, parseOnboardingReturn as o, providerLabel as s, withoutReturnParams as c } from "../../utils/onlineCheckout.js";
5
+ import { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
6
+ import { CreditCard as p, ExternalLink as m, Loader2 as h, RefreshCw as g } from "lucide-react";
7
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
8
+ //#region src/atheletebridge/components/registration/OnlinePaymentsCard.tsx
9
+ var y = "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50", b = "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50", x = {
10
+ unavailable: "Online payments are not switched on for AthleteBridge yet. Families pay you directly, and you record each payment on the registration.",
11
+ not_connected: "Connect your Stripe account so families can pay registration fees by card when they register. Payments go straight to your club; AthleteBridge never holds the money.",
12
+ onboarding: "Your Stripe account is created but the setup form is not finished. Continue the setup to start taking online payments.",
13
+ pending_review: "Stripe has your details but has not enabled card payments yet. This usually takes a few minutes; refresh to check again.",
14
+ ready: "Families see a \"Pay online\" button for any fee still due."
15
+ }, S = (e, t) => e instanceof Error ? e.message : t, C = () => c(window.location.href), w = ({ label: t, on: n, testId: r }) => /* @__PURE__ */ v("div", {
16
+ className: "flex items-center justify-between gap-3",
17
+ "data-testid": r,
18
+ children: [/* @__PURE__ */ _("dt", {
19
+ className: "text-text-secondary",
20
+ children: t
21
+ }), /* @__PURE__ */ _("dd", { children: /* @__PURE__ */ _(e, {
22
+ status: n ? "yes" : "not yet",
23
+ variant: n ? "success" : "warning"
24
+ }) })]
25
+ }), T = () => {
26
+ let c = r(), T = n(), E = i(), [D, O] = f(null), k = d(!1), A = T.mutateAsync, j = E.mutateAsync, M = l(async () => {
27
+ O(null);
28
+ try {
29
+ let e = await A({ returnUrl: C() });
30
+ window.location.assign(e.url);
31
+ } catch (e) {
32
+ O(S(e, "Could not open the Stripe setup."));
33
+ }
34
+ }, [A]), N = l(async () => {
35
+ O(null);
36
+ try {
37
+ await j();
38
+ } catch (e) {
39
+ O(S(e, "Could not refresh the Stripe account."));
40
+ }
41
+ }, [j]), P = c.data?.processorConfigured ?? !1;
42
+ if (u(() => {
43
+ if (k.current || !P) return;
44
+ let e = o(window.location.search);
45
+ e && (k.current = !0, window.history.replaceState(window.history.state, "", C()), e === "refresh" ? M() : N());
46
+ }, [
47
+ P,
48
+ M,
49
+ N
50
+ ]), c.isLoading || c.isError || !c.data) return null;
51
+ let F = c.data, I = a(F), L = F.account, R = T.isPending || E.isPending;
52
+ return /* @__PURE__ */ v("section", {
53
+ "aria-label": "Online payments",
54
+ className: "mb-6 space-y-3 rounded-lg border border-border-seam bg-bg-surface p-4",
55
+ "data-testid": "online-payments-card",
56
+ "data-state": I,
57
+ children: [
58
+ /* @__PURE__ */ v("div", {
59
+ className: "flex flex-wrap items-center justify-between gap-3",
60
+ children: [/* @__PURE__ */ v("h2", {
61
+ className: "flex items-center gap-2 text-base font-semibold text-text-primary",
62
+ children: [/* @__PURE__ */ _(p, {
63
+ className: "h-5 w-5 text-text-secondary",
64
+ "aria-hidden": "true"
65
+ }), " Online payments"]
66
+ }), /* @__PURE__ */ v("span", {
67
+ className: "flex flex-wrap items-center gap-2",
68
+ children: [F.processorConfigured && F.testMode && /* @__PURE__ */ _(e, {
69
+ status: "test mode",
70
+ variant: "warning"
71
+ }), /* @__PURE__ */ _(e, {
72
+ status: I === "ready" ? "active" : I === "unavailable" ? "not available" : "setup needed",
73
+ variant: I === "ready" ? "success" : "secondary"
74
+ })]
75
+ })]
76
+ }),
77
+ /* @__PURE__ */ _("p", {
78
+ className: "text-sm text-text-secondary",
79
+ "data-testid": "online-payments-message",
80
+ children: x[I]
81
+ }),
82
+ F.processorConfigured && F.testMode && /* @__PURE__ */ _("p", {
83
+ className: "text-xs text-text-secondary",
84
+ children: "Test mode: no real money moves. Use Stripe test cards (for example 4242 4242 4242 4242)."
85
+ }),
86
+ L && /* @__PURE__ */ v("dl", {
87
+ className: "grid grid-cols-1 gap-x-6 gap-y-2 text-sm sm:grid-cols-3",
88
+ children: [
89
+ /* @__PURE__ */ _(w, {
90
+ label: "Setup submitted",
91
+ on: L.detailsSubmitted,
92
+ testId: "flag-details"
93
+ }),
94
+ /* @__PURE__ */ _(w, {
95
+ label: "Card payments",
96
+ on: L.chargesEnabled,
97
+ testId: "flag-charges"
98
+ }),
99
+ /* @__PURE__ */ _(w, {
100
+ label: "Payouts",
101
+ on: L.payoutsEnabled,
102
+ testId: "flag-payouts"
103
+ })
104
+ ]
105
+ }),
106
+ L && /* @__PURE__ */ v("p", {
107
+ className: "text-xs text-text-secondary",
108
+ children: [
109
+ s(L.provider),
110
+ " account ",
111
+ L.accountId,
112
+ L.lastSyncedAt ? ` · checked ${t(L.lastSyncedAt)}` : ""
113
+ ]
114
+ }),
115
+ F.processorConfigured && /* @__PURE__ */ v("div", {
116
+ className: "flex flex-wrap gap-2",
117
+ children: [I !== "ready" && /* @__PURE__ */ v("button", {
118
+ type: "button",
119
+ className: y,
120
+ disabled: R,
121
+ onClick: () => void M(),
122
+ children: [
123
+ T.isPending ? /* @__PURE__ */ _(h, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ _(m, { className: "h-4 w-4" }),
124
+ " ",
125
+ I === "not_connected" ? "Connect Stripe" : "Continue Stripe setup"
126
+ ]
127
+ }), L && /* @__PURE__ */ v("button", {
128
+ type: "button",
129
+ className: b,
130
+ disabled: R,
131
+ onClick: () => void N(),
132
+ children: [
133
+ E.isPending ? /* @__PURE__ */ _(h, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ _(g, { className: "h-4 w-4" }),
134
+ " ",
135
+ "Refresh status"
136
+ ]
137
+ })]
138
+ }),
139
+ D && /* @__PURE__ */ _("p", {
140
+ role: "alert",
141
+ className: "text-sm text-status-error-text",
142
+ children: D
143
+ })
144
+ ]
145
+ });
146
+ };
147
+ //#endregion
148
+ export { T as OnlinePaymentsCard };
149
+
150
+ //# sourceMappingURL=OnlinePaymentsCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnlinePaymentsCard.js","names":[],"sources":["../../../../src/atheletebridge/components/registration/OnlinePaymentsCard.tsx"],"sourcesContent":["/**\n * Online payments card (club staff, BOFF-10902)\n * @module atheletebridge/components/registration\n *\n * Lets a club connect its own payout account at the payment processor\n * (Stripe Connect Express, BOFF-10805) so families can pay registration fees\n * online. The club stays merchant of record: money goes straight to its\n * account and Burdenoff never holds it.\n *\n * \"Connect Stripe\" opens the processor's hosted onboarding. When the club comes\n * back (`?athOnboarding=return`) the card re-reads the account from the\n * processor; when the onboarding link expired (`?athOnboarding=refresh`) it\n * opens a fresh one. Renders nothing for staff who cannot read the payment\n * ledger (FORBIDDEN), like the reconciliation panel.\n */\n\nimport { useCallback, useEffect, useRef, useState, type FC } from 'react';\nimport { CreditCard, ExternalLink, Loader2, RefreshCw } from 'lucide-react';\nimport { StatusBadge } from '../StatusBadge';\nimport {\n useConnectPaymentAccount,\n useOnlinePaymentsStatus,\n useRefreshPaymentAccount,\n} from '../../hooks/useRegistrationApi';\nimport { formatDate } from '../../utils/formatters';\nimport {\n onlinePaymentsState,\n parseOnboardingReturn,\n providerLabel,\n withoutReturnParams,\n type OnlinePaymentsState,\n} from '../../utils/onlineCheckout';\n\nconst primaryButton =\n 'inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50';\nconst secondaryButton =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50';\n\nconst STATE_COPY: Record<OnlinePaymentsState, string> = {\n unavailable:\n 'Online payments are not switched on for AthleteBridge yet. Families pay you directly, and you record each payment on the registration.',\n not_connected:\n 'Connect your Stripe account so families can pay registration fees by card when they register. Payments go straight to your club; AthleteBridge never holds the money.',\n onboarding:\n 'Your Stripe account is created but the setup form is not finished. Continue the setup to start taking online payments.',\n pending_review:\n 'Stripe has your details but has not enabled card payments yet. This usually takes a few minutes; refresh to check again.',\n ready: 'Families see a \"Pay online\" button for any fee still due.',\n};\n\nconst errorMessage = (err: unknown, fallback: string) =>\n err instanceof Error ? err.message : fallback;\n\n/** The page the club should come back to after onboarding (this page, cleaned). */\nconst currentReturnUrl = () => withoutReturnParams(window.location.href);\n\nconst Flag: FC<{ label: string; on: boolean; testId: string }> = ({ label, on, testId }) => (\n <div className=\"flex items-center justify-between gap-3\" data-testid={testId}>\n <dt className=\"text-text-secondary\">{label}</dt>\n <dd>\n <StatusBadge status={on ? 'yes' : 'not yet'} variant={on ? 'success' : 'warning'} />\n </dd>\n </div>\n);\n\nexport const OnlinePaymentsCard: FC = () => {\n const status = useOnlinePaymentsStatus();\n const connect = useConnectPaymentAccount();\n const refresh = useRefreshPaymentAccount();\n const [error, setError] = useState<string | null>(null);\n const handledReturn = useRef(false);\n\n const connectAsync = connect.mutateAsync;\n const refreshAsync = refresh.mutateAsync;\n\n const startOnboarding = useCallback(async () => {\n setError(null);\n try {\n const link = await connectAsync({ returnUrl: currentReturnUrl() });\n window.location.assign(link.url);\n } catch (err) {\n setError(errorMessage(err, 'Could not open the Stripe setup.'));\n }\n }, [connectAsync]);\n\n const refreshAccount = useCallback(async () => {\n setError(null);\n try {\n await refreshAsync();\n } catch (err) {\n setError(errorMessage(err, 'Could not refresh the Stripe account.'));\n }\n }, [refreshAsync]);\n\n // Handle the processor's return exactly once, then clean the address bar so\n // a reload does not replay it.\n const processorConfigured = status.data?.processorConfigured ?? false;\n useEffect(() => {\n if (handledReturn.current || !processorConfigured) return;\n const kind = parseOnboardingReturn(window.location.search);\n if (!kind) return;\n handledReturn.current = true;\n window.history.replaceState(window.history.state, '', currentReturnUrl());\n void (kind === 'refresh' ? startOnboarding() : refreshAccount());\n }, [processorConfigured, startOnboarding, refreshAccount]);\n\n if (status.isLoading || status.isError || !status.data) return null;\n const data = status.data;\n const state = onlinePaymentsState(data);\n const account = data.account;\n const busy = connect.isPending || refresh.isPending;\n\n return (\n <section\n aria-label=\"Online payments\"\n className=\"mb-6 space-y-3 rounded-lg border border-border-seam bg-bg-surface p-4\"\n data-testid=\"online-payments-card\"\n data-state={state}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <h2 className=\"flex items-center gap-2 text-base font-semibold text-text-primary\">\n <CreditCard className=\"h-5 w-5 text-text-secondary\" aria-hidden=\"true\" /> Online payments\n </h2>\n <span className=\"flex flex-wrap items-center gap-2\">\n {data.processorConfigured && data.testMode && (\n <StatusBadge status=\"test mode\" variant=\"warning\" />\n )}\n <StatusBadge\n status={\n state === 'ready'\n ? 'active'\n : state === 'unavailable'\n ? 'not available'\n : 'setup needed'\n }\n variant={state === 'ready' ? 'success' : 'secondary'}\n />\n </span>\n </div>\n <p className=\"text-sm text-text-secondary\" data-testid=\"online-payments-message\">\n {STATE_COPY[state]}\n </p>\n {data.processorConfigured && data.testMode && (\n <p className=\"text-xs text-text-secondary\">\n Test mode: no real money moves. Use Stripe test cards (for example 4242 4242 4242 4242).\n </p>\n )}\n {account && (\n <dl className=\"grid grid-cols-1 gap-x-6 gap-y-2 text-sm sm:grid-cols-3\">\n <Flag label=\"Setup submitted\" on={account.detailsSubmitted} testId=\"flag-details\" />\n <Flag label=\"Card payments\" on={account.chargesEnabled} testId=\"flag-charges\" />\n <Flag label=\"Payouts\" on={account.payoutsEnabled} testId=\"flag-payouts\" />\n </dl>\n )}\n {account && (\n <p className=\"text-xs text-text-secondary\">\n {providerLabel(account.provider)} account {account.accountId}\n {account.lastSyncedAt ? ` · checked ${formatDate(account.lastSyncedAt)}` : ''}\n </p>\n )}\n {data.processorConfigured && (\n <div className=\"flex flex-wrap gap-2\">\n {state !== 'ready' && (\n <button\n type=\"button\"\n className={primaryButton}\n disabled={busy}\n onClick={() => void startOnboarding()}\n >\n {connect.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <ExternalLink className=\"h-4 w-4\" />\n )}{' '}\n {state === 'not_connected' ? 'Connect Stripe' : 'Continue Stripe setup'}\n </button>\n )}\n {account && (\n <button\n type=\"button\"\n className={secondaryButton}\n disabled={busy}\n onClick={() => void refreshAccount()}\n >\n {refresh.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <RefreshCw className=\"h-4 w-4\" />\n )}{' '}\n Refresh status\n </button>\n )}\n </div>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n </section>\n );\n};\n"],"mappings":";;;;;;;;AAiCA,IAAM,IACJ,+LACI,IACJ,kLAEI,IAAkD;CACtD,aACE;CACF,eACE;CACF,YACE;CACF,gBACE;CACF,OAAO;AACT,GAEM,KAAgB,GAAc,MAClC,aAAe,QAAQ,EAAI,UAAU,GAGjC,UAAyB,EAAoB,OAAO,SAAS,IAAI,GAEjE,KAA4D,EAAE,UAAO,OAAI,gBAC7E,kBAAC,OAAD;CAAK,WAAU;CAA0C,eAAa;WAAtE,CACE,kBAAC,MAAD;EAAI,WAAU;YAAuB;CAAU,CAAA,GAC/C,kBAAC,MAAD,EAAA,UACE,kBAAC,GAAD;EAAa,QAAQ,IAAK,QAAQ;EAAW,SAAS,IAAK,YAAY;CAAY,CAAA,EACjF,CAAA,CACD;IAGM,UAA+B;CAC1C,IAAM,IAAS,EAAwB,GACjC,IAAU,EAAyB,GACnC,IAAU,EAAyB,GACnC,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,IAAgB,EAAO,EAAK,GAE5B,IAAe,EAAQ,aACvB,IAAe,EAAQ,aAEvB,IAAkB,EAAY,YAAY;EAC9C,EAAS,IAAI;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types';
2
- import { AthCreateRegistrationFormInput, AthMyRegistration, AthMyRegistrationConnection, AthPublicRegistrationForm, AthRecordRegistrationInput, AthRecordRegistrationPaymentInput, AthRegistrationDecision, AthRegistrationForm, AthRegistrationFormConnection, AthRegistrationFormStatus, AthRegistrationPayment, AthRegistrationPaymentStatus, AthRegistrationPaymentSummary, AthRegistrationSubmission, AthRegistrationSubmissionConnection, AthRegistrationSubmissionStatus, AthSubmitRegistrationInput, AthUpdateRegistrationFormInput } from '../types/registration';
2
+ import { AthCreateRegistrationFormInput, AthMyRegistration, AthMyRegistrationConnection, AthOnlinePaymentsStatus, AthPaymentAccount, AthPaymentAccountLink, AthPublicRegistrationForm, AthRecordRegistrationInput, AthRecordRegistrationPaymentInput, AthRegistrationCheckoutSession, AthRegistrationDecision, AthRegistrationForm, AthRegistrationFormConnection, AthRegistrationFormStatus, AthRegistrationPayment, AthRegistrationPaymentStatus, AthRegistrationPaymentSummary, AthRegistrationSubmission, AthRegistrationSubmissionConnection, AthRegistrationSubmissionStatus, AthSubmitRegistrationInput, AthUpdateRegistrationFormInput } from '../types/registration';
3
3
 
4
4
  export interface RegistrationFormFilters {
5
5
  status?: AthRegistrationFormStatus;
@@ -44,6 +44,16 @@ export declare const useRefundRegistrationPayment: () => import('@tanstack/react
44
44
  amount: number;
45
45
  reason: string;
46
46
  }, unknown>;
47
+ export declare const useOnlinePaymentsStatus: () => import('@tanstack/react-query').UseQueryResult<NoInfer<AthOnlinePaymentsStatus>, Error>;
48
+ /**
49
+ * Create (first call) or resume the club's processor onboarding. Resolves to
50
+ * the hosted onboarding link; the caller redirects the browser to it.
51
+ */
52
+ export declare const useConnectPaymentAccount: () => import('@tanstack/react-query').UseMutationResult<AthPaymentAccountLink, Error, {
53
+ returnUrl: string;
54
+ email?: string;
55
+ }, unknown>;
56
+ export declare const useRefreshPaymentAccount: () => import('@tanstack/react-query').UseMutationResult<AthPaymentAccount, Error, void, unknown>;
47
57
  export declare const usePublicRegistrationForm: (slug: string | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<AthPublicRegistrationForm | null>, Error>;
48
58
  export declare const useSubmitRegistration: () => import('@tanstack/react-query').UseMutationResult<AthMyRegistration, Error, {
49
59
  slug: string;
@@ -51,4 +61,11 @@ export declare const useSubmitRegistration: () => import('@tanstack/react-query'
51
61
  }, unknown>;
52
62
  export declare const useMyRegistrations: (pagination?: PaginationInput) => import('@tanstack/react-query').UseQueryResult<NoInfer<AthMyRegistrationConnection>, Error>;
53
63
  export declare const useWithdrawMyRegistration: () => import('@tanstack/react-query').UseMutationResult<AthMyRegistration, Error, string, unknown>;
64
+ /** Open a processor checkout for the outstanding balance of one of your registrations. */
65
+ export declare const useStartRegistrationCheckout: () => import('@tanstack/react-query').UseMutationResult<AthRegistrationCheckoutSession, Error, {
66
+ submissionId: string;
67
+ returnUrl: string;
68
+ }, unknown>;
69
+ /** Settle a checkout after the processor sends the family back (the server re-reads it). */
70
+ export declare const useConfirmRegistrationCheckout: () => import('@tanstack/react-query').UseMutationResult<AthMyRegistration, Error, string, unknown>;
54
71
  //# sourceMappingURL=useRegistrationApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRegistrationApi.d.ts","sourceRoot":"","sources":["../../../src/atheletebridge/hooks/useRegistrationApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EACV,8BAA8B,EAC9B,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,iCAAiC,EACjC,uBAAuB,EACvB,mBAAmB,EACnB,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,mCAAmC,EACnC,+BAA+B,EAC/B,0BAA0B,EAC1B,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AA8D/B,MAAM,WAAW,uBAAuB;IACtC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MAAM,yBAAyB,oGAgBrC,CAAC;AAMF,0FAA0F;AAC1F,eAAO,MAAM,4BAA4B;kBAGK,MAAM;eAAa,MAAM;WAatE,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,8BAA8B,oGAgB1C,CAAC"}
@@ -9,15 +9,15 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
9
9
  submissionCount createdAt updatedAt
10
10
  fields { ${o} }
11
11
  fees { ${s} }
12
- `, l = "\n id workspaceId formId formTitle source submittedByUserId participantName\n participantUserId contactName contactEmail contactPhone answers selectedFeeIds\n status paymentStatus amountDue amountPaid amountOutstanding currency\n waiverAcceptedAt reviewNotes reviewedAt submittedAt createdAt updatedAt\n participantIsRegistrant rosterOutcome rosterMemberId rosterTeamId rosterTeamName\n", u = "\n id submissionId amount refundedAmount netAmount currency method status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n", d = "\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n", f = `
12
+ `, l = "\n id workspaceId formId formTitle source submittedByUserId participantName\n participantUserId contactName contactEmail contactPhone answers selectedFeeIds\n status paymentStatus amountDue amountPaid amountOutstanding currency\n waiverAcceptedAt reviewNotes reviewedAt submittedAt createdAt updatedAt\n participantIsRegistrant rosterOutcome rosterMemberId rosterTeamId rosterTeamName\n", u = "\n id submissionId amount refundedAmount netAmount currency method processor status\n reference note receivedAt voidedAt voidReason refundedAt refundReason\n createdBy createdAt\n", d = "\n formId submissionCount acceptedCount notRequiredCount unpaidCount\n partiallyPaidCount paidCount refundedCount\n totals { currency amountDue amountCollected amountRefunded amountOutstanding }\n", f = `
13
13
  id slug title description season currency opensAt closesAt waiverText isOpen
14
14
  spotsRemaining
15
15
  fields { ${o} }
16
16
  fees { ${s} }
17
- `, p = "\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency submittedAt\n", m = () => {
17
+ `, p = "\n id formId formTitle formSlug participantName status paymentStatus amountDue\n amountPaid amountOutstanding currency onlinePaymentAvailable submittedAt\n", m = "\n provider accountId chargesEnabled payoutsEnabled detailsSubmitted lastSyncedAt createdAt\n", h = () => {
18
18
  let e = i();
19
19
  return () => e.invalidateQueries({ queryKey: a });
20
- }, h = (n = {}) => {
20
+ }, g = (n = {}) => {
21
21
  let { apiGatewayUrl: i, workspaceId: o } = e();
22
22
  return r({
23
23
  queryKey: [
@@ -33,7 +33,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
33
33
  }
34
34
  }`, { ...n }, i)).athListRegistrationForms
35
35
  });
36
- }, g = (n) => {
36
+ }, _ = (n) => {
37
37
  let { apiGatewayUrl: i, workspaceId: o } = e();
38
38
  return r({
39
39
  queryKey: [
@@ -45,16 +45,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
45
45
  queryFn: async () => (await t(`query AthRegistrationForm($id: ID!) { athRegistrationForm(id: $id) { ${c} } }`, { id: n }, i)).athRegistrationForm,
46
46
  enabled: !!n
47
47
  });
48
- }, _ = () => {
49
- let { apiGatewayUrl: r } = e(), i = m();
48
+ }, v = () => {
49
+ let { apiGatewayUrl: r } = e(), i = h();
50
50
  return n({
51
51
  mutationFn: async (e) => (await t(`mutation AthCreateRegistrationForm($input: AthCreateRegistrationFormInput!) {
52
52
  athCreateRegistrationForm(input: $input) { ${c} }
53
53
  }`, { input: e }, r)).athCreateRegistrationForm,
54
54
  onSuccess: () => void i()
55
55
  });
56
- }, v = () => {
57
- let { apiGatewayUrl: r } = e(), i = m();
56
+ }, y = () => {
57
+ let { apiGatewayUrl: r } = e(), i = h();
58
58
  return n({
59
59
  mutationFn: async ({ id: e, input: n }) => (await t(`mutation AthUpdateRegistrationForm($id: ID!, $input: AthUpdateRegistrationFormInput!) {
60
60
  athUpdateRegistrationForm(id: $id, input: $input) { ${c} }
@@ -64,7 +64,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
64
64
  }, r)).athUpdateRegistrationForm,
65
65
  onSuccess: () => void i()
66
66
  });
67
- }, y = {
67
+ }, b = {
68
68
  publish: {
69
69
  field: "athPublishRegistrationForm",
70
70
  selection: `{ ${c} }`
@@ -77,16 +77,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
77
77
  field: "athArchiveRegistrationForm",
78
78
  selection: ""
79
79
  }
80
- }, b = () => {
81
- let { apiGatewayUrl: r } = e(), i = m();
80
+ }, x = () => {
81
+ let { apiGatewayUrl: r } = e(), i = h();
82
82
  return n({
83
83
  mutationFn: async ({ id: e, action: n }) => {
84
- let { field: i, selection: a } = y[n];
84
+ let { field: i, selection: a } = b[n];
85
85
  return await t(`mutation AthRegistrationFormLifecycle($id: ID!) { ${i}(id: $id) ${a} }`, { id: e }, r), n;
86
86
  },
87
87
  onSuccess: () => void i()
88
88
  });
89
- }, x = (n, i = !0) => {
89
+ }, S = (n, i = !0) => {
90
90
  let { apiGatewayUrl: o, workspaceId: s } = e();
91
91
  return r({
92
92
  queryKey: [
@@ -113,7 +113,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
113
113
  }`, { ...n }, o)).athListRegistrationSubmissions,
114
114
  enabled: i
115
115
  });
116
- }, S = (n) => {
116
+ }, C = (n) => {
117
117
  let { apiGatewayUrl: i, workspaceId: o } = e();
118
118
  return r({
119
119
  queryKey: [
@@ -127,16 +127,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
127
127
  }`, { id: n }, i)).athRegistrationSubmission,
128
128
  enabled: !!n
129
129
  });
130
- }, C = () => {
131
- let { apiGatewayUrl: r } = e(), i = m();
130
+ }, w = () => {
131
+ let { apiGatewayUrl: r } = e(), i = h();
132
132
  return n({
133
133
  mutationFn: async (e) => (await t(`mutation AthRecordRegistration($input: AthRecordRegistrationInput!) {
134
134
  athRecordRegistration(input: $input) { ${l} }
135
135
  }`, { input: e }, r)).athRecordRegistration,
136
136
  onSuccess: () => void i()
137
137
  });
138
- }, w = () => {
139
- let { apiGatewayUrl: r } = e(), i = m();
138
+ }, T = () => {
139
+ let { apiGatewayUrl: r } = e(), i = h();
140
140
  return n({
141
141
  mutationFn: async ({ id: e, decision: n, notes: i }) => (await t(`mutation AthReviewRegistrationSubmission($id: ID!, $input: AthReviewRegistrationInput!) {
142
142
  athReviewRegistrationSubmission(id: $id, input: $input) { ${l} }
@@ -149,7 +149,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
149
149
  }, r)).athReviewRegistrationSubmission,
150
150
  onSuccess: () => void i()
151
151
  });
152
- }, T = (n) => {
152
+ }, E = (n) => {
153
153
  let { apiGatewayUrl: i, workspaceId: o } = e();
154
154
  return r({
155
155
  queryKey: [
@@ -164,7 +164,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
164
164
  enabled: !!n,
165
165
  retry: !1
166
166
  });
167
- }, E = (n) => {
167
+ }, D = (n) => {
168
168
  let { apiGatewayUrl: i, workspaceId: o } = e();
169
169
  return r({
170
170
  queryKey: [
@@ -178,16 +178,16 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
178
178
  }`, { formId: n ?? null }, i)).athRegistrationPaymentSummary,
179
179
  retry: !1
180
180
  });
181
- }, D = () => {
182
- let { apiGatewayUrl: r } = e(), i = m();
181
+ }, O = () => {
182
+ let { apiGatewayUrl: r } = e(), i = h();
183
183
  return n({
184
184
  mutationFn: async (e) => (await t(`mutation AthRecordRegistrationPayment($input: AthRecordRegistrationPaymentInput!) {
185
185
  athRecordRegistrationPayment(input: $input) { ${u} }
186
186
  }`, { input: e }, r)).athRecordRegistrationPayment,
187
187
  onSuccess: () => void i()
188
188
  });
189
- }, O = () => {
190
- let { apiGatewayUrl: r } = e(), i = m();
189
+ }, k = () => {
190
+ let { apiGatewayUrl: r } = e(), i = h();
191
191
  return n({
192
192
  mutationFn: async ({ id: e, reason: n }) => (await t(`mutation AthVoidRegistrationPayment($id: ID!, $reason: String!) {
193
193
  athVoidRegistrationPayment(id: $id, reason: $reason) { ${u} }
@@ -197,8 +197,8 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
197
197
  }, r)).athVoidRegistrationPayment,
198
198
  onSuccess: () => void i()
199
199
  });
200
- }, k = () => {
201
- let { apiGatewayUrl: r } = e(), i = m();
200
+ }, A = () => {
201
+ let { apiGatewayUrl: r } = e(), i = h();
202
202
  return n({
203
203
  mutationFn: async ({ id: e, amount: n, reason: i }) => (await t(`mutation AthRefundRegistrationPayment($id: ID!, $input: AthRefundRegistrationPaymentInput!) {
204
204
  athRefundRegistrationPayment(id: $id, input: $input) { ${u} }
@@ -211,7 +211,39 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
211
211
  }, r)).athRefundRegistrationPayment,
212
212
  onSuccess: () => void i()
213
213
  });
214
- }, A = (n) => {
214
+ }, j = () => {
215
+ let { apiGatewayUrl: n, workspaceId: i } = e();
216
+ return r({
217
+ queryKey: [
218
+ ...a,
219
+ i ?? null,
220
+ "online-payments"
221
+ ],
222
+ queryFn: async () => (await t(`query AthOnlinePaymentsStatus {
223
+ athOnlinePaymentsStatus {
224
+ processorConfigured testMode onlineCheckoutAvailable
225
+ account { ${m} }
226
+ }
227
+ }`, {}, n)).athOnlinePaymentsStatus,
228
+ retry: !1
229
+ });
230
+ }, M = () => {
231
+ let { apiGatewayUrl: r } = e();
232
+ return n({ mutationFn: async (e) => (await t(`mutation AthConnectPaymentAccount($input: AthConnectPaymentAccountInput!) {
233
+ athConnectPaymentAccount(input: $input) {
234
+ url expiresAt
235
+ account { ${m} }
236
+ }
237
+ }`, { input: e }, r)).athConnectPaymentAccount });
238
+ }, N = () => {
239
+ let { apiGatewayUrl: r } = e(), i = h();
240
+ return n({
241
+ mutationFn: async () => (await t(`mutation AthRefreshPaymentAccount {
242
+ athRefreshPaymentAccount { ${m} }
243
+ }`, {}, r)).athRefreshPaymentAccount,
244
+ onSuccess: () => void i()
245
+ });
246
+ }, P = (n) => {
215
247
  let { apiGatewayUrl: i } = e();
216
248
  return r({
217
249
  queryKey: [
@@ -224,8 +256,8 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
224
256
  }`, { slug: n }, i)).athRegistrationFormBySlug,
225
257
  enabled: !!n
226
258
  });
227
- }, j = () => {
228
- let { apiGatewayUrl: r } = e(), i = m();
259
+ }, F = () => {
260
+ let { apiGatewayUrl: r } = e(), i = h();
229
261
  return n({
230
262
  mutationFn: async ({ slug: e, input: n }) => (await t(`mutation AthSubmitRegistration($slug: String!, $input: AthSubmitRegistrationInput!) {
231
263
  athSubmitRegistration(slug: $slug, input: $input) { ${p} }
@@ -235,7 +267,7 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
235
267
  }, r)).athSubmitRegistration,
236
268
  onSuccess: () => void i()
237
269
  });
238
- }, M = (n) => {
270
+ }, I = (n) => {
239
271
  let { apiGatewayUrl: i } = e();
240
272
  return r({
241
273
  queryKey: [
@@ -250,16 +282,27 @@ var a = ["atheletebridge", "registration"], o = "id key label fieldType required
250
282
  }
251
283
  }`, { pagination: n ?? null }, i)).athMyRegistrations
252
284
  });
253
- }, N = () => {
254
- let { apiGatewayUrl: r } = e(), i = m();
285
+ }, L = () => {
286
+ let { apiGatewayUrl: r } = e(), i = h();
255
287
  return n({
256
288
  mutationFn: async (e) => (await t(`mutation AthWithdrawMyRegistration($id: ID!) {
257
289
  athWithdrawMyRegistration(id: $id) { ${p} }
258
290
  }`, { id: e }, r)).athWithdrawMyRegistration,
259
291
  onSuccess: () => void i()
260
292
  });
293
+ }, R = () => {
294
+ let { apiGatewayUrl: r } = e();
295
+ return n({ mutationFn: async (e) => (await t("mutation AthStartRegistrationCheckout($input: AthStartRegistrationCheckoutInput!) {\n athStartRegistrationCheckout(input: $input) { checkoutId url amount currency expiresAt }\n }", { input: e }, r)).athStartRegistrationCheckout });
296
+ }, z = () => {
297
+ let { apiGatewayUrl: r } = e(), i = h();
298
+ return n({
299
+ mutationFn: async (e) => (await t(`mutation AthConfirmRegistrationCheckout($checkoutId: ID!) {
300
+ athConfirmRegistrationCheckout(checkoutId: $checkoutId) { ${p} }
301
+ }`, { checkoutId: e }, r)).athConfirmRegistrationCheckout,
302
+ onSuccess: () => void i()
303
+ });
261
304
  };
262
305
  //#endregion
263
- export { _ as useCreateRegistrationForm, M as useMyRegistrations, A as usePublicRegistrationForm, C as useRecordRegistration, D as useRecordRegistrationPayment, k as useRefundRegistrationPayment, g as useRegistrationForm, b as useRegistrationFormLifecycle, h as useRegistrationForms, E as useRegistrationPaymentSummary, T as useRegistrationPayments, S as useRegistrationSubmission, x as useRegistrationSubmissions, w as useReviewRegistration, j as useSubmitRegistration, v as useUpdateRegistrationForm, O as useVoidRegistrationPayment, N as useWithdrawMyRegistration };
306
+ export { z as useConfirmRegistrationCheckout, M as useConnectPaymentAccount, v as useCreateRegistrationForm, I as useMyRegistrations, j as useOnlinePaymentsStatus, P as usePublicRegistrationForm, w as useRecordRegistration, O as useRecordRegistrationPayment, N as useRefreshPaymentAccount, A as useRefundRegistrationPayment, _ as useRegistrationForm, x as useRegistrationFormLifecycle, g as useRegistrationForms, D as useRegistrationPaymentSummary, E as useRegistrationPayments, C as useRegistrationSubmission, S as useRegistrationSubmissions, T as useReviewRegistration, R as useStartRegistrationCheckout, F as useSubmitRegistration, y as useUpdateRegistrationForm, k as useVoidRegistrationPayment, L as useWithdrawMyRegistration };
264
307
 
265
308
  //# sourceMappingURL=useRegistrationApi.js.map