@burdenoff/microfe-eventfullymanaged 2026.1123.6 → 2026.1124.2

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 (92) hide show
  1. package/dist/eventfullymanaged/EventfullyManagedRoutes.js +58 -54
  2. package/dist/eventfullymanaged/EventfullyManagedRoutes.js.map +1 -1
  3. package/dist/eventfullymanaged/components/ActionMenu.js +19 -19
  4. package/dist/eventfullymanaged/components/EntityFormShell.js +9 -9
  5. package/dist/eventfullymanaged/components/EntityTagsField.js +13 -13
  6. package/dist/eventfullymanaged/components/EntityTagsField.js.map +1 -1
  7. package/dist/eventfullymanaged/components/ImageUploadField.js +5 -5
  8. package/dist/eventfullymanaged/components/Pagination.js +7 -7
  9. package/dist/eventfullymanaged/components/floorPlanEditor/ZonePanels.js +51 -51
  10. package/dist/eventfullymanaged/components/floorPlanEditor/ZonePanels.js.map +1 -1
  11. package/dist/eventfullymanaged/pages/certificates/CertificateAccess.d.ts +7 -0
  12. package/dist/eventfullymanaged/pages/certificates/CertificateAccess.js +29 -0
  13. package/dist/eventfullymanaged/pages/certificates/CertificateAccess.js.map +1 -0
  14. package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.d.ts +7 -0
  15. package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js +264 -0
  16. package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js.map +1 -0
  17. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.d.ts +4 -0
  18. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js +31 -0
  19. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js.map +1 -0
  20. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.d.ts +6 -0
  21. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js +76 -0
  22. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js.map +1 -0
  23. package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.d.ts +8 -0
  24. package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js +271 -0
  25. package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js.map +1 -0
  26. package/dist/eventfullymanaged/pages/certificates/CertificatesPage.d.ts +1 -0
  27. package/dist/eventfullymanaged/pages/certificates/CertificatesPage.js +121 -0
  28. package/dist/eventfullymanaged/pages/certificates/CertificatesPage.js.map +1 -0
  29. package/dist/eventfullymanaged/pages/dashboard/DashboardPage.js +26 -26
  30. package/dist/eventfullymanaged/pages/events/EventDetailPage.js +150 -148
  31. package/dist/eventfullymanaged/pages/events/EventDetailPage.js.map +1 -1
  32. package/dist/eventfullymanaged/pages/events/VirtualSessionPage.js +100 -100
  33. package/dist/eventfullymanaged/pages/events/VirtualSessionPage.js.map +1 -1
  34. package/dist/eventfullymanaged/pages/exhibitors/ExhibitorsPage.js +19 -19
  35. package/dist/eventfullymanaged/pages/exhibitors/ExhibitorsPage.js.map +1 -1
  36. package/dist/eventfullymanaged/pages/leads/LeadCaptureDialog.js +16 -16
  37. package/dist/eventfullymanaged/pages/leads/LeadCaptureDialog.js.map +1 -1
  38. package/dist/eventfullymanaged/pages/modules/AnalyticsPage.js +103 -103
  39. package/dist/eventfullymanaged/pages/modules/AnalyticsPage.js.map +1 -1
  40. package/dist/eventfullymanaged/pages/modules/AttendeeProfilePage.js +15 -15
  41. package/dist/eventfullymanaged/pages/modules/AttendeeRecommendations.js +12 -12
  42. package/dist/eventfullymanaged/pages/modules/AttendeeRecommendations.js.map +1 -1
  43. package/dist/eventfullymanaged/pages/modules/CommunicationPage.js +80 -80
  44. package/dist/eventfullymanaged/pages/modules/CommunicationPage.js.map +1 -1
  45. package/dist/eventfullymanaged/pages/modules/EventTemplatesSection.js +14 -14
  46. package/dist/eventfullymanaged/pages/modules/EventTemplatesSection.js.map +1 -1
  47. package/dist/eventfullymanaged/pages/modules/EventsPage.js +121 -121
  48. package/dist/eventfullymanaged/pages/modules/EventsPage.js.map +1 -1
  49. package/dist/eventfullymanaged/pages/modules/IntegrationsPage.js +57 -57
  50. package/dist/eventfullymanaged/pages/modules/IntegrationsPage.js.map +1 -1
  51. package/dist/eventfullymanaged/pages/modules/KioskPage.js +241 -241
  52. package/dist/eventfullymanaged/pages/modules/KioskPage.js.map +1 -1
  53. package/dist/eventfullymanaged/pages/modules/NetworkingPage.js +120 -120
  54. package/dist/eventfullymanaged/pages/modules/NetworkingPage.js.map +1 -1
  55. package/dist/eventfullymanaged/pages/modules/OperationsHubPage.js +17 -17
  56. package/dist/eventfullymanaged/pages/modules/OperationsHubPage.js.map +1 -1
  57. package/dist/eventfullymanaged/pages/modules/RegistrationPage.js +61 -61
  58. package/dist/eventfullymanaged/pages/modules/RegistrationPage.js.map +1 -1
  59. package/dist/eventfullymanaged/pages/modules/RoadmapPanel.js +23 -23
  60. package/dist/eventfullymanaged/pages/modules/RoadmapPanel.js.map +1 -1
  61. package/dist/eventfullymanaged/pages/modules/SponsorDetailsPage.js +17 -17
  62. package/dist/eventfullymanaged/pages/modules/SponsorDetailsPage.js.map +1 -1
  63. package/dist/eventfullymanaged/pages/modules/SponsorLeadsPage.js +11 -11
  64. package/dist/eventfullymanaged/pages/modules/VenueResourcesPage.js +13 -13
  65. package/dist/eventfullymanaged/pages/modules/WorkflowsPage.js +108 -108
  66. package/dist/eventfullymanaged/pages/modules/WorkflowsPage.js.map +1 -1
  67. package/dist/eventfullymanaged/pages/registration/PromoCodeFormPage.js +22 -22
  68. package/dist/eventfullymanaged/pages/registration/PromoCodeFormPage.js.map +1 -1
  69. package/dist/eventfullymanaged/pages/registration/RegisterAttendeePage.js +45 -45
  70. package/dist/eventfullymanaged/pages/speakers/SpeakersPage.js +24 -24
  71. package/dist/eventfullymanaged/pages/speakers/SpeakersPage.js.map +1 -1
  72. package/dist/eventfullymanaged/pages/sponsors/SponsorFormPage.js +37 -37
  73. package/dist/eventfullymanaged/pages/sponsors/SponsorsListPage.js +23 -23
  74. package/dist/eventfullymanaged/pages/sponsors/SponsorsListPage.js.map +1 -1
  75. package/dist/eventfullymanaged/pages/venues/FloorPlansPage.js +123 -123
  76. package/dist/eventfullymanaged/pages/venues/FloorPlansPage.js.map +1 -1
  77. package/dist/eventfullymanaged/pages/venues/VenueDetailPage.js +37 -37
  78. package/dist/eventfullymanaged/pages/venues/VenueDetailPage.js.map +1 -1
  79. package/dist/eventfullymanaged/pages/venues/VenueFormPage.js +25 -25
  80. package/dist/eventfullymanaged/pages/venues/VenueListPage.js +26 -26
  81. package/dist/eventfullymanaged/pages/venues/VenueListPage.js.map +1 -1
  82. package/dist/generated/wspace-operations.d.ts +468 -0
  83. package/dist/generated/wspace-operations.js +215 -11
  84. package/dist/generated/wspace-operations.js.map +1 -1
  85. package/dist/generated/wspace-types.d.ts +30060 -1503
  86. package/dist/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js +19 -0
  87. package/dist/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map +1 -0
  88. package/dist/node_modules/@apollo/client/react/hooks/useLazyQuery.js +110 -0
  89. package/dist/node_modules/@apollo/client/react/hooks/useLazyQuery.js.map +1 -0
  90. package/dist/utils/pageContext.js +5 -0
  91. package/dist/utils/pageContext.js.map +1 -1
  92. package/package.json +1 -1
@@ -0,0 +1,264 @@
1
+ import { useEventCertificateEligibilityLazyQuery as e, useEventCertificateReceiptLazyQuery as t, useEventCertificateRegistrationsQuery as n, useIssueEventCertificateMutation as r } from "../../../generated/wspace-operations.js";
2
+ import { useTr as i } from "../../../shared/hooks/useTr.js";
3
+ import { Pagination as a, usePagination as o } from "../../components/Pagination.js";
4
+ import { mutationSucceeded as s } from "../../lib/mutationResult.js";
5
+ import { notify as c } from "../../lib/toast.js";
6
+ import { formatDateTime as l } from "../events/eventFormUtils.js";
7
+ import { CertificatePdfDownload as u } from "./CertificatePdfDownload.js";
8
+ import { useId as d, useState as f } from "react";
9
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ import { Button as h, Input as g, Label as _ } from "@burdenoff/fe-libs/ui";
11
+ // src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx
12
+ var v = "min-h-10 w-full rounded-input border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus", y = "space-y-4 rounded-card border border-border-seam bg-bg-surface p-4";
13
+ function b({ eventId: t, templates: l }) {
14
+ let u = i(), g = d(), b = o(), S = n({
15
+ variables: {
16
+ eventId: t,
17
+ limit: b.limit,
18
+ offset: b.offset
19
+ },
20
+ fetchPolicy: "no-cache"
21
+ }), w = S.data?.eventfullyManagedRegistrations, [T, E] = f(""), [D, O] = f(""), [k, A] = f(null), [j, M] = f(null), [N, { loading: P }] = e({ fetchPolicy: "no-cache" }), [F, { loading: I }] = r(), L = l.find((e) => e.id === D), R = w?.items.find((e) => e.id === T), z = JSON.stringify([
22
+ R?.id,
23
+ L?.id,
24
+ L?.revision,
25
+ L?.requiredSessionIds
26
+ ]), B = k?.key === z ? k.result : void 0, V = P || I, H = u("eventfullymanaged.certificates.issuanceError", "Could not confirm certificate issuance"), U = async () => {
27
+ if (L && R && !V) {
28
+ A(null);
29
+ try {
30
+ let e = await N({ variables: {
31
+ eventId: t,
32
+ registrationId: R.id,
33
+ requiredSessionIds: L.requiredSessionIds
34
+ } });
35
+ if (e.error || !e.data?.eventfullyManagedCertificateEligibility) throw Error("Eligibility not confirmed");
36
+ A({
37
+ key: z,
38
+ result: e.data.eventfullyManagedCertificateEligibility
39
+ });
40
+ } catch {
41
+ c.error(u("eventfullymanaged.certificates.eligibilityError", "Could not confirm attendance eligibility"));
42
+ }
43
+ }
44
+ };
45
+ return /* @__PURE__ */ p("form", {
46
+ className: y,
47
+ onSubmit: async (e) => {
48
+ if (e.preventDefault(), L && R && B?.eligible && !V) try {
49
+ let e = await F({ variables: {
50
+ eventId: t,
51
+ registrationId: R.id,
52
+ templateId: L.id
53
+ } }), n = e.data?.eventfullyManagedIssueCertificate;
54
+ if (!s(e, n?.id, H) || !n) return;
55
+ M(n);
56
+ } catch {
57
+ c.error(H);
58
+ }
59
+ },
60
+ children: /* @__PURE__ */ m("fieldset", {
61
+ disabled: V,
62
+ className: "space-y-4",
63
+ children: [
64
+ /* @__PURE__ */ p("legend", {
65
+ className: "mb-3 text-lg font-semibold",
66
+ children: u("eventfullymanaged.certificates.manualIssue", "Issue a certificate")
67
+ }),
68
+ /* @__PURE__ */ m("div", {
69
+ className: "space-y-1.5",
70
+ children: [/* @__PURE__ */ p(_, {
71
+ id: g + "templateLabel",
72
+ htmlFor: g + "template",
73
+ children: u("eventfullymanaged.certificates.template", "Certificate template")
74
+ }), /* @__PURE__ */ m("select", {
75
+ id: g + "template",
76
+ "aria-labelledby": g + "templateLabel",
77
+ className: v,
78
+ value: L?.id ?? "",
79
+ onChange: (e) => {
80
+ O(e.target.value), A(null);
81
+ },
82
+ children: [/* @__PURE__ */ p("option", {
83
+ value: "",
84
+ children: u("eventfullymanaged.certificates.chooseTemplate", "Choose a template")
85
+ }), l.map((e) => /* @__PURE__ */ p("option", {
86
+ value: e.id,
87
+ children: e.title
88
+ }, e.id))]
89
+ })]
90
+ }),
91
+ /* @__PURE__ */ m("div", {
92
+ className: "space-y-1.5",
93
+ children: [/* @__PURE__ */ p(_, {
94
+ id: g + "registrationLabel",
95
+ htmlFor: g + "registration",
96
+ children: u("eventfullymanaged.certificates.registration", "Attendee registration")
97
+ }), /* @__PURE__ */ m("select", {
98
+ id: g + "registration",
99
+ "aria-labelledby": g + "registrationLabel",
100
+ className: v,
101
+ value: R?.id ?? "",
102
+ onChange: (e) => {
103
+ E(e.target.value), A(null);
104
+ },
105
+ children: [/* @__PURE__ */ p("option", {
106
+ value: "",
107
+ children: u("eventfullymanaged.certificates.chooseRegistration", "Choose a registration")
108
+ }), w?.items.map((e) => /* @__PURE__ */ m("option", {
109
+ value: e.id,
110
+ children: [
111
+ e.attendeeName || e.id,
112
+ " · ",
113
+ e.status
114
+ ]
115
+ }, e.id))]
116
+ })]
117
+ }),
118
+ S.error ? /* @__PURE__ */ m("p", {
119
+ role: "alert",
120
+ className: "text-sm text-status-error-text",
121
+ children: [
122
+ u("eventfullymanaged.certificates.registrationsError", "Could not load registrations."),
123
+ " ",
124
+ /* @__PURE__ */ p(h, {
125
+ type: "button",
126
+ variant: "outline",
127
+ onClick: () => void S.refetch().catch(() => void 0),
128
+ children: u("eventfullymanaged.certificates.retry", "Retry")
129
+ })
130
+ ]
131
+ }) : null,
132
+ w ? /* @__PURE__ */ p(a, {
133
+ offset: b.offset,
134
+ limit: b.limit,
135
+ total: w.total,
136
+ loadedCount: w.items.length,
137
+ onPrev: b.prevPage,
138
+ onNext: b.nextPage,
139
+ loading: S.loading,
140
+ itemLabel: "registrations"
141
+ }) : null,
142
+ /* @__PURE__ */ m("div", {
143
+ className: "flex flex-wrap gap-2",
144
+ children: [/* @__PURE__ */ p(h, {
145
+ type: "button",
146
+ variant: "outline",
147
+ disabled: !L || !R,
148
+ onClick: () => void U(),
149
+ children: P ? u("eventfullymanaged.certificates.checking", "Checking…") : u("eventfullymanaged.certificates.checkEligibility", "Check eligibility")
150
+ }), /* @__PURE__ */ p(h, {
151
+ type: "submit",
152
+ disabled: !B?.eligible,
153
+ children: I ? u("eventfullymanaged.certificates.issuing", "Issuing…") : u("eventfullymanaged.certificates.issue", "Issue certificate")
154
+ })]
155
+ }),
156
+ /* @__PURE__ */ p(x, { eligibility: B }),
157
+ /* @__PURE__ */ p(C, {
158
+ eventId: t,
159
+ receipt: j
160
+ })
161
+ ]
162
+ })
163
+ });
164
+ }
165
+ function x({ eligibility: e }) {
166
+ let t = i();
167
+ return e ? e.eligible ? /* @__PURE__ */ p("p", {
168
+ className: "text-sm",
169
+ "aria-live": "polite",
170
+ children: t("eventfullymanaged.certificates.eligible", "Eligible for this certificate.")
171
+ }) : /* @__PURE__ */ p("p", {
172
+ className: "text-sm",
173
+ "aria-live": "polite",
174
+ children: e.registrationEligible ? t("eventfullymanaged.certificates.sessionsIneligible", "Required sessions without completed attendance: {{count}}.", { count: e.missingSessionIds.length }) : t("eventfullymanaged.certificates.registrationIneligible", "The registration must be confirmed or checked in.")
175
+ }) : null;
176
+ }
177
+ function S({ eventId: e }) {
178
+ let n = i(), r = d(), [a, o] = f(null), [s, { loading: l }] = t({ fetchPolicy: "no-cache" });
179
+ return /* @__PURE__ */ m("section", {
180
+ className: y,
181
+ "aria-labelledby": r + "receiptHeading",
182
+ children: [
183
+ /* @__PURE__ */ p("h2", {
184
+ id: r + "receiptHeading",
185
+ className: "text-lg font-semibold",
186
+ children: n("eventfullymanaged.certificates.issuedReceipt", "Issuance receipt")
187
+ }),
188
+ /* @__PURE__ */ m("form", {
189
+ className: "space-y-2",
190
+ onSubmit: async (t) => {
191
+ t.preventDefault();
192
+ let r = String(new FormData(t.currentTarget).get("receiptId") ?? "").trim();
193
+ if (r && !l) {
194
+ o(null);
195
+ try {
196
+ let t = await s({ variables: {
197
+ eventId: e,
198
+ id: r
199
+ } });
200
+ if (t.error || !t.data?.eventfullyManagedCertificate) throw Error("Receipt not confirmed");
201
+ o(t.data.eventfullyManagedCertificate);
202
+ } catch {
203
+ c.error(n("eventfullymanaged.certificates.receiptError", "Could not find that receipt for this event"));
204
+ }
205
+ }
206
+ },
207
+ children: [/* @__PURE__ */ p(_, {
208
+ htmlFor: r + "receipt",
209
+ children: n("eventfullymanaged.certificates.receiptId", "Receipt ID")
210
+ }), /* @__PURE__ */ m("div", {
211
+ className: "flex flex-wrap items-center gap-2",
212
+ children: [/* @__PURE__ */ p(g, {
213
+ id: r + "receipt",
214
+ name: "receiptId",
215
+ className: "flex-1",
216
+ maxLength: 128,
217
+ required: !0
218
+ }), /* @__PURE__ */ p(h, {
219
+ type: "submit",
220
+ variant: "outline",
221
+ disabled: l,
222
+ children: l ? n("eventfullymanaged.certificates.finding", "Looking up…") : n("eventfullymanaged.certificates.find", "Find receipt")
223
+ })]
224
+ })]
225
+ }),
226
+ /* @__PURE__ */ p(C, {
227
+ eventId: e,
228
+ receipt: a
229
+ })
230
+ ]
231
+ });
232
+ }
233
+ function C({ eventId: e, receipt: t }) {
234
+ let n = i();
235
+ return t ? /* @__PURE__ */ m("div", {
236
+ "aria-live": "polite",
237
+ className: "space-y-2 rounded-card border border-border-seam p-3 text-sm",
238
+ children: [
239
+ /* @__PURE__ */ p("h3", {
240
+ className: "font-medium break-words",
241
+ children: t.title
242
+ }),
243
+ /* @__PURE__ */ p("p", { children: n("eventfullymanaged.certificates.receiptIssuedAt", "Issued {{date}}", { date: l(t.issuedAt) }) }),
244
+ /* @__PURE__ */ p("p", { children: n("eventfullymanaged.certificates.receiptTemplateRevision", "Template revision {{revision}}", { revision: t.templateRevision }) }),
245
+ /* @__PURE__ */ p("p", {
246
+ className: "break-all text-text-secondary",
247
+ children: t.id
248
+ }),
249
+ /* @__PURE__ */ p(u, {
250
+ eventId: e,
251
+ receiptId: t.id
252
+ })
253
+ ]
254
+ }) : null;
255
+ }
256
+ function w(e) {
257
+ return /* @__PURE__ */ m("div", {
258
+ className: "grid gap-4 lg:grid-cols-2",
259
+ children: [/* @__PURE__ */ p(b, { ...e }), /* @__PURE__ */ p(S, { eventId: e.eventId })]
260
+ });
261
+ }
262
+ export { w as CertificateIssuance };
263
+
264
+ //# sourceMappingURL=CertificateIssuance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CertificateIssuance.js","names":["selectClass","cardClass","CertificateIssueForm","tr","useTr","id","useId","paging","usePagination","registrations","useEventCertificateRegistrationsQuery","registrationPage","registrationId","setRegistrationId","useState","templateId","setTemplateId","checked","setChecked","receipt","setReceipt","readEligibility","checking","useEventCertificateEligibilityLazyQuery","issueCertificate","issuing","useIssueEventCertificateMutation","template","templates","item","registration","checkKey","eligibility","busy","issueError","check","result","event","issued","mutationSucceeded","Label","Button","Pagination","AttendanceOutcome","CertificateReceiptDetails","CertificateReceiptLookup","findReceipt","finding","useEventCertificateReceiptLazyQuery","receiptId","Input","formatDateTime","CertificatePdfDownload","CertificateIssuance","props"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx"],"sourcesContent":["import { useId, useState, type FormEvent } from 'react';\nimport { Button, Input, Label } from '@burdenoff/fe-libs/ui';\nimport {\n useEventCertificateEligibilityLazyQuery,\n useEventCertificateReceiptLazyQuery,\n useEventCertificateRegistrationsQuery,\n useIssueEventCertificateMutation,\n type EventCertificateEligibilityQuery,\n type EventCertificateReceiptFieldsFragment,\n type EventCertificateRegistrationsQuery,\n type EventCertificateTemplateFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { Pagination, usePagination } from '../../components/Pagination';\nimport { mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\nimport { CertificatePdfDownload } from './CertificatePdfDownload';\n\nconst selectClass =\n 'min-h-10 w-full rounded-input border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus';\nconst cardClass = 'space-y-4 rounded-card border border-border-seam bg-bg-surface p-4';\n\ntype Eligibility = EventCertificateEligibilityQuery['eventfullyManagedCertificateEligibility'];\ntype Receipt = EventCertificateReceiptFieldsFragment;\n\ntype IssuanceProps = {\n eventId: string;\n templates: EventCertificateTemplateFieldsFragment[];\n};\n\nfunction CertificateIssueForm({ eventId, templates }: IssuanceProps) {\n const tr = useTr();\n const id = useId();\n const paging = usePagination();\n const registrations = useEventCertificateRegistrationsQuery({\n variables: { eventId, limit: paging.limit, offset: paging.offset },\n fetchPolicy: 'no-cache',\n });\n const registrationPage: EventCertificateRegistrationsQuery['eventfullyManagedRegistrations'] | undefined =\n registrations.data?.eventfullyManagedRegistrations;\n const [registrationId, setRegistrationId] = useState('');\n const [templateId, setTemplateId] = useState('');\n const [checked, setChecked] = useState<{ key: string; result: Eligibility } | null>(null);\n const [receipt, setReceipt] = useState<Receipt | null>(null);\n const [readEligibility, { loading: checking }] = useEventCertificateEligibilityLazyQuery({ fetchPolicy: 'no-cache' });\n const [issueCertificate, { loading: issuing }] = useIssueEventCertificateMutation();\n const template = templates.find((item) => item.id === templateId);\n const registration = registrationPage?.items.find((item) => item.id === registrationId);\n const checkKey = JSON.stringify([registration?.id, template?.id, template?.revision, template?.requiredSessionIds]);\n const eligibility = checked?.key === checkKey ? checked.result : undefined;\n const busy = checking || issuing;\n const issueError = tr('eventfullymanaged.certificates.issuanceError', 'Could not confirm certificate issuance');\n\n const check = async () => {\n if (!template || !registration || busy) return;\n setChecked(null);\n try {\n const result = await readEligibility({\n variables: { eventId, registrationId: registration.id, requiredSessionIds: template.requiredSessionIds },\n });\n if (result.error || !result.data?.eventfullyManagedCertificateEligibility)\n throw new Error('Eligibility not confirmed');\n setChecked({ key: checkKey, result: result.data.eventfullyManagedCertificateEligibility });\n } catch {\n notify.error(tr('eventfullymanaged.certificates.eligibilityError', 'Could not confirm attendance eligibility'));\n }\n };\n\n const issue = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!template || !registration || !eligibility?.eligible || busy) return;\n try {\n const result = await issueCertificate({\n variables: { eventId, registrationId: registration.id, templateId: template.id },\n });\n const issued = result.data?.eventfullyManagedIssueCertificate;\n if (!mutationSucceeded(result, issued?.id, issueError) || !issued) return;\n setReceipt(issued);\n } catch {\n notify.error(issueError);\n }\n };\n\n return (\n <form className={cardClass} onSubmit={issue}>\n <fieldset disabled={busy} className=\"space-y-4\">\n <legend className=\"mb-3 text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.manualIssue', 'Issue a certificate')}\n </legend>\n <div className=\"space-y-1.5\">\n <Label id={id + 'templateLabel'} htmlFor={id + 'template'}>\n {tr('eventfullymanaged.certificates.template', 'Certificate template')}\n </Label>\n <select\n id={id + 'template'}\n aria-labelledby={id + 'templateLabel'}\n className={selectClass}\n value={template?.id ?? ''}\n onChange={(event) => {\n setTemplateId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseTemplate', 'Choose a template')}</option>\n {templates.map((item) => (\n <option key={item.id} value={item.id}>\n {item.title}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-1.5\">\n <Label id={id + 'registrationLabel'} htmlFor={id + 'registration'}>\n {tr('eventfullymanaged.certificates.registration', 'Attendee registration')}\n </Label>\n <select\n id={id + 'registration'}\n aria-labelledby={id + 'registrationLabel'}\n className={selectClass}\n value={registration?.id ?? ''}\n onChange={(event) => {\n setRegistrationId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseRegistration', 'Choose a registration')}</option>\n {registrationPage?.items.map((item) => (\n <option key={item.id} value={item.id}>\n {item.attendeeName || item.id} · {item.status}\n </option>\n ))}\n </select>\n </div>\n {registrations.error ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {tr('eventfullymanaged.certificates.registrationsError', 'Could not load registrations.')}{' '}\n <Button type=\"button\" variant=\"outline\" onClick={() => void registrations.refetch().catch(() => undefined)}>\n {tr('eventfullymanaged.certificates.retry', 'Retry')}\n </Button>\n </p>\n ) : null}\n {registrationPage ? (\n <Pagination\n offset={paging.offset}\n limit={paging.limit}\n total={registrationPage.total}\n loadedCount={registrationPage.items.length}\n onPrev={paging.prevPage}\n onNext={paging.nextPage}\n loading={registrations.loading}\n itemLabel=\"registrations\"\n />\n ) : null}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={!template || !registration} onClick={() => void check()}>\n {checking\n ? tr('eventfullymanaged.certificates.checking', 'Checking…')\n : tr('eventfullymanaged.certificates.checkEligibility', 'Check eligibility')}\n </Button>\n <Button type=\"submit\" disabled={!eligibility?.eligible}>\n {issuing\n ? tr('eventfullymanaged.certificates.issuing', 'Issuing…')\n : tr('eventfullymanaged.certificates.issue', 'Issue certificate')}\n </Button>\n </div>\n <AttendanceOutcome eligibility={eligibility} />\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </fieldset>\n </form>\n );\n}\n\nfunction AttendanceOutcome({ eligibility }: { eligibility?: Eligibility }) {\n const tr = useTr();\n if (!eligibility) return null;\n if (eligibility.eligible) {\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {tr('eventfullymanaged.certificates.eligible', 'Eligible for this certificate.')}\n </p>\n );\n }\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {!eligibility.registrationEligible\n ? tr(\n 'eventfullymanaged.certificates.registrationIneligible',\n 'The registration must be confirmed or checked in.'\n )\n : tr(\n 'eventfullymanaged.certificates.sessionsIneligible',\n 'Required sessions without completed attendance: {{count}}.',\n {\n count: eligibility.missingSessionIds.length,\n }\n )}\n </p>\n );\n}\n\nfunction CertificateReceiptLookup({ eventId }: { eventId: string }) {\n const tr = useTr();\n const id = useId();\n const [receipt, setReceipt] = useState<Receipt | null>(null);\n const [findReceipt, { loading: finding }] = useEventCertificateReceiptLazyQuery({ fetchPolicy: 'no-cache' });\n\n const lookup = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const receiptId = String(new FormData(event.currentTarget).get('receiptId') ?? '').trim();\n if (!receiptId || finding) return;\n setReceipt(null);\n try {\n const result = await findReceipt({ variables: { eventId, id: receiptId } });\n if (result.error || !result.data?.eventfullyManagedCertificate) throw new Error('Receipt not confirmed');\n setReceipt(result.data.eventfullyManagedCertificate);\n } catch {\n notify.error(tr('eventfullymanaged.certificates.receiptError', 'Could not find that receipt for this event'));\n }\n };\n\n return (\n <section className={cardClass} aria-labelledby={id + 'receiptHeading'}>\n <h2 id={id + 'receiptHeading'} className=\"text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.issuedReceipt', 'Issuance receipt')}\n </h2>\n <form className=\"space-y-2\" onSubmit={lookup}>\n <Label htmlFor={id + 'receipt'}>{tr('eventfullymanaged.certificates.receiptId', 'Receipt ID')}</Label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Input id={id + 'receipt'} name=\"receiptId\" className=\"flex-1\" maxLength={128} required />\n <Button type=\"submit\" variant=\"outline\" disabled={finding}>\n {finding\n ? tr('eventfullymanaged.certificates.finding', 'Looking up…')\n : tr('eventfullymanaged.certificates.find', 'Find receipt')}\n </Button>\n </div>\n </form>\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </section>\n );\n}\n\nfunction CertificateReceiptDetails({ eventId, receipt }: { eventId: string; receipt: Receipt | null }) {\n const tr = useTr();\n if (!receipt) return null;\n return (\n <div aria-live=\"polite\" className=\"space-y-2 rounded-card border border-border-seam p-3 text-sm\">\n <h3 className=\"font-medium break-words\">{receipt.title}</h3>\n <p>\n {tr('eventfullymanaged.certificates.receiptIssuedAt', 'Issued {{date}}', {\n date: formatDateTime(receipt.issuedAt),\n })}\n </p>\n <p>\n {tr('eventfullymanaged.certificates.receiptTemplateRevision', 'Template revision {{revision}}', {\n revision: receipt.templateRevision,\n })}\n </p>\n <p className=\"break-all text-text-secondary\">{receipt.id}</p>\n <CertificatePdfDownload eventId={eventId} receiptId={receipt.id} />\n </div>\n );\n}\n\nexport function CertificateIssuance(props: IssuanceProps) {\n return (\n <div className=\"grid gap-4 lg:grid-cols-2\">\n <CertificateIssueForm {...props} />\n <CertificateReceiptLookup eventId={props.eventId} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAmBA,IAAMA,IACJ,gMACIC,IAAY;AAUlB,SAASC,EAAqB,EAAE,YAAS,gBAA4B;CACnE,IAAMC,IAAKC,EAAM,GACXC,IAAKC,EAAM,GACXC,IAASC,EAAc,GACvBC,IAAgBC,EAAsC;EAC1D,WAAW;GAAE;GAAS,OAAOH,EAAO;GAAO,QAAQA,EAAO;EAAO;EACjE,aAAa;CACf,CAAC,GACKI,IACJF,EAAc,MAAM,gCAChB,CAACG,GAAgBC,KAAqBC,EAAS,EAAE,GACjD,CAACC,GAAYC,KAAiBF,EAAS,EAAE,GACzC,CAACG,GAASC,KAAcJ,EAAsD,IAAI,GAClF,CAACK,GAASC,KAAcN,EAAyB,IAAI,GACrD,CAACO,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IAAK;MAAW,MAAK;MAAY,WAAU;MAAS,WAAW;MAAK,UAAA;KAAU,CAAA,GACzF,kBAACoC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,UAAUM;MAC/C,UAAAA,IACG5C,EAAG,0CAA0C,aAAa,IAC1DA,EAAG,uCAAuC,cAAc;KACtD,CAAA,CACL;IACD,CAAA,CAAA;;GACN,kBAACyC,GAAD;IAAoC;IAAkB;GAAU,CAAA;EACzD;;AAEb;AAEA,SAASA,EAA0B,EAAE,YAAS,cAAyD;CACrG,IAAMzC,IAAKC,EAAM;CAEjB,OADKe,IAEH,kBAAC,OAAD;EAAK,aAAU;EAAS,WAAU;EAAlC,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAA2B,UAAAA,EAAQ;GAAU,CAAA;GAC3D,kBAAC,KAAD,EAAA,UACGhB,EAAG,kDAAkD,mBAAmB,EACvE,MAAMgD,EAAehC,EAAQ,QAAQ,EACvC,CAAC,EACA,CAAA;GACH,kBAAC,KAAD,EAAA,UACGhB,EAAG,0DAA0D,kCAAkC,EAC9F,UAAUgB,EAAQ,iBACpB,CAAC,EACA,CAAA;GACH,kBAAC,KAAD;IAAG,WAAU;IAAiC,UAAAA,EAAQ;GAAM,CAAA;GAC5D,kBAACiC,GAAD;IAAiC;IAAS,WAAWjC,EAAQ;GAAK,CAAA;EAC/D;C,KAhBc;AAkBvB;AAEA,SAAgBkC,EAAoB,GAAsB;CACxD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACnD,GAAD,EAAsB,GAAIoD,EAAQ,CAAA,GAClC,kBAACT,GAAD,EAA0B,SAASS,EAAM,QAAU,CAAA,CAChD;;AAET"}
@@ -0,0 +1,4 @@
1
+ export declare function CertificatePdfDownload({ eventId, receiptId }: {
2
+ eventId: string;
3
+ receiptId: string;
4
+ }): import('react').JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { useEventCertificatePdfLazyQuery as e } from "../../../generated/wspace-operations.js";
2
+ import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import { downloadBase64Pdf as n } from "../../api/eventApi.js";
4
+ import { notify as r } from "../../lib/toast.js";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { Button as a } from "@burdenoff/fe-libs/ui";
7
+ // src/eventfullymanaged/pages/certificates/CertificatePdfDownload.tsx
8
+ function o({ eventId: o, receiptId: s }) {
9
+ let c = t(), [l, { loading: u }] = e({ fetchPolicy: "no-cache" }), d = async () => {
10
+ if (!u) try {
11
+ let e = await l({ variables: {
12
+ eventId: o,
13
+ id: s
14
+ } }), t = e.data?.eventfullyManagedCertificatePdf;
15
+ if (e.error || t?.contentType !== "application/pdf" || !t.contentBase64.startsWith("JVBERi0") || !/^certificate-[a-z0-9-]+\.pdf$/i.test(t.filename)) throw Error("Certificate PDF was not confirmed.");
16
+ n(t.contentBase64, t.filename);
17
+ } catch {
18
+ r.error(c("eventfullymanaged.certificates.pdfError", "Could not download the certificate PDF."));
19
+ }
20
+ };
21
+ return /* @__PURE__ */ i(a, {
22
+ type: "button",
23
+ variant: "outline",
24
+ disabled: u,
25
+ onClick: () => void d(),
26
+ children: u ? c("eventfullymanaged.certificates.pdfLoading", "Preparing PDF…") : c("eventfullymanaged.certificates.pdfDownload", "Download PDF")
27
+ });
28
+ }
29
+ export { o as CertificatePdfDownload };
30
+
31
+ //# sourceMappingURL=CertificatePdfDownload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CertificatePdfDownload.js","names":["CertificatePdfDownload","tr","useTr","readPdf","useEventCertificatePdfLazyQuery","download","response","receiptId","pdf","Button","loading"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificatePdfDownload.tsx"],"sourcesContent":["import { Button } from '@burdenoff/fe-libs/ui';\nimport { useEventCertificatePdfLazyQuery } from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { downloadBase64Pdf } from '../../api/eventApi';\nimport { notify } from '../../lib/toast';\n\nexport function CertificatePdfDownload({ eventId, receiptId }: { eventId: string; receiptId: string }) {\n const tr = useTr();\n const [readPdf, { loading }] = useEventCertificatePdfLazyQuery({ fetchPolicy: 'no-cache' });\n const download = async () => {\n if (loading) return;\n try {\n const response = await readPdf({ variables: { eventId, id: receiptId } });\n const pdf = response.data?.eventfullyManagedCertificatePdf;\n if (\n response.error ||\n pdf?.contentType !== 'application/pdf' ||\n !pdf.contentBase64.startsWith('JVBERi0') ||\n !/^certificate-[a-z0-9-]+\\.pdf$/i.test(pdf.filename)\n ) {\n throw new Error('Certificate PDF was not confirmed.');\n }\n downloadBase64Pdf(pdf.contentBase64, pdf.filename);\n } catch {\n notify.error(tr('eventfullymanaged.certificates.pdfError', 'Could not download the certificate PDF.'));\n }\n };\n\n return (\n <Button type=\"button\" variant=\"outline\" disabled={loading} onClick={() => void download()}>\n {loading\n ? tr('eventfullymanaged.certificates.pdfLoading', 'Preparing PDF…')\n : tr('eventfullymanaged.certificates.pdfDownload', 'Download PDF')}\n </Button>\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgBA,EAAuB,EAAE,YAAS,gBAAqD;CACrG,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAS,EAAE,gBAAaC,EAAgC,EAAE,aAAa,WAAW,CAAC,GACpFC,IAAW,YAAY;EAC3B,IAAI,IACJ,IAAI;GACF,IAAMC,IAAW,MAAMH,EAAQ,EAAE,WAAW;IAAE;IAAS,IAAII;GAAU,EAAE,CAAC,GAClEC,IAAMF,EAAS,MAAM;GAC3B,IACEA,EAAS,SACTE,GAAK,gBAAgB,qBACrB,CAACA,EAAI,cAAc,WAAW,SAAS,KACvC,CAAC,iCAAiC,KAAKA,EAAI,QAAQ,GAEnD,MAAU,MAAM,oCAAoC;GAEtD,EAAkBA,EAAI,eAAeA,EAAI,QAAQ;EACnD,QAAQ;GACN,EAAO,MAAMP,EAAG,2CAA2C,yCAAyC,CAAC;EACvG;CACF;CAEA,OACE,kBAACQ,GAAD;EAAQ,MAAK;EAAS,SAAQ;EAAU,UAAUC;EAAS,eAAe,KAAKL,EAAS;EACrF,UAAAK,IACGT,EAAG,6CAA6C,gBAAgB,IAChEA,EAAG,8CAA8C,cAAc;CAC7D,CAAA;AAEZ"}
@@ -0,0 +1,6 @@
1
+ import { EventCertificateTemplateFieldsFragment } from '../../../generated/wspace-operations';
2
+ export declare function CertificateScheduleDialog({ eventId, template, onClose, }: {
3
+ eventId: string;
4
+ template: EventCertificateTemplateFieldsFragment;
5
+ onClose: () => void;
6
+ }): import('react').JSX.Element;
@@ -0,0 +1,76 @@
1
+ import { useScheduleEventCertificateIssuanceMutation as e } from "../../../generated/wspace-operations.js";
2
+ import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import { mutationSucceeded as n } from "../../lib/mutationResult.js";
4
+ import { notify as r } from "../../lib/toast.js";
5
+ import { formatDateTime as i } from "../events/eventFormUtils.js";
6
+ import { useState as a } from "react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { Button as c, Dialog as l, DialogContent as u, DialogDescription as d, DialogHeader as f, DialogTitle as p } from "@burdenoff/fe-libs/ui";
9
+ // src/eventfullymanaged/pages/certificates/CertificateScheduleDialog.tsx
10
+ function m({ eventId: i, template: m, onClose: g }) {
11
+ let _ = t(), [v, { loading: y }] = e(), [b, x] = a(null), S = _("eventfullymanaged.certificates.scheduleError", "Could not schedule certificate issuance"), C = async () => {
12
+ if (!(y || b)) try {
13
+ let e = await v({ variables: {
14
+ eventId: i,
15
+ templateId: m.id,
16
+ templateRevision: m.revision
17
+ } }), t = e.data?.eventfullyManagedScheduleCertificateIssuance;
18
+ n(e, t?.id, S) && t && x(t);
19
+ } catch {
20
+ r.error(S);
21
+ }
22
+ };
23
+ return /* @__PURE__ */ o(l, {
24
+ open: !0,
25
+ onOpenChange: (e) => {
26
+ !e && !y && g();
27
+ },
28
+ children: /* @__PURE__ */ s(u, { children: [
29
+ /* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: _("eventfullymanaged.certificates.schedule", "Schedule automatic issuance") }), /* @__PURE__ */ o(d, { children: _("eventfullymanaged.certificates.scheduleHelp", "Schedule this template revision to issue certificates after the last required session ends.") })] }),
30
+ /* @__PURE__ */ s("p", {
31
+ className: "break-words font-medium",
32
+ children: [
33
+ m.title,
34
+ " ·",
35
+ " ",
36
+ _("eventfullymanaged.certificates.revision", "Revision {{revision}}", { revision: m.revision })
37
+ ]
38
+ }),
39
+ b ? /* @__PURE__ */ o(h, { run: b }) : null,
40
+ /* @__PURE__ */ s("div", {
41
+ className: "flex flex-wrap justify-end gap-2",
42
+ children: [/* @__PURE__ */ o(c, {
43
+ type: "button",
44
+ variant: "outline",
45
+ disabled: y,
46
+ onClick: g,
47
+ children: b ? _("eventfullymanaged.certificates.done", "Done") : _("eventfullymanaged.certificates.cancel", "Cancel")
48
+ }), b ? null : /* @__PURE__ */ o(c, {
49
+ type: "button",
50
+ disabled: y,
51
+ onClick: () => void C(),
52
+ children: y ? _("eventfullymanaged.certificates.scheduling", "Scheduling…") : _("eventfullymanaged.certificates.scheduleConfirm", "Schedule issuance")
53
+ })]
54
+ })
55
+ ] })
56
+ });
57
+ }
58
+ function h({ run: e }) {
59
+ let n = t();
60
+ return /* @__PURE__ */ s("div", {
61
+ className: "space-y-1 rounded-card border border-border-seam p-3 text-sm",
62
+ role: "status",
63
+ children: [
64
+ /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.scheduleStatus", "Run status: {{status}}", { status: e.status }) }),
65
+ e.status === "pending" ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.nextAttempt", "Next attempt: {{date}}", { date: i(e.nextAttemptAt) }) }) : null,
66
+ e.completedAt ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.runFinished", "Finished: {{date}}", { date: i(e.completedAt) }) }) : null,
67
+ /* @__PURE__ */ o("p", {
68
+ className: "break-all text-text-secondary",
69
+ children: e.id
70
+ })
71
+ ]
72
+ });
73
+ }
74
+ export { m as CertificateScheduleDialog };
75
+
76
+ //# sourceMappingURL=CertificateScheduleDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CertificateScheduleDialog.js","names":["CertificateScheduleDialog","tr","useTr","schedule","useScheduleEventCertificateIssuanceMutation","run","setRun","useState","scheduleError","submit","result","template","scheduled","mutationSucceeded","Dialog","open","loading","onClose","DialogContent","DialogHeader","DialogTitle","DialogDescription","ScheduleReceipt","Button","formatDateTime"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateScheduleDialog.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@burdenoff/fe-libs/ui';\nimport {\n useScheduleEventCertificateIssuanceMutation,\n type EventCertificateTemplateFieldsFragment,\n type ScheduleEventCertificateIssuanceMutation,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\n\ntype ScheduleRun = ScheduleEventCertificateIssuanceMutation['eventfullyManagedScheduleCertificateIssuance'];\n\nexport function CertificateScheduleDialog({\n eventId,\n template,\n onClose,\n}: {\n eventId: string;\n template: EventCertificateTemplateFieldsFragment;\n onClose: () => void;\n}) {\n const tr = useTr();\n const [schedule, { loading }] = useScheduleEventCertificateIssuanceMutation();\n const [run, setRun] = useState<ScheduleRun | null>(null);\n const scheduleError = tr('eventfullymanaged.certificates.scheduleError', 'Could not schedule certificate issuance');\n\n const submit = async () => {\n if (loading || run) return;\n try {\n const result = await schedule({\n variables: { eventId, templateId: template.id, templateRevision: template.revision },\n });\n const scheduled = result.data?.eventfullyManagedScheduleCertificateIssuance;\n if (mutationSucceeded(result, scheduled?.id, scheduleError) && scheduled) setRun(scheduled);\n } catch {\n notify.error(scheduleError);\n }\n };\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !loading) onClose();\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{tr('eventfullymanaged.certificates.schedule', 'Schedule automatic issuance')}</DialogTitle>\n <DialogDescription>\n {tr(\n 'eventfullymanaged.certificates.scheduleHelp',\n 'Schedule this template revision to issue certificates after the last required session ends.'\n )}\n </DialogDescription>\n </DialogHeader>\n <p className=\"break-words font-medium\">\n {template.title} ·{' '}\n {tr('eventfullymanaged.certificates.revision', 'Revision {{revision}}', {\n revision: template.revision,\n })}\n </p>\n {run ? <ScheduleReceipt run={run} /> : null}\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={loading} onClick={onClose}>\n {run\n ? tr('eventfullymanaged.certificates.done', 'Done')\n : tr('eventfullymanaged.certificates.cancel', 'Cancel')}\n </Button>\n {run ? null : (\n <Button type=\"button\" disabled={loading} onClick={() => void submit()}>\n {loading\n ? tr('eventfullymanaged.certificates.scheduling', 'Scheduling…')\n : tr('eventfullymanaged.certificates.scheduleConfirm', 'Schedule issuance')}\n </Button>\n )}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ScheduleReceipt({ run }: { run: ScheduleRun }) {\n const tr = useTr();\n return (\n <div className=\"space-y-1 rounded-card border border-border-seam p-3 text-sm\" role=\"status\">\n <p>{tr('eventfullymanaged.certificates.scheduleStatus', 'Run status: {{status}}', { status: run.status })}</p>\n {run.status === 'pending' ? (\n <p>\n {tr('eventfullymanaged.certificates.nextAttempt', 'Next attempt: {{date}}', {\n date: formatDateTime(run.nextAttemptAt),\n })}\n </p>\n ) : null}\n {run.completedAt ? (\n <p>\n {tr('eventfullymanaged.certificates.runFinished', 'Finished: {{date}}', {\n date: formatDateTime(run.completedAt),\n })}\n </p>\n ) : null}\n <p className=\"break-all text-text-secondary\">{run.id}</p>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgBA,EAA0B,EACxC,YACA,aACA,cAKC;CACD,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAU,EAAE,gBAAaC,EAA4C,G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DAAkD,mBAAmB;IACtE,CAAA,CAEP;;EACQ,EAAA,CAAA;CACT,CAAA;AAEZ;AAEA,SAASqB,EAAgB,EAAE,UAA6B;CACtD,IAAMrB,IAAKC,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAU;EAA+D,MAAK;EAAnF,UAAA;GACE,kBAAC,KAAD,EAAA,UAAID,EAAG,iDAAiD,0BAA0B,EAAE,QAAQI,EAAI,OAAO,CAAC,EAAK,CAAA;GAC5GA,EAAI,WAAW,YACd,kBAAC,KAAD,EAAA,UACGJ,EAAG,8CAA8C,0BAA0B,EAC1E,MAAMuB,EAAenB,EAAI,aAAa,EACxC,CAAC,EACA,CAAA,IACD;GACHA,EAAI,cACH,kBAAC,KAAD,EAAA,UACGJ,EAAG,8CAA8C,sBAAsB,EACtE,MAAMuB,EAAenB,EAAI,WAAW,EACtC,CAAC,EACA,CAAA,IACD;GACJ,kBAAC,KAAD;IAAG,WAAU;IAAiC,UAAAA,EAAI;GAAM,CAAA;EACrD;;AAET"}
@@ -0,0 +1,8 @@
1
+ import { EventCertificateTemplateFieldsFragment } from '../../../generated/wspace-operations';
2
+ type Template = EventCertificateTemplateFieldsFragment;
3
+ export declare function CertificateTemplates({ eventId, templates, onChange, }: {
4
+ eventId: string;
5
+ templates: Template[];
6
+ onChange: () => void;
7
+ }): import('react').JSX.Element;
8
+ export {};