@ticketlayer/elements-core 0.1.0 → 0.2.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/README.md +141 -4
- package/dist/cjs/cores/buy-tickets-button.js +213 -0
- package/dist/cjs/cores/buy-tickets-wrapper.js +106 -0
- package/dist/cjs/cores/cart-badge.js +150 -0
- package/dist/cjs/cores/cart-drawer.js +122 -0
- package/dist/cjs/cores/cart.js +247 -0
- package/dist/cjs/cores/checkout-wrapper.js +75 -0
- package/dist/cjs/cores/event-card.js +209 -0
- package/dist/cjs/cores/event-list.js +109 -0
- package/dist/cjs/cores/index.js +64 -1
- package/dist/cjs/cores/login.js +309 -0
- package/dist/cjs/cores/my-orders.js +221 -0
- package/dist/cjs/cores/occurrence-selector.js +528 -0
- package/dist/cjs/cores/order-confirmation.js +301 -0
- package/dist/cjs/cores/order-tickets.js +172 -0
- package/dist/cjs/cores/promo-code.js +136 -0
- package/dist/cjs/cores/ticket-selector.js +30 -0
- package/dist/cjs/define.js +76 -0
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/manifest.js +5 -0
- package/dist/cjs/orders.js +169 -0
- package/dist/esm/client.d.ts +106 -0
- package/dist/esm/cores/buy-tickets-button.d.ts +55 -0
- package/dist/esm/cores/buy-tickets-button.js +210 -0
- package/dist/esm/cores/buy-tickets-wrapper.d.ts +27 -0
- package/dist/esm/cores/buy-tickets-wrapper.js +103 -0
- package/dist/esm/cores/cart-badge.d.ts +48 -0
- package/dist/esm/cores/cart-badge.js +147 -0
- package/dist/esm/cores/cart-drawer.d.ts +44 -0
- package/dist/esm/cores/cart-drawer.js +119 -0
- package/dist/esm/cores/cart.d.ts +105 -0
- package/dist/esm/cores/cart.js +244 -0
- package/dist/esm/cores/checkout-wrapper.d.ts +22 -0
- package/dist/esm/cores/checkout-wrapper.js +72 -0
- package/dist/esm/cores/event-card.d.ts +80 -0
- package/dist/esm/cores/event-card.js +205 -0
- package/dist/esm/cores/event-list.d.ts +35 -0
- package/dist/esm/cores/event-list.js +106 -0
- package/dist/esm/cores/index.d.ts +28 -0
- package/dist/esm/cores/index.js +42 -0
- package/dist/esm/cores/login.d.ts +125 -0
- package/dist/esm/cores/login.js +306 -0
- package/dist/esm/cores/my-orders.d.ts +63 -0
- package/dist/esm/cores/my-orders.js +218 -0
- package/dist/esm/cores/occurrence-selector.d.ts +170 -0
- package/dist/esm/cores/occurrence-selector.js +525 -0
- package/dist/esm/cores/order-confirmation.d.ts +99 -0
- package/dist/esm/cores/order-confirmation.js +298 -0
- package/dist/esm/cores/order-tickets.d.ts +46 -0
- package/dist/esm/cores/order-tickets.js +169 -0
- package/dist/esm/cores/promo-code.d.ts +56 -0
- package/dist/esm/cores/promo-code.js +132 -0
- package/dist/esm/cores/ticket-selector.js +30 -0
- package/dist/esm/define.d.ts +146 -0
- package/dist/esm/define.js +75 -0
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.js +2 -1
- package/dist/esm/manifest.d.ts +12 -0
- package/dist/esm/manifest.js +5 -0
- package/dist/esm/orders.d.ts +110 -0
- package/dist/esm/orders.js +154 -0
- package/package.json +2 -2
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tl-event-card`: one event, as a card.
|
|
3
|
+
*
|
|
4
|
+
* Two ways to fill it, which is the whole of its behaviour: a host hands it an
|
|
5
|
+
* event through the `event` prop (that is what `tl-event-list` does), or it is
|
|
6
|
+
* given an `eventId` and reads the event itself. The prop wins, and a card that
|
|
7
|
+
* has one never touches the client.
|
|
8
|
+
*
|
|
9
|
+
* Behaviour is what the Stencil component did before the split, to the letter,
|
|
10
|
+
* including the status badge's three labels and the `en-GB` date. What did not
|
|
11
|
+
* come across is the `console.log` tracing, which a library should not do for
|
|
12
|
+
* its host.
|
|
13
|
+
*/
|
|
14
|
+
import { defineElement } from '../define.js';
|
|
15
|
+
/**
|
|
16
|
+
* Adapt an event detail to the card shape. The list adapter lives in the SDK
|
|
17
|
+
* connector; this one is the card's own, and it is behaviour, so it is here.
|
|
18
|
+
*/
|
|
19
|
+
export function toEventCardEvent(detail) {
|
|
20
|
+
const occurrences = detail.occurrences ?? [];
|
|
21
|
+
const starts = occurrences
|
|
22
|
+
.map((o) => o.startsAt)
|
|
23
|
+
.filter((s) => !!s)
|
|
24
|
+
.sort();
|
|
25
|
+
const now = Date.now();
|
|
26
|
+
const next = starts.find((s) => new Date(s).getTime() >= now) ?? starts[0];
|
|
27
|
+
const soldOut = detail.status === 'sold_out' ||
|
|
28
|
+
(occurrences.length > 0 && occurrences.every((o) => o.status === 'sold_out'));
|
|
29
|
+
return {
|
|
30
|
+
id: detail.id,
|
|
31
|
+
name: detail.name,
|
|
32
|
+
...(detail.shortDescription ? { shortDescription: detail.shortDescription } : {}),
|
|
33
|
+
...(detail.imageUrl ? { imageUrl: detail.imageUrl } : {}),
|
|
34
|
+
...(detail.venueName
|
|
35
|
+
? { venue: { id: detail.venueId ?? '', name: detail.venueName, city: detail.venueCity ?? '' } }
|
|
36
|
+
: {}),
|
|
37
|
+
...(next ? { nextOccurrence: { startsAt: next } } : {}),
|
|
38
|
+
availabilityStatus: soldOut ? 'sold_out' : 'available',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const STRINGS = {
|
|
42
|
+
available: 'Available',
|
|
43
|
+
limited: 'Limited',
|
|
44
|
+
soldOut: 'Sold Out',
|
|
45
|
+
notFound: 'Event not found',
|
|
46
|
+
loadFailed: 'Failed to load event',
|
|
47
|
+
};
|
|
48
|
+
/** As the component formatted it. See the note on the cart core's date. */
|
|
49
|
+
function formatDate(dateString) {
|
|
50
|
+
return new Date(dateString).toLocaleDateString('en-GB', {
|
|
51
|
+
weekday: 'short',
|
|
52
|
+
day: 'numeric',
|
|
53
|
+
month: 'short',
|
|
54
|
+
hour: '2-digit',
|
|
55
|
+
minute: '2-digit',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export const eventCardCore = defineElement({
|
|
59
|
+
tag: 'tl-event-card',
|
|
60
|
+
docs: 'One event as a card: its image, name, next date, venue and how it is selling.',
|
|
61
|
+
category: 'discovery',
|
|
62
|
+
runtimes: ['web', 'native'],
|
|
63
|
+
tokens: [
|
|
64
|
+
'error',
|
|
65
|
+
'error-foreground',
|
|
66
|
+
'font-family',
|
|
67
|
+
'foreground',
|
|
68
|
+
'muted',
|
|
69
|
+
'muted-foreground',
|
|
70
|
+
'primary',
|
|
71
|
+
'radius-lg',
|
|
72
|
+
'radius-sm',
|
|
73
|
+
'secondary',
|
|
74
|
+
'spacing-4',
|
|
75
|
+
'success',
|
|
76
|
+
'success-foreground',
|
|
77
|
+
'warning',
|
|
78
|
+
'warning-foreground',
|
|
79
|
+
],
|
|
80
|
+
sdkMethods: ['events.get'],
|
|
81
|
+
props: {
|
|
82
|
+
event: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
tsType: 'TlEventCardEvent | undefined',
|
|
85
|
+
attr: null,
|
|
86
|
+
docs: 'Event data to display (tl-event-list passes this)',
|
|
87
|
+
},
|
|
88
|
+
eventId: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
tsType: 'string | undefined',
|
|
91
|
+
attr: 'event-id',
|
|
92
|
+
docs: 'Load the event from the SDK by id when no `event` is given, so a single\ncard works standalone (e.g. on a Webflow page).',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
events: {
|
|
96
|
+
tlClick: { detail: '{ eventId: string; }', docs: 'Emitted when the card is clicked' },
|
|
97
|
+
tlError: { detail: '{ message: string; }', docs: 'Emitted when the event could not be loaded by id' },
|
|
98
|
+
},
|
|
99
|
+
strings: STRINGS,
|
|
100
|
+
statuses: ['loading', 'error', 'empty', 'ready'],
|
|
101
|
+
state: () => ({ loadedEvent: null, loading: false, error: null }),
|
|
102
|
+
/**
|
|
103
|
+
* On screen: read the event, but only when there is one to read and nobody
|
|
104
|
+
* has handed us the event already.
|
|
105
|
+
*
|
|
106
|
+
* `loading` is set here, synchronously, rather than inside the read. The
|
|
107
|
+
* component awaited its load in `componentWillLoad`, so its first paint was
|
|
108
|
+
* already past it; a mount hook cannot hold the first paint, so the card
|
|
109
|
+
* shows its own skeleton instead of a blank. That is the same change
|
|
110
|
+
* `tl-ticket-selector` took when it moved onto the hook (TKT-197).
|
|
111
|
+
*/
|
|
112
|
+
mount: (ctx) => {
|
|
113
|
+
if (ctx.props.event || !ctx.props.eventId)
|
|
114
|
+
return;
|
|
115
|
+
ctx.setState({ loading: true, error: null });
|
|
116
|
+
void (async () => {
|
|
117
|
+
try {
|
|
118
|
+
await ctx.whenClient();
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (!ctx.active())
|
|
122
|
+
return;
|
|
123
|
+
ctx.actions.loadFailed(err instanceof Error && err.message ? err.message : ctx.strings.loadFailed);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!ctx.active())
|
|
127
|
+
return;
|
|
128
|
+
await ctx.actions.load();
|
|
129
|
+
})();
|
|
130
|
+
},
|
|
131
|
+
status: ({ state, props }) => state.loading ? 'loading' : state.error ? 'error' : props.event || state.loadedEvent ? 'ready' : 'empty',
|
|
132
|
+
derive: ({ state, props, strings }) => {
|
|
133
|
+
const event = props.event ?? state.loadedEvent;
|
|
134
|
+
const badge = (suffix) => `status-badge ${suffix}`;
|
|
135
|
+
const status = event?.availabilityStatus;
|
|
136
|
+
return {
|
|
137
|
+
event,
|
|
138
|
+
// The sales surface exposes a single `imageUrl` (card/listing
|
|
139
|
+
// thumbnail); `thumbnailUrl` is an accepted alias if a host ever
|
|
140
|
+
// supplies a distinct one.
|
|
141
|
+
image: event ? event.thumbnailUrl || event.imageUrl || null : null,
|
|
142
|
+
statusBadgeClass: status === 'available'
|
|
143
|
+
? badge('status-available')
|
|
144
|
+
: status === 'limited'
|
|
145
|
+
? badge('status-limited')
|
|
146
|
+
: status === 'sold_out'
|
|
147
|
+
? badge('status-sold-out')
|
|
148
|
+
: 'status-badge',
|
|
149
|
+
statusLabel: status === 'available'
|
|
150
|
+
? strings.available
|
|
151
|
+
: status === 'limited'
|
|
152
|
+
? strings.limited
|
|
153
|
+
: status === 'sold_out'
|
|
154
|
+
? strings.soldOut
|
|
155
|
+
: '',
|
|
156
|
+
dateLabel: event?.nextOccurrence ? formatDate(event.nextOccurrence.startsAt) : null,
|
|
157
|
+
venueLabel: event?.venue ? `${event.venue.name}, ${event.venue.city}` : null,
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
actions: (ctx) => ({
|
|
161
|
+
/**
|
|
162
|
+
* Read the event by id. A card that was handed an event, or has no id, has
|
|
163
|
+
* nothing to read, and this is the guard the component's watcher relied on.
|
|
164
|
+
*/
|
|
165
|
+
async load() {
|
|
166
|
+
if (ctx.props.event || !ctx.props.eventId)
|
|
167
|
+
return;
|
|
168
|
+
try {
|
|
169
|
+
ctx.setState({ loading: true, error: null });
|
|
170
|
+
const events = ctx.client().getEventsManager();
|
|
171
|
+
const read = events.get?.bind(events);
|
|
172
|
+
if (!read)
|
|
173
|
+
throw new TypeError('eventsManager.get is not a function');
|
|
174
|
+
const detail = (await read(ctx.props.eventId));
|
|
175
|
+
if (!detail)
|
|
176
|
+
throw new Error(ctx.strings.notFound);
|
|
177
|
+
ctx.setState({ loadedEvent: toEventCardEvent(detail) });
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
const message = err instanceof Error && err.message ? err.message : ctx.strings.loadFailed;
|
|
181
|
+
ctx.setState({ error: message });
|
|
182
|
+
ctx.emit('tlError', { message });
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
ctx.setState({ loading: false });
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* The host never produced a client. Announced, because the component
|
|
190
|
+
* announced it: the wait and the read were one try block.
|
|
191
|
+
*/
|
|
192
|
+
loadFailed(message) {
|
|
193
|
+
const text = message || ctx.strings.loadFailed;
|
|
194
|
+
ctx.setState({ error: text, loading: false });
|
|
195
|
+
ctx.emit('tlError', { message: text });
|
|
196
|
+
},
|
|
197
|
+
/** The buyer picked this card. Where that goes is the host's business. */
|
|
198
|
+
click() {
|
|
199
|
+
const event = ctx.props.event ?? ctx.state.loadedEvent;
|
|
200
|
+
if (!event)
|
|
201
|
+
return;
|
|
202
|
+
ctx.emit('tlClick', { eventId: event.id });
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
205
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TlEventCardEvent } from './event-card.js';
|
|
2
|
+
export interface EventListProps {
|
|
3
|
+
limit: number;
|
|
4
|
+
category: string | undefined;
|
|
5
|
+
columns: number;
|
|
6
|
+
}
|
|
7
|
+
export interface EventListState {
|
|
8
|
+
events: TlEventCardEvent[];
|
|
9
|
+
loading: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface EventListDerived {
|
|
13
|
+
events: TlEventCardEvent[];
|
|
14
|
+
/** The column count the grid is drawn in, clamped to what the stylesheet has. */
|
|
15
|
+
columns: number;
|
|
16
|
+
}
|
|
17
|
+
export type EventListStatus = 'loading' | 'error' | 'empty' | 'ready';
|
|
18
|
+
declare const STRINGS: {
|
|
19
|
+
errorTitle: string;
|
|
20
|
+
emptyTitle: string;
|
|
21
|
+
emptyMessage: string;
|
|
22
|
+
loadFailed: string;
|
|
23
|
+
noListing: string;
|
|
24
|
+
};
|
|
25
|
+
export type EventListStrings = typeof STRINGS;
|
|
26
|
+
export declare const eventListCore: import("../define.js").ElementCore<EventListProps, EventListState, EventListDerived, {
|
|
27
|
+
load(): Promise<void>;
|
|
28
|
+
}, EventListStatus, {
|
|
29
|
+
errorTitle: string;
|
|
30
|
+
emptyTitle: string;
|
|
31
|
+
emptyMessage: string;
|
|
32
|
+
loadFailed: string;
|
|
33
|
+
noListing: string;
|
|
34
|
+
}>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tl-event-list`: what the channel is selling, as a grid of cards.
|
|
3
|
+
*
|
|
4
|
+
* One read, and a re-read whenever the host changes what it is asking for. The
|
|
5
|
+
* cards themselves are `tl-event-card`, which has its own core; this one
|
|
6
|
+
* decides only what to ask for and what the grid says while there is nothing
|
|
7
|
+
* in it.
|
|
8
|
+
*
|
|
9
|
+
* Behaviour is what the Stencil component did, to the letter, including the
|
|
10
|
+
* two things that read like oversights and are kept:
|
|
11
|
+
*
|
|
12
|
+
* - there is NO error event. A failed listing is drawn and never announced,
|
|
13
|
+
* which makes this the only element of the eighteen that can fail silently
|
|
14
|
+
* as far as a host is concerned. Adding `tlError` would be a new event on a
|
|
15
|
+
* published element, so it is a decision for somebody rather than something
|
|
16
|
+
* to slip into a refactor.
|
|
17
|
+
* - the element paints nothing until the first listing lands. It holds
|
|
18
|
+
* skeleton markup and uses it for every read but the first, because the
|
|
19
|
+
* component awaited its read in `componentWillLoad` and Stencil does not
|
|
20
|
+
* paint until that resolves. The harness keeps that by waiting on the same
|
|
21
|
+
* thing; the core simply reports `loading` and lets the harness decide when
|
|
22
|
+
* a first paint happens, which is a rendering question.
|
|
23
|
+
*
|
|
24
|
+
* What did not come across is the `console.log` tracing, which a library
|
|
25
|
+
* should not do for its host (`tl-cart` dropped its own for the same reason).
|
|
26
|
+
*/
|
|
27
|
+
import { defineElement } from '../define.js';
|
|
28
|
+
const STRINGS = {
|
|
29
|
+
errorTitle: 'Error loading events',
|
|
30
|
+
emptyTitle: 'No events available',
|
|
31
|
+
emptyMessage: 'Check back later for upcoming events.',
|
|
32
|
+
loadFailed: 'Failed to load events',
|
|
33
|
+
noListing: 'Events are not available',
|
|
34
|
+
};
|
|
35
|
+
/** The grid has a class per column count, and only four of them. */
|
|
36
|
+
const MIN_COLUMNS = 1;
|
|
37
|
+
const MAX_COLUMNS = 4;
|
|
38
|
+
export const eventListCore = defineElement({
|
|
39
|
+
tag: 'tl-event-list',
|
|
40
|
+
docs: "What the channel is selling, as a grid of event cards, optionally narrowed to one category.",
|
|
41
|
+
category: 'discovery',
|
|
42
|
+
runtimes: ['web', 'native'],
|
|
43
|
+
tokens: [
|
|
44
|
+
'error',
|
|
45
|
+
'font-family',
|
|
46
|
+
'foreground',
|
|
47
|
+
'muted',
|
|
48
|
+
'muted-foreground',
|
|
49
|
+
'radius-lg',
|
|
50
|
+
'radius-sm',
|
|
51
|
+
'secondary',
|
|
52
|
+
'spacing-4',
|
|
53
|
+
'spacing-6',
|
|
54
|
+
'spacing-8',
|
|
55
|
+
],
|
|
56
|
+
sdkMethods: ['events.list'],
|
|
57
|
+
props: {
|
|
58
|
+
limit: { type: 'number', attr: 'limit', default: 12, docs: 'Maximum number of events to display' },
|
|
59
|
+
category: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
tsType: 'string | undefined',
|
|
62
|
+
attr: 'category',
|
|
63
|
+
docs: 'Category filter',
|
|
64
|
+
},
|
|
65
|
+
columns: { type: 'number', attr: 'columns', default: 3, docs: 'Columns for grid layout (1, 2, 3, or 4)' },
|
|
66
|
+
},
|
|
67
|
+
events: {
|
|
68
|
+
tlEventClick: { detail: '{ eventId: string; }', docs: 'Emitted when an event card is clicked' },
|
|
69
|
+
},
|
|
70
|
+
strings: STRINGS,
|
|
71
|
+
statuses: ['loading', 'error', 'empty', 'ready'],
|
|
72
|
+
state: () => ({ events: [], loading: true, error: null }),
|
|
73
|
+
mount: (ctx) => {
|
|
74
|
+
void ctx.actions.load();
|
|
75
|
+
},
|
|
76
|
+
status: ({ state }) => state.loading ? 'loading' : state.error ? 'error' : state.events.length === 0 ? 'empty' : 'ready',
|
|
77
|
+
derive: ({ state, props }) => ({
|
|
78
|
+
events: state.events,
|
|
79
|
+
columns: Math.min(Math.max(props.columns, MIN_COLUMNS), MAX_COLUMNS),
|
|
80
|
+
}),
|
|
81
|
+
actions: (ctx) => ({
|
|
82
|
+
/**
|
|
83
|
+
* Read the listing. Also what a harness calls when the limit or the
|
|
84
|
+
* category changes, because a different question deserves a fresh answer
|
|
85
|
+
* and the previous one is not narrowed down to it.
|
|
86
|
+
*/
|
|
87
|
+
async load() {
|
|
88
|
+
try {
|
|
89
|
+
ctx.setState({ loading: true, error: null });
|
|
90
|
+
const client = await ctx.whenClient();
|
|
91
|
+
const events = client.getEventsManager();
|
|
92
|
+
if (!events?.list)
|
|
93
|
+
throw new TypeError(ctx.strings.noListing);
|
|
94
|
+
const response = (await events.list({ limit: ctx.props.limit, category: ctx.props.category }));
|
|
95
|
+
ctx.setState({ events: (response?.items ?? []) });
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
// Shown and not announced: this element has no error event.
|
|
99
|
+
ctx.setState({ error: err instanceof Error ? err.message : ctx.strings.loadFailed });
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
ctx.setState({ loading: false });
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
@@ -9,6 +9,34 @@
|
|
|
9
9
|
* that is in both, so the two cannot drift while the split is half done.
|
|
10
10
|
*/
|
|
11
11
|
import type { AnyElementCore } from '../manifest.js';
|
|
12
|
+
export { buyTicketsButtonCore } from './buy-tickets-button.js';
|
|
13
|
+
export type { BuyTicketsButtonDerived, BuyTicketsButtonProps, BuyTicketsButtonSaleState, BuyTicketsButtonSize, BuyTicketsButtonState, BuyTicketsButtonStatus, BuyTicketsButtonStrings, BuyTicketsButtonVariant, } from './buy-tickets-button.js';
|
|
14
|
+
export { buyTicketsWrapperCore } from './buy-tickets-wrapper.js';
|
|
15
|
+
export type { BuyTicketsWrapperDerived, BuyTicketsWrapperProps, BuyTicketsWrapperState, BuyTicketsWrapperStatus, BuyTicketsWrapperStrings, } from './buy-tickets-wrapper.js';
|
|
16
|
+
export { cartCore } from './cart.js';
|
|
17
|
+
export type { CartDerived, CartProps, CartRow, CartState, CartStatus, CartStrings, TlCartData, TlCartItem, } from './cart.js';
|
|
18
|
+
export { cartBadgeCore, CART_COUNT_KEY } from './cart-badge.js';
|
|
19
|
+
export type { CartBadgeDerived, CartBadgeProps, CartBadgeState, CartBadgeStatus, CartBadgeStrings, } from './cart-badge.js';
|
|
20
|
+
export { cartDrawerCore, CLOSE_INTENT, OPEN_INTENT } from './cart-drawer.js';
|
|
21
|
+
export type { CartDrawerDerived, CartDrawerProps, CartDrawerState, CartDrawerStatus, CartDrawerStrings, } from './cart-drawer.js';
|
|
22
|
+
export { checkoutWrapperCore } from './checkout-wrapper.js';
|
|
23
|
+
export type { CheckoutWrapperDerived, CheckoutWrapperProps, CheckoutWrapperState, CheckoutWrapperStatus, CheckoutWrapperStrings, } from './checkout-wrapper.js';
|
|
24
|
+
export { eventCardCore, toEventCardEvent } from './event-card.js';
|
|
25
|
+
export type { EventCardDerived, EventCardProps, EventCardState, EventCardStatus, EventCardStrings, EventDetailLike, TlEventCardEvent, } from './event-card.js';
|
|
26
|
+
export { eventListCore } from './event-list.js';
|
|
27
|
+
export type { EventListDerived, EventListProps, EventListState, EventListStatus, EventListStrings, } from './event-list.js';
|
|
28
|
+
export { loginCore } from './login.js';
|
|
29
|
+
export type { LoginDerived, LoginProps, LoginState, LoginStatus, LoginStrings, TlAuthChanged, TlLoginCustomer, TlLoginPhase, } from './login.js';
|
|
30
|
+
export { myOrdersCore } from './my-orders.js';
|
|
31
|
+
export type { MyOrdersDerived, MyOrdersProps, MyOrdersRow, MyOrdersState, MyOrdersStatus, MyOrdersStrings, } from './my-orders.js';
|
|
32
|
+
export { occurrenceSelectorCore, HORIZONTAL_MIN_WIDTH } from './occurrence-selector.js';
|
|
33
|
+
export type { OccurrenceCalendarDay, OccurrenceEventLike, OccurrenceSelectorDerived, OccurrenceSelectorDisplayMode, OccurrenceSelectorOrientation, OccurrenceSelectorProps, OccurrenceSelectorRow, OccurrenceSelectorState, OccurrenceSelectorStatus, OccurrenceSelectorStrings, TlOccurrence, TlOccurrenceSelectorTheme, } from './occurrence-selector.js';
|
|
34
|
+
export { orderConfirmationCore } from './order-confirmation.js';
|
|
35
|
+
export type { OrderConfirmationDerived, OrderConfirmationLine, OrderConfirmationProps, OrderConfirmationRow, OrderConfirmationState, OrderConfirmationStatus, OrderConfirmationStrings, } from './order-confirmation.js';
|
|
36
|
+
export { orderTicketsCore, POLL_DELAYS_MS } from './order-tickets.js';
|
|
37
|
+
export type { OrderTicketsDerived, OrderTicketsProps, OrderTicketsState, OrderTicketsStatus, OrderTicketsStrings, } from './order-tickets.js';
|
|
38
|
+
export { isAuthError, promoCodeCore } from './promo-code.js';
|
|
39
|
+
export type { PromoCodeDerived, PromoCodeProps, PromoCodeState, PromoCodeStatus, PromoCodeStrings, TlPromoApplied, } from './promo-code.js';
|
|
12
40
|
export { ticketSelectorCore } from './ticket-selector.js';
|
|
13
41
|
export type { AddToCartItem, TicketSelectorDerived, TicketSelectorProps, TicketSelectorRow, TicketSelectorState, TicketSelectorStatus, TicketSelectorStrings, TlTicketType, } from './ticket-selector.js';
|
|
14
42
|
/** Every core, by tag. */
|
package/dist/esm/cores/index.js
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
|
+
import { buyTicketsButtonCore } from './buy-tickets-button.js';
|
|
2
|
+
import { buyTicketsWrapperCore } from './buy-tickets-wrapper.js';
|
|
3
|
+
import { cartCore } from './cart.js';
|
|
4
|
+
import { cartBadgeCore } from './cart-badge.js';
|
|
5
|
+
import { cartDrawerCore } from './cart-drawer.js';
|
|
6
|
+
import { checkoutWrapperCore } from './checkout-wrapper.js';
|
|
7
|
+
import { eventCardCore } from './event-card.js';
|
|
8
|
+
import { eventListCore } from './event-list.js';
|
|
9
|
+
import { loginCore } from './login.js';
|
|
10
|
+
import { myOrdersCore } from './my-orders.js';
|
|
11
|
+
import { occurrenceSelectorCore } from './occurrence-selector.js';
|
|
12
|
+
import { orderConfirmationCore } from './order-confirmation.js';
|
|
13
|
+
import { orderTicketsCore } from './order-tickets.js';
|
|
14
|
+
import { promoCodeCore } from './promo-code.js';
|
|
1
15
|
import { ticketSelectorCore } from './ticket-selector.js';
|
|
16
|
+
export { buyTicketsButtonCore } from './buy-tickets-button.js';
|
|
17
|
+
export { buyTicketsWrapperCore } from './buy-tickets-wrapper.js';
|
|
18
|
+
export { cartCore } from './cart.js';
|
|
19
|
+
export { cartBadgeCore, CART_COUNT_KEY } from './cart-badge.js';
|
|
20
|
+
export { cartDrawerCore, CLOSE_INTENT, OPEN_INTENT } from './cart-drawer.js';
|
|
21
|
+
export { checkoutWrapperCore } from './checkout-wrapper.js';
|
|
22
|
+
export { eventCardCore, toEventCardEvent } from './event-card.js';
|
|
23
|
+
export { eventListCore } from './event-list.js';
|
|
24
|
+
export { loginCore } from './login.js';
|
|
25
|
+
export { myOrdersCore } from './my-orders.js';
|
|
26
|
+
export { occurrenceSelectorCore, HORIZONTAL_MIN_WIDTH } from './occurrence-selector.js';
|
|
27
|
+
export { orderConfirmationCore } from './order-confirmation.js';
|
|
28
|
+
export { orderTicketsCore, POLL_DELAYS_MS } from './order-tickets.js';
|
|
29
|
+
export { isAuthError, promoCodeCore } from './promo-code.js';
|
|
2
30
|
export { ticketSelectorCore } from './ticket-selector.js';
|
|
3
31
|
/** Every core, by tag. */
|
|
4
32
|
export const ELEMENT_CORES = {
|
|
33
|
+
[buyTicketsButtonCore.tag]: buyTicketsButtonCore,
|
|
34
|
+
[buyTicketsWrapperCore.tag]: buyTicketsWrapperCore,
|
|
35
|
+
[cartCore.tag]: cartCore,
|
|
36
|
+
[cartBadgeCore.tag]: cartBadgeCore,
|
|
37
|
+
[cartDrawerCore.tag]: cartDrawerCore,
|
|
38
|
+
[checkoutWrapperCore.tag]: checkoutWrapperCore,
|
|
39
|
+
[eventCardCore.tag]: eventCardCore,
|
|
40
|
+
[eventListCore.tag]: eventListCore,
|
|
41
|
+
[loginCore.tag]: loginCore,
|
|
42
|
+
[myOrdersCore.tag]: myOrdersCore,
|
|
43
|
+
[occurrenceSelectorCore.tag]: occurrenceSelectorCore,
|
|
44
|
+
[orderConfirmationCore.tag]: orderConfirmationCore,
|
|
45
|
+
[orderTicketsCore.tag]: orderTicketsCore,
|
|
46
|
+
[promoCodeCore.tag]: promoCodeCore,
|
|
5
47
|
[ticketSelectorCore.tag]: ticketSelectorCore,
|
|
6
48
|
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** The customer as the session exposes it. */
|
|
2
|
+
export interface TlLoginCustomer {
|
|
3
|
+
id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
firstName?: string | null;
|
|
6
|
+
lastName?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface TlAuthChanged {
|
|
9
|
+
customer: TlLoginCustomer | null;
|
|
10
|
+
authenticated: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type TlLoginPhase = 'email' | 'sent' | 'code' | 'verifying' | 'signed-in';
|
|
13
|
+
export interface LoginProps {
|
|
14
|
+
heading: string;
|
|
15
|
+
allowCodeEntry: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface LoginState {
|
|
18
|
+
phase: TlLoginPhase;
|
|
19
|
+
email: string;
|
|
20
|
+
code: string;
|
|
21
|
+
busy: boolean;
|
|
22
|
+
error: string | null;
|
|
23
|
+
notice: string | null;
|
|
24
|
+
customer: TlLoginCustomer | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the client can sign anyone in at all. False until the host's
|
|
27
|
+
* client is up, and false forever on a connector with no auth accessor,
|
|
28
|
+
* which is what disables the form.
|
|
29
|
+
*/
|
|
30
|
+
authAvailable: boolean;
|
|
31
|
+
/** A magic-link code is single use; the URL is read once per instance. */
|
|
32
|
+
urlCodeUsed: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface LoginDerived {
|
|
35
|
+
/** The address to show on the signed-in step. */
|
|
36
|
+
signedInEmail: string;
|
|
37
|
+
/** The email form is dead until the client can sign somebody in. */
|
|
38
|
+
inputsDisabled: boolean;
|
|
39
|
+
emailSubmitLabel: string;
|
|
40
|
+
resendLabel: string;
|
|
41
|
+
codeSubmitLabel: string;
|
|
42
|
+
showCodeEntry: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type LoginStatus = TlLoginPhase;
|
|
45
|
+
declare const STRINGS: {
|
|
46
|
+
signedInPrefix: string;
|
|
47
|
+
fallbackAccount: string;
|
|
48
|
+
signOut: string;
|
|
49
|
+
verifyingTitle: string;
|
|
50
|
+
verifyingLead: string;
|
|
51
|
+
sentTitle: string;
|
|
52
|
+
sentLeadBefore: string;
|
|
53
|
+
sentLeadAfter: string;
|
|
54
|
+
sentAgain: string;
|
|
55
|
+
resendLink: string;
|
|
56
|
+
resending: string;
|
|
57
|
+
enterCodeInstead: string;
|
|
58
|
+
differentEmail: string;
|
|
59
|
+
codeTitle: string;
|
|
60
|
+
codeLeadBefore: string;
|
|
61
|
+
codeLeadAfter: string;
|
|
62
|
+
codeLabel: string;
|
|
63
|
+
codePlaceholder: string;
|
|
64
|
+
codeSubmit: string;
|
|
65
|
+
checking: string;
|
|
66
|
+
back: string;
|
|
67
|
+
emailLead: string;
|
|
68
|
+
emailLabel: string;
|
|
69
|
+
emailPlaceholder: string;
|
|
70
|
+
emailSubmit: string;
|
|
71
|
+
sendingLink: string;
|
|
72
|
+
enterEmail: string;
|
|
73
|
+
enterCode: string;
|
|
74
|
+
codeRejected: string;
|
|
75
|
+
requestFailed: string;
|
|
76
|
+
unavailable: string;
|
|
77
|
+
unsupported: string;
|
|
78
|
+
};
|
|
79
|
+
export type LoginStrings = typeof STRINGS;
|
|
80
|
+
export declare const loginCore: import("../define.js").ElementCore<LoginProps, LoginState, LoginDerived, {
|
|
81
|
+
setEmail(value: string): void;
|
|
82
|
+
setCode(value: string): void;
|
|
83
|
+
requestLink(resend?: boolean): Promise<void>;
|
|
84
|
+
submitCode(): Promise<void>;
|
|
85
|
+
exchange(code: string): Promise<void>;
|
|
86
|
+
signOut(): Promise<void>;
|
|
87
|
+
goTo(phase: TlLoginPhase): void;
|
|
88
|
+
syncFromClient(): void;
|
|
89
|
+
connectFailed(): void;
|
|
90
|
+
unsupported(): void;
|
|
91
|
+
}, TlLoginPhase, {
|
|
92
|
+
signedInPrefix: string;
|
|
93
|
+
fallbackAccount: string;
|
|
94
|
+
signOut: string;
|
|
95
|
+
verifyingTitle: string;
|
|
96
|
+
verifyingLead: string;
|
|
97
|
+
sentTitle: string;
|
|
98
|
+
sentLeadBefore: string;
|
|
99
|
+
sentLeadAfter: string;
|
|
100
|
+
sentAgain: string;
|
|
101
|
+
resendLink: string;
|
|
102
|
+
resending: string;
|
|
103
|
+
enterCodeInstead: string;
|
|
104
|
+
differentEmail: string;
|
|
105
|
+
codeTitle: string;
|
|
106
|
+
codeLeadBefore: string;
|
|
107
|
+
codeLeadAfter: string;
|
|
108
|
+
codeLabel: string;
|
|
109
|
+
codePlaceholder: string;
|
|
110
|
+
codeSubmit: string;
|
|
111
|
+
checking: string;
|
|
112
|
+
back: string;
|
|
113
|
+
emailLead: string;
|
|
114
|
+
emailLabel: string;
|
|
115
|
+
emailPlaceholder: string;
|
|
116
|
+
emailSubmit: string;
|
|
117
|
+
sendingLink: string;
|
|
118
|
+
enterEmail: string;
|
|
119
|
+
enterCode: string;
|
|
120
|
+
codeRejected: string;
|
|
121
|
+
requestFailed: string;
|
|
122
|
+
unavailable: string;
|
|
123
|
+
unsupported: string;
|
|
124
|
+
}>;
|
|
125
|
+
export {};
|