@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.
Files changed (55) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +9 -0
  3. package/README.md +11 -2
  4. package/dist/AuthButton.d.ts +8 -0
  5. package/dist/AuthButton.js +73 -0
  6. package/dist/AuthButton.js.map +1 -0
  7. package/dist/AuthDialog.d.ts +2 -0
  8. package/dist/AuthDialog.js +295 -0
  9. package/dist/AuthDialog.js.map +1 -0
  10. package/dist/AuthNotice.d.ts +2 -0
  11. package/dist/AuthNotice.js +32 -0
  12. package/dist/AuthNotice.js.map +1 -0
  13. package/dist/CatalogPicker.d.ts +13 -0
  14. package/dist/CatalogPicker.js +272 -0
  15. package/dist/CatalogPicker.js.map +1 -0
  16. package/dist/CheckoutMount.d.ts +10 -0
  17. package/dist/CheckoutMount.js +51 -0
  18. package/dist/CheckoutMount.js.map +1 -0
  19. package/dist/PaymentStatus.d.ts +16 -0
  20. package/dist/PaymentStatus.js +173 -0
  21. package/dist/PaymentStatus.js.map +1 -0
  22. package/dist/ProposalForm.d.ts +12 -0
  23. package/dist/ProposalForm.js +345 -0
  24. package/dist/ProposalForm.js.map +1 -0
  25. package/dist/RegistrationCta.d.ts +17 -0
  26. package/dist/RegistrationCta.js +39 -0
  27. package/dist/RegistrationCta.js.map +1 -0
  28. package/dist/RegistrationForm.d.ts +13 -0
  29. package/dist/RegistrationForm.js +523 -0
  30. package/dist/RegistrationForm.js.map +1 -0
  31. package/dist/ScheduleBadge.d.ts +5 -0
  32. package/dist/ScheduleBadge.js +22 -0
  33. package/dist/ScheduleBadge.js.map +1 -0
  34. package/dist/SchedulePage.d.ts +10 -0
  35. package/dist/SchedulePage.js +435 -0
  36. package/dist/SchedulePage.js.map +1 -0
  37. package/dist/ScheduleViews.d.ts +32 -0
  38. package/dist/ScheduleViews.js +294 -0
  39. package/dist/ScheduleViews.js.map +1 -0
  40. package/dist/SessionDialog.d.ts +16 -0
  41. package/dist/SessionDialog.js +144 -0
  42. package/dist/SessionDialog.js.map +1 -0
  43. package/dist/SuiteAuth.d.ts +6 -0
  44. package/dist/SuiteAuth.js +20 -0
  45. package/dist/SuiteAuth.js.map +1 -0
  46. package/dist/classes.d.ts +36 -0
  47. package/dist/classes.js +40 -0
  48. package/dist/classes.js.map +1 -0
  49. package/dist/fields.d.ts +10 -0
  50. package/dist/fields.js +250 -0
  51. package/dist/fields.js.map +1 -0
  52. package/dist/scheduleClasses.d.ts +16 -0
  53. package/dist/scheduleClasses.js +20 -0
  54. package/dist/scheduleClasses.js.map +1 -0
  55. package/package.json +43 -3
@@ -0,0 +1,523 @@
1
+ "use client";
2
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
3
+ import { checkEmail } from "@conferencesuite/core/auth/api";
4
+ import { isAccountExists, registrationMessage } from "@conferencesuite/core/registration/errors";
5
+ import { emptySelection, hasSelection } from "@conferencesuite/core/registration/catalog";
6
+ import { formatDay } from "@conferencesuite/core/registration/options";
7
+ import { isAskable, isEmail, validateDetails, validateValues } from "@conferencesuite/core/registration/validation";
8
+ import { useAuth } from "@conferencesuite/react/AuthProvider";
9
+ import { useRegistration } from "@conferencesuite/react/useRegistration";
10
+ import { ui } from "./classes.js";
11
+ import { CatalogPicker } from "./CatalogPicker.js";
12
+ import { CheckoutMount } from "./CheckoutMount.js";
13
+ import { FieldInput } from "./fields.js";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ // src/RegistrationForm.tsx
16
+ const EMPTY = {
17
+ fname: "",
18
+ lname: "",
19
+ email: "",
20
+ institution: ""
21
+ };
22
+ function Notice({ tone, title, children }) {
23
+ return /* @__PURE__ */ jsx("div", {
24
+ role: tone === "error" ? "alert" : "status",
25
+ className: tone === "error" ? ui.statusError : ui.statusInfo,
26
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
27
+ className: "font-semibold",
28
+ children: title
29
+ }), children && /* @__PURE__ */ jsx("div", {
30
+ className: "mt-1",
31
+ children
32
+ })] })
33
+ });
34
+ }
35
+ /**
36
+ * The registration form, rendered natively from the suite's `registration` form:
37
+ * your details and the form's questions, then the registration tier and add-ons the
38
+ * organizers sell, then Stripe's embedded checkout. Whether registration is open, full or already done for you is decided by
39
+ * the suite (database guards); this only shows it.
40
+ *
41
+ * `returnPath` is where Stripe sends people back (a page rendering <PaymentStatus />).
42
+ */
43
+ function RegistrationForm({ config, returnPath = "/register/status" }) {
44
+ const reg = useRegistration(config);
45
+ const { load } = reg;
46
+ if (!config.registrationFormId) return /* @__PURE__ */ jsx(Notice, {
47
+ tone: "info",
48
+ title: "Registration is not set up yet"
49
+ });
50
+ if (load.status === "loading") return /* @__PURE__ */ jsxs("p", {
51
+ role: "status",
52
+ "aria-live": "polite",
53
+ className: "text-center",
54
+ children: [/* @__PURE__ */ jsx("span", {
55
+ className: "loading loading-spinner loading-sm mr-2",
56
+ "aria-hidden": "true"
57
+ }), "Loading registration…"]
58
+ });
59
+ if (load.status === "error") return /* @__PURE__ */ jsxs(Notice, {
60
+ tone: "error",
61
+ title: "We couldn't load registration",
62
+ children: [/* @__PURE__ */ jsx("p", { children: load.message }), /* @__PURE__ */ jsx("button", {
63
+ type: "button",
64
+ className: "btn btn-sm mt-2",
65
+ onClick: reg.retry,
66
+ children: "Try again"
67
+ })]
68
+ });
69
+ const { state } = load;
70
+ if (state.kind === "opens_soon") return /* @__PURE__ */ jsx(Notice, {
71
+ tone: "info",
72
+ title: state.startDate ? `Registration opens ${formatDay(state.startDate)}` : "Registration opens soon",
73
+ children: /* @__PURE__ */ jsx("p", { children: "Check back then. Your answers aren't needed until it opens." })
74
+ });
75
+ if (state.kind === "closed") return /* @__PURE__ */ jsx(Notice, {
76
+ tone: "info",
77
+ title: "Registration is closed"
78
+ });
79
+ if (state.kind === "unavailable") return /* @__PURE__ */ jsx(Notice, {
80
+ tone: "info",
81
+ title: "Registration isn't available right now",
82
+ children: /* @__PURE__ */ jsx("p", { children: "Please check back soon." })
83
+ });
84
+ if (reg.membership?.registration_status === "pending") return /* @__PURE__ */ jsx(Notice, {
85
+ tone: "info",
86
+ title: "Your payment is on its way",
87
+ children: /* @__PURE__ */ jsxs("p", { children: [
88
+ "We have your ",
89
+ reg.membership.tier_name ? `${reg.membership.tier_name} ` : "",
90
+ "registration, waiting for your bank transfer to arrive. Once it does, you're registered; there is nothing more to do here."
91
+ ] })
92
+ });
93
+ if (reg.membership?.paid_this_cycle) return /* @__PURE__ */ jsx(Registered, {
94
+ config,
95
+ returnPath,
96
+ membership: reg.membership,
97
+ data: load,
98
+ reg
99
+ });
100
+ if (!load.form || !load.form.schema?.some((f) => f.type === "payment")) return /* @__PURE__ */ jsx(Notice, {
101
+ tone: "info",
102
+ title: "Registration isn't available right now",
103
+ children: /* @__PURE__ */ jsx("p", { children: "The registration form is being set up. Please check back soon." })
104
+ });
105
+ return /* @__PURE__ */ jsx(Flow, {
106
+ config,
107
+ returnPath,
108
+ data: load,
109
+ formId: load.form.id,
110
+ fields: load.form.schema,
111
+ reg
112
+ });
113
+ }
114
+ function Flow({ config, returnPath, data, formId, fields, reg }) {
115
+ const auth = useAuth();
116
+ const signedIn = !!reg.auth.user;
117
+ const paymentField = fields.find((f) => f.type === "payment");
118
+ const askable = useMemo(() => fields.filter(isAskable), [fields]);
119
+ const [step, setStep] = useState("details");
120
+ const [draft] = useState(() => reg.actions.drafts.load(formId));
121
+ const [edits, setEdits] = useState({});
122
+ const [values, setValues] = useState(() => draft?.values ?? {});
123
+ const [errors, setErrors] = useState({
124
+ details: {},
125
+ values: {}
126
+ });
127
+ const [selection, setSelection] = useState(() => draft?.selection ?? emptySelection());
128
+ const [busy, setBusy] = useState(false);
129
+ const [failure, setFailure] = useState(null);
130
+ const [clientSecret, setClientSecret] = useState(null);
131
+ const [emailHint, setEmailHint] = useState(null);
132
+ const headingRef = useRef(null);
133
+ const summaryRef = useRef(null);
134
+ const uid = useId();
135
+ const profile = reg.profile;
136
+ const details = useMemo(() => {
137
+ const base = {
138
+ ...EMPTY,
139
+ ...draft?.details
140
+ };
141
+ if (profile) {
142
+ base.fname ||= profile.fname ?? "";
143
+ base.lname ||= profile.lname ?? "";
144
+ base.institution ||= profile.institution ?? "";
145
+ base.email = profile.email || base.email;
146
+ }
147
+ return {
148
+ ...base,
149
+ ...edits
150
+ };
151
+ }, [
152
+ draft,
153
+ profile,
154
+ edits
155
+ ]);
156
+ const first = useRef(true);
157
+ useEffect(() => {
158
+ if (first.current) {
159
+ first.current = false;
160
+ return;
161
+ }
162
+ headingRef.current?.focus();
163
+ }, [step]);
164
+ const { catalog } = data;
165
+ const stripeAccount = catalog.stripeAccount;
166
+ const publishableKey = catalog.publishableKey;
167
+ const setDetail = (k) => (v) => setEdits((e) => ({
168
+ ...e,
169
+ [k]: v
170
+ }));
171
+ /** Does this email have an account? Then the suite refuses a guest registration: sign in first. */
172
+ async function lookupEmail() {
173
+ if (signedIn || !isEmail(details.email)) {
174
+ setEmailHint(null);
175
+ return null;
176
+ }
177
+ const res = await checkEmail(config, details.email.trim());
178
+ const hint = res.kind === "registered" || res.kind === "other_org" ? "account" : null;
179
+ setEmailHint(hint);
180
+ return hint;
181
+ }
182
+ async function next(e) {
183
+ e.preventDefault();
184
+ const hint = signedIn ? null : await lookupEmail();
185
+ const found = {
186
+ details: validateDetails(details),
187
+ values: validateValues(askable, values)
188
+ };
189
+ if (hint === "account") found.details.email = "That email already has an account. Sign in to continue.";
190
+ setErrors(found);
191
+ if ([...Object.values(found.details), ...Object.values(found.values)].length > 0) {
192
+ requestAnimationFrame(() => summaryRef.current?.focus());
193
+ return;
194
+ }
195
+ setFailure(null);
196
+ setStep("payment");
197
+ }
198
+ async function pay() {
199
+ if (!selection.tierOfferId) {
200
+ setFailure("Choose a registration option to continue.");
201
+ return;
202
+ }
203
+ setBusy(true);
204
+ setFailure(null);
205
+ try {
206
+ reg.actions.drafts.save(formId, {
207
+ details,
208
+ values,
209
+ selection
210
+ });
211
+ const { clientSecret: secret } = await reg.actions.checkout({
212
+ formId,
213
+ fieldId: paymentField.id,
214
+ selection,
215
+ details,
216
+ returnUrl: `${window.location.origin}${returnPath}?session_id={CHECKOUT_SESSION_ID}`
217
+ });
218
+ setClientSecret(secret);
219
+ } catch (e) {
220
+ if (isAccountExists(e)) {
221
+ setEmailHint("account");
222
+ setStep("details");
223
+ auth.open("signin");
224
+ }
225
+ setFailure(registrationMessage(e));
226
+ } finally {
227
+ setBusy(false);
228
+ }
229
+ }
230
+ const problems = [...Object.entries(errors.details), ...Object.entries(errors.values)];
231
+ const detailErr = (k) => errors.details[k];
232
+ const textField = (k, label, opts) => /* @__PURE__ */ jsxs("div", {
233
+ className: ui.field,
234
+ children: [
235
+ /* @__PURE__ */ jsxs("label", {
236
+ htmlFor: `${uid}-${k}`,
237
+ className: ui.label,
238
+ children: [
239
+ label,
240
+ " ",
241
+ /* @__PURE__ */ jsx("span", {
242
+ "aria-hidden": "true",
243
+ children: "*"
244
+ })
245
+ ]
246
+ }),
247
+ /* @__PURE__ */ jsx("input", {
248
+ id: `${uid}-${k}`,
249
+ name: k,
250
+ type: opts.type ?? "text",
251
+ className: `${ui.input} ${detailErr(k) ? ui.inputInvalid : ""}`,
252
+ autoComplete: opts.auto,
253
+ value: details[k],
254
+ readOnly: opts.readOnly,
255
+ "aria-readonly": opts.readOnly || void 0,
256
+ "aria-required": "true",
257
+ "aria-invalid": !!detailErr(k),
258
+ "aria-describedby": detailErr(k) ? `${uid}-${k}-error` : void 0,
259
+ onChange: (e) => setDetail(k)(e.target.value),
260
+ onBlur: k === "email" ? lookupEmail : void 0
261
+ }),
262
+ detailErr(k) && /* @__PURE__ */ jsx("p", {
263
+ id: `${uid}-${k}-error`,
264
+ className: ui.fieldError,
265
+ children: detailErr(k)
266
+ })
267
+ ]
268
+ });
269
+ if (step === "payment") return /* @__PURE__ */ jsx("section", {
270
+ className: ui.section,
271
+ "aria-label": "Choose your registration",
272
+ children: /* @__PURE__ */ jsxs("div", {
273
+ className: "card-body gap-4",
274
+ children: [/* @__PURE__ */ jsx("h2", {
275
+ ref: headingRef,
276
+ tabIndex: -1,
277
+ className: "text-2xl outline-none",
278
+ children: "Choose your registration"
279
+ }), !clientSecret ? /* @__PURE__ */ jsxs(Fragment, { children: [
280
+ /* @__PURE__ */ jsxs("p", { children: [
281
+ "Registering: ",
282
+ details.fname,
283
+ " ",
284
+ details.lname,
285
+ " (",
286
+ details.email,
287
+ ")."
288
+ ] }),
289
+ /* @__PURE__ */ jsx(CatalogPicker, {
290
+ catalog,
291
+ selection,
292
+ onChange: setSelection,
293
+ onApplyCode: async (code) => (await reg.applyCode(code)).codeValid === true
294
+ }),
295
+ failure && /* @__PURE__ */ jsx("p", {
296
+ role: "alert",
297
+ className: ui.statusError,
298
+ children: failure
299
+ }),
300
+ /* @__PURE__ */ jsxs("div", {
301
+ className: "flex flex-wrap gap-2",
302
+ children: [/* @__PURE__ */ jsxs("button", {
303
+ type: "button",
304
+ className: "btn btn-primary",
305
+ disabled: busy || !selection.tierOfferId,
306
+ onClick: pay,
307
+ children: [busy && /* @__PURE__ */ jsx("span", {
308
+ className: "loading loading-spinner loading-sm",
309
+ "aria-hidden": "true"
310
+ }), "Continue to payment"]
311
+ }), /* @__PURE__ */ jsx("button", {
312
+ type: "button",
313
+ className: ui.secondary,
314
+ disabled: busy,
315
+ onClick: () => setStep("details"),
316
+ children: "Back to your details"
317
+ })]
318
+ })
319
+ ] }) : publishableKey && stripeAccount ? /* @__PURE__ */ jsx(CheckoutMount, {
320
+ publishableKey,
321
+ stripeAccount,
322
+ clientSecret
323
+ }) : /* @__PURE__ */ jsx(Notice, {
324
+ tone: "error",
325
+ title: "Payments are not available right now"
326
+ })]
327
+ })
328
+ });
329
+ const heading = "Your details";
330
+ return /* @__PURE__ */ jsx("form", {
331
+ onSubmit: next,
332
+ noValidate: true,
333
+ className: `${ui.section}`,
334
+ "aria-label": heading,
335
+ children: /* @__PURE__ */ jsxs("div", {
336
+ className: "card-body gap-5",
337
+ children: [
338
+ /* @__PURE__ */ jsx("h2", {
339
+ id: `${uid}-details-h`,
340
+ ref: headingRef,
341
+ tabIndex: -1,
342
+ className: "text-2xl outline-none",
343
+ children: heading
344
+ }),
345
+ problems.length > 0 && /* @__PURE__ */ jsx("div", {
346
+ ref: summaryRef,
347
+ tabIndex: -1,
348
+ role: "alert",
349
+ className: ui.statusError,
350
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
351
+ className: "font-semibold",
352
+ children: [
353
+ "Please fix ",
354
+ problems.length === 1 ? "this" : "these",
355
+ " before continuing:"
356
+ ]
357
+ }), /* @__PURE__ */ jsx("ul", {
358
+ className: "list-disc pl-5",
359
+ children: problems.map(([k, m]) => /* @__PURE__ */ jsx("li", { children: m }, k))
360
+ })] })
361
+ }),
362
+ signedIn && /* @__PURE__ */ jsxs("p", {
363
+ className: "text-sm text-base-content/80",
364
+ children: [
365
+ "Signed in as ",
366
+ reg.auth.user?.email,
367
+ ". Your profile is filled in below."
368
+ ]
369
+ }),
370
+ /* @__PURE__ */ jsxs("div", {
371
+ className: "grid gap-4 sm:grid-cols-2",
372
+ children: [textField("fname", "First name", { auto: "given-name" }), textField("lname", "Last name", { auto: "family-name" })]
373
+ }),
374
+ textField("email", "Email", {
375
+ type: "email",
376
+ auto: "email",
377
+ readOnly: signedIn && !!details.email
378
+ }),
379
+ emailHint === "account" && !signedIn && /* @__PURE__ */ jsx("div", {
380
+ role: "status",
381
+ className: ui.statusInfo,
382
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: "That email already has an account. Sign in to register; your details here stay filled in." }), /* @__PURE__ */ jsx("button", {
383
+ type: "button",
384
+ className: "btn btn-sm btn-primary mt-2",
385
+ onClick: () => auth.open("signin"),
386
+ children: "Sign in"
387
+ })] })
388
+ }),
389
+ textField("institution", "Institution", { auto: "organization" }),
390
+ askable.map((f) => /* @__PURE__ */ jsx(FieldInput, {
391
+ field: f,
392
+ value: values[f.id],
393
+ error: errors.values[f.id],
394
+ onChange: (v) => setValues((cur) => ({
395
+ ...cur,
396
+ [f.id]: v
397
+ }))
398
+ }, f.id)),
399
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
400
+ type: "submit",
401
+ className: "btn btn-primary",
402
+ children: "Continue to payment"
403
+ }) })
404
+ ]
405
+ })
406
+ });
407
+ }
408
+ /**
409
+ * Someone who is registered: what they have, and (if any are on sale) a way to add more add-ons. The suite
410
+ * takes the order for add-ons alone; their registration is not touched.
411
+ */
412
+ function Registered({ config, returnPath, membership, data, reg }) {
413
+ useId();
414
+ const { catalog } = data;
415
+ const formId = config.registrationFormId;
416
+ const paymentField = data.form?.schema?.find((f) => f.type === "payment");
417
+ const have = new Map(membership.addons.map((a) => [a.addonId, a.quantity]));
418
+ const open = catalog.addons.filter((a) => (have.get(a.id) ?? 0) < a.maxPerPerson && (a.remaining === null || a.remaining > 0));
419
+ const addonsCatalog = {
420
+ ...catalog,
421
+ tiers: [],
422
+ addons: open
423
+ };
424
+ const [selection, setSelection] = useState(emptySelection());
425
+ const [adding, setAdding] = useState(false);
426
+ const [busy, setBusy] = useState(false);
427
+ const [failure, setFailure] = useState(null);
428
+ const [clientSecret, setClientSecret] = useState(null);
429
+ async function pay() {
430
+ if (!formId || !paymentField) return;
431
+ setBusy(true);
432
+ setFailure(null);
433
+ try {
434
+ const details = {
435
+ fname: reg.profile?.fname ?? "",
436
+ lname: reg.profile?.lname ?? "",
437
+ email: reg.profile?.email ?? reg.auth.user?.email ?? "",
438
+ institution: reg.profile?.institution ?? ""
439
+ };
440
+ const { clientSecret: secret } = await reg.actions.checkout({
441
+ formId,
442
+ fieldId: paymentField.id,
443
+ selection,
444
+ details,
445
+ returnUrl: `${window.location.origin}${returnPath}?session_id={CHECKOUT_SESSION_ID}`
446
+ });
447
+ setClientSecret(secret);
448
+ } catch (e) {
449
+ setFailure(registrationMessage(e));
450
+ } finally {
451
+ setBusy(false);
452
+ }
453
+ }
454
+ return /* @__PURE__ */ jsx("section", {
455
+ className: ui.section,
456
+ "aria-label": "You're registered",
457
+ children: /* @__PURE__ */ jsxs("div", {
458
+ className: "card-body gap-4",
459
+ children: [
460
+ /* @__PURE__ */ jsx("h2", {
461
+ className: "text-2xl",
462
+ children: "You're registered"
463
+ }),
464
+ /* @__PURE__ */ jsxs("p", { children: [membership.tier_name ? `Your registration: ${membership.tier_name}.` : "We have your registration.", " There is nothing more to do; see you at the conference."] }),
465
+ membership.addons.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
466
+ className: ui.label,
467
+ children: "Your add-ons"
468
+ }), /* @__PURE__ */ jsx("ul", {
469
+ className: "list-disc pl-5",
470
+ children: membership.addons.map((a) => /* @__PURE__ */ jsxs("li", { children: [a.name, a.quantity > 1 ? ` × ${a.quantity}` : ""] }, a.addonId))
471
+ })] }),
472
+ open.length > 0 && !clientSecret && /* @__PURE__ */ jsx("div", {
473
+ className: "flex flex-col gap-3",
474
+ children: !adding ? /* @__PURE__ */ jsx("button", {
475
+ type: "button",
476
+ className: "btn btn-outline w-fit",
477
+ onClick: () => setAdding(true),
478
+ children: "Add to your registration"
479
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
480
+ /* @__PURE__ */ jsx(CatalogPicker, {
481
+ catalog: addonsCatalog,
482
+ selection,
483
+ onChange: setSelection,
484
+ addonsOnly: true
485
+ }),
486
+ failure && /* @__PURE__ */ jsx("p", {
487
+ role: "alert",
488
+ className: ui.statusError,
489
+ children: failure
490
+ }),
491
+ /* @__PURE__ */ jsxs("div", {
492
+ className: "flex flex-wrap gap-2",
493
+ children: [/* @__PURE__ */ jsxs("button", {
494
+ type: "button",
495
+ className: "btn btn-primary",
496
+ disabled: busy || !hasSelection(selection),
497
+ onClick: pay,
498
+ children: [busy && /* @__PURE__ */ jsx("span", {
499
+ className: "loading loading-spinner loading-sm",
500
+ "aria-hidden": "true"
501
+ }), "Continue to payment"]
502
+ }), /* @__PURE__ */ jsx("button", {
503
+ type: "button",
504
+ className: ui.secondary,
505
+ disabled: busy,
506
+ onClick: () => setAdding(false),
507
+ children: "Cancel"
508
+ })]
509
+ })
510
+ ] })
511
+ }),
512
+ clientSecret && catalog.publishableKey && catalog.stripeAccount && /* @__PURE__ */ jsx(CheckoutMount, {
513
+ publishableKey: catalog.publishableKey,
514
+ stripeAccount: catalog.stripeAccount,
515
+ clientSecret
516
+ })
517
+ ]
518
+ })
519
+ });
520
+ }
521
+ export { RegistrationForm };
522
+
523
+ //# sourceMappingURL=RegistrationForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegistrationForm.js","names":[],"sources":["../src/RegistrationForm.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { checkEmail } from \"@conferencesuite/core/auth/api\";\nimport { isAccountExists, registrationMessage } from \"@conferencesuite/core/registration/errors\";\nimport { emptySelection, hasSelection, type Selection } from \"@conferencesuite/core/registration/catalog\";\nimport { formatDay } from \"@conferencesuite/core/registration/options\";\nimport type { Details, FieldValue, FormField, Membership } from \"@conferencesuite/core/registration/types\";\nimport { type Errors, isAskable, isEmail, validateDetails, validateValues } from \"@conferencesuite/core/registration/validation\";\nimport type { SuiteConfig } from \"@conferencesuite/core/types\";\nimport { useAuth } from \"@conferencesuite/react/AuthProvider\";\nimport { type RegistrationData, useRegistration } from \"@conferencesuite/react/useRegistration\";\nimport { ui } from \"./classes\";\nimport { CatalogPicker } from \"./CatalogPicker\";\nimport { CheckoutMount } from \"./CheckoutMount\";\nimport { FieldInput } from \"./fields\";\n\nconst EMPTY: Details = { fname: \"\", lname: \"\", email: \"\", institution: \"\" };\n\ntype EmailHint = \"account\" | null;\n\nfunction Notice({ tone, title, children }: { tone: \"info\" | \"error\"; title: string; children?: React.ReactNode }) {\n return (\n <div role={tone === \"error\" ? \"alert\" : \"status\"} className={tone === \"error\" ? ui.statusError : ui.statusInfo}>\n <div>\n <p className=\"font-semibold\">{title}</p>\n {children && <div className=\"mt-1\">{children}</div>}\n </div>\n </div>\n );\n}\n\n/**\n * The registration form, rendered natively from the suite's `registration` form:\n * your details and the form's questions, then the registration tier and add-ons the\n * organizers sell, then Stripe's embedded checkout. Whether registration is open, full or already done for you is decided by\n * the suite (database guards); this only shows it.\n *\n * `returnPath` is where Stripe sends people back (a page rendering <PaymentStatus />).\n */\nexport function RegistrationForm({ config, returnPath = \"/register/status\" }: { config: SuiteConfig; returnPath?: string }) {\n const reg = useRegistration(config);\n const { load } = reg;\n\n if (!config.registrationFormId) {\n return <Notice tone=\"info\" title=\"Registration is not set up yet\" />;\n }\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 registration…\n </p>\n );\n }\n if (load.status === \"error\") {\n return (\n <Notice tone=\"error\" title=\"We couldn't load registration\">\n <p>{load.message}</p>\n <button type=\"button\" className=\"btn btn-sm mt-2\" onClick={reg.retry}>\n Try again\n </button>\n </Notice>\n );\n }\n\n const { state } = load;\n if (state.kind === \"opens_soon\") {\n return (\n <Notice tone=\"info\" title={state.startDate ? `Registration opens ${formatDay(state.startDate)}` : \"Registration opens soon\"}>\n <p>Check back then. Your answers aren&apos;t needed until it opens.</p>\n </Notice>\n );\n }\n if (state.kind === \"closed\") return <Notice tone=\"info\" title=\"Registration is closed\" />;\n if (state.kind === \"unavailable\") {\n return (\n <Notice tone=\"info\" title=\"Registration isn't available right now\">\n <p>Please check back soon.</p>\n </Notice>\n );\n }\n\n if (reg.membership?.registration_status === \"pending\") {\n return (\n <Notice tone=\"info\" title=\"Your payment is on its way\">\n <p>\n We have your {reg.membership.tier_name ? `${reg.membership.tier_name} ` : \"\"}registration, waiting for your bank transfer to arrive. Once it does, you&apos;re registered; there is\n nothing more to do here.\n </p>\n </Notice>\n );\n }\n if (reg.membership?.paid_this_cycle) {\n return <Registered config={config} returnPath={returnPath} membership={reg.membership} data={load} reg={reg} />;\n }\n if (!load.form || !load.form.schema?.some((f) => f.type === \"payment\")) {\n return (\n <Notice tone=\"info\" title=\"Registration isn't available right now\">\n <p>The registration form is being set up. Please check back soon.</p>\n </Notice>\n );\n }\n\n return <Flow config={config} returnPath={returnPath} data={load} formId={load.form.id} fields={load.form.schema} reg={reg} />;\n}\n\nfunction Flow({\n config,\n returnPath,\n data,\n formId,\n fields,\n reg,\n}: {\n config: SuiteConfig;\n returnPath: string;\n data: Extract<ReturnType<typeof useRegistration>[\"load\"], { status: \"ready\" }> & RegistrationData;\n formId: string;\n fields: FormField[];\n reg: ReturnType<typeof useRegistration>;\n}) {\n const auth = useAuth();\n const signedIn = !!reg.auth.user;\n const paymentField = fields.find((f) => f.type === \"payment\")!;\n const askable = useMemo(() => fields.filter(isAskable), [fields]);\n\n const [step, setStep] = useState<\"details\" | \"payment\">(\"details\");\n // A draft is what a person left when they went to Stripe and came back (client only: this mounts after load)\n const [draft] = useState(() => reg.actions.drafts.load(formId));\n const [edits, setEdits] = useState<Partial<Details>>({});\n const [values, setValues] = useState<Record<string, FieldValue>>(() => draft?.values ?? {});\n const [errors, setErrors] = useState<{ details: Errors; values: Errors }>({ details: {}, values: {} });\n const [selection, setSelection] = useState<Selection>(() => draft?.selection ?? emptySelection());\n const [busy, setBusy] = useState(false);\n const [failure, setFailure] = useState<string | null>(null);\n const [clientSecret, setClientSecret] = useState<string | null>(null);\n const [emailHint, setEmailHint] = useState<EmailHint>(null);\n const headingRef = useRef<HTMLHeadingElement>(null);\n const summaryRef = useRef<HTMLDivElement>(null);\n const uid = useId();\n\n // What the form shows: the draft, filled in from the member's profile where empty, then whatever they typed\n const profile = reg.profile;\n const details = useMemo<Details>(() => {\n const base = { ...EMPTY, ...draft?.details };\n if (profile) {\n base.fname ||= profile.fname ?? \"\";\n base.lname ||= profile.lname ?? \"\";\n base.institution ||= profile.institution ?? \"\";\n base.email = profile.email || base.email;\n }\n return { ...base, ...edits };\n }, [draft, profile, edits]);\n\n // Move focus to the new step's heading so keyboard and screen-reader users land on it\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n headingRef.current?.focus();\n }, [step]);\n\n const { catalog } = data;\n const stripeAccount = catalog.stripeAccount;\n const publishableKey = catalog.publishableKey;\n\n const setDetail = (k: keyof Details) => (v: string) => setEdits((e) => ({ ...e, [k]: v }));\n\n /** Does this email have an account? Then the suite refuses a guest registration: sign in first. */\n async function lookupEmail(): Promise<EmailHint> {\n if (signedIn || !isEmail(details.email)) {\n setEmailHint(null);\n return null;\n }\n const res = await checkEmail(config, details.email.trim());\n const hint: EmailHint = res.kind === \"registered\" || res.kind === \"other_org\" ? \"account\" : null;\n setEmailHint(hint);\n return hint;\n }\n\n async function next(e: React.FormEvent) {\n e.preventDefault();\n // Not only on blur: pressing Enter in the email field never blurs it\n const hint = signedIn ? null : await lookupEmail();\n const found = { details: validateDetails(details), values: validateValues(askable, values) };\n if (hint === \"account\") found.details.email = \"That email already has an account. Sign in to continue.\";\n setErrors(found);\n const messages = [...Object.values(found.details), ...Object.values(found.values)];\n if (messages.length > 0) {\n // Move focus to the summary, which lists what to fix\n requestAnimationFrame(() => summaryRef.current?.focus());\n return;\n }\n setFailure(null);\n setStep(\"payment\");\n }\n\n async function pay() {\n if (!selection.tierOfferId) {\n setFailure(\"Choose a registration option to continue.\");\n return;\n }\n setBusy(true);\n setFailure(null);\n try {\n reg.actions.drafts.save(formId, { details, values, selection });\n const { clientSecret: secret } = await reg.actions.checkout({\n formId,\n fieldId: paymentField.id,\n selection,\n details,\n returnUrl: `${window.location.origin}${returnPath}?session_id={CHECKOUT_SESSION_ID}`,\n });\n setClientSecret(secret);\n } catch (e) {\n // The email got an account since the details step: sign in, and the form stays filled in\n if (isAccountExists(e)) {\n setEmailHint(\"account\");\n setStep(\"details\");\n auth.open(\"signin\");\n }\n setFailure(registrationMessage(e));\n } finally {\n setBusy(false);\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 textField = (k: \"fname\" | \"lname\" | \"email\" | \"institution\", label: string, opts: { type?: string; auto: string; readOnly?: boolean }) => (\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\" ? 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 if (step === \"payment\") {\n return (\n <section className={ui.section} aria-label=\"Choose your registration\">\n <div className=\"card-body gap-4\">\n <h2 ref={headingRef} tabIndex={-1} className=\"text-2xl outline-none\">\n Choose your registration\n </h2>\n {!clientSecret ? (\n <>\n <p>\n Registering: {details.fname} {details.lname} ({details.email}).\n </p>\n <CatalogPicker\n catalog={catalog}\n selection={selection}\n onChange={setSelection}\n onApplyCode={async (code) => (await reg.applyCode(code)).codeValid === true}\n />\n {failure && (\n <p role=\"alert\" className={ui.statusError}>\n {failure}\n </p>\n )}\n <div className=\"flex flex-wrap gap-2\">\n <button type=\"button\" className=\"btn btn-primary\" disabled={busy || !selection.tierOfferId} onClick={pay}>\n {busy && <span className=\"loading loading-spinner loading-sm\" aria-hidden=\"true\" />}\n Continue to payment\n </button>\n <button type=\"button\" className={ui.secondary} disabled={busy} onClick={() => setStep(\"details\")}>\n Back to your details\n </button>\n </div>\n </>\n ) : publishableKey && stripeAccount ? (\n <CheckoutMount publishableKey={publishableKey} stripeAccount={stripeAccount} clientSecret={clientSecret} />\n ) : (\n <Notice tone=\"error\" title=\"Payments are not available right now\" />\n )}\n </div>\n </section>\n );\n }\n\n // The forms and sections here are named with aria-label (the heading's text), not aria-labelledby: see ProposalForm.\n const heading = \"Your details\";\n return (\n <form onSubmit={next} noValidate className={`${ui.section}`} aria-label={heading}>\n <div className=\"card-body gap-5\">\n <h2 id={`${uid}-details-h`} ref={headingRef} tabIndex={-1} className=\"text-2xl outline-none\">\n {heading}\n </h2>\n\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 continuing:</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\n {signedIn && <p className=\"text-sm text-base-content/80\">Signed in as {reg.auth.user?.email}. Your profile is filled in below.</p>}\n\n <div className=\"grid gap-4 sm:grid-cols-2\">\n {textField(\"fname\", \"First name\", { auto: \"given-name\" })}\n {textField(\"lname\", \"Last name\", { auto: \"family-name\" })}\n </div>\n {textField(\"email\", \"Email\", { type: \"email\", auto: \"email\", readOnly: signedIn && !!details.email })}\n\n {emailHint === \"account\" && !signedIn && (\n <div role=\"status\" className={ui.statusInfo}>\n <div>\n <p>That email already has an account. Sign in to register; your details here stay filled in.</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\n {textField(\"institution\", \"Institution\", { auto: \"organization\" })}\n\n {askable.map((f) => (\n <FieldInput key={f.id} field={f} value={values[f.id]} error={errors.values[f.id]} onChange={(v) => setValues((cur) => ({ ...cur, [f.id]: v }))} />\n ))}\n\n <div>\n <button type=\"submit\" className=\"btn btn-primary\">\n Continue to payment\n </button>\n </div>\n </div>\n </form>\n );\n}\n\n\n/**\n * Someone who is registered: what they have, and (if any are on sale) a way to add more add-ons. The suite\n * takes the order for add-ons alone; their registration is not touched.\n */\nfunction Registered({\n config,\n returnPath,\n membership,\n data,\n reg,\n}: {\n config: SuiteConfig;\n returnPath: string;\n membership: Membership;\n data: Extract<ReturnType<typeof useRegistration>[\"load\"], { status: \"ready\" }> & RegistrationData;\n reg: ReturnType<typeof useRegistration>;\n}) {\n const uid = useId();\n const { catalog } = data;\n const formId = config.registrationFormId;\n const paymentField = data.form?.schema?.find((f) => f.type === \"payment\");\n // Only add-ons they could still take: not at their limit, not sold out\n const have = new Map(membership.addons.map((a) => [a.addonId, a.quantity]));\n const open = catalog.addons.filter((a) => (have.get(a.id) ?? 0) < a.maxPerPerson && (a.remaining === null || a.remaining > 0));\n const addonsCatalog = { ...catalog, tiers: [], addons: open };\n const [selection, setSelection] = useState<Selection>(emptySelection());\n const [adding, setAdding] = useState(false);\n const [busy, setBusy] = useState(false);\n const [failure, setFailure] = useState<string | null>(null);\n const [clientSecret, setClientSecret] = useState<string | null>(null);\n\n async function pay() {\n if (!formId || !paymentField) return;\n setBusy(true);\n setFailure(null);\n try {\n const details = { fname: reg.profile?.fname ?? \"\", lname: reg.profile?.lname ?? \"\", email: reg.profile?.email ?? reg.auth.user?.email ?? \"\", institution: reg.profile?.institution ?? \"\" };\n const { clientSecret: secret } = await reg.actions.checkout({\n formId,\n fieldId: paymentField.id,\n selection,\n details,\n returnUrl: `${window.location.origin}${returnPath}?session_id={CHECKOUT_SESSION_ID}`,\n });\n setClientSecret(secret);\n } catch (e) {\n setFailure(registrationMessage(e));\n } finally {\n setBusy(false);\n }\n }\n\n return (\n <section className={ui.section} aria-label=\"You're registered\">\n <div className=\"card-body gap-4\">\n <h2 className=\"text-2xl\">\n You&apos;re registered\n </h2>\n <p>\n {membership.tier_name ? `Your registration: ${membership.tier_name}.` : \"We have your registration.\"} There is nothing more to do; see you at the conference.\n </p>\n {membership.addons.length > 0 && (\n <div>\n <p className={ui.label}>Your add-ons</p>\n <ul className=\"list-disc pl-5\">\n {membership.addons.map((a) => (\n <li key={a.addonId}>\n {a.name}\n {a.quantity > 1 ? ` × ${a.quantity}` : \"\"}\n </li>\n ))}\n </ul>\n </div>\n )}\n {open.length > 0 && !clientSecret && (\n <div className=\"flex flex-col gap-3\">\n {!adding ? (\n <button type=\"button\" className=\"btn btn-outline w-fit\" onClick={() => setAdding(true)}>\n Add to your registration\n </button>\n ) : (\n <>\n <CatalogPicker catalog={addonsCatalog} selection={selection} onChange={setSelection} addonsOnly />\n {failure && (\n <p role=\"alert\" className={ui.statusError}>\n {failure}\n </p>\n )}\n <div className=\"flex flex-wrap gap-2\">\n <button type=\"button\" className=\"btn btn-primary\" disabled={busy || !hasSelection(selection)} onClick={pay}>\n {busy && <span className=\"loading loading-spinner loading-sm\" aria-hidden=\"true\" />}\n Continue to payment\n </button>\n <button type=\"button\" className={ui.secondary} disabled={busy} onClick={() => setAdding(false)}>\n Cancel\n </button>\n </div>\n </>\n )}\n </div>\n )}\n {clientSecret && catalog.publishableKey && catalog.stripeAccount && (\n <CheckoutMount publishableKey={catalog.publishableKey} stripeAccount={catalog.stripeAccount} clientSecret={clientSecret} />\n )}\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,QAAiB;CAAE,OAAO;CAAI,OAAO;CAAI,OAAO;CAAI,aAAa;AAAG;AAI1E,SAAS,OAAO,EAAE,MAAM,OAAO,YAAmF;CAChH,OACE,oBAAC,OAAD;EAAK,MAAM,SAAS,UAAU,UAAU;EAAU,WAAW,SAAS,UAAU,GAAG,cAAc,GAAG;EAClG,UAAA,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,KAAD;GAAG,WAAU;GAAiB,UAAA;EAAS,CAAA,GACtC,YAAY,oBAAC,OAAD;GAAK,WAAU;GAAQ;EAAc,CAAA,CAC/C,EAAA,CAAA;CACF,CAAA;AAET;;;;;;;;;AAUA,SAAgB,iBAAiB,EAAE,QAAQ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AA,UAAA,CACG,EAAE,MACF,EAAE,WAAW,IAAI,MAAM,EAAE,aAAa,EACrC,EAAA,GAHK,EAAE,OAGP,CACL;IACC,CAAA,CACD,EAAA,CAAA;IAEN,KAAK,SAAS,KAAK,CAAC,gBACnB,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,CAAC,SACA,oBAAC,UAAD;MAAQ,MAAK;MAAS,WAAU;MAAwB,eAAe,UAAU,IAAI;MAAG,UAAA;KAEhF,CAAA,IAER,qBAAA,UAAA,EAAA,UAAA;MACE,oBAAC,eAAD;OAAe,SAAS;OAA0B;OAAW,UAAU;OAAc,YAAA;MAAY,CAAA;MAChG,WACC,oBAAC,KAAD;OAAG,MAAK;OAAQ,WAAW,GAAG;OAC3B,UAAA;MACA,CAAA;MAEL,qBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,qBAAC,UAAD;QAAQ,MAAK;QAAS,WAAU;QAAkB,UAAU,QAAQ,CAAC,aAAa,SAAS;QAAG,SAAS;QAAvG,UAAA,CACG,QAAQ,oBAAC,QAAD;SAAM,WAAU;SAAqC,eAAY;QAAQ,CAAA,GAAE,qBAE9E;OACR,CAAA,GAAA,oBAAC,UAAD;QAAQ,MAAK;QAAS,WAAW,GAAG;QAAW,UAAU;QAAM,eAAe,UAAU,KAAK;QAAG,UAAA;OAExF,CAAA,CACL;;KACL,EAAA,CAAA;IAED,CAAA;IAEN,gBAAgB,QAAQ,kBAAkB,QAAQ,iBACjD,oBAAC,eAAD;KAAe,gBAAgB,QAAQ;KAAgB,eAAe,QAAQ;KAA6B;IAAe,CAAA;GAEzH;;CACE,CAAA;AAEb"}
@@ -0,0 +1,5 @@
1
+ import { SuiteConfig } from "@conferencesuite/core/types";
2
+ /** A short badge for the schedule card: "Published" once the suite has published sessions, else "Coming soon". */
3
+ export declare function ScheduleBadge({ config: raw }: {
4
+ config: SuiteConfig;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ import { getSchedule } from "@conferencesuite/core/schedule/api";
4
+ import { useStableConfig } from "@conferencesuite/react/useStableConfig";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ // src/ScheduleBadge.tsx
7
+ /** A short badge for the schedule card: "Published" once the suite has published sessions, else "Coming soon". */
8
+ function ScheduleBadge({ config: raw }) {
9
+ const config = useStableConfig(raw);
10
+ const [published, setPublished] = useState(null);
11
+ useEffect(() => {
12
+ let alive = true;
13
+ getSchedule(config).then((r) => alive && setPublished(r.kind === "fresh" && r.schedule.sessions.length > 0)).catch(() => alive && setPublished(false));
14
+ return () => {
15
+ alive = false;
16
+ };
17
+ }, [config]);
18
+ return /* @__PURE__ */ jsx(Fragment, { children: published ? "Published" : "Coming soon" });
19
+ }
20
+ export { ScheduleBadge };
21
+
22
+ //# sourceMappingURL=ScheduleBadge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduleBadge.js","names":[],"sources":["../src/ScheduleBadge.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { getSchedule } from \"@conferencesuite/core/schedule/api\";\nimport type { SuiteConfig } from \"@conferencesuite/core/types\";\nimport { useStableConfig } from \"@conferencesuite/react/useStableConfig\";\n\n/** A short badge for the schedule card: \"Published\" once the suite has published sessions, else \"Coming soon\". */\nexport function ScheduleBadge({ config: raw }: { config: SuiteConfig }) {\n const config = useStableConfig(raw);\n const [published, setPublished] = useState<boolean | null>(null);\n useEffect(() => {\n let alive = true;\n getSchedule(config)\n .then((r) => alive && setPublished(r.kind === \"fresh\" && r.schedule.sessions.length > 0))\n .catch(() => alive && setPublished(false));\n return () => {\n alive = false;\n };\n }, [config]);\n return <>{published ? \"Published\" : \"Coming soon\"}</>;\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,cAAc,EAAE,QAAQ,OAAgC;CACtE,MAAM,SAAS,gBAAgB,GAAG;CAClC,MAAM,CAAC,WAAW,gBAAgB,SAAyB,IAAI;CAC/D,gBAAgB;EACd,IAAI,QAAQ;EACZ,YAAY,MAAM,CAAC,CAChB,MAAM,MAAM,SAAS,aAAa,EAAE,SAAS,WAAW,EAAE,SAAS,SAAS,SAAS,CAAC,CAAC,CAAC,CACxF,YAAY,SAAS,aAAa,KAAK,CAAC;EAC3C,aAAa;GACX,QAAQ;EACV;CACF,GAAG,CAAC,MAAM,CAAC;CACX,OAAO,oBAAA,UAAA,EAAA,UAAG,YAAY,cAAc,cAAgB,CAAA;AACtD"}
@@ -0,0 +1,10 @@
1
+ import { SuiteConfig } from "@conferencesuite/core/types";
2
+ /**
3
+ * The public schedule: day tabs, a rooms-by-time grid on wide screens and an agenda list on
4
+ * narrow ones, filters and search, a session dialog, a bookmarked "My schedule" that syncs when
5
+ * you're signed in, calendar feeds, and a clean print layout. Everything comes from the suite
6
+ * (`GET /api/schedule`); the org's theme arrives as --cs-* variables.
7
+ */
8
+ export declare function SchedulePage({ config }: {
9
+ config: SuiteConfig;
10
+ }): import("react").JSX.Element;