@semics-tech/emdash-events 1.0.0-rc.11 → 1.0.0-rc.12

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  /** @type {import("emdash").PluginDescriptor} */
8
8
  const descriptor = Object.freeze({
9
9
  "id": "semics-events",
10
- "version": "1.0.0-rc.11",
10
+ "version": "1.0.0-rc.12",
11
11
  "format": "standard",
12
12
  "entrypoint": "@semics-tech/emdash-events/sandbox",
13
13
  "capabilities": [
@@ -364,6 +364,11 @@ const descriptor = Object.freeze({
364
364
  "description": "Used by Events Pro only, for paid tickets; the Free edition ignores it. Stored encrypted.",
365
365
  "type": "secret"
366
366
  },
367
+ "vouchersPairing": {
368
+ "label": "Vouchers pairing string (Pro)",
369
+ "description": "Used by Events Pro only, for gift vouchers; the Free edition ignores it. Stored encrypted.",
370
+ "type": "secret"
371
+ },
367
372
  "retentionDays": {
368
373
  "label": "Keep booking data (days)",
369
374
  "description": "Personal data of past events is erased after this many days.",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "semics-events",
3
- "version": "1.0.0-rc.11",
3
+ "version": "1.0.0-rc.12",
4
4
  "declaredAccess": {
5
5
  "content": {
6
6
  "read": {}
@@ -345,6 +345,11 @@
345
345
  "description": "Used by Events Pro only, for paid tickets; the Free edition ignores it. Stored encrypted.",
346
346
  "type": "secret"
347
347
  },
348
+ "vouchersPairing": {
349
+ "label": "Vouchers pairing string (Pro)",
350
+ "description": "Used by Events Pro only, for gift vouchers; the Free edition ignores it. Stored encrypted.",
351
+ "type": "secret"
352
+ },
348
353
  "retentionDays": {
349
354
  "label": "Keep booking data (days)",
350
355
  "description": "Personal data of past events is erased after this many days.",
@@ -34,6 +34,8 @@ export interface PublicRouteError {
34
34
  message: string;
35
35
  /** Input validation issues, when the route reported them (`BAD_REQUEST`). */
36
36
  issues?: PublicRouteIssue[];
37
+ /** Any other top-level fields of the route's refusal, e.g. Vouchers' `lookups` (T166). */
38
+ details?: Record<string, unknown>;
37
39
  }
38
40
  export type PublicRouteResult<T> = {
39
41
  ok: true;
@@ -100,10 +100,12 @@ function refusal(data) {
100
100
  const body = data;
101
101
  if (body.ok !== false || typeof body.error?.code !== "string")
102
102
  return undefined;
103
+ const { ok: _ok, error: _error, issues: _issues, ...details } = body;
103
104
  return {
104
105
  code: body.error.code,
105
106
  message: typeof body.error.message === "string" ? body.error.message : "Request failed",
106
107
  ...(Array.isArray(body.issues) ? { issues: body.issues } : {}),
108
+ ...(Object.keys(details).length > 0 ? { details } : {}),
107
109
  };
108
110
  }
109
111
  function toResult(envelope, via) {
@@ -19,6 +19,14 @@ export interface EventsIntegrationOptions {
19
19
  reconcile?: string;
20
20
  /** How the plugin's own pages look on this site: theme, stylesheet, brand, event page path (`PageOptions`). */
21
21
  page?: PageOptions;
22
+ /**
23
+ * Gift vouchers (T166): the Vouchers core's plugin id and a module exporting `holdVoucher(ctx, input, ids)`
24
+ * (the suite passes its own). The checkout then holds a typed "Gift voucher code" between reserve and continue.
25
+ */
26
+ vouchers?: {
27
+ pluginId: string;
28
+ module: string;
29
+ };
22
30
  }
23
31
  /** The slice of Astro's integration API this needs (so the package takes no `astro` dependency). */
24
32
  interface SetupArgs {
@@ -20,6 +20,15 @@ export function eventsIntegration(options = {}) {
20
20
  options.reconcile
21
21
  ? `export { reconcileBooking as reconcile } from ${JSON.stringify(options.reconcile)};`
22
22
  : "export const reconcile = null;",
23
+ // Only with vouchers: a site without them gets exactly the config it had (pages read these by namespace).
24
+ ...(options.vouchers
25
+ ? [
26
+ `export const vouchersPluginId = ${JSON.stringify(options.vouchers.pluginId)};`,
27
+ `export { holdVoucher } from ${JSON.stringify(options.vouchers.module)};`,
28
+ // T168: the module's dry run, run before reserving.
29
+ `export { checkVoucher } from ${JSON.stringify(options.vouchers.module)};`,
30
+ ]
31
+ : []),
23
32
  ].join("\n");
24
33
  return {
25
34
  name: "semics-events",
@@ -189,6 +189,11 @@
189
189
  "label": "Stripe webhook signing secret (Pro)",
190
190
  "description": "Used by Events Pro only, for paid tickets; the Free edition ignores it. Stored encrypted."
191
191
  },
192
+ "vouchersPairing": {
193
+ "type": "secret",
194
+ "label": "Vouchers pairing string (Pro)",
195
+ "description": "Used by Events Pro only, for gift vouchers; the Free edition ignores it. Stored encrypted."
196
+ },
192
197
  "retentionDays": {
193
198
  "type": "number",
194
199
  "label": "Keep booking data (days)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semics-tech/emdash-events",
3
- "version": "1.0.0-rc.11",
3
+ "version": "1.0.0-rc.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.mjs",
6
6
  "exports": {
@@ -8,7 +8,7 @@
8
8
  // `src/client/receipt.ts` clears the fragment and posts the receipt here, which forwards it to the
9
9
  // core's `signatures/receipt` (no access token needed: the receipt is HMAC-signed) and redirects to
10
10
  // `?ref=&waiver=<outcome>`.
11
- import { esignPluginId, page, pluginId, reconcile } from "virtual:semics-events/config";
11
+ import * as config from "virtual:semics-events/config";
12
12
 
13
13
  import { type MessageKey, pickLocale, translator } from "../i18n/index";
14
14
  import AddToCalendar from "./AddToCalendar.astro";
@@ -39,6 +39,10 @@ import TicketPass from "./TicketPass.astro";
39
39
 
40
40
  export const prerender = false;
41
41
 
42
+ const { esignPluginId, page, pluginId, reconcile } = config;
43
+ // Gift vouchers (T166): exported only when the site wires Vouchers, so read through the namespace.
44
+ const vouchersPluginId = (config as Partial<typeof config>).vouchersPluginId;
45
+
42
46
  Astro.response.headers.set("Referrer-Policy", "no-referrer");
43
47
  Astro.response.headers.set("Cache-Control", "private, no-store");
44
48
 
@@ -144,7 +148,12 @@ if (ref && token) {
144
148
  // closed the tab or signed by email has a receipt this page forwards, then it shows the booking afresh.
145
149
  // An ended booking's open envelopes are voided the same way (Pro's void intents, T152).
146
150
  if (reconcileWanted(booking) && reconcile && esignPluginId) {
147
- const done = await reconcile(ctx, { booking, pluginId, esignPluginId });
151
+ const done = await reconcile(ctx, {
152
+ booking,
153
+ pluginId,
154
+ esignPluginId,
155
+ ...(vouchersPluginId ? { vouchersPluginId } : {}),
156
+ });
148
157
  if (done.forwarded > 0) {
149
158
  const fresh = await callPublicRoute<BookingView>(ctx, {
150
159
  method: "POST",
@@ -89,6 +89,11 @@ const names = showAttendees && new Set(named).size > 1 ? named : [];
89
89
  <ul>{names.map((name) => <li>{name}</li>)}</ul>
90
90
  </div>
91
91
  )}
92
+ {(booking.totals.voucherMinor ?? 0) > 0 && (
93
+ <p class="semics-booking-voucher" data-testid="booking-voucher">
94
+ {t("booking.voucher")} <span>−{formatMoney(booking.totals.voucherMinor ?? 0, booking.totals.currency, locale)}</span>
95
+ </p>
96
+ )}
92
97
  <p class="semics-booking-total">{t("booking.total")} <strong>{formatMoney(booking.totals.totalMinor, booking.totals.currency, locale)}</strong></p>
93
98
  </div>
94
99
  {
@@ -61,6 +61,9 @@ const id = anchorId(eventId);
61
61
  // Promo codes are Events Pro's (T078): the field shows only when the core says it takes them. An
62
62
  // applied code lives in an HttpOnly cookie (`/_events/promo`), never the URL, and is checked again here.
63
63
  const takesCodes = data?.promoCodes === true;
64
+ // Gift vouchers (T166): only Events Pro paired with Vouchers says so. The code goes with the order; the
65
+ // checkout holds it with Vouchers between reserve and continue, and never puts it in a URL.
66
+ const takesVouchers = data?.vouchers === true;
64
67
  let promo: PromoView | null = Astro.props.promo ?? null;
65
68
  if (takesCodes && Astro.props.promo === undefined) {
66
69
  let code = "";
@@ -301,6 +304,27 @@ const when = (iso: string) => {
301
304
  </div>
302
305
  )}
303
306
 
307
+ {takesVouchers && (
308
+ <div class="semics-field semics-voucher">
309
+ <label for={`${id}-voucher`}>{t("widget.voucher.label")}</label>
310
+ <input
311
+ id={`${id}-voucher`}
312
+ name="voucherCode"
313
+ type="text"
314
+ autocomplete="off"
315
+ autocapitalize="characters"
316
+ spellcheck="false"
317
+ maxlength="64"
318
+ data-field="voucher"
319
+ aria-invalid={invalid("voucher")}
320
+ aria-describedby={errId("voucher")}
321
+ />
322
+ <p class="semics-field-error" id={errId("voucher")} data-error-for="voucher" data-message={fieldText("voucher")}>
323
+ {bad("voucher") ? fieldText("voucher") : ""}
324
+ </p>
325
+ </div>
326
+ )}
327
+
304
328
  <fieldset class="semics-tickets" data-field="tickets" aria-invalid={invalid("tickets")} aria-describedby={errId("tickets")}>
305
329
  <legend>{t("widget.tickets")}</legend>
306
330
  {ticketTypes.map((type) => {
@@ -1,11 +1,29 @@
1
1
  // Injected at `/_events/checkout` by the integration. A plain form post (no JavaScript needed).
2
2
  // Cross-site posts get a 403 before anything runs (`isCrossSiteRequest`, T057).
3
- import { pluginId } from "virtual:semics-events/config";
3
+ // With `eventsIntegration({ vouchers })` a typed gift voucher code is held through the suite's hook (T166).
4
+ import * as config from "virtual:semics-events/config";
4
5
 
5
- import { type CheckoutEndpointContext, handleCheckoutRequest } from "./lib/checkout-form";
6
+ import {
7
+ type CheckoutEndpointContext,
8
+ handleCheckoutRequest,
9
+ type VoucherCheckHook,
10
+ type VoucherHook,
11
+ } from "./lib/checkout-form";
6
12
 
7
13
  export const prerender = false;
8
14
 
15
+ const { pluginId, vouchersPluginId, holdVoucher, checkVoucher } = config as Partial<typeof config> & {
16
+ pluginId: string;
17
+ };
18
+ const voucher: VoucherHook | undefined =
19
+ holdVoucher && vouchersPluginId
20
+ ? (ctx, input) => holdVoucher(ctx, input, { eventsPluginId: pluginId, vouchersPluginId })
21
+ : undefined;
22
+
23
+ // T168: the code is checked before reserving, so a refused one leaves no booking (and no "cancelled" email).
24
+ const check: VoucherCheckHook | undefined =
25
+ checkVoucher && vouchersPluginId ? (ctx, input) => checkVoucher(ctx, input, { vouchersPluginId }) : undefined;
26
+
9
27
  export function POST(ctx: CheckoutEndpointContext): Promise<Response> {
10
- return handleCheckoutRequest(ctx, { pluginId });
28
+ return handleCheckoutRequest(ctx, { pluginId, ...(voucher ? { voucher } : {}), ...(check ? { check } : {}) });
11
29
  }
@@ -41,6 +41,8 @@ export interface PublicRouteError {
41
41
  message: string;
42
42
  /** Input validation issues, when the route reported them (`BAD_REQUEST`). */
43
43
  issues?: PublicRouteIssue[];
44
+ /** Any other top-level fields of the route's refusal, e.g. Vouchers' `lookups` (T166). */
45
+ details?: Record<string, unknown>;
44
46
  }
45
47
 
46
48
  export type PublicRouteResult<T> =
@@ -162,10 +164,12 @@ function refusal(data: unknown): PublicRouteError | undefined {
162
164
  if (!data || typeof data !== "object") return undefined;
163
165
  const body = data as { ok?: unknown; error?: { code?: unknown; message?: unknown }; issues?: unknown };
164
166
  if (body.ok !== false || typeof body.error?.code !== "string") return undefined;
167
+ const { ok: _ok, error: _error, issues: _issues, ...details } = body as Record<string, unknown>;
165
168
  return {
166
169
  code: body.error.code,
167
170
  message: typeof body.error.message === "string" ? body.error.message : "Request failed",
168
171
  ...(Array.isArray(body.issues) ? { issues: body.issues as PublicRouteIssue[] } : {}),
172
+ ...(Object.keys(details).length > 0 ? { details } : {}),
169
173
  };
170
174
  }
171
175
 
@@ -11,13 +11,35 @@ import {
11
11
  widgetErrorLocation,
12
12
  } from "./widget";
13
13
 
14
+ /** What the suite's voucher hook answers (T166): a signed `voucher-hold/1` token, or the refusal's code. */
15
+ export type VoucherHoldResult = { ok: true; hold: string } | { ok: false; code: string };
16
+
17
+ /**
18
+ * Holds a gift voucher for a booking just reserved (T166, voucher/1 §8.1): the suite's `holdVoucher`, given
19
+ * through `eventsIntegration({ vouchers })`. Events never talks to Vouchers itself.
20
+ */
21
+ export type VoucherHook = (
22
+ ctx: PublicRouteContext,
23
+ input: { code: string; bookingRef: string; accessToken: string },
24
+ ) => Promise<VoucherHoldResult>;
25
+
14
26
  export interface CheckoutFormOptions {
15
27
  /** The core's plugin id. Defaults to the slug; registry installs pass their `r_…` id. */
16
28
  pluginId?: string;
17
29
  /** Injected for tests: makes the idempotency key when the form carries none. */
18
30
  newKey?: () => string;
31
+ /** The gift voucher hold (T166); without it a typed voucher code is refused (`VOUCHER_UNAVAILABLE`). */
32
+ voucher?: VoucherHook;
33
+ /** The suite's dry run of that hold before reserving (T168); without it the hold alone decides. */
34
+ check?: VoucherCheckHook;
19
35
  }
20
36
 
37
+ /** Checks a typed gift voucher code before anything is reserved (T168): the suite's `checkVoucher`. */
38
+ export type VoucherCheckHook = (
39
+ ctx: PublicRouteContext,
40
+ input: { code: string; eventId: string; ticketTypeIds: string[] },
41
+ ) => Promise<{ ok: true } | { ok: false; code: string }>;
42
+
21
43
  export interface CheckoutRedirect {
22
44
  location: string;
23
45
  /** The booking's access token, for an HttpOnly cookie scoped to `/booking`. Never in a URL. */
@@ -178,6 +200,16 @@ export async function handleCheckoutForm(
178
200
  });
179
201
  if (invalid.length > 0) return refuse("BAD_REQUEST", invalid);
180
202
 
203
+ // A gift voucher (T166) is held between reserve and continue; without the suite's hook it cannot be.
204
+ const voucherCode = text(form, "voucherCode");
205
+ if (voucherCode && !options.voucher) return refuse("VOUCHER_UNAVAILABLE", ["voucher"]);
206
+ // T168: a code the suite's check refuses never reserves, so no booking is held, cancelled and emailed.
207
+ if (voucherCode && options.check) {
208
+ const ticketTypeIds = lines.map((l) => l.ticketTypeId);
209
+ const checked = await options.check(ctx, { code: voucherCode, eventId, ticketTypeIds });
210
+ if (!checked.ok) return refuse(checked.code, ["voucher"]);
211
+ }
212
+
181
213
  const turnstileToken = text(form, "cf-turnstile-response");
182
214
  // Only a typed code is sent: Free's reserve refuses unknown keys, and only Pro offers the field.
183
215
  const promoCode = text(form, "promoCode");
@@ -210,11 +242,22 @@ export async function handleCheckoutForm(
210
242
  // A resubmit of a booking that is already confirmed gets no new token: this browser has its cookie.
211
243
  if (!accessToken) return { location: done };
212
244
  const cookie = { name: bookingCookieName(bookingRef), value: accessToken };
245
+ let voucherHold: string | undefined;
246
+ if (voucherCode && options.voucher) {
247
+ const held = await options.voucher(ctx, { code: voucherCode, bookingRef, accessToken });
248
+ if (!held.ok) {
249
+ // Nothing paid yet: release the places so the corrected order can have them.
250
+ const body = { bookingRef, accessToken };
251
+ await callPublicRoute(ctx, { method: "POST", path: "public/booking/cancel", pluginId, body });
252
+ return refuse(held.code, ["voucher"]);
253
+ }
254
+ voucherHold = held.hold;
255
+ }
213
256
  const next = await callPublicRoute<{ next?: { type?: string; url?: string } }>(ctx, {
214
257
  method: "POST",
215
258
  path: "public/checkout/continue",
216
259
  pluginId,
217
- body: { bookingRef, accessToken },
260
+ body: { bookingRef, accessToken, ...(voucherHold ? { voucherHold } : {}) },
218
261
  });
219
262
  if (!next.ok) return fail(next.error.code, bookingRef, cookie);
220
263
 
@@ -42,6 +42,8 @@ export interface PublicEvent {
42
42
  waiverAfter?: boolean;
43
43
  /** True when the core takes promo codes (Events Pro, T078): the widget then shows a code field. */
44
44
  promoCodes?: boolean;
45
+ /** True when Events Pro is paired with Vouchers (T166): the widget then shows a "Gift voucher code" field. */
46
+ vouchers?: boolean;
45
47
  /** True when a sold-out event takes a waitlist (T081): the widget then shows a "Join the waitlist" form. */
46
48
  waitlist?: boolean;
47
49
  /** Custom attendee questions (Events Pro, T080): the buyer answers them once per booking. */
@@ -53,8 +55,8 @@ export interface PublicEvent {
53
55
  * lines carry only ids (UUIDs for types made in the editor). A hidden type is not listed there.
54
56
  */
55
57
  /** Whether the booking page hands the booking to the suite's reconciliation: lookups, or void intents (T152). */
56
- export const reconcileWanted = (b: Pick<BookingView, "waiver"> | undefined): boolean =>
57
- Boolean(b?.waiver?.lookups || b?.waiver?.voids);
58
+ export const reconcileWanted = (b: Pick<BookingView, "waiver" | "voucher"> | undefined): boolean =>
59
+ Boolean(b?.waiver?.lookups || b?.waiver?.voids || b?.voucher?.settle);
58
60
 
59
61
  export function ticketNames(event: Pick<PublicEvent, "ticketTypes"> | undefined): Record<string, string> {
60
62
  return Object.fromEntries((event?.ticketTypes ?? []).map((t) => [t.id, t.name]));
@@ -76,7 +78,10 @@ export interface BookingView {
76
78
  status: string;
77
79
  eventId?: string;
78
80
  lines: Array<{ ticketTypeId: string; qty: number }>;
79
- totals: { totalMinor: number; currency: string };
81
+ /** `voucherMinor`: what a gift voucher paid (Events Pro, T166), already taken off `totalMinor`. */
82
+ totals: { totalMinor: number; currency: string; voucherMinor?: number };
83
+ /** Events Pro (T166): the voucher hold's signed outcome, which the suite passes to Vouchers. */
84
+ voucher?: { settle?: string | null };
80
85
  holdExpiresAt?: string;
81
86
  /** The event's public info: the booked session (`startsAt`, in `timezone`) and `venue` lead the page (T157); `slug` for "Book again". */
82
87
  event?: { title?: string; startsAt?: string; timezone?: string | null; venue?: string | null; slug?: string | null };
@@ -110,13 +115,13 @@ export interface BookingView {
110
115
 
111
116
  /** A custom question's field is `q:<question id>` (T080). */
112
117
  export type QuestionField = `q:${string}`;
113
- export type WidgetField = "occurrence" | "promo" | "tickets" | "name" | "email" | QuestionField;
118
+ export type WidgetField = "occurrence" | "promo" | "voucher" | "tickets" | "name" | "email" | QuestionField;
114
119
 
115
120
  /** Question ids safe in HTML ids, field names and the widget's error URL. */
116
121
  export const QUESTION_ID = /^[A-Za-z0-9_-]{1,64}$/;
117
122
 
118
123
  /** In form order: the first one is where focus goes. */
119
- export const WIDGET_FIELDS = ["occurrence", "promo", "tickets", "name", "email"] as const;
124
+ export const WIDGET_FIELDS = ["occurrence", "promo", "voucher", "tickets", "name", "email"] as const;
120
125
 
121
126
  export const WIDGET_PARAMS = { error: "booking_error", fields: "booking_fields", event: "booking_event" } as const;
122
127
 
@@ -135,6 +140,11 @@ const ERROR_CODES = [
135
140
  "PROMO_EXHAUSTED",
136
141
  "PROMO_ORDER_TOO_LARGE",
137
142
  "PROMO_UNAVAILABLE",
143
+ "VOUCHER_INVALID",
144
+ "VOUCHER_NO_BALANCE",
145
+ "VOUCHER_WRONG_ACTIVITY",
146
+ "VOUCHER_CURRENCY",
147
+ "VOUCHER_UNAVAILABLE",
138
148
  "INTERNAL",
139
149
  ] as const;
140
150
 
@@ -12,7 +12,29 @@ declare module "virtual:semics-events/config" {
12
12
  export const reconcile:
13
13
  | ((
14
14
  ctx: import("./lib/call").PublicRouteContext,
15
- input: { booking: import("./lib/widget").BookingView; pluginId: string; esignPluginId: string },
15
+ input: {
16
+ booking: import("./lib/widget").BookingView;
17
+ pluginId: string;
18
+ esignPluginId: string;
19
+ vouchersPluginId?: string;
20
+ },
16
21
  ) => Promise<{ forwarded: number }>)
17
22
  | null;
23
+ /** Gift vouchers (T166): only exported with `eventsIntegration({ vouchers })`; read through a namespace import. */
24
+ export const vouchersPluginId: string | undefined;
25
+ export const holdVoucher:
26
+ | ((
27
+ ctx: import("./lib/call").PublicRouteContext,
28
+ input: { code: string; bookingRef: string; accessToken: string },
29
+ ids: { eventsPluginId: string; vouchersPluginId: string },
30
+ ) => Promise<import("./lib/checkout-form").VoucherHoldResult>)
31
+ | undefined;
32
+ /** T168: the suite's check of a code before reserving; exported with `holdVoucher`. */
33
+ export const checkVoucher:
34
+ | ((
35
+ ctx: import("./lib/call").PublicRouteContext,
36
+ input: { code: string; eventId: string; ticketTypeIds: string[] },
37
+ ids: { vouchersPluginId: string },
38
+ ) => Promise<{ ok: true } | { ok: false; code: string }>)
39
+ | undefined;
18
40
  }
package/src/i18n/ar.ts CHANGED
@@ -33,6 +33,7 @@ export const ar: Messages = {
33
33
  "widget.promo.label": "رمز الخصم",
34
34
  "widget.promo.apply": "تطبيق الرمز",
35
35
  "widget.promo.update": "تحديث الرمز",
36
+ "widget.voucher.label": "رمز قسيمة الهدية",
36
37
  "widget.tickets": "التذاكر",
37
38
  "widget.soldOut": "نفدت التذاكر",
38
39
  "widget.name": "اسمك",
@@ -44,6 +45,7 @@ export const ar: Messages = {
44
45
  "widget.book": "احجز",
45
46
  "widget.field.occurrence": "اختر تاريخًا.",
46
47
  "widget.field.promo": "تحقق من الرمز، أو اترك الحقل فارغًا.",
48
+ "widget.field.voucher": "تحقق من الرمز، أو اترك الحقل فارغًا.",
47
49
  "widget.field.tickets": "اختر تذكرة واحدة على الأقل.",
48
50
  "widget.field.name": "أدخل اسمك.",
49
51
  "widget.field.email": "أدخل بريدًا إلكترونيًا صحيحًا.",
@@ -59,6 +61,11 @@ export const ar: Messages = {
59
61
  "widget.error.PROMO_ORDER_TOO_LARGE":
60
62
  "لا يمكن استخدام هذا الرمز لطلب بهذا الحجم. اطلب أنواعًا أقل من التذاكر في المرة الواحدة.",
61
63
  "widget.error.PROMO_UNAVAILABLE": "لا يمكن استخدام هذا الرمز الآن. احذفه للحجز من دونه.",
64
+ "widget.error.VOUCHER_INVALID": "رمز قسيمة الهدية هذا غير صالح.",
65
+ "widget.error.VOUCHER_NO_BALANCE": "لم يتبقَّ رصيد في قسيمة الهدية هذه.",
66
+ "widget.error.VOUCHER_WRONG_ACTIVITY": "قسيمة الهدية هذه مخصصة لنشاط آخر.",
67
+ "widget.error.VOUCHER_CURRENCY": "قسيمة الهدية هذه بعملة مختلفة.",
68
+ "widget.error.VOUCHER_UNAVAILABLE": "لا يمكن استخدام قسائم الهدايا الآن. احذف الرمز للحجز بدونه.",
62
69
  "widget.error.INTERNAL": "حدث خطأ ما. يُرجى المحاولة مرة أخرى.",
63
70
 
64
71
  "waitlist.heading": "انضم إلى قائمة الانتظار",
@@ -110,6 +117,7 @@ export const ar: Messages = {
110
117
  "booking.bookAgain": "احجز مرة أخرى",
111
118
  "booking.decideBy": "سيوافق المنظّم على طلبك أو يرفضه بحلول {time}، وسنراسلك بالبريد الإلكتروني.",
112
119
  "booking.line": "{qty} × {name}",
120
+ "booking.voucher": "قسيمة هدية",
113
121
  "booking.total": "المجموع",
114
122
  "booking.cancelUntil": "يمكنك الإلغاء حتى {time}.",
115
123
  "booking.cancel": "إلغاء الحجز",
package/src/i18n/en.ts CHANGED
@@ -34,6 +34,7 @@ export const en = {
34
34
  "widget.promo.label": "Promo code",
35
35
  "widget.promo.apply": "Apply code",
36
36
  "widget.promo.update": "Update code",
37
+ "widget.voucher.label": "Gift voucher code",
37
38
  "widget.tickets": "Tickets",
38
39
  "widget.soldOut": "Sold out",
39
40
  "widget.name": "Your name",
@@ -45,6 +46,7 @@ export const en = {
45
46
  "widget.book": "Book",
46
47
  "widget.field.occurrence": "Choose a date.",
47
48
  "widget.field.promo": "Check the code, or leave it empty.",
49
+ "widget.field.voucher": "Check the code, or leave it empty.",
48
50
  "widget.field.tickets": "Choose at least one ticket.",
49
51
  "widget.field.name": "Enter your name.",
50
52
  "widget.field.email": "Enter a valid email address.",
@@ -60,6 +62,11 @@ export const en = {
60
62
  "widget.error.PROMO_ORDER_TOO_LARGE":
61
63
  "That code can't be used on an order this large. Order fewer ticket types at once.",
62
64
  "widget.error.PROMO_UNAVAILABLE": "That code can't be used right now. Remove it to book without it.",
65
+ "widget.error.VOUCHER_INVALID": "That gift voucher code is not valid.",
66
+ "widget.error.VOUCHER_NO_BALANCE": "That gift voucher has nothing left to spend.",
67
+ "widget.error.VOUCHER_WRONG_ACTIVITY": "That gift voucher is for a different activity.",
68
+ "widget.error.VOUCHER_CURRENCY": "That gift voucher is in a different currency.",
69
+ "widget.error.VOUCHER_UNAVAILABLE": "Gift vouchers can't be used right now. Remove the code to book without it.",
63
70
  "widget.error.INTERNAL": "Something went wrong. Please try again.",
64
71
 
65
72
  "waitlist.heading": "Join the waitlist",
@@ -112,6 +119,7 @@ export const en = {
112
119
  "booking.signAgain": "If there is a waiver, you will sign it again when you book.",
113
120
  "booking.bookAgain": "Book again",
114
121
  "booking.line": "{qty} × {name}",
122
+ "booking.voucher": "Gift voucher",
115
123
  "booking.total": "Total",
116
124
  "booking.cancelUntil": "You can cancel until {time}.",
117
125
  "booking.cancel": "Cancel booking",