@semics-tech/emdash-events 1.0.0-rc.5 → 1.0.0-rc.7
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/index.mjs +1 -1
- package/dist/manifest.json +1 -1
- package/dist/plugin.mjs +6 -6
- package/dist/ts/astro/lib/page.d.ts +4 -2
- package/dist/ts/astro/lib/page.js +40 -10
- package/package.json +3 -1
- package/src/astro/BookingPage.astro +19 -4
- package/src/astro/BookingStatus.astro +136 -43
- package/src/astro/BookingWidget.astro +115 -46
- package/src/astro/CancelBooking.astro +80 -0
- package/src/astro/PageOrganiser.astro +22 -0
- package/src/astro/TicketPass.astro +45 -15
- package/src/astro/lib/list.ts +14 -13
- package/src/astro/lib/page.ts +41 -11
- package/src/astro/lib/payment.ts +2 -0
- package/src/astro/lib/widget.ts +29 -4
- package/src/client/forget-form.ts +16 -0
- package/src/client/picker.ts +20 -9
- package/src/client/print.ts +12 -0
- package/src/i18n/ar.ts +8 -0
- package/src/i18n/en.ts +8 -0
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
export declare const THEME_PROPERTIES: readonly ["fg", "muted", "bg", "border", "accent", "accent-fg", "error", "success", "radius", "font", "page-bg", "heading-font", "heading-fg"];
|
|
12
12
|
export type ThemeProperty = (typeof THEME_PROPERTIES)[number];
|
|
13
13
|
export interface PageBrand {
|
|
14
|
-
/** The site's name: the link's text, or the logo's alternative text. */
|
|
14
|
+
/** The site's name: the link's text, or the logo's alternative text. Also the organiser at the page's foot. */
|
|
15
15
|
name: string;
|
|
16
16
|
/** Where it links, a path on this site (default `/`). */
|
|
17
17
|
href?: string;
|
|
18
18
|
/** A logo, a path on this site. */
|
|
19
19
|
logo?: string;
|
|
20
|
+
/** The organiser's postal address, one line, at the page's foot and on a printed booking (T157). */
|
|
21
|
+
address?: string;
|
|
20
22
|
}
|
|
21
23
|
export interface PageOptions {
|
|
22
24
|
/** Values for the pages' custom properties, for example `{ accent: "#1f3a2e", "page-bg": "#f6f1ea" }`. */
|
|
@@ -33,6 +35,6 @@ export declare function checkPageOptions(page?: PageOptions): PageOptions;
|
|
|
33
35
|
/** The event's page for "Book again"; undefined when the booking does not know its slug. */
|
|
34
36
|
export declare function eventPageHref(slug: string | null | undefined, eventPath?: string): string | undefined;
|
|
35
37
|
/** Works with no site theme at all. Zero specificity on elements, so the components' own rules win. */
|
|
36
|
-
export declare const PAGE_CSS = "*,*::before,*::after{box-sizing:border-box}\nhtml{color-scheme:light;-webkit-text-size-adjust:100%}\nbody.semics-page{margin:0;min-block-size:100vh;background:var(--events-page-bg, #f5f4f0);color:var(--events-fg, #1a1a1a);font-family:var(--events-font, system-ui, sans-serif);font-size:1.0625rem;line-height:1.55;overflow-wrap:anywhere;\n--esign-fg:var(--events-fg, #1a1a1a);--esign-muted:var(--events-muted, #4a4a4a);--esign-bg:var(--events-bg, #ffffff);--esign-border:var(--events-border, #6b6b6b);--esign-accent:var(--events-accent, #0b57d0);--esign-accent-fg:var(--events-accent-fg, #ffffff);--esign-error:var(--events-error, #b3261e);--esign-radius:var(--events-radius, 6px)}\n.semics-page-brand{max-inline-size:
|
|
38
|
+
export declare const PAGE_CSS = "*,*::before,*::after{box-sizing:border-box}\nhtml{color-scheme:light;-webkit-text-size-adjust:100%}\nbody.semics-page{margin:0;min-block-size:100vh;background:var(--events-page-bg, #f5f4f0);color:var(--events-fg, #1a1a1a);font-family:var(--events-font, system-ui, sans-serif);font-size:1.0625rem;line-height:1.55;overflow-wrap:anywhere;\n--esign-fg:var(--events-fg, #1a1a1a);--esign-muted:var(--events-muted, #4a4a4a);--esign-bg:var(--events-bg, #ffffff);--esign-border:var(--events-border, #6b6b6b);--esign-accent:var(--events-accent, #0b57d0);--esign-accent-fg:var(--events-accent-fg, #ffffff);--esign-error:var(--events-error, #b3261e);--esign-radius:var(--events-radius, 6px);--esign-font:var(--events-font, system-ui, sans-serif)}\n.semics-page-brand{max-inline-size:40rem;margin-inline:auto;padding:1.25rem 1rem 0;font-family:var(--events-heading-font, inherit);font-weight:600}\n.semics-page-brand a{color:var(--events-heading-fg, inherit);text-decoration:none}\n.semics-page-brand img{display:block;block-size:2.5rem;inline-size:auto;max-inline-size:100%}\n.semics-page-main{max-inline-size:40rem;margin-inline:auto;padding:1.5rem 1rem 2rem}\n:where(.semics-page) :is(h1,h2,h3){margin:0 0 .75rem;font-family:var(--events-heading-font, inherit);color:var(--events-heading-fg, inherit);line-height:1.2}\n:where(.semics-page) h1{margin-block-end:1.25rem;font-size:clamp(1.75rem,1.5rem + 1.5vw,2.25rem)}\n:where(.semics-page) h2{font-size:1.25rem}\n:where(.semics-page) h3{font-size:1.0625rem}\n:where(.semics-page) p{margin:0 0 .75rem}\n:where(.semics-page) a{color:var(--events-accent, #0b57d0);text-underline-offset:.2em}\n:where(.semics-page) :focus-visible{outline:3px solid var(--events-accent, #0b57d0);outline-offset:2px}\n:where(.semics-page-main > section,.semics-page-main > form:not([hidden]),.semics-page-main > .semics-ceremony){margin-block:0 1.25rem;padding:clamp(1.25rem,.9rem + 1.8vw,1.75rem);background:var(--events-bg, #ffffff);border:1px solid color-mix(in srgb,var(--events-border, #6b6b6b) 30%,transparent);border-radius:calc(var(--events-radius, 6px) + 6px);box-shadow:0 1px 2px rgb(0 0 0 / .04),0 6px 24px rgb(0 0 0 / .05);max-inline-size:none}\n:where(.semics-page-main > section,.semics-page-main > form,.semics-page-main > .semics-ceremony) > :last-child{margin-block-end:0}\n:where(.semics-page) [role=\"alert\"]{padding:.75rem 1rem;border:1px solid var(--events-error, #b3261e);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-error, #b3261e)}\n:where(.semics-page) :is(input:not([type=\"checkbox\"],[type=\"radio\"],[type=\"hidden\"]),select,textarea){font:inherit;inline-size:100%;min-block-size:2.75rem;padding:.5rem .75rem;border:1px solid var(--events-border, #6b6b6b);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-fg, #1a1a1a)}\n:where(.semics-page) label{display:block}\n:where(.semics-page) fieldset{min-inline-size:0;margin:0 0 1rem;padding:0;border:0}\n:where(.semics-page) legend{padding:0;margin-block-end:.5rem;font-weight:600}\n:where(.semics-page) button{font:inherit;font-weight:600;min-block-size:2.75rem;padding:.625rem 1.25rem;border:1px solid var(--events-accent, #0b57d0);border-radius:var(--events-radius, 6px);background:var(--events-accent, #0b57d0);color:var(--events-accent-fg, #ffffff);cursor:pointer}\n.semics-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1.25rem;margin-block:0 1.25rem}\n.semics-page-actions .semics-print{background:transparent;color:var(--events-accent, #0b57d0)}\n.semics-page-organiser{max-inline-size:40rem;margin-inline:auto;padding:0 1rem 3rem;color:var(--events-muted, #4a4a4a);font-size:.9375rem}\n.semics-page-organiser p{margin:0}\n.semics-page-organiser address{font-style:normal}\n@media print{\n@page{margin:15mm}\nbody.semics-page{min-block-size:0;background:#ffffff;color:#000000;font-size:11pt}\n.semics-page-brand,.semics-page-actions,.semics-page-main form,.semics-page-main button,.semics-page-main details,.semics-add-to-calendar,[data-semics-payment-live]{display:none !important}\n.semics-page-main{max-inline-size:none;padding:0}\n:where(.semics-page-main > section,.semics-page-main > .semics-ceremony){box-shadow:none;border-color:#999999;break-inside:avoid}\n.semics-ticket-pass{break-inside:avoid}\n.semics-page-organiser{max-inline-size:none;padding:1rem 0 0;color:#000000}\n}\n";
|
|
37
39
|
/** The stylesheet for a page: the defaults, then the site's theme. Exact: the signing page hashes this text. */
|
|
38
40
|
export declare function pageCss(page?: PageOptions): string;
|
|
@@ -24,9 +24,21 @@ export const THEME_PROPERTIES = [
|
|
|
24
24
|
"heading-font",
|
|
25
25
|
"heading-fg",
|
|
26
26
|
];
|
|
27
|
+
/** One line of text for people: 1 to 300 characters, no control characters (line breaks included). */
|
|
28
|
+
function oneLine(value) {
|
|
29
|
+
if (typeof value !== "string" || !value.trim() || value.length > 300)
|
|
30
|
+
return false;
|
|
31
|
+
for (let i = 0; i < value.length; i++) {
|
|
32
|
+
const unit = value.charCodeAt(i);
|
|
33
|
+
if (unit <= 0x1f || unit === 0x7f)
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
27
38
|
/** One line of CSS, nothing that could end the declaration, the rule or the `<style>` element. */
|
|
28
39
|
const THEME_VALUE = /^[^;{}<>\\@]{1,200}$/;
|
|
29
|
-
|
|
40
|
+
/** A path on this site; `;` and `,` would end a source in the signing page's CSP header. */
|
|
41
|
+
const SITE_PATH = /^\/(?!\/)[^\s"'<>\\;,]*$/;
|
|
30
42
|
/** Checks a site's page options when the site's config loads; a bad value stops the build with its name. */
|
|
31
43
|
export function checkPageOptions(page = {}) {
|
|
32
44
|
const refuse = (what) => {
|
|
@@ -49,6 +61,8 @@ export function checkPageOptions(page = {}) {
|
|
|
49
61
|
refuse("brand.href");
|
|
50
62
|
if (brand.logo !== undefined && !SITE_PATH.test(brand.logo))
|
|
51
63
|
refuse("brand.logo");
|
|
64
|
+
if (brand.address !== undefined && !oneLine(brand.address))
|
|
65
|
+
refuse("brand.address");
|
|
52
66
|
}
|
|
53
67
|
return page;
|
|
54
68
|
}
|
|
@@ -60,24 +74,40 @@ export function eventPageHref(slug, eventPath) {
|
|
|
60
74
|
export const PAGE_CSS = `*,*::before,*::after{box-sizing:border-box}
|
|
61
75
|
html{color-scheme:light;-webkit-text-size-adjust:100%}
|
|
62
76
|
body.semics-page{margin:0;min-block-size:100vh;background:var(--events-page-bg, #f5f4f0);color:var(--events-fg, #1a1a1a);font-family:var(--events-font, system-ui, sans-serif);font-size:1.0625rem;line-height:1.55;overflow-wrap:anywhere;
|
|
63
|
-
--esign-fg:var(--events-fg, #1a1a1a);--esign-muted:var(--events-muted, #4a4a4a);--esign-bg:var(--events-bg, #ffffff);--esign-border:var(--events-border, #6b6b6b);--esign-accent:var(--events-accent, #0b57d0);--esign-accent-fg:var(--events-accent-fg, #ffffff);--esign-error:var(--events-error, #b3261e);--esign-radius:var(--events-radius, 6px)}
|
|
64
|
-
.semics-page-brand{max-inline-size:
|
|
77
|
+
--esign-fg:var(--events-fg, #1a1a1a);--esign-muted:var(--events-muted, #4a4a4a);--esign-bg:var(--events-bg, #ffffff);--esign-border:var(--events-border, #6b6b6b);--esign-accent:var(--events-accent, #0b57d0);--esign-accent-fg:var(--events-accent-fg, #ffffff);--esign-error:var(--events-error, #b3261e);--esign-radius:var(--events-radius, 6px);--esign-font:var(--events-font, system-ui, sans-serif)}
|
|
78
|
+
.semics-page-brand{max-inline-size:40rem;margin-inline:auto;padding:1.25rem 1rem 0;font-family:var(--events-heading-font, inherit);font-weight:600}
|
|
65
79
|
.semics-page-brand a{color:var(--events-heading-fg, inherit);text-decoration:none}
|
|
66
80
|
.semics-page-brand img{display:block;block-size:2.5rem;inline-size:auto;max-inline-size:100%}
|
|
67
|
-
.semics-page-main{max-inline-size:
|
|
81
|
+
.semics-page-main{max-inline-size:40rem;margin-inline:auto;padding:1.5rem 1rem 2rem}
|
|
68
82
|
:where(.semics-page) :is(h1,h2,h3){margin:0 0 .75rem;font-family:var(--events-heading-font, inherit);color:var(--events-heading-fg, inherit);line-height:1.2}
|
|
69
|
-
:where(.semics-page) h1{font-size:clamp(1.75rem,1.5rem + 1.5vw,2.25rem)}
|
|
83
|
+
:where(.semics-page) h1{margin-block-end:1.25rem;font-size:clamp(1.75rem,1.5rem + 1.5vw,2.25rem)}
|
|
70
84
|
:where(.semics-page) h2{font-size:1.25rem}
|
|
71
85
|
:where(.semics-page) h3{font-size:1.0625rem}
|
|
72
86
|
:where(.semics-page) p{margin:0 0 .75rem}
|
|
73
87
|
:where(.semics-page) a{color:var(--events-accent, #0b57d0);text-underline-offset:.2em}
|
|
74
88
|
:where(.semics-page) :focus-visible{outline:3px solid var(--events-accent, #0b57d0);outline-offset:2px}
|
|
75
|
-
:where(.semics-page-main
|
|
76
|
-
:where(.semics-page
|
|
77
|
-
:where(.semics-page)
|
|
89
|
+
:where(.semics-page-main > section,.semics-page-main > form:not([hidden]),.semics-page-main > .semics-ceremony){margin-block:0 1.25rem;padding:clamp(1.25rem,.9rem + 1.8vw,1.75rem);background:var(--events-bg, #ffffff);border:1px solid color-mix(in srgb,var(--events-border, #6b6b6b) 30%,transparent);border-radius:calc(var(--events-radius, 6px) + 6px);box-shadow:0 1px 2px rgb(0 0 0 / .04),0 6px 24px rgb(0 0 0 / .05);max-inline-size:none}
|
|
90
|
+
:where(.semics-page-main > section,.semics-page-main > form,.semics-page-main > .semics-ceremony) > :last-child{margin-block-end:0}
|
|
91
|
+
:where(.semics-page) [role="alert"]{padding:.75rem 1rem;border:1px solid var(--events-error, #b3261e);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-error, #b3261e)}
|
|
92
|
+
:where(.semics-page) :is(input:not([type="checkbox"],[type="radio"],[type="hidden"]),select,textarea){font:inherit;inline-size:100%;min-block-size:2.75rem;padding:.5rem .75rem;border:1px solid var(--events-border, #6b6b6b);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-fg, #1a1a1a)}
|
|
78
93
|
:where(.semics-page) label{display:block}
|
|
79
|
-
:where(.semics-page) fieldset{min-inline-size:0;margin:0 0
|
|
80
|
-
:where(.semics-page)
|
|
94
|
+
:where(.semics-page) fieldset{min-inline-size:0;margin:0 0 1rem;padding:0;border:0}
|
|
95
|
+
:where(.semics-page) legend{padding:0;margin-block-end:.5rem;font-weight:600}
|
|
96
|
+
:where(.semics-page) button{font:inherit;font-weight:600;min-block-size:2.75rem;padding:.625rem 1.25rem;border:1px solid var(--events-accent, #0b57d0);border-radius:var(--events-radius, 6px);background:var(--events-accent, #0b57d0);color:var(--events-accent-fg, #ffffff);cursor:pointer}
|
|
97
|
+
.semics-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1.25rem;margin-block:0 1.25rem}
|
|
98
|
+
.semics-page-actions .semics-print{background:transparent;color:var(--events-accent, #0b57d0)}
|
|
99
|
+
.semics-page-organiser{max-inline-size:40rem;margin-inline:auto;padding:0 1rem 3rem;color:var(--events-muted, #4a4a4a);font-size:.9375rem}
|
|
100
|
+
.semics-page-organiser p{margin:0}
|
|
101
|
+
.semics-page-organiser address{font-style:normal}
|
|
102
|
+
@media print{
|
|
103
|
+
@page{margin:15mm}
|
|
104
|
+
body.semics-page{min-block-size:0;background:#ffffff;color:#000000;font-size:11pt}
|
|
105
|
+
.semics-page-brand,.semics-page-actions,.semics-page-main form,.semics-page-main button,.semics-page-main details,.semics-add-to-calendar,[data-semics-payment-live]{display:none !important}
|
|
106
|
+
.semics-page-main{max-inline-size:none;padding:0}
|
|
107
|
+
:where(.semics-page-main > section,.semics-page-main > .semics-ceremony){box-shadow:none;border-color:#999999;break-inside:avoid}
|
|
108
|
+
.semics-ticket-pass{break-inside:avoid}
|
|
109
|
+
.semics-page-organiser{max-inline-size:none;padding:1rem 0 0;color:#000000}
|
|
110
|
+
}
|
|
81
111
|
`;
|
|
82
112
|
/** The stylesheet for a page: the defaults, then the site's theme. Exact: the signing page hashes this text. */
|
|
83
113
|
export function pageCss(page = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semics-tech/emdash-events",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"./client/*": "./src/client/*.ts",
|
|
27
27
|
"./astro/BookingPage.astro": "./src/astro/BookingPage.astro",
|
|
28
28
|
"./astro/PageBrand.astro": "./src/astro/PageBrand.astro",
|
|
29
|
+
"./astro/PageOrganiser.astro": "./src/astro/PageOrganiser.astro",
|
|
30
|
+
"./astro/CancelBooking.astro": "./src/astro/CancelBooking.astro",
|
|
29
31
|
"./astro/DoorSignPage.astro": "./src/astro/DoorSignPage.astro",
|
|
30
32
|
"./astro/CheckIn.astro": "./src/astro/CheckIn.astro",
|
|
31
33
|
"./astro/OptOutPage.astro": "./src/astro/OptOutPage.astro",
|
|
@@ -13,7 +13,9 @@ import { esignPluginId, page, pluginId, reconcile } from "virtual:semics-events/
|
|
|
13
13
|
import { type MessageKey, pickLocale, translator } from "../i18n/index";
|
|
14
14
|
import AddToCalendar from "./AddToCalendar.astro";
|
|
15
15
|
import BookingStatus from "./BookingStatus.astro";
|
|
16
|
+
import CancelBooking from "./CancelBooking.astro";
|
|
16
17
|
import PageBrand from "./PageBrand.astro";
|
|
18
|
+
import PageOrganiser from "./PageOrganiser.astro";
|
|
17
19
|
import PaymentReturn from "./PaymentReturn.astro";
|
|
18
20
|
import { callPublicRoute } from "./lib/call";
|
|
19
21
|
import {
|
|
@@ -32,7 +34,7 @@ import { handleAttendeeAction, signingRows } from "./lib/attendees";
|
|
|
32
34
|
import { eventPageHref, pageCss } from "./lib/page";
|
|
33
35
|
import { paymentView } from "./lib/payment";
|
|
34
36
|
import { forwardReceipt } from "./lib/receipt";
|
|
35
|
-
import { type BookingView, type PublicEvent, reconcileWanted, ticketNames } from "./lib/widget";
|
|
37
|
+
import { asOfNow, type BookingView, type PublicEvent, reconcileWanted, ticketNames } from "./lib/widget";
|
|
36
38
|
import TicketPass from "./TicketPass.astro";
|
|
37
39
|
|
|
38
40
|
export const prerender = false;
|
|
@@ -156,6 +158,7 @@ if (ref && token) {
|
|
|
156
158
|
} else if (ref && !opening) {
|
|
157
159
|
missing = true;
|
|
158
160
|
}
|
|
161
|
+
if (booking) booking = asOfNow(booking, Date.now());
|
|
159
162
|
// The attendee signing list's forms (T133): Sign now, Resend and Save, against the fresh answer.
|
|
160
163
|
if (booking && form && ref && token) {
|
|
161
164
|
const done = await handleAttendeeAction(ctx, form, { ref, token }, { pluginId, esignPluginId }, booking);
|
|
@@ -169,7 +172,8 @@ if (booking?.eventId) {
|
|
|
169
172
|
}
|
|
170
173
|
const signingList = booking && !cancelled ? signingRows(booking) : null;
|
|
171
174
|
const payment = booking && !cancelled ? paymentView(booking, locale) : null;
|
|
172
|
-
const
|
|
175
|
+
const confirmed = Boolean(booking && !cancelled && booking.status === "confirmed");
|
|
176
|
+
const passes = booking && confirmed ? booking.attendees.filter((a) => a.code) : [];
|
|
173
177
|
---
|
|
174
178
|
<!doctype html>
|
|
175
179
|
<html lang={lang} dir={dir}>
|
|
@@ -201,7 +205,7 @@ const passes = booking && !cancelled && booking.status === "confirmed" ? booking
|
|
|
201
205
|
</form>
|
|
202
206
|
) : booking ? (
|
|
203
207
|
<>
|
|
204
|
-
<BookingStatus booking={booking} cancelled={cancelled}
|
|
208
|
+
<BookingStatus booking={booking} cancelled={cancelled} ticketNames={names} bookAgain={eventPageHref(booking.event?.slug, page.eventPath)} showAttendees={!signingList} locale={locale} />
|
|
205
209
|
{payment && <PaymentReturn view={payment} bookingRef={ref} action={`/booking?ref=${ref}`} locale={locale} />}
|
|
206
210
|
{signingList && (
|
|
207
211
|
<AttendeeList
|
|
@@ -220,7 +224,15 @@ const passes = booking && !cancelled && booking.status === "confirmed" ? booking
|
|
|
220
224
|
))}
|
|
221
225
|
</section>
|
|
222
226
|
)}
|
|
223
|
-
{
|
|
227
|
+
{confirmed && (
|
|
228
|
+
<div class="semics-page-actions" data-testid="booking-actions">
|
|
229
|
+
<AddToCalendar signedQuery={booking.calendar?.query} locale={locale} />
|
|
230
|
+
<button type="button" class="semics-print" data-print data-testid="booking-print" hidden>{t("booking.print")}</button>
|
|
231
|
+
</div>
|
|
232
|
+
)}
|
|
233
|
+
{booking.canCancel && !cancelled && (
|
|
234
|
+
<CancelBooking action={`/booking?ref=${ref}`} cancelBy={booking.cancelBy} zone={booking.event?.timezone} locale={locale} />
|
|
235
|
+
)}
|
|
224
236
|
</>
|
|
225
237
|
) : missing ? (
|
|
226
238
|
<p data-testid="booking-missing">{t("booking.missing")}</p>
|
|
@@ -229,9 +241,12 @@ const passes = booking && !cancelled && booking.status === "confirmed" ? booking
|
|
|
229
241
|
) : null
|
|
230
242
|
}
|
|
231
243
|
</main>
|
|
244
|
+
<PageOrganiser brand={page.brand} locale={locale} />
|
|
232
245
|
<script>
|
|
233
246
|
import "../client/receipt.ts";
|
|
234
247
|
import "../client/payment.ts";
|
|
248
|
+
import "../client/forget-form.ts";
|
|
249
|
+
import "../client/print.ts";
|
|
235
250
|
</script>
|
|
236
251
|
</body>
|
|
237
252
|
</html>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
// <BookingStatus>: a booking's
|
|
3
|
-
//
|
|
2
|
+
// <BookingStatus>: a booking's summary card (EU-FR-06). Rendered by the `/booking` page from the
|
|
3
|
+
// `public/booking` answer. It leads with the event and the booked session, in the event's zone, and the
|
|
4
|
+
// place (T157), then the state, the order and its total. With `cancelAction` it ends with the quiet cancel
|
|
5
|
+
// action (`<CancelBooking>`); the booking page instead puts that at its foot.
|
|
4
6
|
import { around, pickLocale, translator } from "../i18n/index";
|
|
7
|
+
import CancelBooking from "./CancelBooking.astro";
|
|
5
8
|
import { zonedAt } from "./lib/list";
|
|
6
9
|
import { type BookingView, endedNotes, formatMoney, statusLabel } from "./lib/widget";
|
|
7
10
|
|
|
@@ -9,16 +12,18 @@ interface Props {
|
|
|
9
12
|
booking: BookingView;
|
|
10
13
|
/** Shown as cancelled (the page just cancelled it). */
|
|
11
14
|
cancelled?: boolean;
|
|
12
|
-
/** Where the cancel form posts. */
|
|
15
|
+
/** Where the cancel form posts; without it the card has no cancel action. */
|
|
13
16
|
cancelAction?: string;
|
|
14
17
|
/** Ticket type names by id, when the page knows them. */
|
|
15
18
|
ticketNames?: Record<string, string>;
|
|
16
19
|
/** A lapsed booking's way back: the event's page, when known. */
|
|
17
20
|
bookAgain?: string;
|
|
21
|
+
/** List the attendees' names (the page turns it off when Events Pro's signing list shows them). */
|
|
22
|
+
showAttendees?: boolean;
|
|
18
23
|
locale?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
const { booking, cancelled = false, cancelAction, ticketNames = {}, bookAgain } = Astro.props;
|
|
26
|
+
const { booking, cancelled = false, cancelAction, ticketNames = {}, bookAgain, showAttendees = true } = Astro.props;
|
|
22
27
|
const locale = pickLocale(Astro.props.locale, Astro.currentLocale);
|
|
23
28
|
const { t, plural, lang, dir } = translator(locale);
|
|
24
29
|
// A request awaiting approval (T131) holds its places until the organiser's deadline.
|
|
@@ -26,52 +31,69 @@ const [heldBefore, heldAfter] = around(
|
|
|
26
31
|
t(booking.status === "awaiting_approval" ? "booking.decideBy" : "booking.heldUntil"),
|
|
27
32
|
"time",
|
|
28
33
|
);
|
|
29
|
-
const [cancelBefore, cancelAfter] = around(t("booking.cancelUntil"), "time");
|
|
30
34
|
const tickets = booking.lines.reduce((n, line) => n + line.qty, 0);
|
|
31
35
|
const status = cancelled ? "cancelled" : booking.status;
|
|
32
|
-
const
|
|
36
|
+
const zone = booking.event?.timezone;
|
|
37
|
+
const at = (iso: string) => zonedAt(iso, zone, locale);
|
|
33
38
|
const notes = endedNotes({ ...booking, status }, locale);
|
|
39
|
+
const event = booking.event;
|
|
40
|
+
const startsAt = event?.startsAt && Number.isFinite(Date.parse(event.startsAt)) ? event.startsAt : undefined;
|
|
41
|
+
// Who is coming, when the booking names different people (a plain booking puts every seat in the buyer's name).
|
|
42
|
+
const named = booking.attendees.map((a) => a.name).filter(Boolean);
|
|
43
|
+
const names = showAttendees && new Set(named).size > 1 ? named : [];
|
|
34
44
|
---
|
|
35
45
|
<section class="semics-events semics-booking-status" data-testid="booking-details" data-status={status} lang={lang} dir={dir} aria-labelledby="semics-booking-status-title">
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
{event?.title ? (
|
|
47
|
+
<h2 id="semics-booking-status-title" class="semics-booking-event" data-testid="booking-event">{event.title}</h2>
|
|
48
|
+
) : (
|
|
49
|
+
<h2 id="semics-booking-status-title" class="semics-visually-hidden">{t("booking.status")}</h2>
|
|
50
|
+
)}
|
|
51
|
+
{(startsAt || event?.venue) && (
|
|
52
|
+
<div class="semics-booking-session" data-testid="booking-session">
|
|
53
|
+
{startsAt && <p class="semics-booking-when"><time datetime={startsAt} data-testid="booking-when">{at(startsAt)}</time></p>}
|
|
54
|
+
{event?.venue && <p class="semics-booking-venue" data-testid="booking-venue">{event.venue}</p>}
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
<div class="semics-booking-meta">
|
|
58
|
+
<p class="semics-status" data-testid="booking-status" data-status={status}>
|
|
59
|
+
<span class="semics-status-badge">{statusLabel(status, locale)}</span>
|
|
60
|
+
</p>
|
|
61
|
+
<p class="semics-booking-ref">
|
|
62
|
+
{t("booking.reference")} <strong data-testid="booking-ref">{booking.bookingRef}</strong>
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
43
65
|
{
|
|
44
66
|
!cancelled && booking.holdExpiresAt && (
|
|
45
|
-
<p data-testid="booking-hold">
|
|
67
|
+
<p class="semics-booking-note" data-testid="booking-hold">
|
|
46
68
|
{heldBefore}<time datetime={booking.holdExpiresAt}>{at(booking.holdExpiresAt)}</time>{heldAfter}
|
|
47
69
|
</p>
|
|
48
70
|
)
|
|
49
71
|
}
|
|
50
|
-
{notes.map((note) => <p data-testid="booking-note">{note}</p>)}
|
|
72
|
+
{notes.map((note) => <p class="semics-booking-note" data-testid="booking-note">{note}</p>)}
|
|
51
73
|
{status === "expired" && bookAgain && <p><a href={bookAgain} data-testid="booking-book-again">{t("booking.bookAgain")}</a></p>}
|
|
52
|
-
<
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
<div class="semics-booking-order">
|
|
75
|
+
<ul class="semics-lines" aria-label={plural("booking.lines", tickets)}>
|
|
76
|
+
{
|
|
77
|
+
booking.lines.map((line) => (
|
|
78
|
+
<li>
|
|
79
|
+
{ticketNames[line.ticketTypeId]
|
|
80
|
+
? t("booking.line", { qty: new Intl.NumberFormat(locale).format(line.qty), name: ticketNames[line.ticketTypeId] })
|
|
81
|
+
: plural("booking.lines", line.qty)}
|
|
82
|
+
</li>
|
|
83
|
+
))
|
|
84
|
+
}
|
|
85
|
+
</ul>
|
|
86
|
+
{names.length > 0 && (
|
|
87
|
+
<div class="semics-booking-people" data-testid="booking-attendees">
|
|
88
|
+
<h3>{t("booking.attendeesHeading")}</h3>
|
|
89
|
+
<ul>{names.map((name) => <li>{name}</li>)}</ul>
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
<p class="semics-booking-total">{t("booking.total")} <strong>{formatMoney(booking.totals.totalMinor, booking.totals.currency, locale)}</strong></p>
|
|
93
|
+
</div>
|
|
64
94
|
{
|
|
65
95
|
booking.canCancel && !cancelled && cancelAction && (
|
|
66
|
-
<
|
|
67
|
-
<input type="hidden" name="intent" value="cancel" />
|
|
68
|
-
{booking.cancelBy && (
|
|
69
|
-
<p>
|
|
70
|
-
{cancelBefore}<time datetime={booking.cancelBy}>{at(booking.cancelBy)}</time>{cancelAfter}
|
|
71
|
-
</p>
|
|
72
|
-
)}
|
|
73
|
-
<button type="submit">{t("booking.cancel")}</button>
|
|
74
|
-
</form>
|
|
96
|
+
<CancelBooking action={cancelAction} cancelBy={booking.cancelBy} zone={zone} locale={locale} />
|
|
75
97
|
)
|
|
76
98
|
}
|
|
77
99
|
</section>
|
|
@@ -79,24 +101,95 @@ const notes = endedNotes({ ...booking, status }, locale);
|
|
|
79
101
|
<style>
|
|
80
102
|
.semics-booking-status {
|
|
81
103
|
box-sizing: border-box;
|
|
82
|
-
max-inline-size: 36rem;
|
|
83
104
|
color: var(--events-fg, #1a1a1a);
|
|
84
105
|
overflow-wrap: anywhere;
|
|
85
106
|
}
|
|
107
|
+
.semics-booking-status p {
|
|
108
|
+
margin: 0 0 0.5rem;
|
|
109
|
+
}
|
|
110
|
+
.semics-booking-status .semics-booking-event {
|
|
111
|
+
margin: 0 0 0.5rem;
|
|
112
|
+
font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
|
|
113
|
+
line-height: 1.2;
|
|
114
|
+
}
|
|
115
|
+
.semics-booking-session {
|
|
116
|
+
margin-block-end: 1.25rem;
|
|
117
|
+
}
|
|
118
|
+
.semics-booking-status .semics-booking-when {
|
|
119
|
+
margin: 0;
|
|
120
|
+
font-size: 1.125rem;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
}
|
|
123
|
+
.semics-booking-status .semics-booking-venue {
|
|
124
|
+
margin: 0;
|
|
125
|
+
color: var(--events-muted, #4a4a4a);
|
|
126
|
+
}
|
|
127
|
+
.semics-booking-meta {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 0.5rem 1rem;
|
|
132
|
+
margin-block-end: 0.75rem;
|
|
133
|
+
}
|
|
134
|
+
.semics-booking-meta p {
|
|
135
|
+
margin: 0;
|
|
136
|
+
}
|
|
137
|
+
.semics-booking-ref {
|
|
138
|
+
color: var(--events-muted, #4a4a4a);
|
|
139
|
+
}
|
|
140
|
+
.semics-booking-ref strong {
|
|
141
|
+
color: var(--events-fg, #1a1a1a);
|
|
142
|
+
letter-spacing: 0.04em;
|
|
143
|
+
}
|
|
86
144
|
.semics-status-badge {
|
|
87
145
|
display: inline-block;
|
|
88
|
-
padding: 0.125rem 0.
|
|
146
|
+
padding: 0.125rem 0.625rem;
|
|
89
147
|
border: 1px solid currentColor;
|
|
90
|
-
border-radius:
|
|
148
|
+
border-radius: 999px;
|
|
149
|
+
font-size: 0.875rem;
|
|
91
150
|
font-weight: 600;
|
|
92
151
|
}
|
|
93
152
|
.semics-booking-status[data-status="confirmed"] .semics-status-badge {
|
|
94
153
|
color: var(--events-success, #146c2e);
|
|
95
154
|
}
|
|
96
|
-
.semics-booking-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
155
|
+
.semics-booking-note {
|
|
156
|
+
color: var(--events-muted, #4a4a4a);
|
|
157
|
+
}
|
|
158
|
+
.semics-booking-order {
|
|
159
|
+
margin-block-start: 1.25rem;
|
|
160
|
+
padding-block-start: 1rem;
|
|
161
|
+
border-block-start: 1px solid color-mix(in srgb, var(--events-border, #6b6b6b) 30%, transparent);
|
|
162
|
+
}
|
|
163
|
+
.semics-lines {
|
|
164
|
+
margin: 0 0 0.75rem;
|
|
165
|
+
padding: 0;
|
|
166
|
+
list-style: none;
|
|
167
|
+
}
|
|
168
|
+
.semics-lines li + li {
|
|
169
|
+
margin-block-start: 0.25rem;
|
|
170
|
+
}
|
|
171
|
+
.semics-booking-people h3 {
|
|
172
|
+
margin: 0 0 0.25rem;
|
|
173
|
+
font-size: 0.8125rem;
|
|
174
|
+
letter-spacing: 0.06em;
|
|
175
|
+
text-transform: uppercase;
|
|
176
|
+
color: var(--events-muted, #4a4a4a);
|
|
177
|
+
}
|
|
178
|
+
.semics-booking-people ul {
|
|
179
|
+
margin: 0 0 0.75rem;
|
|
180
|
+
padding-inline-start: 1.25rem;
|
|
181
|
+
}
|
|
182
|
+
.semics-booking-status .semics-booking-total {
|
|
183
|
+
display: flex;
|
|
184
|
+
justify-content: space-between;
|
|
185
|
+
gap: 1rem;
|
|
186
|
+
margin: 0;
|
|
187
|
+
padding-block-start: 0.75rem;
|
|
188
|
+
border-block-start: 1px solid color-mix(in srgb, var(--events-border, #6b6b6b) 30%, transparent);
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
}
|
|
191
|
+
.semics-booking-total strong {
|
|
192
|
+
font-size: 1.125rem;
|
|
100
193
|
}
|
|
101
194
|
.semics-visually-hidden {
|
|
102
195
|
position: absolute;
|