@semics-tech/emdash-events 1.0.0-rc.0 → 1.0.0-rc.10
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 +3 -2
- package/dist/index.mjs +25 -1
- package/dist/manifest.json +25 -1
- package/dist/plugin.mjs +6 -6
- package/dist/ts/astro/lib/page.d.ts +44 -0
- package/dist/ts/astro/lib/page.js +122 -0
- package/dist/ts/integration/index.d.ts +4 -0
- package/dist/ts/integration/index.js +2 -0
- package/emdash-plugin.jsonc +16 -0
- package/package.json +7 -2
- package/src/astro/AttendeeList.astro +154 -0
- package/src/astro/BookingPage.astro +82 -9
- package/src/astro/BookingStatus.astro +147 -51
- package/src/astro/BookingWidget.astro +307 -35
- 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/lib/attendees.ts +218 -0
- package/src/astro/lib/list.ts +22 -0
- package/src/astro/lib/page.ts +142 -0
- package/src/astro/lib/pass.ts +9 -0
- package/src/astro/lib/payment.ts +6 -10
- package/src/astro/lib/picker.ts +245 -0
- package/src/astro/lib/widget.ts +75 -2
- package/src/astro/virtual.d.ts +2 -0
- package/src/client/booking.ts +3 -1
- package/src/client/forget-form.ts +16 -0
- package/src/client/picker.ts +154 -0
- package/src/client/print.ts +12 -0
- package/src/i18n/ar.ts +63 -1
- package/src/i18n/en.ts +61 -1
|
@@ -1,74 +1,99 @@
|
|
|
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";
|
|
5
|
-
import
|
|
7
|
+
import CancelBooking from "./CancelBooking.astro";
|
|
8
|
+
import { zonedAt } from "./lib/list";
|
|
9
|
+
import { type BookingView, endedNotes, formatMoney, statusLabel } from "./lib/widget";
|
|
6
10
|
|
|
7
11
|
interface Props {
|
|
8
12
|
booking: BookingView;
|
|
9
13
|
/** Shown as cancelled (the page just cancelled it). */
|
|
10
14
|
cancelled?: boolean;
|
|
11
|
-
/** Where the cancel form posts. */
|
|
15
|
+
/** Where the cancel form posts; without it the card has no cancel action. */
|
|
12
16
|
cancelAction?: string;
|
|
13
17
|
/** Ticket type names by id, when the page knows them. */
|
|
14
18
|
ticketNames?: Record<string, string>;
|
|
19
|
+
/** A lapsed booking's way back: the event's page, when known. */
|
|
20
|
+
bookAgain?: string;
|
|
21
|
+
/** List the attendees' names (the page turns it off when Events Pro's signing list shows them). */
|
|
22
|
+
showAttendees?: boolean;
|
|
15
23
|
locale?: string;
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
const { booking, cancelled = false, cancelAction, ticketNames = {} } = Astro.props;
|
|
26
|
+
const { booking, cancelled = false, cancelAction, ticketNames = {}, bookAgain, showAttendees = true } = Astro.props;
|
|
19
27
|
const locale = pickLocale(Astro.props.locale, Astro.currentLocale);
|
|
20
28
|
const { t, plural, lang, dir } = translator(locale);
|
|
21
|
-
|
|
22
|
-
const [
|
|
29
|
+
// A request awaiting approval (T131) holds its places until the organiser's deadline.
|
|
30
|
+
const [heldBefore, heldAfter] = around(
|
|
31
|
+
t(booking.status === "awaiting_approval" ? "booking.decideBy" : "booking.heldUntil"),
|
|
32
|
+
"time",
|
|
33
|
+
);
|
|
23
34
|
const tickets = booking.lines.reduce((n, line) => n + line.qty, 0);
|
|
24
35
|
const status = cancelled ? "cancelled" : booking.status;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
};
|
|
36
|
+
const zone = booking.event?.timezone;
|
|
37
|
+
const at = (iso: string) => zonedAt(iso, zone, locale);
|
|
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 : [];
|
|
35
44
|
---
|
|
36
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">
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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>
|
|
44
65
|
{
|
|
45
66
|
!cancelled && booking.holdExpiresAt && (
|
|
46
|
-
<p data-testid="booking-hold">
|
|
67
|
+
<p class="semics-booking-note" data-testid="booking-hold">
|
|
47
68
|
{heldBefore}<time datetime={booking.holdExpiresAt}>{at(booking.holdExpiresAt)}</time>{heldAfter}
|
|
48
69
|
</p>
|
|
49
70
|
)
|
|
50
71
|
}
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
{notes.map((note) => <p class="semics-booking-note" data-testid="booking-note">{note}</p>)}
|
|
73
|
+
{status === "expired" && bookAgain && <p><a href={bookAgain} data-testid="booking-book-again">{t("booking.bookAgain")}</a></p>}
|
|
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>
|
|
61
94
|
{
|
|
62
95
|
booking.canCancel && !cancelled && cancelAction && (
|
|
63
|
-
<
|
|
64
|
-
<input type="hidden" name="intent" value="cancel" />
|
|
65
|
-
{booking.cancelBy && (
|
|
66
|
-
<p>
|
|
67
|
-
{cancelBefore}<time datetime={booking.cancelBy}>{at(booking.cancelBy)}</time>{cancelAfter}
|
|
68
|
-
</p>
|
|
69
|
-
)}
|
|
70
|
-
<button type="submit">{t("booking.cancel")}</button>
|
|
71
|
-
</form>
|
|
96
|
+
<CancelBooking action={cancelAction} cancelBy={booking.cancelBy} zone={zone} locale={locale} />
|
|
72
97
|
)
|
|
73
98
|
}
|
|
74
99
|
</section>
|
|
@@ -76,24 +101,95 @@ const at = (iso: string) => {
|
|
|
76
101
|
<style>
|
|
77
102
|
.semics-booking-status {
|
|
78
103
|
box-sizing: border-box;
|
|
79
|
-
max-inline-size: 36rem;
|
|
80
104
|
color: var(--events-fg, #1a1a1a);
|
|
81
105
|
overflow-wrap: anywhere;
|
|
82
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
|
+
}
|
|
83
144
|
.semics-status-badge {
|
|
84
145
|
display: inline-block;
|
|
85
|
-
padding: 0.125rem 0.
|
|
146
|
+
padding: 0.125rem 0.625rem;
|
|
86
147
|
border: 1px solid currentColor;
|
|
87
|
-
border-radius:
|
|
148
|
+
border-radius: 999px;
|
|
149
|
+
font-size: 0.875rem;
|
|
88
150
|
font-weight: 600;
|
|
89
151
|
}
|
|
90
152
|
.semics-booking-status[data-status="confirmed"] .semics-status-badge {
|
|
91
153
|
color: var(--events-success, #146c2e);
|
|
92
154
|
}
|
|
93
|
-
.semics-booking-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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;
|
|
97
193
|
}
|
|
98
194
|
.semics-visually-hidden {
|
|
99
195
|
position: absolute;
|