@semics-tech/emdash-events 1.0.0-rc.6 → 1.0.0-rc.8

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.
@@ -62,31 +62,26 @@ const WHEN: Intl.DateTimeFormatOptions = {
62
62
  timeZoneName: "short",
63
63
  };
64
64
 
65
- const AT: Intl.DateTimeFormatOptions = {
66
- day: "numeric",
67
- month: "short",
68
- year: "numeric",
69
- hour: "2-digit",
70
- minute: "2-digit",
71
- hourCycle: "h23",
72
- };
65
+ /** The booking widget's and the waiver page's date format: full date, short time. */
66
+ const AT: Intl.DateTimeFormatOptions = { dateStyle: "full", timeStyle: "short" };
73
67
 
74
68
  /**
75
- * A deadline on a customer page: local time in the event's own zone, named as the emails name it
76
- * ("9 Nov 2026, 15:09 (Europe/London)", not workerd's "GMT+0"). UTC for a missing or unknown zone; the raw value
77
- * for one that is not a date.
69
+ * A time on a customer page (a deadline, a hold, the booked session): local time in the event's own zone, as the
70
+ * session's time line reads ("Monday 9 November 2026 at 15:09", T157), without the zone's name. A missing or
71
+ * unknown zone shows UTC and says so; a value that is not a date is shown as it is.
78
72
  */
79
73
  export function zonedAt(iso: string, timezone: string | null | undefined, locale: string): string {
80
74
  const ms = Date.parse(iso);
81
75
  if (!Number.isFinite(ms)) return iso;
82
- const zone = timezone && isValidTimeZone(timezone) ? timezone : "UTC";
76
+ const known = Boolean(timezone && isValidTimeZone(timezone));
77
+ const zone = known ? (timezone as string) : "UTC";
83
78
  let time: string;
84
79
  try {
85
80
  time = formatInZone(ms, zone, locale, AT);
86
81
  } catch {
87
82
  time = formatInZone(ms, zone, "en-GB", AT); // A locale `Intl` refuses, such as `en_GB`.
88
83
  }
89
- return `${time} (${zone})`;
84
+ return known ? time : `${time} (${zone})`;
90
85
  }
91
86
 
92
87
  const BADGES = { cancelled: "list.badge.cancelled", closed: "list.badge.closed", paused: "list.badge.paused" } as const;
@@ -27,12 +27,24 @@ export const THEME_PROPERTIES = [
27
27
  ] as const;
28
28
  export type ThemeProperty = (typeof THEME_PROPERTIES)[number];
29
29
  export interface PageBrand {
30
- /** The site's name: the link's text, or the logo's alternative text. */
30
+ /** The site's name: the link's text, or the logo's alternative text. Also the organiser at the page's foot. */
31
31
  name: string;
32
32
  /** Where it links, a path on this site (default `/`). */
33
33
  href?: string;
34
34
  /** A logo, a path on this site. */
35
35
  logo?: string;
36
+ /** The organiser's postal address, one line, at the page's foot and on a printed booking (T157). */
37
+ address?: string;
38
+ }
39
+
40
+ /** One line of text for people: 1 to 300 characters, no control characters (line breaks included). */
41
+ function oneLine(value: unknown): boolean {
42
+ if (typeof value !== "string" || !value.trim() || value.length > 300) return false;
43
+ for (let i = 0; i < value.length; i++) {
44
+ const unit = value.charCodeAt(i);
45
+ if (unit <= 0x1f || unit === 0x7f) return false;
46
+ }
47
+ return true;
36
48
  }
37
49
 
38
50
  export interface PageOptions {
@@ -68,6 +80,7 @@ export function checkPageOptions(page: PageOptions = {}): PageOptions {
68
80
  if (typeof brand.name !== "string" || !brand.name.trim()) refuse("brand.name");
69
81
  if (brand.href !== undefined && !SITE_PATH.test(brand.href)) refuse("brand.href");
70
82
  if (brand.logo !== undefined && !SITE_PATH.test(brand.logo)) refuse("brand.logo");
83
+ if (brand.address !== undefined && !oneLine(brand.address)) refuse("brand.address");
71
84
  }
72
85
  return page;
73
86
  }
@@ -77,28 +90,48 @@ export function eventPageHref(slug: string | null | undefined, eventPath?: strin
77
90
  return slug ? (eventPath ?? "/events/{slug}").replace("{slug}", encodeURIComponent(slug)) : undefined;
78
91
  }
79
92
 
80
- /** Works with no site theme at all. Zero specificity on elements, so the components' own rules win. */
93
+ /**
94
+ * Works with no site theme at all. Zero specificity on elements, so the components' own rules win; except the card
95
+ * rule for `main`'s sections, which outranks a component's own box (`.semics-payment`, `.semics-attendee-list`) so
96
+ * every card has the same edges, width and look (T158).
97
+ */
81
98
  export const PAGE_CSS = `*,*::before,*::after{box-sizing:border-box}
82
99
  html{color-scheme:light;-webkit-text-size-adjust:100%}
83
100
  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;
84
101
  --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)}
85
- .semics-page-brand{max-inline-size:38rem;margin-inline:auto;padding:1rem 1rem 0;font-family:var(--events-heading-font, inherit);font-weight:600}
102
+ .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}
86
103
  .semics-page-brand a{color:var(--events-heading-fg, inherit);text-decoration:none}
87
104
  .semics-page-brand img{display:block;block-size:2.5rem;inline-size:auto;max-inline-size:100%}
88
- .semics-page-main{max-inline-size:38rem;margin-inline:auto;padding:1.5rem 1rem 3rem}
105
+ .semics-page-main{max-inline-size:40rem;margin-inline:auto;padding:1.5rem 1rem 2rem}
89
106
  :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}
90
- :where(.semics-page) h1{font-size:clamp(1.75rem,1.5rem + 1.5vw,2.25rem)}
107
+ :where(.semics-page) h1{margin-block-end:1.25rem;font-size:clamp(1.75rem,1.5rem + 1.5vw,2.25rem)}
91
108
  :where(.semics-page) h2{font-size:1.25rem}
92
109
  :where(.semics-page) h3{font-size:1.0625rem}
93
110
  :where(.semics-page) p{margin:0 0 .75rem}
94
111
  :where(.semics-page) a{color:var(--events-accent, #0b57d0);text-underline-offset:.2em}
95
112
  :where(.semics-page) :focus-visible{outline:3px solid var(--events-accent, #0b57d0);outline-offset:2px}
96
- :where(.semics-page-main) > section,:where(.semics-page-main) > form:not([hidden]){margin-block:0 1rem;padding:1rem 1.25rem;background:var(--events-bg, #ffffff);border:1px solid var(--events-border, #6b6b6b);border-radius:var(--events-radius, 6px);max-inline-size:none}
97
- :where(.semics-page) [role="alert"]{padding:.5rem .75rem;border:1px solid var(--events-error, #b3261e);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-error, #b3261e)}
98
- :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:.375rem .5rem;border:1px solid var(--events-border, #6b6b6b);border-radius:var(--events-radius, 6px);background:var(--events-bg, #ffffff);color:var(--events-fg, #1a1a1a)}
113
+ .semics-page-main > :is(section,form:not([hidden]),.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}
114
+ :where(.semics-page-main > section,.semics-page-main > form,.semics-page-main > .semics-ceremony) > :last-child{margin-block-end:0}
115
+ :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)}
116
+ :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)}
99
117
  :where(.semics-page) label{display:block}
100
- :where(.semics-page) fieldset{min-inline-size:0;margin:0 0 .75rem;padding:.5rem .75rem;border:1px solid var(--events-border, #6b6b6b);border-radius:var(--events-radius, 6px)}
101
- :where(.semics-page) button{font:inherit;min-block-size:2.75rem;padding:.5rem 1rem;border:0;border-radius:var(--events-radius, 6px);background:var(--events-accent, #0b57d0);color:var(--events-accent-fg, #ffffff);cursor:pointer}
118
+ :where(.semics-page) fieldset{min-inline-size:0;margin:0 0 1rem;padding:0;border:0}
119
+ :where(.semics-page) legend{padding:0;margin-block-end:.5rem;font-weight:600}
120
+ :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}
121
+ .semics-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1.25rem;margin-block:0 1.25rem}
122
+ .semics-page-actions .semics-print{background:transparent;color:var(--events-accent, #0b57d0)}
123
+ .semics-page-organiser{max-inline-size:40rem;margin-inline:auto;padding:0 1rem 3rem;color:var(--events-muted, #4a4a4a);font-size:.9375rem}
124
+ .semics-page-organiser p{margin:0}
125
+ .semics-page-organiser address{font-style:normal}
126
+ @media print{
127
+ @page{margin:15mm}
128
+ body.semics-page{min-block-size:0;background:#ffffff;color:#000000;font-size:11pt}
129
+ .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}
130
+ .semics-page-main{max-inline-size:none;padding:0}
131
+ .semics-page-main > :is(section,form:not([hidden]),.semics-ceremony){box-shadow:none;border-color:#999999;break-inside:avoid}
132
+ .semics-ticket-pass{break-inside:avoid}
133
+ .semics-page-organiser{max-inline-size:none;padding:1rem 0 0;color:#000000}
134
+ }
102
135
  `;
103
136
 
104
137
  /** The stylesheet for a page: the defaults, then the site's theme. Exact: the signing page hashes this text. */
@@ -33,3 +33,12 @@ export function qrPath(qr: unknown): QrPath | null {
33
33
  }
34
34
  return { size, d };
35
35
  }
36
+
37
+ /**
38
+ * A check-in code in groups of four for reading (T158): the pass draws each group as its own span, spaced by CSS, so
39
+ * the text (and a copy of it) stays the exact value door check-in takes. A short code (12 or fewer) stays whole.
40
+ */
41
+ export function codeGroups(code: string): string[] {
42
+ if (code.length <= 12) return code ? [code] : [];
43
+ return code.match(/.{1,4}/gsu) ?? [];
44
+ }
@@ -76,8 +76,8 @@ export interface BookingView {
76
76
  lines: Array<{ ticketTypeId: string; qty: number }>;
77
77
  totals: { totalMinor: number; currency: string };
78
78
  holdExpiresAt?: string;
79
- /** The event's public info (`timezone` for times on the page, `slug` for "Book again"). */
80
- event?: { title?: string; startsAt?: string; timezone?: string | null; slug?: string | null };
79
+ /** The event's public info: the booked session (`startsAt`, in `timezone`) and `venue` lead the page (T157); `slug` for "Book again". */
80
+ event?: { title?: string; startsAt?: string; timezone?: string | null; venue?: string | null; slug?: string | null };
81
81
  /** Why the organiser declined (`status: "declined"`), when they said. */
82
82
  declineReason?: string | null;
83
83
  /** Declined, a price was due and no money was taken (`closeBooking`). */
@@ -60,10 +60,14 @@ export function enhancePicker(picker: HTMLElement): void {
60
60
  const radios = (group: HTMLElement) => Array.from(group.querySelectorAll<HTMLButtonElement>('[role="radio"]'));
61
61
  const isOpen = (b: HTMLElement) => b.getAttribute("aria-disabled") !== "true";
62
62
 
63
+ // The picker's own changes, which `showSelected` (below) need not follow.
64
+ let own = false;
63
65
  const setSelect = (value: string) => {
64
66
  if (select.value === value) return;
65
67
  select.value = value;
68
+ own = true;
66
69
  select.dispatchEvent(new Event("change", { bubbles: true }));
70
+ own = false;
67
71
  };
68
72
 
69
73
  const chooseTime = (button: HTMLButtonElement, focus: boolean) => {
@@ -127,15 +131,22 @@ export function enhancePicker(picker: HTMLElement): void {
127
131
  }
128
132
  }
129
133
 
130
- // A value the browser kept (back/forward, a failed submit): show its day and time.
131
- const kept =
132
- select.value && picker.querySelector<HTMLButtonElement>(`[data-occurrence="${CSS.escape(select.value)}"]`);
133
- const keptDay =
134
- kept && dayButtons.find((b) => b.dataset.day === kept.closest<HTMLElement>("[data-times]")?.dataset.times);
135
- if (kept && keptDay) {
136
- showDay(keptDay, false);
137
- chooseTime(kept, false);
138
- }
134
+ // A value the browser kept (back/forward, a failed submit): show its day and time. Also when a script sets
135
+ // the select later and says so with `change` (the suite's refused-form restore, whose script may run after
136
+ // this one, T157); the picker's own changes are skipped.
137
+ const showSelected = () => {
138
+ if (own) return;
139
+ const kept =
140
+ select.value && picker.querySelector<HTMLButtonElement>(`[data-occurrence="${CSS.escape(select.value)}"]`);
141
+ const keptDay =
142
+ kept && dayButtons.find((b) => b.dataset.day === kept.closest<HTMLElement>("[data-times]")?.dataset.times);
143
+ if (kept && keptDay) {
144
+ showDay(keptDay, false);
145
+ chooseTime(kept, false);
146
+ }
147
+ };
148
+ select.addEventListener("change", showSelected);
149
+ showSelected();
139
150
  }
140
151
 
141
152
  if (typeof document !== "undefined") {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * "Print or save as PDF" on the booking page (T157): the button stays hidden without JavaScript (it could do
3
+ * nothing there; the browser's own Print still uses the page's print stylesheet). Self-contained; no text.
4
+ */
5
+ export function wirePrint(doc: Document, print: () => void): void {
6
+ for (const button of doc.querySelectorAll<HTMLButtonElement>("button[data-print]")) {
7
+ button.hidden = false;
8
+ button.addEventListener("click", () => print());
9
+ }
10
+ }
11
+
12
+ if (typeof document !== "undefined") wirePrint(document, () => window.print());
package/src/i18n/ar.ts CHANGED
@@ -114,6 +114,11 @@ export const ar: Messages = {
114
114
  "booking.cancelUntil": "يمكنك الإلغاء حتى {time}.",
115
115
  "booking.cancel": "إلغاء الحجز",
116
116
  "booking.cancelFailed": "تعذّر علينا إلغاء هذا الحجز.",
117
+ "booking.cancelConfirm": "يؤدي الإلغاء إلى تحرير أماكنك، ولا يمكن التراجع عنه.",
118
+ "booking.cancelYes": "نعم، ألغِ هذا الحجز",
119
+ "booking.attendeesHeading": "الحضور",
120
+ "booking.print": "اطبع أو احفظ بصيغة PDF",
121
+ "booking.organiser": "المنظِّم: {name}",
117
122
  "booking.offer.intro": "التذاكر من قائمة الانتظار محجوزة لك. استلمها على هذا الجهاز؛ يعمل الرابط مرة واحدة.",
118
123
  "booking.offer.button": "استلم تذاكري",
119
124
  "booking.open.intro": "افتح حجزك على هذا الجهاز. يعمل الرابط مرة واحدة، وبعدها يتذكر هذا المتصفح حجزك.",
@@ -165,6 +170,7 @@ export const ar: Messages = {
165
170
 
166
171
  "pass.qr": "رمز QR لرمز تسجيل الحضور",
167
172
  "pass.code": "رمز تسجيل الحضور",
173
+ "pass.codeShow": "إظهار الرمز لكتابته يدويًا",
168
174
  "pass.status.pending": "بانتظار توقيع إقرار التنازل",
169
175
  "pass.status.cancelled": "ملغاة",
170
176
  "calendar.add": "أضف إلى التقويم",
package/src/i18n/en.ts CHANGED
@@ -116,6 +116,11 @@ export const en = {
116
116
  "booking.cancelUntil": "You can cancel until {time}.",
117
117
  "booking.cancel": "Cancel booking",
118
118
  "booking.cancelFailed": "We could not cancel this booking.",
119
+ "booking.cancelConfirm": "Cancelling releases your places. This cannot be undone.",
120
+ "booking.cancelYes": "Yes, cancel this booking",
121
+ "booking.attendeesHeading": "Who is coming",
122
+ "booking.print": "Print or save as PDF",
123
+ "booking.organiser": "Organised by {name}",
119
124
  "booking.offer.intro": "Tickets from the waitlist are held for you. Claim them on this device; the link works once.",
120
125
  "booking.offer.button": "Claim my tickets",
121
126
  "booking.open.intro": "Open your booking on this device. The link works once; after that this browser remembers it.",
@@ -169,6 +174,7 @@ export const en = {
169
174
 
170
175
  "pass.qr": "QR code of the check-in code",
171
176
  "pass.code": "Check-in code",
177
+ "pass.codeShow": "Show the code to type in",
172
178
  "pass.status.pending": "Waiting for a signed waiver",
173
179
  "pass.status.cancelled": "Cancelled",
174
180
  "calendar.add": "Add to calendar",