@ticketlayer/live 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/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/auto.d.ts +31 -0
- package/dist/auto.d.ts.map +1 -0
- package/dist/auto.js +78 -0
- package/dist/auto.js.map +1 -0
- package/dist/client.d.ts +538 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +495 -0
- package/dist/client.js.map +1 -0
- package/dist/clientHeader.d.ts +4 -0
- package/dist/clientHeader.d.ts.map +1 -0
- package/dist/clientHeader.js +25 -0
- package/dist/clientHeader.js.map +1 -0
- package/dist/core/liveClient.d.ts +176 -0
- package/dist/core/liveClient.d.ts.map +1 -0
- package/dist/core/liveClient.js +372 -0
- package/dist/core/liveClient.js.map +1 -0
- package/dist/createLiveClient.d.ts +49 -0
- package/dist/createLiveClient.d.ts.map +1 -0
- package/dist/createLiveClient.js +91 -0
- package/dist/createLiveClient.js.map +1 -0
- package/dist/elements.d.ts +88 -0
- package/dist/elements.d.ts.map +1 -0
- package/dist/elements.js +165 -0
- package/dist/elements.js.map +1 -0
- package/dist/generated/types.d.ts +6110 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +6 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/native/asyncStorageStorage.d.ts +24 -0
- package/dist/native/asyncStorageStorage.d.ts.map +1 -0
- package/dist/native/asyncStorageStorage.js +24 -0
- package/dist/native/asyncStorageStorage.js.map +1 -0
- package/dist/native/checkoutUrl.d.ts +85 -0
- package/dist/native/checkoutUrl.d.ts.map +1 -0
- package/dist/native/checkoutUrl.js +147 -0
- package/dist/native/checkoutUrl.js.map +1 -0
- package/dist/native/index.d.ts +119 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +145 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/secureStoreStorage.d.ts +33 -0
- package/dist/native/secureStoreStorage.d.ts.map +1 -0
- package/dist/native/secureStoreStorage.js +39 -0
- package/dist/native/secureStoreStorage.js.map +1 -0
- package/dist/native/storage.d.ts +29 -0
- package/dist/native/storage.d.ts.map +1 -0
- package/dist/native/storage.js +24 -0
- package/dist/native/storage.js.map +1 -0
- package/dist/server.d.ts +95 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +188 -0
- package/dist/server.js.map +1 -0
- package/dist/state/buyModal.d.ts +24 -0
- package/dist/state/buyModal.d.ts.map +1 -0
- package/dist/state/buyModal.js +56 -0
- package/dist/state/buyModal.js.map +1 -0
- package/dist/state/checkoutModal.d.ts +26 -0
- package/dist/state/checkoutModal.d.ts.map +1 -0
- package/dist/state/checkoutModal.js +126 -0
- package/dist/state/checkoutModal.js.map +1 -0
- package/dist/state/emitter.d.ts +21 -0
- package/dist/state/emitter.d.ts.map +1 -0
- package/dist/state/emitter.js +26 -0
- package/dist/state/emitter.js.map +1 -0
- package/dist/state/loadElements.d.ts +8 -0
- package/dist/state/loadElements.d.ts.map +1 -0
- package/dist/state/loadElements.js +39 -0
- package/dist/state/loadElements.js.map +1 -0
- package/dist/state/registry.d.ts +39 -0
- package/dist/state/registry.d.ts.map +1 -0
- package/dist/state/registry.js +65 -0
- package/dist/state/registry.js.map +1 -0
- package/dist/state/theme.d.ts +20 -0
- package/dist/state/theme.d.ts.map +1 -0
- package/dist/state/theme.js +47 -0
- package/dist/state/theme.js.map +1 -0
- package/dist/ticketlayer.js +5 -0
- package/dist/ticketlayer.js.map +7 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-neutral core of the Live client.
|
|
3
|
+
*
|
|
4
|
+
* Nothing in this module reads `window`, `document` or `location`: it is the
|
|
5
|
+
* shared state layer (session, cart, auth, orders, the event bus) that both
|
|
6
|
+
* adapters build on - `createLiveClient` (browser: cookie or token transport,
|
|
7
|
+
* page defaults, window publishing, modals) and `createNativeLiveClient`
|
|
8
|
+
* (React Native: injected token storage, X-Live-Session header, no page).
|
|
9
|
+
* `theme.apply()` delegates to applyTheme, which is a no-op without a document.
|
|
10
|
+
*/
|
|
11
|
+
import { LiveClient } from '../client.js';
|
|
12
|
+
import { type LiveEvent } from '../state/emitter.js';
|
|
13
|
+
/**
|
|
14
|
+
* Stateful ergonomic layer over the generated LiveClient.
|
|
15
|
+
*
|
|
16
|
+
* The generated client is stateless REST; Elements and HBO need a stateful,
|
|
17
|
+
* reactive surface (a session-owned cart, cart:updated events, theme
|
|
18
|
+
* application, auth state). This class provides that, COORDINATING with the
|
|
19
|
+
* live-api session - which owns the cartId server-side - rather than holding a
|
|
20
|
+
* second source of truth: on start it loads the session's existing cart, and
|
|
21
|
+
* cart mutations both update local state AND ride the same session upstream.
|
|
22
|
+
*/
|
|
23
|
+
export interface SessionState {
|
|
24
|
+
channelId: string | null;
|
|
25
|
+
customer: unknown | null;
|
|
26
|
+
authenticated: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** Result of redeeming a presale/promo code (POST /sales/presale-codes/redeem). */
|
|
29
|
+
export interface PresaleRedemption {
|
|
30
|
+
benefit: string;
|
|
31
|
+
alreadyHeld: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CartItemInput {
|
|
34
|
+
eventOccurrenceId: string;
|
|
35
|
+
categoryId: string;
|
|
36
|
+
ticketTypeId: string;
|
|
37
|
+
quantity?: number;
|
|
38
|
+
eventLayoutAreaId?: string;
|
|
39
|
+
eventLayoutSeatIds?: string[];
|
|
40
|
+
}
|
|
41
|
+
export declare class TicketlayerLive {
|
|
42
|
+
/** The underlying generated client (escape hatch for un-wrapped calls). */
|
|
43
|
+
readonly client: LiveClient;
|
|
44
|
+
private emitter;
|
|
45
|
+
private sessionMode;
|
|
46
|
+
private publishableKey;
|
|
47
|
+
private domain;
|
|
48
|
+
private baseUrl;
|
|
49
|
+
private _sessionStarted;
|
|
50
|
+
private _sessionStarting;
|
|
51
|
+
private _session;
|
|
52
|
+
private _cart;
|
|
53
|
+
private _cartId;
|
|
54
|
+
readonly events: {
|
|
55
|
+
list: () => Promise<unknown>;
|
|
56
|
+
get: (eventId: string) => Promise<unknown>;
|
|
57
|
+
};
|
|
58
|
+
readonly theme: {
|
|
59
|
+
get: () => Promise<unknown>;
|
|
60
|
+
apply: () => Promise<unknown>;
|
|
61
|
+
};
|
|
62
|
+
readonly cart: {
|
|
63
|
+
readonly current: unknown | null;
|
|
64
|
+
readonly id: string | null;
|
|
65
|
+
ensure: () => Promise<string>;
|
|
66
|
+
add: (item: CartItemInput) => Promise<unknown>;
|
|
67
|
+
remove: (itemId: string) => Promise<unknown>;
|
|
68
|
+
refresh: () => Promise<unknown>;
|
|
69
|
+
checkout: (opts?: {
|
|
70
|
+
customerNotes?: string;
|
|
71
|
+
}) => Promise<unknown>;
|
|
72
|
+
};
|
|
73
|
+
readonly auth: {
|
|
74
|
+
readonly customer: unknown | null;
|
|
75
|
+
readonly authenticated: boolean;
|
|
76
|
+
requestMagicLink: (contact: {
|
|
77
|
+
email?: string;
|
|
78
|
+
phone?: string;
|
|
79
|
+
}) => Promise<unknown>;
|
|
80
|
+
exchange: (proof: string | {
|
|
81
|
+
type: string;
|
|
82
|
+
code?: string;
|
|
83
|
+
assertion?: string;
|
|
84
|
+
}) => Promise<unknown>;
|
|
85
|
+
logout: () => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
readonly orders: {
|
|
88
|
+
mine: () => Promise<unknown>;
|
|
89
|
+
get: (orderId: string) => Promise<unknown>;
|
|
90
|
+
ticketPdf: (orderId: string, passId: string) => Promise<Blob>;
|
|
91
|
+
};
|
|
92
|
+
readonly payments: {
|
|
93
|
+
begin: (orderId: string, opts?: {
|
|
94
|
+
paymentType?: string;
|
|
95
|
+
returnUrl?: string;
|
|
96
|
+
}) => Promise<unknown>;
|
|
97
|
+
};
|
|
98
|
+
readonly presale: {
|
|
99
|
+
redeem: (code: string) => Promise<PresaleRedemption>;
|
|
100
|
+
};
|
|
101
|
+
readonly queue: {
|
|
102
|
+
status: () => Promise<unknown>;
|
|
103
|
+
join: () => Promise<unknown>;
|
|
104
|
+
};
|
|
105
|
+
constructor(client: LiveClient, opts: {
|
|
106
|
+
sessionMode: 'cookie' | 'token';
|
|
107
|
+
publishableKey?: string;
|
|
108
|
+
domain?: string;
|
|
109
|
+
baseUrl: string;
|
|
110
|
+
});
|
|
111
|
+
/** Subscribe to a state event or UI intent; returns an unsubscribe fn. */
|
|
112
|
+
on(event: LiveEvent, handler: (payload?: unknown) => void): () => void;
|
|
113
|
+
off(event: LiveEvent, handler: (payload?: unknown) => void): void;
|
|
114
|
+
/**
|
|
115
|
+
* Push an event onto the shared bus. Used by Elements/host to raise UI
|
|
116
|
+
* intents (e.g. ui:checkout-requested) that the host app acts on - the SDK
|
|
117
|
+
* relays but does not render UI itself.
|
|
118
|
+
*/
|
|
119
|
+
emit(event: LiveEvent, payload?: unknown): void;
|
|
120
|
+
get session(): Readonly<SessionState>;
|
|
121
|
+
/** True once a session has been created/resumed (i.e. a mutation has happened). */
|
|
122
|
+
get hasSession(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Create the Live session on demand and hydrate state - idempotent and
|
|
125
|
+
* single-flight. Called lazily before the first mutation (cart/login); NOT on
|
|
126
|
+
* page load, so browsing never creates a session. Channel is identified by the
|
|
127
|
+
* publishable key (embed) or the storefront domain (hosted).
|
|
128
|
+
*/
|
|
129
|
+
ensureSession(): Promise<void>;
|
|
130
|
+
/** @deprecated Use ensureSession(); kept for back-compat. */
|
|
131
|
+
start(opts?: {
|
|
132
|
+
domain?: string;
|
|
133
|
+
}): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Rehydrate an ALREADY-EXISTING session (hosted/cookie transport) without
|
|
136
|
+
* creating one. On a page load/refresh the client is lazily session-less, but
|
|
137
|
+
* a returning visitor may still hold the `live_session` cookie with a cart
|
|
138
|
+
* server-side. This probes `GET /session` (a cheap read - it 401s when no
|
|
139
|
+
* session exists, and never writes one): on success it binds this client to
|
|
140
|
+
* that session and pulls the cart back in; on 401 it stays session-less so
|
|
141
|
+
* browsing still creates no session. Marking `_sessionStarted` on success is
|
|
142
|
+
* load-bearing - otherwise the next mutation's ensureSession() would POST a
|
|
143
|
+
* fresh session and orphan the existing cart.
|
|
144
|
+
*
|
|
145
|
+
* @returns true if an existing session was resumed.
|
|
146
|
+
*/
|
|
147
|
+
resumeIfExists(): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Resume an EXISTING session by token instead of bootstrapping a new one.
|
|
150
|
+
* Used by the embedded checkout iframe: the third-party page hands off its
|
|
151
|
+
* session token so the iframe sees the same cart/channel (token transport).
|
|
152
|
+
*/
|
|
153
|
+
resume(token: string): Promise<void>;
|
|
154
|
+
/** The current session token (token mode), for handing off to an embed iframe. */
|
|
155
|
+
getSessionToken(): Promise<string | null>;
|
|
156
|
+
/** Re-read session state (customer, auth, cart) from the live-api session. */
|
|
157
|
+
refreshSession(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Forget that a session was started, so the next mutation or sign-in mints a
|
|
160
|
+
* fresh one. For adapters whose process outlives the session (a native app
|
|
161
|
+
* signing out, a stored token the API rejected); a browser page reloads instead.
|
|
162
|
+
*/
|
|
163
|
+
protected _resetSessionStarted(): void;
|
|
164
|
+
private _setCart;
|
|
165
|
+
/**
|
|
166
|
+
* True when an API error means the server-side cart is no longer usable -
|
|
167
|
+
* it expired (reservation TTL lapsed), was already checked out, or can't be
|
|
168
|
+
* found. The SDK holds the cartId in memory and rehydrates it from the
|
|
169
|
+
* server session on load, so a lapsed cart would otherwise wedge every
|
|
170
|
+
* subsequent add/remove/checkout with a 409.
|
|
171
|
+
*/
|
|
172
|
+
private _isCartGone;
|
|
173
|
+
/** Forget all local cart state and notify subscribers the cart is now empty. */
|
|
174
|
+
private _resetCart;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=liveClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveClient.d.ts","sourceRoot":"","sources":["../../src/core/liveClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;;;;;;;GASG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAeD,qBAAa,eAAe;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,OAAO,CAAS;IAIxB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,gBAAgB,CAA8B;IAEtD,OAAO,CAAC,QAAQ,CAA2E;IAC3F,OAAO,CAAC,KAAK,CAAwB;IACrC,O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S,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;IAGtE,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAGjE;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAI/C,IAAI,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,CAEpC;IAED,mFAAmF;IACnF,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;;;;OAKG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCpC,6DAA6D;IACvD,KAAK,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D;;;;;;;;;;;;OAYG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAYxC;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C,kFAAkF;IAClF,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzC,8EAA8E;IACxE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAerC;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;IAKtC,OAAO,CAAC,QAAQ;IAKhB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAUnB,gFAAgF;IAChF,OAAO,CAAC,UAAU;CAInB"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-neutral core of the Live client.
|
|
3
|
+
*
|
|
4
|
+
* Nothing in this module reads `window`, `document` or `location`: it is the
|
|
5
|
+
* shared state layer (session, cart, auth, orders, the event bus) that both
|
|
6
|
+
* adapters build on - `createLiveClient` (browser: cookie or token transport,
|
|
7
|
+
* page defaults, window publishing, modals) and `createNativeLiveClient`
|
|
8
|
+
* (React Native: injected token storage, X-Live-Session header, no page).
|
|
9
|
+
* `theme.apply()` delegates to applyTheme, which is a no-op without a document.
|
|
10
|
+
*/
|
|
11
|
+
import { LiveAPIError } from '../client.js';
|
|
12
|
+
import { Emitter } from '../state/emitter.js';
|
|
13
|
+
import { applyTheme } from '../state/theme.js';
|
|
14
|
+
/**
|
|
15
|
+
* Pull a named field from a response, tolerating the generator's
|
|
16
|
+
* single-property auto-unwrapping: some methods return `{ cart }`, others
|
|
17
|
+
* already return the cart itself. If `key` is present we use it; otherwise the
|
|
18
|
+
* value is assumed to be the already-unwrapped payload.
|
|
19
|
+
*/
|
|
20
|
+
const field = (obj, key) => {
|
|
21
|
+
if (obj && typeof obj === 'object' && !Array.isArray(obj) && key in obj) {
|
|
22
|
+
return obj[key];
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
};
|
|
26
|
+
export class TicketlayerLive {
|
|
27
|
+
constructor(client, opts) {
|
|
28
|
+
this.emitter = new Emitter();
|
|
29
|
+
// A session is created LAZILY - only when something mutates state (cart/login).
|
|
30
|
+
// Browsing uses the publishable key as read auth, so most visitors never get
|
|
31
|
+
// a session (no per-visitor Redis write).
|
|
32
|
+
this._sessionStarted = false;
|
|
33
|
+
this._sessionStarting = null;
|
|
34
|
+
this._session = { channelId: null, customer: null, authenticated: false };
|
|
35
|
+
this._cart = null;
|
|
36
|
+
this._cartId = null;
|
|
37
|
+
this.client = client;
|
|
38
|
+
this.sessionMode = opts.sessionMode;
|
|
39
|
+
this.publishableKey = opts.publishableKey;
|
|
40
|
+
this.domain = opts.domain;
|
|
41
|
+
this.baseUrl = opts.baseUrl.replace(/\/$/, '');
|
|
42
|
+
const self = this;
|
|
43
|
+
this.events = {
|
|
44
|
+
list: () => self.client.salesListings.list(),
|
|
45
|
+
get: (eventId) => self.client.sales.get(eventId).then((d) => field(d, 'event')),
|
|
46
|
+
};
|
|
47
|
+
this.theme = {
|
|
48
|
+
get: () => self.client.sales.getTheme().then((d) => field(d, 'theme')),
|
|
49
|
+
apply: async () => {
|
|
50
|
+
const theme = await self.theme.get();
|
|
51
|
+
applyTheme(theme);
|
|
52
|
+
return theme;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
this.cart = {
|
|
56
|
+
get current() {
|
|
57
|
+
return self._cart;
|
|
58
|
+
},
|
|
59
|
+
get id() {
|
|
60
|
+
return self._cartId;
|
|
61
|
+
},
|
|
62
|
+
ensure: async () => {
|
|
63
|
+
if (!self._cartId) {
|
|
64
|
+
// First mutation → create the session lazily, then the cart.
|
|
65
|
+
await self.ensureSession();
|
|
66
|
+
const res = await self.client.salesCarts.create({});
|
|
67
|
+
const cart = field(res, 'cart');
|
|
68
|
+
self._cartId = cart?.id ?? null;
|
|
69
|
+
self._setCart(cart);
|
|
70
|
+
}
|
|
71
|
+
return self._cartId;
|
|
72
|
+
},
|
|
73
|
+
add: async (item) => {
|
|
74
|
+
const id = await self.cart.ensure();
|
|
75
|
+
try {
|
|
76
|
+
const res = await self.client.salesCarts.addItem(id, item);
|
|
77
|
+
self._setCart(field(res, 'cart'));
|
|
78
|
+
return self._cart;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
if (!self._isCartGone(err))
|
|
82
|
+
throw err;
|
|
83
|
+
// The server-side reservation lapsed under us. Drop the dead cart,
|
|
84
|
+
// mint a fresh one and re-add - adding tickets should just work.
|
|
85
|
+
self._resetCart();
|
|
86
|
+
const freshId = await self.cart.ensure();
|
|
87
|
+
const res = await self.client.salesCarts.addItem(freshId, item);
|
|
88
|
+
self._setCart(field(res, 'cart'));
|
|
89
|
+
return self._cart;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
remove: async (itemId) => {
|
|
93
|
+
if (!self._cartId)
|
|
94
|
+
return self._cart;
|
|
95
|
+
try {
|
|
96
|
+
const res = await self.client.salesCarts.removeItem(self._cartId, itemId);
|
|
97
|
+
self._setCart(field(res, 'cart'));
|
|
98
|
+
return self._cart;
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
if (!self._isCartGone(err))
|
|
102
|
+
throw err;
|
|
103
|
+
// Nothing to remove from an expired cart - clear it locally and let
|
|
104
|
+
// the UI fall through to an empty cart rather than surfacing an error.
|
|
105
|
+
self._resetCart();
|
|
106
|
+
return self._cart;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
refresh: async () => {
|
|
110
|
+
if (!self._cartId)
|
|
111
|
+
return self._cart;
|
|
112
|
+
try {
|
|
113
|
+
const res = await self.client.salesCarts.get(self._cartId);
|
|
114
|
+
self._setCart(field(res, 'cart'));
|
|
115
|
+
return self._cart;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (!self._isCartGone(err))
|
|
119
|
+
throw err;
|
|
120
|
+
// A stale cartId carried in from a prior session/page load. Forget it
|
|
121
|
+
// so the next mutation starts a clean cart.
|
|
122
|
+
self._resetCart();
|
|
123
|
+
return self._cart;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
checkout: async (opts = {}) => {
|
|
127
|
+
if (!self._cartId)
|
|
128
|
+
throw new Error('No cart to check out');
|
|
129
|
+
try {
|
|
130
|
+
const res = await self.client.salesCarts.checkout(self._cartId, opts);
|
|
131
|
+
self._cartId = null;
|
|
132
|
+
self._setCart(null);
|
|
133
|
+
self.emitter.emit('checkout:completed', field(res, 'order'));
|
|
134
|
+
return res; // { cart, order, orderAccessToken }
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
if (!self._isCartGone(err))
|
|
138
|
+
throw err;
|
|
139
|
+
// Can't check out an expired cart - clear it and surface a clear,
|
|
140
|
+
// actionable error instead of the raw 409.
|
|
141
|
+
self._resetCart();
|
|
142
|
+
throw new LiveAPIError('Your cart has expired. Please add your tickets again.', 'CART_EXPIRED', 409);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
this.auth = {
|
|
147
|
+
get customer() {
|
|
148
|
+
return self._session.customer;
|
|
149
|
+
},
|
|
150
|
+
get authenticated() {
|
|
151
|
+
return self._session.authenticated;
|
|
152
|
+
},
|
|
153
|
+
requestMagicLink: (contact) => self.client.salesCustomerAuth.magicLink(contact),
|
|
154
|
+
exchange: async (proof) => {
|
|
155
|
+
// Exchanging a proof binds a customer to THIS session → ensure one exists.
|
|
156
|
+
await self.ensureSession();
|
|
157
|
+
const body = typeof proof === 'string' ? { type: 'magic_link', code: proof } : proof;
|
|
158
|
+
const res = await self.client.salesCustomerTokens.create({ proof: body });
|
|
159
|
+
self._session = {
|
|
160
|
+
...self._session,
|
|
161
|
+
customer: field(res, 'customer') ?? null,
|
|
162
|
+
authenticated: true,
|
|
163
|
+
};
|
|
164
|
+
self.emitter.emit('auth:changed', self._session);
|
|
165
|
+
return res;
|
|
166
|
+
},
|
|
167
|
+
logout: async () => {
|
|
168
|
+
await self.client.session.end().catch(() => undefined);
|
|
169
|
+
self._session = { channelId: self._session.channelId, customer: null, authenticated: false };
|
|
170
|
+
self._cart = null;
|
|
171
|
+
self._cartId = null;
|
|
172
|
+
self.emitter.emit('auth:changed', self._session);
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
this.orders = {
|
|
176
|
+
mine: () => self.client.salesMyOrders.list().then((d) => field(d, 'orders')),
|
|
177
|
+
get: (orderId) => self.client.salesOrders.get(orderId).then((d) => field(d, 'order')),
|
|
178
|
+
// Binary download - bypasses the generated (JSON) client; fetches the PDF
|
|
179
|
+
// with the same session credentials.
|
|
180
|
+
ticketPdf: async (orderId, passId) => {
|
|
181
|
+
const headers = {};
|
|
182
|
+
if (self.publishableKey)
|
|
183
|
+
headers['Authorization'] = `Bearer ${self.publishableKey}`;
|
|
184
|
+
if (self.sessionMode === 'token') {
|
|
185
|
+
const token = await self.client.getSessionToken();
|
|
186
|
+
if (token)
|
|
187
|
+
headers['X-Live-Session'] = token;
|
|
188
|
+
}
|
|
189
|
+
const res = await fetch(`${self.baseUrl}/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, { headers, credentials: self.sessionMode === 'cookie' ? 'include' : 'same-origin' });
|
|
190
|
+
if (!res.ok)
|
|
191
|
+
throw new LiveAPIError(`Failed to download ticket (${res.status})`, 'TICKET_PDF_FAILED', res.status);
|
|
192
|
+
return res.blob();
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
this.payments = {
|
|
196
|
+
begin: (orderId, opts = {}) => self.client.salesOrderPayments.create(orderId, opts).then((d) => field(d, 'payment')),
|
|
197
|
+
};
|
|
198
|
+
this.presale = {
|
|
199
|
+
// POST /sales/presale-codes/redeem - needs a signed-in customer. Gated
|
|
200
|
+
// pricing unlocks immediately, so re-read the cart and let cart:updated
|
|
201
|
+
// carry the new totals to subscribers. A failed refresh must not undo a
|
|
202
|
+
// redemption that already succeeded.
|
|
203
|
+
redeem: async (code) => {
|
|
204
|
+
const res = (await self.client.salesPresaleCodes.redeem({ code: code.trim() }));
|
|
205
|
+
if (self._cartId)
|
|
206
|
+
await self.cart.refresh().catch(() => undefined);
|
|
207
|
+
return res;
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
this.queue = {
|
|
211
|
+
status: () => self.client.queue.status(),
|
|
212
|
+
join: () => self.client.queue.join(),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** Subscribe to a state event or UI intent; returns an unsubscribe fn. */
|
|
216
|
+
on(event, handler) {
|
|
217
|
+
return this.emitter.on(event, handler);
|
|
218
|
+
}
|
|
219
|
+
off(event, handler) {
|
|
220
|
+
this.emitter.off(event, handler);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Push an event onto the shared bus. Used by Elements/host to raise UI
|
|
224
|
+
* intents (e.g. ui:checkout-requested) that the host app acts on - the SDK
|
|
225
|
+
* relays but does not render UI itself.
|
|
226
|
+
*/
|
|
227
|
+
emit(event, payload) {
|
|
228
|
+
this.emitter.emit(event, payload);
|
|
229
|
+
}
|
|
230
|
+
get session() {
|
|
231
|
+
return this._session;
|
|
232
|
+
}
|
|
233
|
+
/** True once a session has been created/resumed (i.e. a mutation has happened). */
|
|
234
|
+
get hasSession() {
|
|
235
|
+
return this._sessionStarted;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Create the Live session on demand and hydrate state - idempotent and
|
|
239
|
+
* single-flight. Called lazily before the first mutation (cart/login); NOT on
|
|
240
|
+
* page load, so browsing never creates a session. Channel is identified by the
|
|
241
|
+
* publishable key (embed) or the storefront domain (hosted).
|
|
242
|
+
*/
|
|
243
|
+
async ensureSession() {
|
|
244
|
+
if (this._sessionStarted)
|
|
245
|
+
return;
|
|
246
|
+
if (this._sessionStarting)
|
|
247
|
+
return this._sessionStarting;
|
|
248
|
+
this._sessionStarting = (async () => {
|
|
249
|
+
// Embed (token transport) authenticates the session by publishable key;
|
|
250
|
+
// hosted (cookie transport) by storefront domain.
|
|
251
|
+
const startBody = {};
|
|
252
|
+
if (this.sessionMode === 'token' && this.publishableKey) {
|
|
253
|
+
startBody.channelKey = this.publishableKey;
|
|
254
|
+
}
|
|
255
|
+
else if (this.domain) {
|
|
256
|
+
startBody.domain = this.domain;
|
|
257
|
+
}
|
|
258
|
+
else if (this.publishableKey) {
|
|
259
|
+
startBody.channelKey = this.publishableKey;
|
|
260
|
+
}
|
|
261
|
+
const started = await this.client.session.start(startBody);
|
|
262
|
+
if (this.sessionMode === 'token') {
|
|
263
|
+
const token = field(started, 'sessionToken');
|
|
264
|
+
if (token)
|
|
265
|
+
await this.client.setSessionToken(token);
|
|
266
|
+
}
|
|
267
|
+
this._sessionStarted = true;
|
|
268
|
+
await this.refreshSession();
|
|
269
|
+
})();
|
|
270
|
+
try {
|
|
271
|
+
await this._sessionStarting;
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
this._sessionStarting = null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** @deprecated Use ensureSession(); kept for back-compat. */
|
|
278
|
+
async start(opts = {}) {
|
|
279
|
+
if (opts.domain)
|
|
280
|
+
this.domain = opts.domain;
|
|
281
|
+
return this.ensureSession();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Rehydrate an ALREADY-EXISTING session (hosted/cookie transport) without
|
|
285
|
+
* creating one. On a page load/refresh the client is lazily session-less, but
|
|
286
|
+
* a returning visitor may still hold the `live_session` cookie with a cart
|
|
287
|
+
* server-side. This probes `GET /session` (a cheap read - it 401s when no
|
|
288
|
+
* session exists, and never writes one): on success it binds this client to
|
|
289
|
+
* that session and pulls the cart back in; on 401 it stays session-less so
|
|
290
|
+
* browsing still creates no session. Marking `_sessionStarted` on success is
|
|
291
|
+
* load-bearing - otherwise the next mutation's ensureSession() would POST a
|
|
292
|
+
* fresh session and orphan the existing cart.
|
|
293
|
+
*
|
|
294
|
+
* @returns true if an existing session was resumed.
|
|
295
|
+
*/
|
|
296
|
+
async resumeIfExists() {
|
|
297
|
+
if (this._sessionStarted)
|
|
298
|
+
return true;
|
|
299
|
+
try {
|
|
300
|
+
await this.refreshSession();
|
|
301
|
+
this._sessionStarted = true;
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
// 401 NO_SESSION (or transient) → no session to resume; remain lazy.
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Resume an EXISTING session by token instead of bootstrapping a new one.
|
|
311
|
+
* Used by the embedded checkout iframe: the third-party page hands off its
|
|
312
|
+
* session token so the iframe sees the same cart/channel (token transport).
|
|
313
|
+
*/
|
|
314
|
+
async resume(token) {
|
|
315
|
+
await this.client.setSessionToken(token);
|
|
316
|
+
this._sessionStarted = true;
|
|
317
|
+
await this.refreshSession();
|
|
318
|
+
}
|
|
319
|
+
/** The current session token (token mode), for handing off to an embed iframe. */
|
|
320
|
+
getSessionToken() {
|
|
321
|
+
return this.client.getSessionToken();
|
|
322
|
+
}
|
|
323
|
+
/** Re-read session state (customer, auth, cart) from the live-api session. */
|
|
324
|
+
async refreshSession() {
|
|
325
|
+
const cur = await this.client.session.current();
|
|
326
|
+
this._session = {
|
|
327
|
+
channelId: field(cur, 'channel')?.id ?? null,
|
|
328
|
+
customer: field(cur, 'customer') ?? null,
|
|
329
|
+
authenticated: !!field(cur, 'authenticated'),
|
|
330
|
+
};
|
|
331
|
+
const cartId = field(cur, 'cartId') ?? null;
|
|
332
|
+
if (cartId) {
|
|
333
|
+
this._cartId = cartId;
|
|
334
|
+
await this.cart.refresh();
|
|
335
|
+
}
|
|
336
|
+
this.emitter.emit('session:changed', this._session);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Forget that a session was started, so the next mutation or sign-in mints a
|
|
340
|
+
* fresh one. For adapters whose process outlives the session (a native app
|
|
341
|
+
* signing out, a stored token the API rejected); a browser page reloads instead.
|
|
342
|
+
*/
|
|
343
|
+
_resetSessionStarted() {
|
|
344
|
+
this._sessionStarted = false;
|
|
345
|
+
this._sessionStarting = null;
|
|
346
|
+
}
|
|
347
|
+
_setCart(cart) {
|
|
348
|
+
this._cart = cart ?? null;
|
|
349
|
+
this.emitter.emit('cart:updated', this._cart);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* True when an API error means the server-side cart is no longer usable -
|
|
353
|
+
* it expired (reservation TTL lapsed), was already checked out, or can't be
|
|
354
|
+
* found. The SDK holds the cartId in memory and rehydrates it from the
|
|
355
|
+
* server session on load, so a lapsed cart would otherwise wedge every
|
|
356
|
+
* subsequent add/remove/checkout with a 409.
|
|
357
|
+
*/
|
|
358
|
+
_isCartGone(err) {
|
|
359
|
+
if (!(err instanceof LiveAPIError))
|
|
360
|
+
return false;
|
|
361
|
+
return (err.code === 'CART_EXPIRED' ||
|
|
362
|
+
err.code === 'CART_NOT_ACTIVE' ||
|
|
363
|
+
err.code === 'CART_NOT_FOUND' ||
|
|
364
|
+
err.status === 404);
|
|
365
|
+
}
|
|
366
|
+
/** Forget all local cart state and notify subscribers the cart is now empty. */
|
|
367
|
+
_resetCart() {
|
|
368
|
+
this._cartId = null;
|
|
369
|
+
this._setCart(null);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=liveClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveClient.js","sourceRoot":"","sources":["../../src/core/liveClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAc,YAAY,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,OAAO,EAAkB,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAkC/C;;;;;GAKG;AACH,MAAM,KAAK,GAAG,CAAI,GAAY,EAAE,GAAW,EAAiB,EAAE;IAC5D,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACxE,OAAQ,GAA+B,CAAC,GAAG,CAAM,CAAC;IACpD,CAAC;IACD,OAAO,GAAoB,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,OAAO,eAAe;IAoD1B,YACE,MAAkB,EAClB,IAAoG;QAlD9F,YAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAKhC,gFAAgF;QAChF,6EAA6E;QAC7E,0CAA0C;QAClC,oBAAe,GAAG,KAAK,CAAC;QACxB,qBAAgB,GAAyB,IAAI,CAAC;QAE9C,aAAQ,GAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QACnF,UAAK,GAAmB,IAAI,CAAC;QAC7B,YAAO,GAAkB,IAAI,CAAC;QAuCpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,IAA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AC;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type LiveClientConfig } from './client.js';
|
|
2
|
+
import { type LoadElementsOptions } from './state/loadElements.js';
|
|
3
|
+
import { type CheckoutModalOptions } from './state/checkoutModal.js';
|
|
4
|
+
import { TicketlayerLive } from './core/liveClient.js';
|
|
5
|
+
/**
|
|
6
|
+
* Browser adapter over the runtime-neutral core in ./core/liveClient.ts:
|
|
7
|
+
* resolves the channel from the page host, picks the session transport
|
|
8
|
+
* (cookie for a hosted storefront, token for embeds), publishes the client on
|
|
9
|
+
* `window.Ticketlayer`, applies the theme and mounts the modals. The class
|
|
10
|
+
* itself is re-exported here so existing imports keep working.
|
|
11
|
+
*/
|
|
12
|
+
export { TicketlayerLive };
|
|
13
|
+
export type { PresaleRedemption, SessionState, CartItemInput } from './core/liveClient.js';
|
|
14
|
+
export interface CreateLiveClientOptions extends LiveClientConfig, LoadElementsOptions {
|
|
15
|
+
/** Storefront host to resolve the channel from (hosted mode). Defaults to the page host. */
|
|
16
|
+
domain?: string;
|
|
17
|
+
/** Bootstrap the session immediately (default true). */
|
|
18
|
+
autoStart?: boolean;
|
|
19
|
+
/** Fetch + apply the channel theme on start (default true in the browser). */
|
|
20
|
+
applyTheme?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Publish this client on `window.Ticketlayer` so Elements can find + bind to
|
|
23
|
+
* it (default true in the browser). Set false to keep the client private.
|
|
24
|
+
*/
|
|
25
|
+
publish?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Resume an existing session by token (token transport) instead of
|
|
28
|
+
* bootstrapping a new one. Used by the embedded checkout iframe to inherit
|
|
29
|
+
* the parent page's cart/session. Forces sessionMode 'token'.
|
|
30
|
+
*/
|
|
31
|
+
sessionToken?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Checkout rendering. 'modal' (third-party embeds) auto-opens the hosted
|
|
34
|
+
* checkout in an iframe overlay on `ui:checkout-requested`. Omit on HBO,
|
|
35
|
+
* which handles that intent by navigating to /checkout in-page.
|
|
36
|
+
*/
|
|
37
|
+
checkout?: {
|
|
38
|
+
mode: 'modal';
|
|
39
|
+
} & CheckoutModalOptions;
|
|
40
|
+
/**
|
|
41
|
+
* Mount the in-page buy-tickets modal (occurrence → ticket selection) on
|
|
42
|
+
* `ui:event-modal-requested`. Native Elements overlay, no iframe - works on
|
|
43
|
+
* HBO and embeds alike. Defaults to true in the browser for the published
|
|
44
|
+
* client; set false to opt out.
|
|
45
|
+
*/
|
|
46
|
+
buyModal?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare function createLiveClient(options: CreateLiveClientOptions): Promise<TicketlayerLive>;
|
|
49
|
+
//# sourceMappingURL=createLiveClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLiveClient.d.ts","sourceRoot":"","sources":["../src/createLiveClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAI3F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE3F,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB,EAAE,mBAAmB;IACpF,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,oBAAoB,CAAC;IACpD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkBD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC,CAoEjG"}
|