@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,12 @@
|
|
|
1
|
+
import { SuiteConfig } from "@conferencesuite/core/types";
|
|
2
|
+
/**
|
|
3
|
+
* A public suite form rendered in place, for people with or without an account:
|
|
4
|
+
* signed in, the entry joins their account (and the suite emails a confirmation);
|
|
5
|
+
* as a guest, an email that has an account is asked to sign in first. File fields
|
|
6
|
+
* aren't rendered here yet: a form that has one falls back to `fallbackUrl`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ProposalForm({ config, formId, fallbackUrl }: {
|
|
9
|
+
config: SuiteConfig;
|
|
10
|
+
formId: string;
|
|
11
|
+
fallbackUrl: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Mail } from "lucide-react";
|
|
3
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { checkEmail } from "@conferencesuite/core/auth/api";
|
|
5
|
+
import { isAccountExists, registrationMessage } from "@conferencesuite/core/registration/errors";
|
|
6
|
+
import { buildSubmissionData, isAskable, isEmail, validateDetails, validateValues } from "@conferencesuite/core/registration/validation";
|
|
7
|
+
import { useAuth } from "@conferencesuite/react/AuthProvider";
|
|
8
|
+
import { useSuiteForm } from "@conferencesuite/react/useProposalForm";
|
|
9
|
+
import { ui } from "./classes.js";
|
|
10
|
+
import { FieldInput } from "./fields.js";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
// src/ProposalForm.tsx
|
|
13
|
+
const EMPTY = {
|
|
14
|
+
fname: "",
|
|
15
|
+
lname: "",
|
|
16
|
+
email: "",
|
|
17
|
+
institution: ""
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A public suite form rendered in place, for people with or without an account:
|
|
21
|
+
* signed in, the entry joins their account (and the suite emails a confirmation);
|
|
22
|
+
* as a guest, an email that has an account is asked to sign in first. File fields
|
|
23
|
+
* aren't rendered here yet: a form that has one falls back to `fallbackUrl`.
|
|
24
|
+
*/
|
|
25
|
+
function ProposalForm({ config, formId, fallbackUrl }) {
|
|
26
|
+
const form = useSuiteForm(config, formId);
|
|
27
|
+
const { load } = form;
|
|
28
|
+
if (load.status === "loading") return /* @__PURE__ */ jsxs("p", {
|
|
29
|
+
role: "status",
|
|
30
|
+
"aria-live": "polite",
|
|
31
|
+
className: "text-center",
|
|
32
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "loading loading-spinner loading-sm mr-2",
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
}), "Loading the form…"]
|
|
36
|
+
});
|
|
37
|
+
if (load.status === "error") return /* @__PURE__ */ jsx("div", {
|
|
38
|
+
role: "alert",
|
|
39
|
+
className: ui.statusError,
|
|
40
|
+
children: /* @__PURE__ */ jsxs("div", { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("p", {
|
|
42
|
+
className: "font-semibold",
|
|
43
|
+
children: "We couldn't load the form"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("p", { children: load.message }),
|
|
46
|
+
/* @__PURE__ */ jsx("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
className: "btn btn-sm mt-2",
|
|
49
|
+
onClick: form.retry,
|
|
50
|
+
children: "Try again"
|
|
51
|
+
})
|
|
52
|
+
] })
|
|
53
|
+
});
|
|
54
|
+
const fields = load.form.schema ?? [];
|
|
55
|
+
if (fields.some((f) => f.type === "dropzone" || f.type === "payment")) return /* @__PURE__ */ jsx("div", {
|
|
56
|
+
role: "status",
|
|
57
|
+
className: ui.statusInfo,
|
|
58
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: "This form takes file uploads, so it opens on Conference Suite." }), /* @__PURE__ */ jsx("a", {
|
|
59
|
+
href: fallbackUrl,
|
|
60
|
+
target: "_blank",
|
|
61
|
+
rel: "noopener noreferrer",
|
|
62
|
+
className: "btn btn-primary btn-sm mt-2",
|
|
63
|
+
children: "Open the form"
|
|
64
|
+
})] })
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ jsx(Filled, {
|
|
67
|
+
config,
|
|
68
|
+
fields,
|
|
69
|
+
allowMultiple: !!load.form.allow_multiple,
|
|
70
|
+
form
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function Filled({ config, fields, allowMultiple, form }) {
|
|
74
|
+
const auth = useAuth();
|
|
75
|
+
const signedIn = !!form.auth.user;
|
|
76
|
+
const askable = useMemo(() => fields.filter(isAskable), [fields]);
|
|
77
|
+
const [edits, setEdits] = useState({});
|
|
78
|
+
const [values, setValues] = useState({});
|
|
79
|
+
const [errors, setErrors] = useState({
|
|
80
|
+
details: {},
|
|
81
|
+
values: {}
|
|
82
|
+
});
|
|
83
|
+
const [busy, setBusy] = useState(false);
|
|
84
|
+
const [failure, setFailure] = useState(null);
|
|
85
|
+
const [hasAccount, setHasAccount] = useState(false);
|
|
86
|
+
const [done, setDone] = useState(0);
|
|
87
|
+
const summaryRef = useRef(null);
|
|
88
|
+
const doneRef = useRef(null);
|
|
89
|
+
const uid = useId();
|
|
90
|
+
const profile = form.profile;
|
|
91
|
+
const details = useMemo(() => {
|
|
92
|
+
const base = { ...EMPTY };
|
|
93
|
+
if (profile) {
|
|
94
|
+
base.fname = profile.fname ?? "";
|
|
95
|
+
base.lname = profile.lname ?? "";
|
|
96
|
+
base.institution = profile.institution ?? "";
|
|
97
|
+
base.email = profile.email ?? "";
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...base,
|
|
101
|
+
...edits
|
|
102
|
+
};
|
|
103
|
+
}, [profile, edits]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (done) doneRef.current?.focus();
|
|
106
|
+
}, [done]);
|
|
107
|
+
const setDetail = (k) => (v) => setEdits((e) => ({
|
|
108
|
+
...e,
|
|
109
|
+
[k]: v
|
|
110
|
+
}));
|
|
111
|
+
/** Does this email have an account? A guest entry would be refused, so ask them to sign in first. */
|
|
112
|
+
async function lookupEmail() {
|
|
113
|
+
if (signedIn || !isEmail(details.email)) {
|
|
114
|
+
setHasAccount(false);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const res = await checkEmail(config, details.email.trim());
|
|
118
|
+
const found = res.kind === "registered" || res.kind === "other_org";
|
|
119
|
+
setHasAccount(found);
|
|
120
|
+
return found;
|
|
121
|
+
}
|
|
122
|
+
async function onSubmit(e) {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
const account = await lookupEmail();
|
|
125
|
+
const found = {
|
|
126
|
+
details: signedIn ? {} : validateDetails(details),
|
|
127
|
+
values: validateValues(askable, values)
|
|
128
|
+
};
|
|
129
|
+
if (account) found.details.email = "That email already has an account. Sign in to continue.";
|
|
130
|
+
setErrors(found);
|
|
131
|
+
if ([...Object.values(found.details), ...Object.values(found.values)].length > 0) {
|
|
132
|
+
requestAnimationFrame(() => summaryRef.current?.focus());
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setBusy(true);
|
|
136
|
+
setFailure(null);
|
|
137
|
+
try {
|
|
138
|
+
await form.submit(buildSubmissionData(fields, values), signedIn ? void 0 : details);
|
|
139
|
+
setValues({});
|
|
140
|
+
setErrors({
|
|
141
|
+
details: {},
|
|
142
|
+
values: {}
|
|
143
|
+
});
|
|
144
|
+
setDone((n) => n + 1);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
if (isAccountExists(err)) {
|
|
147
|
+
setHasAccount(true);
|
|
148
|
+
auth.open("signin");
|
|
149
|
+
}
|
|
150
|
+
setFailure(registrationMessage(err));
|
|
151
|
+
} finally {
|
|
152
|
+
setBusy(false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (done) return /* @__PURE__ */ jsx("section", {
|
|
156
|
+
className: ui.section,
|
|
157
|
+
"aria-label": "We received your submission",
|
|
158
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
159
|
+
className: "card-body gap-3",
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx("h2", {
|
|
162
|
+
ref: doneRef,
|
|
163
|
+
tabIndex: -1,
|
|
164
|
+
className: "text-2xl outline-none",
|
|
165
|
+
children: "We received your submission"
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsx("p", { children: signedIn ? "It is saved to your account, and we emailed you a confirmation." : "Thank you. Check your email for a confirmation." }),
|
|
168
|
+
allowMultiple && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
169
|
+
type: "button",
|
|
170
|
+
className: "btn btn-primary",
|
|
171
|
+
onClick: () => setDone(0),
|
|
172
|
+
children: "Submit another"
|
|
173
|
+
}) })
|
|
174
|
+
]
|
|
175
|
+
})
|
|
176
|
+
});
|
|
177
|
+
const problems = [...Object.entries(errors.details), ...Object.entries(errors.values)];
|
|
178
|
+
const detailErr = (k) => errors.details[k];
|
|
179
|
+
const text = (k, label, opts) => /* @__PURE__ */ jsxs("div", {
|
|
180
|
+
className: ui.field,
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("label", {
|
|
183
|
+
htmlFor: `${uid}-${k}`,
|
|
184
|
+
className: ui.label,
|
|
185
|
+
children: [
|
|
186
|
+
label,
|
|
187
|
+
" ",
|
|
188
|
+
/* @__PURE__ */ jsx("span", {
|
|
189
|
+
"aria-hidden": "true",
|
|
190
|
+
children: "*"
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ jsx("input", {
|
|
195
|
+
id: `${uid}-${k}`,
|
|
196
|
+
name: k,
|
|
197
|
+
type: opts.type ?? "text",
|
|
198
|
+
className: `${ui.input} ${detailErr(k) ? ui.inputInvalid : ""}`,
|
|
199
|
+
autoComplete: opts.auto,
|
|
200
|
+
value: details[k],
|
|
201
|
+
readOnly: opts.readOnly,
|
|
202
|
+
"aria-readonly": opts.readOnly || void 0,
|
|
203
|
+
"aria-required": "true",
|
|
204
|
+
"aria-invalid": !!detailErr(k),
|
|
205
|
+
"aria-describedby": detailErr(k) ? `${uid}-${k}-error` : void 0,
|
|
206
|
+
onChange: (e) => setDetail(k)(e.target.value),
|
|
207
|
+
onBlur: k === "email" ? () => void lookupEmail() : void 0
|
|
208
|
+
}),
|
|
209
|
+
detailErr(k) && /* @__PURE__ */ jsx("p", {
|
|
210
|
+
id: `${uid}-${k}-error`,
|
|
211
|
+
className: ui.fieldError,
|
|
212
|
+
children: detailErr(k)
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
const heading = signedIn ? "Submitting as" : "Your details";
|
|
217
|
+
return /* @__PURE__ */ jsx("form", {
|
|
218
|
+
onSubmit,
|
|
219
|
+
noValidate: true,
|
|
220
|
+
className: ui.section,
|
|
221
|
+
"aria-label": heading,
|
|
222
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: "card-body gap-5",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("h2", {
|
|
226
|
+
id: `${uid}-h`,
|
|
227
|
+
className: "text-2xl",
|
|
228
|
+
children: heading
|
|
229
|
+
}),
|
|
230
|
+
problems.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
231
|
+
ref: summaryRef,
|
|
232
|
+
tabIndex: -1,
|
|
233
|
+
role: "alert",
|
|
234
|
+
className: ui.statusError,
|
|
235
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
|
|
236
|
+
className: "font-semibold",
|
|
237
|
+
children: [
|
|
238
|
+
"Please fix ",
|
|
239
|
+
problems.length === 1 ? "this" : "these",
|
|
240
|
+
" before sending:"
|
|
241
|
+
]
|
|
242
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
243
|
+
className: "list-disc pl-5",
|
|
244
|
+
children: problems.map(([k, m]) => /* @__PURE__ */ jsx("li", { children: m }, k))
|
|
245
|
+
})] })
|
|
246
|
+
}),
|
|
247
|
+
signedIn ? /* @__PURE__ */ jsx(SignedInCard, {
|
|
248
|
+
email: form.auth.user?.email ?? "",
|
|
249
|
+
profile: form.profile
|
|
250
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
251
|
+
/* @__PURE__ */ jsxs("div", {
|
|
252
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
253
|
+
children: [text("fname", "First name", { auto: "given-name" }), text("lname", "Last name", { auto: "family-name" })]
|
|
254
|
+
}),
|
|
255
|
+
text("email", "Email", {
|
|
256
|
+
type: "email",
|
|
257
|
+
auto: "email",
|
|
258
|
+
readOnly: signedIn && !!details.email
|
|
259
|
+
}),
|
|
260
|
+
hasAccount && !signedIn && /* @__PURE__ */ jsx("div", {
|
|
261
|
+
role: "status",
|
|
262
|
+
className: ui.statusInfo,
|
|
263
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: "That email already has an account. Sign in to submit; what you typed here stays." }), /* @__PURE__ */ jsx("button", {
|
|
264
|
+
type: "button",
|
|
265
|
+
className: "btn btn-sm btn-primary mt-2",
|
|
266
|
+
onClick: () => auth.open("signin"),
|
|
267
|
+
children: "Sign in"
|
|
268
|
+
})] })
|
|
269
|
+
}),
|
|
270
|
+
text("institution", "Institution", { auto: "organization" })
|
|
271
|
+
] }),
|
|
272
|
+
askable.map((f) => /* @__PURE__ */ jsx(FieldInput, {
|
|
273
|
+
field: f,
|
|
274
|
+
value: values[f.id],
|
|
275
|
+
error: errors.values[f.id],
|
|
276
|
+
onChange: (v) => setValues((cur) => ({
|
|
277
|
+
...cur,
|
|
278
|
+
[f.id]: v
|
|
279
|
+
}))
|
|
280
|
+
}, f.id)),
|
|
281
|
+
failure && /* @__PURE__ */ jsx("p", {
|
|
282
|
+
role: "alert",
|
|
283
|
+
className: ui.statusError,
|
|
284
|
+
children: failure
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("button", {
|
|
287
|
+
type: "submit",
|
|
288
|
+
className: "btn btn-primary",
|
|
289
|
+
disabled: busy,
|
|
290
|
+
children: [busy && /* @__PURE__ */ jsx("span", {
|
|
291
|
+
className: "loading loading-spinner loading-sm",
|
|
292
|
+
"aria-hidden": "true"
|
|
293
|
+
}), "Submit"]
|
|
294
|
+
}) })
|
|
295
|
+
]
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Who a signed-in person is submitting as: read only and compact, because the suite takes the
|
|
301
|
+
* identity from their session, not from anything typed here. Edit your profile on the suite.
|
|
302
|
+
*/
|
|
303
|
+
function SignedInCard({ email, profile }) {
|
|
304
|
+
const name = [profile?.fname, profile?.lname].filter(Boolean).join(" ");
|
|
305
|
+
const initials = (name ? name.split(" ").map((w) => w[0]) : [email[0] ?? "?"]).join("").slice(0, 2).toUpperCase();
|
|
306
|
+
const where = profile?.institution ?? "";
|
|
307
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
308
|
+
className: ui.personCard,
|
|
309
|
+
"data-testid": "signed-in-card",
|
|
310
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
311
|
+
className: ui.personAvatar,
|
|
312
|
+
"aria-hidden": "true",
|
|
313
|
+
children: initials
|
|
314
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
315
|
+
className: "min-w-0",
|
|
316
|
+
children: [
|
|
317
|
+
name && /* @__PURE__ */ jsx("p", {
|
|
318
|
+
className: "font-semibold",
|
|
319
|
+
children: name
|
|
320
|
+
}),
|
|
321
|
+
where && /* @__PURE__ */ jsx("p", {
|
|
322
|
+
className: "text-sm text-base-content/80",
|
|
323
|
+
children: where
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ jsxs("p", {
|
|
326
|
+
className: "flex items-center gap-1.5 text-sm",
|
|
327
|
+
children: [/* @__PURE__ */ jsx(Mail, {
|
|
328
|
+
className: "size-3.5 shrink-0",
|
|
329
|
+
"aria-hidden": "true"
|
|
330
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
331
|
+
className: "truncate",
|
|
332
|
+
children: email
|
|
333
|
+
})]
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx("p", {
|
|
336
|
+
className: "mt-1 text-xs text-base-content/70",
|
|
337
|
+
children: "This is saved to your account. We emailed a confirmation when it arrives."
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
export { ProposalForm };
|
|
344
|
+
|
|
345
|
+
//# sourceMappingURL=ProposalForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProposalForm.js","names":[],"sources":["../src/ProposalForm.tsx"],"sourcesContent":["\"use client\";\n\nimport { Mail } from \"lucide-react\";\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { checkEmail } from \"@conferencesuite/core/auth/api\";\nimport { isAccountExists, registrationMessage } from \"@conferencesuite/core/registration/errors\";\nimport type { Details, FieldValue, FormField } from \"@conferencesuite/core/registration/types\";\nimport {\n buildSubmissionData,\n type Errors,\n isAskable,\n isEmail,\n validateDetails,\n validateValues,\n} from \"@conferencesuite/core/registration/validation\";\nimport type { SuiteConfig } from \"@conferencesuite/core/types\";\nimport { useAuth } from \"@conferencesuite/react/AuthProvider\";\nimport { useSuiteForm } from \"@conferencesuite/react/useProposalForm\";\nimport { ui } from \"./classes\";\nimport { FieldInput } from \"./fields\";\n\nconst EMPTY: Details = {\n fname: \"\",\n lname: \"\",\n email: \"\",\n institution: \"\",\n};\n\n/**\n * A public suite form rendered in place, for people with or without an account:\n * signed in, the entry joins their account (and the suite emails a confirmation);\n * as a guest, an email that has an account is asked to sign in first. File fields\n * aren't rendered here yet: a form that has one falls back to `fallbackUrl`.\n */\nexport function ProposalForm({\n config,\n formId,\n fallbackUrl,\n}: {\n config: SuiteConfig;\n formId: string;\n fallbackUrl: string;\n}) {\n const form = useSuiteForm(config, formId);\n const { load } = form;\n if (load.status === \"loading\") {\n return (\n <p role=\"status\" aria-live=\"polite\" className=\"text-center\">\n <span className=\"loading loading-spinner loading-sm mr-2\" aria-hidden=\"true\" />\n Loading the form…\n </p>\n );\n }\n if (load.status === \"error\") {\n return (\n <div role=\"alert\" className={ui.statusError}>\n <div>\n <p className=\"font-semibold\">We couldn't load the form</p>\n <p>{load.message}</p>\n <button type=\"button\" className=\"btn btn-sm mt-2\" onClick={form.retry}>\n Try again\n </button>\n </div>\n </div>\n );\n }\n const fields = load.form.schema ?? [];\n if (fields.some((f) => f.type === \"dropzone\" || f.type === \"payment\")) {\n return (\n <div role=\"status\" className={ui.statusInfo}>\n <div>\n <p>This form takes file uploads, so it opens on Conference Suite.</p>\n <a href={fallbackUrl} target=\"_blank\" rel=\"noopener noreferrer\" className=\"btn btn-primary btn-sm mt-2\">\n Open the form\n </a>\n </div>\n </div>\n );\n }\n return <Filled config={config} fields={fields} allowMultiple={!!load.form.allow_multiple} form={form} />;\n}\n\nfunction Filled({\n config,\n fields,\n allowMultiple,\n form,\n}: {\n config: SuiteConfig;\n fields: FormField[];\n allowMultiple: boolean;\n form: ReturnType<typeof useSuiteForm>;\n}) {\n const auth = useAuth();\n const signedIn = !!form.auth.user;\n const askable = useMemo(() => fields.filter(isAskable), [fields]);\n const [edits, setEdits] = useState<Partial<Details>>({});\n const [values, setValues] = useState<Record<string, FieldValue>>({});\n const [errors, setErrors] = useState<{ details: Errors; values: Errors }>({\n details: {},\n values: {},\n });\n const [busy, setBusy] = useState(false);\n const [failure, setFailure] = useState<string | null>(null);\n const [hasAccount, setHasAccount] = useState(false);\n const [done, setDone] = useState(0);\n const summaryRef = useRef<HTMLDivElement>(null);\n const doneRef = useRef<HTMLHeadingElement>(null);\n const uid = useId();\n\n const profile = form.profile;\n const details = useMemo<Details>(() => {\n const base = { ...EMPTY };\n if (profile) {\n base.fname = profile.fname ?? \"\";\n base.lname = profile.lname ?? \"\";\n base.institution = profile.institution ?? \"\";\n base.email = profile.email ?? \"\";\n }\n return { ...base, ...edits };\n }, [profile, edits]);\n\n useEffect(() => {\n if (done) doneRef.current?.focus();\n }, [done]);\n\n const setDetail = (k: keyof Details) => (v: string) => setEdits((e) => ({ ...e, [k]: v }));\n\n /** Does this email have an account? A guest entry would be refused, so ask them to sign in first. */\n async function lookupEmail(): Promise<boolean> {\n if (signedIn || !isEmail(details.email)) {\n setHasAccount(false);\n return false;\n }\n const res = await checkEmail(config, details.email.trim());\n const found = res.kind === \"registered\" || res.kind === \"other_org\";\n setHasAccount(found);\n return found;\n }\n\n async function onSubmit(e: React.FormEvent) {\n e.preventDefault();\n const account = await lookupEmail();\n // Signed in, the suite knows who this is from the token: no details to check or send\n const found = {\n details: signedIn ? {} : validateDetails(details),\n values: validateValues(askable, values),\n };\n if (account) found.details.email = \"That email already has an account. Sign in to continue.\";\n setErrors(found);\n if ([...Object.values(found.details), ...Object.values(found.values)].length > 0) {\n requestAnimationFrame(() => summaryRef.current?.focus());\n return;\n }\n setBusy(true);\n setFailure(null);\n try {\n await form.submit(buildSubmissionData(fields, values), signedIn ? undefined : details);\n setValues({});\n setErrors({ details: {}, values: {} });\n setDone((n) => n + 1);\n } catch (err) {\n if (isAccountExists(err)) {\n setHasAccount(true);\n auth.open(\"signin\");\n }\n setFailure(registrationMessage(err));\n } finally {\n setBusy(false);\n }\n }\n\n if (done) {\n return (\n <section className={ui.section} aria-label=\"We received your submission\">\n <div className=\"card-body gap-3\">\n <h2 ref={doneRef} tabIndex={-1} className=\"text-2xl outline-none\">\n We received your submission\n </h2>\n <p>\n {signedIn\n ? \"It is saved to your account, and we emailed you a confirmation.\"\n : \"Thank you. Check your email for a confirmation.\"}\n </p>\n {allowMultiple && (\n <div>\n <button type=\"button\" className=\"btn btn-primary\" onClick={() => setDone(0)}>\n Submit another\n </button>\n </div>\n )}\n </div>\n </section>\n );\n }\n\n const problems = [...Object.entries(errors.details), ...Object.entries(errors.values)];\n const detailErr = (k: keyof Details) => errors.details[k];\n const text = (\n k: \"fname\" | \"lname\" | \"email\" | \"institution\",\n label: string,\n opts: { type?: string; auto: string; readOnly?: boolean },\n ) => (\n <div className={ui.field}>\n <label htmlFor={`${uid}-${k}`} className={ui.label}>\n {label} <span aria-hidden=\"true\">*</span>\n </label>\n <input\n id={`${uid}-${k}`}\n name={k}\n type={opts.type ?? \"text\"}\n className={`${ui.input} ${detailErr(k) ? ui.inputInvalid : \"\"}`}\n autoComplete={opts.auto}\n value={details[k]}\n readOnly={opts.readOnly}\n aria-readonly={opts.readOnly || undefined}\n aria-required=\"true\"\n aria-invalid={!!detailErr(k)}\n aria-describedby={detailErr(k) ? `${uid}-${k}-error` : undefined}\n onChange={(e) => setDetail(k)(e.target.value)}\n onBlur={k === \"email\" ? () => void lookupEmail() : undefined}\n />\n {detailErr(k) && (\n <p id={`${uid}-${k}-error`} className={ui.fieldError}>\n {detailErr(k)}\n </p>\n )}\n </div>\n );\n\n // The form is named with aria-label, the same text as its heading: Firefox's content process crashes when a\n // form named by aria-labelledby is inspected by axe and then interacted with (reproduced in CI).\n const heading = signedIn ? \"Submitting as\" : \"Your details\";\n return (\n <form onSubmit={onSubmit} noValidate className={ui.section} aria-label={heading}>\n <div className=\"card-body gap-5\">\n <h2 id={`${uid}-h`} className=\"text-2xl\">\n {heading}\n </h2>\n {problems.length > 0 && (\n <div ref={summaryRef} tabIndex={-1} role=\"alert\" className={ui.statusError}>\n <div>\n <p className=\"font-semibold\">Please fix {problems.length === 1 ? \"this\" : \"these\"} before sending:</p>\n <ul className=\"list-disc pl-5\">\n {problems.map(([k, m]) => (\n <li key={k}>{m}</li>\n ))}\n </ul>\n </div>\n </div>\n )}\n {signedIn ? (\n <SignedInCard email={form.auth.user?.email ?? \"\"} profile={form.profile} />\n ) : (\n <>\n <div className=\"grid gap-4 sm:grid-cols-2\">\n {text(\"fname\", \"First name\", { auto: \"given-name\" })}\n {text(\"lname\", \"Last name\", { auto: \"family-name\" })}\n </div>\n {text(\"email\", \"Email\", {\n type: \"email\",\n auto: \"email\",\n readOnly: signedIn && !!details.email,\n })}\n {hasAccount && !signedIn && (\n <div role=\"status\" className={ui.statusInfo}>\n <div>\n <p>That email already has an account. Sign in to submit; what you typed here stays.</p>\n <button type=\"button\" className=\"btn btn-sm btn-primary mt-2\" onClick={() => auth.open(\"signin\")}>\n Sign in\n </button>\n </div>\n </div>\n )}\n {text(\"institution\", \"Institution\", { auto: \"organization\" })}\n </>\n )}\n {askable.map((f) => (\n <FieldInput\n key={f.id}\n field={f}\n value={values[f.id]}\n error={errors.values[f.id]}\n onChange={(v) => setValues((cur) => ({ ...cur, [f.id]: v }))}\n />\n ))}\n {failure && (\n <p role=\"alert\" className={ui.statusError}>\n {failure}\n </p>\n )}\n <div>\n <button type=\"submit\" className=\"btn btn-primary\" disabled={busy}>\n {busy && <span className=\"loading loading-spinner loading-sm\" aria-hidden=\"true\" />}\n Submit\n </button>\n </div>\n </div>\n </form>\n );\n}\n\n/**\n * Who a signed-in person is submitting as: read only and compact, because the suite takes the\n * identity from their session, not from anything typed here. Edit your profile on the suite.\n */\nfunction SignedInCard({ email, profile }: { email: string; profile: Partial<Details> | null }) {\n const name = [profile?.fname, profile?.lname].filter(Boolean).join(\" \");\n const initials = (name ? name.split(\" \").map((w) => w[0]) : [email[0] ?? \"?\"]).join(\"\").slice(0, 2).toUpperCase();\n const where = profile?.institution ?? \"\";\n return (\n <div className={ui.personCard} data-testid=\"signed-in-card\">\n <span className={ui.personAvatar} aria-hidden=\"true\">\n {initials}\n </span>\n <div className=\"min-w-0\">\n {name && <p className=\"font-semibold\">{name}</p>}\n {where && <p className=\"text-sm text-base-content/80\">{where}</p>}\n <p className=\"flex items-center gap-1.5 text-sm\">\n <Mail className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"truncate\">{email}</span>\n </p>\n <p className=\"mt-1 text-xs text-base-content/70\">\n This is saved to your account. We emailed a confirmation when it arrives.\n </p>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAqBA,MAAM,QAAiB;CACrB,OAAO;CACP,OAAO;CACP,OAAO;CACP,aAAa;AACf;;;;;;;AAQA,SAAgB,aAAa,EAC3B,QACA,QACA,eAKC;CACD,MAAM,OAAO,aAAa,QAAQ,MAAM;CACxC,MAAM,EAAE,SAAS;CACjB,IAAI,KAAK,WAAW,WAClB,OACE,qBAAC,KAAD;EAAG,MAAK;EAAS,aAAU;EAAS,WAAU;EAA9C,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAA0C,eAAY;EAAQ,CAAA,GAAC,mBAE9E;;CAGP,IAAI,KAAK,WAAW,SAClB,OACE,oBAAC,OAAD;EAAK,MAAK;EAAQ,WAAW,GAAG;EAC9B,UAAA,qBAAC,OAAD,EAAA,UAAA;GACE,oBAAC,KAAD;IAAG,WAAU;IAAgB,UAAA;GAAiC,CAAA;GAC9D,oBAAC,KAAD,EAAA,UAAI,KAAK,QAAW,CAAA;GACpB,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAkB,SAAS,KAAK;IAAO,UAAA;GAE/D,CAAA;EACL,EAAA,CAAA;CACF,CAAA;CAGT,MAAM,SAAS,KAAK,KAAK,UAAU,CAAC;CACpC,IAAI,OAAO,MAAM,MAAM,EAAE,SAAS,cAAc,EAAE,SAAS,SAAS,GAClE,OACE,oBAAC,OAAD;EAAK,MAAK;EAAS,WAAW,GAAG;EAC/B,UAAA,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,KAAD,EAAA,UAAG,iEAAiE,CAAA,GACpE,oBAAC,KAAD;GAAG,MAAM;GAAa,QAAO;GAAS,KAAI;GAAsB,WAAU;GAA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AU;KAAgC,UAAA;IAAS,CAAA;IAChE,qBAAC,KAAD;KAAG,WAAU;KAAb,UAAA,CACE,oBAAC,MAAD;MAAM,WAAU;MAAoB,eAAY;KAAQ,CAAA,GACxD,oBAAC,QAAD;MAAM,WAAU;MAAY,UAAA;KAAY,CAAA,CACvC;;IACH,oBAAC,KAAD;KAAG,WAAU;KAAoC,UAAA;IAE9C,CAAA;GACA;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SuiteConfig } from "@conferencesuite/core/types";
|
|
2
|
+
/** The registration button: its wording and link come from the suite's window, never a hardcoded date. */
|
|
3
|
+
export declare function RegistrationCta({ config, className, registerHref }: {
|
|
4
|
+
config: SuiteConfig;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Where the registration form lives on this site */
|
|
7
|
+
registerHref?: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
/** The day registration opens, from the suite ("TBD" until it is set). */
|
|
10
|
+
export declare function RegistrationDate({ config, fallback }: {
|
|
11
|
+
config: SuiteConfig;
|
|
12
|
+
fallback?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** A short badge for the registration card: opens date, open now, or closed. */
|
|
15
|
+
export declare function RegistrationBadge({ config }: {
|
|
16
|
+
config: SuiteConfig;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { formatDay } from "@conferencesuite/core/registration/options";
|
|
3
|
+
import { useRegistrationState } from "@conferencesuite/react/useRegistration";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/RegistrationCta.tsx
|
|
6
|
+
/** The registration button: its wording and link come from the suite's window, never a hardcoded date. */
|
|
7
|
+
function RegistrationCta({ config, className = "btn btn-lg", registerHref = "/register" }) {
|
|
8
|
+
const state = useRegistrationState(config);
|
|
9
|
+
if (state?.kind === "open") return /* @__PURE__ */ jsx("a", {
|
|
10
|
+
href: registerHref,
|
|
11
|
+
className: `${className} btn-secondary`,
|
|
12
|
+
children: "Register now"
|
|
13
|
+
});
|
|
14
|
+
const label = state === null ? "Registration" : state.kind === "opens_soon" ? state.startDate ? `Registration opens ${formatDay(state.startDate)}` : "Registration opens soon" : state.kind === "closed" ? "Registration closed" : "Registration";
|
|
15
|
+
return /* @__PURE__ */ jsx("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
className,
|
|
18
|
+
disabled: true,
|
|
19
|
+
children: label
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/** The day registration opens, from the suite ("TBD" until it is set). */
|
|
23
|
+
function RegistrationDate({ config, fallback = "TBD" }) {
|
|
24
|
+
const state = useRegistrationState(config);
|
|
25
|
+
if (state?.kind === "opens_soon" && state.startDate) return /* @__PURE__ */ jsx(Fragment, { children: formatDay(state.startDate) });
|
|
26
|
+
if (state?.kind === "open") return /* @__PURE__ */ jsx(Fragment, { children: "Open now" });
|
|
27
|
+
return /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
|
28
|
+
}
|
|
29
|
+
/** A short badge for the registration card: opens date, open now, or closed. */
|
|
30
|
+
function RegistrationBadge({ config }) {
|
|
31
|
+
const state = useRegistrationState(config);
|
|
32
|
+
if (state?.kind === "open") return /* @__PURE__ */ jsx(Fragment, { children: "Open now" });
|
|
33
|
+
if (state?.kind === "opens_soon") return /* @__PURE__ */ jsx(Fragment, { children: state.startDate ? `Opens ${formatDay(state.startDate)}` : "Opens soon" });
|
|
34
|
+
if (state?.kind === "closed") return /* @__PURE__ */ jsx(Fragment, { children: "Closed" });
|
|
35
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "Registration" });
|
|
36
|
+
}
|
|
37
|
+
export { RegistrationBadge, RegistrationCta, RegistrationDate };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=RegistrationCta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegistrationCta.js","names":[],"sources":["../src/RegistrationCta.tsx"],"sourcesContent":["\"use client\";\n\nimport { formatDay } from \"@conferencesuite/core/registration/options\";\nimport type { SuiteConfig } from \"@conferencesuite/core/types\";\nimport { useRegistrationState } from \"@conferencesuite/react/useRegistration\";\n\n/** The registration button: its wording and link come from the suite's window, never a hardcoded date. */\nexport function RegistrationCta({\n config,\n className = \"btn btn-lg\",\n registerHref = \"/register\",\n}: {\n config: SuiteConfig;\n className?: string;\n /** Where the registration form lives on this site */\n registerHref?: string;\n}) {\n const state = useRegistrationState(config);\n if (state?.kind === \"open\") {\n return (\n <a href={registerHref} className={`${className} btn-secondary`}>\n Register now\n </a>\n );\n }\n const label =\n state === null\n ? \"Registration\"\n : state.kind === \"opens_soon\"\n ? state.startDate\n ? `Registration opens ${formatDay(state.startDate)}`\n : \"Registration opens soon\"\n : state.kind === \"closed\"\n ? \"Registration closed\"\n : \"Registration\";\n return (\n <button type=\"button\" className={className} disabled>\n {label}\n </button>\n );\n}\n\n/** The day registration opens, from the suite (\"TBD\" until it is set). */\nexport function RegistrationDate({ config, fallback = \"TBD\" }: { config: SuiteConfig; fallback?: string }) {\n const state = useRegistrationState(config);\n if (state?.kind === \"opens_soon\" && state.startDate) return <>{formatDay(state.startDate)}</>;\n if (state?.kind === \"open\") return <>Open now</>;\n return <>{fallback}</>;\n}\n\n/** A short badge for the registration card: opens date, open now, or closed. */\nexport function RegistrationBadge({ config }: { config: SuiteConfig }) {\n const state = useRegistrationState(config);\n if (state?.kind === \"open\") return <>Open now</>;\n if (state?.kind === \"opens_soon\") return <>{state.startDate ? `Opens ${formatDay(state.startDate)}` : \"Opens soon\"}</>;\n if (state?.kind === \"closed\") return <>Closed</>;\n return <>Registration</>;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,gBAAgB,EAC9B,QACA,YAAY,cACZ,eAAe,eAMd;CACD,MAAM,QAAQ,qBAAqB,MAAM;CACzC,IAAI,OAAO,SAAS,QAClB,OACE,oBAAC,KAAD;EAAG,MAAM;EAAc,WAAW,GAAG,UAAU;EAAiB,UAAA;CAE7D,CAAA;CAGP,MAAM,QACJ,UAAU,OACN,iBACA,MAAM,SAAS,eACb,MAAM,YACJ,sBAAsB,UAAU,MAAM,SAAS,MAC/C,4BACF,MAAM,SAAS,WACb,wBACA;CACV,OACE,oBAAC,UAAD;EAAQ,MAAK;EAAoB;EAAW,UAAA;EACzC,UAAA;CACK,CAAA;AAEZ;;AAGA,SAAgB,iBAAiB,EAAE,QAAQ,WAAW,SAAqD;CACzG,MAAM,QAAQ,qBAAqB,MAAM;CACzC,IAAI,OAAO,SAAS,gBAAgB,MAAM,WAAW,OAAO,oBAAA,UAAA,EAAA,UAAG,UAAU,MAAM,SAAS,EAAI,CAAA;CAC5F,IAAI,OAAO,SAAS,QAAQ,OAAO,oBAAA,UAAA,EAAA,UAAE,WAAU,CAAA;CAC/C,OAAO,oBAAA,UAAA,EAAA,UAAG,SAAW,CAAA;AACvB;;AAGA,SAAgB,kBAAkB,EAAE,UAAmC;CACrE,MAAM,QAAQ,qBAAqB,MAAM;CACzC,IAAI,OAAO,SAAS,QAAQ,OAAO,oBAAA,UAAA,EAAA,UAAE,WAAU,CAAA;CAC/C,IAAI,OAAO,SAAS,cAAc,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,YAAY,SAAS,UAAU,MAAM,SAAS,MAAM,aAAe,CAAA;CACrH,IAAI,OAAO,SAAS,UAAU,OAAO,oBAAA,UAAA,EAAA,UAAE,SAAQ,CAAA;CAC/C,OAAO,oBAAA,UAAA,EAAA,UAAE,eAAc,CAAA;AACzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SuiteConfig } from "@conferencesuite/core/types";
|
|
2
|
+
/**
|
|
3
|
+
* The registration form, rendered natively from the suite's `registration` form:
|
|
4
|
+
* your details and the form's questions, then the registration tier and add-ons the
|
|
5
|
+
* organizers sell, then Stripe's embedded checkout. Whether registration is open, full or already done for you is decided by
|
|
6
|
+
* the suite (database guards); this only shows it.
|
|
7
|
+
*
|
|
8
|
+
* `returnPath` is where Stripe sends people back (a page rendering <PaymentStatus />).
|
|
9
|
+
*/
|
|
10
|
+
export declare function RegistrationForm({ config, returnPath }: {
|
|
11
|
+
config: SuiteConfig;
|
|
12
|
+
returnPath?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|