@composable-os/pack-ticketing 0.1.0-beta.11 → 0.1.0-beta.14

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.
@@ -97,6 +97,7 @@ export type TicketingClient = PackClient<TicketingOperations>;
97
97
  /**
98
98
  * How many decimal places `currency` has (2 for AUD, 0 for JPY), for display. The currency is
99
99
  * always the host's, from the data (a ticket type's `currency`, an order's): never the app's.
100
+ * Asked once per currency: a list of prices asks it for every line.
100
101
  */
101
102
  export declare function currencyDigits(currency: string | null | undefined): number;
102
103
  /** An amount in the minor unit as the buyer reads it: `450.00 AUD`. Display only. */
@@ -135,6 +136,8 @@ export declare function eventCurrency(event: EventOnSale): string | null;
135
136
  export declare function minorFromInput(text: string, currency?: string | null): number | null;
136
137
  /** What the picker shows of a ticket type's places: "Sold out", "Only 3 left", or nothing. */
137
138
  export declare function availabilityLabel(availability: TicketTypeOnSale["availability"]): string | null;
139
+ /** A ticket's state as its holder reads it (a void ticket is "Cancelled"). Display only. */
140
+ export declare function ticketStateLabel(state: string | null): string | null;
138
141
  /** Quantities chosen, by ticket type id. */
139
142
  export type Quantities = Readonly<Record<string, number>>;
140
143
  /** The lines `orderStart` takes, from what was chosen. */
@@ -180,12 +183,15 @@ export type UseQuery = <T>(options: {
180
183
  export type UseMutation = <I, O>(options: {
181
184
  mutationKey: readonly unknown[];
182
185
  mutationFn: (input: I) => Promise<O>;
186
+ gcTime?: number;
183
187
  }) => {
184
188
  mutate(input: I): void;
185
189
  mutateAsync(input: I): Promise<O>;
186
190
  data: O | undefined;
187
191
  isPending: boolean;
188
192
  error: unknown;
193
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
194
+ reset?: () => void;
189
195
  };
190
196
  /** The app's `useState`. */
191
197
  export type UseState = <T>(initial: T) => [T, (next: T | ((previous: T) => T)) => void];
@@ -268,7 +274,7 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
268
274
  currency: string | null;
269
275
  };
270
276
  empty: boolean;
271
- max: (type: TicketTypeOnSale) => number;
277
+ max: typeof pickerMax;
272
278
  clear: () => void;
273
279
  };
274
280
  /** Starts the order through the host, which prices it and holds the places. */
@@ -280,6 +286,7 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
280
286
  }[];
281
287
  pay?: "deposit" | "full" | undefined;
282
288
  email?: string | undefined;
289
+ agreements?: Record<string, unknown>[] | undefined;
283
290
  }): void;
284
291
  mutateAsync(input: {
285
292
  lines: {
@@ -288,6 +295,7 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
288
295
  }[];
289
296
  pay?: "deposit" | "full" | undefined;
290
297
  email?: string | undefined;
298
+ agreements?: Record<string, unknown>[] | undefined;
291
299
  }): Promise<{
292
300
  id: string;
293
301
  state: string;
@@ -332,6 +340,8 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
332
340
  } | undefined;
333
341
  isPending: boolean;
334
342
  error: unknown;
343
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
344
+ reset?: () => void;
335
345
  };
336
346
  /** Opens the payment provider's page for an order (the first payment, or a balance). */
337
347
  useCheckout(): {
@@ -356,6 +366,8 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
356
366
  } | undefined;
357
367
  isPending: boolean;
358
368
  error: unknown;
369
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
370
+ reset?: () => void;
359
371
  };
360
372
  /** One order as its buyer sees it, asked again while it is waiting for the provider. */
361
373
  useOrder(order: {
@@ -449,6 +461,8 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
449
461
  } | undefined;
450
462
  isPending: boolean;
451
463
  error: unknown;
464
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
465
+ reset?: () => void;
452
466
  };
453
467
  /** Undoes a check-in made by mistake. */
454
468
  useUndoCheckIn(): {
@@ -499,6 +513,8 @@ export declare function createTicketingHooks<C extends ClientHolding>(react: {
499
513
  } | undefined;
500
514
  isPending: boolean;
501
515
  error: unknown;
516
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
517
+ reset?: () => void;
502
518
  };
503
519
  }, {
504
520
  readonly useEventsOnSale: readonly ["x.ticketing.eventsOnSale"];
@@ -566,7 +582,7 @@ declare function allTicketingHooks(react: {
566
582
  currency: string | null;
567
583
  };
568
584
  empty: boolean;
569
- max: (type: TicketTypeOnSale) => number;
585
+ max: typeof pickerMax;
570
586
  clear: () => void;
571
587
  };
572
588
  /** Starts the order through the host, which prices it and holds the places. */
@@ -578,6 +594,7 @@ declare function allTicketingHooks(react: {
578
594
  }[];
579
595
  pay?: "deposit" | "full" | undefined;
580
596
  email?: string | undefined;
597
+ agreements?: Record<string, unknown>[] | undefined;
581
598
  }): void;
582
599
  mutateAsync(input: {
583
600
  lines: {
@@ -586,6 +603,7 @@ declare function allTicketingHooks(react: {
586
603
  }[];
587
604
  pay?: "deposit" | "full" | undefined;
588
605
  email?: string | undefined;
606
+ agreements?: Record<string, unknown>[] | undefined;
589
607
  }): Promise<{
590
608
  id: string;
591
609
  state: string;
@@ -630,6 +648,8 @@ declare function allTicketingHooks(react: {
630
648
  } | undefined;
631
649
  isPending: boolean;
632
650
  error: unknown;
651
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
652
+ reset?: () => void;
633
653
  };
634
654
  /** Opens the payment provider's page for an order (the first payment, or a balance). */
635
655
  useCheckout(): {
@@ -654,6 +674,8 @@ declare function allTicketingHooks(react: {
654
674
  } | undefined;
655
675
  isPending: boolean;
656
676
  error: unknown;
677
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
678
+ reset?: () => void;
657
679
  };
658
680
  /** One order as its buyer sees it, asked again while it is waiting for the provider. */
659
681
  useOrder(order: {
@@ -747,6 +769,8 @@ declare function allTicketingHooks(react: {
747
769
  } | undefined;
748
770
  isPending: boolean;
749
771
  error: unknown;
772
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
773
+ reset?: () => void;
750
774
  };
751
775
  /** Undoes a check-in made by mistake. */
752
776
  useUndoCheckIn(): {
@@ -797,6 +821,8 @@ declare function allTicketingHooks(react: {
797
821
  } | undefined;
798
822
  isPending: boolean;
799
823
  error: unknown;
824
+ /** Forgets the call: its variables and its answer (TanStack Query's `reset`). */
825
+ reset?: () => void;
800
826
  };
801
827
  };
802
828
  /** Every hook of this entry, as a client of all its operations gets them. A block takes the ones it calls: `Pick<TicketingHooks, "useCheckIn">`. */
@@ -9,31 +9,38 @@
9
9
  // charge, shown before the order starts; the order the host returns is what is paid.
10
10
  import { packHooks } from "@composable-os/client";
11
11
  // --- Plain functions ------------------------------------------------------------------------------
12
+ const digitsByCurrency = new Map();
12
13
  /**
13
14
  * How many decimal places `currency` has (2 for AUD, 0 for JPY), for display. The currency is
14
15
  * always the host's, from the data (a ticket type's `currency`, an order's): never the app's.
16
+ * Asked once per currency: a list of prices asks it for every line.
15
17
  */
16
18
  export function currencyDigits(currency) {
17
19
  if (!currency)
18
20
  return 2;
19
- try {
20
- return (new Intl.NumberFormat("en", { style: "currency", currency }).resolvedOptions()
21
- .maximumFractionDigits ?? 2);
22
- }
23
- catch {
24
- return 2;
21
+ let digits = digitsByCurrency.get(currency);
22
+ if (digits === undefined) {
23
+ try {
24
+ digits =
25
+ new Intl.NumberFormat("en", { style: "currency", currency }).resolvedOptions()
26
+ .maximumFractionDigits ?? 2;
27
+ }
28
+ catch {
29
+ digits = 2;
30
+ }
31
+ digitsByCurrency.set(currency, digits);
25
32
  }
33
+ return digits;
26
34
  }
35
+ const withCurrency = (amount, currency) => currency ? `${amount} ${currency}` : amount;
27
36
  /** An amount in the minor unit as the buyer reads it: `450.00 AUD`. Display only. */
28
37
  export function formatMoney(minor, currency) {
29
38
  const digits = currencyDigits(currency);
30
- return `${(minor / 10 ** digits).toFixed(digits)}${currency ? ` ${currency}` : ""}`;
39
+ return withCurrency((minor / 10 ** digits).toFixed(digits), currency);
31
40
  }
32
41
  /** A ticket type's price (major unit, as the record holds it) as the buyer reads it. */
33
42
  export function formatPrice(price, currency) {
34
- return price === null
35
- ? ""
36
- : `${price.toFixed(currencyDigits(currency))}${currency ? ` ${currency}` : ""}`;
43
+ return price === null ? "" : withCurrency(price.toFixed(currencyDigits(currency)), currency);
37
44
  }
38
45
  /** The viewer's own time zone, as their device reports it. */
39
46
  export function viewerTimeZone() {
@@ -101,13 +108,12 @@ export function eventDay(event) {
101
108
  if (Number.isNaN(at.getTime()))
102
109
  return "";
103
110
  try {
104
- const parts = new Intl.DateTimeFormat("en-CA", {
111
+ return new Intl.DateTimeFormat("en-CA", {
105
112
  timeZone: event.timeZone ?? viewerTimeZone(),
106
113
  year: "numeric",
107
114
  month: "2-digit",
108
115
  day: "2-digit",
109
116
  }).format(at);
110
- return parts;
111
117
  }
112
118
  catch {
113
119
  return event.startsAt.slice(0, 10);
@@ -137,6 +143,15 @@ export function availabilityLabel(availability) {
137
143
  }
138
144
  return null;
139
145
  }
146
+ const TICKET_STATE_LABELS = {
147
+ valid: "Valid",
148
+ used: "Used",
149
+ void: "Cancelled",
150
+ };
151
+ /** A ticket's state as its holder reads it (a void ticket is "Cancelled"). Display only. */
152
+ export function ticketStateLabel(state) {
153
+ return state === null ? null : (TICKET_STATE_LABELS[state] ?? state);
154
+ }
140
155
  /** The lines `orderStart` takes, from what was chosen. */
141
156
  export function pickerLines(quantities) {
142
157
  return Object.entries(quantities)
@@ -247,13 +262,15 @@ function allTicketingHooks(react, api) {
247
262
  lines,
248
263
  estimate: event ? estimate(event, quantities) : { full: 0, deposit: null, currency: null },
249
264
  empty: lines.length === 0,
250
- max: (type) => pickerMax(type),
265
+ max: pickerMax,
251
266
  clear: () => setQuantities({}),
252
267
  };
253
268
  },
254
269
  /** Starts the order through the host, which prices it and holds the places. */
255
270
  useStartOrder() {
256
- return useMutation(api.mutation("x.ticketing.orderStart"));
271
+ // A visitor's agreements (a name typed, a signature, health answers) go in this call:
272
+ // not kept in the app's cache once it is over (stage 44, issue #292).
273
+ return useMutation({ ...api.mutation("x.ticketing.orderStart"), gcTime: 0 });
257
274
  },
258
275
  /** Opens the payment provider's page for an order (the first payment, or a balance). */
259
276
  useCheckout() {
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare const _default: import("@composable-os/sdk").Extension<{
7
7
  readonly permissions: {
8
8
  readonly read: ["person"];
9
9
  readonly operations: ["order.start", "order.get", "query.sql", "public.list", "capacity.get", "extensionSettings.list", "order.settings.get"];
10
- readonly modules: ["ops", "email-send"];
10
+ readonly modules: ["ops", "routine-mail", "email-send"];
11
11
  };
12
12
  readonly objects: {
13
13
  readonly event: {
@@ -197,6 +197,12 @@ declare const _default: import("@composable-os/sdk").Extension<{
197
197
  readonly show: "low";
198
198
  readonly lowAt: 10;
199
199
  };
200
+ readonly agreements: {
201
+ readonly point: "event";
202
+ readonly label: "Buying a ticket";
203
+ readonly suggests: readonly ["waiver"];
204
+ readonly inlineStep: true;
205
+ };
200
206
  readonly sellable: {
201
207
  readonly price: "price";
202
208
  readonly saleWindow: {
@@ -231,6 +237,14 @@ declare const _default: import("@composable-os/sdk").Extension<{
231
237
  readonly line1: "taxAddress";
232
238
  };
233
239
  };
240
+ readonly finance: {
241
+ readonly category: {
242
+ readonly key: "tickets";
243
+ readonly label: "Tickets";
244
+ };
245
+ readonly earned: "at_date";
246
+ readonly at: "event.startsAt";
247
+ };
234
248
  };
235
249
  readonly public: {
236
250
  readonly read: readonly ["event", "name", "description", "price", "onSaleFrom", "onSaleUntil", "maxPerOrder", "depositAmount", "balanceDue"];
@@ -287,6 +301,8 @@ declare const _default: import("@composable-os/sdk").Extension<{
287
301
  readonly order: {
288
302
  readonly type: "text";
289
303
  readonly label: "Order";
304
+ readonly readOnly: true;
305
+ readonly description: "The order that granted this ticket, set by the host.";
290
306
  };
291
307
  readonly state: {
292
308
  readonly type: "select";
@@ -335,6 +351,15 @@ declare const _default: import("@composable-os/sdk").Extension<{
335
351
  readonly final: true;
336
352
  }];
337
353
  };
354
+ readonly agreements: {
355
+ readonly point: "event";
356
+ readonly label: "Buying a ticket";
357
+ readonly suggests: readonly ["waiver"];
358
+ readonly enter: readonly ["valid"];
359
+ readonly keeps: readonly ["valid", "used"];
360
+ readonly person: "holder";
361
+ readonly inlineStep: true;
362
+ };
338
363
  readonly customer: {
339
364
  readonly field: "holder";
340
365
  readonly read: readonly ["event", "tickettype", "code", "state"];
@@ -423,11 +448,187 @@ declare const _default: import("@composable-os/sdk").Extension<{
423
448
  readonly type: "text";
424
449
  readonly label: "Where buyers see their tickets";
425
450
  readonly description: string;
451
+ readonly personApproves: true;
426
452
  };
427
453
  readonly payUrl: {
428
454
  readonly type: "text";
429
455
  readonly label: "Where buyers pay a balance";
430
456
  readonly description: string;
457
+ readonly personApproves: true;
458
+ };
459
+ };
460
+ readonly routineMail: {
461
+ tickets: {
462
+ label: string;
463
+ description: string;
464
+ about: string;
465
+ slots: {
466
+ events: {
467
+ each: {
468
+ object: string;
469
+ via: string;
470
+ distinct: string;
471
+ max: number;
472
+ line: string;
473
+ slots: {
474
+ event: {
475
+ field: string;
476
+ };
477
+ when: {
478
+ field: string;
479
+ format: "datetime";
480
+ zone: string;
481
+ year: true;
482
+ optional: true;
483
+ };
484
+ venue: {
485
+ field: string;
486
+ optional: true;
487
+ };
488
+ };
489
+ };
490
+ };
491
+ tickets: {
492
+ each: {
493
+ object: string;
494
+ via: string;
495
+ max: number;
496
+ line: string;
497
+ slots: {
498
+ name: {
499
+ field: string;
500
+ };
501
+ code: {
502
+ field: string;
503
+ max: number;
504
+ private: true;
505
+ };
506
+ };
507
+ };
508
+ };
509
+ link: {
510
+ link: string;
511
+ withId: string;
512
+ };
513
+ };
514
+ messages: {
515
+ one: {
516
+ subject: string;
517
+ text: string;
518
+ };
519
+ many: {
520
+ subject: string;
521
+ text: string;
522
+ };
523
+ };
524
+ };
525
+ eventReminder: {
526
+ label: string;
527
+ description: string;
528
+ about: string;
529
+ essential: false;
530
+ channels: ("push" | "email" | "text")[];
531
+ until: string;
532
+ open: {
533
+ screen: string;
534
+ };
535
+ slots: {
536
+ event: {
537
+ field: string;
538
+ };
539
+ when: {
540
+ field: string;
541
+ format: "datetime";
542
+ zone: string;
543
+ year: true;
544
+ optional: true;
545
+ };
546
+ venue: {
547
+ field: string;
548
+ optional: true;
549
+ };
550
+ count: {
551
+ count: {
552
+ max: number;
553
+ };
554
+ };
555
+ time: {
556
+ field: string;
557
+ format: "time";
558
+ zone: string;
559
+ optional: true;
560
+ };
561
+ place: {
562
+ field: string;
563
+ max: number;
564
+ optional: true;
565
+ };
566
+ short: {
567
+ field: string;
568
+ max: number;
569
+ };
570
+ };
571
+ messages: {
572
+ one: {
573
+ subject: string;
574
+ text: string;
575
+ textMessage: string;
576
+ push: {
577
+ title: string;
578
+ body: string;
579
+ };
580
+ };
581
+ many: {
582
+ subject: string;
583
+ text: string;
584
+ textMessage: string;
585
+ push: {
586
+ title: string;
587
+ body: string;
588
+ };
589
+ };
590
+ };
591
+ };
592
+ balance: {
593
+ label: string;
594
+ description: string;
595
+ about: string;
596
+ slots: {
597
+ balance: {
598
+ field: string;
599
+ format: "money";
600
+ currency: string;
601
+ };
602
+ due: {
603
+ field: string;
604
+ format: "date";
605
+ year: true;
606
+ };
607
+ link: {
608
+ link: string;
609
+ withId: string;
610
+ };
611
+ };
612
+ messages: {
613
+ due: {
614
+ subject: string;
615
+ text: string;
616
+ };
617
+ };
618
+ };
619
+ };
620
+ readonly journeySignals: {
621
+ readonly ticketBought: {
622
+ readonly label: "Ticket bought";
623
+ readonly description: "A ticket is granted to its holder when its order is paid.";
624
+ readonly object: "ticket";
625
+ };
626
+ readonly checkedIn: {
627
+ readonly label: "Checked in at an event";
628
+ readonly description: "A ticket is checked in at the door.";
629
+ readonly object: "ticket";
630
+ readonly enters: readonly ["used"];
631
+ readonly from: readonly ["valid"];
431
632
  };
432
633
  };
433
634
  readonly automations: {
@@ -523,6 +724,7 @@ declare const _default: import("@composable-os/sdk").Extension<{
523
724
  full: "full";
524
725
  }>>;
525
726
  email: import("zod").ZodOptional<import("zod").ZodString>;
727
+ agreements: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
526
728
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
527
729
  id: import("zod").ZodString;
528
730
  state: import("zod").ZodString;
@@ -652,5 +854,20 @@ declare const _default: import("@composable-os/sdk").Extension<{
652
854
  }, import("zod/v4/core").$strip>;
653
855
  }, import("zod/v4/core").$strip>>;
654
856
  };
857
+ readonly portal: {
858
+ readonly tickets: {
859
+ readonly label: "My tickets";
860
+ readonly web: {
861
+ readonly block: "ticketing-my-tickets";
862
+ readonly export: "MyTickets";
863
+ };
864
+ readonly native: {
865
+ readonly block: "ticketing-native-my-tickets";
866
+ readonly export: "MyTicketsScreen";
867
+ };
868
+ readonly order: 40;
869
+ readonly has: readonly ["ticketing.ticket"];
870
+ };
871
+ };
655
872
  }>;
656
873
  export default _default;
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@
16
16
  import { defineExtension } from "@composable-os/sdk";
17
17
  import { ticketingAutomations } from "./automations.js";
18
18
  import { ticketingDashboards } from "./dashboards.js";
19
+ import { ticketingRoutineMail } from "./routine-mail.js";
19
20
  import { checkIn, eventsOnSale, myTickets, orderStart, salesSummary, undoCheckIn, } from "./tools.js";
20
21
  export default defineExtension({
21
22
  id: "ticketing",
@@ -30,7 +31,9 @@ export default defineExtension({
30
31
  // sales summary. person.get (read person): the holder's name a check-in reports.
31
32
  read: ["person"],
32
33
  // public.list and capacity.get: the events on sale and their places, for the public.
33
- // extensionSettings.list: the pages the buyer's emails link to. email-send: the buyer's mail.
34
+ // extensionSettings.list: the pages the blocks link to. routine-mail: the buyer's and the
35
+ // holder's email (routine-mail.ts, ADR 0590), sent by the host from the email-send
36
+ // connection an admin binds to each automation.
34
37
  // order.settings.get: the currency the sales summary's amounts are in (staff).
35
38
  operations: [
36
39
  "order.start",
@@ -41,7 +44,7 @@ export default defineExtension({
41
44
  "extensionSettings.list",
42
45
  "order.settings.get",
43
46
  ],
44
- modules: ["ops", "email-send"],
47
+ modules: ["ops", "routine-mail", "email-send"],
45
48
  },
46
49
  objects: {
47
50
  event: {
@@ -156,6 +159,16 @@ export default defineExtension({
156
159
  balanceDue: { type: "date", label: "Balance due" },
157
160
  },
158
161
  capacity: { places: "places", pool: "event", show: "low", lowAt: 10 },
162
+ // Where agreement may be needed (stage 44, ADR 0641): nothing is attached by default, so a
163
+ // ticket sells as before until the business attaches a document (a waiver) to "event". The
164
+ // buyer agrees for themselves (ADR 0644). The checkout block shows what is due and lets the
165
+ // buyer agree on the way (issue #292).
166
+ agreements: {
167
+ point: "event",
168
+ label: "Buying a ticket",
169
+ suggests: ["waiver"],
170
+ inlineStep: true,
171
+ },
159
172
  sellable: {
160
173
  price: "price",
161
174
  saleWindow: { from: "onSaleFrom", until: "onSaleUntil" },
@@ -188,6 +201,12 @@ export default defineExtension({
188
201
  line1: "taxAddress",
189
202
  },
190
203
  },
204
+ // In the finance reports (ADR 0792): earned when the event starts.
205
+ finance: {
206
+ category: { key: "tickets", label: "Tickets" },
207
+ earned: "at_date",
208
+ at: "event.startsAt",
209
+ },
191
210
  },
192
211
  // A ticket type is public while its event is on sale; its places are capacity.get's.
193
212
  public: {
@@ -234,7 +253,14 @@ export default defineExtension({
234
253
  },
235
254
  event: { type: "relation", label: "Event", to: "ticketing.event", required: true },
236
255
  holder: { type: "relation", label: "Holder", to: "person" },
237
- order: { type: "text", label: "Order" },
256
+ // Which order granted it, set by the host's grant (ADR 0590, the fourth review): never
257
+ // written by a caller, or a ticket could be moved to another buyer's order and mailed.
258
+ order: {
259
+ type: "text",
260
+ label: "Order",
261
+ readOnly: true,
262
+ description: "The order that granted this ticket, set by the host.",
263
+ },
238
264
  state: {
239
265
  type: "select",
240
266
  label: "State",
@@ -262,6 +288,20 @@ export default defineExtension({
262
288
  { from: ["valid", "used"], to: "void", by: ["staff", "host"], final: true },
263
289
  ],
264
290
  },
291
+ // A ticket made by hand starts a ticket as buying one does: the same point, asked by the
292
+ // engine for its holder when a caller makes one or gives it to another holder (stage 44,
293
+ // issue #281). Valid and used are the same ticket, so undoing a check-in asks nobody. One a
294
+ // paid order grants is the host's, asked when the order started.
295
+ agreements: {
296
+ point: "event",
297
+ label: "Buying a ticket",
298
+ suggests: ["waiver"],
299
+ enter: ["valid"],
300
+ keeps: ["valid", "used"],
301
+ person: "holder",
302
+ // The same point as buying one, so the checkout's step answers it too (issue #292).
303
+ inlineStep: true,
304
+ },
265
305
  // The holder reads their ticket's event, type, code and state, and changes nothing.
266
306
  customer: { field: "holder", read: ["event", "tickettype", "code", "state"], write: [] },
267
307
  timelineLinks: ["holder"],
@@ -318,13 +358,34 @@ export default defineExtension({
318
358
  type: "text",
319
359
  label: "Where buyers see their tickets",
320
360
  description: "The page on your site or app where a signed-in buyer sees their tickets. Linked from the " +
321
- "tickets email, with ?order=<id>.",
361
+ "tickets email, with ?order=<id>, when it is on your site (Settings → Routine email).",
362
+ // The link in every buyer's email: a person's to change.
363
+ personApproves: true,
322
364
  },
323
365
  payUrl: {
324
366
  type: "text",
325
367
  label: "Where buyers pay a balance",
326
368
  description: "The page where a signed-in buyer pays what is owed on an order. Linked from the balance " +
327
- "reminders, with ?order=<id>.",
369
+ "reminders, with ?order=<id>, when it is on your site (Settings → Routine email).",
370
+ personApproves: true,
371
+ },
372
+ },
373
+ // The buyer's and the holder's email (ADR 0590): routine mail the host sends on its own.
374
+ routineMail: ticketingRoutineMail,
375
+ // What a journey can start or stop on (stage 53, ADR 0802), about a ticket's holder: the host
376
+ // records the last time each had each, in the write's batch.
377
+ journeySignals: {
378
+ ticketBought: {
379
+ label: "Ticket bought",
380
+ description: "A ticket is granted to its holder when its order is paid.",
381
+ object: "ticket",
382
+ },
383
+ checkedIn: {
384
+ label: "Checked in at an event",
385
+ description: "A ticket is checked in at the door.",
386
+ object: "ticket",
387
+ enters: ["used"],
388
+ from: ["valid"],
328
389
  },
329
390
  },
330
391
  automations: ticketingAutomations,
@@ -338,4 +399,15 @@ export default defineExtension({
338
399
  },
339
400
  },
340
401
  tools: { eventsOnSale, orderStart, myTickets, salesSummary, checkIn, undoCheckIn },
402
+ // Its section of My account (stage 48, ADR 0710): the tickets a buyer holds, shown once they hold
403
+ // one. A child's ticket stays the child's: a ticket does not open to guardians.
404
+ portal: {
405
+ tickets: {
406
+ label: "My tickets",
407
+ web: { block: "ticketing-my-tickets", export: "MyTickets" },
408
+ native: { block: "ticketing-native-my-tickets", export: "MyTicketsScreen" },
409
+ order: 40,
410
+ has: ["ticketing.ticket"],
411
+ },
412
+ },
341
413
  });