@semics-tech/emdash-events 1.0.0-rc.2 → 1.0.0-rc.20
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/README.md +1 -1
- package/dist/index.mjs +6 -1
- package/dist/manifest.json +6 -1
- package/dist/plugin.mjs +7 -6
- package/dist/ts/astro/lib/call.d.ts +2 -0
- package/dist/ts/astro/lib/call.js +2 -0
- package/dist/ts/astro/lib/page.d.ts +44 -0
- package/dist/ts/astro/lib/page.js +123 -0
- package/dist/ts/integration/index.d.ts +13 -0
- package/dist/ts/integration/index.js +13 -0
- package/emdash-plugin.jsonc +5 -0
- package/package.json +6 -2
- package/src/astro/AttendeeList.astro +9 -12
- package/src/astro/BookingPage.astro +71 -10
- package/src/astro/BookingStatus.astro +204 -53
- package/src/astro/BookingWidget.astro +226 -52
- package/src/astro/CancelBooking.astro +80 -0
- package/src/astro/PageBrand.astro +18 -0
- package/src/astro/PageOrganiser.astro +22 -0
- package/src/astro/TicketPass.astro +131 -33
- package/src/astro/checkout-endpoint.ts +21 -3
- package/src/astro/lib/attendees.ts +52 -4
- package/src/astro/lib/book-link.ts +46 -0
- package/src/astro/lib/call.ts +4 -0
- package/src/astro/lib/checkout-form.ts +49 -1
- package/src/astro/lib/list.ts +22 -0
- package/src/astro/lib/page.ts +143 -0
- package/src/astro/lib/pass.ts +9 -0
- package/src/astro/lib/payment.ts +6 -10
- package/src/astro/lib/widget.ts +113 -5
- package/src/astro/virtual.d.ts +25 -1
- 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 +46 -1
- package/src/i18n/en.ts +47 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { pluginId } from "virtual:semics-events/config";
|
|
7
7
|
|
|
8
8
|
import { pickLocale, translator } from "../i18n/index";
|
|
9
|
+
import { bookAnchor, presetTicketType, presetVoucher } from "./lib/book-link";
|
|
9
10
|
import { callPublicRoute } from "./lib/call";
|
|
10
11
|
import { CHECKOUT_PATH, QTY_PREFIX } from "./lib/checkout-form";
|
|
11
12
|
import { pickerFetchFrom, pickerHref, pickerParam, pickerView, usesPicker } from "./lib/picker";
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
newIdempotencyKey,
|
|
21
22
|
type PublicEvent,
|
|
22
23
|
readWidgetState,
|
|
24
|
+
requestDates,
|
|
23
25
|
safeReturnTo,
|
|
24
26
|
type WidgetField,
|
|
25
27
|
} from "./lib/widget";
|
|
@@ -61,6 +63,9 @@ const id = anchorId(eventId);
|
|
|
61
63
|
// Promo codes are Events Pro's (T078): the field shows only when the core says it takes them. An
|
|
62
64
|
// applied code lives in an HttpOnly cookie (`/_events/promo`), never the URL, and is checked again here.
|
|
63
65
|
const takesCodes = data?.promoCodes === true;
|
|
66
|
+
// Gift vouchers (T166): only Events Pro paired with Vouchers says so. The code goes with the order; the
|
|
67
|
+
// checkout holds it with Vouchers between reserve and continue, and never puts it in a URL.
|
|
68
|
+
const takesVouchers = data?.vouchers === true;
|
|
64
69
|
let promo: PromoView | null = Astro.props.promo ?? null;
|
|
65
70
|
if (takesCodes && Astro.props.promo === undefined) {
|
|
66
71
|
let code = "";
|
|
@@ -83,12 +88,33 @@ const ticketTypes = [
|
|
|
83
88
|
...(takesCodes ? (promo?.hiddenTypes ?? []) : []).filter((t) => !listed.has(t.id)),
|
|
84
89
|
] as PublicEvent["ticketTypes"];
|
|
85
90
|
const onSale = data?.status === "on_sale" && ticketTypes.length > 0;
|
|
91
|
+
// "Book with this voucher" (T171): the voucher page left the code in an HttpOnly cookie (never a URL) and may
|
|
92
|
+
// name a ticket type, which starts at one ticket. A page that filled in a code must not be cached.
|
|
93
|
+
let presetCode = "";
|
|
94
|
+
if (takesVouchers) {
|
|
95
|
+
presetCode = presetVoucher(Astro.cookies);
|
|
96
|
+
if (presetCode) {
|
|
97
|
+
try {
|
|
98
|
+
Astro.response.headers.set("Cache-Control", "private, no-store");
|
|
99
|
+
} catch {
|
|
100
|
+
// Headers already sent: the cookie only reaches the buyer who has it.
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const presetType = presetTicketType(
|
|
105
|
+
Astro.url,
|
|
106
|
+
ticketTypes.filter((t) => t.available !== 0).map((t) => t.id),
|
|
107
|
+
);
|
|
86
108
|
// Many dates a day, or a slot schedule (T130): a month calendar of days, then the day's times. Without
|
|
87
109
|
// JavaScript the same month's dates show as a select grouped by day.
|
|
88
110
|
const zone = data?.timezone ?? "UTC";
|
|
89
111
|
const picker = usesPicker(data, zone)
|
|
90
112
|
? pickerView(occurrences, { zone, locale, start: pickerStart, now: Date.now(), more: data?.more === true })
|
|
91
113
|
: null;
|
|
114
|
+
// Booking requests (T174a): the dates the event takes (allowed weekdays, notice, days ahead, not closed) as a
|
|
115
|
+
// select that works without JavaScript, then the time windows as radios; the form posts `request`.
|
|
116
|
+
const requests = data?.requests;
|
|
117
|
+
const requestDays = requests ? requestDates(requests, zone, Date.now(), locale) : [];
|
|
92
118
|
const pickerIds = new Set(picker?.days.flatMap((d) => d.slots.map((s) => s.id)));
|
|
93
119
|
const monthId = `${id}-month`;
|
|
94
120
|
// The waitlist (T081): offered when the core takes one and the tickets, or some dates, are sold out.
|
|
@@ -130,6 +156,7 @@ const when = (iso: string) => {
|
|
|
130
156
|
</form>
|
|
131
157
|
)}
|
|
132
158
|
<form
|
|
159
|
+
id={bookAnchor(eventId)}
|
|
133
160
|
method="post"
|
|
134
161
|
action={CHECKOUT_PATH}
|
|
135
162
|
data-semics-booking
|
|
@@ -140,6 +167,11 @@ const when = (iso: string) => {
|
|
|
140
167
|
data-turnstile-message={siteKey ? t("widget.turnstile") : undefined}
|
|
141
168
|
>
|
|
142
169
|
<p class="semics-form-alert" role="alert" data-form-alert hidden={!formAlert}>{formAlert}</p>
|
|
170
|
+
{takesVouchers && (
|
|
171
|
+
<p class="semics-have-voucher">
|
|
172
|
+
<a href={`#${id}-voucher`} data-testid="have-voucher">{t("widget.voucher.have")}</a>
|
|
173
|
+
</p>
|
|
174
|
+
)}
|
|
143
175
|
<input type="hidden" name="eventId" value={eventId} />
|
|
144
176
|
<input type="hidden" name="returnTo" value={returnTo} />
|
|
145
177
|
<input type="hidden" name="idempotencyKey" value={newIdempotencyKey()} />
|
|
@@ -181,7 +213,7 @@ const when = (iso: string) => {
|
|
|
181
213
|
aria-invalid={invalid("occurrence")}
|
|
182
214
|
aria-describedby={errId("occurrence")}
|
|
183
215
|
>
|
|
184
|
-
<legend>{t("widget.date")}</legend>
|
|
216
|
+
<legend class="semics-visually-hidden">{t("widget.date")}</legend>
|
|
185
217
|
<table role="grid" class="semics-calendar" aria-labelledby={monthId}>
|
|
186
218
|
<thead>
|
|
187
219
|
<tr>
|
|
@@ -267,6 +299,38 @@ const when = (iso: string) => {
|
|
|
267
299
|
</div>
|
|
268
300
|
)}
|
|
269
301
|
|
|
302
|
+
{requests && (
|
|
303
|
+
<>
|
|
304
|
+
<div class="semics-field">
|
|
305
|
+
<input type="hidden" name="needsRequest" value="1" />
|
|
306
|
+
<label for={`${id}-occurrence`}>{t("widget.date")}</label>
|
|
307
|
+
<select
|
|
308
|
+
id={`${id}-occurrence`}
|
|
309
|
+
name="requestDate"
|
|
310
|
+
required
|
|
311
|
+
data-field="occurrence"
|
|
312
|
+
aria-invalid={invalid("occurrence")}
|
|
313
|
+
aria-describedby={errId("occurrence")}
|
|
314
|
+
>
|
|
315
|
+
<option value="">{t("widget.chooseDate")}</option>
|
|
316
|
+
{requestDays.map((d) => <option value={d.value}>{d.label}</option>)}
|
|
317
|
+
</select>
|
|
318
|
+
<p class="semics-field-error" id={errId("occurrence")} data-error-for="occurrence" data-message={fieldText("occurrence")}>
|
|
319
|
+
{bad("occurrence") ? fieldText("occurrence") : ""}
|
|
320
|
+
</p>
|
|
321
|
+
</div>
|
|
322
|
+
<fieldset class="semics-windows" data-testid="booking-windows">
|
|
323
|
+
<legend>{t("widget.window")}</legend>
|
|
324
|
+
{requests.windows.map((w) => (
|
|
325
|
+
<div class="semics-field semics-check">
|
|
326
|
+
<input id={`${id}-window-${w.id}`} type="radio" name="requestWindow" value={w.id} required checked={requests.windows.length === 1} />
|
|
327
|
+
<label for={`${id}-window-${w.id}`}>{w.label} ({w.start}–{w.end})</label>
|
|
328
|
+
</div>
|
|
329
|
+
))}
|
|
330
|
+
</fieldset>
|
|
331
|
+
</>
|
|
332
|
+
)}
|
|
333
|
+
|
|
270
334
|
{takesCodes && (
|
|
271
335
|
<div class="semics-field semics-promo">
|
|
272
336
|
{promo && <input type="hidden" name="promoCode" value={promo.code} />}
|
|
@@ -301,6 +365,28 @@ const when = (iso: string) => {
|
|
|
301
365
|
</div>
|
|
302
366
|
)}
|
|
303
367
|
|
|
368
|
+
{takesVouchers && (
|
|
369
|
+
<div class="semics-field semics-voucher">
|
|
370
|
+
<label for={`${id}-voucher`}>{t("widget.voucher.label")}</label>
|
|
371
|
+
<input
|
|
372
|
+
id={`${id}-voucher`}
|
|
373
|
+
name="voucherCode"
|
|
374
|
+
type="text"
|
|
375
|
+
autocomplete="off"
|
|
376
|
+
autocapitalize="characters"
|
|
377
|
+
spellcheck="false"
|
|
378
|
+
maxlength="64"
|
|
379
|
+
value={presetCode || undefined}
|
|
380
|
+
data-field="voucher"
|
|
381
|
+
aria-invalid={invalid("voucher")}
|
|
382
|
+
aria-describedby={errId("voucher")}
|
|
383
|
+
/>
|
|
384
|
+
<p class="semics-field-error" id={errId("voucher")} data-error-for="voucher" data-message={fieldText("voucher")}>
|
|
385
|
+
{bad("voucher") ? fieldText("voucher") : ""}
|
|
386
|
+
</p>
|
|
387
|
+
</div>
|
|
388
|
+
)}
|
|
389
|
+
|
|
304
390
|
<fieldset class="semics-tickets" data-field="tickets" aria-invalid={invalid("tickets")} aria-describedby={errId("tickets")}>
|
|
305
391
|
<legend>{t("widget.tickets")}</legend>
|
|
306
392
|
{ticketTypes.map((type) => {
|
|
@@ -318,7 +404,7 @@ const when = (iso: string) => {
|
|
|
318
404
|
type="number"
|
|
319
405
|
inputmode="numeric"
|
|
320
406
|
name={`${QTY_PREFIX}${type.id}`}
|
|
321
|
-
value="0"
|
|
407
|
+
value={type.id === presetType ? "1" : "0"}
|
|
322
408
|
min="0"
|
|
323
409
|
max={String(max)}
|
|
324
410
|
disabled={soldOut}
|
|
@@ -439,9 +525,9 @@ const when = (iso: string) => {
|
|
|
439
525
|
|
|
440
526
|
{siteKey && (
|
|
441
527
|
<>
|
|
442
|
-
<div class="cf-turnstile" data-sitekey={siteKey}></div>
|
|
443
|
-
{/* Turnstile is 300 px wide
|
|
444
|
-
<script is:inline>(function (s) { var t = s && s.previousElementSibling
|
|
528
|
+
<div class="cf-turnstile" data-sitekey={siteKey} data-theme="light"></div>
|
|
529
|
+
{/* Turnstile is 300 px wide: compact when the form has less room, so a 320 px screen never scrolls sideways (WCAG 1.4.10). The form is measured, not the empty box; a form not laid out yet (0 px) falls back to the screen less the card's padding (T158). Light, like the card. */}
|
|
530
|
+
<script is:inline>(function (s) { var t = s && s.previousElementSibling, f = t && t.closest("form"), w = f ? f.clientWidth : 0; if (!w) w = document.documentElement.clientWidth - 48; if (t && w < 300) t.setAttribute("data-size", "compact"); })(document.currentScript);</script>
|
|
445
531
|
<noscript>
|
|
446
532
|
<p class="semics-needs-js" data-testid="booking-needs-js">{t("widget.needsJs")}</p>
|
|
447
533
|
</noscript>
|
|
@@ -493,8 +579,8 @@ const when = (iso: string) => {
|
|
|
493
579
|
</div>
|
|
494
580
|
{siteKey && (
|
|
495
581
|
<>
|
|
496
|
-
<div class="cf-turnstile" data-sitekey={siteKey}></div>
|
|
497
|
-
<script is:inline>(function (s) { var t = s && s.previousElementSibling
|
|
582
|
+
<div class="cf-turnstile" data-sitekey={siteKey} data-theme="light"></div>
|
|
583
|
+
<script is:inline>(function (s) { var t = s && s.previousElementSibling, f = t && t.closest("form"), w = f ? f.clientWidth : 0; if (!w) w = document.documentElement.clientWidth - 48; if (t && w < 300) t.setAttribute("data-size", "compact"); })(document.currentScript);</script>
|
|
498
584
|
</>
|
|
499
585
|
)}
|
|
500
586
|
<button type="submit" class="semics-secondary">{t("waitlist.button")}</button>
|
|
@@ -510,23 +596,31 @@ const when = (iso: string) => {
|
|
|
510
596
|
import "../client/picker.ts";
|
|
511
597
|
</script>
|
|
512
598
|
|
|
599
|
+
|
|
513
600
|
<style>
|
|
601
|
+
/* One card with even, generous padding; groups read as sections with small headings, not boxes (T157). */
|
|
514
602
|
.semics-booking-widget {
|
|
515
603
|
--_fg: var(--events-fg, #1a1a1a);
|
|
516
604
|
--_muted: var(--events-muted, #4a4a4a);
|
|
517
605
|
--_bg: var(--events-bg, #ffffff);
|
|
518
606
|
--_border: var(--events-border, #6b6b6b);
|
|
607
|
+
--_line: color-mix(in srgb, var(--_border) 30%, transparent);
|
|
608
|
+
--_tint: color-mix(in srgb, var(--_accent) 7%, var(--_bg));
|
|
519
609
|
--_accent: var(--events-accent, #0b57d0);
|
|
520
610
|
--_accent-fg: var(--events-accent-fg, #ffffff);
|
|
521
611
|
--_error: var(--events-error, #b3261e);
|
|
522
612
|
--_radius: var(--events-radius, 6px);
|
|
613
|
+
--_pad: clamp(1.25rem, 0.75rem + 2.5vw, 2rem);
|
|
523
614
|
box-sizing: border-box;
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
border
|
|
615
|
+
/* The host sets the width: the widget fills its column, up to `--events-widget-max` when set (T158). */
|
|
616
|
+
max-inline-size: var(--events-widget-max, none);
|
|
617
|
+
padding: var(--_pad);
|
|
618
|
+
border: 1px solid var(--_line);
|
|
619
|
+
border-radius: calc(var(--_radius) + 6px);
|
|
528
620
|
background: var(--_bg);
|
|
621
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 24px rgb(0 0 0 / 0.06);
|
|
529
622
|
color: var(--_fg);
|
|
623
|
+
line-height: 1.5;
|
|
530
624
|
overflow-wrap: anywhere;
|
|
531
625
|
}
|
|
532
626
|
.semics-booking-widget *,
|
|
@@ -535,37 +629,41 @@ const when = (iso: string) => {
|
|
|
535
629
|
box-sizing: border-box;
|
|
536
630
|
}
|
|
537
631
|
.semics-booking-widget h2 {
|
|
538
|
-
margin: 0 0
|
|
539
|
-
font-size: 1.
|
|
632
|
+
margin: 0 0 1.25rem;
|
|
633
|
+
font-size: 1.375rem;
|
|
634
|
+
line-height: 1.25;
|
|
540
635
|
}
|
|
541
636
|
.semics-booking-widget form {
|
|
542
637
|
display: grid;
|
|
543
638
|
grid-template-columns: minmax(0, 1fr);
|
|
544
|
-
gap:
|
|
639
|
+
gap: 1.25rem;
|
|
545
640
|
}
|
|
546
641
|
.semics-booking-widget .semics-waitlist {
|
|
547
|
-
margin-block-start: 1.
|
|
548
|
-
padding-block-start:
|
|
549
|
-
border-block-start: 1px solid var(--
|
|
642
|
+
margin-block-start: 1.5rem;
|
|
643
|
+
padding-block-start: 1.5rem;
|
|
644
|
+
border-block-start: 1px solid var(--_line);
|
|
550
645
|
}
|
|
551
646
|
.semics-waitlist h3,
|
|
552
647
|
.semics-waitlist p {
|
|
553
648
|
margin: 0;
|
|
554
649
|
}
|
|
555
|
-
.semics-
|
|
556
|
-
margin: 0;
|
|
557
|
-
padding: 0
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
650
|
+
.semics-booking-widget legend {
|
|
651
|
+
margin: 0 0 0.5rem;
|
|
652
|
+
padding: 0;
|
|
653
|
+
font-size: 0.8125rem;
|
|
654
|
+
font-weight: 700;
|
|
655
|
+
letter-spacing: 0.06em;
|
|
656
|
+
text-transform: uppercase;
|
|
657
|
+
color: var(--_muted);
|
|
561
658
|
}
|
|
659
|
+
.semics-tickets,
|
|
660
|
+
.semics-windows,
|
|
562
661
|
.semics-questions {
|
|
563
662
|
display: grid;
|
|
564
663
|
gap: 0.75rem;
|
|
565
664
|
margin: 0;
|
|
566
|
-
padding: 0
|
|
567
|
-
border:
|
|
568
|
-
border-radius: var(--_radius);
|
|
665
|
+
padding: 0;
|
|
666
|
+
border: 0;
|
|
569
667
|
min-inline-size: 0;
|
|
570
668
|
}
|
|
571
669
|
.semics-check {
|
|
@@ -580,51 +678,70 @@ const when = (iso: string) => {
|
|
|
580
678
|
min-block-size: 1.25rem;
|
|
581
679
|
inline-size: 1.25rem;
|
|
582
680
|
margin: 0;
|
|
681
|
+
accent-color: var(--_accent);
|
|
583
682
|
}
|
|
584
683
|
.semics-hint {
|
|
585
684
|
color: var(--_muted);
|
|
586
685
|
}
|
|
686
|
+
.semics-picker-field {
|
|
687
|
+
gap: 0.75rem;
|
|
688
|
+
}
|
|
587
689
|
.semics-picker-nav {
|
|
690
|
+
max-inline-size: var(--events-calendar-max, 26rem);
|
|
588
691
|
display: flex;
|
|
589
692
|
flex-wrap: wrap;
|
|
590
|
-
align-items:
|
|
591
|
-
gap: 0.
|
|
693
|
+
align-items: center;
|
|
694
|
+
gap: 0.5rem;
|
|
592
695
|
}
|
|
593
696
|
.semics-picker-month {
|
|
594
697
|
margin: 0;
|
|
595
698
|
margin-inline-end: auto;
|
|
596
|
-
font-
|
|
699
|
+
font-size: 1.125rem;
|
|
700
|
+
font-weight: 700;
|
|
597
701
|
}
|
|
598
702
|
.semics-picker-nav a {
|
|
703
|
+
display: inline-flex;
|
|
704
|
+
align-items: center;
|
|
705
|
+
min-block-size: 2.25rem;
|
|
706
|
+
padding: 0.25rem 0.875rem;
|
|
707
|
+
border: 1px solid var(--_line);
|
|
708
|
+
border-radius: 999px;
|
|
599
709
|
color: var(--_accent);
|
|
600
|
-
|
|
710
|
+
font-size: 0.9375rem;
|
|
711
|
+
text-decoration: none;
|
|
712
|
+
}
|
|
713
|
+
.semics-picker-nav a:hover {
|
|
714
|
+
border-color: var(--_accent);
|
|
601
715
|
}
|
|
602
716
|
.semics-picker {
|
|
603
717
|
display: grid;
|
|
604
|
-
gap:
|
|
718
|
+
gap: 1rem;
|
|
605
719
|
margin: 0;
|
|
606
|
-
padding: 0
|
|
607
|
-
border:
|
|
608
|
-
border-radius: var(--_radius);
|
|
720
|
+
padding: 0;
|
|
721
|
+
border: 0;
|
|
609
722
|
min-inline-size: 0;
|
|
610
723
|
}
|
|
611
724
|
.semics-picker p {
|
|
612
725
|
margin: 0;
|
|
613
726
|
}
|
|
727
|
+
/* Room between the days: cells 6px apart, buttons at least 44px tall. The calendar keeps its size in a wide host column:
|
|
728
|
+
at most `--events-calendar-max` (26rem, days about 54px) while the rest of the widget fills the column (T159). */
|
|
614
729
|
.semics-calendar {
|
|
615
|
-
inline-size: 100
|
|
616
|
-
|
|
730
|
+
inline-size: calc(min(100%, var(--events-calendar-max, 26rem)) + 0.75rem);
|
|
731
|
+
margin: -0.375rem;
|
|
732
|
+
border-collapse: separate;
|
|
733
|
+
border-spacing: 0.375rem;
|
|
617
734
|
table-layout: fixed;
|
|
618
735
|
text-align: center;
|
|
619
736
|
}
|
|
620
737
|
.semics-calendar th {
|
|
621
|
-
padding-block: 0.25rem;
|
|
622
|
-
font-weight:
|
|
623
|
-
font-size: 0.
|
|
738
|
+
padding-block: 0 0.25rem;
|
|
739
|
+
font-weight: 600;
|
|
740
|
+
font-size: 0.8125rem;
|
|
624
741
|
color: var(--_muted);
|
|
625
742
|
}
|
|
626
743
|
.semics-calendar td {
|
|
627
|
-
padding:
|
|
744
|
+
padding: 0;
|
|
628
745
|
}
|
|
629
746
|
.semics-booking-widget .semics-calendar button,
|
|
630
747
|
.semics-booking-widget .semics-times button {
|
|
@@ -633,11 +750,24 @@ const when = (iso: string) => {
|
|
|
633
750
|
border: 1px solid var(--_accent);
|
|
634
751
|
background: var(--_bg);
|
|
635
752
|
color: var(--_accent);
|
|
753
|
+
font-weight: 600;
|
|
754
|
+
}
|
|
755
|
+
.semics-booking-widget .semics-calendar button {
|
|
756
|
+
block-size: clamp(2.75rem, 2rem + 2vw, 3.25rem);
|
|
757
|
+
}
|
|
758
|
+
/* Hover is its own, lighter state: a tint and a ring, the text stays the accent; only the chosen day or time
|
|
759
|
+
is filled (T158). */
|
|
760
|
+
.semics-booking-widget .semics-calendar button:not([aria-pressed="true"], .semics-day-full):hover,
|
|
761
|
+
.semics-booking-widget .semics-times button:not([aria-disabled="true"], [aria-checked="true"]):hover {
|
|
762
|
+
background: var(--_tint);
|
|
763
|
+
box-shadow: inset 0 0 0 1px var(--_accent);
|
|
764
|
+
color: var(--_accent);
|
|
636
765
|
}
|
|
637
766
|
.semics-booking-widget .semics-calendar button.semics-day-full,
|
|
638
767
|
.semics-booking-widget .semics-times button[aria-disabled="true"] {
|
|
639
|
-
border-color: var(--
|
|
768
|
+
border-color: var(--_line);
|
|
640
769
|
color: var(--_muted);
|
|
770
|
+
font-weight: 400;
|
|
641
771
|
text-decoration: line-through;
|
|
642
772
|
}
|
|
643
773
|
.semics-booking-widget .semics-times button[aria-disabled="true"] {
|
|
@@ -647,39 +777,50 @@ const when = (iso: string) => {
|
|
|
647
777
|
.semics-booking-widget .semics-times button[aria-checked="true"] {
|
|
648
778
|
background: var(--_accent);
|
|
649
779
|
color: var(--_accent-fg);
|
|
780
|
+
box-shadow: none;
|
|
650
781
|
}
|
|
651
782
|
.semics-day-none {
|
|
652
|
-
display:
|
|
653
|
-
|
|
783
|
+
display: grid;
|
|
784
|
+
place-items: center;
|
|
785
|
+
block-size: clamp(2.75rem, 2rem + 2vw, 3.25rem);
|
|
654
786
|
color: var(--_muted);
|
|
655
787
|
}
|
|
656
788
|
.semics-times {
|
|
657
789
|
display: grid;
|
|
658
|
-
grid-template-columns: repeat(auto-fill, minmax(
|
|
790
|
+
grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
|
|
659
791
|
gap: 0.5rem;
|
|
660
792
|
}
|
|
661
793
|
.semics-booking-widget .semics-times button {
|
|
662
794
|
display: grid;
|
|
663
795
|
justify-items: center;
|
|
796
|
+
padding: 0.5rem;
|
|
664
797
|
}
|
|
665
798
|
.semics-places {
|
|
666
|
-
font-size: 0.
|
|
799
|
+
font-size: 0.8125rem;
|
|
800
|
+
font-weight: 400;
|
|
667
801
|
}
|
|
668
802
|
.semics-ticket {
|
|
669
803
|
display: flex;
|
|
670
804
|
flex-wrap: wrap;
|
|
671
805
|
align-items: center;
|
|
672
806
|
justify-content: space-between;
|
|
673
|
-
gap: 0.5rem;
|
|
674
|
-
padding-block: 0.
|
|
807
|
+
gap: 0.5rem 1rem;
|
|
808
|
+
padding-block: 0.5rem;
|
|
809
|
+
border-block-end: 1px solid var(--_line);
|
|
810
|
+
}
|
|
811
|
+
.semics-ticket:last-of-type {
|
|
812
|
+
border-block-end: 0;
|
|
675
813
|
}
|
|
676
814
|
.semics-ticket label {
|
|
677
815
|
display: flex;
|
|
678
816
|
flex-wrap: wrap;
|
|
679
|
-
gap: 0 0.
|
|
817
|
+
gap: 0 0.75rem;
|
|
680
818
|
flex: 1 1 10rem;
|
|
681
819
|
min-inline-size: 0;
|
|
682
820
|
}
|
|
821
|
+
.semics-ticket-name {
|
|
822
|
+
font-weight: 600;
|
|
823
|
+
}
|
|
683
824
|
.semics-ticket-price,
|
|
684
825
|
.semics-ticket-soldout {
|
|
685
826
|
color: var(--_muted);
|
|
@@ -690,7 +831,10 @@ const when = (iso: string) => {
|
|
|
690
831
|
.semics-field {
|
|
691
832
|
display: grid;
|
|
692
833
|
grid-template-columns: minmax(0, 1fr);
|
|
693
|
-
gap: 0.
|
|
834
|
+
gap: 0.375rem;
|
|
835
|
+
}
|
|
836
|
+
.semics-field > label {
|
|
837
|
+
font-weight: 500;
|
|
694
838
|
}
|
|
695
839
|
.semics-field select {
|
|
696
840
|
inline-size: 100%;
|
|
@@ -704,7 +848,7 @@ const when = (iso: string) => {
|
|
|
704
848
|
}
|
|
705
849
|
.semics-booking-widget input,
|
|
706
850
|
.semics-booking-widget select {
|
|
707
|
-
padding: 0.
|
|
851
|
+
padding: 0.5rem 0.75rem;
|
|
708
852
|
border: 1px solid var(--_border);
|
|
709
853
|
border-radius: var(--_radius);
|
|
710
854
|
background: var(--_bg);
|
|
@@ -723,7 +867,7 @@ const when = (iso: string) => {
|
|
|
723
867
|
display: none;
|
|
724
868
|
}
|
|
725
869
|
.semics-form-alert {
|
|
726
|
-
padding: 0.
|
|
870
|
+
padding: 0.75rem 1rem;
|
|
727
871
|
border: 1px solid var(--_error);
|
|
728
872
|
border-radius: var(--_radius);
|
|
729
873
|
}
|
|
@@ -731,16 +875,28 @@ const when = (iso: string) => {
|
|
|
731
875
|
margin: 0;
|
|
732
876
|
font-weight: 600;
|
|
733
877
|
}
|
|
878
|
+
/* The summary above Book. */
|
|
734
879
|
.semics-total {
|
|
880
|
+
display: flex;
|
|
881
|
+
flex-wrap: wrap;
|
|
882
|
+
justify-content: space-between;
|
|
883
|
+
gap: 0.25rem 1rem;
|
|
735
884
|
margin: 0;
|
|
885
|
+
padding: 1rem 1.25rem;
|
|
886
|
+
border-radius: var(--_radius);
|
|
887
|
+
background: var(--_tint);
|
|
888
|
+
}
|
|
889
|
+
.semics-total strong {
|
|
890
|
+
font-size: 1.125rem;
|
|
736
891
|
}
|
|
737
892
|
.semics-booking-widget button {
|
|
738
893
|
justify-self: start;
|
|
739
|
-
padding: 0.
|
|
894
|
+
padding: 0.75rem 2rem;
|
|
740
895
|
border: 0;
|
|
741
896
|
border-radius: var(--_radius);
|
|
742
897
|
background: var(--_accent);
|
|
743
898
|
color: var(--_accent-fg);
|
|
899
|
+
font-weight: 600;
|
|
744
900
|
cursor: pointer;
|
|
745
901
|
}
|
|
746
902
|
.semics-promo-row {
|
|
@@ -758,6 +914,16 @@ const when = (iso: string) => {
|
|
|
758
914
|
background: var(--_bg);
|
|
759
915
|
color: var(--_accent);
|
|
760
916
|
}
|
|
917
|
+
.semics-have-voucher {
|
|
918
|
+
margin: 0;
|
|
919
|
+
}
|
|
920
|
+
.semics-have-voucher a {
|
|
921
|
+
color: var(--_accent);
|
|
922
|
+
}
|
|
923
|
+
.semics-booking-widget input:target {
|
|
924
|
+
outline: 3px solid var(--_accent);
|
|
925
|
+
outline-offset: 2px;
|
|
926
|
+
}
|
|
761
927
|
.semics-promo-note {
|
|
762
928
|
margin: 0;
|
|
763
929
|
color: var(--_muted);
|
|
@@ -770,6 +936,14 @@ const when = (iso: string) => {
|
|
|
770
936
|
outline: 3px solid var(--_accent);
|
|
771
937
|
outline-offset: 2px;
|
|
772
938
|
}
|
|
939
|
+
.semics-visually-hidden {
|
|
940
|
+
position: absolute;
|
|
941
|
+
inline-size: 1px;
|
|
942
|
+
block-size: 1px;
|
|
943
|
+
overflow: hidden;
|
|
944
|
+
clip-path: inset(50%);
|
|
945
|
+
white-space: nowrap;
|
|
946
|
+
}
|
|
773
947
|
[hidden] {
|
|
774
948
|
display: none !important;
|
|
775
949
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
// <CancelBooking>: the quiet "Cancel booking" action at the foot of the booking page (T157). The button only
|
|
3
|
+
// opens a confirmation (a `<details>`, no JavaScript needed); the form posts `intent=cancel` back to the page.
|
|
4
|
+
import { around, pickLocale, translator } from "../i18n/index";
|
|
5
|
+
import { zonedAt } from "./lib/list";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** Where the cancel form posts. */
|
|
9
|
+
action: string;
|
|
10
|
+
/** The last moment to cancel, when there is one. */
|
|
11
|
+
cancelBy?: string | undefined;
|
|
12
|
+
/** The event's zone, for `cancelBy`. */
|
|
13
|
+
zone?: string | null | undefined;
|
|
14
|
+
locale?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { action, cancelBy, zone } = Astro.props;
|
|
18
|
+
const locale = pickLocale(Astro.props.locale, Astro.currentLocale);
|
|
19
|
+
const { t, lang, dir } = translator(locale);
|
|
20
|
+
const [cancelBefore, cancelAfter] = around(t("booking.cancelUntil"), "time");
|
|
21
|
+
---
|
|
22
|
+
<details class="semics-events semics-cancel" lang={lang} dir={dir} data-testid="booking-cancel">
|
|
23
|
+
<summary>{t("booking.cancel")}</summary>
|
|
24
|
+
<form method="post" action={action}>
|
|
25
|
+
<input type="hidden" name="intent" value="cancel" />
|
|
26
|
+
{cancelBy && (
|
|
27
|
+
<p>
|
|
28
|
+
{cancelBefore}<time datetime={cancelBy}>{zonedAt(cancelBy, zone, locale)}</time>{cancelAfter}
|
|
29
|
+
</p>
|
|
30
|
+
)}
|
|
31
|
+
<p>{t("booking.cancelConfirm")}</p>
|
|
32
|
+
<button type="submit">{t("booking.cancelYes")}</button>
|
|
33
|
+
</form>
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.semics-cancel {
|
|
38
|
+
margin-block: 1.5rem 0;
|
|
39
|
+
color: var(--events-fg, #1a1a1a);
|
|
40
|
+
}
|
|
41
|
+
.semics-cancel summary {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
min-block-size: 2.75rem;
|
|
45
|
+
color: var(--events-muted, #4a4a4a);
|
|
46
|
+
text-decoration: underline;
|
|
47
|
+
text-underline-offset: 0.2em;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
.semics-cancel form {
|
|
51
|
+
margin-block-start: 0.5rem;
|
|
52
|
+
padding: 1rem 1.25rem;
|
|
53
|
+
border: 1px solid var(--events-error, #b3261e);
|
|
54
|
+
border-radius: var(--events-radius, 6px);
|
|
55
|
+
background: var(--events-bg, #ffffff);
|
|
56
|
+
}
|
|
57
|
+
.semics-cancel p {
|
|
58
|
+
margin: 0 0 0.75rem;
|
|
59
|
+
}
|
|
60
|
+
.semics-cancel button {
|
|
61
|
+
font: inherit;
|
|
62
|
+
min-block-size: 2.75rem;
|
|
63
|
+
padding: 0.5rem 1.25rem;
|
|
64
|
+
border: 1px solid var(--events-error, #b3261e);
|
|
65
|
+
border-radius: var(--events-radius, 6px);
|
|
66
|
+
background: var(--events-bg, #ffffff);
|
|
67
|
+
color: var(--events-error, #b3261e);
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
.semics-cancel :focus-visible {
|
|
72
|
+
outline: 3px solid var(--events-accent, #0b57d0);
|
|
73
|
+
outline-offset: 2px;
|
|
74
|
+
}
|
|
75
|
+
@media print {
|
|
76
|
+
.semics-cancel {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The site's name or logo at the top of the plugins' own pages (`/booking`, `/_events/waiver`), linking
|
|
3
|
+
// home: those pages run outside the site's layout (`eventsIntegration({ page: { brand } })`).
|
|
4
|
+
import type { PageBrand } from "./lib/page";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
brand?: PageBrand | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { brand } = Astro.props;
|
|
11
|
+
---
|
|
12
|
+
{
|
|
13
|
+
brand && (
|
|
14
|
+
<header class="semics-page-brand">
|
|
15
|
+
<a href={brand.href ?? "/"}>{brand.logo ? <img src={brand.logo} alt={brand.name} /> : brand.name}</a>
|
|
16
|
+
</header>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The organiser at the foot of the plugins' own pages (T157): the site's name and, when the site gives one,
|
|
3
|
+
// its address (`page.brand.address`). It stays on a printed booking, where the brand bar is hidden.
|
|
4
|
+
import { pickLocale, translator } from "../i18n/index";
|
|
5
|
+
import type { PageBrand } from "./lib/page";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
brand?: PageBrand | undefined;
|
|
9
|
+
locale?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { brand } = Astro.props;
|
|
13
|
+
const { t } = translator(pickLocale(Astro.props.locale, Astro.currentLocale));
|
|
14
|
+
---
|
|
15
|
+
{
|
|
16
|
+
brand && (
|
|
17
|
+
<footer class="semics-page-organiser" data-testid="page-organiser">
|
|
18
|
+
<p>{t("booking.organiser", { name: brand.name })}</p>
|
|
19
|
+
{brand.address && <address>{brand.address}</address>}
|
|
20
|
+
</footer>
|
|
21
|
+
)
|
|
22
|
+
}
|