@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.
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.d.ts +6 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js +141 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js +143 -111
- package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js.map +1 -1
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.d.ts +4 -0
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js +31 -0
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.d.ts +8 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js +43 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.d.ts +6 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js +86 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js +71 -60
- package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +240 -0
- package/dist/generated/wspace-operations.js +133 -30
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +651 -6
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +23 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
- package/dist/node_modules/@apollo/client/errors/utils.js +15 -0
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -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,EAAG,6CAA6C,mBAAmB;GAAM,CAAA;GACrGO,IAAW,kBAACG,GAAD,EAAkC,YAAW,CAAA,IAAI;GAC5DL,EAAO,UACN,kBAAC,KAAD;IAAG,MAAK;IAAU,UAAAL,EAAG,qDAAqD,wBAAwB;GAAK,CAAA,IACrG;GACHK,EAAO,QACN,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;IACvB,UAAAL,EAAG,mDAAmD,iDAAiD;GACvG,CAAA,IACD;GACJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACW,GAAD;KACW;KACM;KACf,UAAUJ;KACV,UAAUF,EAAO,WAAW,EAAQA,EAAO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;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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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
|
|
12
|
-
function
|
|
13
|
-
let
|
|
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:
|
|
17
|
-
offset:
|
|
19
|
+
limit: v.limit,
|
|
20
|
+
offset: v.offset
|
|
18
21
|
},
|
|
19
22
|
fetchPolicy: "no-cache"
|
|
20
|
-
}), w =
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
32
|
+
let e = await P({ variables: {
|
|
30
33
|
eventId: t,
|
|
31
|
-
registrationId:
|
|
32
|
-
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
|
-
|
|
36
|
-
key:
|
|
38
|
+
j({
|
|
39
|
+
key: B,
|
|
37
40
|
result: e.data.eventfullyManagedCertificateEligibility
|
|
38
41
|
});
|
|
39
42
|
} catch {
|
|
40
|
-
c.error(
|
|
43
|
+
c.error(u("eventfullymanaged.certificates.eligibilityError", "Could not confirm attendance eligibility"));
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
className:
|
|
47
|
+
return /* @__PURE__ */ h("form", {
|
|
48
|
+
className: x,
|
|
46
49
|
onSubmit: async (e) => {
|
|
47
|
-
if (e.preventDefault(),
|
|
48
|
-
let e = await
|
|
50
|
+
if (e.preventDefault(), R && z && V?.eligible && !U) try {
|
|
51
|
+
let e = await I({ variables: {
|
|
49
52
|
eventId: t,
|
|
50
|
-
registrationId:
|
|
51
|
-
templateId:
|
|
53
|
+
registrationId: z.id,
|
|
54
|
+
templateId: R.id
|
|
52
55
|
} }), n = e.data?.eventfullyManagedIssueCertificate;
|
|
53
|
-
if (!s(e, n?.id,
|
|
54
|
-
|
|
56
|
+
if (!s(e, n?.id, W) || !n) return;
|
|
57
|
+
N({
|
|
58
|
+
key: B,
|
|
59
|
+
value: n
|
|
60
|
+
});
|
|
55
61
|
} catch {
|
|
56
|
-
c.error(
|
|
62
|
+
c.error(W);
|
|
57
63
|
}
|
|
58
64
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
disabled:
|
|
65
|
+
children: /* @__PURE__ */ g("fieldset", {
|
|
66
|
+
disabled: U,
|
|
61
67
|
className: "space-y-4",
|
|
62
68
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ h("legend", {
|
|
64
70
|
className: "mb-3 text-lg font-semibold",
|
|
65
|
-
children:
|
|
71
|
+
children: u("eventfullymanaged.certificates.manualIssue", "Issue a certificate")
|
|
66
72
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ g("div", {
|
|
68
74
|
className: "space-y-1.5",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
-
id:
|
|
71
|
-
htmlFor:
|
|
72
|
-
children:
|
|
73
|
-
}), /* @__PURE__ */
|
|
74
|
-
id:
|
|
75
|
-
"aria-labelledby":
|
|
76
|
-
className:
|
|
77
|
-
value:
|
|
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
|
-
|
|
85
|
+
k(e.target.value), j(null);
|
|
80
86
|
},
|
|
81
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ h("option", {
|
|
82
88
|
value: "",
|
|
83
|
-
children:
|
|
84
|
-
}), l.map((e) => /* @__PURE__ */
|
|
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__ */
|
|
96
|
+
/* @__PURE__ */ g("div", {
|
|
91
97
|
className: "space-y-1.5",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
93
|
-
id:
|
|
94
|
-
htmlFor:
|
|
95
|
-
children:
|
|
96
|
-
}), /* @__PURE__ */
|
|
97
|
-
id:
|
|
98
|
-
"aria-labelledby":
|
|
99
|
-
className:
|
|
100
|
-
value:
|
|
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
|
-
|
|
108
|
+
D(e.target.value), j(null);
|
|
103
109
|
},
|
|
104
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ h("option", {
|
|
105
111
|
value: "",
|
|
106
|
-
children:
|
|
107
|
-
}), w?.items.map((e) => /* @__PURE__ */
|
|
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
|
-
|
|
123
|
+
S.error ? /* @__PURE__ */ g("p", {
|
|
118
124
|
role: "alert",
|
|
119
125
|
className: "text-sm text-status-error-text",
|
|
120
126
|
children: [
|
|
121
|
-
|
|
127
|
+
u("eventfullymanaged.certificates.registrationsError", "Could not load registrations."),
|
|
122
128
|
" ",
|
|
123
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ h(_, {
|
|
124
130
|
type: "button",
|
|
125
131
|
variant: "outline",
|
|
126
|
-
onClick: () => void
|
|
127
|
-
children:
|
|
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__ */
|
|
132
|
-
offset:
|
|
133
|
-
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:
|
|
137
|
-
onNext:
|
|
138
|
-
loading:
|
|
142
|
+
onPrev: v.prevPage,
|
|
143
|
+
onNext: v.nextPage,
|
|
144
|
+
loading: S.loading,
|
|
139
145
|
itemLabel: "registrations"
|
|
140
146
|
}) : null,
|
|
141
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ g("div", {
|
|
142
148
|
className: "flex flex-wrap gap-2",
|
|
143
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ h(_, {
|
|
144
150
|
type: "button",
|
|
145
151
|
variant: "outline",
|
|
146
|
-
disabled: !
|
|
147
|
-
onClick: () => void
|
|
148
|
-
children:
|
|
149
|
-
}), /* @__PURE__ */
|
|
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: !
|
|
152
|
-
children:
|
|
157
|
+
disabled: !V?.eligible,
|
|
158
|
+
children: L ? u("eventfullymanaged.certificates.issuing", "Issuing…") : u("eventfullymanaged.certificates.issue", "Issue certificate")
|
|
153
159
|
})]
|
|
154
160
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */ f
|
|
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
|
|
180
|
+
function C({ eligibility: e }) {
|
|
162
181
|
let t = i();
|
|
163
|
-
return e ? e.eligible ? /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
174
|
-
let n = i(), r =
|
|
175
|
-
return /* @__PURE__ */
|
|
176
|
-
className:
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
222
|
+
children: [/* @__PURE__ */ h(y, {
|
|
204
223
|
htmlFor: r + "receipt",
|
|
205
224
|
children: n("eventfullymanaged.certificates.receiptId", "Receipt ID")
|
|
206
|
-
}), /* @__PURE__ */
|
|
225
|
+
}), /* @__PURE__ */ g("div", {
|
|
207
226
|
className: "flex flex-wrap items-center gap-2",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
243
|
+
/* @__PURE__ */ h(T, {
|
|
244
|
+
eventId: e,
|
|
245
|
+
receipt: a
|
|
246
|
+
})
|
|
223
247
|
]
|
|
224
248
|
});
|
|
225
249
|
}
|
|
226
|
-
function
|
|
227
|
-
let
|
|
228
|
-
return
|
|
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__ */
|
|
256
|
+
/* @__PURE__ */ h("h3", {
|
|
233
257
|
className: "font-medium break-words",
|
|
234
|
-
children:
|
|
258
|
+
children: t.title
|
|
235
259
|
}),
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
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:
|
|
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
|
|
246
|
-
return /* @__PURE__ */
|
|
277
|
+
function E(e) {
|
|
278
|
+
return /* @__PURE__ */ g("div", {
|
|
247
279
|
className: "grid gap-4 lg:grid-cols-2",
|
|
248
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ h(S, { ...e }), /* @__PURE__ */ h(w, { eventId: e.eventId })]
|
|
249
281
|
});
|
|
250
282
|
}
|
|
251
|
-
export {
|
|
283
|
+
export { E as CertificateIssuance };
|
|
252
284
|
|
|
253
285
|
//# sourceMappingURL=CertificateIssuance.js.map
|