@seatlayer/js 0.95.1 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ICMSBXRJ.js +1 -0
- package/dist/chunk-URLBBOTJ.js +1 -0
- package/dist/hostedCheckout-4BFFNCCU.js +146 -0
- package/dist/index.cjs +148 -60
- package/dist/index.d.cts +57 -7
- package/dist/index.d.ts +57 -7
- package/dist/index.js +17 -17
- package/dist/manager.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-JELR6YYZ.js +0 -1
- package/dist/hostedCheckout-GQQF4XDN.js +0 -58
package/dist/manager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as _,t as K}from"./chunk-
|
|
1
|
+
import{s as _,t as K}from"./chunk-URLBBOTJ.js";import{A as Ve,B as Pe,C as je,D as qe,E as Ne,F as _e,G as Ke,H as Ue,I as We,J as Ge,K as Ze,L as Ye,M as Xe,N as Qe,O as Je,P as et,Q as tt,R as st,S as it,T as ot,V as at,a as L,b as U,c as k,d as F,e as W,f as G,g as Z,h as Y,i as O,j as M,k as x,l as X,m as Q,n as J,o as ee,p as te,q as T,r as m,s as D,t as se,u as V,v as ze,w as Ie,x as Fe,y as Oe,z as De}from"./chunk-DR5JXWLO.js";import{d as I,f as N}from"./chunk-RZ2VKZ44.js";import"./chunk-OSZ7DOEH.js";var ie={hold:"Held",release:"Released",expire:"Expired",book:"Booked",unbook:"Cancelled",block:"Blocked",unblock:"Unblocked"},C=class{constructor(e,t){this.host=e;this.fetchPage=t;this.closed=!1;this.busy=!1;this.generation=0;this.entries=[];this.next=null;this.summary=document.createElement("div");this.list=document.createElement("div");this.message=document.createElement("div");this.older=document.createElement("button");this.latest=document.createElement("button");e.className="slm-seat-history",this.summary.className="slm-history-counts",this.list.className="slm-history-list",this.list.setAttribute("role","region"),this.list.setAttribute("aria-label","Seat history"),this.list.tabIndex=0,this.message.className="slm-note",this.message.setAttribute("role","status"),this.older.className=this.latest.className="slm-btn ghost",this.older.textContent="Load older",this.older.hidden=!0,this.latest.textContent="New activity \xB7 Show latest",this.latest.hidden=!0,this.older.onclick=()=>{this.load(!0)},this.latest.onclick=()=>{this.list.scrollTop=0,this.latest.hidden=!0,this.load()},e.append(this.summary,this.latest,this.list,this.message,this.older),this.load()}destroy(){this.closed=!0,this.generation++}refresh(){this.busy||this.load(!1,!0)}async load(e=!1,t=!1){if(this.closed||this.busy||e&&!this.next)return;this.busy=!0,this.older.disabled=!0;let s=this.generation;t||(this.message.textContent="Loading history\u2026");try{let i=await this.fetchPage(e?this.next:void 0,this.action);if(this.closed||s!==this.generation)return;if(this.paintCounts(i),t&&this.entries.length&&i.entries[0]?.id!==this.entries[0]?.id&&this.list.scrollTop>24){this.latest.hidden=!1;return}let o=!t||i.entries[0]?.id!==this.entries[0]?.id;e?(this.entries=[...this.entries,...i.entries.filter(a=>!this.entries.some(l=>l.id===a.id))],this.next=i.nextBefore):o&&(this.entries=i.entries,this.next=i.nextBefore),o&&this.paintRows(),this.older.hidden=this.next===null,this.message.textContent=this.entries.length?"":"No recorded activity for this seat."}catch{if(!this.closed){this.message.textContent="History could not be loaded. ";let i=document.createElement("button");i.className="slm-btn ghost",i.textContent="Retry",i.onclick=()=>{this.load(e)},this.message.append(i)}}finally{this.busy=!1,this.older.disabled=!1}}paintCounts(e){let t=[{action:"",count:e.total},...e.counts];this.summary.replaceChildren(...t.map(({action:s,count:i})=>{let o=document.createElement("button");return o.type="button",o.textContent=s?`${ie[s]??s} ${i}`:`${i} changes`,o.setAttribute("aria-pressed",String((this.action??"")===s)),o.onclick=()=>{this.busy||(this.action=s||void 0,this.entries=[],this.next=null,this.list.scrollTop=0,this.latest.hidden=!0,this.load())},o}))}paintRows(){let e=this.list.scrollTop;this.list.replaceChildren(...this.entries.map(t=>{let s=document.createElement("div");s.className="slm-history-row",s.dataset.action=t.action;let i=document.createElement("time");i.dateTime=new Date(t.at).toISOString(),i.textContent=new Date(t.at).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),i.title=new Date(t.at).toString();let o=document.createElement("strong");return o.textContent=ie[t.action]??t.action,s.append(i,o),s})),this.list.scrollTop=e}};var lt={held:"HOLD",booked:"BOOK",expired:"EXPIRE",released:"RELEASE",cancelled:"CANCEL",blocked:"BLOCK",unblocked:"ON SALE",available:"FREE"},oe={held:"Held",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again"},E=class{constructor(e,t,s){this.host=e;this.locate=s;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let i={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},i),this.list.addEventListener("focusin",()=>{this.paused=!0},i),this.list.addEventListener("toggle",a=>{a.target.open&&(this.paused=!0)},{...i,capture:!0}),this.newer.addEventListener("click",o,i),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},i)}update(e){this.items=e,this.render()}render(e=!1){let t=this.items,s=t.filter(a=>!this.shown.has(a.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let i=t.slice(0,this.limit),o=i.map(a=>`${a.id}:${a.verb}`).join("|");if(o!==this.signature){if(this.signature=o,this.shown=new Set(t.map(a=>a.id)),this.list.replaceChildren(),!i.length){let a=document.createElement("p");a.className="slm-activity-empty",a.textContent=this.items.length?"No activity matches these filters.":"Waiting for activity. Holds, bookings and releases will appear here.",this.list.append(a)}for(let a of i){let l=document.createElement("article");l.className="slm-activity-entry",l.dataset.status=a.status;let r=document.createElement("button");r.type="button",r.className="slm-activity-row";let c=`${oe[a.verb]??a.verb} \xB7 ${a.count} seat${a.count===1?"":"s"} \xB7 ${a.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${a.labels.join(", ")} \xB7 ${new Date(a.at).toLocaleString()}`;r.title=`${c} \u2014 click to show seats on the map`,r.setAttribute("aria-label",`Show seats on map: ${c}`),r.addEventListener("click",()=>this.locate(a.id));let d=document.createElement("time");d.dateTime=new Date(a.at).toISOString(),d.textContent=new Date(a.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let h=document.createElement("strong");h.textContent=lt[a.verb]??a.verb,h.title=oe[a.verb]??a.verb;let p=document.createElement("span");if(p.className="slm-activity-seats",p.textContent=a.labels.join(", "),r.append(d,h,p),l.append(r),a.count>1){let u=document.createElement("details");u.className="slm-activity-details";let g=document.createElement("summary");g.textContent="\u22EF",g.setAttribute("aria-label",`Show all ${a.count} seats`);let f=document.createElement("p");f.textContent=c,u.append(g,f),l.append(u)}this.list.append(l)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};var R=class{constructor(e){this.host=e;this.moving=!1;this.space=!1;this.monitor=!1;this.selected=0;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=b=>`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${b}</svg>`,i=s('<path d="M8 13V6a2 2 0 0 1 4 0v6-8a2 2 0 0 1 4 0v8-6a2 2 0 0 1 4 0v10c0 4-3 6-7 6-3 0-5-2-7-5l-3-4a2 2 0 0 1 3-2l2 2Z"/>'),o=s('<path d="m5 3 14 10-7 1-3 7-4-18Z"/>'),a=s('<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>'),l=s('<path d="M7 6h10M12 1v10M7 18h10"/>'),r=s('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M15 4v16"/>');t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map navigation">
|
|
2
2
|
<button type="button" data-nav="move" aria-label="Move" aria-pressed="false" title="Drag to move the map; hold Space temporarily">${i}</button>
|
|
3
3
|
<button type="button" data-nav="select" aria-label="Select" aria-pressed="true" title="Drag to select seats \xB7 drag empty floor to move">${o}</button>
|
|
4
4
|
<button type="button" data-nav="search" aria-label="Search" title="Search seats, rows or sections" aria-expanded="false">${a}</button>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seatlayer/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "SeatLayer's official JavaScript seating chart and seat map SDK — live availability, seat selection, temporary holds, and a typed API for any web ticketing app.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript"
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@seatlayer/core": "0.
|
|
71
|
+
"@seatlayer/core": "0.97.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsup": "^8.5.1",
|
package/dist/chunk-JELR6YYZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as C}from"@seatlayer/core";import{cdnAssetUrl as _}from"@seatlayer/core/core/cdnAsset";var A=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,T=/[\s"'<>`\\]/;function E(i){return i.startsWith("//")?!1:i.startsWith("/")||i.startsWith("./")||i.startsWith("../")}function S(){try{let i=typeof location>"u"?"":location.origin;return i&&i!=="null"?i:null}catch{return null}}function x(i){if(typeof i!="string"||!i||i.length>2e6||i!==i.trim())return!1;if(i.startsWith("data:"))return A.test(i);if(T.test(i))return!1;let t=S();if(E(i)){if(!t)return!1;try{let n=new URL(i,t);return n.origin===t&&!n.username&&!n.password}catch{return!1}}try{let n=new URL(i);return n.username||n.password?!1:n.protocol==="https:"||t!=null&&n.origin===t}catch{return!1}}import{SEATLAYER_MODULE_URL as ae}from"@seatlayer/core/core/cdnAsset";function d(i,t){let n=C(i);return n===i?t:n}function $(){return globalThis.matchMedia?.("(pointer: coarse)").matches??!1?d("picker.dragToLookTouch","Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close"):d("picker.dragToLookMouse","Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function B(){return{rotate:d("picker.dragToRotateVenue","Drag to rotate the venue"),move:d("picker.dragToMoveVenue","Drag to move the venue"),zoomIn:d("picker.zoomIn","Zoom in"),zoomOut:d("picker.zoomOut","Zoom out"),fitView:d("picker.fitWholeVenue","Show whole venue")}}function X(i,t){let n=t?i.toLocaleUpperCase(t):i.toLocaleUpperCase(),e=t?i.toLocaleLowerCase(t):i.toLocaleLowerCase();if(i!==n||n===e)return i;let o=[...e][0]??"";return(t?o.toLocaleUpperCase(t):o.toLocaleUpperCase())+e.slice(o.length)}function G(i){if(typeof i=="string"){let t=document.querySelector(i);if(!t)throw new Error(`seatmap: container "${i}" not found`);return t}if(!(i instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return i}function K(i){return String(i??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function q(i,t,n){let e=t.find(l=>x(l))??null;if(i.replaceChildren(),!e)return i.textContent=n.slice(0,1).toUpperCase(),null;let o=document.createElement("img");return o.alt="",o.referrerPolicy="no-referrer",o.src=e,i.appendChild(o),e}var v=null;function Z(){if(v!==null)return v;try{if(typeof document>"u")return v=!1;v=!!document.createElement("canvas").getContext("webgl2")}catch{v=!1}return v}function b(i){return _(i)}var y=null;function P(){return y||(y=(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(b("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")).catch(t=>{throw y=null,t}),y)}function j(){(typeof navigator>"u"?void 0:navigator.connection)?.saveData||P().catch(()=>{})}async function z(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(b("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function J(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(b("seatlayer-checkout.mjs")):import("./hostedCheckout-GQQF4XDN.js")}function Q(i){return i==="unavailable_for_event"||i==="payments_off_for_event"?i:"not_configured"}function ee(i){return i.lineItems.reduce((t,n)=>t+n.quantity,0)}function L(i,t){if(i.objectType!=="ga")return i.displayLabel??i.label;let n=t.find(e=>e.id===i.objectId);return i.displayLabel??n?.displayLabel??n?.label??d("picker.generalAdmission","General admission")}var k=(i,t,n)=>C("picker.bookingForm.guestOfCount",{label:i,index:t,total:n});function R(i,t,n=[]){let e=new Map,o=[];for(let s of i.lineItems){let r=L(s,n),f=Math.max(1,Math.floor(s.quantity)||1);if(s.objectType!=="ga"&&!(s.objectType==="table"&&f>1)){o.push({key:s.label,name:r,unitIndex:1,quantity:1});continue}for(let h=1;h<=f;h+=1){let p=(e.get(s.label)??0)+1;e.set(s.label,p),o.push({key:`${s.label}#${p}`,name:r,unitIndex:h,quantity:f})}}let l=t?.ticketKeyDetails??[],a=t?.ticketKeys??l.map(s=>s.ticketKey),m=(a.length===o.length?a:o.map(s=>s.key)).map(s=>{let r=o.find(h=>h.key===s),f=l.find(h=>h.ticketKey===s);return{key:s,name:f?.displayLabel??r?.name,unitIndex:f?.unitIndex??r?.unitIndex??1,quantity:f?.quantity??r?.quantity??1}}),c=new Map;for(let s of m)s.name&&s.quantity<=1&&c.set(s.name,(c.get(s.name)??0)+1);let u=new Map;return m.map(({key:s,name:r,unitIndex:f,quantity:h})=>{if(!r)return{key:s};if(h>1)return{key:s,title:k(r,f,h)};let p=(u.get(r)??0)+1;u.set(r,p);let g=c.get(r)??1;return{key:s,title:g>1?k(r,p,g):r}})}function te(i,t,n,e,o=[]){let l=new Map;for(let a of i.lineItems){let m=L(a,o);l.set(m,(l.get(m)??0)+1)}return{kind:"pay",provider:t,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:[...l].map(([a,m])=>m>1?`${a} \xD7${m}`:a),tickets:R(i,e,o)},bookingForm:n?.bookingForm??null,...n?.bookingMode==="free"?{free:!0}:{}}}function ne(i){return String(i?.code).startsWith("booking_form_")}function ie(i,t,n){let e={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},o=new Date(i);if(t)try{return o.toLocaleString(n,{...e,timeZone:t})}catch{}return o.toLocaleString(n,e)}function se(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}import{pointInPolygon as I}from"@seatlayer/core";import{createMinimapTransform as D,minimapPointToWorld as H,minimapViewportPlan as V}from"@seatlayer/core/picker/minimapGeometry";function O(i){let t={inactive:0,available:1,selected:2},n=new Map;for(let o of i){let l=n.get(o.id);(!l||t[o.state]>t[l])&&n.set(o.id,o.state)}let e={selected:0,available:0,inactive:0};for(let o of n.values())e[o]+=1;return e}function W(i,t){return i.x<=t.x&&i.y<=t.y&&i.x+i.width>=t.x+t.width&&i.y+i.height>=t.y+t.height}function me(i,t){let n=new M(i);return n.build(t),n}var M=class{constructor(t){this.host=t;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(t){if(!this.host.controller.getViewport())return;let e=document.createElement("button");e.type="button",e.className="sl-minimap-toggle",e.setAttribute("aria-label",d("picker.openVenueMap","Open venue overview map")),e.setAttribute("aria-expanded","false"),e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',t.appendChild(e),this.miniToggle=e;let o=document.createElement("div");o.className="sl-minimap",o.setAttribute("role","group");let l=document.createElement("div");l.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let m=document.createElement("span");m.className="sl-minimap-key",m.setAttribute("aria-label",d("picker.minimapStateKey","Focused, selected, available, and inactive sections")),m.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let c=document.createElement("button");c.type="button",c.className="sl-minimap-close",c.setAttribute("aria-label",d("picker.closeVenueMap","Close venue overview map")),c.textContent="\xD7",l.append(a,m,c);let u=document.createElement("canvas");u.tabIndex=0,u.setAttribute("role","application"),u.setAttribute("aria-label",d("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),o.append(l,u),t.appendChild(o),this.miniWrap=o,this.miniLabel=a,this.miniCanvas=u;let s=document.createElement("canvas");this.miniBase=s,e.addEventListener("click",()=>{let r=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=r,this.setMinimapOpen(!r)}),c.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),u.addEventListener("click",r=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(r)}),u.addEventListener("pointerdown",r=>this.minimapPointerDown(r)),u.addEventListener("pointermove",r=>this.minimapPointerMove(r)),u.addEventListener("pointerup",r=>this.minimapPointerUp(r)),u.addEventListener("pointercancel",r=>this.minimapPointerUp(r)),u.addEventListener("keydown",r=>this.minimapKeydown(r)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(t){if(this.miniWrap){if(!t){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(t,n=!0){this.host.root()?.setAttribute("data-minimap-open",String(t)),this.miniToggle?.setAttribute("aria-expanded",String(t)),n&&(t?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let t=this.miniCanvas,n=this.miniBase,e=this.host.controller.getViewport()?.bounds;if(!t||!n||!e||!(e.width>0&&e.height>0))return;let o=196,l=146,a=6,m=e.width/Math.max(1,e.height),c=o,u=Math.round(o/m);u>l&&(u=l,c=Math.round(l*m)),c=Math.max(64,c),u=Math.max(48,u);let s=Math.min(2,window.devicePixelRatio||1);t.width=Math.round(c*s),t.height=Math.round(u*s),t.style.width=`${c}px`,t.style.height=`${u}px`,n.width=t.width,n.height=t.height,this.miniTf=D(e,t.width,t.height,s,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let t=this.host.controller.getFloors(),n=this.host.controller.isFloorOverview()?d("picker.allFloors","All floors"):t.find(s=>s.id===this.host.controller.getActiveFloorId())?.name??d("picker.venueOverview","Venue overview"),e=this.host.controller.getMinimapSnapshot().sections,l=e.find(s=>s.active)?.label??this.host.focusedSectionLabel(),a=l?`${n} \xB7 ${l}`:n;this.miniLabel.textContent=a;let{selected:m,available:c,inactive:u}=O(e);this.miniWrap.setAttribute("aria-label",e.length?`${a}. ${m} selected, ${c} available, ${u} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",e.length?`${a}. ${m} selected, ${c} available, ${u} inactive sections. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let t=this.miniBase,n=this.miniTf;if(!t||!n)return;let e=t.getContext("2d");if(!e)return;e.clearRect(0,0,t.width,t.height);let o=r=>r*n.scale+n.offX,l=r=>r*n.scale+n.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",m=this.host.cssVar("--sl-muted")||"#8b93a7",c=this.host.cssVar("--sl-accent")||"#6e7bff",u=this.host.cssVar("--sl-success")||"#22a06b",s=this.host.controller.getMinimapSnapshot();for(let r of s.sections){if(r.outline.length<3)continue;e.beginPath(),r.outline.forEach((h,p)=>p===0?e.moveTo(o(h.x),l(h.y)):e.lineTo(o(h.x),l(h.y))),e.closePath();let f=r.paint;if(e.globalAlpha=r.state==="inactive"?.5:.92,f?e.fillStyle=f.fill:(e.globalAlpha=r.state==="inactive"?.18:r.state==="selected"?.72:.34,e.fillStyle=r.state==="inactive"?m:r.state==="selected"?c:u),e.fill(),e.globalAlpha=.82,e.lineWidth=Math.max(1,n.dpr),e.strokeStyle=f?.stroke||a,e.stroke(),r.owned){e.globalAlpha=1,e.lineWidth=Math.max(2,n.dpr*1.5),e.strokeStyle=c,e.stroke();let h=r.outline.reduce((p,g)=>({x:p.x+g.x,y:p.y+g.y}),{x:0,y:0});e.beginPath(),e.arc(o(h.x/r.outline.length),l(h.y/r.outline.length),Math.max(1.5,n.dpr*1.6),0,Math.PI*2),e.fillStyle=c,e.fill(),e.beginPath(),r.outline.forEach((p,g)=>g===0?e.moveTo(o(p.x),l(p.y)):e.lineTo(o(p.x),l(p.y))),e.closePath()}r.active&&(e.globalAlpha=1,e.lineJoin="round",e.lineWidth=Math.max(4,n.dpr*3.5),e.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",e.stroke(),e.lineWidth=Math.max(2,n.dpr*1.75),e.strokeStyle=c,e.stroke())}if(e.globalAlpha=1,!s.sections.length){let r=Math.max(1,n.dpr),f=new Map,h=p=>{let g=f.get(p);if(g)return g;let w=this.host.tint?.(p)||u;return f.set(p,w),w};for(let p of s.seats)e.globalAlpha=p.state==="inactive"?.22:.78,e.fillStyle=p.state==="inactive"?m:p.state==="selected"?c:h(p.categoryKey),e.beginPath(),e.arc(o(p.x),l(p.y),r,0,Math.PI*2),e.fill();e.globalAlpha=1}}drawMinimapRect(){let t=this.miniCanvas,n=this.miniBase,e=this.miniTf;if(!t||!n||!e)return;let o=t.getContext("2d");if(!o)return;o.clearRect(0,0,t.width,t.height),o.drawImage(n,0,0);let l=this.host.controller.getViewport();if(!l||W(l.visible,l.bounds))return;let a=V(l.visible,e,t.width,t.height,Math.max(2,e.dpr*2)),m=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";o.save(),o.globalAlpha=.1,o.fillStyle=m,o.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=.9,o.lineJoin="round",o.lineWidth=Math.max(4,e.dpr*3.25),o.strokeStyle=c,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=1,o.lineWidth=Math.max(2,e.dpr*1.75),o.strokeStyle=m,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(o.setLineDash([Math.max(3,e.dpr*3),Math.max(2,e.dpr*2)]),o.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),o.restore()}minimapWorldPoint(t){let n=this.miniCanvas,e=this.miniTf;if(!n||!e)return null;let o=n.getBoundingClientRect(),l=(t.clientX-o.left)*(n.width/Math.max(1,o.width)),a=(t.clientY-o.top)*(n.height/Math.max(1,o.height));return{...H({x:l,y:a},e),px:l,py:a}}minimapPointerDown(t){let n=this.minimapWorldPoint(t),e=this.host.controller.getViewport()?.visible;!n||!e||!(n.x>=e.x&&n.x<=e.x+e.width&&n.y>=e.y&&n.y<=e.y+e.height)||(this.miniDrag={pointerId:t.pointerId,offsetX:n.x-(e.x+e.width/2),offsetY:n.y-(e.y+e.height/2),startX:t.clientX,startY:t.clientY,moved:!1},this.miniCanvas?.setPointerCapture(t.pointerId),this.miniCanvas?.classList.add("sl-dragging"),t.preventDefault())}minimapPointerMove(t){let n=this.miniDrag;if(!n||n.pointerId!==t.pointerId)return;let e=this.minimapWorldPoint(t);e&&(!n.moved&&Math.hypot(t.clientX-n.startX,t.clientY-n.startY)>2&&(n.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:e.x-n.offsetX,y:e.y-n.offsetY}),t.preventDefault())}minimapPointerUp(t){let n=this.miniDrag;!n||n.pointerId!==t.pointerId||(this.miniSuppressClick=n.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(t.pointerId)&&this.miniCanvas.releasePointerCapture(t.pointerId))}minimapKeydown(t){let n=this.host.controller.getViewport()?.visible;if(!n)return;if(t.key==="Home"){this.host.controller.overview(),t.preventDefault();return}let e=t.key==="ArrowLeft"?-n.width*.2:t.key==="ArrowRight"?n.width*.2:0,o=t.key==="ArrowUp"?-n.height*.2:t.key==="ArrowDown"?n.height*.2:0;!e&&!o||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:n.x+n.width/2+e,y:n.y+n.height/2+o}),t.preventDefault())}minimapJump(t){let n=this.minimapWorldPoint(t);if(n){for(let e of this.host.controller.getMinimapSnapshot().sections)if(!(e.state==="inactive"||e.outline.length<3)&&I(n,e.outline)){this.host.controller.focusSection(e.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(n)}}};export{x as a,d as b,$ as c,B as d,X as e,G as f,K as g,q as h,Z as i,P as j,j as k,z as l,J as m,Q as n,ee as o,te as p,ne as q,ie as r,se as s,me as t};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import"./chunk-OSZ7DOEH.js";var ae=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,se=/^[0-9 +()-]{6,20}$/,le=/^(\d{4})-(\d{2})-(\d{2})$/,ce=["required","invalid","too_long"],de=[["attendeeName","name","picker.bookingForm.name","Name"],["attendeeEmail","email","picker.bookingForm.email","Email"],["attendeePhone","phone","picker.bookingForm.phone","Phone"]],ue={email:"email",phone:"tel",number:"number",date:"date"};function ee(e){return e===void 0||e===""||e===!1||Array.isArray(e)&&!e.length}function pe(e,r,o,l){if(ee(o))return r?"required":null;let p=x=>!!l?.some(E=>E.id===x);if(e==="number")return typeof o=="number"&&Number.isFinite(o)?null:"invalid";if(e==="checkbox")return o===!0?null:"invalid";if(e==="select")return p(o)?null:"invalid";if(e==="multiselect")return Array.isArray(o)&&o.length<=50&&o.every(p)?null:"invalid";if(typeof o!="string")return"invalid";if(e==="phone")return se.test(o)?null:"invalid";if(o.length>500)return"too_long";if(e==="email")return ae.test(o)?null:"invalid";if(e==="date"){let x=le.exec(o);if(!x)return"invalid";let[E,F,B]=[Number(x[1]),Number(x[2]),Number(x[3])],w=new Date(Date.UTC(E,F-1,B));return w.getUTCFullYear()===E&&w.getUTCMonth()===F-1&&w.getUTCDate()===B?null:"invalid"}return null}function v(e,r,o){let l=document.createElement(e);return r&&(l.className=r),o!==void 0&&(l.textContent=o),l}function Z(e,r){let o=e?.[r];return o==="optional"||o==="required"?o:"off"}function te(e){let{form:r,t:o,idPrefix:l}=e,p=(r?.questions??[]).filter(n=>n&&!n.archived).sort((n,t)=>n.position-t.position),x=de.filter(([n])=>Z(r,n)!=="off"),E=p.filter(n=>n.scope==="ticket"),F=p.filter(n=>n.scope!=="ticket"),B=x.length>0||E.length>0;if(!B&&!F.length)return{element:null,validate:()=>!0,payload:()=>({}),showServerErrors:()=>!1};let w=[],A=[],S=v("div","sl-hco-bf"),K=v("div"),_=v("p","sl-hco-status sl-hco-error");_.setAttribute("role","alert"),_.hidden=!0;let U=0,R=(n,t)=>t==="required"?o("picker.bookingForm.required","This is required."):t==="too_long"?o("picker.bookingForm.tooLong","This is too long."):n==="email"?o("picker.bookingForm.invalidEmail","Enter a valid email address."):n==="phone"?o("picker.bookingForm.invalidPhone","Enter a valid phone number."):o("picker.bookingForm.invalid","Check this answer."),$=(n,t)=>{n.error.textContent=t?R(n.kind,t):"",n.error.hidden=!t;let i=n.kind==="multiselect"?n.control.closest("fieldset")??n.control:n.control;t?i.setAttribute("aria-invalid","true"):i.removeAttribute("aria-invalid")},X=(n,t)=>{let i=`${l}-bf${U++}`,c=v("div","sl-hco-field"),s=t.required?t.label:o("picker.bookingForm.optional","{label} (optional)",{label:t.label}),g=t.help?v("p","sl-hco-help",t.help):null;g&&(g.id=`${i}-h`);let h=v("p","sl-hco-ferr");h.id=`${i}-e`,h.hidden=!0;let C=y=>{y.setAttribute("aria-describedby",g?`${g.id} ${h.id}`:h.id),t.required&&y.tagName!=="FIELDSET"&&y.setAttribute("aria-required","true")},M;if(t.kind==="checkbox"||t.kind==="multiselect"){let y=t.kind==="multiselect"?v("fieldset","sl-hco-group"):null,k=y?t.options??[]:[{id:"",label:s}];y&&(y.appendChild(v("legend",void 0,s)),g&&y.appendChild(g),C(y));let T=k.map((b,I)=>{let P=v("label","sl-hco-check"),L=v("input");return L.type="checkbox",L.value=b.id,y?I===0&&(L.id=i):(L.id=i,C(L)),P.append(L,v("span",void 0,b.label)),(y??c).appendChild(P),L});y?c.appendChild(y):g&&c.appendChild(g),M={...t,control:T[0]??y??c,error:h,read:y?()=>T.filter(b=>b.checked).map(b=>b.value):()=>!!T[0]?.checked}}else{let y=v("label","sl-hco-label",s);y.htmlFor=i;let k;if(t.kind==="textarea")k=v("textarea","sl-hco-input"),k.rows=3,k.maxLength=500;else if(t.kind==="select"){k=v("select","sl-hco-input"),k.appendChild(new Option(o("picker.bookingForm.choose","Choose\u2026"),""));for(let b of t.options??[])k.appendChild(new Option(b.label,b.id))}else k=v("input","sl-hco-input"),k.type=ue[t.kind]??"text",t.kind==="number"?(k.step="any",k.inputMode="decimal"):t.kind!=="date"&&(k.maxLength=t.kind==="phone"?20:500),t.autocomplete&&(k.autocomplete=t.autocomplete);k.id=i,C(k),c.append(y,...g?[g]:[],k);let T=k;M={...t,control:k,error:h,read:()=>{let b=T.value.trim();return t.kind!=="number"?b:T.validity?.badInput?Number.NaN:b===""?void 0:Number(b)},write:b=>{T.value=b}}}c.appendChild(h);let Q=()=>$(M,null);return c.addEventListener("input",Q),c.addEventListener("change",Q),n.appendChild(c),w.push(M),M},N=(n,t,i)=>X(n,{key:`question:${t.id}`,...i!==void 0?{ticketKey:i}:{},kind:t.type,label:t.label,required:!!t.required,help:t.helpText,options:t.options}),q=n=>{if(A.includes(n.key))return;let t=!A.length;A.push(n.key);let i=v("fieldset","sl-hco-block");i.appendChild(v("legend","sl-hco-legend",n.title||o("picker.bookingForm.ticket","Ticket {number}",{number:A.length})));let c={};if(t&&x.some(([,s])=>s!=="phone")){let s=v("button","sl-hco-use",o("picker.bookingForm.useMyDetails","Use my details"));s.type="button",s.addEventListener("click",()=>{let g=e.buyer();for(let h of["name","email"]){let C=c[h];C&&g[h]&&(C.write?.(g[h]),$(C,null))}}),i.appendChild(s)}for(let[s,g,h,C]of x){let M=X(i,{key:s,ticketKey:n.key,kind:g,label:o(h,C),required:Z(r,s)==="required",autocomplete:"off"});g!=="phone"&&(c[g]=M)}for(let s of E)N(i,s,n.key);K.appendChild(i)};B&&e.tickets.forEach(q),S.appendChild(K);for(let n of F)N(S,n);S.appendChild(_);let D=n=>(_.textContent=n?o("picker.bookingForm.fix","Some details need attention."):"",_.hidden=!n,n?.control.focus(),!!n);return{element:S,validate(){let n=null;for(let t of w){let i=pe(t.kind,t.required,t.read(),t.options);$(t,i),i&&!n&&(n=t)}return!D(n)},payload(){let n=new Map,t=[];for(let i of w){let c=i.read();if(!ee(c)){if(i.key.startsWith("question:"))t.push({questionId:i.key.slice(9),...i.ticketKey!==void 0?{ticketKey:i.ticketKey}:{},value:c});else if(i.ticketKey!==void 0){let s=n.get(i.ticketKey)??{ticketKey:i.ticketKey},g=i.key==="attendeeName"?"name":i.key==="attendeeEmail"?"email":"phone";s[g]=String(c),n.set(i.ticketKey,s)}}}return{...n.size?{attendees:[...n.values()]}:{},...t.length?{answers:t}:{}}},showServerErrors(n){let t=(Array.isArray(n)?n:[]).filter(c=>!!c&&typeof c.key=="string");if(B){for(let c of t)typeof c.ticketKey=="string"&&!A.includes(c.ticketKey)&&q({key:c.ticketKey});w.sort((c,s)=>c.control.compareDocumentPosition(s.control)&4?-1:1)}let i=null;for(let c of w){let s=t.find(h=>h.key===c.key&&(h.ticketKey??void 0)===(c.ticketKey??void 0)),g=s?ce.includes(s.code)?s.code:"invalid":null;$(c,g),g&&!i&&(i=c)}return i?D(i):(_.textContent=o("picker.bookingForm.fix","Some details need attention."),_.hidden=!1,!1)}}}var he=9e4,ge=2e3,ne="https://checkout.razorpay.com/v1/checkout.js",oe="seatlayer-checkout-style",fe="@seatlayer/pending-checkout/v1";function me(e,r){try{window.sessionStorage.setItem(fe,JSON.stringify({orderId:e,...r?{eventKey:r}:{},storedAt:Date.now()}))}catch{}}var ke=`
|
|
2
|
-
/* The card is centred, but max-height:100% lets a long form reach the bottom
|
|
3
|
-
edge \u2014 and on the hosted buyer page that edge is the phone's edge, with the
|
|
4
|
-
Pay button last in the scroll. Reserve the home-indicator gutter here too.
|
|
5
|
-
--sl-safe-b is declared on .sl-picker, which this overlay lives inside, so it
|
|
6
|
-
inherits; it resolves to 0px in any host that is not inset. */
|
|
7
|
-
.sl-hco{position:absolute;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;
|
|
8
|
-
padding:16px 16px calc(16px + var(--sl-safe-b,0px));
|
|
9
|
-
background:color-mix(in srgb, var(--sl-bg) 82%, transparent);backdrop-filter:blur(3px)}
|
|
10
|
-
.sl-hco-card{width:100%;max-width:380px;max-height:100%;overflow:auto;padding:22px;
|
|
11
|
-
background:var(--sl-surface);color:var(--sl-text);border:1px solid var(--sl-line);
|
|
12
|
-
border-radius:var(--sl-radius);box-shadow:0 18px 48px rgba(0,0,0,.28)}
|
|
13
|
-
.sl-hco-title{margin:0 0 14px;font-size:19px;font-weight:650;letter-spacing:-.01em}
|
|
14
|
-
.sl-hco-summary{margin-bottom:16px;padding-bottom:14px;border-bottom:1px solid var(--sl-line)}
|
|
15
|
-
.sl-hco-seats{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
|
|
16
|
-
.sl-hco-seat{padding:3px 8px;font-size:12px;font-weight:600;border-radius:calc(var(--sl-radius) * .5);
|
|
17
|
-
background:var(--sl-bg);border:1px solid var(--sl-line)}
|
|
18
|
-
.sl-hco-total{display:flex;justify-content:space-between;align-items:baseline;font-size:14px}
|
|
19
|
-
.sl-hco-total strong{font-size:17px;font-weight:700}
|
|
20
|
-
.sl-hco-label{display:block;margin:12px 0 5px;font-size:12px;font-weight:600;color:var(--sl-muted)}
|
|
21
|
-
.sl-hco-input{width:100%;padding:10px 11px;font:inherit;font-size:15px;color:var(--sl-text);
|
|
22
|
-
background:var(--sl-bg);border:1px solid var(--sl-line);border-radius:calc(var(--sl-radius) * .55)}
|
|
23
|
-
.sl-hco-input:focus-visible{outline:2px solid var(--sl-accent);outline-offset:1px}
|
|
24
|
-
.sl-hco-pay{width:100%;margin-top:16px;padding:12px;font:inherit;font-size:15px;font-weight:650;
|
|
25
|
-
color:var(--sl-accent-ink);background:var(--sl-accent);border:0;
|
|
26
|
-
border-radius:calc(var(--sl-radius) * .55);cursor:pointer}
|
|
27
|
-
.sl-hco-pay[disabled]{opacity:.5;cursor:default}
|
|
28
|
-
.sl-hco-back{width:100%;margin-top:8px;padding:10px;font:inherit;font-size:14px;color:var(--sl-muted);
|
|
29
|
-
background:none;border:0;cursor:pointer;text-decoration:underline}
|
|
30
|
-
.sl-hco-note{margin:12px 0 0;font-size:12px;line-height:1.5;color:var(--sl-muted)}
|
|
31
|
-
.sl-hco-note a{color:inherit;text-decoration:underline;text-underline-offset:2px}
|
|
32
|
-
.sl-hco-status{margin:8px 0 0;font-size:14px;line-height:1.55}
|
|
33
|
-
.sl-hco-error{color:var(--sl-danger, #c0392b)}
|
|
34
|
-
.sl-hco-receipt{display:grid;grid-template-columns:auto 1fr;gap:4px 14px;margin:14px 0 0;font-size:13px}
|
|
35
|
-
.sl-hco-receipt dt{color:var(--sl-muted)}
|
|
36
|
-
.sl-hco-receipt dd{margin:0;text-align:right}
|
|
37
|
-
.sl-hco-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;word-break:break-all}
|
|
38
|
-
.sl-hco-tickets{display:block;width:100%;margin-top:14px;padding:12px;font:inherit;font-size:15px;
|
|
39
|
-
font-weight:650;text-align:center;text-decoration:none;color:var(--sl-accent-ink);
|
|
40
|
-
background:var(--sl-accent);border-radius:calc(var(--sl-radius) * .55)}
|
|
41
|
-
/* Booking form: one fieldset per ticket, then the booking's own questions.
|
|
42
|
-
Controls reuse .sl-hco-label/.sl-hco-input so a host theme reaches them. */
|
|
43
|
-
.sl-hco-block{min-width:0;margin:16px 0 0;padding:4px 12px 14px;border:1px solid var(--sl-line);
|
|
44
|
-
border-radius:calc(var(--sl-radius) * .55)}
|
|
45
|
-
.sl-hco-legend{padding:0 6px;font-size:13px;font-weight:650}
|
|
46
|
-
.sl-hco-use{margin:4px 0 0;padding:0;font:inherit;font-size:13px;font-weight:600;color:var(--sl-accent);
|
|
47
|
-
background:none;border:0;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
|
|
48
|
-
.sl-hco-help{margin:0 0 6px;font-size:12px;line-height:1.45;color:var(--sl-muted)}
|
|
49
|
-
.sl-hco-ferr{margin:5px 0 0;font-size:12px;line-height:1.4;color:var(--sl-danger, #c0392b)}
|
|
50
|
-
.sl-hco-input[aria-invalid="true"]{border-color:var(--sl-danger, #c0392b)}
|
|
51
|
-
textarea.sl-hco-input{min-height:72px;resize:vertical}
|
|
52
|
-
.sl-hco-group{min-width:0;margin:12px 0 0;padding:0;border:0}
|
|
53
|
-
.sl-hco-group legend{margin:0 0 5px;padding:0;font-size:12px;font-weight:600;color:var(--sl-muted)}
|
|
54
|
-
.sl-hco-group[aria-invalid="true"] legend{color:var(--sl-danger, #c0392b)}
|
|
55
|
-
.sl-hco-check{display:flex;gap:8px;align-items:flex-start;margin:8px 0 0;font-size:14px;line-height:1.4;cursor:pointer}
|
|
56
|
-
.sl-hco-check input{flex:none;width:18px;height:18px;margin:1px 0 0;accent-color:var(--sl-accent)}
|
|
57
|
-
.sl-hco-check input:focus-visible{outline:2px solid var(--sl-accent);outline-offset:2px}
|
|
58
|
-
`;function ye(){if(typeof document>"u"||document.getElementById(oe))return;let e=document.createElement("style");e.id=oe,e.textContent=ke,document.head.appendChild(e)}function be(e,r){let o=`${r} ${r===1?"seat is":"seats are"} held for a limited time.`;return e==="payments_off_for_event"?{title:"This event isn\u2019t sold online",body:`${o} The organiser isn\u2019t taking payment for this event here.`,detail:"Nothing has been charged. Check where you found this event for how to get tickets."}:e==="unavailable_for_event"?{title:"This event isn\u2019t taking payment yet",body:`${o} Online payment is not switched on for this event.`,detail:"Nothing has been charged. If you were sent here to pay, let the organiser know, only they can turn payment on for this event."}:{title:"Finish in the ticketing checkout",body:`${o} Payment for this event is taken elsewhere.`,detail:"Nothing has been charged. Continue in the checkout on this page to pay for your seats."}}var ve=3,xe=1,we=400,Ce=3e3;function re(e){if(!e||typeof e!="object")return!1;let r=e;return r.status!==503||r.code==="maintenance_mode"||r.reason==="maintenance_mode"?!1:r.code==="checkout_busy"||r.code==="database_busy"?!0:r.retryable===!0}function Ee(e,r=Math.random){let o=e?.retryAfterS,l=typeof o=="number"&&Number.isFinite(o)&&o>=0?o:xe,p=Math.floor(Math.max(0,Math.min(1,r()))*we);return Math.min(Ce,l*1e3+p)}function _e(e){return`${(typeof e?.notice=="string"?e.notice.trim():"")||(()=>{let l=e?.retryAfterS;if(typeof l!="number"||!Number.isFinite(l)||l<0)return"Booking is paused for a few minutes for maintenance. Please try again shortly.";let p=Math.max(1,Math.ceil(l/60));return`Booking is paused for maintenance. Please try again in about ${p} minute${p===1?"":"s"}.`})()} Nothing was charged. Your seats are still held.`}function Y(e,r){if(e==="maintenance_mode")return _e(r);switch(e){case"checkout_busy":case"database_busy":return r?.free?"We couldn\u2019t confirm your booking yet because it\u2019s very busy. Nothing was charged. Please try again.":"We couldn\u2019t start the payment yet because it\u2019s very busy. Nothing was charged. Please try again.";case"gateway_not_connected":case"payments_not_enabled_for_event":return"This event is not taking online payments. Contact the organiser to buy these seats.";case"provider_mismatch":return"This event\u2019s payment setup changed while you were choosing. Nothing was charged. Please try again.";case"hold_not_active":case"hold_not_found":return"Your seats were released before checkout started. Nothing was charged. Please pick again.";case"checkout_already_started":return"A payment for these seats is already in progress. Finish that one, or wait for it to time out before starting again.";case"event_closed":return"Sales for this event have closed.";case"insufficient_hosted_credits":return"Ticket sales are temporarily paused while the organiser updates their SeatLayer balance. Nothing was charged. Please try again later or contact the organiser.";case"gateway_currency_mismatch":case"unsupported_currency":case"mixed_currency_hold":case"price_unusable":return"These seats cannot be checked out right now because of a pricing configuration problem. Nothing was charged. Please contact the organiser.";case"provider_refused":return"The organiser\u2019s payment provider refused to start this payment. Nothing was charged. Please contact the organiser.";case"rate_limited":return"Too many attempts. Wait a moment and try again.";case"seats_unavailable":return"Those seats were taken while you were filling this in. Nothing was charged. Please pick again.";case"booking_form_incomplete":return"The details this event asks for changed while you were choosing. Nothing was charged. Please go back and try again.";default:return"We could not start the payment. Nothing was charged. Please try again."}}function Te(){let e=window.Razorpay;return e?Promise.resolve(e):new Promise((r,o)=>{let l=document.querySelector(`script[src="${ne}"]`),p=l??document.createElement("script"),x=()=>{let E=window.Razorpay;E?r(E):o(new Error("razorpay_unavailable"))};p.addEventListener("load",x,{once:!0}),p.addEventListener("error",()=>o(new Error("razorpay_script_failed")),{once:!0}),!l&&(p.src=ne,p.async=!0,document.head.appendChild(p))})}function a(e,r,o){let l=document.createElement(e);return r&&(l.className=r),o!==void 0&&(l.textContent=o),l}function Me(e){ye();let r=!0,o=!1,l=(u,f,m)=>{let d=e.t?.(u,m);return d&&d!==u?d:m?f.replace(/\{(\w+)\}/g,(z,H)=>H in m?String(m[H]):z):f},p=a("div","sl-hco");p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true");let x=a("div","sl-hco-card");p.appendChild(x);let E=()=>{r=!1,p.remove(),document.removeEventListener("keydown",B,!0)},F=()=>{E(),e.onCancel()};function B(u){u.key!=="Escape"||!p.isConnected||(u.stopPropagation(),u.preventDefault(),F())}document.addEventListener("keydown",B,!0);let w=a("h2","sl-hco-title","Checkout"),A=`sl-hco-t-${Math.random().toString(36).slice(2,8)}`;w.id=A,p.setAttribute("aria-labelledby",A);let S=(...u)=>{x.replaceChildren(w,...u)},K=u=>{if(!r)return;let f=a("p","sl-hco-status sl-hco-error",u);f.setAttribute("role","alert");let m=a("button","sl-hco-back","Back to seats");m.type="button",m.addEventListener("click",F),S(f,m)},_=u=>{if(!r)return;let f=a("p","sl-hco-status",u);f.setAttribute("role","status"),S(f)},U=async(u,f=!1)=>{_(f?l("checkout.confirmingSeats","Confirming your seats\u2026"):"Payment received. Confirming your seats\u2026");let m=Date.now()+he;for(;r&&Date.now()<m;){try{let d=await e.orderStatus(u);if(!r)return;if(d.status==="confirmed"){o=!0,w.textContent="Your tickets are confirmed";let z=a("p","sl-hco-status",`${d.seatCount} ${d.seatCount===1?"seat":"seats"} confirmed. Your tickets, with their door QR codes, are in your email.`),H=a("dl","sl-hco-receipt"),G=(d.tickets??[]).map(O=>O.displayLabel||O.label);G.length&&H.append(a("dt",void 0,"Seats"),a("dd",void 0,G.join(", ")));let J=f||d.totalMinor===0;H.append(a("dt",void 0,J?l("checkout.price","Price"):"Paid"),a("dd",void 0,J?l("checkout.free","Free"):`${d.amountFormatted} ${d.currency}`),a("dt",void 0,"Order"),a("dd","sl-hco-ref",d.orderId));let W=a("button","sl-hco-back","Close");if(W.type="button",W.addEventListener("click",F),d.ticketUrl){let O=a("a","sl-hco-tickets","View tickets & QR codes");O.href=d.ticketUrl,O.target="_blank",O.rel="noreferrer",S(z,H,O,W)}else S(z,H,W);e.onConfirmed(d);return}if(d.status==="failed"||d.status==="expired"){K(d.status==="expired"?"Your seats were released before payment completed. Nothing was charged. Please pick again.":"The payment did not complete. If you were charged, it has been refunded automatically.");return}}catch{}await new Promise(d=>setTimeout(d,ge))}!r||o||K(f?"Still confirming your booking. Once it is confirmed, your tickets will arrive by email. Nothing was charged.":"Still confirming with the payment provider. If your payment went through, your tickets will arrive by email shortly. You do not need to pay again.")};if(e.state.kind==="unavailable"){let u=be(e.state.reason,e.state.seatCount);w.textContent=u.title;let f=a("p","sl-hco-label","Seats held"),m=a("button","sl-hco-back","Back to seat map");return m.type="button",m.addEventListener("click",F),x.replaceChildren(f,w,a("p","sl-hco-status",u.body),a("p","sl-hco-note",u.detail),m),e.root.appendChild(p),m.focus(),{destroy:E}}if(e.state.kind==="resume")return e.root.appendChild(p),U(e.state.orderId),{destroy:E};let{order:R,provider:$,bookingForm:X}=e.state,N=e.state.free===!0,q=a("div","sl-hco-summary"),D=a("div","sl-hco-seats");for(let u of R.labels)D.appendChild(a("span","sl-hco-seat",u));let n=N?l("checkout.free","Free"):e.formatMoney(R.total,R.currency),t=a("div","sl-hco-total");t.append(a("span",void 0,"Total"),a("strong",void 0,n)),q.append(D,t);let i=a("form","sl-hco-form");i.noValidate=!0;let c=a("label","sl-hco-label","Email: your tickets go here"),s=a("input","sl-hco-input");s.type="email",s.required=!0,s.autocomplete="email",s.placeholder="you@example.com",s.id=`${A}-email`,c.htmlFor=s.id;let g=a("label","sl-hco-label","Name (optional)"),h=a("input","sl-hco-input");h.type="text",h.autocomplete="name",h.placeholder="Your name",h.id=`${A}-name`,g.htmlFor=h.id;let C=a("button","sl-hco-pay",N?l("checkout.confirmBooking","Confirm booking"):`Pay ${n}`);C.type="submit",C.disabled=!0;let M=a("button","sl-hco-back","Back to seats");M.type="button",M.addEventListener("click",F);let Q=new Date(R.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),y=a("p","sl-hco-note",N?`Your seats are held until ${Q}. ${l("checkout.freeNote","This event is free. Nothing is charged.")}`:`Your seats are held until ${Q}. Payment is handled by ${$==="razorpay"?"Razorpay":"Stripe"}. We never see your card details.`),k=a("p","sl-hco-note");k.append("The event organizer and SeatLayer use your email to issue and manage your tickets. ");let T=a("a",void 0,"Privacy Policy");T.href="https://seatlayer.io/privacy/",T.target="_blank",T.rel="noreferrer",k.appendChild(T);let b=()=>/.+@.+\..+/.test(s.value.trim());s.addEventListener("input",()=>{C.disabled=!b()});let I=te({form:X,tickets:R.tickets??[],idPrefix:A,t:l,buyer:()=>({name:h.value.trim(),email:s.value.trim()})}),P=a("p","sl-hco-status sl-hco-error");P.setAttribute("role","alert"),P.hidden=!0;let L=u=>{P.textContent=u,P.hidden=!1},j=!1,ie=async()=>{if(!j){j=!0,C.disabled=!0,_(N?l("checkout.confirmingBooking","Confirming your booking\u2026"):"Opening secure payment\u2026");try{let u={holdId:R.holdId,buyerEmail:s.value.trim(),...h.value.trim()?{buyerName:h.value.trim()}:{},...I.payload(),bookingFormVersion:1},f=0,m;for(;;)try{m=await e.startSession(u);break}catch(d){if(!r)return;if(f>=ve||!re(d))throw d;if(f+=1,_(N?l("checkout.busyRetryingBooking","Busy right now. Still confirming your booking\u2026"):l("checkout.busyRetryingPayment","Busy right now. Still opening secure payment\u2026")),await new Promise(z=>setTimeout(z,Ee(d))),!r)return}if(!r)return;if(m.status==="confirmed"){U(m.orderId,!0);return}if(m.redirectUrl){me(m.orderId,e.eventKey),_("Taking you to secure payment\u2026"),window.location.assign(m.redirectUrl);return}if(m.clientPayload){let d=m.clientPayload,z=await Te();if(!r)return;_("Waiting for payment\u2026"),new z({key:d.key,order_id:d.orderId,amount:d.amount,currency:d.currency,name:d.name,prefill:d.prefill,handler:()=>{U(m.orderId)},modal:{ondismiss:()=>{r&&V()}}}).open();return}K(Y("gateway_unavailable"))}catch(u){e.onError?.(u);let f=u;if(f?.code==="booking_form_incomplete"&&I.element){V(),I.showServerErrors(f.fields);return}if(re(f)){V(),L(N?l("checkout.busyFailedBooking",Y("checkout_busy",{free:!0})):l("checkout.busyFailedPayment",Y("checkout_busy")));return}K(f?.code==="seats_unavailable"?l("checkout.seatsUnavailable",Y(f.code)):Y(f?.code,f))}}};i.addEventListener("submit",u=>{u.preventDefault(),b()&&I.validate()&&ie()}),i.append(c,s,g,h),I.element&&i.appendChild(I.element),i.append(k,P,C,M,y);let V=()=>{w.textContent="Checkout",P.hidden=!0,P.textContent="",j=!1,S(q,i),C.disabled=!b()};return V(),e.root.appendChild(p),s.focus(),{destroy:E}}export{ve as CHECKOUT_BUSY_MAX_RETRIES,Ee as checkoutBusyDelayMs,Y as errorCopy,re as isCheckoutBusy,Me as mountCheckout,be as unavailableCopy};
|