@burdenoff/microfe-eventfullymanaged 2026.1124.1 → 2026.1124.3

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 (25) hide show
  1. package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.d.ts +6 -0
  2. package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js +141 -0
  3. package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js.map +1 -0
  4. package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js +143 -111
  5. package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js.map +1 -1
  6. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.d.ts +4 -0
  7. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js +31 -0
  8. package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js.map +1 -0
  9. package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.d.ts +8 -0
  10. package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js +43 -0
  11. package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js.map +1 -0
  12. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.d.ts +6 -0
  13. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js +86 -0
  14. package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js.map +1 -0
  15. package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js +71 -60
  16. package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js.map +1 -1
  17. package/dist/generated/wspace-operations.d.ts +240 -0
  18. package/dist/generated/wspace-operations.js +133 -30
  19. package/dist/generated/wspace-operations.js.map +1 -1
  20. package/dist/generated/wspace-types.d.ts +651 -6
  21. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +23 -0
  22. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
  23. package/dist/node_modules/@apollo/client/errors/utils.js +15 -0
  24. package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
  25. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ type DeliveryScope = {
2
+ eventId: string;
3
+ certificateId: string;
4
+ };
5
+ export declare function CertificateEmailControls({ eventId, certificateId }: DeliveryScope): import('react').JSX.Element;
6
+ export {};
@@ -0,0 +1,141 @@
1
+ import { CombinedGraphQLErrors as e } from "../../../node_modules/@apollo/client/errors/CombinedGraphQLErrors.js";
2
+ import { useEventLatestCertificateEmailQuery as t, useQueueEventCertificateEmailMutation as n } from "../../../generated/wspace-operations.js";
3
+ import { useTr as r } from "../../../shared/hooks/useTr.js";
4
+ import { notify as i } from "../../lib/toast.js";
5
+ import { formatDateTime as a } from "../events/eventFormUtils.js";
6
+ import { useRef as o, useState as s } from "react";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ import { Button as d, Dialog as f, DialogContent as p, DialogDescription as m, DialogHeader as h, DialogTitle as g } from "@burdenoff/fe-libs/ui";
9
+ // src/eventfullymanaged/pages/certificates/CertificateEmailControls.tsx
10
+ function _({ eventId: e, certificateId: n }) {
11
+ let a = r(), [o, c] = s(null), f = t({
12
+ variables: {
13
+ eventId: e,
14
+ certificateId: n
15
+ },
16
+ fetchPolicy: "no-cache",
17
+ notifyOnNetworkStatusChange: !0
18
+ }), p = o ?? f.data?.eventfullyManagedLatestCertificateEmailDelivery ?? null, m = async () => {
19
+ try {
20
+ let e = await f.refetch();
21
+ if (e.error || !e.data) throw Error("Email status was not confirmed.");
22
+ c(null);
23
+ } catch {
24
+ i.error(a("eventfullymanaged.certificates.emailStatusError", "Could not refresh the certificate email status."));
25
+ }
26
+ };
27
+ return /* @__PURE__ */ u("section", {
28
+ className: "space-y-2 border-t border-border-seam pt-3",
29
+ children: [
30
+ /* @__PURE__ */ l("h4", {
31
+ className: "font-medium",
32
+ children: a("eventfullymanaged.certificates.emailTitle", "Certificate email")
33
+ }),
34
+ p ? /* @__PURE__ */ l(v, { delivery: p }) : null,
35
+ f.loading ? /* @__PURE__ */ l("p", {
36
+ role: "status",
37
+ children: a("eventfullymanaged.certificates.emailStatusLoading", "Checking email status…")
38
+ }) : null,
39
+ f.error ? /* @__PURE__ */ l("p", {
40
+ role: "alert",
41
+ className: "text-status-error-text",
42
+ children: a("eventfullymanaged.certificates.emailStatusError", "Could not refresh the certificate email status.")
43
+ }) : null,
44
+ /* @__PURE__ */ u("div", {
45
+ className: "flex flex-wrap gap-2",
46
+ children: [/* @__PURE__ */ l(y, {
47
+ eventId: e,
48
+ certificateId: n,
49
+ previous: p,
50
+ disabled: f.loading || !!f.error,
51
+ onQueued: c
52
+ }), /* @__PURE__ */ l(d, {
53
+ type: "button",
54
+ variant: "outline",
55
+ disabled: f.loading,
56
+ onClick: () => void m(),
57
+ children: a("eventfullymanaged.certificates.emailRefresh", "Refresh email status")
58
+ })]
59
+ })
60
+ ]
61
+ });
62
+ }
63
+ function v({ delivery: e }) {
64
+ let t = r();
65
+ return /* @__PURE__ */ u("div", {
66
+ className: "space-y-1 text-sm",
67
+ "aria-live": "polite",
68
+ children: [
69
+ /* @__PURE__ */ l("p", { children: t("eventfullymanaged.certificates.emailStatus", "Request status: {{status}}", { status: e.status }) }),
70
+ e.channelStatus ? /* @__PURE__ */ l("p", { children: t("eventfullymanaged.certificates.emailChannelStatus", "Email provider status: {{status}}", { status: e.channelStatus }) }) : null,
71
+ /* @__PURE__ */ l("p", { children: t("eventfullymanaged.certificates.emailRequestedAt", "Requested {{date}}", { date: a(e.createdAt) }) })
72
+ ]
73
+ });
74
+ }
75
+ function y({ eventId: t, certificateId: i, previous: a, disabled: _, onQueued: v }) {
76
+ let y = r(), [b, x] = s(!1), [S, C] = s(), w = o(null), [T, { loading: E }] = n({ refetchQueries: ["EventLatestCertificateEmail"] }), D = a?.status === "pending" || a?.status === "submitting", O = a ? y("eventfullymanaged.certificates.emailResend", "Re-send certificate email") : y("eventfullymanaged.certificates.emailSend", "Email certificate"), k = () => {
77
+ w.current?.previousDeliveryId !== (a?.id ?? null) && (w.current = null, C(void 0)), x(!0);
78
+ }, A = async () => {
79
+ if (!(E || D || _)) {
80
+ C(void 0);
81
+ try {
82
+ w.current ??= {
83
+ id: crypto.randomUUID(),
84
+ previousDeliveryId: a?.id ?? null
85
+ };
86
+ let e = await T({ variables: {
87
+ eventId: t,
88
+ certificateId: i,
89
+ requestId: w.current.id
90
+ } }), n = e.data?.eventfullyManagedQueueCertificateEmail;
91
+ if (e.error) throw e.error;
92
+ if (!n?.id) throw Error("Email request was not confirmed.");
93
+ w.current = null, v(n), x(!1);
94
+ } catch (t) {
95
+ let n = e.is(t) && t.errors.some(({ extensions: e }) => e?.code === "CONFLICT");
96
+ C(n ? y("eventfullymanaged.certificates.emailBindingError", "The original attendee binding is unavailable for this receipt. Download the PDF from the receipt.") : y("eventfullymanaged.certificates.emailQueueError", "Could not confirm the email request. Retry the same request."));
97
+ }
98
+ }
99
+ };
100
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(d, {
101
+ type: "button",
102
+ disabled: _ || D,
103
+ onClick: k,
104
+ children: O
105
+ }), /* @__PURE__ */ l(f, {
106
+ open: b,
107
+ onOpenChange: (e) => {
108
+ E || x(e);
109
+ },
110
+ children: /* @__PURE__ */ u(p, { children: [
111
+ /* @__PURE__ */ u(h, { children: [/* @__PURE__ */ l(g, { children: O }), /* @__PURE__ */ l(m, { children: y("eventfullymanaged.certificates.emailHelp", "Queue the issued PDF for the email address on the attendee registration.") })] }),
112
+ a?.status === "unknown" ? /* @__PURE__ */ l("p", {
113
+ className: "text-sm",
114
+ children: y("eventfullymanaged.certificates.emailUnknown", "The previous request has no confirmed outcome. A second request may send another copy.")
115
+ }) : null,
116
+ S ? /* @__PURE__ */ l("p", {
117
+ role: "alert",
118
+ className: "text-status-error-text",
119
+ children: S
120
+ }) : null,
121
+ /* @__PURE__ */ u("div", {
122
+ className: "flex flex-wrap justify-end gap-2",
123
+ children: [/* @__PURE__ */ l(d, {
124
+ type: "button",
125
+ variant: "outline",
126
+ disabled: E,
127
+ onClick: () => x(!1),
128
+ children: y("eventfullymanaged.certificates.cancel", "Cancel")
129
+ }), /* @__PURE__ */ l(d, {
130
+ type: "button",
131
+ disabled: E || _ || D,
132
+ onClick: () => void A(),
133
+ children: E ? y("eventfullymanaged.certificates.emailQueueing", "Queueing…") : y("eventfullymanaged.certificates.emailConfirm", "Queue email")
134
+ })]
135
+ })
136
+ ] })
137
+ })] });
138
+ }
139
+ export { _ as CertificateEmailControls };
140
+
141
+ //# sourceMappingURL=CertificateEmailControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CertificateEmailControls.js","names":["_Fragment","CertificateEmailControls","tr","useTr","queued","setQueued","useState","latest","useEventLatestCertificateEmailQuery","delivery","refresh","result","CertificateEmailStatus","CertificateEmailRequest","Button","formatDateTime","open","setOpen","errorMessage","setErrorMessage","request","useRef","queue","useQueueEventCertificateEmailMutation","sending","previous","label","openConfirmation","submit","disabled","onQueued","error","missingBinding","CombinedGraphQLErrors","extensions","Fragment","Dialog","loading","next","DialogContent","DialogHeader","DialogTitle","DialogDescription"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateEmailControls.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { CombinedGraphQLErrors } from '@apollo/client/errors';\nimport { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@burdenoff/fe-libs/ui';\nimport {\n useEventLatestCertificateEmailQuery,\n useQueueEventCertificateEmailMutation,\n type EventCertificateEmailFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\n\ntype Delivery = EventCertificateEmailFieldsFragment;\ntype DeliveryScope = { eventId: string; certificateId: string };\n\nexport function CertificateEmailControls({ eventId, certificateId }: DeliveryScope) {\n const tr = useTr();\n const [queued, setQueued] = useState<Delivery | null>(null);\n const latest = useEventLatestCertificateEmailQuery({\n variables: { eventId, certificateId },\n fetchPolicy: 'no-cache',\n notifyOnNetworkStatusChange: true,\n });\n const delivery: Delivery | null = queued ?? latest.data?.eventfullyManagedLatestCertificateEmailDelivery ?? null;\n\n const refresh = async () => {\n try {\n const result = await latest.refetch();\n if (result.error || !result.data) throw new Error('Email status was not confirmed.');\n setQueued(null);\n } catch {\n notify.error(\n tr('eventfullymanaged.certificates.emailStatusError', 'Could not refresh the certificate email status.')\n );\n }\n };\n\n return (\n <section className=\"space-y-2 border-t border-border-seam pt-3\">\n <h4 className=\"font-medium\">{tr('eventfullymanaged.certificates.emailTitle', 'Certificate email')}</h4>\n {delivery ? <CertificateEmailStatus delivery={delivery} /> : null}\n {latest.loading ? (\n <p role=\"status\">{tr('eventfullymanaged.certificates.emailStatusLoading', 'Checking email status…')}</p>\n ) : null}\n {latest.error ? (\n <p role=\"alert\" className=\"text-status-error-text\">\n {tr('eventfullymanaged.certificates.emailStatusError', 'Could not refresh the certificate email status.')}\n </p>\n ) : null}\n <div className=\"flex flex-wrap gap-2\">\n <CertificateEmailRequest\n eventId={eventId}\n certificateId={certificateId}\n previous={delivery}\n disabled={latest.loading || Boolean(latest.error)}\n onQueued={setQueued}\n />\n <Button type=\"button\" variant=\"outline\" disabled={latest.loading} onClick={() => void refresh()}>\n {tr('eventfullymanaged.certificates.emailRefresh', 'Refresh email status')}\n </Button>\n </div>\n </section>\n );\n}\n\nfunction CertificateEmailStatus({ delivery }: { delivery: Delivery }) {\n const tr = useTr();\n return (\n <div className=\"space-y-1 text-sm\" aria-live=\"polite\">\n <p>\n {tr('eventfullymanaged.certificates.emailStatus', 'Request status: {{status}}', { status: delivery.status })}\n </p>\n {delivery.channelStatus ? (\n <p>\n {tr('eventfullymanaged.certificates.emailChannelStatus', 'Email provider status: {{status}}', {\n status: delivery.channelStatus,\n })}\n </p>\n ) : null}\n <p>\n {tr('eventfullymanaged.certificates.emailRequestedAt', 'Requested {{date}}', {\n date: formatDateTime(delivery.createdAt),\n })}\n </p>\n </div>\n );\n}\n\nfunction CertificateEmailRequest({\n eventId,\n certificateId,\n previous,\n disabled,\n onQueued,\n}: DeliveryScope & {\n previous: Delivery | null;\n disabled: boolean;\n onQueued: (delivery: Delivery) => void;\n}) {\n const tr = useTr();\n const [open, setOpen] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string>();\n const request = useRef<{ id: string; previousDeliveryId: string | null } | null>(null);\n const [queue, { loading }] = useQueueEventCertificateEmailMutation({\n refetchQueries: ['EventLatestCertificateEmail'],\n });\n const sending = previous?.status === 'pending' || previous?.status === 'submitting';\n const label = previous\n ? tr('eventfullymanaged.certificates.emailResend', 'Re-send certificate email')\n : tr('eventfullymanaged.certificates.emailSend', 'Email certificate');\n\n const openConfirmation = () => {\n if (request.current?.previousDeliveryId !== (previous?.id ?? null)) {\n request.current = null;\n setErrorMessage(undefined);\n }\n setOpen(true);\n };\n\n const submit = async () => {\n if (loading || sending || disabled) return;\n setErrorMessage(undefined);\n try {\n request.current ??= { id: crypto.randomUUID(), previousDeliveryId: previous?.id ?? null };\n const result = await queue({ variables: { eventId, certificateId, requestId: request.current.id } });\n const delivery = result.data?.eventfullyManagedQueueCertificateEmail;\n if (result.error) throw result.error;\n if (!delivery?.id) throw new Error('Email request was not confirmed.');\n request.current = null;\n onQueued(delivery);\n setOpen(false);\n } catch (error) {\n const missingBinding =\n CombinedGraphQLErrors.is(error) && error.errors.some(({ extensions }) => extensions?.code === 'CONFLICT');\n setErrorMessage(\n missingBinding\n ? tr(\n 'eventfullymanaged.certificates.emailBindingError',\n 'The original attendee binding is unavailable for this receipt. Download the PDF from the receipt.'\n )\n : tr(\n 'eventfullymanaged.certificates.emailQueueError',\n 'Could not confirm the email request. Retry the same request.'\n )\n );\n }\n };\n\n return (\n <>\n <Button type=\"button\" disabled={disabled || sending} onClick={openConfirmation}>\n {label}\n </Button>\n <Dialog\n open={open}\n onOpenChange={(next) => {\n if (!loading) setOpen(next);\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{label}</DialogTitle>\n <DialogDescription>\n {tr(\n 'eventfullymanaged.certificates.emailHelp',\n 'Queue the issued PDF for the email address on the attendee registration.'\n )}\n </DialogDescription>\n </DialogHeader>\n {previous?.status === 'unknown' ? (\n <p className=\"text-sm\">\n {tr(\n 'eventfullymanaged.certificates.emailUnknown',\n 'The previous request has no confirmed outcome. A second request may send another copy.'\n )}\n </p>\n ) : null}\n {errorMessage ? (\n <p role=\"alert\" className=\"text-status-error-text\">\n {errorMessage}\n </p>\n ) : null}\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={loading} onClick={() => setOpen(false)}>\n {tr('eventfullymanaged.certificates.cancel', 'Cancel')}\n </Button>\n <Button type=\"button\" disabled={loading || disabled || sending} onClick={() => void submit()}>\n {loading\n ? tr('eventfullymanaged.certificates.emailQueueing', 'Queueing…')\n : tr('eventfullymanaged.certificates.emailConfirm', 'Queue email')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgBC,EAAyB,EAAE,YAAS,oBAAgC;CAClF,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAA0B,IAAI,GACpDC,IAASC,EAAoC;EACjD,WAAW;GAAE;GAAS;EAAc;EACpC,aAAa;EACb,6BAA6B;CAC/B,CAAC,GACKC,IAA4BL,KAAUG,EAAO,MAAM,mDAAmD,MAEtGG,IAAU,YAAY;EAC1B,IAAI;GACF,IAAMC,IAAS,MAAMJ,EAAO,QAAQ;GACpC,IAAII,EAAO,SAAS,CAACA,EAAO,MAAM,MAAU,MAAM,iCAAiC;GACnF,EAAU,IAAI;EAChB,QAAQ;GACN,EAAO,MACLT,EAAG,mDAAmD,iDAAiD,CACzG;EACF;CACF;CAEA,OACE,kBAAC,WAAD;EAAS,WAAU;EAAnB,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAAe,UAAAA,E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A,UAAA;GACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAcf,EAAmB,CAAA,GACjC,kBAACgB,GAAD,EAAA,UACGxC,EACC,4CACA,0EACF,EACiB,CAAA,CACP,EAAA,CAAA;GACbuB,GAAU,WAAW,YACpB,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAvB,EACC,+CACA,wFACF;GACC,CAAA,IACD;GACHgB,IACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;IACvB,UAAAA;GACA,CAAA,IACD;GACJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACJ,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,UAAUuB;KAAS,eAAepB,EAAQ,EAAK;KACpF,UAAAf,EAAG,yCAAyC,QAAQ;IAC/C,CAAA,GACR,kBAACY,GAAD;KAAQ,MAAK;KAAS,UAAUuB,KAAWR,KAAYL;KAAS,eAAe,KAAKI,EAAO;KACxF,UAAAS,IACGnC,EAAG,gDAAgD,WAAW,IAC9DA,EAAG,+CAA+C,aAAa;IAC7D,CAAA,CACL;;EACQ,EAAA,CAAA;CACT,CAAA,CACR,EAAA,CAAA;AAEN"}
@@ -4,107 +4,113 @@ import { Pagination as a, usePagination as o } from "../../components/Pagination
4
4
  import { mutationSucceeded as s } from "../../lib/mutationResult.js";
5
5
  import { notify as c } from "../../lib/toast.js";
6
6
  import { formatDateTime as l } from "../events/eventFormUtils.js";
7
- import { useId as u, useState as d } from "react";
8
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
- import { Button as m, Input as h, Label as g } from "@burdenoff/fe-libs/ui";
7
+ import { CertificatePdfDownload as u } from "./CertificatePdfDownload.js";
8
+ import { CertificateEmailControls as d } from "./CertificateEmailControls.js";
9
+ import { CertificateReceiptSearch as f } from "./CertificateReceiptSearch.js";
10
+ import { useId as p, useState as m } from "react";
11
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ import { Button as _, Input as v, Label as y } from "@burdenoff/fe-libs/ui";
10
13
  // src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx
11
- var _ = "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", v = "space-y-4 rounded-card border border-border-seam bg-bg-surface p-4";
12
- function y({ eventId: t, templates: l }) {
13
- let h = i(), y = u(), x = o(), C = n({
14
+ var b = "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", x = "space-y-4 rounded-card border border-border-seam bg-bg-surface p-4";
15
+ function S({ eventId: t, templates: l }) {
16
+ let u = i(), d = p(), v = o(), S = n({
14
17
  variables: {
15
18
  eventId: t,
16
- limit: x.limit,
17
- offset: x.offset
19
+ limit: v.limit,
20
+ offset: v.offset
18
21
  },
19
22
  fetchPolicy: "no-cache"
20
- }), w = C.data?.eventfullyManagedRegistrations, [T, E] = d(""), [D, O] = d(""), [k, A] = d(null), [j, M] = d(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([
23
+ }), w = S.data?.eventfullyManagedRegistrations, [E, D] = m(""), [O, k] = m(""), [A, j] = m(null), [M, N] = m(null), [P, { loading: F }] = e({ fetchPolicy: "no-cache" }), [I, { loading: L }] = r(), R = l.find((e) => e.id === O), z = w?.items.find((e) => e.id === E), B = JSON.stringify([
24
+ z?.id,
21
25
  R?.id,
22
- L?.id,
23
- L?.revision,
24
- L?.requiredSessionIds
25
- ]), B = k?.key === z ? k.result : void 0, V = P || I, H = h("eventfullymanaged.certificates.issuanceError", "Could not confirm certificate issuance"), U = async () => {
26
- if (L && R && !V) {
27
- A(null);
26
+ R?.revision,
27
+ R?.requiredSessionIds
28
+ ]), V = A?.key === B ? A.result : void 0, H = M?.key === B ? M.value : null, U = F || L, W = u("eventfullymanaged.certificates.issuanceError", "Could not confirm certificate issuance"), G = async () => {
29
+ if (R && z && !U) {
30
+ j(null);
28
31
  try {
29
- let e = await N({ variables: {
32
+ let e = await P({ variables: {
30
33
  eventId: t,
31
- registrationId: R.id,
32
- requiredSessionIds: L.requiredSessionIds
34
+ registrationId: z.id,
35
+ requiredSessionIds: R.requiredSessionIds
33
36
  } });
34
37
  if (e.error || !e.data?.eventfullyManagedCertificateEligibility) throw Error("Eligibility not confirmed");
35
- A({
36
- key: z,
38
+ j({
39
+ key: B,
37
40
  result: e.data.eventfullyManagedCertificateEligibility
38
41
  });
39
42
  } catch {
40
- c.error(h("eventfullymanaged.certificates.eligibilityError", "Could not confirm attendance eligibility"));
43
+ c.error(u("eventfullymanaged.certificates.eligibilityError", "Could not confirm attendance eligibility"));
41
44
  }
42
45
  }
43
46
  };
44
- return /* @__PURE__ */ f("form", {
45
- className: v,
47
+ return /* @__PURE__ */ h("form", {
48
+ className: x,
46
49
  onSubmit: async (e) => {
47
- if (e.preventDefault(), L && R && B?.eligible && !V) try {
48
- let e = await F({ variables: {
50
+ if (e.preventDefault(), R && z && V?.eligible && !U) try {
51
+ let e = await I({ variables: {
49
52
  eventId: t,
50
- registrationId: R.id,
51
- templateId: L.id
53
+ registrationId: z.id,
54
+ templateId: R.id
52
55
  } }), n = e.data?.eventfullyManagedIssueCertificate;
53
- if (!s(e, n?.id, H) || !n) return;
54
- M(n);
56
+ if (!s(e, n?.id, W) || !n) return;
57
+ N({
58
+ key: B,
59
+ value: n
60
+ });
55
61
  } catch {
56
- c.error(H);
62
+ c.error(W);
57
63
  }
58
64
  },
59
- children: /* @__PURE__ */ p("fieldset", {
60
- disabled: V,
65
+ children: /* @__PURE__ */ g("fieldset", {
66
+ disabled: U,
61
67
  className: "space-y-4",
62
68
  children: [
63
- /* @__PURE__ */ f("legend", {
69
+ /* @__PURE__ */ h("legend", {
64
70
  className: "mb-3 text-lg font-semibold",
65
- children: h("eventfullymanaged.certificates.manualIssue", "Issue a certificate")
71
+ children: u("eventfullymanaged.certificates.manualIssue", "Issue a certificate")
66
72
  }),
67
- /* @__PURE__ */ p("div", {
73
+ /* @__PURE__ */ g("div", {
68
74
  className: "space-y-1.5",
69
- children: [/* @__PURE__ */ f(g, {
70
- id: y + "templateLabel",
71
- htmlFor: y + "template",
72
- children: h("eventfullymanaged.certificates.template", "Certificate template")
73
- }), /* @__PURE__ */ p("select", {
74
- id: y + "template",
75
- "aria-labelledby": y + "templateLabel",
76
- className: _,
77
- value: L?.id ?? "",
75
+ children: [/* @__PURE__ */ h(y, {
76
+ id: d + "templateLabel",
77
+ htmlFor: d + "template",
78
+ children: u("eventfullymanaged.certificates.template", "Certificate template")
79
+ }), /* @__PURE__ */ g("select", {
80
+ id: d + "template",
81
+ "aria-labelledby": d + "templateLabel",
82
+ className: b,
83
+ value: R?.id ?? "",
78
84
  onChange: (e) => {
79
- O(e.target.value), A(null);
85
+ k(e.target.value), j(null);
80
86
  },
81
- children: [/* @__PURE__ */ f("option", {
87
+ children: [/* @__PURE__ */ h("option", {
82
88
  value: "",
83
- children: h("eventfullymanaged.certificates.chooseTemplate", "Choose a template")
84
- }), l.map((e) => /* @__PURE__ */ f("option", {
89
+ children: u("eventfullymanaged.certificates.chooseTemplate", "Choose a template")
90
+ }), l.map((e) => /* @__PURE__ */ h("option", {
85
91
  value: e.id,
86
92
  children: e.title
87
93
  }, e.id))]
88
94
  })]
89
95
  }),
90
- /* @__PURE__ */ p("div", {
96
+ /* @__PURE__ */ g("div", {
91
97
  className: "space-y-1.5",
92
- children: [/* @__PURE__ */ f(g, {
93
- id: y + "registrationLabel",
94
- htmlFor: y + "registration",
95
- children: h("eventfullymanaged.certificates.registration", "Attendee registration")
96
- }), /* @__PURE__ */ p("select", {
97
- id: y + "registration",
98
- "aria-labelledby": y + "registrationLabel",
99
- className: _,
100
- value: R?.id ?? "",
98
+ children: [/* @__PURE__ */ h(y, {
99
+ id: d + "registrationLabel",
100
+ htmlFor: d + "registration",
101
+ children: u("eventfullymanaged.certificates.registration", "Attendee registration")
102
+ }), /* @__PURE__ */ g("select", {
103
+ id: d + "registration",
104
+ "aria-labelledby": d + "registrationLabel",
105
+ className: b,
106
+ value: z?.id ?? "",
101
107
  onChange: (e) => {
102
- E(e.target.value), A(null);
108
+ D(e.target.value), j(null);
103
109
  },
104
- children: [/* @__PURE__ */ f("option", {
110
+ children: [/* @__PURE__ */ h("option", {
105
111
  value: "",
106
- children: h("eventfullymanaged.certificates.chooseRegistration", "Choose a registration")
107
- }), w?.items.map((e) => /* @__PURE__ */ p("option", {
112
+ children: u("eventfullymanaged.certificates.chooseRegistration", "Choose a registration")
113
+ }), w?.items.map((e) => /* @__PURE__ */ g("option", {
108
114
  value: e.id,
109
115
  children: [
110
116
  e.attendeeName || e.id,
@@ -114,74 +120,87 @@ function y({ eventId: t, templates: l }) {
114
120
  }, e.id))]
115
121
  })]
116
122
  }),
117
- C.error ? /* @__PURE__ */ p("p", {
123
+ S.error ? /* @__PURE__ */ g("p", {
118
124
  role: "alert",
119
125
  className: "text-sm text-status-error-text",
120
126
  children: [
121
- h("eventfullymanaged.certificates.registrationsError", "Could not load registrations."),
127
+ u("eventfullymanaged.certificates.registrationsError", "Could not load registrations."),
122
128
  " ",
123
- /* @__PURE__ */ f(m, {
129
+ /* @__PURE__ */ h(_, {
124
130
  type: "button",
125
131
  variant: "outline",
126
- onClick: () => void C.refetch().catch(() => void 0),
127
- children: h("eventfullymanaged.certificates.retry", "Retry")
132
+ onClick: () => void S.refetch().catch(() => void 0),
133
+ children: u("eventfullymanaged.certificates.retry", "Retry")
128
134
  })
129
135
  ]
130
136
  }) : null,
131
- w ? /* @__PURE__ */ f(a, {
132
- offset: x.offset,
133
- limit: x.limit,
137
+ w ? /* @__PURE__ */ h(a, {
138
+ offset: v.offset,
139
+ limit: v.limit,
134
140
  total: w.total,
135
141
  loadedCount: w.items.length,
136
- onPrev: x.prevPage,
137
- onNext: x.nextPage,
138
- loading: C.loading,
142
+ onPrev: v.prevPage,
143
+ onNext: v.nextPage,
144
+ loading: S.loading,
139
145
  itemLabel: "registrations"
140
146
  }) : null,
141
- /* @__PURE__ */ p("div", {
147
+ /* @__PURE__ */ g("div", {
142
148
  className: "flex flex-wrap gap-2",
143
- children: [/* @__PURE__ */ f(m, {
149
+ children: [/* @__PURE__ */ h(_, {
144
150
  type: "button",
145
151
  variant: "outline",
146
- disabled: !L || !R,
147
- onClick: () => void U(),
148
- children: P ? h("eventfullymanaged.certificates.checking", "Checking…") : h("eventfullymanaged.certificates.checkEligibility", "Check eligibility")
149
- }), /* @__PURE__ */ f(m, {
152
+ disabled: !R || !z,
153
+ onClick: () => void G(),
154
+ children: F ? u("eventfullymanaged.certificates.checking", "Checking…") : u("eventfullymanaged.certificates.checkEligibility", "Check eligibility")
155
+ }), /* @__PURE__ */ h(_, {
150
156
  type: "submit",
151
- disabled: !B?.eligible,
152
- children: I ? h("eventfullymanaged.certificates.issuing", "Issuing…") : h("eventfullymanaged.certificates.issue", "Issue certificate")
157
+ disabled: !V?.eligible,
158
+ children: L ? u("eventfullymanaged.certificates.issuing", "Issuing…") : u("eventfullymanaged.certificates.issue", "Issue certificate")
153
159
  })]
154
160
  }),
155
- /* @__PURE__ */ f(b, { eligibility: B }),
156
- /* @__PURE__ */ f(S, { receipt: j })
161
+ /* @__PURE__ */ h(C, { eligibility: V }),
162
+ /* @__PURE__ */ h(f, {
163
+ eventId: t,
164
+ registrationId: z?.id,
165
+ templateId: R?.id,
166
+ disabled: U,
167
+ onFound: (e) => N(e ? {
168
+ key: B,
169
+ value: e
170
+ } : null)
171
+ }, B),
172
+ /* @__PURE__ */ h(T, {
173
+ eventId: t,
174
+ receipt: H
175
+ })
157
176
  ]
158
177
  })
159
178
  });
160
179
  }
161
- function b({ eligibility: e }) {
180
+ function C({ eligibility: e }) {
162
181
  let t = i();
163
- return e ? e.eligible ? /* @__PURE__ */ f("p", {
182
+ return e ? e.eligible ? /* @__PURE__ */ h("p", {
164
183
  className: "text-sm",
165
184
  "aria-live": "polite",
166
185
  children: t("eventfullymanaged.certificates.eligible", "Eligible for this certificate.")
167
- }) : /* @__PURE__ */ f("p", {
186
+ }) : /* @__PURE__ */ h("p", {
168
187
  className: "text-sm",
169
188
  "aria-live": "polite",
170
189
  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.")
171
190
  }) : null;
172
191
  }
173
- function x({ eventId: e }) {
174
- let n = i(), r = u(), [a, o] = d(null), [s, { loading: l }] = t({ fetchPolicy: "no-cache" });
175
- return /* @__PURE__ */ p("section", {
176
- className: v,
192
+ function w({ eventId: e }) {
193
+ let n = i(), r = p(), [a, o] = m(null), [s, { loading: l }] = t({ fetchPolicy: "no-cache" });
194
+ return /* @__PURE__ */ g("section", {
195
+ className: x,
177
196
  "aria-labelledby": r + "receiptHeading",
178
197
  children: [
179
- /* @__PURE__ */ f("h2", {
198
+ /* @__PURE__ */ h("h2", {
180
199
  id: r + "receiptHeading",
181
200
  className: "text-lg font-semibold",
182
201
  children: n("eventfullymanaged.certificates.issuedReceipt", "Issuance receipt")
183
202
  }),
184
- /* @__PURE__ */ p("form", {
203
+ /* @__PURE__ */ g("form", {
185
204
  className: "space-y-2",
186
205
  onSubmit: async (t) => {
187
206
  t.preventDefault();
@@ -200,18 +219,20 @@ function x({ eventId: e }) {
200
219
  }
201
220
  }
202
221
  },
203
- children: [/* @__PURE__ */ f(g, {
222
+ children: [/* @__PURE__ */ h(y, {
204
223
  htmlFor: r + "receipt",
205
224
  children: n("eventfullymanaged.certificates.receiptId", "Receipt ID")
206
- }), /* @__PURE__ */ p("div", {
225
+ }), /* @__PURE__ */ g("div", {
207
226
  className: "flex flex-wrap items-center gap-2",
208
- children: [/* @__PURE__ */ f(h, {
227
+ children: [/* @__PURE__ */ h(v, {
209
228
  id: r + "receipt",
210
229
  name: "receiptId",
211
230
  className: "flex-1",
212
231
  maxLength: 128,
232
+ disabled: l,
233
+ onChange: () => o(null),
213
234
  required: !0
214
- }), /* @__PURE__ */ f(m, {
235
+ }), /* @__PURE__ */ h(_, {
215
236
  type: "submit",
216
237
  variant: "outline",
217
238
  disabled: l,
@@ -219,35 +240,46 @@ function x({ eventId: e }) {
219
240
  })]
220
241
  })]
221
242
  }),
222
- /* @__PURE__ */ f(S, { receipt: a })
243
+ /* @__PURE__ */ h(T, {
244
+ eventId: e,
245
+ receipt: a
246
+ })
223
247
  ]
224
248
  });
225
249
  }
226
- function S({ receipt: e }) {
227
- let t = i();
228
- return e ? /* @__PURE__ */ p("div", {
250
+ function T({ eventId: e, receipt: t }) {
251
+ let n = i();
252
+ return t ? /* @__PURE__ */ g("div", {
229
253
  "aria-live": "polite",
230
254
  className: "space-y-2 rounded-card border border-border-seam p-3 text-sm",
231
255
  children: [
232
- /* @__PURE__ */ f("h3", {
256
+ /* @__PURE__ */ h("h3", {
233
257
  className: "font-medium break-words",
234
- children: e.title
258
+ children: t.title
235
259
  }),
236
- /* @__PURE__ */ f("p", { children: t("eventfullymanaged.certificates.receiptIssuedAt", "Issued {{date}}", { date: l(e.issuedAt) }) }),
237
- /* @__PURE__ */ f("p", { children: t("eventfullymanaged.certificates.receiptTemplateRevision", "Template revision {{revision}}", { revision: e.templateRevision }) }),
238
- /* @__PURE__ */ f("p", {
260
+ /* @__PURE__ */ h("p", { children: n("eventfullymanaged.certificates.receiptIssuedAt", "Issued {{date}}", { date: l(t.issuedAt) }) }),
261
+ /* @__PURE__ */ h("p", { children: n("eventfullymanaged.certificates.receiptTemplateRevision", "Template revision {{revision}}", { revision: t.templateRevision }) }),
262
+ /* @__PURE__ */ h("p", {
239
263
  className: "break-all text-text-secondary",
240
- children: e.id
241
- })
264
+ children: t.id
265
+ }),
266
+ /* @__PURE__ */ h(u, {
267
+ eventId: e,
268
+ receiptId: t.id
269
+ }),
270
+ /* @__PURE__ */ h(d, {
271
+ eventId: e,
272
+ certificateId: t.id
273
+ }, t.id)
242
274
  ]
243
275
  }) : null;
244
276
  }
245
- function C(e) {
246
- return /* @__PURE__ */ p("div", {
277
+ function E(e) {
278
+ return /* @__PURE__ */ g("div", {
247
279
  className: "grid gap-4 lg:grid-cols-2",
248
- children: [/* @__PURE__ */ f(y, { ...e }), /* @__PURE__ */ f(x, { eventId: e.eventId })]
280
+ children: [/* @__PURE__ */ h(S, { ...e }), /* @__PURE__ */ h(w, { eventId: e.eventId })]
249
281
  });
250
282
  }
251
- export { C as CertificateIssuance };
283
+ export { E as CertificateIssuance };
252
284
 
253
285
  //# sourceMappingURL=CertificateIssuance.js.map