@ticketlayer/elements 0.4.0 → 1.0.0
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/cjs/{index-I9CoYv3k.js → index-DanPUX0s.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/ticket-selector-BYVL13k_.js +3623 -0
- package/dist/cjs/ticketlayer-elements.cjs.js +2 -2
- package/dist/cjs/tl-buy-modal.cjs.entry.js +3 -3
- package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +89 -74
- package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +61 -30
- package/dist/cjs/tl-cart-badge.cjs.entry.js +74 -61
- package/dist/cjs/tl-cart-drawer.cjs.entry.js +51 -23
- package/dist/cjs/tl-cart.cjs.entry.js +71 -103
- package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +51 -29
- package/dist/cjs/tl-event-card.cjs.entry.js +43 -105
- package/dist/cjs/tl-event-list.cjs.entry.js +72 -35
- package/dist/cjs/tl-login.cjs.entry.js +74 -141
- package/dist/cjs/tl-my-orders.cjs.entry.js +52 -92
- package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +153 -921
- package/dist/cjs/tl-order-confirmation.cjs.entry.js +71 -107
- package/dist/cjs/tl-order-tickets_2.cjs.entry.js +48 -74
- package/dist/cjs/tl-promo-code.cjs.entry.js +50 -47
- package/dist/cjs/tl-seat-map.cjs.entry.js +3 -3
- package/dist/cjs/web-query-Ce73jB4k.js +16 -0
- package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +2 -2
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +37 -0
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +105 -79
- package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +73 -30
- package/dist/collection/components/tl-cart/tl-cart.js +82 -107
- package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +62 -62
- package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +56 -24
- package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +61 -29
- package/dist/collection/components/tl-event-card/event-card-adapter.js +11 -23
- package/dist/collection/components/tl-event-card/tl-event-card.js +51 -84
- package/dist/collection/components/tl-event-list/tl-event-list.js +82 -38
- package/dist/collection/components/tl-login/tl-login.js +83 -147
- package/dist/collection/components/tl-my-orders/tl-my-orders.js +58 -96
- package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +137 -516
- package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +81 -115
- package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +57 -92
- package/dist/collection/components/tl-promo-code/tl-promo-code.js +55 -50
- package/dist/collection/components/tl-seat-map/tl-seat-map.js +2 -2
- package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +34 -20
- package/dist/collection/utils/order-summary.js +15 -135
- package/dist/collection/utils/testing/deep-text.js +29 -0
- package/dist/collection/utils/testing/fixtures.js +290 -0
- package/dist/collection/utils/testing/mock-sdk.js +13 -2
- package/dist/collection/utils/web-query.js +12 -0
- package/dist/collection/utils/web-storage.js +22 -0
- package/dist/components/ticket-selector.js +1 -0
- package/dist/components/tl-buy-modal.js +1 -1
- package/dist/components/tl-buy-tickets-button.js +1 -1
- package/dist/components/tl-buy-tickets-wrapper2.js +1 -1
- package/dist/components/tl-cart-badge.js +1 -1
- package/dist/components/tl-cart-drawer.js +1 -1
- package/dist/components/tl-cart2.js +1 -1
- package/dist/components/tl-checkout-wrapper2.js +1 -1
- package/dist/components/tl-event-card2.js +1 -1
- package/dist/components/tl-event-list.js +1 -1
- package/dist/components/tl-login2.js +1 -1
- package/dist/components/tl-my-orders.js +1 -1
- package/dist/components/tl-occurrence-selector2.js +1 -1
- package/dist/components/tl-order-confirmation.js +1 -1
- package/dist/components/tl-order-tickets2.js +1 -1
- package/dist/components/tl-promo-code.js +1 -1
- package/dist/components/tl-seat-map.js +1 -1
- package/dist/components/tl-ticket-selector2.js +1 -1
- package/dist/components/web-query.js +1 -0
- package/dist/elements.docs.json +34 -34
- package/dist/esm/{index-OoYV1faY.js → index-imfxp765.js} +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/ticket-selector-BwChnHVC.js +3606 -0
- package/dist/esm/ticketlayer-elements.js +3 -3
- package/dist/esm/tl-buy-modal.entry.js +3 -3
- package/dist/esm/tl-buy-tickets-button.entry.js +90 -75
- package/dist/esm/tl-buy-tickets-wrapper.entry.js +62 -31
- package/dist/esm/tl-cart-badge.entry.js +75 -62
- package/dist/esm/tl-cart-drawer.entry.js +52 -24
- package/dist/esm/tl-cart.entry.js +72 -104
- package/dist/esm/tl-checkout-wrapper.entry.js +52 -30
- package/dist/esm/tl-event-card.entry.js +44 -106
- package/dist/esm/tl-event-list.entry.js +73 -36
- package/dist/esm/tl-login.entry.js +75 -142
- package/dist/esm/tl-my-orders.entry.js +53 -93
- package/dist/esm/tl-occurrence-selector_2.entry.js +152 -920
- package/dist/esm/tl-order-confirmation.entry.js +72 -108
- package/dist/esm/tl-order-tickets_2.entry.js +49 -75
- package/dist/esm/tl-promo-code.entry.js +51 -48
- package/dist/esm/tl-seat-map.entry.js +3 -3
- package/dist/esm/web-query-Bdbb2lk5.js +14 -0
- package/dist/ticketlayer-elements/index.esm.js +1 -1
- package/dist/ticketlayer-elements/p-45923d2c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-492adc77.entry.js +1 -0
- package/dist/ticketlayer-elements/p-4cfc9e53.entry.js +1 -0
- package/dist/ticketlayer-elements/{p-ac264adc.entry.js → p-5135630e.entry.js} +1 -1
- package/dist/ticketlayer-elements/p-5bbce3b5.entry.js +1 -0
- package/dist/ticketlayer-elements/p-7d547721.entry.js +1 -0
- package/dist/ticketlayer-elements/p-7fe7b6ba.entry.js +1 -0
- package/dist/ticketlayer-elements/p-8122f0c1.entry.js +1 -0
- package/dist/ticketlayer-elements/p-98d40869.entry.js +1 -0
- package/dist/ticketlayer-elements/p-Bdbb2lk5.js +1 -0
- package/dist/ticketlayer-elements/p-BwChnHVC.js +1 -0
- package/dist/ticketlayer-elements/p-abec290a.entry.js +1 -0
- package/dist/ticketlayer-elements/p-ac79a3f6.entry.js +1 -0
- package/dist/ticketlayer-elements/p-d01f4429.entry.js +1 -0
- package/dist/ticketlayer-elements/p-d7ffaf46.entry.js +1 -0
- package/dist/ticketlayer-elements/p-e7170f3c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-e787e862.entry.js +1 -0
- package/dist/ticketlayer-elements/p-f1ff931f.entry.js +1 -0
- package/dist/ticketlayer-elements/p-imfxp765.js +3 -0
- package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -1
- package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -1
- package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +40 -8
- package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +20 -1
- package/dist/types/components/tl-cart/tl-cart.d.ts +40 -42
- package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +22 -7
- package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +28 -5
- package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +18 -1
- package/dist/types/components/tl-event-card/event-card-adapter.d.ts +9 -20
- package/dist/types/components/tl-event-card/tl-event-card.d.ts +25 -28
- package/dist/types/components/tl-event-list/tl-event-list.d.ts +46 -6
- package/dist/types/components/tl-login/tl-login.d.ts +68 -22
- package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +30 -12
- package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +73 -161
- package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +48 -15
- package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +29 -31
- package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +28 -10
- package/dist/types/components/tl-ticket/tl-ticket.d.ts +2 -11
- package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +22 -4
- package/dist/types/components.d.ts +270 -62
- package/dist/types/utils/order-summary.d.ts +14 -97
- package/dist/types/utils/testing/deep-text.d.ts +13 -0
- package/dist/types/utils/testing/fixtures.d.ts +225 -0
- package/dist/types/utils/testing/mock-sdk.d.ts +14 -1
- package/dist/types/utils/web-query.d.ts +18 -0
- package/dist/types/utils/web-storage.d.ts +16 -0
- package/elements.catalogue.json +602 -50
- package/package.json +8 -6
- package/dist/cjs/money-BtmM2gt-.js +0 -118
- package/dist/cjs/order-summary-X3TlZxc2.js +0 -150
- package/dist/components/money.js +0 -1
- package/dist/components/order-summary.js +0 -1
- package/dist/esm/money-4ig0-WB6.js +0 -112
- package/dist/esm/order-summary-DiDtvfZM.js +0 -136
- package/dist/ticketlayer-elements/p-0814420f.entry.js +0 -1
- package/dist/ticketlayer-elements/p-0acabc26.entry.js +0 -1
- package/dist/ticketlayer-elements/p-109a3feb.entry.js +0 -1
- package/dist/ticketlayer-elements/p-1a4ba71c.entry.js +0 -1
- package/dist/ticketlayer-elements/p-318965c1.entry.js +0 -1
- package/dist/ticketlayer-elements/p-347c7fd1.entry.js +0 -1
- package/dist/ticketlayer-elements/p-3649c26d.entry.js +0 -1
- package/dist/ticketlayer-elements/p-40260cc9.entry.js +0 -1
- package/dist/ticketlayer-elements/p-4ig0-WB6.js +0 -1
- package/dist/ticketlayer-elements/p-55fd2f9f.entry.js +0 -1
- package/dist/ticketlayer-elements/p-62ee659b.entry.js +0 -1
- package/dist/ticketlayer-elements/p-7d4ecc2b.entry.js +0 -1
- package/dist/ticketlayer-elements/p-7f0abf95.entry.js +0 -1
- package/dist/ticketlayer-elements/p-BXpVGW51.js +0 -1
- package/dist/ticketlayer-elements/p-OoYV1faY.js +0 -3
- package/dist/ticketlayer-elements/p-a3c1b26c.entry.js +0 -1
- package/dist/ticketlayer-elements/p-aeb4c6fb.entry.js +0 -1
- package/dist/ticketlayer-elements/p-ba62541f.entry.js +0 -1
|
@@ -1,101 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* tl-my-orders). The sales order view carries line items, totals and tickets
|
|
4
|
-
* but no event name, occurrence date or customer email, so these derive what
|
|
5
|
-
* they can from the order and resolve the rest through the SDK.
|
|
6
|
-
*/
|
|
7
|
-
import type { TicketlayerSDK } from './sdk-connector';
|
|
8
|
-
export interface TlOrderItem {
|
|
9
|
-
name: string;
|
|
10
|
-
description?: string | null;
|
|
11
|
-
type?: string;
|
|
12
|
-
quantity: number;
|
|
13
|
-
unitPrice: number | string;
|
|
14
|
-
subtotal: number | string;
|
|
15
|
-
}
|
|
16
|
-
export interface TlOrderTicketRef {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
eventOccurrenceId: string | null;
|
|
20
|
-
}
|
|
21
|
-
export interface TlOrderData {
|
|
22
|
-
id: string;
|
|
23
|
-
orderNumber: string;
|
|
24
|
-
status: string;
|
|
25
|
-
paymentStatus?: string;
|
|
26
|
-
currency: string;
|
|
27
|
-
items: TlOrderItem[];
|
|
28
|
-
subtotal: number | string;
|
|
29
|
-
totalFees?: number | string;
|
|
30
|
-
totalTax?: number | string;
|
|
31
|
-
totalDiscounts?: number | string;
|
|
32
|
-
total: number | string;
|
|
33
|
-
tickets?: TlOrderTicketRef[];
|
|
34
|
-
createdAt?: string;
|
|
35
|
-
eventName?: string | null;
|
|
36
|
-
customerEmail?: string | null;
|
|
37
|
-
customer?: {
|
|
38
|
-
email?: string | null;
|
|
39
|
-
} | null;
|
|
40
|
-
}
|
|
41
|
-
export interface TlResolvedOccurrence {
|
|
42
|
-
eventId: string;
|
|
43
|
-
eventName: string;
|
|
44
|
-
startsAt: string | null;
|
|
45
|
-
}
|
|
46
|
-
/** Money arrives as minor-unit integers or decimal strings ("50.00"). */
|
|
47
|
-
export declare function formatPrice(value: number | string | null | undefined, currency?: string): string;
|
|
48
|
-
export declare function formatDateTime(iso: string): string;
|
|
49
|
-
export declare function formatDate(iso: string): string;
|
|
50
|
-
/** Line items that are tickets (fees, taxes and discounts have their own type). */
|
|
51
|
-
export declare function ticketItems(order: TlOrderData): TlOrderItem[];
|
|
52
|
-
export declare function ticketCount(order: TlOrderData): number;
|
|
53
|
-
/** Event name as the order view exposes it: the first ticket line's name. */
|
|
54
|
-
export declare function orderEventName(order: TlOrderData): string | null;
|
|
55
|
-
export declare function orderCustomerEmail(order: TlOrderData | null, customer: unknown): string | null;
|
|
56
|
-
export declare function statusLabel(status: string | undefined): string;
|
|
57
|
-
export type StatusTone = 'success' | 'info' | 'warning' | 'error' | 'muted';
|
|
58
|
-
export declare function statusTone(status: string | undefined): StatusTone;
|
|
59
|
-
export declare function errorMessage(err: unknown, fallback: string): string;
|
|
60
|
-
/** True for the "not signed in" family of API errors (401/403, NO_SESSION, NOT_AUTHENTICATED). */
|
|
61
|
-
export declare function isAuthError(err: unknown): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Find the event and start time for an occurrence id. The order view only
|
|
64
|
-
* carries the occurrence id, so this walks the channel's listings (cached by
|
|
65
|
-
* live-api) until one owns the occurrence. Best effort: null when not found.
|
|
66
|
-
*/
|
|
67
|
-
export declare function resolveOccurrence(sdk: TicketlayerSDK, occurrenceId: string, maxEvents?: number): Promise<TlResolvedOccurrence | null>;
|
|
68
|
-
/**
|
|
69
|
-
* The money rows the order views render.
|
|
70
|
-
*
|
|
71
|
-
* Two things about the sales order view drive this (backstage-api
|
|
72
|
-
* `src/domains/orders/services/order-line-items.service.ts`, `views/index.ts`):
|
|
2
|
+
* The order helpers, as the components have always imported them.
|
|
73
3
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* order therefore hides the fee inside it, which is the bug this fixes.
|
|
4
|
+
* Everything here now lives in `@ticketlayer/elements-core`
|
|
5
|
+
* (`src/orders.ts`): the order shape, the money rows, the status tone, the
|
|
6
|
+
* date and price formatting and the occurrence lookup all moved across with
|
|
7
|
+
* the split of `tl-my-orders` and `tl-order-confirmation` (TKT-69), so a
|
|
8
|
+
* native harness answers the same questions the same way. This module stays as
|
|
9
|
+
* the import path, unchanged for callers, because `tl-order-tickets` and
|
|
10
|
+
* `tl-ticket` are not split yet and read these helpers from here.
|
|
82
11
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
12
|
+
* `resolveOccurrence` is the one signature that moved: it takes the core's
|
|
13
|
+
* `ElementClient` rather than this package's `TicketlayerSDK`. A
|
|
14
|
+
* `TicketlayerSDK` satisfies that shape, so every existing call still
|
|
15
|
+
* compiles, which is why it is re-exported rather than wrapped.
|
|
86
16
|
*/
|
|
87
|
-
export
|
|
88
|
-
|
|
89
|
-
/** Ticket lines only, in minor units: the fee is not folded in. */
|
|
90
|
-
subtotal: number;
|
|
91
|
-
fees: number;
|
|
92
|
-
feeLabel: string;
|
|
93
|
-
showFee: boolean;
|
|
94
|
-
tax: number;
|
|
95
|
-
discount: number;
|
|
96
|
-
/** What the buyer was charged, as the order reports it. */
|
|
97
|
-
total: number;
|
|
98
|
-
}
|
|
99
|
-
export declare function orderTotals(order: TlOrderData | null | undefined): TlOrderTotals;
|
|
100
|
-
/** The rows add up to the total the order reports. Asserted in the specs. */
|
|
101
|
-
export declare function totalsAgree(totals: TlOrderTotals): boolean;
|
|
17
|
+
export { errorMessage, formatDate, formatDateTime, formatPrice, isAuthError, orderCustomerEmail, orderEventName, orderTotals, resolveOccurrence, statusLabel, statusTone, ticketCount, ticketItems, totalsAgree, } from '@ticketlayer/elements-core';
|
|
18
|
+
export type { StatusTone, TlOrderData, TlOrderItem, TlOrderTicketRef, TlOrderTotals, TlResolvedOccurrence, } from '@ticketlayer/elements-core';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text an element actually shows, shadow roots included.
|
|
3
|
+
*
|
|
4
|
+
* `textContent` stops at a shadow boundary, and every element here renders
|
|
5
|
+
* into one (and several compose others: `tl-cart-drawer` holds a `tl-cart`,
|
|
6
|
+
* `tl-order-tickets` a grid of `tl-ticket`). A check that an element rendered
|
|
7
|
+
* something has to see through that, or it reads an empty string from an
|
|
8
|
+
* element that is perfectly full.
|
|
9
|
+
*
|
|
10
|
+
* Used by the stories' `expectRendered` in the browser and by
|
|
11
|
+
* story-coverage.spec.tsx in jsdom, so both are asking the same question.
|
|
12
|
+
*/
|
|
13
|
+
export declare function deepText(node: Node | null | undefined): string;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
export declare const FIXTURE_CUSTOMER: {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
};
|
|
7
|
+
/** `events.list` items, i.e. what a card is handed by `tl-event-list`. */
|
|
8
|
+
export declare const FIXTURE_EVENT_CARDS: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
shortDescription: string;
|
|
12
|
+
availabilityStatus: string;
|
|
13
|
+
venue: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
city: string;
|
|
17
|
+
};
|
|
18
|
+
nextOccurrence: {
|
|
19
|
+
startsAt: string;
|
|
20
|
+
};
|
|
21
|
+
}[];
|
|
22
|
+
/** `events.get` details, keyed by event id. */
|
|
23
|
+
export declare const FIXTURE_EVENT_DETAILS: Record<string, unknown>;
|
|
24
|
+
/** `events.getTicketTypes` for `evoc_1`. */
|
|
25
|
+
export declare const FIXTURE_TICKET_TYPES: {
|
|
26
|
+
id: string;
|
|
27
|
+
occurrenceId: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
price: number;
|
|
31
|
+
currency: string;
|
|
32
|
+
availableQuantity: number;
|
|
33
|
+
maxPerOrder: number;
|
|
34
|
+
minPerOrder: number;
|
|
35
|
+
availabilityStatus: string;
|
|
36
|
+
sortOrder: number;
|
|
37
|
+
}[];
|
|
38
|
+
/** A cart with lines, a fee the surface quoted and a discount. */
|
|
39
|
+
export declare const FIXTURE_CART: {
|
|
40
|
+
items: {
|
|
41
|
+
id: string;
|
|
42
|
+
ticketTypeId: string;
|
|
43
|
+
ticketTypeName: string;
|
|
44
|
+
eventName: string;
|
|
45
|
+
occurrenceDate: string;
|
|
46
|
+
quantity: number;
|
|
47
|
+
unitPrice: number;
|
|
48
|
+
totalPrice: number;
|
|
49
|
+
subtotal: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
}[];
|
|
52
|
+
itemCount: number;
|
|
53
|
+
subtotal: number;
|
|
54
|
+
fees: number;
|
|
55
|
+
discount: number;
|
|
56
|
+
total: number;
|
|
57
|
+
hasFees: boolean;
|
|
58
|
+
feeLabel: string;
|
|
59
|
+
currency: string;
|
|
60
|
+
};
|
|
61
|
+
/** An empty cart, for the states an element only reaches with nothing in it. */
|
|
62
|
+
export declare const FIXTURE_EMPTY_CART: {
|
|
63
|
+
items: never[];
|
|
64
|
+
itemCount: number;
|
|
65
|
+
subtotal: number;
|
|
66
|
+
fees: number;
|
|
67
|
+
discount: number;
|
|
68
|
+
total: number;
|
|
69
|
+
hasFees: boolean;
|
|
70
|
+
feeLabel: null;
|
|
71
|
+
currency: string;
|
|
72
|
+
};
|
|
73
|
+
/** Passes on the order: what `tl-ticket` renders and `tl-order-tickets` grids. */
|
|
74
|
+
export declare const FIXTURE_TICKETS: {
|
|
75
|
+
id: string;
|
|
76
|
+
barcode: string;
|
|
77
|
+
type: string;
|
|
78
|
+
status: string;
|
|
79
|
+
holderName: string;
|
|
80
|
+
name: string;
|
|
81
|
+
admissionStatus: string;
|
|
82
|
+
eventOccurrenceId: string;
|
|
83
|
+
seatLabel: string;
|
|
84
|
+
}[];
|
|
85
|
+
export declare const FIXTURE_ORDER: {
|
|
86
|
+
id: string;
|
|
87
|
+
orderNumber: string;
|
|
88
|
+
status: string;
|
|
89
|
+
paymentStatus: string;
|
|
90
|
+
currency: string;
|
|
91
|
+
items: {
|
|
92
|
+
name: string;
|
|
93
|
+
description: null;
|
|
94
|
+
type: string;
|
|
95
|
+
quantity: number;
|
|
96
|
+
unitPrice: number;
|
|
97
|
+
subtotal: number;
|
|
98
|
+
}[];
|
|
99
|
+
subtotal: number;
|
|
100
|
+
totalFees: number;
|
|
101
|
+
totalTax: number;
|
|
102
|
+
total: number;
|
|
103
|
+
tickets: {
|
|
104
|
+
id: string;
|
|
105
|
+
barcode: string;
|
|
106
|
+
type: string;
|
|
107
|
+
status: string;
|
|
108
|
+
holderName: string;
|
|
109
|
+
name: string;
|
|
110
|
+
admissionStatus: string;
|
|
111
|
+
eventOccurrenceId: string;
|
|
112
|
+
seatLabel: string;
|
|
113
|
+
}[];
|
|
114
|
+
expiresAt: null;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
};
|
|
117
|
+
export declare const FIXTURE_ORDERS: {
|
|
118
|
+
id: string;
|
|
119
|
+
orderNumber: string;
|
|
120
|
+
status: string;
|
|
121
|
+
paymentStatus: string;
|
|
122
|
+
currency: string;
|
|
123
|
+
items: {
|
|
124
|
+
name: string;
|
|
125
|
+
description: null;
|
|
126
|
+
type: string;
|
|
127
|
+
quantity: number;
|
|
128
|
+
unitPrice: number;
|
|
129
|
+
subtotal: number;
|
|
130
|
+
}[];
|
|
131
|
+
subtotal: number;
|
|
132
|
+
totalFees: number;
|
|
133
|
+
totalTax: number;
|
|
134
|
+
total: number;
|
|
135
|
+
tickets: {
|
|
136
|
+
id: string;
|
|
137
|
+
barcode: string;
|
|
138
|
+
type: string;
|
|
139
|
+
status: string;
|
|
140
|
+
holderName: string;
|
|
141
|
+
name: string;
|
|
142
|
+
admissionStatus: string;
|
|
143
|
+
eventOccurrenceId: string;
|
|
144
|
+
seatLabel: string;
|
|
145
|
+
}[];
|
|
146
|
+
expiresAt: null;
|
|
147
|
+
createdAt: string;
|
|
148
|
+
}[];
|
|
149
|
+
/**
|
|
150
|
+
* The datasets a story may ask for by name, through
|
|
151
|
+
* `parameters.ticketlayer.dataset`. Keep the set small: a dataset is a state
|
|
152
|
+
* of the whole channel, not a per-element fixture.
|
|
153
|
+
*/
|
|
154
|
+
export declare const FIXTURE_DATASETS: {
|
|
155
|
+
/** Signed in, three events on sale, a cart with lines and two orders. */
|
|
156
|
+
default: {
|
|
157
|
+
cart: {
|
|
158
|
+
get: () => Promise<{
|
|
159
|
+
items: {
|
|
160
|
+
id: string;
|
|
161
|
+
ticketTypeId: string;
|
|
162
|
+
ticketTypeName: string;
|
|
163
|
+
eventName: string;
|
|
164
|
+
occurrenceDate: string;
|
|
165
|
+
quantity: number;
|
|
166
|
+
unitPrice: number;
|
|
167
|
+
totalPrice: number;
|
|
168
|
+
subtotal: number;
|
|
169
|
+
currency: string;
|
|
170
|
+
}[];
|
|
171
|
+
itemCount: number;
|
|
172
|
+
subtotal: number;
|
|
173
|
+
fees: number;
|
|
174
|
+
discount: number;
|
|
175
|
+
total: number;
|
|
176
|
+
hasFees: boolean;
|
|
177
|
+
feeLabel: string;
|
|
178
|
+
currency: string;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
authState: {
|
|
182
|
+
customer: {
|
|
183
|
+
id: string;
|
|
184
|
+
email: string;
|
|
185
|
+
firstName: string;
|
|
186
|
+
lastName: string;
|
|
187
|
+
};
|
|
188
|
+
authenticated: true;
|
|
189
|
+
};
|
|
190
|
+
events?: Partial<ReturnType<import("../sdk-connector").TicketlayerSDK["getEventsManager"]>>;
|
|
191
|
+
orders?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getOrdersManager"]>>>>;
|
|
192
|
+
auth?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getAuthManager"]>>>>;
|
|
193
|
+
presale?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getPresaleManager"]>>>>;
|
|
194
|
+
withoutAuth?: boolean;
|
|
195
|
+
withoutPresale?: boolean;
|
|
196
|
+
};
|
|
197
|
+
/** Nobody signed in and nothing in the cart. */
|
|
198
|
+
'signed-out': {
|
|
199
|
+
cart: {
|
|
200
|
+
get: () => Promise<{
|
|
201
|
+
items: never[];
|
|
202
|
+
itemCount: number;
|
|
203
|
+
subtotal: number;
|
|
204
|
+
fees: number;
|
|
205
|
+
discount: number;
|
|
206
|
+
total: number;
|
|
207
|
+
hasFees: boolean;
|
|
208
|
+
feeLabel: null;
|
|
209
|
+
currency: string;
|
|
210
|
+
}>;
|
|
211
|
+
};
|
|
212
|
+
authState: {
|
|
213
|
+
customer: null;
|
|
214
|
+
authenticated: false;
|
|
215
|
+
};
|
|
216
|
+
events?: Partial<ReturnType<import("../sdk-connector").TicketlayerSDK["getEventsManager"]>>;
|
|
217
|
+
orders?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getOrdersManager"]>>>>;
|
|
218
|
+
auth?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getAuthManager"]>>>>;
|
|
219
|
+
presale?: Partial<NonNullable<ReturnType<NonNullable<import("../sdk-connector").TicketlayerSDK["getPresaleManager"]>>>>;
|
|
220
|
+
withoutAuth?: boolean;
|
|
221
|
+
withoutPresale?: boolean;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
export type FixtureDataset = keyof typeof FIXTURE_DATASETS;
|
|
225
|
+
export declare const FIXTURE_DATASET_NAMES: FixtureDataset[];
|
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
* slot the sdk-connector reads, with an in-memory bus so tests can push
|
|
4
4
|
* SDK events (cart:updated, auth:changed, checkout:completed) at components.
|
|
5
5
|
*/
|
|
6
|
-
import { type TicketlayerSDK } from '../sdk-connector';
|
|
6
|
+
import { type ModalOptions, type TicketlayerSDK } from '../sdk-connector';
|
|
7
|
+
/** One `openModal` an element asked for, with the callbacks it passed. */
|
|
8
|
+
export interface MockModalCall {
|
|
9
|
+
kind: 'event' | 'checkout';
|
|
10
|
+
/** The event the modal was opened for, for `kind: 'event'`. */
|
|
11
|
+
eventId?: string;
|
|
12
|
+
options: ModalOptions;
|
|
13
|
+
}
|
|
7
14
|
export interface MockSDK extends TicketlayerSDK {
|
|
8
15
|
emit(event: string, payload?: unknown): void;
|
|
9
16
|
authState: {
|
|
10
17
|
customer: unknown | null;
|
|
11
18
|
authenticated: boolean;
|
|
12
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Every modal an element has asked for, oldest first. The wrapper elements
|
|
22
|
+
* report the modal's outcome to the page, so a test replies by calling the
|
|
23
|
+
* callbacks recorded here.
|
|
24
|
+
*/
|
|
25
|
+
modalCalls: MockModalCall[];
|
|
13
26
|
}
|
|
14
27
|
export interface MockSDKOptions {
|
|
15
28
|
events?: Partial<ReturnType<TicketlayerSDK['getEventsManager']>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `window.location.search` as the cores' query seam.
|
|
3
|
+
*
|
|
4
|
+
* Two elements are the far end of a link: `tl-login` exchanges the `?code=` a
|
|
5
|
+
* magic-link email lands on, and `tl-order-confirmation` finds its order in
|
|
6
|
+
* `?orderId=` and reads `?redirect_status=` to know whether the payment
|
|
7
|
+
* provider sent the buyer back on a success. What they read is theirs to
|
|
8
|
+
* decide; where a parameter comes from is the runtime's, and a React Native
|
|
9
|
+
* harness will answer the same question from its deep-link router rather than
|
|
10
|
+
* from an address bar (AGENTS.md: a harness renders and forwards, it does not
|
|
11
|
+
* decide).
|
|
12
|
+
*
|
|
13
|
+
* Read per call rather than parsed once, because a host may have pushed a new
|
|
14
|
+
* URL since the element mounted, which is what `window.location` reports and
|
|
15
|
+
* what the components read.
|
|
16
|
+
*/
|
|
17
|
+
import type { ElementQuery } from '@ticketlayer/elements-core';
|
|
18
|
+
export declare const webQuery: ElementQuery;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `localStorage` as the cores' storage seam.
|
|
3
|
+
*
|
|
4
|
+
* A core is allowed to remember a little between visits (`tl-cart-badge` keeps
|
|
5
|
+
* the last item count so the badge does not flash empty), and where that is
|
|
6
|
+
* written down is per runtime: the browser has `localStorage`, React Native
|
|
7
|
+
* will have something asynchronous of its own. So the core states what it
|
|
8
|
+
* remembers and the harness supplies the store (AGENTS.md: a harness renders
|
|
9
|
+
* and forwards, it does not decide).
|
|
10
|
+
*
|
|
11
|
+
* Everything is wrapped: `localStorage` throws on access in a sandboxed frame
|
|
12
|
+
* and in Safari's private mode, and a component that cannot remember a number
|
|
13
|
+
* still has to render.
|
|
14
|
+
*/
|
|
15
|
+
import type { ElementStorage } from '@ticketlayer/elements-core';
|
|
16
|
+
export declare const webStorage: ElementStorage;
|