@semics-tech/emdash-events 0.0.0-stage → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -2
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +416 -0
- package/dist/manifest.json +425 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.mjs +7 -0
- package/dist/ts/astro/lib/call.d.ts +54 -0
- package/dist/ts/astro/lib/call.js +121 -0
- package/dist/ts/integration/index.d.ts +48 -0
- package/dist/ts/integration/index.js +76 -0
- package/dist/ts/ui/index.d.ts +6 -0
- package/dist/ts/ui/index.js +46 -0
- package/emdash-plugin.jsonc +222 -0
- package/package.json +78 -3
- package/src/astro/AddToCalendar.astro +47 -0
- package/src/astro/AttendeeList.astro +157 -0
- package/src/astro/BookingBlock.astro +30 -0
- package/src/astro/BookingPage.astro +230 -0
- package/src/astro/BookingStatus.astro +112 -0
- package/src/astro/BookingWidget.astro +776 -0
- package/src/astro/CheckIn.astro +186 -0
- package/src/astro/DoorSignPage.astro +62 -0
- package/src/astro/EventCard.astro +81 -0
- package/src/astro/EventList.astro +83 -0
- package/src/astro/OptOutPage.astro +58 -0
- package/src/astro/PaymentReturn.astro +96 -0
- package/src/astro/TicketPass.astro +95 -0
- package/src/astro/checkout-endpoint.ts +11 -0
- package/src/astro/index.js +18 -0
- package/src/astro/lib/attendees.ts +170 -0
- package/src/astro/lib/call.ts +185 -0
- package/src/astro/lib/checkout-form.ts +271 -0
- package/src/astro/lib/list.ts +99 -0
- package/src/astro/lib/opt-out.ts +49 -0
- package/src/astro/lib/pass.ts +35 -0
- package/src/astro/lib/payment.ts +73 -0
- package/src/astro/lib/picker.ts +245 -0
- package/src/astro/lib/promo.ts +162 -0
- package/src/astro/lib/questions.ts +107 -0
- package/src/astro/lib/receipt.ts +132 -0
- package/src/astro/lib/waitlist.ts +72 -0
- package/src/astro/lib/widget.ts +299 -0
- package/src/astro/promo-endpoint.ts +11 -0
- package/src/astro/virtual.d.ts +16 -0
- package/src/astro/waitlist-endpoint.ts +12 -0
- package/src/client/booking.ts +190 -0
- package/src/client/checkin.ts +260 -0
- package/src/client/payment.ts +76 -0
- package/src/client/picker.ts +143 -0
- package/src/client/receipt.ts +75 -0
- package/src/i18n/ar.ts +251 -0
- package/src/i18n/en.ts +255 -0
- package/src/i18n/index.ts +121 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { definePlugin } from "emdash";
|
|
2
|
+
const ID = "semics-events-ui";
|
|
3
|
+
const VERSION = "0.1.0";
|
|
4
|
+
/** Native UI plugin descriptor. Add to `plugins: [eventsUi()]` beside the sandboxed core. */
|
|
5
|
+
export function eventsUi() {
|
|
6
|
+
return {
|
|
7
|
+
id: ID,
|
|
8
|
+
version: VERSION,
|
|
9
|
+
entrypoint: "@semics-tech/emdash-events/ui",
|
|
10
|
+
componentsEntry: "@semics-tech/emdash-events/astro",
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** Runtime entry: no capabilities, storage, hooks or routes; it registers editor blocks only. */
|
|
14
|
+
export function createPlugin() {
|
|
15
|
+
return definePlugin({
|
|
16
|
+
id: ID,
|
|
17
|
+
version: VERSION,
|
|
18
|
+
admin: {
|
|
19
|
+
portableTextBlocks: [
|
|
20
|
+
{
|
|
21
|
+
type: "events-booking",
|
|
22
|
+
label: "Book an event",
|
|
23
|
+
icon: "code",
|
|
24
|
+
description: "A booking form for one event",
|
|
25
|
+
category: "Events",
|
|
26
|
+
fields: [
|
|
27
|
+
{ type: "text_input", action_id: "event", label: "Event (entry ID or slug)" },
|
|
28
|
+
{ type: "text_input", action_id: "heading", label: "Heading", initial_value: "Book tickets" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "events-list",
|
|
33
|
+
label: "Events list",
|
|
34
|
+
icon: "code",
|
|
35
|
+
description: "A list of upcoming events",
|
|
36
|
+
category: "Events",
|
|
37
|
+
fields: [
|
|
38
|
+
{ type: "text_input", action_id: "heading", label: "Heading", initial_value: "Upcoming events" },
|
|
39
|
+
{ type: "number_input", action_id: "limit", label: "Number of events", initial_value: 3, min: 1, max: 20 },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export default createPlugin;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@emdash-cms/plugin-cli/schemas/emdash-plugin.schema.json",
|
|
3
|
+
|
|
4
|
+
"slug": "semics-events",
|
|
5
|
+
"publisher": "did:plc:mire6xkehfirmoj5pmpqgpvq",
|
|
6
|
+
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": { "name": "semics", "url": "https://semics.co.uk" },
|
|
9
|
+
"security": { "email": "security@semics.co.uk" },
|
|
10
|
+
"description": "Events bookings and ticketing for EmDash",
|
|
11
|
+
"repo": "https://github.com/semics-uk/emdash-plugins",
|
|
12
|
+
|
|
13
|
+
// Registry listing (T103): the package page's text and images. Not part of the trust contract.
|
|
14
|
+
// The images are made by apps/playground/e2e/t103-screenshots.spec.ts (T103_WRITE=1).
|
|
15
|
+
"name": "semics Events",
|
|
16
|
+
"keywords": ["events", "tickets", "bookings", "rsvp", "waitlist"],
|
|
17
|
+
"sections": {
|
|
18
|
+
"description": { "file": "listing/description.md" },
|
|
19
|
+
"installation": { "file": "listing/installation.md" },
|
|
20
|
+
"faq": { "file": "listing/faq.md" },
|
|
21
|
+
"security": { "file": "listing/security.md" }
|
|
22
|
+
},
|
|
23
|
+
"release": {
|
|
24
|
+
"requires": { "env:emdash": ">=1.2.0 <2" },
|
|
25
|
+
"artifacts": {
|
|
26
|
+
"icon": { "file": "listing/icon.png" },
|
|
27
|
+
"banner": { "file": "listing/banner.png" },
|
|
28
|
+
"screenshots": [
|
|
29
|
+
{ "file": "listing/screenshots/1-booking-form.png" },
|
|
30
|
+
{ "file": "listing/screenshots/2-events-list.png" }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Trust contract (Free edition, BUILD-PLAN 3.1 and 13). Changing these between releases
|
|
36
|
+
// requires a version bump because installed users have consented to the old contract.
|
|
37
|
+
// content:read resolve events, and veto deleting an event that has bookings (spike S9)
|
|
38
|
+
// schema:read validate the collection field mapping
|
|
39
|
+
// email:send booking confirmations, reminders, waitlist offers
|
|
40
|
+
// network:request Cloudflare Turnstile verification, and nothing else
|
|
41
|
+
// Deliberately not requested: content:write, users:read.
|
|
42
|
+
"capabilities": ["content:read", "schema:read", "email:send", "network:request"],
|
|
43
|
+
"allowedHosts": ["challenges.cloudflare.com"],
|
|
44
|
+
|
|
45
|
+
// Keep in step with src/storage/schema.ts (a test compares them).
|
|
46
|
+
"storage": {
|
|
47
|
+
"event_configs": { "indexes": ["status", "salesEnd"] },
|
|
48
|
+
"occurrences": { "indexes": [["eventId", "startsAt"], "startsAt", "status"] },
|
|
49
|
+
"ticket_types": { "indexes": ["eventId"] },
|
|
50
|
+
"bookings": {
|
|
51
|
+
// ["ipHash", "createdAt"]: checkout's rate limit counts recent bookings per hashed IP (T047).
|
|
52
|
+
"indexes": [
|
|
53
|
+
"eventId",
|
|
54
|
+
"status",
|
|
55
|
+
"email",
|
|
56
|
+
"createdAt",
|
|
57
|
+
["status", "holdExpiresAt"],
|
|
58
|
+
["eventId", "status"],
|
|
59
|
+
["ipHash", "createdAt"]
|
|
60
|
+
],
|
|
61
|
+
"uniqueIndexes": ["ref"]
|
|
62
|
+
},
|
|
63
|
+
// id = "<provider>:<sessionId>", which gives webhook idempotency; no unique index needed.
|
|
64
|
+
"payments": { "indexes": ["bookingId"] },
|
|
65
|
+
"attendees": {
|
|
66
|
+
"indexes": ["bookingId", "eventId", "email", ["eventId", "checkedInAt"]],
|
|
67
|
+
"uniqueIndexes": ["code"]
|
|
68
|
+
},
|
|
69
|
+
// "email": deletion on request finds a person's waitlist entries (T081).
|
|
70
|
+
"waitlist": { "indexes": [["eventId", "status"], "offerExpiresAt", "email"] },
|
|
71
|
+
"promo_codes": { "indexes": ["eventId"], "uniqueIndexes": ["code"] },
|
|
72
|
+
"outbox": { "indexes": [["status", "nextAttemptAt"], "to"] }
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
"admin": {
|
|
76
|
+
// Block Kit pages and widget, answered by the private `admin` route (src/admin/pages.ts).
|
|
77
|
+
"pages": [
|
|
78
|
+
{ "path": "/bookings", "label": "Bookings", "icon": "ticket" },
|
|
79
|
+
{ "path": "/attendees", "label": "Attendees", "icon": "users" },
|
|
80
|
+
{ "path": "/events", "label": "Event editor", "icon": "calendar" },
|
|
81
|
+
{ "path": "/setup", "label": "Setup check", "icon": "gear" }
|
|
82
|
+
],
|
|
83
|
+
"widgets": [{ "id": "sales", "title": "Ticket sales", "size": "half" }],
|
|
84
|
+
// "Tickets & booking" panel on saved event entries (T043), answered by the private editor/tickets route.
|
|
85
|
+
// Scoped to the default events collection; it reads and writes plugin storage only, never the entry.
|
|
86
|
+
"editorPanels": [
|
|
87
|
+
{ "id": "tickets", "title": "Tickets & booking", "route": "editor/tickets", "collections": ["events"] }
|
|
88
|
+
],
|
|
89
|
+
// Secret fields are encrypted with EMDASH_ENCRYPTION_KEY (spike S8); saving one without it fails.
|
|
90
|
+
"settingsSchema": {
|
|
91
|
+
"eventsCollection": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"label": "Events collection",
|
|
94
|
+
"description": "Slug of the collection that holds your events.",
|
|
95
|
+
"default": "events"
|
|
96
|
+
},
|
|
97
|
+
"fieldStartsAt": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"label": "Start field",
|
|
100
|
+
"description": "Field that holds the start date and time.",
|
|
101
|
+
"default": "starts_at"
|
|
102
|
+
},
|
|
103
|
+
"fieldEndsAt": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"label": "End field",
|
|
106
|
+
"description": "Field that holds the end date and time.",
|
|
107
|
+
"default": "ends_at"
|
|
108
|
+
},
|
|
109
|
+
"fieldTimezone": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"label": "Timezone field",
|
|
112
|
+
"description": "Field that holds the IANA timezone, for example Europe/London.",
|
|
113
|
+
"default": "timezone"
|
|
114
|
+
},
|
|
115
|
+
"fieldVenue": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"label": "Venue field",
|
|
118
|
+
"description": "Field that holds the venue name or address.",
|
|
119
|
+
"default": "venue"
|
|
120
|
+
},
|
|
121
|
+
"holdMinutesFree": {
|
|
122
|
+
"type": "number",
|
|
123
|
+
"label": "Hold time, free tickets (minutes)",
|
|
124
|
+
"description": "How long a seat is held while a buyer completes a free checkout.",
|
|
125
|
+
"default": 15,
|
|
126
|
+
"min": 5,
|
|
127
|
+
"max": 60
|
|
128
|
+
},
|
|
129
|
+
"holdMinutesPaid": {
|
|
130
|
+
"type": "number",
|
|
131
|
+
"label": "Hold time, paid tickets (minutes)",
|
|
132
|
+
"description": "How long a seat is held during a paid checkout. Card processors need at least 30 minutes.",
|
|
133
|
+
"default": 35,
|
|
134
|
+
"min": 30,
|
|
135
|
+
"max": 60
|
|
136
|
+
},
|
|
137
|
+
"holdCeilingMinutes": {
|
|
138
|
+
"type": "number",
|
|
139
|
+
"label": "Maximum total hold (minutes)",
|
|
140
|
+
"description": "Each checkout step extends the hold, but never beyond this many minutes from the first hold.",
|
|
141
|
+
"default": 60,
|
|
142
|
+
"min": 15,
|
|
143
|
+
"max": 120
|
|
144
|
+
},
|
|
145
|
+
"cancelCutoffHours": {
|
|
146
|
+
"type": "number",
|
|
147
|
+
"label": "Self-service cancel cutoff (hours before start)",
|
|
148
|
+
"description": "Buyers can cancel a confirmed booking up to this many hours before the event starts.",
|
|
149
|
+
"default": 24,
|
|
150
|
+
"min": 0,
|
|
151
|
+
"max": 720
|
|
152
|
+
},
|
|
153
|
+
"currency": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"label": "Default currency",
|
|
156
|
+
"description": "Three-letter ISO 4217 code, for example GBP.",
|
|
157
|
+
"default": "GBP"
|
|
158
|
+
},
|
|
159
|
+
"turnstileSiteKey": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"label": "Turnstile site key",
|
|
162
|
+
"description": "Public site key of your Cloudflare Turnstile widget."
|
|
163
|
+
},
|
|
164
|
+
"turnstileSecretKey": {
|
|
165
|
+
"type": "secret",
|
|
166
|
+
"label": "Turnstile secret key",
|
|
167
|
+
"description": "Secret key used to verify bot checks. Stored encrypted."
|
|
168
|
+
},
|
|
169
|
+
"esignPairing": {
|
|
170
|
+
"type": "secret",
|
|
171
|
+
"label": "E-sign pairing string",
|
|
172
|
+
"description": "Pairing string from the e-sign plugin, for events that require signed waivers. Stored encrypted."
|
|
173
|
+
},
|
|
174
|
+
// Secrets an Events Pro build stores (T067). Declared here so a site switched back to Free can
|
|
175
|
+
// still read its settings: EmDash refuses to list an encrypted value the manifest does not
|
|
176
|
+
// declare as a secret. Free never reads them.
|
|
177
|
+
"licenceKey": {
|
|
178
|
+
"type": "secret",
|
|
179
|
+
"label": "Licence key (Pro)",
|
|
180
|
+
"description": "Used by Events Pro only; the Free edition ignores it. Stored encrypted."
|
|
181
|
+
},
|
|
182
|
+
"stripeSecretKey": {
|
|
183
|
+
"type": "secret",
|
|
184
|
+
"label": "Stripe secret key (Pro)",
|
|
185
|
+
"description": "Used by Events Pro only, for paid tickets; the Free edition ignores it. Stored encrypted."
|
|
186
|
+
},
|
|
187
|
+
"stripeWebhookSecret": {
|
|
188
|
+
"type": "secret",
|
|
189
|
+
"label": "Stripe webhook signing secret (Pro)",
|
|
190
|
+
"description": "Used by Events Pro only, for paid tickets; the Free edition ignores it. Stored encrypted."
|
|
191
|
+
},
|
|
192
|
+
"retentionDays": {
|
|
193
|
+
"type": "number",
|
|
194
|
+
"label": "Keep booking data (days)",
|
|
195
|
+
"description": "Personal data of past events is erased after this many days.",
|
|
196
|
+
"default": 365,
|
|
197
|
+
"min": 30
|
|
198
|
+
},
|
|
199
|
+
// Admin notifications (T131): sent through the outbox; the email links into the admin.
|
|
200
|
+
"adminNotifyEmails": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"label": "Admin notification emails",
|
|
203
|
+
"description": "Up to 5 addresses, separated by commas, told about booking requests (and bookings, if chosen below)."
|
|
204
|
+
},
|
|
205
|
+
"notifyAdminOn": {
|
|
206
|
+
"type": "select",
|
|
207
|
+
"label": "Notify admins about",
|
|
208
|
+
"options": [
|
|
209
|
+
{ "value": "requests", "label": "Booking requests that need approval" },
|
|
210
|
+
{ "value": "all", "label": "All bookings" },
|
|
211
|
+
{ "value": "off", "label": "Nothing" }
|
|
212
|
+
],
|
|
213
|
+
"default": "requests"
|
|
214
|
+
},
|
|
215
|
+
"emailSenderName": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"label": "Email sender name",
|
|
218
|
+
"description": "Name shown on booking emails. Defaults to the site name."
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semics-tech/emdash-events",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.mts"
|
|
10
|
+
},
|
|
11
|
+
"./sandbox": "./dist/plugin.mjs",
|
|
12
|
+
"./ui": {
|
|
13
|
+
"import": "./dist/ts/ui/index.js",
|
|
14
|
+
"types": "./dist/ts/ui/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./integration": {
|
|
17
|
+
"import": "./dist/ts/integration/index.js",
|
|
18
|
+
"types": "./dist/ts/integration/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./astro": "./src/astro/index.js",
|
|
21
|
+
"./astro/checkout-endpoint": "./src/astro/checkout-endpoint.ts",
|
|
22
|
+
"./astro/promo-endpoint": "./src/astro/promo-endpoint.ts",
|
|
23
|
+
"./astro/waitlist-endpoint": "./src/astro/waitlist-endpoint.ts",
|
|
24
|
+
"./astro/lib/*": "./src/astro/lib/*.ts",
|
|
25
|
+
"./i18n": "./src/i18n/index.ts",
|
|
26
|
+
"./client/*": "./src/client/*.ts",
|
|
27
|
+
"./astro/BookingPage.astro": "./src/astro/BookingPage.astro",
|
|
28
|
+
"./astro/DoorSignPage.astro": "./src/astro/DoorSignPage.astro",
|
|
29
|
+
"./astro/CheckIn.astro": "./src/astro/CheckIn.astro",
|
|
30
|
+
"./astro/OptOutPage.astro": "./src/astro/OptOutPage.astro",
|
|
31
|
+
"./astro/BookingWidget.astro": "./src/astro/BookingWidget.astro",
|
|
32
|
+
"./astro/BookingBlock.astro": "./src/astro/BookingBlock.astro",
|
|
33
|
+
"./astro/EventList.astro": "./src/astro/EventList.astro",
|
|
34
|
+
"./astro/EventCard.astro": "./src/astro/EventCard.astro",
|
|
35
|
+
"./astro/BookingStatus.astro": "./src/astro/BookingStatus.astro",
|
|
36
|
+
"./astro/PaymentReturn.astro": "./src/astro/PaymentReturn.astro",
|
|
37
|
+
"./astro/TicketPass.astro": "./src/astro/TicketPass.astro",
|
|
38
|
+
"./astro/AddToCalendar.astro": "./src/astro/AddToCalendar.astro"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"src/astro",
|
|
43
|
+
"src/i18n",
|
|
44
|
+
"src/client",
|
|
45
|
+
"emdash-plugin.jsonc"
|
|
46
|
+
],
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"emdash": ">=1.2.0 <2"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@emdash-cms/plugin-cli": "0.13.3",
|
|
52
|
+
"@emdash-cms/plugin-test": "0.2.8",
|
|
53
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
54
|
+
"emdash": "1.2.0",
|
|
55
|
+
"typescript": "^5.9.0",
|
|
56
|
+
"vitest": "^4.1.12",
|
|
57
|
+
"zod": "4.6.5",
|
|
58
|
+
"@semics-tech/shared": "0.1.0-rc.1"
|
|
59
|
+
},
|
|
60
|
+
"description": "Events bookings and ticketing for EmDash",
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "https://github.com/semics-uk/emdash-plugins",
|
|
65
|
+
"directory": "packages/events"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"validate": "emdash-plugin validate",
|
|
69
|
+
"build": "emdash-plugin build && tsc -p tsconfig.ui.json",
|
|
70
|
+
"dev": "emdash-plugin dev",
|
|
71
|
+
"typecheck": "tsc --noEmit",
|
|
72
|
+
"test:coverage": "vitest run --coverage --reporter=dot",
|
|
73
|
+
"test:verify": "vitest run --reporter=dot ${CI:+--coverage}",
|
|
74
|
+
"verify": "pnpm run validate && pnpm run typecheck && pnpm run test:verify && pnpm run build",
|
|
75
|
+
"test": "emdash-plugin validate && vitest run",
|
|
76
|
+
"bundle": "emdash-plugin bundle",
|
|
77
|
+
"login": "emdash-plugin login",
|
|
78
|
+
"registry:publish": "emdash-plugin publish",
|
|
79
|
+
"release:setup": "emdash-plugin release setup"
|
|
80
|
+
}
|
|
6
81
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
// <AddToCalendar>: a link to the core's calendar file (EU-FR-08). For a booking, pass the
|
|
3
|
+
// short-lived signed query the core issued (`signedQuery`); the access token is never in the URL,
|
|
4
|
+
// and an unsigned or expired query renders nothing. For an event, pass `event` (public data, no
|
|
5
|
+
// signature). The download is a plain link, so it works without JavaScript.
|
|
6
|
+
import { pluginId } from "virtual:semics-events/config";
|
|
7
|
+
|
|
8
|
+
import { pickLocale, translator } from "../i18n/index";
|
|
9
|
+
import { bookingCalendarHref, eventCalendarHref } from "./lib/widget";
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
signedQuery?: string;
|
|
13
|
+
event?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { signedQuery, event } = Astro.props;
|
|
19
|
+
const { t, lang, dir } = translator(pickLocale(Astro.props.locale, Astro.currentLocale));
|
|
20
|
+
const label = Astro.props.label ?? t("calendar.add");
|
|
21
|
+
const href = signedQuery
|
|
22
|
+
? bookingCalendarHref({ pluginId, query: signedQuery, now: Date.now() })
|
|
23
|
+
: event
|
|
24
|
+
? eventCalendarHref(pluginId, event)
|
|
25
|
+
: undefined;
|
|
26
|
+
---
|
|
27
|
+
{
|
|
28
|
+
href && (
|
|
29
|
+
<a class="semics-events semics-add-to-calendar" lang={lang} dir={dir} href={href} download="event.ics" rel="nofollow" data-testid="add-to-calendar">
|
|
30
|
+
{label} <span class="semics-ics-hint">{t("calendar.hint")}</span>
|
|
31
|
+
</a>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.semics-add-to-calendar {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 0.25rem;
|
|
40
|
+
min-block-size: 2.75rem;
|
|
41
|
+
color: var(--events-accent, #0b57d0);
|
|
42
|
+
text-decoration: underline;
|
|
43
|
+
}
|
|
44
|
+
.semics-ics-hint {
|
|
45
|
+
color: var(--events-muted, #4a4a4a);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
// <AttendeeList>: a waiver booking's attendees with Signed / Waiting (T133, R95; Suite Pro). Rendered
|
|
3
|
+
// by the `/booking` page only when Events Pro's `public/booking` carries a signing list. Every button
|
|
4
|
+
// is a plain form POST back to the page (no JavaScript): Sign now opens that attendee's signing on
|
|
5
|
+
// this device, Resend asks e-sign to email an invited adult again, and the edit form corrects names
|
|
6
|
+
// and emails of attendees who have not signed, until the cutoff. Rows come from `signingRows`.
|
|
7
|
+
import { around, pickLocale, translator } from "../i18n/index";
|
|
8
|
+
import type { SigningRow } from "./lib/attendees";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
rows: SigningRow[];
|
|
12
|
+
/** Where the forms post (`/booking?ref=…`). */
|
|
13
|
+
action: string;
|
|
14
|
+
/** While names may be changed: the deadline (ISO). */
|
|
15
|
+
editUntil?: string;
|
|
16
|
+
locale?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { rows, action, editUntil } = Astro.props;
|
|
20
|
+
const locale = pickLocale(Astro.props.locale, Astro.currentLocale);
|
|
21
|
+
const { t, lang, dir } = translator(locale);
|
|
22
|
+
const editable = rows.filter((r) => r.canEdit);
|
|
23
|
+
const [untilBefore, untilAfter] = around(t("booking.attendees.editUntil"), "time");
|
|
24
|
+
const [emailedBefore, emailedAfter] = around(t("booking.attendees.emailed"), "email");
|
|
25
|
+
const at = (iso: string) => {
|
|
26
|
+
try {
|
|
27
|
+
const time = new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short", timeZone: "UTC" }).format(
|
|
28
|
+
new Date(iso),
|
|
29
|
+
);
|
|
30
|
+
return t("time.utc", { time });
|
|
31
|
+
} catch {
|
|
32
|
+
return iso;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
---
|
|
36
|
+
<section class="semics-events semics-attendee-list" data-testid="attendee-list" lang={lang} dir={dir} aria-labelledby="semics-attendees-title">
|
|
37
|
+
<h2 id="semics-attendees-title">{t("booking.attendees.title")}</h2>
|
|
38
|
+
<ul>
|
|
39
|
+
{
|
|
40
|
+
rows.map((row) => (
|
|
41
|
+
<li data-testid="attendee-row" data-seat={row.seat} data-signing={row.signed ? "signed" : "waiting"}>
|
|
42
|
+
<span class="semics-attendee-name" id={`semics-attendee-${row.seat}`}>{row.name}</span>
|
|
43
|
+
<span class="semics-status-badge">{row.signed ? t("booking.attendees.signed") : t("booking.attendees.waiting")}</span>
|
|
44
|
+
{row.minor && <p class="semics-attendee-note">{t("booking.attendees.minor")}</p>}
|
|
45
|
+
{row.canResend && row.email && (
|
|
46
|
+
<p class="semics-attendee-note">
|
|
47
|
+
{emailedBefore}<span>{row.email}</span>{emailedAfter}
|
|
48
|
+
</p>
|
|
49
|
+
)}
|
|
50
|
+
{(row.canSign || row.canResend) && (
|
|
51
|
+
<div class="semics-attendee-actions">
|
|
52
|
+
{row.canSign && (
|
|
53
|
+
<form method="post" action={action}>
|
|
54
|
+
<input type="hidden" name="intent" value="sign-now" />
|
|
55
|
+
<input type="hidden" name="seat" value={row.seat} />
|
|
56
|
+
<button type="submit" aria-describedby={`semics-attendee-${row.seat}`} data-testid="attendee-sign-now">
|
|
57
|
+
{t("booking.attendees.signNow")}
|
|
58
|
+
</button>
|
|
59
|
+
</form>
|
|
60
|
+
)}
|
|
61
|
+
{row.canResend && (
|
|
62
|
+
<form method="post" action={action}>
|
|
63
|
+
<input type="hidden" name="intent" value="resend" />
|
|
64
|
+
<input type="hidden" name="seat" value={row.seat} />
|
|
65
|
+
<button type="submit" aria-describedby={`semics-attendee-${row.seat}`} data-testid="attendee-resend">
|
|
66
|
+
{t("booking.attendees.resend")}
|
|
67
|
+
</button>
|
|
68
|
+
</form>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
</li>
|
|
73
|
+
))
|
|
74
|
+
}
|
|
75
|
+
</ul>
|
|
76
|
+
{
|
|
77
|
+
editable.length > 0 && (
|
|
78
|
+
<form method="post" action={action} class="semics-attendee-edit" data-testid="attendee-edit">
|
|
79
|
+
<input type="hidden" name="intent" value="attendees" />
|
|
80
|
+
<h3>{t("booking.attendees.edit")}</h3>
|
|
81
|
+
{editUntil && (
|
|
82
|
+
<p>
|
|
83
|
+
{untilBefore}<time datetime={editUntil}>{at(editUntil)}</time>{untilAfter}
|
|
84
|
+
</p>
|
|
85
|
+
)}
|
|
86
|
+
{editable.map((row) => (
|
|
87
|
+
<fieldset>
|
|
88
|
+
<legend>{row.name}</legend>
|
|
89
|
+
<label for={`semics-attendee-name-${row.seat}`}>{t("booking.attendees.name")}</label>
|
|
90
|
+
<input id={`semics-attendee-name-${row.seat}`} name={`name:${row.seat}`} value={row.name} required maxlength={200} autocomplete="off" />
|
|
91
|
+
{!row.minor && (
|
|
92
|
+
<>
|
|
93
|
+
<label for={`semics-attendee-email-${row.seat}`}>{t("booking.attendees.email")}</label>
|
|
94
|
+
<input id={`semics-attendee-email-${row.seat}`} name={`email:${row.seat}`} type="email" value={row.email} required maxlength={254} autocomplete="off" />
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</fieldset>
|
|
98
|
+
))}
|
|
99
|
+
<button type="submit" data-testid="attendee-save">{t("booking.attendees.save")}</button>
|
|
100
|
+
</form>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
</section>
|
|
104
|
+
|
|
105
|
+
<style>
|
|
106
|
+
.semics-attendee-list {
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
max-inline-size: 36rem;
|
|
109
|
+
color: var(--events-fg, #1a1a1a);
|
|
110
|
+
overflow-wrap: anywhere;
|
|
111
|
+
}
|
|
112
|
+
.semics-attendee-list ul {
|
|
113
|
+
list-style: none;
|
|
114
|
+
padding: 0;
|
|
115
|
+
}
|
|
116
|
+
.semics-attendee-list li {
|
|
117
|
+
padding-block: 0.5rem;
|
|
118
|
+
border-block-end: 1px solid var(--events-border, #6b6b6b);
|
|
119
|
+
}
|
|
120
|
+
.semics-attendee-name {
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
margin-inline-end: 0.5rem;
|
|
123
|
+
}
|
|
124
|
+
.semics-status-badge {
|
|
125
|
+
display: inline-block;
|
|
126
|
+
padding: 0.125rem 0.5rem;
|
|
127
|
+
border: 1px solid currentColor;
|
|
128
|
+
border-radius: var(--events-radius, 6px);
|
|
129
|
+
}
|
|
130
|
+
[data-signing="signed"] .semics-status-badge {
|
|
131
|
+
color: var(--events-success, #146c2e);
|
|
132
|
+
}
|
|
133
|
+
.semics-attendee-actions {
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-wrap: wrap;
|
|
136
|
+
gap: 0.5rem;
|
|
137
|
+
margin-block-start: 0.5rem;
|
|
138
|
+
}
|
|
139
|
+
.semics-attendee-list button,
|
|
140
|
+
.semics-attendee-list input {
|
|
141
|
+
font: inherit;
|
|
142
|
+
min-block-size: 2.75rem;
|
|
143
|
+
}
|
|
144
|
+
.semics-attendee-list button {
|
|
145
|
+
padding: 0.5rem 1rem;
|
|
146
|
+
}
|
|
147
|
+
.semics-attendee-edit fieldset {
|
|
148
|
+
display: grid;
|
|
149
|
+
gap: 0.25rem;
|
|
150
|
+
margin-block: 0.5rem;
|
|
151
|
+
}
|
|
152
|
+
.semics-attendee-edit input {
|
|
153
|
+
box-sizing: border-box;
|
|
154
|
+
inline-size: 100%;
|
|
155
|
+
padding: 0.25rem 0.5rem;
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The `events-booking` Portable Text block (BUILD-PLAN 3.3): renders <BookingWidget> for the event
|
|
3
|
+
// the editor picked. The block's `event` is the event entry's id or its slug; a slug is resolved to the
|
|
4
|
+
// entry id. A block with no event renders nothing.
|
|
5
|
+
import { getEmDashEntry } from "emdash";
|
|
6
|
+
|
|
7
|
+
import BookingWidget from "./BookingWidget.astro";
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
node?: { event?: string; heading?: string };
|
|
11
|
+
event?: string;
|
|
12
|
+
heading?: string;
|
|
13
|
+
locale?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = Astro.props as Props;
|
|
17
|
+
const ref = (props.node?.event ?? props.event ?? "").trim();
|
|
18
|
+
const heading = props.node?.heading ?? props.heading;
|
|
19
|
+
let eventId = ref;
|
|
20
|
+
if (ref) {
|
|
21
|
+
try {
|
|
22
|
+
const { entry } = await getEmDashEntry("events", ref);
|
|
23
|
+
const id = (entry?.data as { id?: unknown } | undefined)?.id;
|
|
24
|
+
if (typeof id === "string" && id) eventId = id;
|
|
25
|
+
} catch {
|
|
26
|
+
// Not a slug of a known entry: treat the value as the entry id.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
---
|
|
30
|
+
{eventId && <BookingWidget event={eventId} heading={heading || undefined} locale={props.locale} />}
|