@conferencesuite/ui 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +11 -2
- package/dist/AuthButton.d.ts +8 -0
- package/dist/AuthButton.js +73 -0
- package/dist/AuthButton.js.map +1 -0
- package/dist/AuthDialog.d.ts +2 -0
- package/dist/AuthDialog.js +295 -0
- package/dist/AuthDialog.js.map +1 -0
- package/dist/AuthNotice.d.ts +2 -0
- package/dist/AuthNotice.js +32 -0
- package/dist/AuthNotice.js.map +1 -0
- package/dist/CatalogPicker.d.ts +13 -0
- package/dist/CatalogPicker.js +272 -0
- package/dist/CatalogPicker.js.map +1 -0
- package/dist/CheckoutMount.d.ts +10 -0
- package/dist/CheckoutMount.js +51 -0
- package/dist/CheckoutMount.js.map +1 -0
- package/dist/PaymentStatus.d.ts +16 -0
- package/dist/PaymentStatus.js +173 -0
- package/dist/PaymentStatus.js.map +1 -0
- package/dist/ProposalForm.d.ts +12 -0
- package/dist/ProposalForm.js +345 -0
- package/dist/ProposalForm.js.map +1 -0
- package/dist/RegistrationCta.d.ts +17 -0
- package/dist/RegistrationCta.js +39 -0
- package/dist/RegistrationCta.js.map +1 -0
- package/dist/RegistrationForm.d.ts +13 -0
- package/dist/RegistrationForm.js +523 -0
- package/dist/RegistrationForm.js.map +1 -0
- package/dist/ScheduleBadge.d.ts +5 -0
- package/dist/ScheduleBadge.js +22 -0
- package/dist/ScheduleBadge.js.map +1 -0
- package/dist/SchedulePage.d.ts +10 -0
- package/dist/SchedulePage.js +435 -0
- package/dist/SchedulePage.js.map +1 -0
- package/dist/ScheduleViews.d.ts +32 -0
- package/dist/ScheduleViews.js +294 -0
- package/dist/ScheduleViews.js.map +1 -0
- package/dist/SessionDialog.d.ts +16 -0
- package/dist/SessionDialog.js +144 -0
- package/dist/SessionDialog.js.map +1 -0
- package/dist/SuiteAuth.d.ts +6 -0
- package/dist/SuiteAuth.js +20 -0
- package/dist/SuiteAuth.js.map +1 -0
- package/dist/classes.d.ts +36 -0
- package/dist/classes.js +40 -0
- package/dist/classes.js.map +1 -0
- package/dist/fields.d.ts +10 -0
- package/dist/fields.js +250 -0
- package/dist/fields.js.map +1 -0
- package/dist/scheduleClasses.d.ts +16 -0
- package/dist/scheduleClasses.js +20 -0
- package/dist/scheduleClasses.js.map +1 -0
- package/package.json +43 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useAuth } from "@conferencesuite/react/AuthProvider";
|
|
4
|
+
import { ui } from "./classes.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/AuthNotice.tsx
|
|
7
|
+
/** Announces the result of an auth action after the dialog closes, then goes away. */
|
|
8
|
+
function AuthNotice() {
|
|
9
|
+
const { notice, dismissNotice } = useAuth();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!notice) return;
|
|
12
|
+
const t = setTimeout(dismissNotice, 7e3);
|
|
13
|
+
return () => clearTimeout(t);
|
|
14
|
+
}, [notice, dismissNotice]);
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: ui.notice,
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-live": "polite",
|
|
19
|
+
children: notice && /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: ui.noticeBody,
|
|
21
|
+
children: [/* @__PURE__ */ jsx("span", { children: notice }), /* @__PURE__ */ jsx("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
className: "btn btn-ghost btn-xs",
|
|
24
|
+
onClick: dismissNotice,
|
|
25
|
+
children: "Dismiss"
|
|
26
|
+
})]
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export { AuthNotice };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=AuthNotice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthNotice.js","names":[],"sources":["../src/AuthNotice.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useAuth } from \"@conferencesuite/react/AuthProvider\";\nimport { ui } from \"./classes\";\n\n/** Announces the result of an auth action after the dialog closes, then goes away. */\nexport function AuthNotice() {\n const { notice, dismissNotice } = useAuth();\n\n useEffect(() => {\n if (!notice) return;\n const t = setTimeout(dismissNotice, 7000);\n return () => clearTimeout(t);\n }, [notice, dismissNotice]);\n\n // The live region stays mounted so screen readers announce the text when it appears\n return (\n <div className={ui.notice} role=\"status\" aria-live=\"polite\">\n {notice && (\n <div className={ui.noticeBody}>\n <span>{notice}</span>\n <button type=\"button\" className=\"btn btn-ghost btn-xs\" onClick={dismissNotice}>\n Dismiss\n </button>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,aAAa;CAC3B,MAAM,EAAE,QAAQ,kBAAkB,QAAQ;CAE1C,gBAAgB;EACd,IAAI,CAAC,QAAQ;EACb,MAAM,IAAI,WAAW,eAAe,GAAI;EACxC,aAAa,aAAa,CAAC;CAC7B,GAAG,CAAC,QAAQ,aAAa,CAAC;CAG1B,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG;EAAQ,MAAK;EAAS,aAAU;EAChD,UAAA,UACC,qBAAC,OAAD;GAAK,WAAW,GAAG;GAAnB,UAAA,CACE,oBAAC,QAAD,EAAA,UAAO,OAAa,CAAA,GACpB,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAuB,SAAS;IAAe,UAAA;GAEvE,CAAA,CACL;;CAEJ,CAAA;AAET"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Catalog, Selection } from "@conferencesuite/core/registration/catalog";
|
|
2
|
+
type Props = {
|
|
3
|
+
catalog: Catalog;
|
|
4
|
+
selection: Selection;
|
|
5
|
+
onChange: (next: Selection) => void;
|
|
6
|
+
/** Add-ons only (someone already registered): no tier choice */
|
|
7
|
+
addonsOnly?: boolean;
|
|
8
|
+
/** Ask the suite for the hidden tiers a code unlocks; returns whether it unlocked anything */
|
|
9
|
+
onApplyCode?: (code: string) => Promise<boolean>;
|
|
10
|
+
locale?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function CatalogPicker({ catalog, selection, onChange, addonsOnly, onApplyCode, locale }: Props): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { RadioGroup } from "@ark-ui/react/radio-group";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { ADDON_CATEGORIES, addonEligible, selectedTierId, selectionLines } from "@conferencesuite/core/registration/catalog";
|
|
5
|
+
import { formatMoney } from "@conferencesuite/core/money";
|
|
6
|
+
import { ui } from "./classes.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/CatalogPicker.tsx
|
|
9
|
+
const money = (minor, currency, locale) => formatMoney(minor, currency, locale) ?? "";
|
|
10
|
+
/**
|
|
11
|
+
* What to register for: tiers (one), add-ons (quantities), an access code for hidden tiers, and the total.
|
|
12
|
+
* Everything shown comes from the suite's catalog: sold-out and ineligible choices are marked, not hidden,
|
|
13
|
+
* and the suite checks every choice again at checkout.
|
|
14
|
+
*/
|
|
15
|
+
/** Removes the aria-labelledby Zag adds to a radio's hidden input: its wrapping <label> is the name. */
|
|
16
|
+
const dropLabelledBy = (el) => el?.removeAttribute("aria-labelledby");
|
|
17
|
+
function CatalogPicker({ catalog, selection, onChange, addonsOnly = false, onApplyCode, locale }) {
|
|
18
|
+
const uid = useId();
|
|
19
|
+
const tierId = selectedTierId(catalog, selection);
|
|
20
|
+
const { lines, total, currency } = selectionLines(catalog, selection);
|
|
21
|
+
const [codeOpen, setCodeOpen] = useState(false);
|
|
22
|
+
const [codeInput, setCodeInput] = useState("");
|
|
23
|
+
const [codeNote, setCodeNote] = useState(null);
|
|
24
|
+
const [applying, setApplying] = useState(false);
|
|
25
|
+
const [dropped, setDropped] = useState(null);
|
|
26
|
+
const pickTier = (offerId) => {
|
|
27
|
+
const tier = catalog.tiers.find((t) => t.offers.some((o) => o.id === offerId));
|
|
28
|
+
const keep = {};
|
|
29
|
+
const removed = [];
|
|
30
|
+
for (const addon of catalog.addons) for (const offer of addon.offers) {
|
|
31
|
+
const qty = selection.addons[offer.id] ?? 0;
|
|
32
|
+
if (qty <= 0) continue;
|
|
33
|
+
if (addonEligible(addon, tier?.id ?? null)) keep[offer.id] = qty;
|
|
34
|
+
else removed.push(addon.name);
|
|
35
|
+
}
|
|
36
|
+
setDropped(removed.length ? `${removed.join(", ")} ${removed.length === 1 ? "isn't" : "aren't"} available with that registration and ${removed.length === 1 ? "was" : "were"} removed.` : null);
|
|
37
|
+
onChange({
|
|
38
|
+
...selection,
|
|
39
|
+
tierOfferId: offerId,
|
|
40
|
+
addons: keep
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const setQty = (addon, offerId, raw, max) => {
|
|
44
|
+
const qty = Number.isFinite(raw) ? Math.max(0, Math.min(Math.floor(raw), max)) : 0;
|
|
45
|
+
onChange({
|
|
46
|
+
...selection,
|
|
47
|
+
addons: {
|
|
48
|
+
...selection.addons,
|
|
49
|
+
[offerId]: qty
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
async function apply() {
|
|
54
|
+
if (!onApplyCode || !codeInput.trim()) return;
|
|
55
|
+
setApplying(true);
|
|
56
|
+
setCodeNote(null);
|
|
57
|
+
try {
|
|
58
|
+
const ok = await onApplyCode(codeInput.trim());
|
|
59
|
+
onChange({
|
|
60
|
+
...selection,
|
|
61
|
+
code: ok ? codeInput.trim() : ""
|
|
62
|
+
});
|
|
63
|
+
setCodeNote(ok ? {
|
|
64
|
+
ok: true,
|
|
65
|
+
text: "Code accepted. The options it unlocks are shown."
|
|
66
|
+
} : {
|
|
67
|
+
ok: false,
|
|
68
|
+
text: "That code didn't match. Check it and try again."
|
|
69
|
+
});
|
|
70
|
+
} catch {
|
|
71
|
+
setCodeNote({
|
|
72
|
+
ok: false,
|
|
73
|
+
text: "We couldn't check that code. Try again."
|
|
74
|
+
});
|
|
75
|
+
} finally {
|
|
76
|
+
setApplying(false);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const tierCard = (t) => {
|
|
80
|
+
const soldOut = t.remaining !== null && t.remaining <= 0;
|
|
81
|
+
return t.offers.map((o) => {
|
|
82
|
+
const gone = soldOut || o.remaining !== null && o.remaining <= 0;
|
|
83
|
+
return /* @__PURE__ */ jsxs(RadioGroup.Item, {
|
|
84
|
+
value: o.id,
|
|
85
|
+
disabled: gone,
|
|
86
|
+
className: `${ui.radioItem} ${gone ? "opacity-70" : ""}`,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(RadioGroup.ItemControl, { className: ui.radioDot }),
|
|
89
|
+
/* @__PURE__ */ jsxs(RadioGroup.ItemText, {
|
|
90
|
+
className: "flex flex-1 flex-col gap-0.5",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("span", {
|
|
93
|
+
className: "flex flex-wrap justify-between gap-x-4",
|
|
94
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "font-medium",
|
|
96
|
+
children: o.label ? `${t.name} · ${o.label}` : t.name
|
|
97
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "font-semibold",
|
|
99
|
+
children: o.amount === 0 ? "Free" : money(o.amount, o.currency, locale)
|
|
100
|
+
})]
|
|
101
|
+
}),
|
|
102
|
+
t.description && /* @__PURE__ */ jsx("span", {
|
|
103
|
+
className: "text-sm text-base-content/80",
|
|
104
|
+
children: t.description
|
|
105
|
+
}),
|
|
106
|
+
gone && /* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "badge badge-neutral mt-1 w-fit",
|
|
108
|
+
children: "Sold out"
|
|
109
|
+
}),
|
|
110
|
+
!gone && t.remaining !== null && t.remaining <= 10 && /* @__PURE__ */ jsxs("span", {
|
|
111
|
+
className: "text-sm",
|
|
112
|
+
children: [t.remaining, " left"]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsx(RadioGroup.ItemHiddenInput, { ref: dropLabelledBy })
|
|
117
|
+
]
|
|
118
|
+
}, o.id);
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const addonsByCategory = ADDON_CATEGORIES.map((c) => ({
|
|
122
|
+
...c,
|
|
123
|
+
items: catalog.addons.filter((a) => a.category === c.value)
|
|
124
|
+
})).filter((c) => c.items.length > 0);
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
126
|
+
className: "flex flex-col gap-5",
|
|
127
|
+
children: [
|
|
128
|
+
!addonsOnly && /* @__PURE__ */ jsxs(RadioGroup.Root, {
|
|
129
|
+
value: selection.tierOfferId ?? "",
|
|
130
|
+
onValueChange: (e) => e.value && pickTier(e.value),
|
|
131
|
+
className: "flex flex-col gap-2",
|
|
132
|
+
"aria-label": "Choose your registration",
|
|
133
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
134
|
+
className: ui.label,
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: "Choose your registration"
|
|
137
|
+
}), catalog.tiers.flatMap(tierCard)]
|
|
138
|
+
}),
|
|
139
|
+
!addonsOnly && onApplyCode && /* @__PURE__ */ jsx("div", { children: !codeOpen ? /* @__PURE__ */ jsx("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
className: ui.link,
|
|
142
|
+
onClick: () => setCodeOpen(true),
|
|
143
|
+
children: "Have an access code?"
|
|
144
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: "flex flex-col gap-2",
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx("label", {
|
|
148
|
+
htmlFor: `${uid}-code`,
|
|
149
|
+
className: ui.label,
|
|
150
|
+
children: "Access code"
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: "flex flex-wrap gap-2",
|
|
154
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
155
|
+
id: `${uid}-code`,
|
|
156
|
+
className: `${ui.input} max-w-xs`,
|
|
157
|
+
value: codeInput,
|
|
158
|
+
autoComplete: "off",
|
|
159
|
+
onChange: (e) => setCodeInput(e.target.value),
|
|
160
|
+
onKeyDown: (e) => {
|
|
161
|
+
if (e.key === "Enter") {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
apply();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
className: "btn btn-outline",
|
|
169
|
+
disabled: applying || !codeInput.trim(),
|
|
170
|
+
onClick: () => void apply(),
|
|
171
|
+
children: [applying && /* @__PURE__ */ jsx("span", {
|
|
172
|
+
className: "loading loading-spinner loading-sm",
|
|
173
|
+
"aria-hidden": "true"
|
|
174
|
+
}), "Apply"]
|
|
175
|
+
})]
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsx("p", {
|
|
178
|
+
role: "status",
|
|
179
|
+
"aria-live": "polite",
|
|
180
|
+
className: codeNote && !codeNote.ok ? ui.fieldError : "text-sm",
|
|
181
|
+
children: codeNote?.text
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
}) }),
|
|
185
|
+
addonsByCategory.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
186
|
+
className: "flex flex-col gap-4",
|
|
187
|
+
children: addonsByCategory.map((c) => /* @__PURE__ */ jsxs("fieldset", {
|
|
188
|
+
className: ui.fieldset,
|
|
189
|
+
children: [/* @__PURE__ */ jsx("legend", {
|
|
190
|
+
className: ui.legend,
|
|
191
|
+
children: c.label
|
|
192
|
+
}), c.items.map((a) => {
|
|
193
|
+
const eligible = addonEligible(a, tierId);
|
|
194
|
+
const needsTier = !addonsOnly && a.requiresRegistration && !tierId;
|
|
195
|
+
return a.offers.map((o) => {
|
|
196
|
+
const cap = a.remaining === null && o.remaining === null ? a.maxPerPerson : Math.min(a.maxPerPerson, a.remaining ?? 1e400, o.remaining ?? 1e400);
|
|
197
|
+
const gone = cap <= 0;
|
|
198
|
+
const disabled = gone || !eligible || needsTier;
|
|
199
|
+
const id = `${uid}-${o.id}`;
|
|
200
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
202
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "min-w-0 flex-1",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx("label", {
|
|
206
|
+
htmlFor: id,
|
|
207
|
+
className: "font-medium",
|
|
208
|
+
children: o.label ? `${a.name} · ${o.label}` : a.name
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ jsxs("p", {
|
|
211
|
+
className: "text-sm text-base-content/80",
|
|
212
|
+
children: [
|
|
213
|
+
money(o.amount, o.currency, locale),
|
|
214
|
+
" each",
|
|
215
|
+
a.maxPerPerson > 1 ? ` · up to ${a.maxPerPerson} per person` : "",
|
|
216
|
+
gone ? " · Sold out" : !eligible ? " · Not available with this registration" : needsTier ? " · Choose a registration first" : ""
|
|
217
|
+
]
|
|
218
|
+
}),
|
|
219
|
+
a.description && /* @__PURE__ */ jsx("p", {
|
|
220
|
+
className: "text-sm text-base-content/80",
|
|
221
|
+
children: a.description
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
225
|
+
id,
|
|
226
|
+
type: "number",
|
|
227
|
+
inputMode: "numeric",
|
|
228
|
+
min: 0,
|
|
229
|
+
max: Number.isFinite(cap) ? cap : void 0,
|
|
230
|
+
className: `${ui.input} w-24`,
|
|
231
|
+
"aria-label": `Quantity for ${a.name}`,
|
|
232
|
+
disabled,
|
|
233
|
+
value: selection.addons[o.id] ?? 0,
|
|
234
|
+
onChange: (e) => setQty(a, o.id, Number(e.target.value), Number.isFinite(cap) ? cap : 99)
|
|
235
|
+
})]
|
|
236
|
+
}, o.id);
|
|
237
|
+
});
|
|
238
|
+
})]
|
|
239
|
+
}, c.value))
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ jsx("p", {
|
|
242
|
+
role: "status",
|
|
243
|
+
"aria-live": "polite",
|
|
244
|
+
className: "text-sm",
|
|
245
|
+
children: dropped
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ jsxs("div", {
|
|
248
|
+
className: "rounded-box border border-base-300 bg-base-200/60 p-4",
|
|
249
|
+
"aria-live": "polite",
|
|
250
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
251
|
+
className: "sr-only",
|
|
252
|
+
children: "Your selection"
|
|
253
|
+
}), lines.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
254
|
+
className: "text-sm",
|
|
255
|
+
children: addonsOnly ? "Choose an add-on to continue." : "Choose a registration option to continue."
|
|
256
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
257
|
+
className: "m-0 flex list-none flex-col gap-1 p-0",
|
|
258
|
+
children: lines.map((l) => /* @__PURE__ */ jsxs("li", {
|
|
259
|
+
className: "flex justify-between gap-4",
|
|
260
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [l.name, l.quantity > 1 ? ` × ${l.quantity}` : ""] }), /* @__PURE__ */ jsx("span", { children: l.amount === 0 ? "Free" : money(l.amount, l.currency, locale) })]
|
|
261
|
+
}, l.key))
|
|
262
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
263
|
+
className: "mt-2 flex justify-between border-t border-base-300 pt-2 font-semibold",
|
|
264
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Total" }), /* @__PURE__ */ jsx("span", { children: total === 0 ? "Free" : money(total, currency, locale) })]
|
|
265
|
+
})] })]
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
export { CatalogPicker };
|
|
271
|
+
|
|
272
|
+
//# sourceMappingURL=CatalogPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogPicker.js","names":[],"sources":["../src/CatalogPicker.tsx"],"sourcesContent":["\"use client\";\n\nimport { RadioGroup } from \"@ark-ui/react/radio-group\";\nimport { useId, useState } from \"react\";\nimport { ADDON_CATEGORIES, type Catalog, type CatalogAddon, type CatalogTier, type Selection, addonEligible, selectedTierId, selectionLines } from \"@conferencesuite/core/registration/catalog\";\nimport { formatMoney } from \"@conferencesuite/core/money\";\nimport { ui } from \"./classes\";\n\ntype Props = {\n catalog: Catalog;\n selection: Selection;\n onChange: (next: Selection) => void;\n /** Add-ons only (someone already registered): no tier choice */\n addonsOnly?: boolean;\n /** Ask the suite for the hidden tiers a code unlocks; returns whether it unlocked anything */\n onApplyCode?: (code: string) => Promise<boolean>;\n locale?: string;\n};\n\nconst money = (minor: number, currency: string, locale?: string) => formatMoney(minor, currency, locale) ?? \"\";\n\n/**\n * What to register for: tiers (one), add-ons (quantities), an access code for hidden tiers, and the total.\n * Everything shown comes from the suite's catalog: sold-out and ineligible choices are marked, not hidden,\n * and the suite checks every choice again at checkout.\n */\n/** Removes the aria-labelledby Zag adds to a radio's hidden input: its wrapping <label> is the name. */\nconst dropLabelledBy = (el: HTMLInputElement | null) => el?.removeAttribute(\"aria-labelledby\");\n\nexport function CatalogPicker({ catalog, selection, onChange, addonsOnly = false, onApplyCode, locale }: Props) {\n const uid = useId();\n const tierId = selectedTierId(catalog, selection);\n const { lines, total, currency } = selectionLines(catalog, selection);\n const [codeOpen, setCodeOpen] = useState(false);\n const [codeInput, setCodeInput] = useState(\"\");\n const [codeNote, setCodeNote] = useState<{ ok: boolean; text: string } | null>(null);\n const [applying, setApplying] = useState(false);\n const [dropped, setDropped] = useState<string | null>(null);\n\n const pickTier = (offerId: string) => {\n const tier = catalog.tiers.find((t) => t.offers.some((o) => o.id === offerId));\n // Add-ons the new tier can't take are dropped, and the person is told\n const keep: Record<string, number> = {};\n const removed: string[] = [];\n for (const addon of catalog.addons) {\n for (const offer of addon.offers) {\n const qty = selection.addons[offer.id] ?? 0;\n if (qty <= 0) continue;\n if (addonEligible(addon, tier?.id ?? null)) keep[offer.id] = qty;\n else removed.push(addon.name);\n }\n }\n setDropped(removed.length ? `${removed.join(\", \")} ${removed.length === 1 ? \"isn't\" : \"aren't\"} available with that registration and ${removed.length === 1 ? \"was\" : \"were\"} removed.` : null);\n onChange({ ...selection, tierOfferId: offerId, addons: keep });\n };\n\n const setQty = (addon: CatalogAddon, offerId: string, raw: number, max: number) => {\n const qty = Number.isFinite(raw) ? Math.max(0, Math.min(Math.floor(raw), max)) : 0;\n onChange({ ...selection, addons: { ...selection.addons, [offerId]: qty } });\n void addon;\n };\n\n async function apply() {\n if (!onApplyCode || !codeInput.trim()) return;\n setApplying(true);\n setCodeNote(null);\n try {\n const ok = await onApplyCode(codeInput.trim());\n onChange({ ...selection, code: ok ? codeInput.trim() : \"\" });\n setCodeNote(ok ? { ok: true, text: \"Code accepted. The options it unlocks are shown.\" } : { ok: false, text: \"That code didn't match. Check it and try again.\" });\n } catch {\n setCodeNote({ ok: false, text: \"We couldn't check that code. Try again.\" });\n } finally {\n setApplying(false);\n }\n }\n\n const tierCard = (t: CatalogTier) => {\n const soldOut = t.remaining !== null && t.remaining <= 0;\n return t.offers.map((o) => {\n const gone = soldOut || (o.remaining !== null && o.remaining <= 0);\n return (\n <RadioGroup.Item key={o.id} value={o.id} disabled={gone} className={`${ui.radioItem} ${gone ? \"opacity-70\" : \"\"}`}>\n <RadioGroup.ItemControl className={ui.radioDot} />\n <RadioGroup.ItemText className=\"flex flex-1 flex-col gap-0.5\">\n <span className=\"flex flex-wrap justify-between gap-x-4\">\n <span className=\"font-medium\">{o.label ? `${t.name} · ${o.label}` : t.name}</span>\n <span className=\"font-semibold\">{o.amount === 0 ? \"Free\" : money(o.amount, o.currency, locale)}</span>\n </span>\n {t.description && <span className=\"text-sm text-base-content/80\">{t.description}</span>}\n {gone && <span className=\"badge badge-neutral mt-1 w-fit\">Sold out</span>}\n {!gone && t.remaining !== null && t.remaining <= 10 && <span className=\"text-sm\">{t.remaining} left</span>}\n </RadioGroup.ItemText>\n {/* The wrapping <label> already names the input; Zag's extra aria-labelledby crashes Firefox under axe (see above). */}\n <RadioGroup.ItemHiddenInput ref={dropLabelledBy} />\n </RadioGroup.Item>\n );\n });\n };\n\n const addonsByCategory = ADDON_CATEGORIES.map((c) => ({ ...c, items: catalog.addons.filter((a) => a.category === c.value) })).filter((c) => c.items.length > 0);\n\n return (\n <div className=\"flex flex-col gap-5\">\n {!addonsOnly && (\n <RadioGroup.Root\n value={selection.tierOfferId ?? \"\"}\n onValueChange={(e) => e.value && pickTier(e.value)}\n className=\"flex flex-col gap-2\"\n aria-label=\"Choose your registration\"\n >\n {/* A plain element, not RadioGroup.Label: that part makes Zag name the group with aria-labelledby, which crashes\n Firefox's content process when axe inspects the page (see ProposalForm); aria-label carries the same text. */}\n <span className={ui.label} aria-hidden=\"true\">\n Choose your registration\n </span>\n {catalog.tiers.flatMap(tierCard)}\n </RadioGroup.Root>\n )}\n\n {!addonsOnly && onApplyCode && (\n <div>\n {!codeOpen ? (\n <button type=\"button\" className={ui.link} onClick={() => setCodeOpen(true)}>\n Have an access code?\n </button>\n ) : (\n <div className=\"flex flex-col gap-2\">\n <label htmlFor={`${uid}-code`} className={ui.label}>\n Access code\n </label>\n <div className=\"flex flex-wrap gap-2\">\n <input\n id={`${uid}-code`}\n className={`${ui.input} max-w-xs`}\n value={codeInput}\n autoComplete=\"off\"\n onChange={(e) => setCodeInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n void apply();\n }\n }}\n />\n <button type=\"button\" className=\"btn btn-outline\" disabled={applying || !codeInput.trim()} onClick={() => void apply()}>\n {applying && <span className=\"loading loading-spinner loading-sm\" aria-hidden=\"true\" />}\n Apply\n </button>\n </div>\n <p role=\"status\" aria-live=\"polite\" className={codeNote && !codeNote.ok ? ui.fieldError : \"text-sm\"}>\n {codeNote?.text}\n </p>\n </div>\n )}\n </div>\n )}\n\n {addonsByCategory.length > 0 && (\n <div className=\"flex flex-col gap-4\">\n {addonsByCategory.map((c) => (\n <fieldset key={c.value} className={ui.fieldset}>\n <legend className={ui.legend}>{c.label}</legend>\n {c.items.map((a) => {\n const eligible = addonEligible(a, tierId);\n const needsTier = !addonsOnly && a.requiresRegistration && !tierId;\n return a.offers.map((o) => {\n const cap = a.remaining === null && o.remaining === null ? a.maxPerPerson : Math.min(a.maxPerPerson, a.remaining ?? Infinity, o.remaining ?? Infinity);\n const gone = cap <= 0;\n const disabled = gone || !eligible || needsTier;\n const id = `${uid}-${o.id}`;\n return (\n <div key={o.id} className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">\n <label htmlFor={id} className=\"font-medium\">\n {o.label ? `${a.name} · ${o.label}` : a.name}\n </label>\n <p className=\"text-sm text-base-content/80\">\n {money(o.amount, o.currency, locale)} each\n {a.maxPerPerson > 1 ? ` · up to ${a.maxPerPerson} per person` : \"\"}\n {gone ? \" · Sold out\" : !eligible ? \" · Not available with this registration\" : needsTier ? \" · Choose a registration first\" : \"\"}\n </p>\n {a.description && <p className=\"text-sm text-base-content/80\">{a.description}</p>}\n </div>\n <input\n id={id}\n type=\"number\"\n inputMode=\"numeric\"\n min={0}\n max={Number.isFinite(cap) ? cap : undefined}\n className={`${ui.input} w-24`}\n aria-label={`Quantity for ${a.name}`}\n disabled={disabled}\n value={selection.addons[o.id] ?? 0}\n onChange={(e) => setQty(a, o.id, Number(e.target.value), Number.isFinite(cap) ? cap : 99)}\n />\n </div>\n );\n });\n })}\n </fieldset>\n ))}\n </div>\n )}\n\n <p role=\"status\" aria-live=\"polite\" className=\"text-sm\">\n {dropped}\n </p>\n\n <div className=\"rounded-box border border-base-300 bg-base-200/60 p-4\" aria-live=\"polite\">\n <p className=\"sr-only\">Your selection</p>\n {lines.length === 0 ? (\n <p className=\"text-sm\">{addonsOnly ? \"Choose an add-on to continue.\" : \"Choose a registration option to continue.\"}</p>\n ) : (\n <>\n <ul className=\"m-0 flex list-none flex-col gap-1 p-0\">\n {lines.map((l) => (\n <li key={l.key} className=\"flex justify-between gap-4\">\n <span>\n {l.name}\n {l.quantity > 1 ? ` × ${l.quantity}` : \"\"}\n </span>\n <span>{l.amount === 0 ? \"Free\" : money(l.amount, l.currency, locale)}</span>\n </li>\n ))}\n </ul>\n <p className=\"mt-2 flex justify-between border-t border-base-300 pt-2 font-semibold\">\n <span>Total</span>\n <span>{total === 0 ? \"Free\" : money(total, currency, locale)}</span>\n </p>\n </>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,SAAS,OAAe,UAAkB,WAAoB,YAAY,OAAO,UAAU,MAAM,KAAK;;;;;;;AAQ5G,MAAM,kBAAkB,OAAgC,IAAI,gBAAgB,iBAAiB;AAE7F,SAAgB,cAAc,EAAE,SAAS,WAAW,UAAU,aAAa,OAAO,aAAa,UAAiB;CAC9G,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,eAAe,SAAS,SAAS;CAChD,MAAM,EAAE,OAAO,OAAO,aAAa,eAAe,SAAS,SAAS;CACpE,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,WAAW,gBAAgB,SAAS,EAAE;CAC7C,MAAM,CAAC,UAAU,eAAe,SAA+C,IAAI;CACnF,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,SAAS,cAAc,SAAwB,IAAI;CAE1D,MAAM,YAAY,YAAoB;EACpC,MAAM,OAAO,QAAQ,MAAM,MAAM,MAAM,EAAE,OAAO,MAAM,MAAM,EAAE,OAAO,OAAO,CAAC;EAE7E,MAAM,OAA+B,CAAC;EACtC,MAAM,UAAoB,CAAC;EAC3B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O,EAAE,OAAO,KAAK,GAAG,OAAO,SAAS,GAAG,IAAI,MAAM,EAAE;QACzF,CAAA,CACE;OAxBK,GAAA,EAAE,EAwBP;MAET,CAAC;KACH,CAAC,CACO;IAvCK,GAAA,EAAE,KAuCP,CACX;GACE,CAAA;GAGP,oBAAC,KAAD;IAAG,MAAK;IAAS,aAAU;IAAS,WAAU;IAC3C,UAAA;GACA,CAAA;GAEH,qBAAC,OAAD;IAAK,WAAU;IAAwD,aAAU;IAAjF,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAU,UAAA;IAAiB,CAAA,GACvC,MAAM,WAAW,IAChB,oBAAC,KAAD;KAAG,WAAU;KAAW,UAAA,aAAa,kCAAkC;IAA+C,CAAA,IAEtH,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,MAAD;KAAI,WAAU;KACX,UAAA,MAAM,KAAK,MACV,qBAAC,MAAD;MAAgB,WAAU;MAA1B,UAAA,CACE,qBAAC,QAAD,EAAA,UAAA,CACG,EAAE,MACF,EAAE,WAAW,IAAI,MAAM,EAAE,aAAa,EACnC,EAAA,CAAA,GACN,oBAAC,QAAD,EAAA,UAAO,EAAE,WAAW,IAAI,SAAS,MAAM,EAAE,QAAQ,EAAE,UAAU,MAAM,EAAQ,CAAA,CACzE;KANK,GAAA,EAAE,GAMP,CACL;IACC,CAAA,GACJ,qBAAC,KAAD;KAAG,WAAU;KAAb,UAAA,CACE,oBAAC,QAAD,EAAA,UAAM,QAAW,CAAA,GACjB,oBAAC,QAAD,EAAA,UAAO,UAAU,IAAI,SAAS,MAAM,OAAO,UAAU,MAAM,EAAQ,CAAA,CAClE;IACH,CAAA,CAAA,EAAA,CAAA,CAED;;EACF;;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stripe's embedded checkout, mounted with the vanilla API (no react-stripe-js).
|
|
3
|
+
* Card entry happens in Stripe's own frame; this only provides the mount point,
|
|
4
|
+
* and cleans it up. `stripeAccount` is the org's connected account (a direct charge).
|
|
5
|
+
*/
|
|
6
|
+
export declare function CheckoutMount({ publishableKey, stripeAccount, clientSecret }: {
|
|
7
|
+
publishableKey: string;
|
|
8
|
+
stripeAccount: string;
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { loadStripe } from "@stripe/stripe-js";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { ui } from "./classes.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/CheckoutMount.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Stripe's embedded checkout, mounted with the vanilla API (no react-stripe-js).
|
|
9
|
+
* Card entry happens in Stripe's own frame; this only provides the mount point,
|
|
10
|
+
* and cleans it up. `stripeAccount` is the org's connected account (a direct charge).
|
|
11
|
+
*/
|
|
12
|
+
function CheckoutMount({ publishableKey, stripeAccount, clientSecret }) {
|
|
13
|
+
const el = useRef(null);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
let destroyed = false;
|
|
17
|
+
let checkout = null;
|
|
18
|
+
(async () => {
|
|
19
|
+
try {
|
|
20
|
+
const stripe = await loadStripe(publishableKey, { stripeAccount });
|
|
21
|
+
if (!stripe) throw new Error("Stripe did not load");
|
|
22
|
+
const embedded = await stripe.initEmbeddedCheckout({ clientSecret });
|
|
23
|
+
if (destroyed) return embedded.destroy();
|
|
24
|
+
checkout = embedded;
|
|
25
|
+
if (el.current) embedded.mount(el.current);
|
|
26
|
+
} catch {
|
|
27
|
+
if (!destroyed) setError("We could not load the payment form. Check your connection and try again.");
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
return () => {
|
|
31
|
+
destroyed = true;
|
|
32
|
+
checkout?.destroy();
|
|
33
|
+
};
|
|
34
|
+
}, [
|
|
35
|
+
publishableKey,
|
|
36
|
+
stripeAccount,
|
|
37
|
+
clientSecret
|
|
38
|
+
]);
|
|
39
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
40
|
+
"aria-label": "Secure payment form",
|
|
41
|
+
className: "flex flex-col gap-3",
|
|
42
|
+
children: [error && /* @__PURE__ */ jsx("p", {
|
|
43
|
+
role: "alert",
|
|
44
|
+
className: ui.statusError,
|
|
45
|
+
children: error
|
|
46
|
+
}), /* @__PURE__ */ jsx("div", { ref: el })]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export { CheckoutMount };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=CheckoutMount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutMount.js","names":[],"sources":["../src/CheckoutMount.tsx"],"sourcesContent":["\"use client\";\n\nimport { loadStripe } from \"@stripe/stripe-js\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { ui } from \"./classes\";\n\n/**\n * Stripe's embedded checkout, mounted with the vanilla API (no react-stripe-js).\n * Card entry happens in Stripe's own frame; this only provides the mount point,\n * and cleans it up. `stripeAccount` is the org's connected account (a direct charge).\n */\nexport function CheckoutMount({\n publishableKey,\n stripeAccount,\n clientSecret,\n}: {\n publishableKey: string;\n stripeAccount: string;\n clientSecret: string;\n}) {\n const el = useRef<HTMLDivElement>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let destroyed = false;\n let checkout: { destroy: () => void } | null = null;\n (async () => {\n try {\n const stripe = await loadStripe(publishableKey, { stripeAccount });\n if (!stripe) throw new Error(\"Stripe did not load\");\n const embedded = await stripe.initEmbeddedCheckout({ clientSecret });\n if (destroyed) return embedded.destroy();\n checkout = embedded;\n if (el.current) embedded.mount(el.current);\n } catch {\n if (!destroyed) setError(\"We could not load the payment form. Check your connection and try again.\");\n }\n })();\n return () => {\n destroyed = true;\n checkout?.destroy();\n };\n }, [publishableKey, stripeAccount, clientSecret]);\n\n return (\n <section aria-label=\"Secure payment form\" className=\"flex flex-col gap-3\">\n {error && (\n <p role=\"alert\" className={ui.statusError}>\n {error}\n </p>\n )}\n <div ref={el} />\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,cAAc,EAC5B,gBACA,eACA,gBAKC;CACD,MAAM,KAAK,OAAuB,IAAI;CACtC,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CAEtD,gBAAgB;EACd,IAAI,YAAY;EAChB,IAAI,WAA2C;EAC/C,CAAC,YAAY;GACX,IAAI;IACF,MAAM,SAAS,MAAM,WAAW,gBAAgB,EAAE,cAAc,CAAC;IACjE,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,qBAAqB;IAClD,MAAM,WAAW,MAAM,OAAO,qBAAqB,EAAE,aAAa,CAAC;IACnE,IAAI,WAAW,OAAO,SAAS,QAAQ;IACvC,WAAW;IACX,IAAI,GAAG,SAAS,SAAS,MAAM,GAAG,OAAO;GAC3C,QAAQ;IACN,IAAI,CAAC,WAAW,SAAS,0EAA0E;GACrG;EACF,EAAA,CAAG;EACH,aAAa;GACX,YAAY;GACZ,UAAU,QAAQ;EACpB;CACF,GAAG;EAAC;EAAgB;EAAe;CAAY,CAAC;CAEhD,OACE,qBAAC,WAAD;EAAS,cAAW;EAAsB,WAAU;EAApD,UAAA,CACG,SACC,oBAAC,KAAD;GAAG,MAAK;GAAQ,WAAW,GAAG;GAC3B,UAAA;EACA,CAAA,GAEL,oBAAC,OAAD,EAAK,KAAK,GAAK,CAAA,CACR;;AAEb"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SuiteConfig } from "@conferencesuite/core/types";
|
|
2
|
+
/**
|
|
3
|
+
* The page Stripe returns to (`/register/status?session_id=`). It confirms the
|
|
4
|
+
* payment, then sends the answers saved before checkout so the registration form
|
|
5
|
+
* has its submission. Stripe and the suite's webhook are the record of payment
|
|
6
|
+
* (they apply the member's role even if this page is never opened), so a closed tab
|
|
7
|
+
* loses nothing that matters; this page only completes the form.
|
|
8
|
+
*/
|
|
9
|
+
export declare function PaymentStatus({ config: rawConfig, sessionId, registerHref, homeHref }: {
|
|
10
|
+
config: SuiteConfig;
|
|
11
|
+
sessionId: string | null;
|
|
12
|
+
/** Where the registration form lives on this site */
|
|
13
|
+
registerHref?: string;
|
|
14
|
+
/** Where "Back to home" goes */
|
|
15
|
+
homeHref?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { registrationMessage } from "@conferencesuite/core/registration/errors";
|
|
4
|
+
import { buildSubmissionData } from "@conferencesuite/core/registration/validation";
|
|
5
|
+
import { useRegistrationActions } from "@conferencesuite/react/useRegistration";
|
|
6
|
+
import { useAuth } from "@conferencesuite/react/AuthProvider";
|
|
7
|
+
import { useStableConfig } from "@conferencesuite/react/useStableConfig";
|
|
8
|
+
import { getRegistrationForm } from "@conferencesuite/core/registration/api";
|
|
9
|
+
import { ui } from "./classes.js";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/PaymentStatus.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The page Stripe returns to (`/register/status?session_id=`). It confirms the
|
|
14
|
+
* payment, then sends the answers saved before checkout so the registration form
|
|
15
|
+
* has its submission. Stripe and the suite's webhook are the record of payment
|
|
16
|
+
* (they apply the member's role even if this page is never opened), so a closed tab
|
|
17
|
+
* loses nothing that matters; this page only completes the form.
|
|
18
|
+
*/
|
|
19
|
+
function PaymentStatus({ config: rawConfig, sessionId, registerHref = "/register", homeHref = "/" }) {
|
|
20
|
+
const config = useStableConfig(rawConfig);
|
|
21
|
+
const actions = useRegistrationActions(config);
|
|
22
|
+
const auth = useAuth();
|
|
23
|
+
const [run, setView] = useState({ kind: "checking" });
|
|
24
|
+
const view = sessionId ? run : { kind: "missing" };
|
|
25
|
+
const [attempt, setAttempt] = useState(0);
|
|
26
|
+
const started = useRef(null);
|
|
27
|
+
const headingRef = useRef(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!sessionId) return;
|
|
30
|
+
if (!auth.ready) return;
|
|
31
|
+
const key = `${sessionId}:${attempt}`;
|
|
32
|
+
if (started.current === key) return;
|
|
33
|
+
started.current = key;
|
|
34
|
+
(async () => {
|
|
35
|
+
try {
|
|
36
|
+
let status;
|
|
37
|
+
try {
|
|
38
|
+
status = await actions.status(sessionId);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
setView({
|
|
41
|
+
kind: "error",
|
|
42
|
+
message: registrationMessage(e)
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (status.payment_status !== "paid") return void setView({
|
|
47
|
+
kind: "unpaid",
|
|
48
|
+
status
|
|
49
|
+
});
|
|
50
|
+
const formId = config.registrationFormId;
|
|
51
|
+
const draft = formId ? actions.drafts.load(formId) : null;
|
|
52
|
+
if (!formId || !draft) return void setView({
|
|
53
|
+
kind: "done",
|
|
54
|
+
email: status.customer_email,
|
|
55
|
+
saved: false
|
|
56
|
+
});
|
|
57
|
+
setView({ kind: "saving" });
|
|
58
|
+
const fields = (await getRegistrationForm(config, formId)).schema ?? [];
|
|
59
|
+
const paymentField = fields.find((f) => f.type === "payment");
|
|
60
|
+
await actions.submit({
|
|
61
|
+
formId,
|
|
62
|
+
data: buildSubmissionData(fields, draft.values, paymentField ? {
|
|
63
|
+
fieldId: paymentField.id,
|
|
64
|
+
sessionId
|
|
65
|
+
} : void 0),
|
|
66
|
+
details: draft.details
|
|
67
|
+
});
|
|
68
|
+
actions.drafts.clear(formId);
|
|
69
|
+
setView({
|
|
70
|
+
kind: "done",
|
|
71
|
+
email: status.customer_email,
|
|
72
|
+
saved: true
|
|
73
|
+
});
|
|
74
|
+
} catch (e) {
|
|
75
|
+
setView({
|
|
76
|
+
kind: "save_failed",
|
|
77
|
+
message: registrationMessage(e)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
})();
|
|
81
|
+
}, [
|
|
82
|
+
sessionId,
|
|
83
|
+
auth.ready,
|
|
84
|
+
actions,
|
|
85
|
+
config,
|
|
86
|
+
attempt
|
|
87
|
+
]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (view.kind !== "checking" && view.kind !== "saving") headingRef.current?.focus();
|
|
90
|
+
}, [view.kind]);
|
|
91
|
+
const heading = (text) => /* @__PURE__ */ jsx("h2", {
|
|
92
|
+
ref: headingRef,
|
|
93
|
+
tabIndex: -1,
|
|
94
|
+
className: "text-2xl outline-none",
|
|
95
|
+
children: text
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ jsx("section", {
|
|
98
|
+
className: ui.section,
|
|
99
|
+
"aria-live": "polite",
|
|
100
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
101
|
+
className: "card-body gap-3",
|
|
102
|
+
children: [
|
|
103
|
+
view.kind === "checking" && /* @__PURE__ */ jsxs("p", {
|
|
104
|
+
role: "status",
|
|
105
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "loading loading-spinner loading-sm mr-2",
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
}), "Confirming your payment…"]
|
|
109
|
+
}),
|
|
110
|
+
view.kind === "saving" && /* @__PURE__ */ jsxs("p", {
|
|
111
|
+
role: "status",
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "loading loading-spinner loading-sm mr-2",
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
}), "Payment received. Saving your registration…"]
|
|
116
|
+
}),
|
|
117
|
+
view.kind === "missing" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
heading("No payment to show"),
|
|
119
|
+
/* @__PURE__ */ jsx("p", { children: "This page opens after checkout. If you meant to register, start here." }),
|
|
120
|
+
/* @__PURE__ */ jsx("a", {
|
|
121
|
+
href: registerHref,
|
|
122
|
+
className: "btn btn-primary self-start",
|
|
123
|
+
children: "Go to registration"
|
|
124
|
+
})
|
|
125
|
+
] }),
|
|
126
|
+
view.kind === "unpaid" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
127
|
+
heading(view.status.status === "expired" ? "Your checkout expired" : "Your payment isn't complete"),
|
|
128
|
+
/* @__PURE__ */ jsx("p", { children: "You haven't been charged. You can start again; your details are saved on this device." }),
|
|
129
|
+
/* @__PURE__ */ jsx("a", {
|
|
130
|
+
href: registerHref,
|
|
131
|
+
className: "btn btn-primary self-start",
|
|
132
|
+
children: "Back to registration"
|
|
133
|
+
})
|
|
134
|
+
] }),
|
|
135
|
+
view.kind === "done" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
|
+
heading("You're registered"),
|
|
137
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
138
|
+
"Thank you. Your payment went through",
|
|
139
|
+
view.email ? /* @__PURE__ */ jsxs(Fragment, { children: [" and Stripe will email a receipt to ", view.email] }) : null,
|
|
140
|
+
".",
|
|
141
|
+
!view.saved && " Your registration is recorded with your payment."
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsx("a", {
|
|
144
|
+
href: homeHref,
|
|
145
|
+
className: "btn self-start",
|
|
146
|
+
children: "Back to home"
|
|
147
|
+
})
|
|
148
|
+
] }),
|
|
149
|
+
view.kind === "save_failed" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
+
heading("Payment received, but we couldn't save your answers"),
|
|
151
|
+
/* @__PURE__ */ jsx("p", {
|
|
152
|
+
role: "alert",
|
|
153
|
+
children: view.message
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ jsx("p", { children: "Your payment is safe and your registration is recorded. Try saving your answers again, or contact the organizers." }),
|
|
156
|
+
/* @__PURE__ */ jsx("button", {
|
|
157
|
+
type: "button",
|
|
158
|
+
className: "btn btn-primary self-start",
|
|
159
|
+
onClick: () => setAttempt((n) => n + 1),
|
|
160
|
+
children: "Try again"
|
|
161
|
+
})
|
|
162
|
+
] }),
|
|
163
|
+
view.kind === "error" && /* @__PURE__ */ jsxs(Fragment, { children: [heading("We couldn't check your payment"), /* @__PURE__ */ jsx("p", {
|
|
164
|
+
role: "alert",
|
|
165
|
+
children: view.message
|
|
166
|
+
})] })
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export { PaymentStatus };
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=PaymentStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentStatus.js","names":[],"sources":["../src/PaymentStatus.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { registrationMessage } from \"@conferencesuite/core/registration/errors\";\nimport type { CheckoutStatus } from \"@conferencesuite/core/registration/types\";\nimport { buildSubmissionData } from \"@conferencesuite/core/registration/validation\";\nimport type { SuiteConfig } from \"@conferencesuite/core/types\";\nimport { useRegistrationActions } from \"@conferencesuite/react/useRegistration\";\nimport { useAuth } from \"@conferencesuite/react/AuthProvider\";\nimport { useStableConfig } from \"@conferencesuite/react/useStableConfig\";\nimport { getRegistrationForm } from \"@conferencesuite/core/registration/api\";\nimport { ui } from \"./classes\";\n\ntype View =\n | { kind: \"checking\" }\n | { kind: \"missing\" }\n | { kind: \"unpaid\"; status: CheckoutStatus }\n | { kind: \"saving\" }\n | { kind: \"done\"; email: string | null; saved: boolean }\n | { kind: \"save_failed\"; message: string }\n | { kind: \"error\"; message: string };\n\n/**\n * The page Stripe returns to (`/register/status?session_id=`). It confirms the\n * payment, then sends the answers saved before checkout so the registration form\n * has its submission. Stripe and the suite's webhook are the record of payment\n * (they apply the member's role even if this page is never opened), so a closed tab\n * loses nothing that matters; this page only completes the form.\n */\nexport function PaymentStatus({\n config: rawConfig,\n sessionId,\n registerHref = \"/register\",\n homeHref = \"/\",\n}: {\n config: SuiteConfig;\n sessionId: string | null;\n /** Where the registration form lives on this site */\n registerHref?: string;\n /** Where \"Back to home\" goes */\n homeHref?: string;\n}) {\n const config = useStableConfig(rawConfig);\n const actions = useRegistrationActions(config);\n const auth = useAuth();\n const [run, setView] = useState<View>({ kind: \"checking\" });\n const view: View = sessionId ? run : { kind: \"missing\" };\n const [attempt, setAttempt] = useState(0);\n // One run per session id and retry: effects run twice in development, and a run must not be cancelled midway\n const started = useRef<string | null>(null);\n const headingRef = useRef<HTMLHeadingElement>(null);\n\n useEffect(() => {\n if (!sessionId) return;\n // Wait for the session to be read so a signed-in member submits with their token\n if (!auth.ready) return;\n const key = `${sessionId}:${attempt}`;\n if (started.current === key) return;\n started.current = key;\n (async () => {\n try {\n let status: CheckoutStatus;\n try {\n status = await actions.status(sessionId);\n } catch (e) {\n return void setView({ kind: \"error\", message: registrationMessage(e) });\n }\n if (status.payment_status !== \"paid\") return void setView({ kind: \"unpaid\", status });\n\n const formId = config.registrationFormId;\n const draft = formId ? actions.drafts.load(formId) : null;\n if (!formId || !draft) return void setView({ kind: \"done\", email: status.customer_email, saved: false });\n\n setView({ kind: \"saving\" });\n const form = await getRegistrationForm(config, formId);\n const fields = form.schema ?? [];\n const paymentField = fields.find((f) => f.type === \"payment\");\n await actions.submit({\n formId,\n data: buildSubmissionData(fields, draft.values, paymentField ? { fieldId: paymentField.id, sessionId } : undefined),\n details: draft.details,\n });\n actions.drafts.clear(formId);\n setView({ kind: \"done\", email: status.customer_email, saved: true });\n } catch (e) {\n setView({ kind: \"save_failed\", message: registrationMessage(e) });\n }\n })();\n }, [sessionId, auth.ready, actions, config, attempt]);\n\n useEffect(() => {\n if (view.kind !== \"checking\" && view.kind !== \"saving\") headingRef.current?.focus();\n }, [view.kind]);\n\n const heading = (text: string) => (\n <h2 ref={headingRef} tabIndex={-1} className=\"text-2xl outline-none\">\n {text}\n </h2>\n );\n\n return (\n <section className={ui.section} aria-live=\"polite\">\n <div className=\"card-body gap-3\">\n {view.kind === \"checking\" && (\n <p role=\"status\">\n <span className=\"loading loading-spinner loading-sm mr-2\" aria-hidden=\"true\" />\n Confirming your payment…\n </p>\n )}\n {view.kind === \"saving\" && (\n <p role=\"status\">\n <span className=\"loading loading-spinner loading-sm mr-2\" aria-hidden=\"true\" />\n Payment received. Saving your registration…\n </p>\n )}\n {view.kind === \"missing\" && (\n <>\n {heading(\"No payment to show\")}\n <p>This page opens after checkout. If you meant to register, start here.</p>\n <a href={registerHref} className=\"btn btn-primary self-start\">\n Go to registration\n </a>\n </>\n )}\n {view.kind === \"unpaid\" && (\n <>\n {heading(view.status.status === \"expired\" ? \"Your checkout expired\" : \"Your payment isn't complete\")}\n <p>You haven't been charged. You can start again; your details are saved on this device.</p>\n <a href={registerHref} className=\"btn btn-primary self-start\">\n Back to registration\n </a>\n </>\n )}\n {view.kind === \"done\" && (\n <>\n {heading(\"You're registered\")}\n <p>\n Thank you. Your payment went through{view.email ? <> and Stripe will email a receipt to {view.email}</> : null}.\n {!view.saved && \" Your registration is recorded with your payment.\"}\n </p>\n <a href={homeHref} className=\"btn self-start\">\n Back to home\n </a>\n </>\n )}\n {view.kind === \"save_failed\" && (\n <>\n {heading(\"Payment received, but we couldn't save your answers\")}\n <p role=\"alert\">{view.message}</p>\n <p>Your payment is safe and your registration is recorded. Try saving your answers again, or contact the organizers.</p>\n <button type=\"button\" className=\"btn btn-primary self-start\" onClick={() => setAttempt((n) => n + 1)}>\n Try again\n </button>\n </>\n )}\n {view.kind === \"error\" && (\n <>\n {heading(\"We couldn't check your payment\")}\n <p role=\"alert\">{view.message}</p>\n </>\n )}\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAAgB,cAAc,EAC5B,QAAQ,WACR,WACA,eAAe,aACf,WAAW,OAQV;CACD,MAAM,SAAS,gBAAgB,SAAS;CACxC,MAAM,UAAU,uBAAuB,MAAM;CAC7C,MAAM,OAAO,QAAQ;CACrB,MAAM,CAAC,KAAK,WAAW,SAAe,EAAE,MAAM,WAAW,CAAC;CAC1D,MAAM,OAAa,YAAY,MAAM,EAAE,MA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