@ticketlayer/live 0.2.0 → 0.3.2

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 CHANGED
@@ -8,11 +8,8 @@ the server (`@ticketlayer/live/server`).
8
8
  npm install @ticketlayer/live
9
9
  ```
10
10
 
11
- Not on npm yet: the package is built and versioned here but the first
12
- release waits on the `NPM_TOKEN` secret (see "Releasing"). Until then our
13
- apps use a `file:` link to this repository, and third-party pages load the
14
- CDN build. The vault page `architecture/sdk-architecture.md` lists what is
15
- on npm.
11
+ Third-party pages load the same client from the CDN build instead. The
12
+ vault page `architecture/sdk-architecture.md` lists what is on npm.
16
13
 
17
14
  ## Browser
18
15
 
@@ -28,7 +25,7 @@ const tl = await createLiveClient({
28
25
 
29
26
  The CDN build (`dist/ticketlayer.js`, served at `/v1/ticketlayer.js`) boots
30
27
  itself from `data-*` attributes on its script tag; see `src/auto.ts` and
31
- `live-elements/cdn/README.md`. `CLAUDE.md` is the working agreement.
28
+ `cdn/README.md` at the repository root. `CLAUDE.md` is the working agreement.
32
29
 
33
30
  ## React Native
34
31
 
@@ -179,19 +176,21 @@ overrides), so framework-specific fetch options pass straight through.
179
176
 
180
177
  ## Scripts
181
178
 
179
+ From the repository root, after `pnpm install`:
180
+
182
181
  ```bash
183
- npm run build # tsc -> dist/ (index.js, server.js, native/, types)
184
- npm run build:cdn # + esbuild IIFE -> dist/ticketlayer.js
185
- npm test # builds, then node --test test/*.test.mjs
186
- npm run docs:gen # typedoc -> docs-output/
182
+ pnpm --filter @ticketlayer/live build # tsc -> dist/ (index.js, server.js, native/, types)
183
+ pnpm --filter @ticketlayer/live build:cdn # + esbuild IIFE -> dist/ticketlayer.js
184
+ pnpm --filter @ticketlayer/live test # builds, then node --test test/*.test.mjs
185
+ pnpm --filter @ticketlayer/live docs:gen # typedoc -> docs-output/
187
186
  ```
188
187
 
189
188
  ## Releasing
190
189
 
191
- Versioning and publishing are driven by [changesets](.changeset/README.md):
192
- add a changeset with your change, and on merge to `main` the release workflow
193
- keeps a "Release @ticketlayer/live" pull request up to date; merging that
194
- publishes to npm with provenance. `src/client.ts` and `src/generated/` are
190
+ Versioning and publishing are driven by [changesets](../../.changeset/README.md)
191
+ for the whole workspace: add a changeset with your change, and on merge to
192
+ `main` the release workflow keeps a "Release Ticketlayer Live" pull request
193
+ up to date; merging that publishes to npm with provenance. `src/client.ts` and `src/generated/` are
195
194
  generated by `backstage-sdk-tooling` (regeneration PRs arrive automatically
196
195
  when backstage-api publishes a contract) and are shipped exactly as committed.
197
196
  The `ticketlayer` block in `package.json` records the spec version, dated API
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * GENERATED FILE - do not edit by hand.
3
3
  * @ticketlayer/live client generated from the backstage sales surface
4
4
  * (spec 1.0.0) + live-api (0.1.0)
5
- * by backstage-sdk-tooling 0.1.0 on 2026-09-15T01:37:36.041Z.
5
+ * by backstage-sdk-tooling 0.1.0 on 2026-09-15T10:18:42.096Z.
6
6
  * Regenerate with `tt sdk live`.
7
7
  */
8
8
  import type { components } from './generated/types';
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutModal.d.ts","sourceRoot":"","sources":["../../src/state/checkoutModal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA2CD,gEAAgE;AAChE,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,eAAe,EACnB,IAAI,GAAE,oBAAyB,GAC9B,MAAM,IAAI,CAqHZ"}
1
+ {"version":3,"file":"checkoutModal.d.ts","sourceRoot":"","sources":["../../src/state/checkoutModal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAyBD,gEAAgE;AAChE,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,eAAe,EACnB,IAAI,GAAE,oBAAyB,GAC9B,MAAM,IAAI,CAoHZ"}
@@ -1,17 +1,4 @@
1
1
  const OVERLAY_ID = 'tl-checkout-overlay';
2
- const PRIVACY_URL = 'https://ticketlayer.com/privacy';
3
- const REPORT_URL = 'https://ticketlayer.com/report-abuse';
4
- const SITE_URL = 'https://ticketlayer.com';
5
- /** Floating-chrome markup: platform links (left) + Powered by Ticketlayer (right). */
6
- function footerHtml() {
7
- const logo = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="display:block;">' +
8
- '<path d="M4 7.5A1.5 1.5 0 0 1 5.5 6h13A1.5 1.5 0 0 1 20 7.5v2a2 2 0 0 0 0 5v2a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 16.5v-2a2 2 0 0 0 0-5v-2Z" fill="currentColor"/>' +
9
- '<path d="M13 7v10" stroke="rgba(255,255,255,0.5)" stroke-width="1.2" stroke-dasharray="1.5 1.8" stroke-linecap="round"/></svg>';
10
- const link = (href, label) => `<a href="${href}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none;opacity:0.85;">${label}</a>`;
11
- return (`<div style="display:flex;gap:16px;align-items:center;">${link(PRIVACY_URL, 'Privacy Policy')}${link(REPORT_URL, 'Report Abuse')}</div>` +
12
- `<a href="${SITE_URL}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:6px;opacity:0.92;">` +
13
- `<span style="opacity:0.7;">Powered by</span>${logo}<span style="font-weight:700;letter-spacing:0.01em;">Ticketlayer</span></a>`);
14
- }
15
2
  /** Wire the modal to the bus; returns an uninstall function. */
16
3
  export function installCheckoutModal(tl, opts = {}) {
17
4
  if (typeof window === 'undefined' || typeof document === 'undefined')
@@ -56,15 +43,15 @@ export function installCheckoutModal(tl, opts = {}) {
56
43
  frame.style.cssText =
57
44
  'width:100%;height:88vh;max-height:760px;border:1px solid var(--tl-border,#e5e7eb);' +
58
45
  'border-radius:16px;background:#fff;box-shadow:0 24px 64px rgba(0,0,0,0.45);';
59
- // Floating chrome: platform links far-left, "Powered by Ticketlayer" far-right.
60
- const footer = document.createElement('div');
61
- footer.style.cssText =
62
- 'display:flex;align-items:center;justify-content:space-between;gap:12px;' +
63
- 'padding:0 8px;font:500 12px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;' +
64
- 'color:rgba(255,255,255,0.78);';
65
- footer.innerHTML = footerHtml();
46
+ // No chrome of our own around the iframe.
47
+ //
48
+ // The overlay is a transport: an iframe onto the hosted checkout plus the
49
+ // postMessage bridge. It used to draw a "Powered by Ticketlayer" footer
50
+ // beneath the frame, which put attribution at the wrong layer - duplicated
51
+ // by the page inside, and absent for anyone who opens /embed/checkout
52
+ // directly rather than through this overlay. The checkout page renders it
53
+ // now, where the buyer actually is.
66
54
  wrapper.appendChild(frame);
67
- wrapper.appendChild(footer);
68
55
  overlay.appendChild(wrapper);
69
56
  overlay.addEventListener('click', (e) => {
70
57
  if (e.target === overlay || e.target === wrapper) {
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutModal.js","sourceRoot":"","sources":["../../src/state/checkoutModal.ts"],"names":[],"mappings":"AA6CA,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAEzC,MAAM,WAAW,GAAG,iCAAiC,CAAC;AACtD,MAAM,UAAU,GAAG,sCAAsC,CAAC;AAC1D,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAE3C,sFAAsF;AACtF,SAAS,UAAU;IACjB,MAAM,IAAI,GACR,wGAAwG;QACxG,0KAA0K;QAC1K,gIAAgI,CAAC;IACnI,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAC3C,YAAY,IAAI,w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BACtB,MAAM;gBACR,CAAC;gBACD,0EAA0E;YAC5E,CAAC;QACH,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAE,CAAoB,IAAI,EAAE,CAAC,CAAC,CAAC;IAClG,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAElE,OAAO,GAAG,EAAE;QACV,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,CAAC;IACV,CAAC,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
- "use strict";var TicketlayerLive=(()=>{var C=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var X=(s,t)=>{for(var a in t)C(s,a,{get:t[a],enumerable:!0})},Z=(s,t,a,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z(t))!H.call(s,o)&&o!==a&&C(s,o,{get:()=>t[o],enumerable:!(e=Y(t,o))||e.enumerable});return s};var Q=s=>Z(C({},"__esModule",{value:!0}),s);var me={};X(me,{TicketlayerLive:()=>S,boot:()=>j,createLiveClient:()=>O});var A="@ticketlayer/live",R="0.2.0";var I="2026-06-13";function W(){var t,a,e;let s=globalThis;return((t=s.navigator)==null?void 0:t.product)==="ReactNative"?"react-native":typeof s.window!="undefined"&&typeof s.document!="undefined"?"browser":(e=(a=s.process)==null?void 0:a.versions)!=null&&e.node?`node/${s.process.versions.node}`:s.EdgeRuntime?"edge":"unknown"}var ee=`${A.replace(/^@/,"").replace("/","-")}/${R} (${W()})`;function te(){let s=null;return{get:()=>s,set:t=>{s=t},clear:()=>{s=null}}}var b=class extends Error{constructor(t,a,e){super(t),this.code=a,this.status=e,this.name="LiveAPIError"}},v=class{constructor(t){var a,e,o,l;this.salesListings={list:async()=>await this.request("/sales/listings",{method:"GET"})},this.salesCustomerAuth={magicLink:async r=>(await this.request("/sales/customer-auth/magic-link",{method:"POST",body:JSON.stringify(r)})).sent},this.salesCustomerTokens={create:async r=>await this.request("/sales/customer-tokens",{method:"POST",body:JSON.stringify(r)}),refresh:async()=>await this.request("/sales/customer-tokens/refresh",{method:"POST"})},this.salesCarts={create:async r=>(await this.request("/sales/carts",{method:"POST",body:JSON.stringify(r)})).cart,get:async r=>(await this.request(`/sales/carts/${r}`,{method:"GET"})).cart,addItem:async(r,i)=>(await this.request(`/sales/carts/${r}/items`,{method:"POST",body:JSON.stringify(i)})).cart,removeItem:async(r,i)=>(await this.request(`/sales/carts/${r}/items/${i}`,{method:"DELETE"})).cart,checkout:async(r,i)=>await this.request(`/sales/carts/${r}/checkout`,{method:"POST",body:JSON.stringify(i)})},this.salesMyOrders={list:async()=>(await this.request("/sales/my-orders",{method:"GET"})).orders},this.salesOrders={get:async r=>(await this.request(`/sales/orders/${r}`,{method:"GET"})).order,ticketPdf:async(r,i)=>await this.request(`/sales/orders/${r}/passes/${i}/ticket.pdf`,{method:"GET"})},this.salesOrderPayments={create:async(r,i)=>(await this.request(`/sales/orders/${r}/payments`,{method:"POST",body:JSON.stringify(i)})).payment},this.salesRefundRequests={create:async(r,i)=>(await this.request(`/sales/orders/${r}/refund-requests`,{method:"POST",body:JSON.stringify(i)})).request},this.salesCustomers={create:async r=>(await this.request("/sales/customers",{method:"POST",body:JSON.stringify(r)})).customer,get:async r=>(await this.request(`/sales/customers/${r}`,{method:"GET"})).customer,update:async(r,i)=>(await this.request(`/sales/customers/${r}`,{method:"PATCH",body:JSON.stringify(i)})).customer},this.salesPresaleCodes={redeem:async r=>await this.request("/sales/presale-codes/redeem",{method:"POST",body:JSON.stringify(r)})},this.sales={resolveChannel:async r=>{let i=new URLSearchParams;(r==null?void 0:r.domain)!==void 0&&i.append("domain",String(r.domain));let n=i.toString(),c=n?`/sales/channel?${n}`:"/sales/channel";return await this.request(c,{method:"GET"})},get:async r=>(await this.request(`/sales/events/${r}`,{method:"GET"})).event,getTheme:async()=>(await this.request("/sales/theme",{method:"GET"})).theme},this.session={start:async r=>await this.request("/session",{method:"POST",body:JSON.stringify(r)}),current:async()=>await this.request("/session",{method:"GET"}),end:async()=>await this.request("/session",{method:"DELETE"}),attachOrderAccess:async r=>await this.request("/session/order-access",{method:"POST",body:JSON.stringify(r)})},this.queue={status:async()=>await this.request("/queue/status",{method:"GET"}),join:async()=>await this.request("/queue/join",{method:"POST"})},this.baseUrl=t.baseUrl.replace(/\/$/,""),this.sessionMode=(a=t.sessionMode)!=null?a:"cookie",this.publishableKey=t.publishableKey,this.tokenStorage=(e=t.tokenStorage)!=null?e:te(),this.apiVersion=(o=t.apiVersion)!=null?o:I,this.headers=(l=t.headers)!=null?l:{}}async setSessionToken(t){await this.tokenStorage.set(t)}async getSessionToken(){return this.tokenStorage.get()}async clearSession(){await this.tokenStorage.clear()}async request(t,a={}){var n,c,d;let e=`${this.baseUrl}${t}`,o={"Content-Type":"application/json","TL-Version":this.apiVersion,"TL-Client":ee,...this.headers,...a.headers};if(this.publishableKey&&(o.Authorization=`Bearer ${this.publishableKey}`),this.sessionMode==="token"){let u=await this.tokenStorage.get();u&&(o["X-Live-Session"]=u)}let l=await fetch(e,{...a,headers:o,credentials:this.sessionMode==="cookie"?"include":"same-origin"}),r=await l.text(),i=r?JSON.parse(r):null;if(!l.ok){let u=(n=i==null?void 0:i.error)!=null?n:{};throw new b((c=u.message)!=null?c:`Request failed (${l.status})`,(d=u.code)!=null?d:"REQUEST_FAILED",l.status)}return i&&i.status==="success"&&i.data!==void 0?i.data:i}};var x="Ticketlayer",se="ticketlayer:ready";function re(s){let t=window;if(t[x])return t[x];let a={client:null,sdk:null,version:s,_resolvers:[],getClient(){return this.client},getSDK(){return this.sdk},ready(){return this.client?Promise.resolve(this.client):new Promise(e=>this._resolvers.push(e))}};return t[x]=a,a}function U(s,t,a){if(typeof window=="undefined")return;let e=re(a);e.client&&e.client!==s&&console.warn("[live] A Ticketlayer client is already on window.Ticketlayer; replacing it. Create a single client per page."),e.client=s,e.sdk=t;let o=e._resolvers;e._resolvers=[],o.forEach(l=>l(s)),window.dispatchEvent(new CustomEvent(se,{detail:s}))}var ne="https://cdn.ticketlayer.com/elements/v1/ticketlayer-elements/ticketlayer-elements.esm.js",oe="tl-event-list",N=new Map;function K(s={}){var l;if(!s.elements||typeof window=="undefined"||typeof document=="undefined")return Promise.resolve();let t=window.customElements;if(t!=null&&t.get(oe))return Promise.resolve();let a=(l=s.elementsUrl)!=null?l:ne,e=N.get(a);if(e)return e;let o=new Promise((r,i)=>{let n=document.createElement("script");n.type="module",n.src=a,n.async=!0,n.dataset.ticketlayerElements="auto",n.onload=()=>r(),n.onerror=()=>i(new Error(`[live] Failed to load Elements from ${a}`)),document.head.appendChild(n)});return N.set(a,o),o}var D="tl-checkout-overlay",ae="https://ticketlayer.com/privacy",ie="https://ticketlayer.com/report-abuse",ce="https://ticketlayer.com";function le(){let s='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="display:block;"><path d="M4 7.5A1.5 1.5 0 0 1 5.5 6h13A1.5 1.5 0 0 1 20 7.5v2a2 2 0 0 0 0 5v2a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 16.5v-2a2 2 0 0 0 0-5v-2Z" fill="currentColor"/><path d="M13 7v10" stroke="rgba(255,255,255,0.5)" stroke-width="1.2" stroke-dasharray="1.5 1.8" stroke-linecap="round"/></svg>',t=(a,e)=>`<a href="${a}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none;opacity:0.85;">${e}</a>`;return`<div style="display:flex;gap:16px;align-items:center;">${t(ae,"Privacy Policy")}${t(ie,"Report Abuse")}</div><a href="${ce}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:6px;opacity:0.92;"><span style="opacity:0.7;">Powered by</span>${s}<span style="font-weight:700;letter-spacing:0.01em;">Ticketlayer</span></a>`}function G(s,t={}){if(typeof window=="undefined"||typeof document=="undefined")return()=>{};let a=null,e=()=>{var i;(i=document.getElementById(D))==null||i.remove(),a&&(window.removeEventListener("message",a),a=null)},o=async i=>{let n=await s.getSessionToken().catch(()=>null),c=(t.embedBaseUrl||window.location.origin).replace(/\/$/,""),d=new URLSearchParams;n&&d.set("session",n),d.set("parent_origin",window.location.origin);let u=`${c}/embed/checkout?${d.toString()}`,h=new URL(u).origin;e();let f=document.createElement("div");f.id=D,f.style.cssText="position:fixed;inset:0;z-index:2147483647;background:rgba(15,23,42,0.55);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;";let p=document.createElement("div");p.style.cssText="width:100%;max-width:960px;display:flex;flex-direction:column;gap:10px;";let w=document.createElement("iframe");w.src=u,w.allow="payment",w.style.cssText="width:100%;height:88vh;max-height:760px;border:1px solid var(--tl-border,#e5e7eb);border-radius:16px;background:#fff;box-shadow:0 24px 64px rgba(0,0,0,0.45);";let k=document.createElement("div");k.style.cssText='display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 8px;font:500 12px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:rgba(255,255,255,0.78);',k.innerHTML=le(),p.appendChild(w),p.appendChild(k),f.appendChild(p),f.addEventListener("click",y=>{var m;(y.target===f||y.target===p)&&(e(),(m=i.onClose)==null||m.call(i))}),document.body.appendChild(f),a=y=>{var P,M,$;if(y.origin!==h)return;let m=y.data;if(!(!m||typeof m!="object"))switch(m.type){case"tl:complete":{let E=m.order&&typeof m.order=="object"?m.order:{},L=m.orderId?{...E,id:m.orderId,orderNumber:m.orderReference,...m.accessToken?{accessToken:m.accessToken}:{}}:m.order;(P=i.onComplete)==null||P.call(i,L),s.emit("checkout:completed",L),e();break}case"tl:close":case"tl:cancel":(M=i.onClose)==null||M.call(i),e();break;case"tl:error":{let E=new Error(m.message||m.code||"Checkout failed");m.code&&(E.code=m.code),($=i.onError)==null||$.call(i,E);break}}},window.addEventListener("message",a)},l=s.on("ui:checkout-requested",i=>void o(i!=null?i:{})),r=s.on("ui:modal-close-requested",()=>e());return()=>{l(),r(),e()}}function B(s,t={}){if(typeof window=="undefined"||typeof document=="undefined")return()=>{};let a=t.tag||"tl-buy-modal",e=null,o=null,l=()=>{e&&(e.remove(),e=null),o=null},r=c=>{if(!(c!=null&&c.eventId))return;l(),o=c;let d=document.createElement(a);d.setAttribute("event-id",c.eventId),c.occurrenceId&&d.setAttribute("occurrence-id",c.occurrenceId),d.addEventListener("tlClose",()=>{var h;let u=o;l(),(h=u==null?void 0:u.onClose)==null||h.call(u)}),d.addEventListener("tlError",u=>{var f,p;let h=((f=u.detail)==null?void 0:f.message)||"Could not load this event";(p=o==null?void 0:o.onError)==null||p.call(o,new Error(h))}),d.addEventListener("tlCheckout",()=>{let u=o;l(),s.emit("ui:checkout-requested",{onComplete:u==null?void 0:u.onComplete,onError:u==null?void 0:u.onError,onClose:u==null?void 0:u.onClose})}),document.body.appendChild(d),e=d},i=s.on("ui:event-modal-requested",c=>r(c!=null?c:{})),n=s.on("ui:modal-close-requested",()=>l());return()=>{i(),n(),l()}}var _=s=>{var l,r,i,n,c;if(!s||typeof s!="object")return s;let t=s,a=((l=t.items)!=null?l:[]).map(d=>{var p,w,k;let u=d,h=(p=u.quantity)!=null?p:0,f=(w=u.subtotal)!=null?w:u.unitPrice*h;return{...u,totalPrice:(k=u.totalPrice)!=null?k:f}}),e=a.reduce((d,u)=>{var h;return d+((h=u.quantity)!=null?h:0)},0),o=(i=(r=t.itemsSubtotal)!=null?r:t.subtotal)!=null?i:0;return{...t,items:a,itemCount:e,subtotal:o,fees:(n=t.fees)!=null?n:0,total:(c=t.total)!=null?c:o}};function J(s){let t=new Map,a=(n,c)=>{let d=t.get(n);if(!(d!=null&&d.categoryId))throw new Error(`[live] No category known for ticket type ${n}. Load the occurrence's ticket types (getTicketTypes) before adding it to the cart.`);return{categoryId:d.categoryId,occurrenceId:c||d.occurrenceId}},e={async list(n){var u;let c=await s.events.list(),d=((u=c==null?void 0:c.listings)!=null?u:[]).map(h=>{var f,p,w;return{id:(f=h.eventId)!=null?f:h.id,name:(p=h.name)!=null?p:"",...h.shortDescription?{shortDescription:h.shortDescription}:{},...h.imageUrl?{imageUrl:h.imageUrl}:{},...h.venueName?{venue:{id:"",name:h.venueName,city:(w=h.venueCity)!=null?w:""}}:{},...h.nextOccurrenceAt?{nextOccurrence:{startsAt:h.nextOccurrenceAt}}:{},availabilityStatus:"available"}});return n!=null&&n.limit&&(d=d.slice(0,n.limit)),{items:d}},get:n=>s.events.get(n),async getTicketTypes(n,c){var f,p,w,k;let d=await s.events.get(n),u=(w=(f=d==null?void 0:d.occurrences)==null?void 0:f.find(y=>y.id===c))!=null?w:(p=d==null?void 0:d.occurrences)==null?void 0:p[0];return((k=u==null?void 0:u.ticketTypes)!=null?k:[]).map(y=>(u&&t.set(y.ticketTypeId,{categoryId:y.categoryId,occurrenceId:u.id}),{id:y.ticketTypeId,name:y.ticketTypeName,description:y.description,price:y.unitPrice,currency:y.currency,categoryId:y.categoryId,categoryName:y.categoryName,maxPerOrder:10,available:999}))}},o={get:async()=>{var n;return _((n=s.cart.current)!=null?n:await s.cart.refresh())},on:(n,c)=>s.on(n,d=>c(n==="cart:updated"?_(d):d)),off:(n,c)=>s.off(n,c),addItem:async(n,c,d)=>{let{categoryId:u,occurrenceId:h}=a(n,d);return _(await s.cart.add({eventOccurrenceId:h,categoryId:u,ticketTypeId:n,quantity:c}))},addItems:async n=>{let c=s.cart.current;for(let d of n)c=await o.addItem(d.ticketTypeId,d.quantity,d.occurrenceId);return c},removeItem:async n=>_(await s.cart.remove(n)),addSeat:async(n,c,d)=>{let{categoryId:u,occurrenceId:h}=a(c,d);return _(await s.cart.add({eventOccurrenceId:h,categoryId:u,ticketTypeId:c,eventLayoutSeatIds:[n]}))},removeSeat:async(n,c)=>{var d;return console.warn("[live] removeSeat is a no-op until cart items expose seat ids; use removeItem(itemId)."),_((d=await s.cart.refresh())!=null?d:s.cart.current)}},l={mine:()=>s.orders.mine(),get:n=>s.orders.get(n),ticketPdf:(n,c)=>s.orders.ticketPdf(n,c)},r={get customer(){return s.auth.customer},get authenticated(){return s.auth.authenticated},requestMagicLink:n=>s.auth.requestMagicLink(n),exchange:n=>s.auth.exchange(n),logout:()=>s.auth.logout()},i={redeem:n=>s.presale.redeem(n)};return{getEventsManager:()=>e,getCartManager:()=>o,getOrdersManager:()=>l,getAuthManager:()=>r,getPresaleManager:()=>i,on:(n,c)=>s.on(n,c),off:(n,c)=>s.off(n,c),event:n=>({openModal:(c={})=>s.emit("ui:event-modal-requested",{eventId:n,...c})}),checkout:{openModal:(n={})=>s.emit("ui:checkout-requested",n),closeModal:()=>s.emit("ui:modal-close-requested")},closeModal:()=>s.emit("ui:modal-close-requested")}}var T=class{constructor(){this.handlers=new Map}on(t,a){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(a),()=>this.off(t,a)}off(t,a){var e;(e=this.handlers.get(t))==null||e.delete(a)}emit(t,a){var e;(e=this.handlers.get(t))==null||e.forEach(o=>{try{o(a)}catch(l){console.error(`[live] handler for ${t} threw`,l)}})}};var V="tl-theme-vars",q=s=>s.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),de={fontFamily:"font-family",fontFamilyMono:"font-family-mono",baseSize:"font-size-base",scaleRatio:"font-scale"};function F(s){var o,l,r,i;if(!s||typeof document=="undefined")return;let t=[],a=(n,c)=>{c!=null&&t.push(`--tl-${n}: ${String(c)};`)};for(let[n,c]of Object.entries((o=s.colors)!=null?o:{})){let d=q(n);a(d,c),a(`color-${d}`,c),n==="destructive"&&(a("error",c),a("color-error",c)),n==="destructiveForeground"&&(a("error-foreground",c),a("color-error-foreground",c))}for(let[n,c]of Object.entries((l=s.typography)!=null?l:{}))a((r=de[n])!=null?r:q(n),c);for(let[n,c]of Object.entries((i=s.shape)!=null?i:{}))a(q(n),c);let e=document.getElementById(V);e||(e=document.createElement("style"),e.id=V,document.head.appendChild(e)),e.textContent=`:root {
1
+ "use strict";var TicketlayerLive=(()=>{var v=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var X=(s,t)=>{for(var a in t)v(s,a,{get:t[a],enumerable:!0})},H=(s,t,a,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Y(t))!z.call(s,o)&&o!==a&&v(s,o,{get:()=>t[o],enumerable:!(e=j(t,o))||e.enumerable});return s};var Q=s=>H(v({},"__esModule",{value:!0}),s);var ce={};X(ce,{TicketlayerLive:()=>_,boot:()=>V,createLiveClient:()=>q});var $="@ticketlayer/live",A="0.3.2";var C="2026-06-13";function Z(){var t,a,e;let s=globalThis;return((t=s.navigator)==null?void 0:t.product)==="ReactNative"?"react-native":typeof s.window!="undefined"&&typeof s.document!="undefined"?"browser":(e=(a=s.process)==null?void 0:a.versions)!=null&&e.node?`node/${s.process.versions.node}`:s.EdgeRuntime?"edge":"unknown"}var W=`${$.replace(/^@/,"").replace("/","-")}/${A} (${Z()})`;function ee(){let s=null;return{get:()=>s,set:t=>{s=t},clear:()=>{s=null}}}var k=class extends Error{constructor(t,a,e){super(t),this.code=a,this.status=e,this.name="LiveAPIError"}},E=class{constructor(t){var a,e,o,l;this.salesListings={list:async()=>await this.request("/sales/listings",{method:"GET"})},this.salesCustomerAuth={magicLink:async r=>(await this.request("/sales/customer-auth/magic-link",{method:"POST",body:JSON.stringify(r)})).sent},this.salesCustomerTokens={create:async r=>await this.request("/sales/customer-tokens",{method:"POST",body:JSON.stringify(r)}),refresh:async()=>await this.request("/sales/customer-tokens/refresh",{method:"POST"})},this.salesCarts={create:async r=>(await this.request("/sales/carts",{method:"POST",body:JSON.stringify(r)})).cart,get:async r=>(await this.request(`/sales/carts/${r}`,{method:"GET"})).cart,addItem:async(r,i)=>(await this.request(`/sales/carts/${r}/items`,{method:"POST",body:JSON.stringify(i)})).cart,removeItem:async(r,i)=>(await this.request(`/sales/carts/${r}/items/${i}`,{method:"DELETE"})).cart,checkout:async(r,i)=>await this.request(`/sales/carts/${r}/checkout`,{method:"POST",body:JSON.stringify(i)})},this.salesMyOrders={list:async()=>(await this.request("/sales/my-orders",{method:"GET"})).orders},this.salesOrders={get:async r=>(await this.request(`/sales/orders/${r}`,{method:"GET"})).order,ticketPdf:async(r,i)=>await this.request(`/sales/orders/${r}/passes/${i}/ticket.pdf`,{method:"GET"})},this.salesOrderPayments={create:async(r,i)=>(await this.request(`/sales/orders/${r}/payments`,{method:"POST",body:JSON.stringify(i)})).payment},this.salesRefundRequests={create:async(r,i)=>(await this.request(`/sales/orders/${r}/refund-requests`,{method:"POST",body:JSON.stringify(i)})).request},this.salesCustomers={create:async r=>(await this.request("/sales/customers",{method:"POST",body:JSON.stringify(r)})).customer,get:async r=>(await this.request(`/sales/customers/${r}`,{method:"GET"})).customer,update:async(r,i)=>(await this.request(`/sales/customers/${r}`,{method:"PATCH",body:JSON.stringify(i)})).customer},this.salesPresaleCodes={redeem:async r=>await this.request("/sales/presale-codes/redeem",{method:"POST",body:JSON.stringify(r)})},this.sales={resolveChannel:async r=>{let i=new URLSearchParams;(r==null?void 0:r.domain)!==void 0&&i.append("domain",String(r.domain));let n=i.toString(),c=n?`/sales/channel?${n}`:"/sales/channel";return await this.request(c,{method:"GET"})},get:async r=>(await this.request(`/sales/events/${r}`,{method:"GET"})).event,getTheme:async()=>(await this.request("/sales/theme",{method:"GET"})).theme},this.session={start:async r=>await this.request("/session",{method:"POST",body:JSON.stringify(r)}),current:async()=>await this.request("/session",{method:"GET"}),end:async()=>await this.request("/session",{method:"DELETE"}),attachOrderAccess:async r=>await this.request("/session/order-access",{method:"POST",body:JSON.stringify(r)})},this.queue={status:async()=>await this.request("/queue/status",{method:"GET"}),join:async()=>await this.request("/queue/join",{method:"POST"})},this.baseUrl=t.baseUrl.replace(/\/$/,""),this.sessionMode=(a=t.sessionMode)!=null?a:"cookie",this.publishableKey=t.publishableKey,this.tokenStorage=(e=t.tokenStorage)!=null?e:ee(),this.apiVersion=(o=t.apiVersion)!=null?o:C,this.headers=(l=t.headers)!=null?l:{}}async setSessionToken(t){await this.tokenStorage.set(t)}async getSessionToken(){return this.tokenStorage.get()}async clearSession(){await this.tokenStorage.clear()}async request(t,a={}){var n,c,u;let e=`${this.baseUrl}${t}`,o={"Content-Type":"application/json","TL-Version":this.apiVersion,"TL-Client":W,...this.headers,...a.headers};if(this.publishableKey&&(o.Authorization=`Bearer ${this.publishableKey}`),this.sessionMode==="token"){let d=await this.tokenStorage.get();d&&(o["X-Live-Session"]=d)}let l=await fetch(e,{...a,headers:o,credentials:this.sessionMode==="cookie"?"include":"same-origin"}),r=await l.text(),i=r?JSON.parse(r):null;if(!l.ok){let d=(n=i==null?void 0:i.error)!=null?n:{};throw new k((c=d.message)!=null?c:`Request failed (${l.status})`,(u=d.code)!=null?u:"REQUEST_FAILED",l.status)}return i&&i.status==="success"&&i.data!==void 0?i.data:i}};var I="Ticketlayer",te="ticketlayer:ready";function se(s){let t=window;if(t[I])return t[I];let a={client:null,sdk:null,version:s,_resolvers:[],getClient(){return this.client},getSDK(){return this.sdk},ready(){return this.client?Promise.resolve(this.client):new Promise(e=>this._resolvers.push(e))}};return t[I]=a,a}function N(s,t,a){if(typeof window=="undefined")return;let e=se(a);e.client&&e.client!==s&&console.warn("[live] A Ticketlayer client is already on window.Ticketlayer; replacing it. Create a single client per page."),e.client=s,e.sdk=t;let o=e._resolvers;e._resolvers=[],o.forEach(l=>l(s)),window.dispatchEvent(new CustomEvent(te,{detail:s}))}var re="https://cdn.ticketlayer.com/elements/v1/ticketlayer-elements/ticketlayer-elements.esm.js",ne="tl-event-list",K=new Map;function U(s={}){var l;if(!s.elements||typeof window=="undefined"||typeof document=="undefined")return Promise.resolve();let t=window.customElements;if(t!=null&&t.get(ne))return Promise.resolve();let a=(l=s.elementsUrl)!=null?l:re,e=K.get(a);if(e)return e;let o=new Promise((r,i)=>{let n=document.createElement("script");n.type="module",n.src=a,n.async=!0,n.dataset.ticketlayerElements="auto",n.onload=()=>r(),n.onerror=()=>i(new Error(`[live] Failed to load Elements from ${a}`)),document.head.appendChild(n)});return K.set(a,o),o}var R="tl-checkout-overlay";function D(s,t={}){if(typeof window=="undefined"||typeof document=="undefined")return()=>{};let a=null,e=()=>{var i;(i=document.getElementById(R))==null||i.remove(),a&&(window.removeEventListener("message",a),a=null)},o=async i=>{let n=await s.getSessionToken().catch(()=>null),c=(t.embedBaseUrl||window.location.origin).replace(/\/$/,""),u=new URLSearchParams;n&&u.set("session",n),u.set("parent_origin",window.location.origin);let d=`${c}/embed/checkout?${u.toString()}`,m=new URL(d).origin;e();let f=document.createElement("div");f.id=R,f.style.cssText="position:fixed;inset:0;z-index:2147483647;background:rgba(15,23,42,0.55);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;";let p=document.createElement("div");p.style.cssText="width:100%;max-width:960px;display:flex;flex-direction:column;gap:10px;";let g=document.createElement("iframe");g.src=d,g.allow="payment",g.style.cssText="width:100%;height:88vh;max-height:760px;border:1px solid var(--tl-border,#e5e7eb);border-radius:16px;background:#fff;box-shadow:0 24px 64px rgba(0,0,0,0.45);",p.appendChild(g),f.appendChild(p),f.addEventListener("click",w=>{var h;(w.target===f||w.target===p)&&(e(),(h=i.onClose)==null||h.call(i))}),document.body.appendChild(f),a=w=>{var O,P,M;if(w.origin!==m)return;let h=w.data;if(!(!h||typeof h!="object"))switch(h.type){case"tl:complete":{let S=h.order&&typeof h.order=="object"?h.order:{},L=h.orderId?{...S,id:h.orderId,orderNumber:h.orderReference,...h.accessToken?{accessToken:h.accessToken}:{}}:h.order;(O=i.onComplete)==null||O.call(i,L),s.emit("checkout:completed",L),e();break}case"tl:close":case"tl:cancel":(P=i.onClose)==null||P.call(i),e();break;case"tl:error":{let S=new Error(h.message||h.code||"Checkout failed");h.code&&(S.code=h.code),(M=i.onError)==null||M.call(i,S);break}}},window.addEventListener("message",a)},l=s.on("ui:checkout-requested",i=>void o(i!=null?i:{})),r=s.on("ui:modal-close-requested",()=>e());return()=>{l(),r(),e()}}function G(s,t={}){if(typeof window=="undefined"||typeof document=="undefined")return()=>{};let a=t.tag||"tl-buy-modal",e=null,o=null,l=()=>{e&&(e.remove(),e=null),o=null},r=c=>{if(!(c!=null&&c.eventId))return;l(),o=c;let u=document.createElement(a);u.setAttribute("event-id",c.eventId),c.occurrenceId&&u.setAttribute("occurrence-id",c.occurrenceId),u.addEventListener("tlClose",()=>{var m;let d=o;l(),(m=d==null?void 0:d.onClose)==null||m.call(d)}),u.addEventListener("tlError",d=>{var f,p;let m=((f=d.detail)==null?void 0:f.message)||"Could not load this event";(p=o==null?void 0:o.onError)==null||p.call(o,new Error(m))}),u.addEventListener("tlCheckout",()=>{let d=o;l(),s.emit("ui:checkout-requested",{onComplete:d==null?void 0:d.onComplete,onError:d==null?void 0:d.onError,onClose:d==null?void 0:d.onClose})}),document.body.appendChild(u),e=u},i=s.on("ui:event-modal-requested",c=>r(c!=null?c:{})),n=s.on("ui:modal-close-requested",()=>l());return()=>{i(),n(),l()}}var b=s=>{var l,r,i,n,c;if(!s||typeof s!="object")return s;let t=s,a=((l=t.items)!=null?l:[]).map(u=>{var p,g,w;let d=u,m=(p=d.quantity)!=null?p:0,f=(g=d.subtotal)!=null?g:d.unitPrice*m;return{...d,totalPrice:(w=d.totalPrice)!=null?w:f}}),e=a.reduce((u,d)=>{var m;return u+((m=d.quantity)!=null?m:0)},0),o=(i=(r=t.itemsSubtotal)!=null?r:t.subtotal)!=null?i:0;return{...t,items:a,itemCount:e,subtotal:o,fees:(n=t.fees)!=null?n:0,total:(c=t.total)!=null?c:o}};function B(s){let t=new Map,a=(n,c)=>{let u=t.get(n);if(!(u!=null&&u.categoryId))throw new Error(`[live] No category known for ticket type ${n}. Load the occurrence's ticket types (getTicketTypes) before adding it to the cart.`);return{categoryId:u.categoryId,occurrenceId:c||u.occurrenceId}},e={async list(n){var d;let c=await s.events.list(),u=((d=c==null?void 0:c.listings)!=null?d:[]).map(m=>{var f,p,g;return{id:(f=m.eventId)!=null?f:m.id,name:(p=m.name)!=null?p:"",...m.shortDescription?{shortDescription:m.shortDescription}:{},...m.imageUrl?{imageUrl:m.imageUrl}:{},...m.venueName?{venue:{id:"",name:m.venueName,city:(g=m.venueCity)!=null?g:""}}:{},...m.nextOccurrenceAt?{nextOccurrence:{startsAt:m.nextOccurrenceAt}}:{},availabilityStatus:"available"}});return n!=null&&n.limit&&(u=u.slice(0,n.limit)),{items:u}},get:n=>s.events.get(n),async getTicketTypes(n,c){var f,p,g,w;let u=await s.events.get(n),d=(g=(f=u==null?void 0:u.occurrences)==null?void 0:f.find(h=>h.id===c))!=null?g:(p=u==null?void 0:u.occurrences)==null?void 0:p[0];return((w=d==null?void 0:d.ticketTypes)!=null?w:[]).map(h=>(d&&t.set(h.ticketTypeId,{categoryId:h.categoryId,occurrenceId:d.id}),{id:h.ticketTypeId,name:h.ticketTypeName,description:h.description,price:h.unitPrice,currency:h.currency,categoryId:h.categoryId,categoryName:h.categoryName,maxPerOrder:10,available:999}))}},o={get:async()=>{var n;return b((n=s.cart.current)!=null?n:await s.cart.refresh())},on:(n,c)=>s.on(n,u=>c(n==="cart:updated"?b(u):u)),off:(n,c)=>s.off(n,c),addItem:async(n,c,u)=>{let{categoryId:d,occurrenceId:m}=a(n,u);return b(await s.cart.add({eventOccurrenceId:m,categoryId:d,ticketTypeId:n,quantity:c}))},addItems:async n=>{let c=s.cart.current;for(let u of n)c=await o.addItem(u.ticketTypeId,u.quantity,u.occurrenceId);return c},removeItem:async n=>b(await s.cart.remove(n)),addSeat:async(n,c,u)=>{let{categoryId:d,occurrenceId:m}=a(c,u);return b(await s.cart.add({eventOccurrenceId:m,categoryId:d,ticketTypeId:c,eventLayoutSeatIds:[n]}))},removeSeat:async(n,c)=>{var u;return console.warn("[live] removeSeat is a no-op until cart items expose seat ids; use removeItem(itemId)."),b((u=await s.cart.refresh())!=null?u:s.cart.current)}},l={mine:()=>s.orders.mine(),get:n=>s.orders.get(n),ticketPdf:(n,c)=>s.orders.ticketPdf(n,c)},r={get customer(){return s.auth.customer},get authenticated(){return s.auth.authenticated},requestMagicLink:n=>s.auth.requestMagicLink(n),exchange:n=>s.auth.exchange(n),logout:()=>s.auth.logout()},i={redeem:n=>s.presale.redeem(n)};return{getEventsManager:()=>e,getCartManager:()=>o,getOrdersManager:()=>l,getAuthManager:()=>r,getPresaleManager:()=>i,on:(n,c)=>s.on(n,c),off:(n,c)=>s.off(n,c),event:n=>({openModal:(c={})=>s.emit("ui:event-modal-requested",{eventId:n,...c})}),checkout:{openModal:(n={})=>s.emit("ui:checkout-requested",n),closeModal:()=>s.emit("ui:modal-close-requested")},closeModal:()=>s.emit("ui:modal-close-requested")}}var T=class{constructor(){this.handlers=new Map}on(t,a){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(a),()=>this.off(t,a)}off(t,a){var e;(e=this.handlers.get(t))==null||e.delete(a)}emit(t,a){var e;(e=this.handlers.get(t))==null||e.forEach(o=>{try{o(a)}catch(l){console.error(`[live] handler for ${t} threw`,l)}})}};var J="tl-theme-vars",x=s=>s.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),oe={fontFamily:"font-family",fontFamilyMono:"font-family-mono",baseSize:"font-size-base",scaleRatio:"font-scale"};function F(s){var o,l,r,i;if(!s||typeof document=="undefined")return;let t=[],a=(n,c)=>{c!=null&&t.push(`--tl-${n}: ${String(c)};`)};for(let[n,c]of Object.entries((o=s.colors)!=null?o:{})){let u=x(n);a(u,c),a(`color-${u}`,c),n==="destructive"&&(a("error",c),a("color-error",c)),n==="destructiveForeground"&&(a("error-foreground",c),a("color-error-foreground",c))}for(let[n,c]of Object.entries((l=s.typography)!=null?l:{}))a((r=oe[n])!=null?r:x(n),c);for(let[n,c]of Object.entries((i=s.shape)!=null?i:{}))a(x(n),c);let e=document.getElementById(J);e||(e=document.createElement("style"),e.id=J,document.head.appendChild(e)),e.textContent=`:root {
2
2
  ${t.join(`
3
3
  `)}
4
- }`}var g=(s,t)=>s&&typeof s=="object"&&!Array.isArray(s)&&t in s?s[t]:s,S=class{constructor(t,a){this.emitter=new T,this._sessionStarted=!1,this._sessionStarting=null,this._session={channelId:null,customer:null,authenticated:!1},this._cart=null,this._cartId=null,this.client=t,this.sessionMode=a.sessionMode,this.publishableKey=a.publishableKey,this.domain=a.domain,this.baseUrl=a.baseUrl.replace(/\/$/,"");let e=this;this.events={list:()=>e.client.salesListings.list(),get:o=>e.client.sales.get(o).then(l=>g(l,"event"))},this.theme={get:()=>e.client.sales.getTheme().then(o=>g(o,"theme")),apply:async()=>{let o=await e.theme.get();return F(o),o}},this.cart={get current(){return e._cart},get id(){return e._cartId},ensure:async()=>{var o;if(!e._cartId){await e.ensureSession();let l=await e.client.salesCarts.create({}),r=g(l,"cart");e._cartId=(o=r==null?void 0:r.id)!=null?o:null,e._setCart(r)}return e._cartId},add:async o=>{let l=await e.cart.ensure();try{let r=await e.client.salesCarts.addItem(l,o);return e._setCart(g(r,"cart")),e._cart}catch(r){if(!e._isCartGone(r))throw r;e._resetCart();let i=await e.cart.ensure(),n=await e.client.salesCarts.addItem(i,o);return e._setCart(g(n,"cart")),e._cart}},remove:async o=>{if(!e._cartId)return e._cart;try{let l=await e.client.salesCarts.removeItem(e._cartId,o);return e._setCart(g(l,"cart")),e._cart}catch(l){if(!e._isCartGone(l))throw l;return e._resetCart(),e._cart}},refresh:async()=>{if(!e._cartId)return e._cart;try{let o=await e.client.salesCarts.get(e._cartId);return e._setCart(g(o,"cart")),e._cart}catch(o){if(!e._isCartGone(o))throw o;return e._resetCart(),e._cart}},checkout:async(o={})=>{if(!e._cartId)throw new Error("No cart to check out");try{let l=await e.client.salesCarts.checkout(e._cartId,o);return e._cartId=null,e._setCart(null),e.emitter.emit("checkout:completed",g(l,"order")),l}catch(l){throw e._isCartGone(l)?(e._resetCart(),new b("Your cart has expired. Please add your tickets again.","CART_EXPIRED",409)):l}}},this.auth={get customer(){return e._session.customer},get authenticated(){return e._session.authenticated},requestMagicLink:o=>e.client.salesCustomerAuth.magicLink(o),exchange:async o=>{var i;await e.ensureSession();let l=typeof o=="string"?{type:"magic_link",code:o}:o,r=await e.client.salesCustomerTokens.create({proof:l});return e._session={...e._session,customer:(i=g(r,"customer"))!=null?i:null,authenticated:!0},e.emitter.emit("auth:changed",e._session),r},logout:async()=>{await e.client.session.end().catch(()=>{}),e._session={channelId:e._session.channelId,customer:null,authenticated:!1},e._cart=null,e._cartId=null,e.emitter.emit("auth:changed",e._session)}},this.orders={mine:()=>e.client.salesMyOrders.list().then(o=>g(o,"orders")),get:o=>e.client.salesOrders.get(o).then(l=>g(l,"order")),ticketPdf:async(o,l)=>{let r={};if(e.publishableKey&&(r.Authorization=`Bearer ${e.publishableKey}`),e.sessionMode==="token"){let n=await e.client.getSessionToken();n&&(r["X-Live-Session"]=n)}let i=await fetch(`${e.baseUrl}/sales/orders/${o}/passes/${l}/ticket.pdf`,{headers:r,credentials:e.sessionMode==="cookie"?"include":"same-origin"});if(!i.ok)throw new b(`Failed to download ticket (${i.status})`,"TICKET_PDF_FAILED",i.status);return i.blob()}},this.payments={begin:(o,l={})=>e.client.salesOrderPayments.create(o,l).then(r=>g(r,"payment"))},this.presale={redeem:async o=>{let l=await e.client.salesPresaleCodes.redeem({code:o.trim()});return e._cartId&&await e.cart.refresh().catch(()=>{}),l}},this.queue={status:()=>e.client.queue.status(),join:()=>e.client.queue.join()}}on(t,a){return this.emitter.on(t,a)}off(t,a){this.emitter.off(t,a)}emit(t,a){this.emitter.emit(t,a)}get session(){return this._session}get hasSession(){return this._sessionStarted}async ensureSession(){if(!this._sessionStarted){if(this._sessionStarting)return this._sessionStarting;this._sessionStarting=(async()=>{let t={};this.sessionMode==="token"&&this.publishableKey?t.channelKey=this.publishableKey:this.domain?t.domain=this.domain:this.publishableKey&&(t.channelKey=this.publishableKey);let a=await this.client.session.start(t);if(this.sessionMode==="token"){let e=g(a,"sessionToken");e&&await this.client.setSessionToken(e)}this._sessionStarted=!0,await this.refreshSession()})();try{await this._sessionStarting}finally{this._sessionStarting=null}}}async start(t={}){return t.domain&&(this.domain=t.domain),this.ensureSession()}async resumeIfExists(){if(this._sessionStarted)return!0;try{return await this.refreshSession(),this._sessionStarted=!0,!0}catch{return!1}}async resume(t){await this.client.setSessionToken(t),this._sessionStarted=!0,await this.refreshSession()}getSessionToken(){return this.client.getSessionToken()}async refreshSession(){var e,o,l,r;let t=await this.client.session.current();this._session={channelId:(o=(e=g(t,"channel"))==null?void 0:e.id)!=null?o:null,customer:(l=g(t,"customer"))!=null?l:null,authenticated:!!g(t,"authenticated")};let a=(r=g(t,"cartId"))!=null?r:null;a&&(this._cartId=a,await this.cart.refresh()),this.emitter.emit("session:changed",this._session)}_resetSessionStarted(){this._sessionStarted=!1,this._sessionStarting=null}_setCart(t){this._cart=t!=null?t:null,this.emitter.emit("cart:updated",this._cart)}_isCartGone(t){return t instanceof b?t.code==="CART_EXPIRED"||t.code==="CART_NOT_ACTIVE"||t.code==="CART_NOT_FOUND"||t.status===404:!1}_resetCart(){this._cartId=null,this._setCart(null)}};async function ue(s,t){var a;try{let e=await fetch(`${s.replace(/\/$/,"")}/channel?domain=${encodeURIComponent(t)}`,{headers:{accept:"application/json"}});if(!e.ok)return;let o=await e.json();return(a=o==null?void 0:o.data)==null?void 0:a.publishableKey}catch{return}}async function O(s){var n,c,d;let t=(n=s.domain)!=null?n:typeof window!="undefined"?window.location.host:void 0,a=s.publishableKey;!a&&!s.sessionToken&&t&&(a=await ue(s.baseUrl,t));let e=!!s.publishableKey||!!s.sessionToken,o=(c=s.sessionMode)!=null?c:e?"token":"cookie",l=new v({...s,sessionMode:o,...a?{publishableKey:a}:{}}),r=new S(l,{sessionMode:o,baseUrl:s.baseUrl,...a?{publishableKey:a}:{},...t?{domain:t}:{}});s.publish!==!1&&typeof window!="undefined"&&U(r,J(r),I),((d=s.checkout)==null?void 0:d.mode)==="modal"&&typeof window!="undefined"&&G(r,s.checkout),s.buyModal!==!1&&s.publish!==!1&&typeof window!="undefined"&&B(r);let i=K(s).catch(u=>{console.error("[live] Elements auto-load failed",u)});return s.autoStart!==!1&&(s.sessionToken?await r.resume(s.sessionToken):o==="cookie"&&typeof window!="undefined"&&await r.resumeIfExists().catch(()=>{}),s.applyTheme!==!1&&typeof window!="undefined"&&await r.theme.apply().catch(()=>{})),await i,r}function he(){var a;if(typeof document=="undefined")return null;let s=(a=document.currentScript)!=null?a:document.querySelector("script[data-publishable-key]");if(!s)return null;let t=s.dataset;return{publishableKey:t.publishableKey,apiUrl:t.apiUrl,elementsUrl:t.elementsUrl,checkoutBase:t.checkoutBase,autoElements:t.elements!=="false"}}function j(){var e,o;if(typeof window=="undefined")return Promise.resolve(null);let s=window;if(s.__tlBooted)return(o=(e=s.ticketlayer)==null?void 0:e.ready)!=null?o:Promise.resolve(null);let t=he();if(!(t!=null&&t.publishableKey))return Promise.resolve(null);if(!t.apiUrl)return console.error("[ticketlayer] Missing data-api-url on the embed script; cannot auto-init."),Promise.resolve(null);s.__tlBooted=!0;let a=O({baseUrl:t.apiUrl,publishableKey:t.publishableKey,elements:t.autoElements,...t.elementsUrl?{elementsUrl:t.elementsUrl}:{},checkout:{mode:"modal",...t.checkoutBase?{embedBaseUrl:t.checkoutBase}:{}}}).catch(l=>(console.error("[ticketlayer] Failed to initialise:",l),null));return s.ticketlayer={ready:a},a}j();return Q(me);})();
4
+ }`}var y=(s,t)=>s&&typeof s=="object"&&!Array.isArray(s)&&t in s?s[t]:s,_=class{constructor(t,a){this.emitter=new T,this._sessionStarted=!1,this._sessionStarting=null,this._session={channelId:null,customer:null,authenticated:!1},this._cart=null,this._cartId=null,this.client=t,this.sessionMode=a.sessionMode,this.publishableKey=a.publishableKey,this.domain=a.domain,this.baseUrl=a.baseUrl.replace(/\/$/,"");let e=this;this.events={list:()=>e.client.salesListings.list(),get:o=>e.client.sales.get(o).then(l=>y(l,"event"))},this.theme={get:()=>e.client.sales.getTheme().then(o=>y(o,"theme")),apply:async()=>{let o=await e.theme.get();return F(o),o}},this.cart={get current(){return e._cart},get id(){return e._cartId},ensure:async()=>{var o;if(!e._cartId){await e.ensureSession();let l=await e.client.salesCarts.create({}),r=y(l,"cart");e._cartId=(o=r==null?void 0:r.id)!=null?o:null,e._setCart(r)}return e._cartId},add:async o=>{let l=await e.cart.ensure();try{let r=await e.client.salesCarts.addItem(l,o);return e._setCart(y(r,"cart")),e._cart}catch(r){if(!e._isCartGone(r))throw r;e._resetCart();let i=await e.cart.ensure(),n=await e.client.salesCarts.addItem(i,o);return e._setCart(y(n,"cart")),e._cart}},remove:async o=>{if(!e._cartId)return e._cart;try{let l=await e.client.salesCarts.removeItem(e._cartId,o);return e._setCart(y(l,"cart")),e._cart}catch(l){if(!e._isCartGone(l))throw l;return e._resetCart(),e._cart}},refresh:async()=>{if(!e._cartId)return e._cart;try{let o=await e.client.salesCarts.get(e._cartId);return e._setCart(y(o,"cart")),e._cart}catch(o){if(!e._isCartGone(o))throw o;return e._resetCart(),e._cart}},checkout:async(o={})=>{if(!e._cartId)throw new Error("No cart to check out");try{let l=await e.client.salesCarts.checkout(e._cartId,o);return e._cartId=null,e._setCart(null),e.emitter.emit("checkout:completed",y(l,"order")),l}catch(l){throw e._isCartGone(l)?(e._resetCart(),new k("Your cart has expired. Please add your tickets again.","CART_EXPIRED",409)):l}}},this.auth={get customer(){return e._session.customer},get authenticated(){return e._session.authenticated},requestMagicLink:o=>e.client.salesCustomerAuth.magicLink(o),exchange:async o=>{var i;await e.ensureSession();let l=typeof o=="string"?{type:"magic_link",code:o}:o,r=await e.client.salesCustomerTokens.create({proof:l});return e._session={...e._session,customer:(i=y(r,"customer"))!=null?i:null,authenticated:!0},e.emitter.emit("auth:changed",e._session),r},logout:async()=>{await e.client.session.end().catch(()=>{}),e._session={channelId:e._session.channelId,customer:null,authenticated:!1},e._cart=null,e._cartId=null,e.emitter.emit("auth:changed",e._session)}},this.orders={mine:()=>e.client.salesMyOrders.list().then(o=>y(o,"orders")),get:o=>e.client.salesOrders.get(o).then(l=>y(l,"order")),ticketPdf:async(o,l)=>{let r={};if(e.publishableKey&&(r.Authorization=`Bearer ${e.publishableKey}`),e.sessionMode==="token"){let n=await e.client.getSessionToken();n&&(r["X-Live-Session"]=n)}let i=await fetch(`${e.baseUrl}/sales/orders/${o}/passes/${l}/ticket.pdf`,{headers:r,credentials:e.sessionMode==="cookie"?"include":"same-origin"});if(!i.ok)throw new k(`Failed to download ticket (${i.status})`,"TICKET_PDF_FAILED",i.status);return i.blob()}},this.payments={begin:(o,l={})=>e.client.salesOrderPayments.create(o,l).then(r=>y(r,"payment"))},this.presale={redeem:async o=>{let l=await e.client.salesPresaleCodes.redeem({code:o.trim()});return e._cartId&&await e.cart.refresh().catch(()=>{}),l}},this.queue={status:()=>e.client.queue.status(),join:()=>e.client.queue.join()}}on(t,a){return this.emitter.on(t,a)}off(t,a){this.emitter.off(t,a)}emit(t,a){this.emitter.emit(t,a)}get session(){return this._session}get hasSession(){return this._sessionStarted}async ensureSession(){if(!this._sessionStarted){if(this._sessionStarting)return this._sessionStarting;this._sessionStarting=(async()=>{let t={};this.sessionMode==="token"&&this.publishableKey?t.channelKey=this.publishableKey:this.domain?t.domain=this.domain:this.publishableKey&&(t.channelKey=this.publishableKey);let a=await this.client.session.start(t);if(this.sessionMode==="token"){let e=y(a,"sessionToken");e&&await this.client.setSessionToken(e)}this._sessionStarted=!0,await this.refreshSession()})();try{await this._sessionStarting}finally{this._sessionStarting=null}}}async start(t={}){return t.domain&&(this.domain=t.domain),this.ensureSession()}async resumeIfExists(){if(this._sessionStarted)return!0;try{return await this.refreshSession(),this._sessionStarted=!0,!0}catch{return!1}}async resume(t){await this.client.setSessionToken(t),this._sessionStarted=!0,await this.refreshSession()}getSessionToken(){return this.client.getSessionToken()}async refreshSession(){var e,o,l,r;let t=await this.client.session.current();this._session={channelId:(o=(e=y(t,"channel"))==null?void 0:e.id)!=null?o:null,customer:(l=y(t,"customer"))!=null?l:null,authenticated:!!y(t,"authenticated")};let a=(r=y(t,"cartId"))!=null?r:null;a&&(this._cartId=a,await this.cart.refresh()),this.emitter.emit("session:changed",this._session)}_resetSessionStarted(){this._sessionStarted=!1,this._sessionStarting=null}_setCart(t){this._cart=t!=null?t:null,this.emitter.emit("cart:updated",this._cart)}_isCartGone(t){return t instanceof k?t.code==="CART_EXPIRED"||t.code==="CART_NOT_ACTIVE"||t.code==="CART_NOT_FOUND"||t.status===404:!1}_resetCart(){this._cartId=null,this._setCart(null)}};async function ae(s,t){var a;try{let e=await fetch(`${s.replace(/\/$/,"")}/channel?domain=${encodeURIComponent(t)}`,{headers:{accept:"application/json"}});if(!e.ok)return;let o=await e.json();return(a=o==null?void 0:o.data)==null?void 0:a.publishableKey}catch{return}}async function q(s){var n,c,u;let t=(n=s.domain)!=null?n:typeof window!="undefined"?window.location.host:void 0,a=s.publishableKey;!a&&!s.sessionToken&&t&&(a=await ae(s.baseUrl,t));let e=!!s.publishableKey||!!s.sessionToken,o=(c=s.sessionMode)!=null?c:e?"token":"cookie",l=new E({...s,sessionMode:o,...a?{publishableKey:a}:{}}),r=new _(l,{sessionMode:o,baseUrl:s.baseUrl,...a?{publishableKey:a}:{},...t?{domain:t}:{}});s.publish!==!1&&typeof window!="undefined"&&N(r,B(r),C),((u=s.checkout)==null?void 0:u.mode)==="modal"&&typeof window!="undefined"&&D(r,s.checkout),s.buyModal!==!1&&s.publish!==!1&&typeof window!="undefined"&&G(r);let i=U(s).catch(d=>{console.error("[live] Elements auto-load failed",d)});return s.autoStart!==!1&&(s.sessionToken?await r.resume(s.sessionToken):o==="cookie"&&typeof window!="undefined"&&await r.resumeIfExists().catch(()=>{}),s.applyTheme!==!1&&typeof window!="undefined"&&await r.theme.apply().catch(()=>{})),await i,r}function ie(){var a;if(typeof document=="undefined")return null;let s=(a=document.currentScript)!=null?a:document.querySelector("script[data-publishable-key]");if(!s)return null;let t=s.dataset;return{publishableKey:t.publishableKey,apiUrl:t.apiUrl,elementsUrl:t.elementsUrl,checkoutBase:t.checkoutBase,autoElements:t.elements!=="false"}}function V(){var e,o;if(typeof window=="undefined")return Promise.resolve(null);let s=window;if(s.__tlBooted)return(o=(e=s.ticketlayer)==null?void 0:e.ready)!=null?o:Promise.resolve(null);let t=ie();if(!(t!=null&&t.publishableKey))return Promise.resolve(null);if(!t.apiUrl)return console.error("[ticketlayer] Missing data-api-url on the embed script; cannot auto-init."),Promise.resolve(null);s.__tlBooted=!0;let a=q({baseUrl:t.apiUrl,publishableKey:t.publishableKey,elements:t.autoElements,...t.elementsUrl?{elementsUrl:t.elementsUrl}:{},checkout:{mode:"modal",...t.checkoutBase?{embedBaseUrl:t.checkoutBase}:{}}}).catch(l=>(console.error("[ticketlayer] Failed to initialise:",l),null));return s.ticketlayer={ready:a},a}V();return Q(ce);})();
5
5
  //# sourceMappingURL=ticketlayer.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/auto.ts", "../src/version.ts", "../src/client.ts", "../src/state/registry.ts", "../src/state/loadElements.ts", "../src/state/checkoutModal.ts", "../src/state/buyModal.ts", "../src/elements.ts", "../src/state/emitter.ts", "../src/state/theme.ts", "../src/core/liveClient.ts", "../src/createLiveClient.ts"],
4
- "sourcesContent": ["/**\n * Drop-in auto-init for the CDN/UMD build (`dist/ticketlayer.js`).\n *\n * This is the \"one line of code\" embed - what a Webflow/Framer/any site drops in:\n *\n * <script src=\"https://cdn.ticketlayer.com/v1/ticketlayer.js\"\n * data-publishable-key=\"tlpk_...\"\n * data-api-url=\"https://live-api.ticketlayer.com\"\n * data-checkout-base=\"https://checkout.ticketlayer.com\"></script>\n *\n * On load it boots a Live client from the script tag's data-* attributes:\n * publishes `window.Ticketlayer` (so `@ticketlayer/elements` bind), injects the\n * Elements bundle, and installs the hosted iframe checkout modal. Plain HTML\n * custom-element tags (`<tl-event-list>`, `<tl-buy-tickets-button event-id>`)\n * then just work - no bundler, no framework.\n *\n * The IIFE also exposes the SDK on `window.TicketlayerLive` (createLiveClient,\n * boot) for sites that want manual control instead of the data-attribute path.\n *\n * NOTE: index.ts (the npm/bundler entry) does NOT import this module, so only\n * the CDN build auto-boots. Booting is idempotent and a no-op without a key.\n */\nimport { createLiveClient, TicketlayerLive } from './createLiveClient.js';\n\ninterface BootWindow {\n Ticketlayer?: unknown;\n ticketlayer?: { ready: Promise<TicketlayerLive | null> };\n __tlBooted?: boolean;\n}\n\ninterface DropInConfig {\n publishableKey?: string;\n apiUrl?: string;\n elementsUrl?: string;\n checkoutBase?: string;\n autoElements: boolean;\n}\n\n/** Read config off the embedding <script> tag's data-* attributes. */\nfunction readConfig(): DropInConfig | null {\n if (typeof document === 'undefined') return null;\n const el =\n (document.currentScript as HTMLScriptElement | null) ??\n document.querySelector<HTMLScriptElement>('script[data-publishable-key]');\n if (!el) return null;\n const d = el.dataset;\n return {\n publishableKey: d.publishableKey,\n apiUrl: d.apiUrl,\n elementsUrl: d.elementsUrl,\n checkoutBase: d.checkoutBase,\n // Inject @ticketlayer/elements unless explicitly opted out (data-elements=\"false\").\n autoElements: d.elements !== 'false',\n };\n}\n\n/**\n * Boot a Live client from the script tag's data-* attributes. Returns the\n * client (or null when there's no publishable key / not in a browser). Safe to\n * call once; subsequent calls no-op.\n */\nexport function boot(): Promise<TicketlayerLive | null> {\n if (typeof window === 'undefined') return Promise.resolve(null);\n const w = window as unknown as BootWindow;\n if (w.__tlBooted) return w.ticketlayer?.ready ?? Promise.resolve(null);\n\n const cfg = readConfig();\n if (!cfg?.publishableKey) return Promise.resolve(null); // manual usage - nothing to boot\n if (!cfg.apiUrl) {\n console.error('[ticketlayer] Missing data-api-url on the embed script; cannot auto-init.');\n return Promise.resolve(null);\n }\n\n w.__tlBooted = true;\n const ready = createLiveClient({\n baseUrl: cfg.apiUrl,\n publishableKey: cfg.publishableKey,\n elements: cfg.autoElements,\n ...(cfg.elementsUrl ? { elementsUrl: cfg.elementsUrl } : {}),\n checkout: { mode: 'modal', ...(cfg.checkoutBase ? { embedBaseUrl: cfg.checkoutBase } : {}) },\n }).catch((err) => {\n console.error('[ticketlayer] Failed to initialise:', err);\n return null;\n });\n\n w.ticketlayer = { ready };\n return ready;\n}\n\n// Manual-use surface on the global (the IIFE's globalName is TicketlayerLive).\nexport { createLiveClient, TicketlayerLive };\n\n// Auto-boot on load.\nvoid boot();\n", "/**\n * GENERATED FILE - written from package.json by the prebuild script.\n * Do not edit; do not commit.\n */\nexport const SDK_NAME = \"@ticketlayer/live\";\nexport const SDK_VERSION = \"0.2.0\";\n", "/**\n * GENERATED FILE - do not edit by hand.\n * @ticketlayer/live client generated from the backstage sales surface\n * (spec 1.0.0) + live-api (0.1.0)\n * by backstage-sdk-tooling 0.1.0 on 2026-09-15T01:37:36.041Z.\n * Regenerate with `tt sdk live`.\n */\nimport type { components } from './generated/types';\nimport { SDK_NAME, SDK_VERSION } from './version.js';\n\ntype AttachOrderAccessBody = components['schemas']['AttachOrderAccessBody'];\ntype CreateSalesOrderPaymentResponse = components['schemas']['CreateSalesOrderPaymentResponse'];\ntype CreateSalesRefundRequestResponse = components['schemas']['CreateSalesRefundRequestResponse'];\ntype CreateSessionBody = components['schemas']['CreateSessionBody'];\ntype GetSalesListingsResponse = components['schemas']['GetSalesListingsResponse'];\ntype GetSalesOrderResponse = components['schemas']['GetSalesOrderResponse'];\ntype ListMySalesOrdersResponse = components['schemas']['ListMySalesOrdersResponse'];\ntype RedeemSalesPresaleCodeResponse = components['schemas']['RedeemSalesPresaleCodeResponse'];\ntype SalesCartResponse = components['schemas']['SalesCartResponse'];\ntype SalesCheckoutResponse = components['schemas']['SalesCheckoutResponse'];\ntype SalesCustomerResponse = components['schemas']['SalesCustomerResponse'];\ntype SalesCustomerTokenResponse = components['schemas']['SalesCustomerTokenResponse'];\ntype SalesEventDetailResponse = components['schemas']['SalesEventDetailResponse'];\ntype SalesMagicLinkResponse = components['schemas']['SalesMagicLinkResponse'];\ntype SalesResolveChannelResponse = components['schemas']['SalesResolveChannelResponse'];\ntype SalesThemeResponse = components['schemas']['SalesThemeResponse'];\n\n/**\n * The dated API version (TL-Version) this SDK speaks. Stamped at generation\n * time; the Live/sales surface keeps serving this version's behaviour even as\n * the API evolves. See https://docs.ticketlayer.com/api/versions\n */\nexport const API_DATED_VERSION = '2026-06-13';\n\n/** Best-effort description of the JavaScript runtime, for the TL-Client header. */\nfunction describeRuntime(): string {\n const g = globalThis as Record<string, any>;\n if (g.navigator?.product === 'ReactNative') return 'react-native';\n if (typeof g.window !== 'undefined' && typeof g.document !== 'undefined') return 'browser';\n if (g.process?.versions?.node) return `node/${g.process.versions.node}`;\n if (g.EdgeRuntime) return 'edge';\n return 'unknown';\n}\n\n/**\n * Identifies this SDK build to the API, sent as the TL-Client request header:\n * `ticketlayer-live/<package version> (<runtime>)`. SDK_VERSION comes from\n * src/version.ts, which the package's prebuild writes from package.json so the\n * header always names the version npm published.\n */\nexport const SDK_CLIENT_HEADER = `${SDK_NAME.replace(/^@/, '').replace('/', '-')}/${SDK_VERSION} (${describeRuntime()})`;\n\n/** Pluggable token storage so the SDK runs in browser, React Native, etc. */\nexport interface LiveTokenStorage {\n get(): string | null | Promise<string | null>;\n set(token: string): void | Promise<void>;\n clear(): void | Promise<void>;\n}\n\n/** In-memory storage (default; embeds/SSR). */\nexport function memoryTokenStorage(): LiveTokenStorage {\n let token: string | null = null;\n return {\n get: () => token,\n set: (t) => {\n token = t;\n },\n clear: () => {\n token = null;\n },\n };\n}\n\nexport interface LiveClientConfig {\n /** Base URL of a Live deployment (or the sales surface directly). */\n baseUrl: string;\n /**\n * Session transport:\n * - 'cookie' (hosted web): the live_session httpOnly cookie travels\n * automatically with credentials: 'include'; no token is held client-side.\n * - 'token' (embeds / React Native / native): the session id is held by the\n * SDK and sent as the X-Live-Session header.\n */\n sessionMode?: 'cookie' | 'token';\n /** For embeds/native: the channel's publishable key (tlpk_\u2026). */\n publishableKey?: string;\n /** Token storage for 'token' session mode (defaults to in-memory). */\n tokenStorage?: LiveTokenStorage;\n /** Override the dated API version sent as TL-Version. */\n apiVersion?: string;\n /** Extra headers sent on every request (merged under per-call headers). */\n headers?: Record<string, string>;\n}\n\nexport class LiveAPIError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'LiveAPIError';\n }\n}\n\n/**\n * Generated Live client. Mirrors the sales surface (byte-for-byte views) plus\n * the Live-only /session and /queue operations. Auth is the Live session\n * (cookie on hosted web; X-Live-Session header elsewhere) + the channel\n * publishable key for embeds. Browser ergonomics live in createLiveClient.\n */\nexport class LiveClient {\n private baseUrl: string;\n private sessionMode: 'cookie' | 'token';\n private publishableKey?: string;\n private tokenStorage: LiveTokenStorage;\n private apiVersion: string;\n private headers: Record<string, string>;\n\n constructor(config: LiveClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.sessionMode = config.sessionMode ?? 'cookie';\n this.publishableKey = config.publishableKey;\n this.tokenStorage = config.tokenStorage ?? memoryTokenStorage();\n this.apiVersion = config.apiVersion ?? API_DATED_VERSION;\n this.headers = config.headers ?? {};\n }\n\n /** Store the Live session id (token mode). Called after POST /session. */\n async setSessionToken(token: string): Promise<void> {\n await this.tokenStorage.set(token);\n }\n\n /** The current session token (token mode), if any - used for embed handoff. */\n async getSessionToken(): Promise<string | null> {\n return this.tokenStorage.get();\n }\n\n async clearSession(): Promise<void> {\n await this.tokenStorage.clear();\n }\n\n /**\n * Make a request to the Live deployment. Live serves at the root (no /v1\n * prefix). Injects the publishable key + session header + TL-Version, and\n * unwraps the JSend envelope.\n */\n private async request<T>(path: string, options: RequestInit = {}): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'TL-Version': this.apiVersion,\n 'TL-Client': SDK_CLIENT_HEADER,\n ...this.headers,\n ...(options.headers as Record<string, string> | undefined),\n };\n\n if (this.publishableKey) {\n headers['Authorization'] = `Bearer ${this.publishableKey}`;\n }\n\n if (this.sessionMode === 'token') {\n const token = await this.tokenStorage.get();\n if (token) headers['X-Live-Session'] = token;\n }\n\n const response = await fetch(url, {\n ...options,\n headers,\n // Hosted web relies on the session cookie travelling with the request\n credentials: this.sessionMode === 'cookie' ? 'include' : 'same-origin',\n });\n\n const text = await response.text();\n const json = text ? JSON.parse(text) : null;\n\n if (!response.ok) {\n const error = json?.error ?? {};\n throw new LiveAPIError(\n error.message ?? `Request failed (${response.status})`,\n error.code ?? 'REQUEST_FAILED',\n response.status\n );\n }\n\n // Unwrap JSend: { status, data, metadata } \u2192 data\n if (json && json.status === 'success' && json.data !== undefined) {\n return json.data as T;\n }\n return json as T;\n }\n\n /**\n * Sales Listings methods\n */\n salesListings = {\n /**\n * List active listings\n * What is on sale through this channel right now. The channel is resolved from the key, never from a parameter.\n * @operationId listSalesListings\n */\n list: async () => {\n const response = await this.request<GetSalesListingsResponse>(`/sales/listings`, {\n method: 'GET'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Customer Auth methods\n */\n salesCustomerAuth = {\n /**\n * Request magic link\n * Start a magic-link sign-in for a customer. Always reports success - account existence is never revealed.\n * @operationId requestSalesMagicLink\n */\n magicLink: async (request: { email?: string; phone?: string }) => {\n const response = await this.request<SalesMagicLinkResponse>(`/sales/customer-auth/magic-link`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.sent;\n }\n };\n\n /**\n * Sales Customer Tokens methods\n */\n salesCustomerTokens = {\n /**\n * Exchange identity proof for customer token\n * 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.\n * @operationId createSalesCustomerToken\n */\n create: async (request: { proof: any }) => {\n const response = await this.request<SalesCustomerTokenResponse>(`/sales/customer-tokens`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n },\n\n /**\n * Refresh a customer token\n * 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.\n * @operationId refreshSalesCustomerToken\n */\n refresh: async () => {\n const response = await this.request<SalesCustomerTokenResponse>(`/sales/customer-tokens/refresh`, {\n method: 'POST'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Carts methods\n */\n salesCarts = {\n /**\n * Create cart\n * Create a cart on this channel. Customer identity comes only from a verified customer token, never from the body.\n * @operationId createSalesCart\n */\n create: async (request: { metadata?: Record<string, any> }) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.cart;\n },\n\n /**\n * Get cart\n * Get a cart with its items\n * @operationId getSalesCart\n */\n get: async (cartId: string) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}`, {\n method: 'GET'\n });\n\n return response.cart;\n },\n\n /**\n * Add cart item\n * Add an item to the cart, taking a real inventory reservation with the channel's TTL\n * @operationId addSalesCartItem\n */\n addItem: async (cartId: string, request: { eventOccurrenceId: string; categoryId: string; ticketTypeId: string; quantity?: number; eventLayoutAreaId?: string; eventLayoutSeatIds?: string[] }) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}/items`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.cart;\n },\n\n /**\n * Remove cart item\n * Remove an item from the cart, releasing its reservation\n * @operationId removeSalesCartItem\n */\n removeItem: async (cartId: string, itemId: string) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}/items/${itemId}`, {\n method: 'DELETE'\n });\n\n return response.cart;\n },\n\n /**\n * Checkout cart\n * Convert the cart into an order. Returns an order access token for possession-based guest access (confirmation page, payment status polling).\n * @operationId checkoutSalesCart\n */\n checkout: async (cartId: string, request: { customerNotes?: string; metadata?: Record<string, any>; customer?: { email: string; firstName?: string; lastName?: string; phone?: string; marketingConsent?: boolean } }) => {\n const response = await this.request<SalesCheckoutResponse>(`/sales/carts/${cartId}/checkout`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Sales My Orders methods\n */\n salesMyOrders = {\n /**\n * List my orders\n * The verified customer's own orders. Requires a customer token - orders cannot be listed with key or possession credentials alone.\n * @operationId listMySalesOrders\n */\n list: async () => {\n const response = await this.request<ListMySalesOrdersResponse>(`/sales/my-orders`, {\n method: 'GET'\n });\n\n return response.orders;\n }\n };\n\n /**\n * Sales Orders methods\n */\n salesOrders = {\n /**\n * Get order\n * 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).\n * @operationId getSalesOrder\n */\n get: async (orderId: string) => {\n const response = await this.request<GetSalesOrderResponse>(`/sales/orders/${orderId}`, {\n method: 'GET'\n });\n\n return response.order;\n },\n\n /**\n * Download a ticket PDF\n * 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.\n * @operationId getSalesOrderTicketPdf\n */\n ticketPdf: async (orderId: string, passId: string) => {\n const response = await this.request<any>(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {\n method: 'GET'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Order Payments methods\n */\n salesOrderPayments = {\n /**\n * Create order payment\n * Initiate payment for the order's outstanding balance through the channel's payment provider\n * @operationId createSalesOrderPayment\n */\n create: async (orderId: string, request: { paymentType?: 'online_card' | 'online_bank_transfer' | 'online_wallet'; returnUrl?: string }) => {\n const response = await this.request<CreateSalesOrderPaymentResponse>(`/sales/orders/${orderId}/payments`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.payment;\n }\n };\n\n /**\n * Sales Refund Requests methods\n */\n salesRefundRequests = {\n /**\n * Request refund or exchange\n * 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.\n * @operationId createSalesOrderRefundRequest\n */\n create: async (orderId: string, request: { type: 'refund' | 'exchange'; reason?: string }) => {\n const response = await this.request<CreateSalesRefundRequestResponse>(`/sales/orders/${orderId}/refund-requests`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.request;\n }\n };\n\n /**\n * Sales Customers methods\n */\n salesCustomers = {\n /**\n * Create customer\n * 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.\n * @operationId createSalesCustomer\n */\n create: async (request: { email: string; firstName?: string; lastName?: string; phone?: string; marketingConsent?: boolean }) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.customer;\n },\n\n /**\n * Get customer\n * Get a customer the channel holds an access grant for (created through it, or who bought through it)\n * @operationId getSalesCustomer\n */\n get: async (customerId: string) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers/${customerId}`, {\n method: 'GET'\n });\n\n return response.customer;\n },\n\n /**\n * Update customer\n * Update a customer the channel holds an access grant for. The update surface is deliberately small - email changes go through the org's staff.\n * @operationId updateSalesCustomer\n */\n update: async (customerId: string, request: { firstName?: string; lastName?: string; phone?: string }) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers/${customerId}`, {\n method: 'PATCH',\n body: JSON.stringify(request)\n });\n\n return response.customer;\n }\n };\n\n /**\n * Sales Presale Codes methods\n */\n salesPresaleCodes = {\n /**\n * Redeem presale code\n * A verified customer redeems a presale code for its benefit; gated pricing unlocks immediately. Requires a customer token.\n * @operationId redeemSalesPresaleCode\n */\n redeem: async (request: { code: string }) => {\n const response = await this.request<RedeemSalesPresaleCodeResponse>(`/sales/presale-codes/redeem`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Sales methods\n */\n sales = {\n /**\n * Resolve a channel by domain\n * 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.\n * @operationId resolveSalesChannel\n */\n resolveChannel: async (options?: { domain: string }) => {\n const params = new URLSearchParams();\n if (options?.domain !== undefined) params.append('domain', String(options.domain));\n const queryString = params.toString();\n const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;\n\n const response = await this.request<SalesResolveChannelResponse>(requestPath, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Get event catalogue detail\n * 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.\n * @operationId getSalesEvent\n */\n get: async (eventId: string) => {\n const response = await this.request<SalesEventDetailResponse>(`/sales/events/${eventId}`, {\n method: 'GET'\n });\n\n return response.event;\n },\n\n /**\n * Get channel theme\n * 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.\n * @operationId getSalesTheme\n */\n getTheme: async () => {\n const response = await this.request<SalesThemeResponse>(`/sales/theme`, {\n method: 'GET'\n });\n\n return response.theme;\n }\n };\n\n /**\n * Session methods\n */\n session = {\n /**\n * Bootstrap a Live session\n * Resolves the channel and mints a session that holds the channel\u2019s 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.\n * @operationId createLiveSession\n */\n start: async (request: CreateSessionBody) => {\n const response = await this.request<any>(`/session`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n },\n\n /**\n * Get the current session\n * Returns the current session\u2019s customer and cart state.\n * @operationId getLiveSession\n */\n current: async () => {\n const response = await this.request<any>(`/session`, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Destroy the current session\n * Signs out and drops the current session.\n * @operationId deleteLiveSession\n */\n end: async () => {\n const response = await this.request<any>(`/session`, {\n method: 'DELETE'\n });\n\n return response;\n },\n\n /**\n * Attach an order access token to the session\n * 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`.\n * @operationId attachLiveOrderAccess\n */\n attachOrderAccess: async (request: AttachOrderAccessBody) => {\n const response = await this.request<any>(`/session/order-access`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Queue methods\n */\n queue = {\n /**\n * Get waiting-room status\n * 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.\n * @operationId getLiveQueueStatus\n */\n status: async () => {\n const response = await this.request<any>(`/queue/status`, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Join the waiting room\n * Joins the current session to the waiting room. While the queue is disabled this is a no-op that reports immediate admission.\n * @operationId joinLiveQueue\n */\n join: async () => {\n const response = await this.request<any>(`/queue/join`, {\n method: 'POST'\n });\n\n return response;\n }\n };\n}\n", "/**\n * The `window.Ticketlayer` global registry.\n *\n * One stateful Live client per page, published on a well-known global so that\n * Elements (a separate bundle, possibly CDN-loaded) can find and bind to it\n * WITHOUT importing @ticketlayer/live. The contract is deliberately tiny and\n * stable - it's the public integration surface for snippet/Webflow embeds:\n *\n * - `getClient()` - the rich stateful facade (events/cart/auth/theme/bus).\n * - `getSDK()` - the Elements-shaped connector view of that same client.\n * - `ready()` - resolves when the client is published (immediately if it\n * already is); Elements await this instead of polling.\n *\n * Publishing also dispatches a `ticketlayer:ready` CustomEvent on window, so a\n * pure-DOM listener (no promise plumbing) can react too.\n */\n\nexport const TICKETLAYER_GLOBAL_KEY = 'Ticketlayer' as const;\nexport const TICKETLAYER_READY_EVENT = 'ticketlayer:ready' as const;\n\nexport interface TicketlayerGlobal<Client = unknown, Sdk = unknown> {\n /** The singleton stateful client (facade). */\n client: Client | null;\n /** Elements-shaped connector view of the same client. */\n sdk: Sdk | null;\n getClient(): Client | null;\n getSDK(): Sdk | null;\n /** Resolves with the client once published; immediate if already present. */\n ready(): Promise<Client>;\n version: string;\n}\n\ninterface InternalGlobal<Client, Sdk> extends TicketlayerGlobal<Client, Sdk> {\n _resolvers: Array<(c: Client) => void>;\n}\n\ndeclare global {\n interface Window {\n Ticketlayer?: TicketlayerGlobal;\n }\n}\n\nfunction ensureRegistry<Client, Sdk>(version: string): InternalGlobal<Client, Sdk> {\n const w = window as unknown as { [TICKETLAYER_GLOBAL_KEY]?: InternalGlobal<Client, Sdk> };\n if (w[TICKETLAYER_GLOBAL_KEY]) return w[TICKETLAYER_GLOBAL_KEY]!;\n\n const reg: InternalGlobal<Client, Sdk> = {\n client: null,\n sdk: null,\n version,\n _resolvers: [],\n getClient() {\n return this.client;\n },\n getSDK() {\n return this.sdk;\n },\n ready() {\n if (this.client) return Promise.resolve(this.client);\n return new Promise<Client>((resolve) => this._resolvers.push(resolve));\n },\n };\n w[TICKETLAYER_GLOBAL_KEY] = reg;\n return reg;\n}\n\n/** Publish the singleton client + connector. Browser-only; safe to call once. */\nexport function publishClient<Client, Sdk>(client: Client, sdk: Sdk, version: string): void {\n if (typeof window === 'undefined') return;\n const reg = ensureRegistry<Client, Sdk>(version);\n\n if (reg.client && reg.client !== client) {\n console.warn(\n '[live] A Ticketlayer client is already on window.Ticketlayer; replacing it. ' +\n 'Create a single client per page.'\n );\n }\n\n reg.client = client;\n reg.sdk = sdk;\n const resolvers = reg._resolvers;\n reg._resolvers = [];\n resolvers.forEach((r) => r(client));\n\n window.dispatchEvent(new CustomEvent(TICKETLAYER_READY_EVENT, { detail: client }));\n}\n\n/** Read the current client, if any (host convenience; Elements use ready()). */\nexport function getPublishedClient<Client>(): Client | null {\n if (typeof window === 'undefined') return null;\n return (window.Ticketlayer?.getClient() as Client | null) ?? null;\n}\n", "/**\n * Optionally pull in @ticketlayer/elements at runtime so a single Live include\n * gives you the components too - the \"one line of code\" snippet path.\n *\n * No-op when: not in a browser, the custom elements are already defined (a\n * bundler-based host like HBO imports them directly), or an injection for this\n * URL is already in flight. The default URL points at the Elements ESM entry on\n * the Ticketlayer CDN; pass `elementsUrl` to target a local build in dev.\n */\nconst DEFAULT_ELEMENTS_URL =\n 'https://cdn.ticketlayer.com/elements/v1/ticketlayer-elements/ticketlayer-elements.esm.js';\n\nconst SENTINEL_TAG = 'tl-event-list';\nconst inFlight = new Map<string, Promise<void>>();\n\nexport interface LoadElementsOptions {\n /** Enable runtime injection (default false - most hosts import Elements directly). */\n elements?: boolean;\n /** Override the Elements ESM bundle URL (e.g. a local dist in dev). */\n elementsUrl?: string;\n}\n\nexport function loadElements(opts: LoadElementsOptions = {}): Promise<void> {\n if (!opts.elements) return Promise.resolve();\n if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.resolve();\n\n // Already registered (bundler import or a prior load) - nothing to do.\n const ce = (window as unknown as { customElements?: CustomElementRegistry }).customElements;\n if (ce?.get(SENTINEL_TAG)) return Promise.resolve();\n\n const url = opts.elementsUrl ?? DEFAULT_ELEMENTS_URL;\n const existing = inFlight.get(url);\n if (existing) return existing;\n\n const p = new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.type = 'module';\n script.src = url;\n script.async = true;\n script.dataset.ticketlayerElements = 'auto';\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`[live] Failed to load Elements from ${url}`));\n document.head.appendChild(script);\n });\n\n inFlight.set(url, p);\n return p;\n}\n", "/**\n * Checkout modal manager (third-party embeds).\n *\n * On a third-party site, Elements build the cart in-page and emit\n * `ui:checkout-requested`. This opens the hosted checkout in an iframe overlay\n * pointing at HBO's `/embed/checkout`, handing off the current session token so\n * the iframe sees the same cart (and so card data stays on HBO's origin - PCI\n * isolation). It bridges the `tl:*` postMessage protocol back to the caller's\n * onComplete/onError/onClose callbacks (which rode in on the intent payload).\n *\n * The iframe URL carries `parent_origin=<this page's origin>` so HBO can pin\n * its postMessage target to us (it never posts to '*'), and incoming messages\n * are only accepted from the checkout's own origin. The message set is\n * documented in HBO's docs/embed-checkout-contract.md.\n *\n * HBO itself does NOT use this - it handles `ui:checkout-requested` by\n * navigating in-page to /checkout.\n */\nimport type { TicketlayerLive } from '../createLiveClient.js';\n\nexport interface CheckoutModalOptions {\n /** Base URL of the HBO instance serving /embed/checkout. Defaults to origin. */\n embedBaseUrl?: string;\n}\n\n/** Inbound `tl:*` envelope (see HBO docs/embed-checkout-contract.md). */\ninterface EmbedMessage {\n type?: string;\n version?: number;\n orderId?: string;\n orderReference?: string;\n accessToken?: string;\n /** Pre-v1 payload of tl:complete. */\n order?: unknown;\n code?: string;\n message?: string;\n height?: number;\n}\n\ninterface CheckoutIntent {\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\nconst OVERLAY_ID = 'tl-checkout-overlay';\n\nconst PRIVACY_URL = 'https://ticketlayer.com/privacy';\nconst REPORT_URL = 'https://ticketlayer.com/report-abuse';\nconst SITE_URL = 'https://ticketlayer.com';\n\n/** Floating-chrome markup: platform links (left) + Powered by Ticketlayer (right). */\nfunction footerHtml(): string {\n const logo =\n '<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" style=\"display:block;\">' +\n '<path d=\"M4 7.5A1.5 1.5 0 0 1 5.5 6h13A1.5 1.5 0 0 1 20 7.5v2a2 2 0 0 0 0 5v2a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 16.5v-2a2 2 0 0 0 0-5v-2Z\" fill=\"currentColor\"/>' +\n '<path d=\"M13 7v10\" stroke=\"rgba(255,255,255,0.5)\" stroke-width=\"1.2\" stroke-dasharray=\"1.5 1.8\" stroke-linecap=\"round\"/></svg>';\n const link = (href: string, label: string) =>\n `<a href=\"${href}\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color:inherit;text-decoration:none;opacity:0.85;\">${label}</a>`;\n return (\n `<div style=\"display:flex;gap:16px;align-items:center;\">${link(PRIVACY_URL, 'Privacy Policy')}${link(REPORT_URL, 'Report Abuse')}</div>` +\n `<a href=\"${SITE_URL}\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:6px;opacity:0.92;\">` +\n `<span style=\"opacity:0.7;\">Powered by</span>${logo}<span style=\"font-weight:700;letter-spacing:0.01em;\">Ticketlayer</span></a>`\n );\n}\n\n/** Wire the modal to the bus; returns an uninstall function. */\nexport function installCheckoutModal(\n tl: TicketlayerLive,\n opts: CheckoutModalOptions = {}\n): () => void {\n if (typeof window === 'undefined' || typeof document === 'undefined') return () => {};\n\n let onMessage: ((e: MessageEvent) => void) | null = null;\n\n const close = () => {\n document.getElementById(OVERLAY_ID)?.remove();\n if (onMessage) {\n window.removeEventListener('message', onMessage);\n onMessage = null;\n }\n };\n\n const open = async (intent: CheckoutIntent) => {\n const token = await tl.getSessionToken().catch(() => null);\n const base = (opts.embedBaseUrl || window.location.origin).replace(/\\/$/, '');\n const query = new URLSearchParams();\n if (token) query.set('session', token);\n // Lets HBO pin its postMessage target origin to this page.\n query.set('parent_origin', window.location.origin);\n const url = `${base}/embed/checkout?${query.toString()}`;\n const frameOrigin = new URL(url).origin;\n\n close();\n\n const overlay = document.createElement('div');\n overlay.id = OVERLAY_ID;\n // Blurred, dimmed backdrop so the underlying site recedes behind the modal.\n overlay.style.cssText =\n 'position:fixed;inset:0;z-index:2147483647;background:rgba(15,23,42,0.55);' +\n 'backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);' +\n 'display:flex;flex-direction:column;align-items:center;justify-content:center;' +\n 'gap:12px;padding:16px;';\n\n // Column wrapper: the modal panel + a floating chrome footer beneath it.\n const wrapper = document.createElement('div');\n wrapper.style.cssText =\n 'width:100%;max-width:960px;display:flex;flex-direction:column;gap:10px;';\n\n const frame = document.createElement('iframe');\n frame.src = url;\n frame.allow = 'payment';\n // Wide enough for the two-column checkout (form left, order summary right);\n // the embedded page stacks to one column on narrow viewports. Subtle theme\n // border (matches the buy-tickets modal) + a soft lift off the backdrop.\n frame.style.cssText =\n 'width:100%;height:88vh;max-height:760px;border:1px solid var(--tl-border,#e5e7eb);' +\n 'border-radius:16px;background:#fff;box-shadow:0 24px 64px rgba(0,0,0,0.45);';\n\n // Floating chrome: platform links far-left, \"Powered by Ticketlayer\" far-right.\n const footer = document.createElement('div');\n footer.style.cssText =\n 'display:flex;align-items:center;justify-content:space-between;gap:12px;' +\n 'padding:0 8px;font:500 12px/1.4 system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;' +\n 'color:rgba(255,255,255,0.78);';\n footer.innerHTML = footerHtml();\n\n wrapper.appendChild(frame);\n wrapper.appendChild(footer);\n overlay.appendChild(wrapper);\n\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay || e.target === wrapper) {\n close();\n intent.onClose?.();\n }\n });\n document.body.appendChild(overlay);\n\n onMessage = (e: MessageEvent) => {\n // Only the checkout page's own origin may drive the modal.\n if (e.origin !== frameOrigin) return;\n const msg = e.data as EmbedMessage | null;\n if (!msg || typeof msg !== 'object') return;\n switch (msg.type) {\n case 'tl:complete': {\n // v1 carries orderId/orderReference/accessToken at the top level and\n // keeps the pre-v1 `order` object; merge so both shapes are served.\n const legacy = (msg.order && typeof msg.order === 'object' ? msg.order : {}) as object;\n const order: unknown = msg.orderId\n ? {\n ...legacy,\n id: msg.orderId,\n orderNumber: msg.orderReference,\n ...(msg.accessToken ? { accessToken: msg.accessToken } : {}),\n }\n : msg.order;\n intent.onComplete?.(order);\n tl.emit('checkout:completed', order);\n close();\n break;\n }\n case 'tl:close':\n case 'tl:cancel':\n intent.onClose?.();\n close();\n break;\n case 'tl:error': {\n const err = new Error(msg.message || msg.code || 'Checkout failed');\n if (msg.code) (err as Error & { code?: string }).code = msg.code;\n intent.onError?.(err);\n break;\n }\n // tl:ready and tl:height are informational; the overlay has a fixed size.\n }\n };\n window.addEventListener('message', onMessage);\n };\n\n const offCheckout = tl.on('ui:checkout-requested', (p) => void open((p as CheckoutIntent) ?? {}));\n const offClose = tl.on('ui:modal-close-requested', () => close());\n\n return () => {\n offCheckout();\n offClose();\n close();\n };\n}\n", "/**\n * Buy-tickets modal manager (in-page, native Elements).\n *\n * The buy funnel (occurrence \u2192 ticket selection \u2192 add to cart) is pure\n * browse/cart with no PCI surface, so - unlike checkout - it does NOT need a\n * cross-origin iframe. This manager simply mounts the `<tl-buy-modal>` Element\n * on demand when something emits `ui:event-modal-requested` (a\n * `tl-buy-tickets-button`, a calendar date click, etc.) and removes it on close.\n * Because the modal is a normal Element bound to the same `window.Ticketlayer`,\n * it works identically on HBO and on any third-party embed.\n *\n * When the user proceeds to checkout, the manager hands the funnel over by\n * re-emitting `ui:checkout-requested` (forwarding the original caller's\n * callbacks): on a third-party embed the checkout modal opens the hosted\n * checkout in an iframe; on HBO the host navigates to /checkout in-page.\n */\nimport type { TicketlayerLive } from '../createLiveClient.js';\n\nexport interface BuyModalOptions {\n /** Override the custom-element tag (default `tl-buy-modal`). */\n tag?: string;\n}\n\ninterface BuyIntent {\n eventId: string;\n occurrenceId?: string;\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\n/** Wire the buy modal to the bus; returns an uninstall function. */\nexport function installBuyModal(tl: TicketlayerLive, opts: BuyModalOptions = {}): () => void {\n if (typeof window === 'undefined' || typeof document === 'undefined') return () => {};\n\n const TAG = opts.tag || 'tl-buy-modal';\n let el: HTMLElement | null = null;\n let current: BuyIntent | null = null;\n\n const remove = () => {\n if (el) {\n el.remove();\n el = null;\n }\n current = null;\n };\n\n const open = (intent: BuyIntent) => {\n if (!intent?.eventId) return;\n remove();\n current = intent;\n\n const node = document.createElement(TAG);\n // Set as attributes (strings) so they apply before the element upgrades.\n node.setAttribute('event-id', intent.eventId);\n if (intent.occurrenceId) node.setAttribute('occurrence-id', intent.occurrenceId);\n\n node.addEventListener('tlClose', () => {\n const i = current;\n remove();\n i?.onClose?.();\n });\n\n node.addEventListener('tlError', (e: Event) => {\n const message =\n (e as CustomEvent<{ message?: string }>).detail?.message || 'Could not load this event';\n current?.onError?.(new Error(message));\n });\n\n node.addEventListener('tlCheckout', () => {\n const i = current;\n remove();\n // Hand off to the checkout intent, forwarding the caller's callbacks so a\n // third-party site's onComplete still fires when the order completes.\n tl.emit('ui:checkout-requested', {\n onComplete: i?.onComplete,\n onError: i?.onError,\n onClose: i?.onClose,\n });\n });\n\n document.body.appendChild(node);\n el = node;\n };\n\n const offOpen = tl.on('ui:event-modal-requested', (p) => open((p as BuyIntent) ?? ({} as BuyIntent)));\n const offClose = tl.on('ui:modal-close-requested', () => remove());\n\n return () => {\n offOpen();\n offClose();\n remove();\n };\n}\n", "/**\n * Elements connector - adapts the stateful {@link TicketlayerLive} facade to the\n * structural interface `@ticketlayer/elements` components consume.\n *\n * Elements never import @ticketlayer/live directly: they bind to a generic\n * shape published on a window global (`setSDK(...)`), so the SDK and the\n * components can ship as separate bundles (e.g. the Elements CDN build). This\n * adapter is the bridge a host (HBO, a promoter site) installs:\n *\n * import { createLiveClient, createElementsConnector } from '@ticketlayer/live';\n * import { setSDK } from '@ticketlayer/elements';\n * const tl = await createLiveClient({ ... });\n * setSDK(createElementsConnector(tl));\n *\n * Two responsibilities the components expect that the facade doesn't expose 1:1:\n * - cart line items need a `categoryId` the components never pass; we resolve\n * it from the ticketTypeId captured when `getTicketTypes()` was called (the\n * ticket selector always loads types before adding - so the cache is warm).\n * - modal verbs (`event(id).openModal()`, `checkout.openModal()`, `closeModal()`)\n * are UI INTENTS: the SDK renders no UI, it relays them onto the shared bus\n * (ui:event-modal-requested / ui:checkout-requested / ui:modal-close-requested)\n * and the host opens the modal. Caller callbacks ride along in the payload.\n */\nimport type { TicketlayerLive, PresaleRedemption } from './createLiveClient.js';\n\ninterface CartLike {\n items?: Array<{ quantity?: number }>;\n [k: string]: unknown;\n}\n\nexport interface ModalOptions {\n occurrenceId?: string;\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\nexport interface ElementsConnector {\n getEventsManager(): {\n list(options?: { limit?: number; category?: string }): Promise<{ items: unknown[] }>;\n get(eventId: string): Promise<unknown>;\n getTicketTypes(eventId: string, occurrenceId: string): Promise<unknown[]>;\n };\n getCartManager(): {\n get(): Promise<unknown>;\n on(event: string, cb: (data: unknown) => void): () => void;\n off(event: string, cb: (data: unknown) => void): void;\n addItem(ticketTypeId: string, quantity: number, occurrenceId: string): Promise<unknown>;\n addItems(items: Array<{ ticketTypeId: string; quantity: number; occurrenceId: string }>): Promise<unknown>;\n removeItem(itemId: string): Promise<unknown>;\n addSeat(seatId: string, ticketTypeId: string, occurrenceId: string): Promise<unknown>;\n removeSeat(seatId: string, occurrenceId: string): Promise<unknown>;\n };\n getOrdersManager(): {\n mine(): Promise<unknown>;\n get(orderId: string): Promise<unknown>;\n ticketPdf(orderId: string, passId: string): Promise<Blob>;\n };\n /** Magic-link sign-in (tl-login, tl-my-orders). Never sees a password. */\n getAuthManager(): {\n readonly customer: unknown | null;\n readonly authenticated: boolean;\n requestMagicLink(contact: { email?: string; phone?: string }): Promise<unknown>;\n exchange(code: string): Promise<unknown>;\n logout(): Promise<void>;\n };\n /** Presale / promo codes (tl-promo-code). */\n getPresaleManager(): {\n redeem(code: string): Promise<PresaleRedemption>;\n };\n on(event: string, cb: (data: unknown) => void): () => void;\n off(event: string, cb: (data: unknown) => void): void;\n event(eventId: string): { openModal(options?: ModalOptions): void };\n checkout: { openModal(options?: ModalOptions): void; closeModal(): void };\n closeModal(): void;\n}\n\n/**\n * Adapt the sales-surface cart view to the shape Elements consume. The sales\n * view exposes `itemsSubtotal` + per-item `subtotal`; the components (tl-cart,\n * badges) were written against `subtotal`/`total`/`fees` + per-item\n * `totalPrice`. Add those aliases (and itemCount) without dropping the\n * originals - otherwise tl-cart formats undefined \u2192 \u00A3NaN. No fees concept on\n * the sales surface yet, so fees=0 and total=subtotal. Money stays minor units.\n */\nconst withCount = (cart: unknown): unknown => {\n if (!cart || typeof cart !== 'object') return cart;\n const c = cart as CartLike & { itemsSubtotal?: number };\n const items: Array<Record<string, unknown>> = (c.items ?? []).map((i) => {\n const it = i as Record<string, unknown>;\n const qty = (it.quantity as number) ?? 0;\n const line = (it.subtotal as number) ?? (it.unitPrice as number) * qty;\n return { ...it, totalPrice: it.totalPrice ?? line };\n });\n const itemCount = items.reduce((sum, i) => sum + ((i.quantity as number) ?? 0), 0);\n const subtotal = c.itemsSubtotal ?? (c as { subtotal?: number }).subtotal ?? 0;\n return {\n ...c,\n items,\n itemCount,\n subtotal,\n fees: (c as { fees?: number }).fees ?? 0,\n total: (c as { total?: number }).total ?? subtotal,\n };\n};\n\nexport function createElementsConnector(tl: TicketlayerLive): ElementsConnector {\n // ticketTypeId \u2192 { categoryId, occurrenceId }, captured on getTicketTypes so\n // addItem/addSeat can supply the categoryId the cart API requires.\n const ttMeta = new Map<string, { categoryId: string; occurrenceId: string }>();\n\n const resolve = (ticketTypeId: string, occurrenceId?: string) => {\n const meta = ttMeta.get(ticketTypeId);\n if (!meta?.categoryId) {\n throw new Error(\n `[live] No category known for ticket type ${ticketTypeId}. ` +\n `Load the occurrence's ticket types (getTicketTypes) before adding it to the cart.`\n );\n }\n return { categoryId: meta.categoryId, occurrenceId: occurrenceId || meta.occurrenceId };\n };\n\n const eventsManager = {\n async list(options?: { limit?: number; category?: string }) {\n const res = (await tl.events.list()) as {\n listings?: Array<{\n id: string;\n eventId?: string;\n name?: string | null;\n shortDescription?: string | null;\n imageUrl?: string | null;\n venueName?: string | null;\n venueCity?: string | null;\n nextOccurrenceAt?: string | null;\n }>;\n } | null;\n // Adapt the sales-surface LISTING shape to the structural shape\n // tl-event-card consumes. Two shape gaps the card otherwise renders blank:\n // - venue/date are flat (venueName/venueCity/nextOccurrenceAt) on the\n // listing but nested (venue.{name,city} / nextOccurrence.startsAt) on\n // the card.\n // - the card reads `imageUrl`; the listing already carries it (surface\n // explicitly rather than relying on a passthrough spread).\n // A listing's own id is the channel-listing id (lst_/schl_), but cards\n // navigate by EVENT id, so we surface eventId as `id`.\n let items = (res?.listings ?? []).map((l) => ({\n id: l.eventId ?? l.id,\n name: l.name ?? '',\n ...(l.shortDescription ? { shortDescription: l.shortDescription } : {}),\n ...(l.imageUrl ? { imageUrl: l.imageUrl } : {}),\n ...(l.venueName\n ? { venue: { id: '', name: l.venueName, city: l.venueCity ?? '' } }\n : {}),\n ...(l.nextOccurrenceAt ? { nextOccurrence: { startsAt: l.nextOccurrenceAt } } : {}),\n availabilityStatus: 'available' as const,\n }));\n if (options?.limit) items = items.slice(0, options.limit);\n return { items };\n },\n get: (eventId: string) => tl.events.get(eventId),\n async getTicketTypes(eventId: string, occurrenceId: string) {\n const ev = (await tl.events.get(eventId)) as {\n occurrences?: Array<{\n id: string;\n ticketTypes?: Array<{\n ticketTypeId: string;\n ticketTypeName: string;\n description: string | null;\n categoryId: string;\n categoryName: string;\n unitPrice: number;\n currency: string;\n }>;\n }>;\n } | null;\n const occ =\n ev?.occurrences?.find((o) => o.id === occurrenceId) ?? ev?.occurrences?.[0];\n const tts = occ?.ticketTypes ?? [];\n return tts.map((tt) => {\n if (occ) ttMeta.set(tt.ticketTypeId, { categoryId: tt.categoryId, occurrenceId: occ.id });\n return {\n id: tt.ticketTypeId,\n name: tt.ticketTypeName,\n description: tt.description,\n price: tt.unitPrice, // minor units; components divide by 100 to display\n currency: tt.currency,\n categoryId: tt.categoryId,\n categoryName: tt.categoryName,\n // The sales surface view doesn't expose per-order limits/remaining yet;\n // sensible defaults until the catalogue view carries them.\n maxPerOrder: 10,\n available: 999,\n };\n });\n },\n };\n\n const cartManager = {\n // Cache-first. The SDK keeps `_cart` authoritative - mutations update it and\n // every `cart:updated` carries the full cart - so Elements reading the cart\n // must NOT each trigger a GET. We return the cached cart and only fetch when\n // nothing is cached yet. This stops the fetch storm when several cart-aware\n // Elements mount, and breaks any cart:updated \u2192 get() \u2192 refresh \u2192\n // cart:updated feedback loop (which was tripping the rate limiter).\n get: async () => withCount(tl.cart.current ?? (await tl.cart.refresh())),\n on: (event: string, cb: (data: unknown) => void) =>\n tl.on(event as never, (p) => cb(event === 'cart:updated' ? withCount(p) : p)),\n off: (event: string, cb: (data: unknown) => void) => tl.off(event as never, cb),\n addItem: async (ticketTypeId: string, quantity: number, occurrenceId: string) => {\n const { categoryId, occurrenceId: occ } = resolve(ticketTypeId, occurrenceId);\n return withCount(await tl.cart.add({ eventOccurrenceId: occ, categoryId, ticketTypeId, quantity }));\n },\n addItems: async (items: Array<{ ticketTypeId: string; quantity: number; occurrenceId: string }>) => {\n let last: unknown = tl.cart.current;\n for (const it of items) last = await cartManager.addItem(it.ticketTypeId, it.quantity, it.occurrenceId);\n return last;\n },\n removeItem: async (itemId: string) => withCount(await tl.cart.remove(itemId)),\n addSeat: async (seatId: string, ticketTypeId: string, occurrenceId: string) => {\n const { categoryId, occurrenceId: occ } = resolve(ticketTypeId, occurrenceId);\n return withCount(\n await tl.cart.add({ eventOccurrenceId: occ, categoryId, ticketTypeId, eventLayoutSeatIds: [seatId] })\n );\n },\n removeSeat: async (_seatId: string, _occurrenceId: string) => {\n // The cart line-item view doesn't expose seat ids, so seat\u2192lineItem can't\n // be mapped here yet. Seat removal flows through removeItem(itemId) until\n // the view carries seat references.\n console.warn('[live] removeSeat is a no-op until cart items expose seat ids; use removeItem(itemId).');\n return withCount((await tl.cart.refresh()) ?? tl.cart.current);\n },\n };\n\n const ordersManager = {\n mine: () => tl.orders.mine(),\n get: (orderId: string) => tl.orders.get(orderId),\n ticketPdf: (orderId: string, passId: string) => tl.orders.ticketPdf(orderId, passId),\n };\n\n // Getters read the facade's session state live, so a component that asks\n // after auth:changed sees the new customer without holding its own copy.\n const authManager = {\n get customer() {\n return tl.auth.customer;\n },\n get authenticated() {\n return tl.auth.authenticated;\n },\n requestMagicLink: (contact: { email?: string; phone?: string }) => tl.auth.requestMagicLink(contact),\n exchange: (code: string) => tl.auth.exchange(code),\n logout: () => tl.auth.logout(),\n };\n\n const presaleManager = {\n redeem: (code: string) => tl.presale.redeem(code),\n };\n\n return {\n getEventsManager: () => eventsManager,\n getCartManager: () => cartManager,\n getOrdersManager: () => ordersManager,\n getAuthManager: () => authManager,\n getPresaleManager: () => presaleManager,\n on: (event: string, cb: (data: unknown) => void) => tl.on(event as never, cb),\n off: (event: string, cb: (data: unknown) => void) => tl.off(event as never, cb),\n event: (eventId: string) => ({\n openModal: (options: ModalOptions = {}) => tl.emit('ui:event-modal-requested', { eventId, ...options }),\n }),\n checkout: {\n openModal: (options: ModalOptions = {}) => tl.emit('ui:checkout-requested', options),\n closeModal: () => tl.emit('ui:modal-close-requested'),\n },\n closeModal: () => tl.emit('ui:modal-close-requested'),\n };\n}\n", "/**\n * Bidirectional event bus shared by the SDK, Elements, and the host app.\n *\n * Two directions:\n * - STATE events the SDK pushes OUT so Elements re-render (cart:updated, \u2026).\n * - UI INTENTS Elements/host push IN for someone else to act on\n * (ui:checkout-requested, ui:event-modal-requested, \u2026) - e.g. a\n * tl-buy-tickets-button emits ui:event-modal-requested and HBO opens the\n * modal. The SDK itself doesn't render UI; it just relays.\n */\nexport type LiveEvent =\n // State (SDK \u2192 subscribers)\n | 'session:changed'\n | 'cart:updated'\n | 'auth:changed'\n | 'checkout:completed'\n | 'error'\n // UI intents (Elements/host \u2192 subscribers)\n | 'ui:event-modal-requested'\n | 'ui:checkout-requested'\n | 'ui:cart-requested'\n | 'ui:login-requested'\n | 'ui:modal-close-requested';\n\ntype Handler = (payload?: unknown) => void;\n\nexport class Emitter {\n private handlers = new Map<LiveEvent, Set<Handler>>();\n\n /** Subscribe; returns an unsubscribe function. */\n on(event: LiveEvent, handler: Handler): () => void {\n if (!this.handlers.has(event)) this.handlers.set(event, new Set());\n this.handlers.get(event)!.add(handler);\n return () => this.off(event, handler);\n }\n\n off(event: LiveEvent, handler: Handler): void {\n this.handlers.get(event)?.delete(handler);\n }\n\n emit(event: LiveEvent, payload?: unknown): void {\n this.handlers.get(event)?.forEach((h) => {\n try {\n h(payload);\n } catch (err) {\n console.error(`[live] handler for ${event} threw`, err);\n }\n });\n }\n}\n", "/**\n * Apply a resolved channel theme to the document as CSS custom properties\n * (browser only; SSR-safe no-op).\n *\n * The token contract spans two consumers that share one var namespace:\n * - HBO's Tailwind v4 `@theme` maps `--color-primary: var(--tl-primary, \u2026)`.\n * - Elements read a mix of `--tl-primary` AND `--tl-color-primary`.\n * So colors are emitted under BOTH prefixes. The theme's `destructive` is also\n * aliased to the `error` name Elements use. Keys are camelCase on the theme and\n * kebab-case as CSS vars (primaryForeground \u2192 --tl-primary-foreground).\n */\ninterface ResolvedTheme {\n colors?: Record<string, string>;\n typography?: Record<string, string | number>;\n shape?: Record<string, string>;\n brand?: Record<string, string>;\n}\n\nconst STYLE_ID = 'tl-theme-vars';\nconst kebab = (s: string) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n\n// camelCase typography key \u2192 the CSS var suffix HBO's @theme / fallbacks expect.\nconst TYPOGRAPHY_VARS: Record<string, string> = {\n fontFamily: 'font-family',\n fontFamilyMono: 'font-family-mono',\n baseSize: 'font-size-base',\n scaleRatio: 'font-scale',\n};\n\nexport function applyTheme(theme: ResolvedTheme | null | undefined): void {\n if (!theme || typeof document === 'undefined') return;\n\n const vars: string[] = [];\n const push = (name: string, value: unknown) => {\n if (value === undefined || value === null) return;\n vars.push(`--tl-${name}: ${String(value)};`);\n };\n\n // Colors: emit both --tl-<name> and --tl-color-<name>; alias destructive\u2192error.\n for (const [key, value] of Object.entries(theme.colors ?? {})) {\n const name = kebab(key);\n push(name, value);\n push(`color-${name}`, value);\n if (key === 'destructive') {\n push('error', value);\n push('color-error', value);\n }\n if (key === 'destructiveForeground') {\n push('error-foreground', value);\n push('color-error-foreground', value);\n }\n }\n\n for (const [key, value] of Object.entries(theme.typography ?? {})) {\n push(TYPOGRAPHY_VARS[key] ?? kebab(key), value);\n }\n for (const [key, value] of Object.entries(theme.shape ?? {})) {\n push(kebab(key), value); // radiusMd \u2192 radius-md\n }\n\n let style = document.getElementById(STYLE_ID) as HTMLStyleElement | null;\n if (!style) {\n style = document.createElement('style');\n style.id = STYLE_ID;\n document.head.appendChild(style);\n }\n style.textContent = `:root {\\n ${vars.join('\\n ')}\\n}`;\n}\n", "/**\n * Runtime-neutral core of the Live client.\n *\n * Nothing in this module reads `window`, `document` or `location`: it is the\n * shared state layer (session, cart, auth, orders, the event bus) that both\n * adapters build on - `createLiveClient` (browser: cookie or token transport,\n * page defaults, window publishing, modals) and `createNativeLiveClient`\n * (React Native: injected token storage, X-Live-Session header, no page).\n * `theme.apply()` delegates to applyTheme, which is a no-op without a document.\n */\nimport { LiveClient, LiveAPIError } from '../client.js';\nimport { Emitter, type LiveEvent } from '../state/emitter.js';\nimport { applyTheme } from '../state/theme.js';\n\n/**\n * Stateful ergonomic layer over the generated LiveClient.\n *\n * The generated client is stateless REST; Elements and HBO need a stateful,\n * reactive surface (a session-owned cart, cart:updated events, theme\n * application, auth state). This class provides that, COORDINATING with the\n * live-api session - which owns the cartId server-side - rather than holding a\n * second source of truth: on start it loads the session's existing cart, and\n * cart mutations both update local state AND ride the same session upstream.\n */\n\nexport interface SessionState {\n channelId: string | null;\n customer: unknown | null;\n authenticated: boolean;\n}\n\n/** Result of redeeming a presale/promo code (POST /sales/presale-codes/redeem). */\nexport interface PresaleRedemption {\n benefit: string;\n alreadyHeld: boolean;\n}\n\nexport interface CartItemInput {\n eventOccurrenceId: string;\n categoryId: string;\n ticketTypeId: string;\n quantity?: number;\n eventLayoutAreaId?: string;\n eventLayoutSeatIds?: string[];\n}\n\n/**\n * Pull a named field from a response, tolerating the generator's\n * single-property auto-unwrapping: some methods return `{ cart }`, others\n * already return the cart itself. If `key` is present we use it; otherwise the\n * value is assumed to be the already-unwrapped payload.\n */\nconst field = <T>(obj: unknown, key: string): T | undefined => {\n if (obj && typeof obj === 'object' && !Array.isArray(obj) && key in obj) {\n return (obj as Record<string, unknown>)[key] as T;\n }\n return obj as T | undefined;\n};\n\nexport class TicketlayerLive {\n /** The underlying generated client (escape hatch for un-wrapped calls). */\n readonly client: LiveClient;\n\n private emitter = new Emitter();\n private sessionMode: 'cookie' | 'token';\n private publishableKey: string | undefined;\n private domain: string | undefined;\n private baseUrl: string;\n // A session is created LAZILY - only when something mutates state (cart/login).\n // Browsing uses the publishable key as read auth, so most visitors never get\n // a session (no per-visitor Redis write).\n private _sessionStarted = false;\n private _sessionStarting: Promise<void> | null = null;\n\n private _session: SessionState = { channelId: null, customer: null, authenticated: false };\n private _cart: unknown | null = null;\n private _cartId: string | null = null;\n\n // Namespaces are built in the constructor so their getters/methods close over\n // the instance (`self`) correctly - object-literal getters don't bind `this`.\n readonly events!: { list: () => Promise<unknown>; get: (eventId: string) => Promise<unknown> };\n readonly theme!: { get: () => Promise<unknown>; apply: () => Promise<unknown> };\n readonly cart!: {\n readonly current: unknown | null;\n readonly id: string | null;\n ensure: () => Promise<string>;\n add: (item: CartItemInput) => Promise<unknown>;\n remove: (itemId: string) => Promise<unknown>;\n refresh: () => Promise<unknown>;\n checkout: (opts?: { customerNotes?: string }) => Promise<unknown>;\n };\n readonly auth!: {\n readonly customer: unknown | null;\n readonly authenticated: boolean;\n requestMagicLink: (contact: { email?: string; phone?: string }) => Promise<unknown>;\n exchange: (proof: string | { type: string; code?: string; assertion?: string }) => Promise<unknown>;\n logout: () => Promise<void>;\n };\n readonly orders!: {\n mine: () => Promise<unknown>;\n get: (orderId: string) => Promise<unknown>;\n ticketPdf: (orderId: string, passId: string) => Promise<Blob>;\n };\n readonly payments!: {\n begin: (orderId: string, opts?: { paymentType?: string; returnUrl?: string }) => Promise<unknown>;\n };\n readonly presale!: {\n redeem: (code: string) => Promise<PresaleRedemption>;\n };\n readonly queue!: { status: () => Promise<unknown>; join: () => Promise<unknown> };\n\n constructor(\n client: LiveClient,\n opts: { sessionMode: 'cookie' | 'token'; publishableKey?: string; domain?: string; baseUrl: string }\n ) {\n this.client = client;\n this.sessionMode = opts.sessionMode;\n this.publishableKey = opts.publishableKey;\n this.domain = opts.domain;\n this.baseUrl = opts.baseUrl.replace(/\\/$/, '');\n\n const self = this;\n\n this.events = {\n list: () => self.client.salesListings.list(),\n get: (eventId) => self.client.sales.get(eventId).then((d) => field(d, 'event')),\n };\n\n this.theme = {\n get: () => self.client.sales.getTheme().then((d) => field(d, 'theme')),\n apply: async () => {\n const theme = await self.theme.get();\n applyTheme(theme as never);\n return theme;\n },\n };\n\n this.cart = {\n get current() {\n return self._cart;\n },\n get id() {\n return self._cartId;\n },\n ensure: async () => {\n if (!self._cartId) {\n // First mutation \u2192 create the session lazily, then the cart.\n await self.ensureSession();\n const res = await self.client.salesCarts.create({});\n const cart = field<{ id: string }>(res, 'cart');\n self._cartId = cart?.id ?? null;\n self._setCart(cart);\n }\n return self._cartId!;\n },\n add: async (item) => {\n const id = await self.cart.ensure();\n try {\n const res = await self.client.salesCarts.addItem(id, item);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // The server-side reservation lapsed under us. Drop the dead cart,\n // mint a fresh one and re-add - adding tickets should just work.\n self._resetCart();\n const freshId = await self.cart.ensure();\n const res = await self.client.salesCarts.addItem(freshId, item);\n self._setCart(field(res, 'cart'));\n return self._cart;\n }\n },\n remove: async (itemId) => {\n if (!self._cartId) return self._cart;\n try {\n const res = await self.client.salesCarts.removeItem(self._cartId, itemId);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // Nothing to remove from an expired cart - clear it locally and let\n // the UI fall through to an empty cart rather than surfacing an error.\n self._resetCart();\n return self._cart;\n }\n },\n refresh: async () => {\n if (!self._cartId) return self._cart;\n try {\n const res = await self.client.salesCarts.get(self._cartId);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // A stale cartId carried in from a prior session/page load. Forget it\n // so the next mutation starts a clean cart.\n self._resetCart();\n return self._cart;\n }\n },\n checkout: async (opts = {}) => {\n if (!self._cartId) throw new Error('No cart to check out');\n try {\n const res = await self.client.salesCarts.checkout(self._cartId, opts as never);\n self._cartId = null;\n self._setCart(null);\n self.emitter.emit('checkout:completed', field(res, 'order'));\n return res; // { cart, order, orderAccessToken }\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // Can't check out an expired cart - clear it and surface a clear,\n // actionable error instead of the raw 409.\n self._resetCart();\n throw new LiveAPIError(\n 'Your cart has expired. Please add your tickets again.',\n 'CART_EXPIRED',\n 409,\n );\n }\n },\n };\n\n this.auth = {\n get customer() {\n return self._session.customer;\n },\n get authenticated() {\n return self._session.authenticated;\n },\n requestMagicLink: (contact) => self.client.salesCustomerAuth.magicLink(contact),\n exchange: async (proof) => {\n // Exchanging a proof binds a customer to THIS session \u2192 ensure one exists.\n await self.ensureSession();\n const body = typeof proof === 'string' ? { type: 'magic_link', code: proof } : proof;\n const res = await self.client.salesCustomerTokens.create({ proof: body });\n self._session = {\n ...self._session,\n customer: field(res, 'customer') ?? null,\n authenticated: true,\n };\n self.emitter.emit('auth:changed', self._session);\n return res;\n },\n logout: async () => {\n await self.client.session.end().catch(() => undefined);\n self._session = { channelId: self._session.channelId, customer: null, authenticated: false };\n self._cart = null;\n self._cartId = null;\n self.emitter.emit('auth:changed', self._session);\n },\n };\n\n this.orders = {\n mine: () => self.client.salesMyOrders.list().then((d) => field(d, 'orders')),\n get: (orderId) => self.client.salesOrders.get(orderId).then((d) => field(d, 'order')),\n // Binary download - bypasses the generated (JSON) client; fetches the PDF\n // with the same session credentials.\n ticketPdf: async (orderId, passId) => {\n const headers: Record<string, string> = {};\n if (self.publishableKey) headers['Authorization'] = `Bearer ${self.publishableKey}`;\n if (self.sessionMode === 'token') {\n const token = await self.client.getSessionToken();\n if (token) headers['X-Live-Session'] = token;\n }\n const res = await fetch(\n `${self.baseUrl}/sales/orders/${orderId}/passes/${passId}/ticket.pdf`,\n { headers, credentials: self.sessionMode === 'cookie' ? 'include' : 'same-origin' },\n );\n if (!res.ok) throw new LiveAPIError(`Failed to download ticket (${res.status})`, 'TICKET_PDF_FAILED', res.status);\n return res.blob();\n },\n };\n\n this.payments = {\n begin: (orderId, opts = {}) =>\n self.client.salesOrderPayments.create(orderId, opts as never).then((d) => field(d, 'payment')),\n };\n\n this.presale = {\n // POST /sales/presale-codes/redeem - needs a signed-in customer. Gated\n // pricing unlocks immediately, so re-read the cart and let cart:updated\n // carry the new totals to subscribers. A failed refresh must not undo a\n // redemption that already succeeded.\n redeem: async (code) => {\n const res = (await self.client.salesPresaleCodes.redeem({ code: code.trim() })) as PresaleRedemption;\n if (self._cartId) await self.cart.refresh().catch(() => undefined);\n return res;\n },\n };\n\n this.queue = {\n status: () => self.client.queue.status(),\n join: () => self.client.queue.join(),\n };\n }\n\n /** Subscribe to a state event or UI intent; returns an unsubscribe fn. */\n on(event: LiveEvent, handler: (payload?: unknown) => void): () => void {\n return this.emitter.on(event, handler);\n }\n off(event: LiveEvent, handler: (payload?: unknown) => void): void {\n this.emitter.off(event, handler);\n }\n /**\n * Push an event onto the shared bus. Used by Elements/host to raise UI\n * intents (e.g. ui:checkout-requested) that the host app acts on - the SDK\n * relays but does not render UI itself.\n */\n emit(event: LiveEvent, payload?: unknown): void {\n this.emitter.emit(event, payload);\n }\n\n get session(): Readonly<SessionState> {\n return this._session;\n }\n\n /** True once a session has been created/resumed (i.e. a mutation has happened). */\n get hasSession(): boolean {\n return this._sessionStarted;\n }\n\n /**\n * Create the Live session on demand and hydrate state - idempotent and\n * single-flight. Called lazily before the first mutation (cart/login); NOT on\n * page load, so browsing never creates a session. Channel is identified by the\n * publishable key (embed) or the storefront domain (hosted).\n */\n async ensureSession(): Promise<void> {\n if (this._sessionStarted) return;\n if (this._sessionStarting) return this._sessionStarting;\n\n this._sessionStarting = (async () => {\n // Embed (token transport) authenticates the session by publishable key;\n // hosted (cookie transport) by storefront domain.\n const startBody: Record<string, string> = {};\n if (this.sessionMode === 'token' && this.publishableKey) {\n startBody.channelKey = this.publishableKey;\n } else if (this.domain) {\n startBody.domain = this.domain;\n } else if (this.publishableKey) {\n startBody.channelKey = this.publishableKey;\n }\n\n const started = await this.client.session.start(startBody as never);\n if (this.sessionMode === 'token') {\n const token = field<string>(started, 'sessionToken');\n if (token) await this.client.setSessionToken(token);\n }\n this._sessionStarted = true;\n await this.refreshSession();\n })();\n\n try {\n await this._sessionStarting;\n } finally {\n this._sessionStarting = null;\n }\n }\n\n /** @deprecated Use ensureSession(); kept for back-compat. */\n async start(opts: { domain?: string } = {}): Promise<void> {\n if (opts.domain) this.domain = opts.domain;\n return this.ensureSession();\n }\n\n /**\n * Rehydrate an ALREADY-EXISTING session (hosted/cookie transport) without\n * creating one. On a page load/refresh the client is lazily session-less, but\n * a returning visitor may still hold the `live_session` cookie with a cart\n * server-side. This probes `GET /session` (a cheap read - it 401s when no\n * session exists, and never writes one): on success it binds this client to\n * that session and pulls the cart back in; on 401 it stays session-less so\n * browsing still creates no session. Marking `_sessionStarted` on success is\n * load-bearing - otherwise the next mutation's ensureSession() would POST a\n * fresh session and orphan the existing cart.\n *\n * @returns true if an existing session was resumed.\n */\n async resumeIfExists(): Promise<boolean> {\n if (this._sessionStarted) return true;\n try {\n await this.refreshSession();\n this._sessionStarted = true;\n return true;\n } catch {\n // 401 NO_SESSION (or transient) \u2192 no session to resume; remain lazy.\n return false;\n }\n }\n\n /**\n * Resume an EXISTING session by token instead of bootstrapping a new one.\n * Used by the embedded checkout iframe: the third-party page hands off its\n * session token so the iframe sees the same cart/channel (token transport).\n */\n async resume(token: string): Promise<void> {\n await this.client.setSessionToken(token);\n this._sessionStarted = true;\n await this.refreshSession();\n }\n\n /** The current session token (token mode), for handing off to an embed iframe. */\n getSessionToken(): Promise<string | null> {\n return this.client.getSessionToken();\n }\n\n /** Re-read session state (customer, auth, cart) from the live-api session. */\n async refreshSession(): Promise<void> {\n const cur = await this.client.session.current();\n this._session = {\n channelId: field<{ id: string }>(cur, 'channel')?.id ?? null,\n customer: field(cur, 'customer') ?? null,\n authenticated: !!field<boolean>(cur, 'authenticated'),\n };\n const cartId = field<string>(cur, 'cartId') ?? null;\n if (cartId) {\n this._cartId = cartId;\n await this.cart.refresh();\n }\n this.emitter.emit('session:changed', this._session);\n }\n\n /**\n * Forget that a session was started, so the next mutation or sign-in mints a\n * fresh one. For adapters whose process outlives the session (a native app\n * signing out, a stored token the API rejected); a browser page reloads instead.\n */\n protected _resetSessionStarted(): void {\n this._sessionStarted = false;\n this._sessionStarting = null;\n }\n\n private _setCart(cart: unknown): void {\n this._cart = cart ?? null;\n this.emitter.emit('cart:updated', this._cart);\n }\n\n /**\n * True when an API error means the server-side cart is no longer usable -\n * it expired (reservation TTL lapsed), was already checked out, or can't be\n * found. The SDK holds the cartId in memory and rehydrates it from the\n * server session on load, so a lapsed cart would otherwise wedge every\n * subsequent add/remove/checkout with a 409.\n */\n private _isCartGone(err: unknown): boolean {\n if (!(err instanceof LiveAPIError)) return false;\n return (\n err.code === 'CART_EXPIRED' ||\n err.code === 'CART_NOT_ACTIVE' ||\n err.code === 'CART_NOT_FOUND' ||\n err.status === 404\n );\n }\n\n /** Forget all local cart state and notify subscribers the cart is now empty. */\n private _resetCart(): void {\n this._cartId = null;\n this._setCart(null);\n }\n}\n", "import { LiveClient, type LiveClientConfig } from './client.js';\nimport { publishClient } from './state/registry.js';\nimport { loadElements, type LoadElementsOptions } from './state/loadElements.js';\nimport { installCheckoutModal, type CheckoutModalOptions } from './state/checkoutModal.js';\nimport { installBuyModal } from './state/buyModal.js';\nimport { createElementsConnector } from './elements.js';\nimport { API_DATED_VERSION } from './client.js';\nimport { TicketlayerLive } from './core/liveClient.js';\n\n/**\n * Browser adapter over the runtime-neutral core in ./core/liveClient.ts:\n * resolves the channel from the page host, picks the session transport\n * (cookie for a hosted storefront, token for embeds), publishes the client on\n * `window.Ticketlayer`, applies the theme and mounts the modals. The class\n * itself is re-exported here so existing imports keep working.\n */\nexport { TicketlayerLive };\nexport type { PresaleRedemption, SessionState, CartItemInput } from './core/liveClient.js';\n\nexport interface CreateLiveClientOptions extends LiveClientConfig, LoadElementsOptions {\n /** Storefront host to resolve the channel from (hosted mode). Defaults to the page host. */\n domain?: string;\n /** Bootstrap the session immediately (default true). */\n autoStart?: boolean;\n /** Fetch + apply the channel theme on start (default true in the browser). */\n applyTheme?: boolean;\n /**\n * Publish this client on `window.Ticketlayer` so Elements can find + bind to\n * it (default true in the browser). Set false to keep the client private.\n */\n publish?: boolean;\n /**\n * Resume an existing session by token (token transport) instead of\n * bootstrapping a new one. Used by the embedded checkout iframe to inherit\n * the parent page's cart/session. Forces sessionMode 'token'.\n */\n sessionToken?: string;\n /**\n * Checkout rendering. 'modal' (third-party embeds) auto-opens the hosted\n * checkout in an iframe overlay on `ui:checkout-requested`. Omit on HBO,\n * which handles that intent by navigating to /checkout in-page.\n */\n checkout?: { mode: 'modal' } & CheckoutModalOptions;\n /**\n * Mount the in-page buy-tickets modal (occurrence \u2192 ticket selection) on\n * `ui:event-modal-requested`. Native Elements overlay, no iframe - works on\n * HBO and embeds alike. Defaults to true in the browser for the published\n * client; set false to opt out.\n */\n buyModal?: boolean;\n}\n\n\n/** Resolve a hosted storefront's publishable key by domain (GET /channel). */\nasync function resolveChannelKey(baseUrl: string, domain: string): Promise<string | undefined> {\n try {\n const res = await fetch(\n `${baseUrl.replace(/\\/$/, '')}/channel?domain=${encodeURIComponent(domain)}`,\n { headers: { accept: 'application/json' } }\n );\n if (!res.ok) return undefined;\n const json = (await res.json()) as { data?: { publishableKey?: string } };\n return json?.data?.publishableKey;\n } catch {\n return undefined;\n }\n}\n\nexport async function createLiveClient(options: CreateLiveClientOptions): Promise<TicketlayerLive> {\n const domain =\n options.domain ?? (typeof window !== 'undefined' ? window.location.host : undefined);\n\n // Resolve the channel's publishable key - the READ credential. Embeds pass it\n // directly; a hosted storefront resolves it ONCE by domain and then uses it\n // for all reads (no per-read domain lookup, no session). Browsing never\n // creates a session - that happens lazily on the first mutation/login.\n let publishableKey = options.publishableKey;\n if (!publishableKey && !options.sessionToken && domain) {\n publishableKey = await resolveChannelKey(options.baseUrl, domain);\n }\n\n // Transport: embed/handoff use the header (token); a hosted storefront uses\n // the cookie for its (lazily-created) session.\n const isEmbed = !!options.publishableKey || !!options.sessionToken;\n const sessionMode = options.sessionMode ?? (isEmbed ? 'token' : 'cookie');\n const client = new LiveClient({\n ...options,\n sessionMode,\n ...(publishableKey ? { publishableKey } : {}),\n });\n const tl = new TicketlayerLive(client, {\n sessionMode,\n baseUrl: options.baseUrl,\n ...(publishableKey ? { publishableKey } : {}),\n ...(domain ? { domain } : {}),\n });\n\n // Publish the singleton + Elements connector so Elements bind immediately.\n if (options.publish !== false && typeof window !== 'undefined') {\n publishClient(tl, createElementsConnector(tl), API_DATED_VERSION);\n }\n\n // Third-party embeds: auto-open the hosted checkout iframe on checkout intents.\n if (options.checkout?.mode === 'modal' && typeof window !== 'undefined') {\n installCheckoutModal(tl, options.checkout);\n }\n\n // In-page buy-tickets modal (occurrence \u2192 ticket selection). Native Elements\n // overlay mounted on `ui:event-modal-requested`; works on HBO and embeds. Tied\n // to the published client (the one driving on-page UI), opt out via buyModal.\n if (options.buyModal !== false && options.publish !== false && typeof window !== 'undefined') {\n installBuyModal(tl);\n }\n\n const elementsLoad = loadElements(options).catch((err) => {\n console.error('[live] Elements auto-load failed', err);\n });\n\n if (options.autoStart !== false) {\n // Embed iframe resumes a handed-off session; everyone else stays\n // session-less until the first mutation. Theme applies via the pk.\n if (options.sessionToken) {\n await tl.resume(options.sessionToken);\n } else if (sessionMode === 'cookie' && typeof window !== 'undefined') {\n // Hosted browser: if a session cookie already exists (a returning visitor\n // mid-purchase, or a refresh/deep-link), rehydrate its cart without\n // creating a session. A brand-new visitor 401s here and stays lazy.\n await tl.resumeIfExists().catch(() => undefined);\n }\n if (options.applyTheme !== false && typeof window !== 'undefined') {\n await tl.theme.apply().catch(() => undefined);\n }\n }\n\n await elementsLoad;\n return tl;\n}\n"],
5
- "mappings": "mcAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,qBAAAE,EAAA,SAAAC,EAAA,qBAAAC,ICIO,IAAMC,EAAW,oBACXC,EAAc,QC2BpB,IAAMC,EAAoB,aAGjC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AAwB,QAAQ,QAAQ,IAAI,EAErE,IAAME,EAAMP,GAAU,EACtB,GAAI,EAACO,GAAA,MAAAA,EAAK,gBAAgB,OAAO,QAAQ,QAAQ,IAAI,EACrD,GAAI,CAACA,EAAI,OACP,eAAQ,MAAM,2EAA2E,EAClF,QAAQ,QAAQ,IAAI,EAG7BD,EAAE,WAAa,GACf,IAAME,EAAQC,EAAiB,CAC7B,QAASF,EAAI,OACb,eAAgBA,EAAI,eACpB,SAAUA,EAAI,aACd,GAAIA,EAAI,YAAc,CAAE,YAAaA,EAAI,WAAW,EAAK,CAAA,EACzD,SAAU,CAAE,KAAM,QAAS,GAAIA,EAAI,aAAe,CAAE,aAAcA,EAAI,YAAY,EAAK,CAAA,CAAG,EAC3F,EAAE,MAAOG,IACR,QAAQ,MAAM,sCAAuCA,CAAG,EACjD,KACR,EAED,OAAAJ,EAAE,YAAc,CAAE,MAAAE,CAAK,EAChBA,CACT,CAMKG,EAAI",
6
- "names": ["auto_exports", "__export", "TicketlayerLive", "boot", "createLiveClient", "SDK_NAME", "SDK_VERSION", "API_DATED_VERSION", "describeRuntime", "_a", "_b", "_c", "g", "SDK_CLIENT_HEADER", "SDK_NAME", "SDK_VERSION", "memoryTokenStorage", "token", "LiveAPIError", "message", "code", "status", "LiveClient", "config", "_d", "request", "cartId", "itemId", "orderId", "passId", "customerId", "options", "params", "queryString", "requestPath", "eventId", "path", "url", "headers", "response", "text", "json", "error", "TICKETLAYER_GLOBAL_KEY", "TICKETLAYER_READY_EVENT", "ensureRegistry", "version", "w", "reg", "resolve", "publishClient", "client", "sdk", "resolvers", "r", "DEFAULT_ELEMENTS_URL", "SENTINEL_TAG", "inFlight", "loadElements", "opts", "_a", "ce", "url", "existing", "p", "resolve", "reject", "script", "OVERLAY_ID", "PRIVACY_URL", "REPORT_URL", "SITE_URL", "footerHtml", "logo", "link", "href", "label", "installCheckoutModal", "tl", "opts", "onMessage", "close", "_a", "open", "intent", "token", "base", "query", "url", "frameOrigin", "overlay", "wrapper", "frame", "footer", "e", "_b", "_c", "msg", "legacy", "order", "err", "offCheckout", "p", "offClose", "installBuyModal", "tl", "opts", "TAG", "el", "current", "remove", "open", "intent", "node", "_a", "i", "e", "_b", "message", "offOpen", "p", "offClose", "withCount", "cart", "_a", "_b", "_c", "_d", "_e", "c", "items", "i", "it", "qty", "line", "itemCount", "sum", "subtotal", "createElementsConnector", "tl", "ttMeta", "resolve", "ticketTypeId", "occurrenceId", "meta", "eventsManager", "options", "res", "l", "eventId", "ev", "occ", "o", "tt", "cartManager", "event", "cb", "p", "quantity", "categoryId", "last", "itemId", "seatId", "_seatId", "_occurrenceId", "ordersManager", "orderId", "passId", "authManager", "contact", "code", "presaleManager", "Emitter", "event", "handler", "_a", "payload", "h", "err", "STYLE_ID", "kebab", "m", "TYPOGRAPHY_VARS", "applyTheme", "theme", "_a", "_b", "_c", "_d", "vars", "push", "name", "value", "key", "style", "field", "obj", "key", "TicketlayerLive", "client", "opts", "Emitter", "self", "eventId", "d", "theme", "applyTheme", "_a", "res", "cart", "item", "id", "err", "freshId", "itemId", "LiveAPIError", "contact", "proof", "body", "orderId", "passId", "headers", "token", "code", "event", "handler", "payload", "startBody", "started", "_b", "_c", "_d", "cur", "cartId", "resolveChannelKey", "baseUrl", "domain", "_a", "res", "json", "createLiveClient", "options", "_b", "_c", "publishableKey", "isEmbed", "sessionMode", "client", "LiveClient", "tl", "TicketlayerLive", "publishClient", "createElementsConnector", "API_DATED_VERSION", "installCheckoutModal", "installBuyModal", "elementsLoad", "loadElements", "err", "readConfig", "_a", "el", "d", "boot", "_b", "w", "cfg", "ready", "createLiveClient", "err", "boot"]
4
+ "sourcesContent": ["/**\n * Drop-in auto-init for the CDN/UMD build (`dist/ticketlayer.js`).\n *\n * This is the \"one line of code\" embed - what a Webflow/Framer/any site drops in:\n *\n * <script src=\"https://cdn.ticketlayer.com/v1/ticketlayer.js\"\n * data-publishable-key=\"tlpk_...\"\n * data-api-url=\"https://live-api.ticketlayer.com\"\n * data-checkout-base=\"https://checkout.ticketlayer.com\"></script>\n *\n * On load it boots a Live client from the script tag's data-* attributes:\n * publishes `window.Ticketlayer` (so `@ticketlayer/elements` bind), injects the\n * Elements bundle, and installs the hosted iframe checkout modal. Plain HTML\n * custom-element tags (`<tl-event-list>`, `<tl-buy-tickets-button event-id>`)\n * then just work - no bundler, no framework.\n *\n * The IIFE also exposes the SDK on `window.TicketlayerLive` (createLiveClient,\n * boot) for sites that want manual control instead of the data-attribute path.\n *\n * NOTE: index.ts (the npm/bundler entry) does NOT import this module, so only\n * the CDN build auto-boots. Booting is idempotent and a no-op without a key.\n */\nimport { createLiveClient, TicketlayerLive } from './createLiveClient.js';\n\ninterface BootWindow {\n Ticketlayer?: unknown;\n ticketlayer?: { ready: Promise<TicketlayerLive | null> };\n __tlBooted?: boolean;\n}\n\ninterface DropInConfig {\n publishableKey?: string;\n apiUrl?: string;\n elementsUrl?: string;\n checkoutBase?: string;\n autoElements: boolean;\n}\n\n/** Read config off the embedding <script> tag's data-* attributes. */\nfunction readConfig(): DropInConfig | null {\n if (typeof document === 'undefined') return null;\n const el =\n (document.currentScript as HTMLScriptElement | null) ??\n document.querySelector<HTMLScriptElement>('script[data-publishable-key]');\n if (!el) return null;\n const d = el.dataset;\n return {\n publishableKey: d.publishableKey,\n apiUrl: d.apiUrl,\n elementsUrl: d.elementsUrl,\n checkoutBase: d.checkoutBase,\n // Inject @ticketlayer/elements unless explicitly opted out (data-elements=\"false\").\n autoElements: d.elements !== 'false',\n };\n}\n\n/**\n * Boot a Live client from the script tag's data-* attributes. Returns the\n * client (or null when there's no publishable key / not in a browser). Safe to\n * call once; subsequent calls no-op.\n */\nexport function boot(): Promise<TicketlayerLive | null> {\n if (typeof window === 'undefined') return Promise.resolve(null);\n const w = window as unknown as BootWindow;\n if (w.__tlBooted) return w.ticketlayer?.ready ?? Promise.resolve(null);\n\n const cfg = readConfig();\n if (!cfg?.publishableKey) return Promise.resolve(null); // manual usage - nothing to boot\n if (!cfg.apiUrl) {\n console.error('[ticketlayer] Missing data-api-url on the embed script; cannot auto-init.');\n return Promise.resolve(null);\n }\n\n w.__tlBooted = true;\n const ready = createLiveClient({\n baseUrl: cfg.apiUrl,\n publishableKey: cfg.publishableKey,\n elements: cfg.autoElements,\n ...(cfg.elementsUrl ? { elementsUrl: cfg.elementsUrl } : {}),\n checkout: { mode: 'modal', ...(cfg.checkoutBase ? { embedBaseUrl: cfg.checkoutBase } : {}) },\n }).catch((err) => {\n console.error('[ticketlayer] Failed to initialise:', err);\n return null;\n });\n\n w.ticketlayer = { ready };\n return ready;\n}\n\n// Manual-use surface on the global (the IIFE's globalName is TicketlayerLive).\nexport { createLiveClient, TicketlayerLive };\n\n// Auto-boot on load.\nvoid boot();\n", "/**\n * GENERATED FILE - written from package.json by the prebuild script.\n * Do not edit; do not commit.\n */\nexport const SDK_NAME = \"@ticketlayer/live\";\nexport const SDK_VERSION = \"0.3.2\";\n", "/**\n * GENERATED FILE - do not edit by hand.\n * @ticketlayer/live client generated from the backstage sales surface\n * (spec 1.0.0) + live-api (0.1.0)\n * by backstage-sdk-tooling 0.1.0 on 2026-09-15T10:18:42.096Z.\n * Regenerate with `tt sdk live`.\n */\nimport type { components } from './generated/types';\nimport { SDK_NAME, SDK_VERSION } from './version.js';\n\ntype AttachOrderAccessBody = components['schemas']['AttachOrderAccessBody'];\ntype CreateSalesOrderPaymentResponse = components['schemas']['CreateSalesOrderPaymentResponse'];\ntype CreateSalesRefundRequestResponse = components['schemas']['CreateSalesRefundRequestResponse'];\ntype CreateSessionBody = components['schemas']['CreateSessionBody'];\ntype GetSalesListingsResponse = components['schemas']['GetSalesListingsResponse'];\ntype GetSalesOrderResponse = components['schemas']['GetSalesOrderResponse'];\ntype ListMySalesOrdersResponse = components['schemas']['ListMySalesOrdersResponse'];\ntype RedeemSalesPresaleCodeResponse = components['schemas']['RedeemSalesPresaleCodeResponse'];\ntype SalesCartResponse = components['schemas']['SalesCartResponse'];\ntype SalesCheckoutResponse = components['schemas']['SalesCheckoutResponse'];\ntype SalesCustomerResponse = components['schemas']['SalesCustomerResponse'];\ntype SalesCustomerTokenResponse = components['schemas']['SalesCustomerTokenResponse'];\ntype SalesEventDetailResponse = components['schemas']['SalesEventDetailResponse'];\ntype SalesMagicLinkResponse = components['schemas']['SalesMagicLinkResponse'];\ntype SalesResolveChannelResponse = components['schemas']['SalesResolveChannelResponse'];\ntype SalesThemeResponse = components['schemas']['SalesThemeResponse'];\n\n/**\n * The dated API version (TL-Version) this SDK speaks. Stamped at generation\n * time; the Live/sales surface keeps serving this version's behaviour even as\n * the API evolves. See https://docs.ticketlayer.com/api/versions\n */\nexport const API_DATED_VERSION = '2026-06-13';\n\n/** Best-effort description of the JavaScript runtime, for the TL-Client header. */\nfunction describeRuntime(): string {\n const g = globalThis as Record<string, any>;\n if (g.navigator?.product === 'ReactNative') return 'react-native';\n if (typeof g.window !== 'undefined' && typeof g.document !== 'undefined') return 'browser';\n if (g.process?.versions?.node) return `node/${g.process.versions.node}`;\n if (g.EdgeRuntime) return 'edge';\n return 'unknown';\n}\n\n/**\n * Identifies this SDK build to the API, sent as the TL-Client request header:\n * `ticketlayer-live/<package version> (<runtime>)`. SDK_VERSION comes from\n * src/version.ts, which the package's prebuild writes from package.json so the\n * header always names the version npm published.\n */\nexport const SDK_CLIENT_HEADER = `${SDK_NAME.replace(/^@/, '').replace('/', '-')}/${SDK_VERSION} (${describeRuntime()})`;\n\n/** Pluggable token storage so the SDK runs in browser, React Native, etc. */\nexport interface LiveTokenStorage {\n get(): string | null | Promise<string | null>;\n set(token: string): void | Promise<void>;\n clear(): void | Promise<void>;\n}\n\n/** In-memory storage (default; embeds/SSR). */\nexport function memoryTokenStorage(): LiveTokenStorage {\n let token: string | null = null;\n return {\n get: () => token,\n set: (t) => {\n token = t;\n },\n clear: () => {\n token = null;\n },\n };\n}\n\nexport interface LiveClientConfig {\n /** Base URL of a Live deployment (or the sales surface directly). */\n baseUrl: string;\n /**\n * Session transport:\n * - 'cookie' (hosted web): the live_session httpOnly cookie travels\n * automatically with credentials: 'include'; no token is held client-side.\n * - 'token' (embeds / React Native / native): the session id is held by the\n * SDK and sent as the X-Live-Session header.\n */\n sessionMode?: 'cookie' | 'token';\n /** For embeds/native: the channel's publishable key (tlpk_\u2026). */\n publishableKey?: string;\n /** Token storage for 'token' session mode (defaults to in-memory). */\n tokenStorage?: LiveTokenStorage;\n /** Override the dated API version sent as TL-Version. */\n apiVersion?: string;\n /** Extra headers sent on every request (merged under per-call headers). */\n headers?: Record<string, string>;\n}\n\nexport class LiveAPIError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'LiveAPIError';\n }\n}\n\n/**\n * Generated Live client. Mirrors the sales surface (byte-for-byte views) plus\n * the Live-only /session and /queue operations. Auth is the Live session\n * (cookie on hosted web; X-Live-Session header elsewhere) + the channel\n * publishable key for embeds. Browser ergonomics live in createLiveClient.\n */\nexport class LiveClient {\n private baseUrl: string;\n private sessionMode: 'cookie' | 'token';\n private publishableKey?: string;\n private tokenStorage: LiveTokenStorage;\n private apiVersion: string;\n private headers: Record<string, string>;\n\n constructor(config: LiveClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.sessionMode = config.sessionMode ?? 'cookie';\n this.publishableKey = config.publishableKey;\n this.tokenStorage = config.tokenStorage ?? memoryTokenStorage();\n this.apiVersion = config.apiVersion ?? API_DATED_VERSION;\n this.headers = config.headers ?? {};\n }\n\n /** Store the Live session id (token mode). Called after POST /session. */\n async setSessionToken(token: string): Promise<void> {\n await this.tokenStorage.set(token);\n }\n\n /** The current session token (token mode), if any - used for embed handoff. */\n async getSessionToken(): Promise<string | null> {\n return this.tokenStorage.get();\n }\n\n async clearSession(): Promise<void> {\n await this.tokenStorage.clear();\n }\n\n /**\n * Make a request to the Live deployment. Live serves at the root (no /v1\n * prefix). Injects the publishable key + session header + TL-Version, and\n * unwraps the JSend envelope.\n */\n private async request<T>(path: string, options: RequestInit = {}): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'TL-Version': this.apiVersion,\n 'TL-Client': SDK_CLIENT_HEADER,\n ...this.headers,\n ...(options.headers as Record<string, string> | undefined),\n };\n\n if (this.publishableKey) {\n headers['Authorization'] = `Bearer ${this.publishableKey}`;\n }\n\n if (this.sessionMode === 'token') {\n const token = await this.tokenStorage.get();\n if (token) headers['X-Live-Session'] = token;\n }\n\n const response = await fetch(url, {\n ...options,\n headers,\n // Hosted web relies on the session cookie travelling with the request\n credentials: this.sessionMode === 'cookie' ? 'include' : 'same-origin',\n });\n\n const text = await response.text();\n const json = text ? JSON.parse(text) : null;\n\n if (!response.ok) {\n const error = json?.error ?? {};\n throw new LiveAPIError(\n error.message ?? `Request failed (${response.status})`,\n error.code ?? 'REQUEST_FAILED',\n response.status\n );\n }\n\n // Unwrap JSend: { status, data, metadata } \u2192 data\n if (json && json.status === 'success' && json.data !== undefined) {\n return json.data as T;\n }\n return json as T;\n }\n\n /**\n * Sales Listings methods\n */\n salesListings = {\n /**\n * List active listings\n * What is on sale through this channel right now. The channel is resolved from the key, never from a parameter.\n * @operationId listSalesListings\n */\n list: async () => {\n const response = await this.request<GetSalesListingsResponse>(`/sales/listings`, {\n method: 'GET'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Customer Auth methods\n */\n salesCustomerAuth = {\n /**\n * Request magic link\n * Start a magic-link sign-in for a customer. Always reports success - account existence is never revealed.\n * @operationId requestSalesMagicLink\n */\n magicLink: async (request: { email?: string; phone?: string }) => {\n const response = await this.request<SalesMagicLinkResponse>(`/sales/customer-auth/magic-link`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.sent;\n }\n };\n\n /**\n * Sales Customer Tokens methods\n */\n salesCustomerTokens = {\n /**\n * Exchange identity proof for customer token\n * 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.\n * @operationId createSalesCustomerToken\n */\n create: async (request: { proof: any }) => {\n const response = await this.request<SalesCustomerTokenResponse>(`/sales/customer-tokens`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n },\n\n /**\n * Refresh a customer token\n * 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.\n * @operationId refreshSalesCustomerToken\n */\n refresh: async () => {\n const response = await this.request<SalesCustomerTokenResponse>(`/sales/customer-tokens/refresh`, {\n method: 'POST'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Carts methods\n */\n salesCarts = {\n /**\n * Create cart\n * Create a cart on this channel. Customer identity comes only from a verified customer token, never from the body.\n * @operationId createSalesCart\n */\n create: async (request: { metadata?: Record<string, any> }) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.cart;\n },\n\n /**\n * Get cart\n * Get a cart with its items\n * @operationId getSalesCart\n */\n get: async (cartId: string) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}`, {\n method: 'GET'\n });\n\n return response.cart;\n },\n\n /**\n * Add cart item\n * Add an item to the cart, taking a real inventory reservation with the channel's TTL\n * @operationId addSalesCartItem\n */\n addItem: async (cartId: string, request: { eventOccurrenceId: string; categoryId: string; ticketTypeId: string; quantity?: number; eventLayoutAreaId?: string; eventLayoutSeatIds?: string[] }) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}/items`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.cart;\n },\n\n /**\n * Remove cart item\n * Remove an item from the cart, releasing its reservation\n * @operationId removeSalesCartItem\n */\n removeItem: async (cartId: string, itemId: string) => {\n const response = await this.request<SalesCartResponse>(`/sales/carts/${cartId}/items/${itemId}`, {\n method: 'DELETE'\n });\n\n return response.cart;\n },\n\n /**\n * Checkout cart\n * Convert the cart into an order. Returns an order access token for possession-based guest access (confirmation page, payment status polling).\n * @operationId checkoutSalesCart\n */\n checkout: async (cartId: string, request: { customerNotes?: string; metadata?: Record<string, any>; customer?: { email: string; firstName?: string; lastName?: string; phone?: string; marketingConsent?: boolean } }) => {\n const response = await this.request<SalesCheckoutResponse>(`/sales/carts/${cartId}/checkout`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Sales My Orders methods\n */\n salesMyOrders = {\n /**\n * List my orders\n * The verified customer's own orders. Requires a customer token - orders cannot be listed with key or possession credentials alone.\n * @operationId listMySalesOrders\n */\n list: async () => {\n const response = await this.request<ListMySalesOrdersResponse>(`/sales/my-orders`, {\n method: 'GET'\n });\n\n return response.orders;\n }\n };\n\n /**\n * Sales Orders methods\n */\n salesOrders = {\n /**\n * Get order\n * 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).\n * @operationId getSalesOrder\n */\n get: async (orderId: string) => {\n const response = await this.request<GetSalesOrderResponse>(`/sales/orders/${orderId}`, {\n method: 'GET'\n });\n\n return response.order;\n },\n\n /**\n * Download a ticket PDF\n * 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.\n * @operationId getSalesOrderTicketPdf\n */\n ticketPdf: async (orderId: string, passId: string) => {\n const response = await this.request<any>(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {\n method: 'GET'\n });\n\n return response;\n }\n };\n\n /**\n * Sales Order Payments methods\n */\n salesOrderPayments = {\n /**\n * Create order payment\n * Initiate payment for the order's outstanding balance through the channel's payment provider\n * @operationId createSalesOrderPayment\n */\n create: async (orderId: string, request: { paymentType?: 'online_card' | 'online_bank_transfer' | 'online_wallet'; returnUrl?: string }) => {\n const response = await this.request<CreateSalesOrderPaymentResponse>(`/sales/orders/${orderId}/payments`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.payment;\n }\n };\n\n /**\n * Sales Refund Requests methods\n */\n salesRefundRequests = {\n /**\n * Request refund or exchange\n * 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.\n * @operationId createSalesOrderRefundRequest\n */\n create: async (orderId: string, request: { type: 'refund' | 'exchange'; reason?: string }) => {\n const response = await this.request<CreateSalesRefundRequestResponse>(`/sales/orders/${orderId}/refund-requests`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.request;\n }\n };\n\n /**\n * Sales Customers methods\n */\n salesCustomers = {\n /**\n * Create customer\n * 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.\n * @operationId createSalesCustomer\n */\n create: async (request: { email: string; firstName?: string; lastName?: string; phone?: string; marketingConsent?: boolean }) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response.customer;\n },\n\n /**\n * Get customer\n * Get a customer the channel holds an access grant for (created through it, or who bought through it)\n * @operationId getSalesCustomer\n */\n get: async (customerId: string) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers/${customerId}`, {\n method: 'GET'\n });\n\n return response.customer;\n },\n\n /**\n * Update customer\n * Update a customer the channel holds an access grant for. The update surface is deliberately small - email changes go through the org's staff.\n * @operationId updateSalesCustomer\n */\n update: async (customerId: string, request: { firstName?: string; lastName?: string; phone?: string }) => {\n const response = await this.request<SalesCustomerResponse>(`/sales/customers/${customerId}`, {\n method: 'PATCH',\n body: JSON.stringify(request)\n });\n\n return response.customer;\n }\n };\n\n /**\n * Sales Presale Codes methods\n */\n salesPresaleCodes = {\n /**\n * Redeem presale code\n * A verified customer redeems a presale code for its benefit; gated pricing unlocks immediately. Requires a customer token.\n * @operationId redeemSalesPresaleCode\n */\n redeem: async (request: { code: string }) => {\n const response = await this.request<RedeemSalesPresaleCodeResponse>(`/sales/presale-codes/redeem`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Sales methods\n */\n sales = {\n /**\n * Resolve a channel by domain\n * 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.\n * @operationId resolveSalesChannel\n */\n resolveChannel: async (options?: { domain: string }) => {\n const params = new URLSearchParams();\n if (options?.domain !== undefined) params.append('domain', String(options.domain));\n const queryString = params.toString();\n const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;\n\n const response = await this.request<SalesResolveChannelResponse>(requestPath, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Get event catalogue detail\n * 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.\n * @operationId getSalesEvent\n */\n get: async (eventId: string) => {\n const response = await this.request<SalesEventDetailResponse>(`/sales/events/${eventId}`, {\n method: 'GET'\n });\n\n return response.event;\n },\n\n /**\n * Get channel theme\n * 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.\n * @operationId getSalesTheme\n */\n getTheme: async () => {\n const response = await this.request<SalesThemeResponse>(`/sales/theme`, {\n method: 'GET'\n });\n\n return response.theme;\n }\n };\n\n /**\n * Session methods\n */\n session = {\n /**\n * Bootstrap a Live session\n * Resolves the channel and mints a session that holds the channel\u2019s 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.\n * @operationId createLiveSession\n */\n start: async (request: CreateSessionBody) => {\n const response = await this.request<any>(`/session`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n },\n\n /**\n * Get the current session\n * Returns the current session\u2019s customer and cart state.\n * @operationId getLiveSession\n */\n current: async () => {\n const response = await this.request<any>(`/session`, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Destroy the current session\n * Signs out and drops the current session.\n * @operationId deleteLiveSession\n */\n end: async () => {\n const response = await this.request<any>(`/session`, {\n method: 'DELETE'\n });\n\n return response;\n },\n\n /**\n * Attach an order access token to the session\n * 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`.\n * @operationId attachLiveOrderAccess\n */\n attachOrderAccess: async (request: AttachOrderAccessBody) => {\n const response = await this.request<any>(`/session/order-access`, {\n method: 'POST',\n body: JSON.stringify(request)\n });\n\n return response;\n }\n };\n\n /**\n * Queue methods\n */\n queue = {\n /**\n * Get waiting-room status\n * 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.\n * @operationId getLiveQueueStatus\n */\n status: async () => {\n const response = await this.request<any>(`/queue/status`, {\n method: 'GET'\n });\n\n return response;\n },\n\n /**\n * Join the waiting room\n * Joins the current session to the waiting room. While the queue is disabled this is a no-op that reports immediate admission.\n * @operationId joinLiveQueue\n */\n join: async () => {\n const response = await this.request<any>(`/queue/join`, {\n method: 'POST'\n });\n\n return response;\n }\n };\n}\n", "/**\n * The `window.Ticketlayer` global registry.\n *\n * One stateful Live client per page, published on a well-known global so that\n * Elements (a separate bundle, possibly CDN-loaded) can find and bind to it\n * WITHOUT importing @ticketlayer/live. The contract is deliberately tiny and\n * stable - it's the public integration surface for snippet/Webflow embeds:\n *\n * - `getClient()` - the rich stateful facade (events/cart/auth/theme/bus).\n * - `getSDK()` - the Elements-shaped connector view of that same client.\n * - `ready()` - resolves when the client is published (immediately if it\n * already is); Elements await this instead of polling.\n *\n * Publishing also dispatches a `ticketlayer:ready` CustomEvent on window, so a\n * pure-DOM listener (no promise plumbing) can react too.\n */\n\nexport const TICKETLAYER_GLOBAL_KEY = 'Ticketlayer' as const;\nexport const TICKETLAYER_READY_EVENT = 'ticketlayer:ready' as const;\n\nexport interface TicketlayerGlobal<Client = unknown, Sdk = unknown> {\n /** The singleton stateful client (facade). */\n client: Client | null;\n /** Elements-shaped connector view of the same client. */\n sdk: Sdk | null;\n getClient(): Client | null;\n getSDK(): Sdk | null;\n /** Resolves with the client once published; immediate if already present. */\n ready(): Promise<Client>;\n version: string;\n}\n\ninterface InternalGlobal<Client, Sdk> extends TicketlayerGlobal<Client, Sdk> {\n _resolvers: Array<(c: Client) => void>;\n}\n\ndeclare global {\n interface Window {\n Ticketlayer?: TicketlayerGlobal;\n }\n}\n\nfunction ensureRegistry<Client, Sdk>(version: string): InternalGlobal<Client, Sdk> {\n const w = window as unknown as { [TICKETLAYER_GLOBAL_KEY]?: InternalGlobal<Client, Sdk> };\n if (w[TICKETLAYER_GLOBAL_KEY]) return w[TICKETLAYER_GLOBAL_KEY]!;\n\n const reg: InternalGlobal<Client, Sdk> = {\n client: null,\n sdk: null,\n version,\n _resolvers: [],\n getClient() {\n return this.client;\n },\n getSDK() {\n return this.sdk;\n },\n ready() {\n if (this.client) return Promise.resolve(this.client);\n return new Promise<Client>((resolve) => this._resolvers.push(resolve));\n },\n };\n w[TICKETLAYER_GLOBAL_KEY] = reg;\n return reg;\n}\n\n/** Publish the singleton client + connector. Browser-only; safe to call once. */\nexport function publishClient<Client, Sdk>(client: Client, sdk: Sdk, version: string): void {\n if (typeof window === 'undefined') return;\n const reg = ensureRegistry<Client, Sdk>(version);\n\n if (reg.client && reg.client !== client) {\n console.warn(\n '[live] A Ticketlayer client is already on window.Ticketlayer; replacing it. ' +\n 'Create a single client per page.'\n );\n }\n\n reg.client = client;\n reg.sdk = sdk;\n const resolvers = reg._resolvers;\n reg._resolvers = [];\n resolvers.forEach((r) => r(client));\n\n window.dispatchEvent(new CustomEvent(TICKETLAYER_READY_EVENT, { detail: client }));\n}\n\n/** Read the current client, if any (host convenience; Elements use ready()). */\nexport function getPublishedClient<Client>(): Client | null {\n if (typeof window === 'undefined') return null;\n return (window.Ticketlayer?.getClient() as Client | null) ?? null;\n}\n", "/**\n * Optionally pull in @ticketlayer/elements at runtime so a single Live include\n * gives you the components too - the \"one line of code\" snippet path.\n *\n * No-op when: not in a browser, the custom elements are already defined (a\n * bundler-based host like HBO imports them directly), or an injection for this\n * URL is already in flight. The default URL points at the Elements ESM entry on\n * the Ticketlayer CDN; pass `elementsUrl` to target a local build in dev.\n */\nconst DEFAULT_ELEMENTS_URL =\n 'https://cdn.ticketlayer.com/elements/v1/ticketlayer-elements/ticketlayer-elements.esm.js';\n\nconst SENTINEL_TAG = 'tl-event-list';\nconst inFlight = new Map<string, Promise<void>>();\n\nexport interface LoadElementsOptions {\n /** Enable runtime injection (default false - most hosts import Elements directly). */\n elements?: boolean;\n /** Override the Elements ESM bundle URL (e.g. a local dist in dev). */\n elementsUrl?: string;\n}\n\nexport function loadElements(opts: LoadElementsOptions = {}): Promise<void> {\n if (!opts.elements) return Promise.resolve();\n if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.resolve();\n\n // Already registered (bundler import or a prior load) - nothing to do.\n const ce = (window as unknown as { customElements?: CustomElementRegistry }).customElements;\n if (ce?.get(SENTINEL_TAG)) return Promise.resolve();\n\n const url = opts.elementsUrl ?? DEFAULT_ELEMENTS_URL;\n const existing = inFlight.get(url);\n if (existing) return existing;\n\n const p = new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.type = 'module';\n script.src = url;\n script.async = true;\n script.dataset.ticketlayerElements = 'auto';\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`[live] Failed to load Elements from ${url}`));\n document.head.appendChild(script);\n });\n\n inFlight.set(url, p);\n return p;\n}\n", "/**\n * Checkout modal manager (third-party embeds).\n *\n * On a third-party site, Elements build the cart in-page and emit\n * `ui:checkout-requested`. This opens the hosted checkout in an iframe overlay\n * pointing at HBO's `/embed/checkout`, handing off the current session token so\n * the iframe sees the same cart (and so card data stays on HBO's origin - PCI\n * isolation). It bridges the `tl:*` postMessage protocol back to the caller's\n * onComplete/onError/onClose callbacks (which rode in on the intent payload).\n *\n * The iframe URL carries `parent_origin=<this page's origin>` so HBO can pin\n * its postMessage target to us (it never posts to '*'), and incoming messages\n * are only accepted from the checkout's own origin. The message set is\n * documented in HBO's docs/embed-checkout-contract.md.\n *\n * HBO itself does NOT use this - it handles `ui:checkout-requested` by\n * navigating in-page to /checkout.\n */\nimport type { TicketlayerLive } from '../createLiveClient.js';\n\nexport interface CheckoutModalOptions {\n /** Base URL of the HBO instance serving /embed/checkout. Defaults to origin. */\n embedBaseUrl?: string;\n}\n\n/** Inbound `tl:*` envelope (see HBO docs/embed-checkout-contract.md). */\ninterface EmbedMessage {\n type?: string;\n version?: number;\n orderId?: string;\n orderReference?: string;\n accessToken?: string;\n /** Pre-v1 payload of tl:complete. */\n order?: unknown;\n code?: string;\n message?: string;\n height?: number;\n}\n\ninterface CheckoutIntent {\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\nconst OVERLAY_ID = 'tl-checkout-overlay';\n\n\n/** Wire the modal to the bus; returns an uninstall function. */\nexport function installCheckoutModal(\n tl: TicketlayerLive,\n opts: CheckoutModalOptions = {}\n): () => void {\n if (typeof window === 'undefined' || typeof document === 'undefined') return () => {};\n\n let onMessage: ((e: MessageEvent) => void) | null = null;\n\n const close = () => {\n document.getElementById(OVERLAY_ID)?.remove();\n if (onMessage) {\n window.removeEventListener('message', onMessage);\n onMessage = null;\n }\n };\n\n const open = async (intent: CheckoutIntent) => {\n const token = await tl.getSessionToken().catch(() => null);\n const base = (opts.embedBaseUrl || window.location.origin).replace(/\\/$/, '');\n const query = new URLSearchParams();\n if (token) query.set('session', token);\n // Lets HBO pin its postMessage target origin to this page.\n query.set('parent_origin', window.location.origin);\n const url = `${base}/embed/checkout?${query.toString()}`;\n const frameOrigin = new URL(url).origin;\n\n close();\n\n const overlay = document.createElement('div');\n overlay.id = OVERLAY_ID;\n // Blurred, dimmed backdrop so the underlying site recedes behind the modal.\n overlay.style.cssText =\n 'position:fixed;inset:0;z-index:2147483647;background:rgba(15,23,42,0.55);' +\n 'backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);' +\n 'display:flex;flex-direction:column;align-items:center;justify-content:center;' +\n 'gap:12px;padding:16px;';\n\n // Column wrapper: the modal panel + a floating chrome footer beneath it.\n const wrapper = document.createElement('div');\n wrapper.style.cssText =\n 'width:100%;max-width:960px;display:flex;flex-direction:column;gap:10px;';\n\n const frame = document.createElement('iframe');\n frame.src = url;\n frame.allow = 'payment';\n // Wide enough for the two-column checkout (form left, order summary right);\n // the embedded page stacks to one column on narrow viewports. Subtle theme\n // border (matches the buy-tickets modal) + a soft lift off the backdrop.\n frame.style.cssText =\n 'width:100%;height:88vh;max-height:760px;border:1px solid var(--tl-border,#e5e7eb);' +\n 'border-radius:16px;background:#fff;box-shadow:0 24px 64px rgba(0,0,0,0.45);';\n\n // No chrome of our own around the iframe.\n //\n // The overlay is a transport: an iframe onto the hosted checkout plus the\n // postMessage bridge. It used to draw a \"Powered by Ticketlayer\" footer\n // beneath the frame, which put attribution at the wrong layer - duplicated\n // by the page inside, and absent for anyone who opens /embed/checkout\n // directly rather than through this overlay. The checkout page renders it\n // now, where the buyer actually is.\n wrapper.appendChild(frame);\n overlay.appendChild(wrapper);\n\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay || e.target === wrapper) {\n close();\n intent.onClose?.();\n }\n });\n document.body.appendChild(overlay);\n\n onMessage = (e: MessageEvent) => {\n // Only the checkout page's own origin may drive the modal.\n if (e.origin !== frameOrigin) return;\n const msg = e.data as EmbedMessage | null;\n if (!msg || typeof msg !== 'object') return;\n switch (msg.type) {\n case 'tl:complete': {\n // v1 carries orderId/orderReference/accessToken at the top level and\n // keeps the pre-v1 `order` object; merge so both shapes are served.\n const legacy = (msg.order && typeof msg.order === 'object' ? msg.order : {}) as object;\n const order: unknown = msg.orderId\n ? {\n ...legacy,\n id: msg.orderId,\n orderNumber: msg.orderReference,\n ...(msg.accessToken ? { accessToken: msg.accessToken } : {}),\n }\n : msg.order;\n intent.onComplete?.(order);\n tl.emit('checkout:completed', order);\n close();\n break;\n }\n case 'tl:close':\n case 'tl:cancel':\n intent.onClose?.();\n close();\n break;\n case 'tl:error': {\n const err = new Error(msg.message || msg.code || 'Checkout failed');\n if (msg.code) (err as Error & { code?: string }).code = msg.code;\n intent.onError?.(err);\n break;\n }\n // tl:ready and tl:height are informational; the overlay has a fixed size.\n }\n };\n window.addEventListener('message', onMessage);\n };\n\n const offCheckout = tl.on('ui:checkout-requested', (p) => void open((p as CheckoutIntent) ?? {}));\n const offClose = tl.on('ui:modal-close-requested', () => close());\n\n return () => {\n offCheckout();\n offClose();\n close();\n };\n}\n", "/**\n * Buy-tickets modal manager (in-page, native Elements).\n *\n * The buy funnel (occurrence \u2192 ticket selection \u2192 add to cart) is pure\n * browse/cart with no PCI surface, so - unlike checkout - it does NOT need a\n * cross-origin iframe. This manager simply mounts the `<tl-buy-modal>` Element\n * on demand when something emits `ui:event-modal-requested` (a\n * `tl-buy-tickets-button`, a calendar date click, etc.) and removes it on close.\n * Because the modal is a normal Element bound to the same `window.Ticketlayer`,\n * it works identically on HBO and on any third-party embed.\n *\n * When the user proceeds to checkout, the manager hands the funnel over by\n * re-emitting `ui:checkout-requested` (forwarding the original caller's\n * callbacks): on a third-party embed the checkout modal opens the hosted\n * checkout in an iframe; on HBO the host navigates to /checkout in-page.\n */\nimport type { TicketlayerLive } from '../createLiveClient.js';\n\nexport interface BuyModalOptions {\n /** Override the custom-element tag (default `tl-buy-modal`). */\n tag?: string;\n}\n\ninterface BuyIntent {\n eventId: string;\n occurrenceId?: string;\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\n/** Wire the buy modal to the bus; returns an uninstall function. */\nexport function installBuyModal(tl: TicketlayerLive, opts: BuyModalOptions = {}): () => void {\n if (typeof window === 'undefined' || typeof document === 'undefined') return () => {};\n\n const TAG = opts.tag || 'tl-buy-modal';\n let el: HTMLElement | null = null;\n let current: BuyIntent | null = null;\n\n const remove = () => {\n if (el) {\n el.remove();\n el = null;\n }\n current = null;\n };\n\n const open = (intent: BuyIntent) => {\n if (!intent?.eventId) return;\n remove();\n current = intent;\n\n const node = document.createElement(TAG);\n // Set as attributes (strings) so they apply before the element upgrades.\n node.setAttribute('event-id', intent.eventId);\n if (intent.occurrenceId) node.setAttribute('occurrence-id', intent.occurrenceId);\n\n node.addEventListener('tlClose', () => {\n const i = current;\n remove();\n i?.onClose?.();\n });\n\n node.addEventListener('tlError', (e: Event) => {\n const message =\n (e as CustomEvent<{ message?: string }>).detail?.message || 'Could not load this event';\n current?.onError?.(new Error(message));\n });\n\n node.addEventListener('tlCheckout', () => {\n const i = current;\n remove();\n // Hand off to the checkout intent, forwarding the caller's callbacks so a\n // third-party site's onComplete still fires when the order completes.\n tl.emit('ui:checkout-requested', {\n onComplete: i?.onComplete,\n onError: i?.onError,\n onClose: i?.onClose,\n });\n });\n\n document.body.appendChild(node);\n el = node;\n };\n\n const offOpen = tl.on('ui:event-modal-requested', (p) => open((p as BuyIntent) ?? ({} as BuyIntent)));\n const offClose = tl.on('ui:modal-close-requested', () => remove());\n\n return () => {\n offOpen();\n offClose();\n remove();\n };\n}\n", "/**\n * Elements connector - adapts the stateful {@link TicketlayerLive} facade to the\n * structural interface `@ticketlayer/elements` components consume.\n *\n * Elements never import @ticketlayer/live directly: they bind to a generic\n * shape published on a window global (`setSDK(...)`), so the SDK and the\n * components can ship as separate bundles (e.g. the Elements CDN build). This\n * adapter is the bridge a host (HBO, a promoter site) installs:\n *\n * import { createLiveClient, createElementsConnector } from '@ticketlayer/live';\n * import { setSDK } from '@ticketlayer/elements';\n * const tl = await createLiveClient({ ... });\n * setSDK(createElementsConnector(tl));\n *\n * Two responsibilities the components expect that the facade doesn't expose 1:1:\n * - cart line items need a `categoryId` the components never pass; we resolve\n * it from the ticketTypeId captured when `getTicketTypes()` was called (the\n * ticket selector always loads types before adding - so the cache is warm).\n * - modal verbs (`event(id).openModal()`, `checkout.openModal()`, `closeModal()`)\n * are UI INTENTS: the SDK renders no UI, it relays them onto the shared bus\n * (ui:event-modal-requested / ui:checkout-requested / ui:modal-close-requested)\n * and the host opens the modal. Caller callbacks ride along in the payload.\n */\nimport type { TicketlayerLive, PresaleRedemption } from './createLiveClient.js';\n\ninterface CartLike {\n items?: Array<{ quantity?: number }>;\n [k: string]: unknown;\n}\n\nexport interface ModalOptions {\n occurrenceId?: string;\n onComplete?: (order: unknown) => void;\n onError?: (error: Error) => void;\n onClose?: () => void;\n}\n\nexport interface ElementsConnector {\n getEventsManager(): {\n list(options?: { limit?: number; category?: string }): Promise<{ items: unknown[] }>;\n get(eventId: string): Promise<unknown>;\n getTicketTypes(eventId: string, occurrenceId: string): Promise<unknown[]>;\n };\n getCartManager(): {\n get(): Promise<unknown>;\n on(event: string, cb: (data: unknown) => void): () => void;\n off(event: string, cb: (data: unknown) => void): void;\n addItem(ticketTypeId: string, quantity: number, occurrenceId: string): Promise<unknown>;\n addItems(items: Array<{ ticketTypeId: string; quantity: number; occurrenceId: string }>): Promise<unknown>;\n removeItem(itemId: string): Promise<unknown>;\n addSeat(seatId: string, ticketTypeId: string, occurrenceId: string): Promise<unknown>;\n removeSeat(seatId: string, occurrenceId: string): Promise<unknown>;\n };\n getOrdersManager(): {\n mine(): Promise<unknown>;\n get(orderId: string): Promise<unknown>;\n ticketPdf(orderId: string, passId: string): Promise<Blob>;\n };\n /** Magic-link sign-in (tl-login, tl-my-orders). Never sees a password. */\n getAuthManager(): {\n readonly customer: unknown | null;\n readonly authenticated: boolean;\n requestMagicLink(contact: { email?: string; phone?: string }): Promise<unknown>;\n exchange(code: string): Promise<unknown>;\n logout(): Promise<void>;\n };\n /** Presale / promo codes (tl-promo-code). */\n getPresaleManager(): {\n redeem(code: string): Promise<PresaleRedemption>;\n };\n on(event: string, cb: (data: unknown) => void): () => void;\n off(event: string, cb: (data: unknown) => void): void;\n event(eventId: string): { openModal(options?: ModalOptions): void };\n checkout: { openModal(options?: ModalOptions): void; closeModal(): void };\n closeModal(): void;\n}\n\n/**\n * Adapt the sales-surface cart view to the shape Elements consume. The sales\n * view exposes `itemsSubtotal` + per-item `subtotal`; the components (tl-cart,\n * badges) were written against `subtotal`/`total`/`fees` + per-item\n * `totalPrice`. Add those aliases (and itemCount) without dropping the\n * originals - otherwise tl-cart formats undefined \u2192 \u00A3NaN. No fees concept on\n * the sales surface yet, so fees=0 and total=subtotal. Money stays minor units.\n */\nconst withCount = (cart: unknown): unknown => {\n if (!cart || typeof cart !== 'object') return cart;\n const c = cart as CartLike & { itemsSubtotal?: number };\n const items: Array<Record<string, unknown>> = (c.items ?? []).map((i) => {\n const it = i as Record<string, unknown>;\n const qty = (it.quantity as number) ?? 0;\n const line = (it.subtotal as number) ?? (it.unitPrice as number) * qty;\n return { ...it, totalPrice: it.totalPrice ?? line };\n });\n const itemCount = items.reduce((sum, i) => sum + ((i.quantity as number) ?? 0), 0);\n const subtotal = c.itemsSubtotal ?? (c as { subtotal?: number }).subtotal ?? 0;\n return {\n ...c,\n items,\n itemCount,\n subtotal,\n fees: (c as { fees?: number }).fees ?? 0,\n total: (c as { total?: number }).total ?? subtotal,\n };\n};\n\nexport function createElementsConnector(tl: TicketlayerLive): ElementsConnector {\n // ticketTypeId \u2192 { categoryId, occurrenceId }, captured on getTicketTypes so\n // addItem/addSeat can supply the categoryId the cart API requires.\n const ttMeta = new Map<string, { categoryId: string; occurrenceId: string }>();\n\n const resolve = (ticketTypeId: string, occurrenceId?: string) => {\n const meta = ttMeta.get(ticketTypeId);\n if (!meta?.categoryId) {\n throw new Error(\n `[live] No category known for ticket type ${ticketTypeId}. ` +\n `Load the occurrence's ticket types (getTicketTypes) before adding it to the cart.`\n );\n }\n return { categoryId: meta.categoryId, occurrenceId: occurrenceId || meta.occurrenceId };\n };\n\n const eventsManager = {\n async list(options?: { limit?: number; category?: string }) {\n const res = (await tl.events.list()) as {\n listings?: Array<{\n id: string;\n eventId?: string;\n name?: string | null;\n shortDescription?: string | null;\n imageUrl?: string | null;\n venueName?: string | null;\n venueCity?: string | null;\n nextOccurrenceAt?: string | null;\n }>;\n } | null;\n // Adapt the sales-surface LISTING shape to the structural shape\n // tl-event-card consumes. Two shape gaps the card otherwise renders blank:\n // - venue/date are flat (venueName/venueCity/nextOccurrenceAt) on the\n // listing but nested (venue.{name,city} / nextOccurrence.startsAt) on\n // the card.\n // - the card reads `imageUrl`; the listing already carries it (surface\n // explicitly rather than relying on a passthrough spread).\n // A listing's own id is the channel-listing id (lst_/schl_), but cards\n // navigate by EVENT id, so we surface eventId as `id`.\n let items = (res?.listings ?? []).map((l) => ({\n id: l.eventId ?? l.id,\n name: l.name ?? '',\n ...(l.shortDescription ? { shortDescription: l.shortDescription } : {}),\n ...(l.imageUrl ? { imageUrl: l.imageUrl } : {}),\n ...(l.venueName\n ? { venue: { id: '', name: l.venueName, city: l.venueCity ?? '' } }\n : {}),\n ...(l.nextOccurrenceAt ? { nextOccurrence: { startsAt: l.nextOccurrenceAt } } : {}),\n availabilityStatus: 'available' as const,\n }));\n if (options?.limit) items = items.slice(0, options.limit);\n return { items };\n },\n get: (eventId: string) => tl.events.get(eventId),\n async getTicketTypes(eventId: string, occurrenceId: string) {\n const ev = (await tl.events.get(eventId)) as {\n occurrences?: Array<{\n id: string;\n ticketTypes?: Array<{\n ticketTypeId: string;\n ticketTypeName: string;\n description: string | null;\n categoryId: string;\n categoryName: string;\n unitPrice: number;\n currency: string;\n }>;\n }>;\n } | null;\n const occ =\n ev?.occurrences?.find((o) => o.id === occurrenceId) ?? ev?.occurrences?.[0];\n const tts = occ?.ticketTypes ?? [];\n return tts.map((tt) => {\n if (occ) ttMeta.set(tt.ticketTypeId, { categoryId: tt.categoryId, occurrenceId: occ.id });\n return {\n id: tt.ticketTypeId,\n name: tt.ticketTypeName,\n description: tt.description,\n price: tt.unitPrice, // minor units; components divide by 100 to display\n currency: tt.currency,\n categoryId: tt.categoryId,\n categoryName: tt.categoryName,\n // The sales surface view doesn't expose per-order limits/remaining yet;\n // sensible defaults until the catalogue view carries them.\n maxPerOrder: 10,\n available: 999,\n };\n });\n },\n };\n\n const cartManager = {\n // Cache-first. The SDK keeps `_cart` authoritative - mutations update it and\n // every `cart:updated` carries the full cart - so Elements reading the cart\n // must NOT each trigger a GET. We return the cached cart and only fetch when\n // nothing is cached yet. This stops the fetch storm when several cart-aware\n // Elements mount, and breaks any cart:updated \u2192 get() \u2192 refresh \u2192\n // cart:updated feedback loop (which was tripping the rate limiter).\n get: async () => withCount(tl.cart.current ?? (await tl.cart.refresh())),\n on: (event: string, cb: (data: unknown) => void) =>\n tl.on(event as never, (p) => cb(event === 'cart:updated' ? withCount(p) : p)),\n off: (event: string, cb: (data: unknown) => void) => tl.off(event as never, cb),\n addItem: async (ticketTypeId: string, quantity: number, occurrenceId: string) => {\n const { categoryId, occurrenceId: occ } = resolve(ticketTypeId, occurrenceId);\n return withCount(await tl.cart.add({ eventOccurrenceId: occ, categoryId, ticketTypeId, quantity }));\n },\n addItems: async (items: Array<{ ticketTypeId: string; quantity: number; occurrenceId: string }>) => {\n let last: unknown = tl.cart.current;\n for (const it of items) last = await cartManager.addItem(it.ticketTypeId, it.quantity, it.occurrenceId);\n return last;\n },\n removeItem: async (itemId: string) => withCount(await tl.cart.remove(itemId)),\n addSeat: async (seatId: string, ticketTypeId: string, occurrenceId: string) => {\n const { categoryId, occurrenceId: occ } = resolve(ticketTypeId, occurrenceId);\n return withCount(\n await tl.cart.add({ eventOccurrenceId: occ, categoryId, ticketTypeId, eventLayoutSeatIds: [seatId] })\n );\n },\n removeSeat: async (_seatId: string, _occurrenceId: string) => {\n // The cart line-item view doesn't expose seat ids, so seat\u2192lineItem can't\n // be mapped here yet. Seat removal flows through removeItem(itemId) until\n // the view carries seat references.\n console.warn('[live] removeSeat is a no-op until cart items expose seat ids; use removeItem(itemId).');\n return withCount((await tl.cart.refresh()) ?? tl.cart.current);\n },\n };\n\n const ordersManager = {\n mine: () => tl.orders.mine(),\n get: (orderId: string) => tl.orders.get(orderId),\n ticketPdf: (orderId: string, passId: string) => tl.orders.ticketPdf(orderId, passId),\n };\n\n // Getters read the facade's session state live, so a component that asks\n // after auth:changed sees the new customer without holding its own copy.\n const authManager = {\n get customer() {\n return tl.auth.customer;\n },\n get authenticated() {\n return tl.auth.authenticated;\n },\n requestMagicLink: (contact: { email?: string; phone?: string }) => tl.auth.requestMagicLink(contact),\n exchange: (code: string) => tl.auth.exchange(code),\n logout: () => tl.auth.logout(),\n };\n\n const presaleManager = {\n redeem: (code: string) => tl.presale.redeem(code),\n };\n\n return {\n getEventsManager: () => eventsManager,\n getCartManager: () => cartManager,\n getOrdersManager: () => ordersManager,\n getAuthManager: () => authManager,\n getPresaleManager: () => presaleManager,\n on: (event: string, cb: (data: unknown) => void) => tl.on(event as never, cb),\n off: (event: string, cb: (data: unknown) => void) => tl.off(event as never, cb),\n event: (eventId: string) => ({\n openModal: (options: ModalOptions = {}) => tl.emit('ui:event-modal-requested', { eventId, ...options }),\n }),\n checkout: {\n openModal: (options: ModalOptions = {}) => tl.emit('ui:checkout-requested', options),\n closeModal: () => tl.emit('ui:modal-close-requested'),\n },\n closeModal: () => tl.emit('ui:modal-close-requested'),\n };\n}\n", "/**\n * Bidirectional event bus shared by the SDK, Elements, and the host app.\n *\n * Two directions:\n * - STATE events the SDK pushes OUT so Elements re-render (cart:updated, \u2026).\n * - UI INTENTS Elements/host push IN for someone else to act on\n * (ui:checkout-requested, ui:event-modal-requested, \u2026) - e.g. a\n * tl-buy-tickets-button emits ui:event-modal-requested and HBO opens the\n * modal. The SDK itself doesn't render UI; it just relays.\n */\nexport type LiveEvent =\n // State (SDK \u2192 subscribers)\n | 'session:changed'\n | 'cart:updated'\n | 'auth:changed'\n | 'checkout:completed'\n | 'error'\n // UI intents (Elements/host \u2192 subscribers)\n | 'ui:event-modal-requested'\n | 'ui:checkout-requested'\n | 'ui:cart-requested'\n | 'ui:login-requested'\n | 'ui:modal-close-requested';\n\ntype Handler = (payload?: unknown) => void;\n\nexport class Emitter {\n private handlers = new Map<LiveEvent, Set<Handler>>();\n\n /** Subscribe; returns an unsubscribe function. */\n on(event: LiveEvent, handler: Handler): () => void {\n if (!this.handlers.has(event)) this.handlers.set(event, new Set());\n this.handlers.get(event)!.add(handler);\n return () => this.off(event, handler);\n }\n\n off(event: LiveEvent, handler: Handler): void {\n this.handlers.get(event)?.delete(handler);\n }\n\n emit(event: LiveEvent, payload?: unknown): void {\n this.handlers.get(event)?.forEach((h) => {\n try {\n h(payload);\n } catch (err) {\n console.error(`[live] handler for ${event} threw`, err);\n }\n });\n }\n}\n", "/**\n * Apply a resolved channel theme to the document as CSS custom properties\n * (browser only; SSR-safe no-op).\n *\n * The token contract spans two consumers that share one var namespace:\n * - HBO's Tailwind v4 `@theme` maps `--color-primary: var(--tl-primary, \u2026)`.\n * - Elements read a mix of `--tl-primary` AND `--tl-color-primary`.\n * So colors are emitted under BOTH prefixes. The theme's `destructive` is also\n * aliased to the `error` name Elements use. Keys are camelCase on the theme and\n * kebab-case as CSS vars (primaryForeground \u2192 --tl-primary-foreground).\n */\ninterface ResolvedTheme {\n colors?: Record<string, string>;\n typography?: Record<string, string | number>;\n shape?: Record<string, string>;\n brand?: Record<string, string>;\n}\n\nconst STYLE_ID = 'tl-theme-vars';\nconst kebab = (s: string) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n\n// camelCase typography key \u2192 the CSS var suffix HBO's @theme / fallbacks expect.\nconst TYPOGRAPHY_VARS: Record<string, string> = {\n fontFamily: 'font-family',\n fontFamilyMono: 'font-family-mono',\n baseSize: 'font-size-base',\n scaleRatio: 'font-scale',\n};\n\nexport function applyTheme(theme: ResolvedTheme | null | undefined): void {\n if (!theme || typeof document === 'undefined') return;\n\n const vars: string[] = [];\n const push = (name: string, value: unknown) => {\n if (value === undefined || value === null) return;\n vars.push(`--tl-${name}: ${String(value)};`);\n };\n\n // Colors: emit both --tl-<name> and --tl-color-<name>; alias destructive\u2192error.\n for (const [key, value] of Object.entries(theme.colors ?? {})) {\n const name = kebab(key);\n push(name, value);\n push(`color-${name}`, value);\n if (key === 'destructive') {\n push('error', value);\n push('color-error', value);\n }\n if (key === 'destructiveForeground') {\n push('error-foreground', value);\n push('color-error-foreground', value);\n }\n }\n\n for (const [key, value] of Object.entries(theme.typography ?? {})) {\n push(TYPOGRAPHY_VARS[key] ?? kebab(key), value);\n }\n for (const [key, value] of Object.entries(theme.shape ?? {})) {\n push(kebab(key), value); // radiusMd \u2192 radius-md\n }\n\n let style = document.getElementById(STYLE_ID) as HTMLStyleElement | null;\n if (!style) {\n style = document.createElement('style');\n style.id = STYLE_ID;\n document.head.appendChild(style);\n }\n style.textContent = `:root {\\n ${vars.join('\\n ')}\\n}`;\n}\n", "/**\n * Runtime-neutral core of the Live client.\n *\n * Nothing in this module reads `window`, `document` or `location`: it is the\n * shared state layer (session, cart, auth, orders, the event bus) that both\n * adapters build on - `createLiveClient` (browser: cookie or token transport,\n * page defaults, window publishing, modals) and `createNativeLiveClient`\n * (React Native: injected token storage, X-Live-Session header, no page).\n * `theme.apply()` delegates to applyTheme, which is a no-op without a document.\n */\nimport { LiveClient, LiveAPIError } from '../client.js';\nimport { Emitter, type LiveEvent } from '../state/emitter.js';\nimport { applyTheme } from '../state/theme.js';\n\n/**\n * Stateful ergonomic layer over the generated LiveClient.\n *\n * The generated client is stateless REST; Elements and HBO need a stateful,\n * reactive surface (a session-owned cart, cart:updated events, theme\n * application, auth state). This class provides that, COORDINATING with the\n * live-api session - which owns the cartId server-side - rather than holding a\n * second source of truth: on start it loads the session's existing cart, and\n * cart mutations both update local state AND ride the same session upstream.\n */\n\nexport interface SessionState {\n channelId: string | null;\n customer: unknown | null;\n authenticated: boolean;\n}\n\n/** Result of redeeming a presale/promo code (POST /sales/presale-codes/redeem). */\nexport interface PresaleRedemption {\n benefit: string;\n alreadyHeld: boolean;\n}\n\nexport interface CartItemInput {\n eventOccurrenceId: string;\n categoryId: string;\n ticketTypeId: string;\n quantity?: number;\n eventLayoutAreaId?: string;\n eventLayoutSeatIds?: string[];\n}\n\n/**\n * Pull a named field from a response, tolerating the generator's\n * single-property auto-unwrapping: some methods return `{ cart }`, others\n * already return the cart itself. If `key` is present we use it; otherwise the\n * value is assumed to be the already-unwrapped payload.\n */\nconst field = <T>(obj: unknown, key: string): T | undefined => {\n if (obj && typeof obj === 'object' && !Array.isArray(obj) && key in obj) {\n return (obj as Record<string, unknown>)[key] as T;\n }\n return obj as T | undefined;\n};\n\nexport class TicketlayerLive {\n /** The underlying generated client (escape hatch for un-wrapped calls). */\n readonly client: LiveClient;\n\n private emitter = new Emitter();\n private sessionMode: 'cookie' | 'token';\n private publishableKey: string | undefined;\n private domain: string | undefined;\n private baseUrl: string;\n // A session is created LAZILY - only when something mutates state (cart/login).\n // Browsing uses the publishable key as read auth, so most visitors never get\n // a session (no per-visitor Redis write).\n private _sessionStarted = false;\n private _sessionStarting: Promise<void> | null = null;\n\n private _session: SessionState = { channelId: null, customer: null, authenticated: false };\n private _cart: unknown | null = null;\n private _cartId: string | null = null;\n\n // Namespaces are built in the constructor so their getters/methods close over\n // the instance (`self`) correctly - object-literal getters don't bind `this`.\n readonly events!: { list: () => Promise<unknown>; get: (eventId: string) => Promise<unknown> };\n readonly theme!: { get: () => Promise<unknown>; apply: () => Promise<unknown> };\n readonly cart!: {\n readonly current: unknown | null;\n readonly id: string | null;\n ensure: () => Promise<string>;\n add: (item: CartItemInput) => Promise<unknown>;\n remove: (itemId: string) => Promise<unknown>;\n refresh: () => Promise<unknown>;\n checkout: (opts?: { customerNotes?: string }) => Promise<unknown>;\n };\n readonly auth!: {\n readonly customer: unknown | null;\n readonly authenticated: boolean;\n requestMagicLink: (contact: { email?: string; phone?: string }) => Promise<unknown>;\n exchange: (proof: string | { type: string; code?: string; assertion?: string }) => Promise<unknown>;\n logout: () => Promise<void>;\n };\n readonly orders!: {\n mine: () => Promise<unknown>;\n get: (orderId: string) => Promise<unknown>;\n ticketPdf: (orderId: string, passId: string) => Promise<Blob>;\n };\n readonly payments!: {\n begin: (orderId: string, opts?: { paymentType?: string; returnUrl?: string }) => Promise<unknown>;\n };\n readonly presale!: {\n redeem: (code: string) => Promise<PresaleRedemption>;\n };\n readonly queue!: { status: () => Promise<unknown>; join: () => Promise<unknown> };\n\n constructor(\n client: LiveClient,\n opts: { sessionMode: 'cookie' | 'token'; publishableKey?: string; domain?: string; baseUrl: string }\n ) {\n this.client = client;\n this.sessionMode = opts.sessionMode;\n this.publishableKey = opts.publishableKey;\n this.domain = opts.domain;\n this.baseUrl = opts.baseUrl.replace(/\\/$/, '');\n\n const self = this;\n\n this.events = {\n list: () => self.client.salesListings.list(),\n get: (eventId) => self.client.sales.get(eventId).then((d) => field(d, 'event')),\n };\n\n this.theme = {\n get: () => self.client.sales.getTheme().then((d) => field(d, 'theme')),\n apply: async () => {\n const theme = await self.theme.get();\n applyTheme(theme as never);\n return theme;\n },\n };\n\n this.cart = {\n get current() {\n return self._cart;\n },\n get id() {\n return self._cartId;\n },\n ensure: async () => {\n if (!self._cartId) {\n // First mutation \u2192 create the session lazily, then the cart.\n await self.ensureSession();\n const res = await self.client.salesCarts.create({});\n const cart = field<{ id: string }>(res, 'cart');\n self._cartId = cart?.id ?? null;\n self._setCart(cart);\n }\n return self._cartId!;\n },\n add: async (item) => {\n const id = await self.cart.ensure();\n try {\n const res = await self.client.salesCarts.addItem(id, item);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // The server-side reservation lapsed under us. Drop the dead cart,\n // mint a fresh one and re-add - adding tickets should just work.\n self._resetCart();\n const freshId = await self.cart.ensure();\n const res = await self.client.salesCarts.addItem(freshId, item);\n self._setCart(field(res, 'cart'));\n return self._cart;\n }\n },\n remove: async (itemId) => {\n if (!self._cartId) return self._cart;\n try {\n const res = await self.client.salesCarts.removeItem(self._cartId, itemId);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // Nothing to remove from an expired cart - clear it locally and let\n // the UI fall through to an empty cart rather than surfacing an error.\n self._resetCart();\n return self._cart;\n }\n },\n refresh: async () => {\n if (!self._cartId) return self._cart;\n try {\n const res = await self.client.salesCarts.get(self._cartId);\n self._setCart(field(res, 'cart'));\n return self._cart;\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // A stale cartId carried in from a prior session/page load. Forget it\n // so the next mutation starts a clean cart.\n self._resetCart();\n return self._cart;\n }\n },\n checkout: async (opts = {}) => {\n if (!self._cartId) throw new Error('No cart to check out');\n try {\n const res = await self.client.salesCarts.checkout(self._cartId, opts as never);\n self._cartId = null;\n self._setCart(null);\n self.emitter.emit('checkout:completed', field(res, 'order'));\n return res; // { cart, order, orderAccessToken }\n } catch (err) {\n if (!self._isCartGone(err)) throw err;\n // Can't check out an expired cart - clear it and surface a clear,\n // actionable error instead of the raw 409.\n self._resetCart();\n throw new LiveAPIError(\n 'Your cart has expired. Please add your tickets again.',\n 'CART_EXPIRED',\n 409,\n );\n }\n },\n };\n\n this.auth = {\n get customer() {\n return self._session.customer;\n },\n get authenticated() {\n return self._session.authenticated;\n },\n requestMagicLink: (contact) => self.client.salesCustomerAuth.magicLink(contact),\n exchange: async (proof) => {\n // Exchanging a proof binds a customer to THIS session \u2192 ensure one exists.\n await self.ensureSession();\n const body = typeof proof === 'string' ? { type: 'magic_link', code: proof } : proof;\n const res = await self.client.salesCustomerTokens.create({ proof: body });\n self._session = {\n ...self._session,\n customer: field(res, 'customer') ?? null,\n authenticated: true,\n };\n self.emitter.emit('auth:changed', self._session);\n return res;\n },\n logout: async () => {\n await self.client.session.end().catch(() => undefined);\n self._session = { channelId: self._session.channelId, customer: null, authenticated: false };\n self._cart = null;\n self._cartId = null;\n self.emitter.emit('auth:changed', self._session);\n },\n };\n\n this.orders = {\n mine: () => self.client.salesMyOrders.list().then((d) => field(d, 'orders')),\n get: (orderId) => self.client.salesOrders.get(orderId).then((d) => field(d, 'order')),\n // Binary download - bypasses the generated (JSON) client; fetches the PDF\n // with the same session credentials.\n ticketPdf: async (orderId, passId) => {\n const headers: Record<string, string> = {};\n if (self.publishableKey) headers['Authorization'] = `Bearer ${self.publishableKey}`;\n if (self.sessionMode === 'token') {\n const token = await self.client.getSessionToken();\n if (token) headers['X-Live-Session'] = token;\n }\n const res = await fetch(\n `${self.baseUrl}/sales/orders/${orderId}/passes/${passId}/ticket.pdf`,\n { headers, credentials: self.sessionMode === 'cookie' ? 'include' : 'same-origin' },\n );\n if (!res.ok) throw new LiveAPIError(`Failed to download ticket (${res.status})`, 'TICKET_PDF_FAILED', res.status);\n return res.blob();\n },\n };\n\n this.payments = {\n begin: (orderId, opts = {}) =>\n self.client.salesOrderPayments.create(orderId, opts as never).then((d) => field(d, 'payment')),\n };\n\n this.presale = {\n // POST /sales/presale-codes/redeem - needs a signed-in customer. Gated\n // pricing unlocks immediately, so re-read the cart and let cart:updated\n // carry the new totals to subscribers. A failed refresh must not undo a\n // redemption that already succeeded.\n redeem: async (code) => {\n const res = (await self.client.salesPresaleCodes.redeem({ code: code.trim() })) as PresaleRedemption;\n if (self._cartId) await self.cart.refresh().catch(() => undefined);\n return res;\n },\n };\n\n this.queue = {\n status: () => self.client.queue.status(),\n join: () => self.client.queue.join(),\n };\n }\n\n /** Subscribe to a state event or UI intent; returns an unsubscribe fn. */\n on(event: LiveEvent, handler: (payload?: unknown) => void): () => void {\n return this.emitter.on(event, handler);\n }\n off(event: LiveEvent, handler: (payload?: unknown) => void): void {\n this.emitter.off(event, handler);\n }\n /**\n * Push an event onto the shared bus. Used by Elements/host to raise UI\n * intents (e.g. ui:checkout-requested) that the host app acts on - the SDK\n * relays but does not render UI itself.\n */\n emit(event: LiveEvent, payload?: unknown): void {\n this.emitter.emit(event, payload);\n }\n\n get session(): Readonly<SessionState> {\n return this._session;\n }\n\n /** True once a session has been created/resumed (i.e. a mutation has happened). */\n get hasSession(): boolean {\n return this._sessionStarted;\n }\n\n /**\n * Create the Live session on demand and hydrate state - idempotent and\n * single-flight. Called lazily before the first mutation (cart/login); NOT on\n * page load, so browsing never creates a session. Channel is identified by the\n * publishable key (embed) or the storefront domain (hosted).\n */\n async ensureSession(): Promise<void> {\n if (this._sessionStarted) return;\n if (this._sessionStarting) return this._sessionStarting;\n\n this._sessionStarting = (async () => {\n // Embed (token transport) authenticates the session by publishable key;\n // hosted (cookie transport) by storefront domain.\n const startBody: Record<string, string> = {};\n if (this.sessionMode === 'token' && this.publishableKey) {\n startBody.channelKey = this.publishableKey;\n } else if (this.domain) {\n startBody.domain = this.domain;\n } else if (this.publishableKey) {\n startBody.channelKey = this.publishableKey;\n }\n\n const started = await this.client.session.start(startBody as never);\n if (this.sessionMode === 'token') {\n const token = field<string>(started, 'sessionToken');\n if (token) await this.client.setSessionToken(token);\n }\n this._sessionStarted = true;\n await this.refreshSession();\n })();\n\n try {\n await this._sessionStarting;\n } finally {\n this._sessionStarting = null;\n }\n }\n\n /** @deprecated Use ensureSession(); kept for back-compat. */\n async start(opts: { domain?: string } = {}): Promise<void> {\n if (opts.domain) this.domain = opts.domain;\n return this.ensureSession();\n }\n\n /**\n * Rehydrate an ALREADY-EXISTING session (hosted/cookie transport) without\n * creating one. On a page load/refresh the client is lazily session-less, but\n * a returning visitor may still hold the `live_session` cookie with a cart\n * server-side. This probes `GET /session` (a cheap read - it 401s when no\n * session exists, and never writes one): on success it binds this client to\n * that session and pulls the cart back in; on 401 it stays session-less so\n * browsing still creates no session. Marking `_sessionStarted` on success is\n * load-bearing - otherwise the next mutation's ensureSession() would POST a\n * fresh session and orphan the existing cart.\n *\n * @returns true if an existing session was resumed.\n */\n async resumeIfExists(): Promise<boolean> {\n if (this._sessionStarted) return true;\n try {\n await this.refreshSession();\n this._sessionStarted = true;\n return true;\n } catch {\n // 401 NO_SESSION (or transient) \u2192 no session to resume; remain lazy.\n return false;\n }\n }\n\n /**\n * Resume an EXISTING session by token instead of bootstrapping a new one.\n * Used by the embedded checkout iframe: the third-party page hands off its\n * session token so the iframe sees the same cart/channel (token transport).\n */\n async resume(token: string): Promise<void> {\n await this.client.setSessionToken(token);\n this._sessionStarted = true;\n await this.refreshSession();\n }\n\n /** The current session token (token mode), for handing off to an embed iframe. */\n getSessionToken(): Promise<string | null> {\n return this.client.getSessionToken();\n }\n\n /** Re-read session state (customer, auth, cart) from the live-api session. */\n async refreshSession(): Promise<void> {\n const cur = await this.client.session.current();\n this._session = {\n channelId: field<{ id: string }>(cur, 'channel')?.id ?? null,\n customer: field(cur, 'customer') ?? null,\n authenticated: !!field<boolean>(cur, 'authenticated'),\n };\n const cartId = field<string>(cur, 'cartId') ?? null;\n if (cartId) {\n this._cartId = cartId;\n await this.cart.refresh();\n }\n this.emitter.emit('session:changed', this._session);\n }\n\n /**\n * Forget that a session was started, so the next mutation or sign-in mints a\n * fresh one. For adapters whose process outlives the session (a native app\n * signing out, a stored token the API rejected); a browser page reloads instead.\n */\n protected _resetSessionStarted(): void {\n this._sessionStarted = false;\n this._sessionStarting = null;\n }\n\n private _setCart(cart: unknown): void {\n this._cart = cart ?? null;\n this.emitter.emit('cart:updated', this._cart);\n }\n\n /**\n * True when an API error means the server-side cart is no longer usable -\n * it expired (reservation TTL lapsed), was already checked out, or can't be\n * found. The SDK holds the cartId in memory and rehydrates it from the\n * server session on load, so a lapsed cart would otherwise wedge every\n * subsequent add/remove/checkout with a 409.\n */\n private _isCartGone(err: unknown): boolean {\n if (!(err instanceof LiveAPIError)) return false;\n return (\n err.code === 'CART_EXPIRED' ||\n err.code === 'CART_NOT_ACTIVE' ||\n err.code === 'CART_NOT_FOUND' ||\n err.status === 404\n );\n }\n\n /** Forget all local cart state and notify subscribers the cart is now empty. */\n private _resetCart(): void {\n this._cartId = null;\n this._setCart(null);\n }\n}\n", "import { LiveClient, type LiveClientConfig } from './client.js';\nimport { publishClient } from './state/registry.js';\nimport { loadElements, type LoadElementsOptions } from './state/loadElements.js';\nimport { installCheckoutModal, type CheckoutModalOptions } from './state/checkoutModal.js';\nimport { installBuyModal } from './state/buyModal.js';\nimport { createElementsConnector } from './elements.js';\nimport { API_DATED_VERSION } from './client.js';\nimport { TicketlayerLive } from './core/liveClient.js';\n\n/**\n * Browser adapter over the runtime-neutral core in ./core/liveClient.ts:\n * resolves the channel from the page host, picks the session transport\n * (cookie for a hosted storefront, token for embeds), publishes the client on\n * `window.Ticketlayer`, applies the theme and mounts the modals. The class\n * itself is re-exported here so existing imports keep working.\n */\nexport { TicketlayerLive };\nexport type { PresaleRedemption, SessionState, CartItemInput } from './core/liveClient.js';\n\nexport interface CreateLiveClientOptions extends LiveClientConfig, LoadElementsOptions {\n /** Storefront host to resolve the channel from (hosted mode). Defaults to the page host. */\n domain?: string;\n /** Bootstrap the session immediately (default true). */\n autoStart?: boolean;\n /** Fetch + apply the channel theme on start (default true in the browser). */\n applyTheme?: boolean;\n /**\n * Publish this client on `window.Ticketlayer` so Elements can find + bind to\n * it (default true in the browser). Set false to keep the client private.\n */\n publish?: boolean;\n /**\n * Resume an existing session by token (token transport) instead of\n * bootstrapping a new one. Used by the embedded checkout iframe to inherit\n * the parent page's cart/session. Forces sessionMode 'token'.\n */\n sessionToken?: string;\n /**\n * Checkout rendering. 'modal' (third-party embeds) auto-opens the hosted\n * checkout in an iframe overlay on `ui:checkout-requested`. Omit on HBO,\n * which handles that intent by navigating to /checkout in-page.\n */\n checkout?: { mode: 'modal' } & CheckoutModalOptions;\n /**\n * Mount the in-page buy-tickets modal (occurrence \u2192 ticket selection) on\n * `ui:event-modal-requested`. Native Elements overlay, no iframe - works on\n * HBO and embeds alike. Defaults to true in the browser for the published\n * client; set false to opt out.\n */\n buyModal?: boolean;\n}\n\n\n/** Resolve a hosted storefront's publishable key by domain (GET /channel). */\nasync function resolveChannelKey(baseUrl: string, domain: string): Promise<string | undefined> {\n try {\n const res = await fetch(\n `${baseUrl.replace(/\\/$/, '')}/channel?domain=${encodeURIComponent(domain)}`,\n { headers: { accept: 'application/json' } }\n );\n if (!res.ok) return undefined;\n const json = (await res.json()) as { data?: { publishableKey?: string } };\n return json?.data?.publishableKey;\n } catch {\n return undefined;\n }\n}\n\nexport async function createLiveClient(options: CreateLiveClientOptions): Promise<TicketlayerLive> {\n const domain =\n options.domain ?? (typeof window !== 'undefined' ? window.location.host : undefined);\n\n // Resolve the channel's publishable key - the READ credential. Embeds pass it\n // directly; a hosted storefront resolves it ONCE by domain and then uses it\n // for all reads (no per-read domain lookup, no session). Browsing never\n // creates a session - that happens lazily on the first mutation/login.\n let publishableKey = options.publishableKey;\n if (!publishableKey && !options.sessionToken && domain) {\n publishableKey = await resolveChannelKey(options.baseUrl, domain);\n }\n\n // Transport: embed/handoff use the header (token); a hosted storefront uses\n // the cookie for its (lazily-created) session.\n const isEmbed = !!options.publishableKey || !!options.sessionToken;\n const sessionMode = options.sessionMode ?? (isEmbed ? 'token' : 'cookie');\n const client = new LiveClient({\n ...options,\n sessionMode,\n ...(publishableKey ? { publishableKey } : {}),\n });\n const tl = new TicketlayerLive(client, {\n sessionMode,\n baseUrl: options.baseUrl,\n ...(publishableKey ? { publishableKey } : {}),\n ...(domain ? { domain } : {}),\n });\n\n // Publish the singleton + Elements connector so Elements bind immediately.\n if (options.publish !== false && typeof window !== 'undefined') {\n publishClient(tl, createElementsConnector(tl), API_DATED_VERSION);\n }\n\n // Third-party embeds: auto-open the hosted checkout iframe on checkout intents.\n if (options.checkout?.mode === 'modal' && typeof window !== 'undefined') {\n installCheckoutModal(tl, options.checkout);\n }\n\n // In-page buy-tickets modal (occurrence \u2192 ticket selection). Native Elements\n // overlay mounted on `ui:event-modal-requested`; works on HBO and embeds. Tied\n // to the published client (the one driving on-page UI), opt out via buyModal.\n if (options.buyModal !== false && options.publish !== false && typeof window !== 'undefined') {\n installBuyModal(tl);\n }\n\n const elementsLoad = loadElements(options).catch((err) => {\n console.error('[live] Elements auto-load failed', err);\n });\n\n if (options.autoStart !== false) {\n // Embed iframe resumes a handed-off session; everyone else stays\n // session-less until the first mutation. Theme applies via the pk.\n if (options.sessionToken) {\n await tl.resume(options.sessionToken);\n } else if (sessionMode === 'cookie' && typeof window !== 'undefined') {\n // Hosted browser: if a session cookie already exists (a returning visitor\n // mid-purchase, or a refresh/deep-link), rehydrate its cart without\n // creating a session. A brand-new visitor 401s here and stays lazy.\n await tl.resumeIfExists().catch(() => undefined);\n }\n if (options.applyTheme !== false && typeof window !== 'undefined') {\n await tl.theme.apply().catch(() => undefined);\n }\n }\n\n await elementsLoad;\n return tl;\n}\n"],
5
+ "mappings": "mcAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,qBAAAE,EAAA,SAAAC,EAAA,qBAAAC,ICIO,IAAMC,EAAW,oBACXC,EAAc,QC2BpB,IAAMC,EAAoB,aAGjC,SAASC,GAAe,CA3BxB,IAAAC,EAAAC,EAAAC,EA4BE,IAAMC,EAAI,WACV,QAAIH,EAAAG,EAAE,YAAF,YAAAH,EAAa,WAAY,cAAsB,eAC/C,OAAOG,EAAE,QAAW,aAAe,OAAOA,EAAE,UAAa,YAAoB,WAC7ED,GAAAD,EAAAE,EAAE,UAAF,YAAAF,EAAW,WAAX,MAAAC,EAAqB,KAAa,QAAQC,EAAE,QAAQ,SAAS,IAAI,GACjEA,EAAE,YAAoB,OACnB,SACT,CAQO,IAAMC,EAAoB,GAAGC,EAAS,QAAQ,KAAM,EAAE,EAAE,QAAQ,IAAK,GAAG,CAAC,IAAIC,CAAW,KAAKP,EAAe,CAAE,IAU/G,SAAUQ,IAAkB,CAChC,IAAIC,EAAuB,KAC3B,MAAO,CACL,IAAK,IAAMA,EACX,IAAM,GAAK,CACTA,EAAQ,CACV,EACA,MAAO,IAAK,CACVA,EAAQ,IACV,EAEJ,CAuBM,IAAOC,EAAP,cAA4B,KAAK,CACrC,YACEC,EACgBC,EACAC,EAAc,CAE9B,MAAMF,CAAO,EAHG,KAAA,KAAAC,EACA,KAAA,OAAAC,EAGhB,KAAK,KAAO,cACd,GASWC,EAAP,KAAiB,CAQrB,YAAYC,EAAwB,CA/GtC,IAAAd,EAAAC,EAAAC,EAAAa,EA4LE,KAAA,cAAgB,CAMV,KAAM,SACS,MAAM,KAAK,QAAkC,kBAAmB,CAC/E,OAAQ,MACT,GASL,KAAA,kBAAoB,CAMd,UAAW,MAAOC,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,QAAQ,QAAQ,IAAI,EACrD,GAAI,CAACA,EAAI,OACP,eAAQ,MAAM,2EAA2E,EAClF,QAAQ,QAAQ,IAAI,EAG7BD,EAAE,WAAa,GACf,IAAME,EAAQC,EAAiB,CAC7B,QAASF,EAAI,OACb,eAAgBA,EAAI,eACpB,SAAUA,EAAI,aACd,GAAIA,EAAI,YAAc,CAAE,YAAaA,EAAI,WAAW,EAAK,CAAA,EACzD,SAAU,CAAE,KAAM,QAAS,GAAIA,EAAI,aAAe,CAAE,aAAcA,EAAI,YAAY,EAAK,CAAA,CAAG,EAC3F,EAAE,MAAOG,IACR,QAAQ,MAAM,sCAAuCA,CAAG,EACjD,KACR,EAED,OAAAJ,EAAE,YAAc,CAAE,MAAAE,CAAK,EAChBA,CACT,CAMKG,EAAI",
6
+ "names": ["auto_exports", "__export", "TicketlayerLive", "boot", "createLiveClient", "SDK_NAME", "SDK_VERSION", "API_DATED_VERSION", "describeRuntime", "_a", "_b", "_c", "g", "SDK_CLIENT_HEADER", "SDK_NAME", "SDK_VERSION", "memoryTokenStorage", "token", "LiveAPIError", "message", "code", "status", "LiveClient", "config", "_d", "request", "cartId", "itemId", "orderId", "passId", "customerId", "options", "params", "queryString", "requestPath", "eventId", "path", "url", "headers", "response", "text", "json", "error", "TICKETLAYER_GLOBAL_KEY", "TICKETLAYER_READY_EVENT", "ensureRegistry", "version", "w", "reg", "resolve", "publishClient", "client", "sdk", "resolvers", "r", "DEFAULT_ELEMENTS_URL", "SENTINEL_TAG", "inFlight", "loadElements", "opts", "_a", "ce", "url", "existing", "p", "resolve", "reject", "script", "OVERLAY_ID", "installCheckoutModal", "tl", "opts", "onMessage", "close", "_a", "open", "intent", "token", "base", "query", "url", "frameOrigin", "overlay", "wrapper", "frame", "e", "_b", "_c", "msg", "legacy", "order", "err", "offCheckout", "p", "offClose", "installBuyModal", "tl", "opts", "TAG", "el", "current", "remove", "open", "intent", "node", "_a", "i", "e", "_b", "message", "offOpen", "p", "offClose", "withCount", "cart", "_a", "_b", "_c", "_d", "_e", "c", "items", "i", "it", "qty", "line", "itemCount", "sum", "subtotal", "createElementsConnector", "tl", "ttMeta", "resolve", "ticketTypeId", "occurrenceId", "meta", "eventsManager", "options", "res", "l", "eventId", "ev", "occ", "o", "tt", "cartManager", "event", "cb", "p", "quantity", "categoryId", "last", "itemId", "seatId", "_seatId", "_occurrenceId", "ordersManager", "orderId", "passId", "authManager", "contact", "code", "presaleManager", "Emitter", "event", "handler", "_a", "payload", "h", "err", "STYLE_ID", "kebab", "m", "TYPOGRAPHY_VARS", "applyTheme", "theme", "_a", "_b", "_c", "_d", "vars", "push", "name", "value", "key", "style", "field", "obj", "key", "TicketlayerLive", "client", "opts", "Emitter", "self", "eventId", "d", "theme", "applyTheme", "_a", "res", "cart", "item", "id", "err", "freshId", "itemId", "LiveAPIError", "contact", "proof", "body", "orderId", "passId", "headers", "token", "code", "event", "handler", "payload", "startBody", "started", "_b", "_c", "_d", "cur", "cartId", "resolveChannelKey", "baseUrl", "domain", "_a", "res", "json", "createLiveClient", "options", "_b", "_c", "publishableKey", "isEmbed", "sessionMode", "client", "LiveClient", "tl", "TicketlayerLive", "publishClient", "createElementsConnector", "API_DATED_VERSION", "installCheckoutModal", "installBuyModal", "elementsLoad", "loadElements", "err", "readConfig", "_a", "el", "d", "boot", "_b", "w", "cfg", "ready", "createLiveClient", "err", "boot"]
7
7
  }
package/dist/version.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * Do not edit; do not commit.
4
4
  */
5
5
  export declare const SDK_NAME = "@ticketlayer/live";
6
- export declare const SDK_VERSION = "0.2.0";
6
+ export declare const SDK_VERSION = "0.3.2";
7
7
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -3,5 +3,5 @@
3
3
  * Do not edit; do not commit.
4
4
  */
5
5
  export const SDK_NAME = "@ticketlayer/live";
6
- export const SDK_VERSION = "0.2.0";
6
+ export const SDK_VERSION = "0.3.2";
7
7
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticketlayer/live",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "description": "Ticketlayer Live SDK - buyer-facing client (browser + React Native)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,26 +26,14 @@
26
26
  "LICENSE"
27
27
  ],
28
28
  "sideEffects": false,
29
- "scripts": {
30
- "prebuild": "node scripts/write-version.mjs",
31
- "build": "tsc -p tsconfig.json",
32
- "build:cdn": "npm run build && esbuild dist/auto.js --bundle --format=iife --global-name=TicketlayerLive --platform=browser --target=es2019 --minify --sourcemap --outfile=dist/ticketlayer.js",
33
- "clean": "rm -rf dist src/version.ts",
34
- "lint": "eslint src --ext .ts",
35
- "format": "prettier --write \"src/**/*.ts\"",
36
- "docs:gen": "typedoc",
37
- "pretest": "npm run build",
38
- "test": "node --test test/*.test.mjs",
39
- "changeset": "changeset",
40
- "release": "changeset publish"
41
- },
42
29
  "repository": {
43
30
  "type": "git",
44
- "url": "git+https://github.com/ticketlayer/live-sdk.git"
31
+ "url": "git+https://github.com/ticketlayer/live.git",
32
+ "directory": "packages/live"
45
33
  },
46
34
  "homepage": "https://docs.ticketlayer.com/sdks/live",
47
35
  "bugs": {
48
- "url": "https://github.com/ticketlayer/live-sdk/issues"
36
+ "url": "https://github.com/ticketlayer/live/issues"
49
37
  },
50
38
  "keywords": [
51
39
  "ticketlayer",
@@ -57,12 +45,11 @@
57
45
  "author": "Ticketlayer",
58
46
  "license": "MIT",
59
47
  "engines": {
60
- "node": ">=18.0.0"
48
+ "node": ">=22.0.0"
61
49
  },
62
50
  "publishConfig": {
63
51
  "access": "public",
64
- "registry": "https://registry.npmjs.org/",
65
- "provenance": true
52
+ "registry": "https://registry.npmjs.org/"
66
53
  },
67
54
  "ticketlayer": {
68
55
  "spec": "1.0.0",
@@ -70,11 +57,20 @@
70
57
  "generator": "backstage-sdk-tooling 0.1.0"
71
58
  },
72
59
  "devDependencies": {
73
- "@changesets/cli": "^2.31.1",
74
60
  "@types/node": "^22.15.30",
75
61
  "esbuild": "^0.24.0",
76
62
  "typedoc": "^0.28.15",
77
63
  "typedoc-plugin-markdown": "^4.9.0",
78
64
  "typescript": "^5.8.3"
65
+ },
66
+ "scripts": {
67
+ "prebuild": "node scripts/write-version.mjs",
68
+ "build": "tsc -p tsconfig.json",
69
+ "build:cdn": "pnpm run build && esbuild dist/auto.js --bundle --format=iife --global-name=TicketlayerLive --platform=browser --target=es2019 --minify --sourcemap --outfile=dist/ticketlayer.js",
70
+ "clean": "rm -rf dist src/version.ts",
71
+ "docs:gen": "typedoc",
72
+ "pretest": "pnpm run build",
73
+ "test": "node --test test/*.test.mjs",
74
+ "typecheck": "tsc -p tsconfig.json --noEmit"
79
75
  }
80
- }
76
+ }