@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
package/dist/client.js
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { SDK_NAME, SDK_VERSION } from './version.js';
|
|
2
|
+
/**
|
|
3
|
+
* The dated API version (TL-Version) this SDK speaks. Stamped at generation
|
|
4
|
+
* time; the Live/sales surface keeps serving this version's behaviour even as
|
|
5
|
+
* the API evolves. See https://docs.ticketlayer.com/api/versions
|
|
6
|
+
*/
|
|
7
|
+
export const API_DATED_VERSION = '2026-06-13';
|
|
8
|
+
/** Best-effort description of the JavaScript runtime, for the TL-Client header. */
|
|
9
|
+
function describeRuntime() {
|
|
10
|
+
const g = globalThis;
|
|
11
|
+
if (g.navigator?.product === 'ReactNative')
|
|
12
|
+
return 'react-native';
|
|
13
|
+
if (typeof g.window !== 'undefined' && typeof g.document !== 'undefined')
|
|
14
|
+
return 'browser';
|
|
15
|
+
if (g.process?.versions?.node)
|
|
16
|
+
return `node/${g.process.versions.node}`;
|
|
17
|
+
if (g.EdgeRuntime)
|
|
18
|
+
return 'edge';
|
|
19
|
+
return 'unknown';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Identifies this SDK build to the API, sent as the TL-Client request header:
|
|
23
|
+
* `ticketlayer-live/<package version> (<runtime>)`. SDK_VERSION comes from
|
|
24
|
+
* src/version.ts, which the package's prebuild writes from package.json so the
|
|
25
|
+
* header always names the version npm published.
|
|
26
|
+
*/
|
|
27
|
+
export const SDK_CLIENT_HEADER = `${SDK_NAME.replace(/^@/, '').replace('/', '-')}/${SDK_VERSION} (${describeRuntime()})`;
|
|
28
|
+
/** In-memory storage (default; embeds/SSR). */
|
|
29
|
+
export function memoryTokenStorage() {
|
|
30
|
+
let token = null;
|
|
31
|
+
return {
|
|
32
|
+
get: () => token,
|
|
33
|
+
set: (t) => {
|
|
34
|
+
token = t;
|
|
35
|
+
},
|
|
36
|
+
clear: () => {
|
|
37
|
+
token = null;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export class LiveAPIError extends Error {
|
|
42
|
+
constructor(message, code, status) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.code = code;
|
|
45
|
+
this.status = status;
|
|
46
|
+
this.name = 'LiveAPIError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generated Live client. Mirrors the sales surface (byte-for-byte views) plus
|
|
51
|
+
* the Live-only /session and /queue operations. Auth is the Live session
|
|
52
|
+
* (cookie on hosted web; X-Live-Session header elsewhere) + the channel
|
|
53
|
+
* publishable key for embeds. Browser ergonomics live in createLiveClient.
|
|
54
|
+
*/
|
|
55
|
+
export class LiveClient {
|
|
56
|
+
constructor(config) {
|
|
57
|
+
/**
|
|
58
|
+
* Sales Listings methods
|
|
59
|
+
*/
|
|
60
|
+
this.salesListings = {
|
|
61
|
+
/**
|
|
62
|
+
* List active listings
|
|
63
|
+
* What is on sale through this channel right now. The channel is resolved from the key, never from a parameter.
|
|
64
|
+
* @operationId listSalesListings
|
|
65
|
+
*/
|
|
66
|
+
list: async () => {
|
|
67
|
+
const response = await this.request(`/sales/listings`, {
|
|
68
|
+
method: 'GET'
|
|
69
|
+
});
|
|
70
|
+
return response;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Sales Customer Auth methods
|
|
75
|
+
*/
|
|
76
|
+
this.salesCustomerAuth = {
|
|
77
|
+
/**
|
|
78
|
+
* Request magic link
|
|
79
|
+
* Start a magic-link sign-in for a customer. Always reports success - account existence is never revealed.
|
|
80
|
+
* @operationId requestSalesMagicLink
|
|
81
|
+
*/
|
|
82
|
+
magicLink: async (request) => {
|
|
83
|
+
const response = await this.request(`/sales/customer-auth/magic-link`, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
body: JSON.stringify(request)
|
|
86
|
+
});
|
|
87
|
+
return response.sent;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Sales Customer Tokens methods
|
|
92
|
+
*/
|
|
93
|
+
this.salesCustomerTokens = {
|
|
94
|
+
/**
|
|
95
|
+
* Exchange identity proof for customer token
|
|
96
|
+
* Exchange an identity proof (magic-link code or partner assertion) for a short-lived customer token bound to this channel. Identity is exchanged, never asserted.
|
|
97
|
+
* @operationId createSalesCustomerToken
|
|
98
|
+
*/
|
|
99
|
+
create: async (request) => {
|
|
100
|
+
const response = await this.request(`/sales/customer-tokens`, {
|
|
101
|
+
method: 'POST',
|
|
102
|
+
body: JSON.stringify(request)
|
|
103
|
+
});
|
|
104
|
+
return response;
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Refresh a customer token
|
|
108
|
+
* Re-signs a still-valid customer token (presented via X-Customer-Token) for a fresh 30 minutes, carrying the original 24-hour absolute ceiling forward. Once the ceiling passes the customer must re-authenticate.
|
|
109
|
+
* @operationId refreshSalesCustomerToken
|
|
110
|
+
*/
|
|
111
|
+
refresh: async () => {
|
|
112
|
+
const response = await this.request(`/sales/customer-tokens/refresh`, {
|
|
113
|
+
method: 'POST'
|
|
114
|
+
});
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Sales Carts methods
|
|
120
|
+
*/
|
|
121
|
+
this.salesCarts = {
|
|
122
|
+
/**
|
|
123
|
+
* Create cart
|
|
124
|
+
* Create a cart on this channel. Customer identity comes only from a verified customer token, never from the body.
|
|
125
|
+
* @operationId createSalesCart
|
|
126
|
+
*/
|
|
127
|
+
create: async (request) => {
|
|
128
|
+
const response = await this.request(`/sales/carts`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
body: JSON.stringify(request)
|
|
131
|
+
});
|
|
132
|
+
return response.cart;
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Get cart
|
|
136
|
+
* Get a cart with its items
|
|
137
|
+
* @operationId getSalesCart
|
|
138
|
+
*/
|
|
139
|
+
get: async (cartId) => {
|
|
140
|
+
const response = await this.request(`/sales/carts/${cartId}`, {
|
|
141
|
+
method: 'GET'
|
|
142
|
+
});
|
|
143
|
+
return response.cart;
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Add cart item
|
|
147
|
+
* Add an item to the cart, taking a real inventory reservation with the channel's TTL
|
|
148
|
+
* @operationId addSalesCartItem
|
|
149
|
+
*/
|
|
150
|
+
addItem: async (cartId, request) => {
|
|
151
|
+
const response = await this.request(`/sales/carts/${cartId}/items`, {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
body: JSON.stringify(request)
|
|
154
|
+
});
|
|
155
|
+
return response.cart;
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* Remove cart item
|
|
159
|
+
* Remove an item from the cart, releasing its reservation
|
|
160
|
+
* @operationId removeSalesCartItem
|
|
161
|
+
*/
|
|
162
|
+
removeItem: async (cartId, itemId) => {
|
|
163
|
+
const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
|
|
164
|
+
method: 'DELETE'
|
|
165
|
+
});
|
|
166
|
+
return response.cart;
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Checkout cart
|
|
170
|
+
* Convert the cart into an order. Returns an order access token for possession-based guest access (confirmation page, payment status polling).
|
|
171
|
+
* @operationId checkoutSalesCart
|
|
172
|
+
*/
|
|
173
|
+
checkout: async (cartId, request) => {
|
|
174
|
+
const response = await this.request(`/sales/carts/${cartId}/checkout`, {
|
|
175
|
+
method: 'POST',
|
|
176
|
+
body: JSON.stringify(request)
|
|
177
|
+
});
|
|
178
|
+
return response;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Sales My Orders methods
|
|
183
|
+
*/
|
|
184
|
+
this.salesMyOrders = {
|
|
185
|
+
/**
|
|
186
|
+
* List my orders
|
|
187
|
+
* The verified customer's own orders. Requires a customer token - orders cannot be listed with key or possession credentials alone.
|
|
188
|
+
* @operationId listMySalesOrders
|
|
189
|
+
*/
|
|
190
|
+
list: async () => {
|
|
191
|
+
const response = await this.request(`/sales/my-orders`, {
|
|
192
|
+
method: 'GET'
|
|
193
|
+
});
|
|
194
|
+
return response.orders;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Sales Orders methods
|
|
199
|
+
*/
|
|
200
|
+
this.salesOrders = {
|
|
201
|
+
/**
|
|
202
|
+
* Get order
|
|
203
|
+
* Get an order on this channel. Access requires a secret key (own channel), an X-Order-Access-Token header (guest possession) or a customer token (own orders).
|
|
204
|
+
* @operationId getSalesOrder
|
|
205
|
+
*/
|
|
206
|
+
get: async (orderId) => {
|
|
207
|
+
const response = await this.request(`/sales/orders/${orderId}`, {
|
|
208
|
+
method: 'GET'
|
|
209
|
+
});
|
|
210
|
+
return response.order;
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* Download a ticket PDF
|
|
214
|
+
* Render and stream a pass as a PDF ticket (application/pdf) for the holder. Order-access gated. Browsers fetch this directly rather than through the typed SDK.
|
|
215
|
+
* @operationId getSalesOrderTicketPdf
|
|
216
|
+
*/
|
|
217
|
+
ticketPdf: async (orderId, passId) => {
|
|
218
|
+
const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
|
|
219
|
+
method: 'GET'
|
|
220
|
+
});
|
|
221
|
+
return response;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Sales Order Payments methods
|
|
226
|
+
*/
|
|
227
|
+
this.salesOrderPayments = {
|
|
228
|
+
/**
|
|
229
|
+
* Create order payment
|
|
230
|
+
* Initiate payment for the order's outstanding balance through the channel's payment provider
|
|
231
|
+
* @operationId createSalesOrderPayment
|
|
232
|
+
*/
|
|
233
|
+
create: async (orderId, request) => {
|
|
234
|
+
const response = await this.request(`/sales/orders/${orderId}/payments`, {
|
|
235
|
+
method: 'POST',
|
|
236
|
+
body: JSON.stringify(request)
|
|
237
|
+
});
|
|
238
|
+
return response.payment;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Sales Refund Requests methods
|
|
243
|
+
*/
|
|
244
|
+
this.salesRefundRequests = {
|
|
245
|
+
/**
|
|
246
|
+
* Request refund or exchange
|
|
247
|
+
* File a refund or exchange request for the order within the resolved refund policy. Requester identity is derived from the credential, never from the body.
|
|
248
|
+
* @operationId createSalesOrderRefundRequest
|
|
249
|
+
*/
|
|
250
|
+
create: async (orderId, request) => {
|
|
251
|
+
const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
body: JSON.stringify(request)
|
|
254
|
+
});
|
|
255
|
+
return response.request;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Sales Customers methods
|
|
260
|
+
*/
|
|
261
|
+
this.salesCustomers = {
|
|
262
|
+
/**
|
|
263
|
+
* Create customer
|
|
264
|
+
* Provenance-scoped channel CRM (secret keys only). Reuses the org's existing record for the email and grants the channel access; there is no list or search.
|
|
265
|
+
* @operationId createSalesCustomer
|
|
266
|
+
*/
|
|
267
|
+
create: async (request) => {
|
|
268
|
+
const response = await this.request(`/sales/customers`, {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
body: JSON.stringify(request)
|
|
271
|
+
});
|
|
272
|
+
return response.customer;
|
|
273
|
+
},
|
|
274
|
+
/**
|
|
275
|
+
* Get customer
|
|
276
|
+
* Get a customer the channel holds an access grant for (created through it, or who bought through it)
|
|
277
|
+
* @operationId getSalesCustomer
|
|
278
|
+
*/
|
|
279
|
+
get: async (customerId) => {
|
|
280
|
+
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
281
|
+
method: 'GET'
|
|
282
|
+
});
|
|
283
|
+
return response.customer;
|
|
284
|
+
},
|
|
285
|
+
/**
|
|
286
|
+
* Update customer
|
|
287
|
+
* Update a customer the channel holds an access grant for. The update surface is deliberately small - email changes go through the org's staff.
|
|
288
|
+
* @operationId updateSalesCustomer
|
|
289
|
+
*/
|
|
290
|
+
update: async (customerId, request) => {
|
|
291
|
+
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
292
|
+
method: 'PATCH',
|
|
293
|
+
body: JSON.stringify(request)
|
|
294
|
+
});
|
|
295
|
+
return response.customer;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Sales Presale Codes methods
|
|
300
|
+
*/
|
|
301
|
+
this.salesPresaleCodes = {
|
|
302
|
+
/**
|
|
303
|
+
* Redeem presale code
|
|
304
|
+
* A verified customer redeems a presale code for its benefit; gated pricing unlocks immediately. Requires a customer token.
|
|
305
|
+
* @operationId redeemSalesPresaleCode
|
|
306
|
+
*/
|
|
307
|
+
redeem: async (request) => {
|
|
308
|
+
const response = await this.request(`/sales/presale-codes/redeem`, {
|
|
309
|
+
method: 'POST',
|
|
310
|
+
body: JSON.stringify(request)
|
|
311
|
+
});
|
|
312
|
+
return response;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Sales methods
|
|
317
|
+
*/
|
|
318
|
+
this.sales = {
|
|
319
|
+
/**
|
|
320
|
+
* Resolve a channel by domain
|
|
321
|
+
* Public tenant resolution for hosted surfaces: maps a hostname (the channel's configured subdomain or custom domain) to its channel summary and publishable key. No authentication; rate-limited.
|
|
322
|
+
* @operationId resolveSalesChannel
|
|
323
|
+
*/
|
|
324
|
+
resolveChannel: async (options) => {
|
|
325
|
+
const params = new URLSearchParams();
|
|
326
|
+
if (options?.domain !== undefined)
|
|
327
|
+
params.append('domain', String(options.domain));
|
|
328
|
+
const queryString = params.toString();
|
|
329
|
+
const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;
|
|
330
|
+
const response = await this.request(requestPath, {
|
|
331
|
+
method: 'GET'
|
|
332
|
+
});
|
|
333
|
+
return response;
|
|
334
|
+
},
|
|
335
|
+
/**
|
|
336
|
+
* Get event catalogue detail
|
|
337
|
+
* Catalogue detail for an event listed on this channel: occurrences with their priced ticket-type offers. Benefit-gated types are included only when the request carries a customer token holding the benefit. Returns 404 if the event is not listed on this channel.
|
|
338
|
+
* @operationId getSalesEvent
|
|
339
|
+
*/
|
|
340
|
+
get: async (eventId) => {
|
|
341
|
+
const response = await this.request(`/sales/events/${eventId}`, {
|
|
342
|
+
method: 'GET'
|
|
343
|
+
});
|
|
344
|
+
return response.event;
|
|
345
|
+
},
|
|
346
|
+
/**
|
|
347
|
+
* Get channel theme
|
|
348
|
+
* The channel's resolved (inheritance-merged) theme for SSR injection. Returns 404 if the channel has neither its own theme nor an organisation base theme.
|
|
349
|
+
* @operationId getSalesTheme
|
|
350
|
+
*/
|
|
351
|
+
getTheme: async () => {
|
|
352
|
+
const response = await this.request(`/sales/theme`, {
|
|
353
|
+
method: 'GET'
|
|
354
|
+
});
|
|
355
|
+
return response.theme;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Session methods
|
|
360
|
+
*/
|
|
361
|
+
this.session = {
|
|
362
|
+
/**
|
|
363
|
+
* Bootstrap a Live session
|
|
364
|
+
* Resolves the channel and mints a session that holds the channel’s publishable key server-side. Hosted callers (channel resolved from the Host header or an explicit `domain`) receive an httpOnly cookie; embed callers (providing a `channelKey`) receive the session id in the body.
|
|
365
|
+
* @operationId createLiveSession
|
|
366
|
+
*/
|
|
367
|
+
start: async (request) => {
|
|
368
|
+
const response = await this.request(`/session`, {
|
|
369
|
+
method: 'POST',
|
|
370
|
+
body: JSON.stringify(request)
|
|
371
|
+
});
|
|
372
|
+
return response;
|
|
373
|
+
},
|
|
374
|
+
/**
|
|
375
|
+
* Get the current session
|
|
376
|
+
* Returns the current session’s customer and cart state.
|
|
377
|
+
* @operationId getLiveSession
|
|
378
|
+
*/
|
|
379
|
+
current: async () => {
|
|
380
|
+
const response = await this.request(`/session`, {
|
|
381
|
+
method: 'GET'
|
|
382
|
+
});
|
|
383
|
+
return response;
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* Destroy the current session
|
|
387
|
+
* Signs out and drops the current session.
|
|
388
|
+
* @operationId deleteLiveSession
|
|
389
|
+
*/
|
|
390
|
+
end: async () => {
|
|
391
|
+
const response = await this.request(`/session`, {
|
|
392
|
+
method: 'DELETE'
|
|
393
|
+
});
|
|
394
|
+
return response;
|
|
395
|
+
},
|
|
396
|
+
/**
|
|
397
|
+
* Attach an order access token to the session
|
|
398
|
+
* Proves possession of an order by reading it upstream with the emailed order access token, then holds the token in the session so `GET /sales/orders/{orderId}` (and ticket downloads) work without the browser keeping it. Creates the session on a cold open, exactly like `POST /session`.
|
|
399
|
+
* @operationId attachLiveOrderAccess
|
|
400
|
+
*/
|
|
401
|
+
attachOrderAccess: async (request) => {
|
|
402
|
+
const response = await this.request(`/session/order-access`, {
|
|
403
|
+
method: 'POST',
|
|
404
|
+
body: JSON.stringify(request)
|
|
405
|
+
});
|
|
406
|
+
return response;
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* Queue methods
|
|
411
|
+
*/
|
|
412
|
+
this.queue = {
|
|
413
|
+
/**
|
|
414
|
+
* Get waiting-room status
|
|
415
|
+
* Returns the waiting-room status for the current session. The waiting room lives only in Live; when disabled the queue is transparent and every session is admitted.
|
|
416
|
+
* @operationId getLiveQueueStatus
|
|
417
|
+
*/
|
|
418
|
+
status: async () => {
|
|
419
|
+
const response = await this.request(`/queue/status`, {
|
|
420
|
+
method: 'GET'
|
|
421
|
+
});
|
|
422
|
+
return response;
|
|
423
|
+
},
|
|
424
|
+
/**
|
|
425
|
+
* Join the waiting room
|
|
426
|
+
* Joins the current session to the waiting room. While the queue is disabled this is a no-op that reports immediate admission.
|
|
427
|
+
* @operationId joinLiveQueue
|
|
428
|
+
*/
|
|
429
|
+
join: async () => {
|
|
430
|
+
const response = await this.request(`/queue/join`, {
|
|
431
|
+
method: 'POST'
|
|
432
|
+
});
|
|
433
|
+
return response;
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
437
|
+
this.sessionMode = config.sessionMode ?? 'cookie';
|
|
438
|
+
this.publishableKey = config.publishableKey;
|
|
439
|
+
this.tokenStorage = config.tokenStorage ?? memoryTokenStorage();
|
|
440
|
+
this.apiVersion = config.apiVersion ?? API_DATED_VERSION;
|
|
441
|
+
this.headers = config.headers ?? {};
|
|
442
|
+
}
|
|
443
|
+
/** Store the Live session id (token mode). Called after POST /session. */
|
|
444
|
+
async setSessionToken(token) {
|
|
445
|
+
await this.tokenStorage.set(token);
|
|
446
|
+
}
|
|
447
|
+
/** The current session token (token mode), if any - used for embed handoff. */
|
|
448
|
+
async getSessionToken() {
|
|
449
|
+
return this.tokenStorage.get();
|
|
450
|
+
}
|
|
451
|
+
async clearSession() {
|
|
452
|
+
await this.tokenStorage.clear();
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Make a request to the Live deployment. Live serves at the root (no /v1
|
|
456
|
+
* prefix). Injects the publishable key + session header + TL-Version, and
|
|
457
|
+
* unwraps the JSend envelope.
|
|
458
|
+
*/
|
|
459
|
+
async request(path, options = {}) {
|
|
460
|
+
const url = `${this.baseUrl}${path}`;
|
|
461
|
+
const headers = {
|
|
462
|
+
'Content-Type': 'application/json',
|
|
463
|
+
'TL-Version': this.apiVersion,
|
|
464
|
+
'TL-Client': SDK_CLIENT_HEADER,
|
|
465
|
+
...this.headers,
|
|
466
|
+
...options.headers,
|
|
467
|
+
};
|
|
468
|
+
if (this.publishableKey) {
|
|
469
|
+
headers['Authorization'] = `Bearer ${this.publishableKey}`;
|
|
470
|
+
}
|
|
471
|
+
if (this.sessionMode === 'token') {
|
|
472
|
+
const token = await this.tokenStorage.get();
|
|
473
|
+
if (token)
|
|
474
|
+
headers['X-Live-Session'] = token;
|
|
475
|
+
}
|
|
476
|
+
const response = await fetch(url, {
|
|
477
|
+
...options,
|
|
478
|
+
headers,
|
|
479
|
+
// Hosted web relies on the session cookie travelling with the request
|
|
480
|
+
credentials: this.sessionMode === 'cookie' ? 'include' : 'same-origin',
|
|
481
|
+
});
|
|
482
|
+
const text = await response.text();
|
|
483
|
+
const json = text ? JSON.parse(text) : null;
|
|
484
|
+
if (!response.ok) {
|
|
485
|
+
const error = json?.error ?? {};
|
|
486
|
+
throw new LiveAPIError(error.message ?? `Request failed (${response.status})`, error.code ?? 'REQUEST_FAILED', response.status);
|
|
487
|
+
}
|
|
488
|
+
// Unwrap JSend: { status, data, metadata } → data
|
|
489
|
+
if (json && json.status === 'success' && json.data !== undefined) {
|
|
490
|
+
return json.data;
|
|
491
|
+
}
|
|
492
|
+
return json;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmBrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE9C,mFAAmF;AACnF,SAAS,eAAe;IACtB,MAAM,CAAC,GAAG,UAAiC,CAAC;IAC5C,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,KAAK,aAAa;QAAE,OAAO,cAAc,CAAC;IAClE,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IAC3F,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI;QAAE,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxE,IAAI,CAAC,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,WAAW,KAAK,eAAe,EAAE,GAAG,CAAC;AASzH,+CAA+C;AAC/C,MAA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,EAAE,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;SACvE,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YAChC,MAAM,IAAI,YAAY,CACpB,KAAK,CAAC,OAAO,IAAI,mBAAmB,QAAQ,CAAC,MAAM,GAAG,EACtD,KAAK,CAAC,IAAI,IAAI,gBAAgB,EAC9B,QAAQ,CAAC,MAAM,CAChB,CAAC;QACJ,CAAC;QAED,kDAAkD;QAClD,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC,IAAS,CAAC;QACxB,CAAC;QACD,OAAO,IAAS,CAAC;IACnB,CAAC;CAkbF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientHeader.d.ts","sourceRoot":"","sources":["../src/clientHeader.ts"],"names":[],"mappings":"AAWA,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,MAAM,CAOxC;AAED,eAAO,MAAM,iBAAiB,QAA0F,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TL-Client request header: `ticketlayer-live/<version> (<runtime>)`.
|
|
3
|
+
*
|
|
4
|
+
* Lets the API attribute traffic to an SDK build. The version comes from
|
|
5
|
+
* src/version.ts, written from package.json by the prebuild script, so it is
|
|
6
|
+
* always the version npm published. Hand-written; the generated client
|
|
7
|
+
* (src/client.ts) gains an equivalent on its next regeneration from
|
|
8
|
+
* backstage-sdk-tooling's live-client template.
|
|
9
|
+
*/
|
|
10
|
+
import { SDK_NAME, SDK_VERSION } from './version.js';
|
|
11
|
+
/** Best-effort description of the JavaScript runtime. */
|
|
12
|
+
export function describeRuntime() {
|
|
13
|
+
const g = globalThis;
|
|
14
|
+
if (g.navigator?.product === 'ReactNative')
|
|
15
|
+
return 'react-native';
|
|
16
|
+
if (typeof g.window !== 'undefined' && typeof g.document !== 'undefined')
|
|
17
|
+
return 'browser';
|
|
18
|
+
if (g.process?.versions?.node)
|
|
19
|
+
return `node/${g.process.versions.node}`;
|
|
20
|
+
if (g.EdgeRuntime)
|
|
21
|
+
return 'edge';
|
|
22
|
+
return 'unknown';
|
|
23
|
+
}
|
|
24
|
+
export const SDK_CLIENT_HEADER = `${SDK_NAME.replace(/^@/, '').replace('/', '-')}/${SDK_VERSION} (${describeRuntime()})`;
|
|
25
|
+
//# sourceMappingURL=clientHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientHeader.js","sourceRoot":"","sources":["../src/clientHeader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAErD,yDAAyD;AACzD,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,GAAG,UAAiC,CAAC;IAC5C,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,KAAK,aAAa;QAAE,OAAO,cAAc,CAAC;IAClE,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IAC3F,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI;QAAE,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxE,IAAI,CAAC,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,WAAW,KAAK,eAAe,EAAE,GAAG,CAAC"}
|