@ticketlayer/elements 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/cjs/index-DfzcrE9-.js +3598 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/order-summary-ZMkJ5bez.js +116 -0
- package/dist/cjs/sdk-connector-ClDF3013.js +108 -0
- package/dist/cjs/ticketlayer-elements.cjs.js +24 -0
- package/dist/cjs/tl-buy-modal.cjs.entry.js +127 -0
- package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +131 -0
- package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +58 -0
- package/dist/cjs/tl-cart-badge.cjs.entry.js +109 -0
- package/dist/cjs/tl-cart-drawer.cjs.entry.js +67 -0
- package/dist/cjs/tl-cart.cjs.entry.js +148 -0
- package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +57 -0
- package/dist/cjs/tl-event-card.cjs.entry.js +140 -0
- package/dist/cjs/tl-event-list.cjs.entry.js +80 -0
- package/dist/cjs/tl-login.cjs.entry.js +184 -0
- package/dist/cjs/tl-my-orders.cjs.entry.js +123 -0
- package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +754 -0
- package/dist/cjs/tl-order-confirmation.cjs.entry.js +146 -0
- package/dist/cjs/tl-order-tickets_2.cjs.entry.js +3198 -0
- package/dist/cjs/tl-promo-code.cjs.entry.js +75 -0
- package/dist/cjs/tl-seat-map.cjs.entry.js +147 -0
- package/dist/collection/collection-manifest.json +29 -0
- package/dist/collection/components/tl-buy-modal/tl-buy-modal.css +264 -0
- package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +249 -0
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +120 -0
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +412 -0
- package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.css +23 -0
- package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +192 -0
- package/dist/collection/components/tl-cart/tl-cart.css +251 -0
- package/dist/collection/components/tl-cart/tl-cart.js +314 -0
- package/dist/collection/components/tl-cart-badge/tl-cart-badge.css +138 -0
- package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +217 -0
- package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.css +98 -0
- package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +185 -0
- package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.css +23 -0
- package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +148 -0
- package/dist/collection/components/tl-event-card/event-card-adapter.js +23 -0
- package/dist/collection/components/tl-event-card/tl-event-card.css +175 -0
- package/dist/collection/components/tl-event-card/tl-event-card.js +205 -0
- package/dist/collection/components/tl-event-list/tl-event-list.css +134 -0
- package/dist/collection/components/tl-event-list/tl-event-list.js +171 -0
- package/dist/collection/components/tl-login/tl-login.css +133 -0
- package/dist/collection/components/tl-login/tl-login.js +309 -0
- package/dist/collection/components/tl-my-orders/tl-my-orders.css +204 -0
- package/dist/collection/components/tl-my-orders/tl-my-orders.js +221 -0
- package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.css +658 -0
- package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +707 -0
- package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.css +176 -0
- package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +298 -0
- package/dist/collection/components/tl-order-tickets/tl-order-tickets.css +30 -0
- package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +122 -0
- package/dist/collection/components/tl-promo-code/tl-promo-code.css +106 -0
- package/dist/collection/components/tl-promo-code/tl-promo-code.js +181 -0
- package/dist/collection/components/tl-seat-map/tl-seat-map.css +85 -0
- package/dist/collection/components/tl-seat-map/tl-seat-map.js +366 -0
- package/dist/collection/components/tl-ticket/tl-ticket.css +90 -0
- package/dist/collection/components/tl-ticket/tl-ticket.js +129 -0
- package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.css +205 -0
- package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +332 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/utils/order-summary.js +101 -0
- package/dist/collection/utils/sdk-connector.js +100 -0
- package/dist/collection/utils/testing/mock-sdk.js +95 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/order-summary.js +1 -0
- package/dist/components/sdk-connector.js +1 -0
- package/dist/components/tl-buy-modal.d.ts +11 -0
- package/dist/components/tl-buy-modal.js +1 -0
- package/dist/components/tl-buy-tickets-button.d.ts +11 -0
- package/dist/components/tl-buy-tickets-button.js +1 -0
- package/dist/components/tl-buy-tickets-wrapper.d.ts +11 -0
- package/dist/components/tl-buy-tickets-wrapper.js +1 -0
- package/dist/components/tl-buy-tickets-wrapper2.js +1 -0
- package/dist/components/tl-cart-badge.d.ts +11 -0
- package/dist/components/tl-cart-badge.js +1 -0
- package/dist/components/tl-cart-drawer.d.ts +11 -0
- package/dist/components/tl-cart-drawer.js +1 -0
- package/dist/components/tl-cart.d.ts +11 -0
- package/dist/components/tl-cart.js +1 -0
- package/dist/components/tl-cart2.js +1 -0
- package/dist/components/tl-checkout-wrapper.d.ts +11 -0
- package/dist/components/tl-checkout-wrapper.js +1 -0
- package/dist/components/tl-checkout-wrapper2.js +1 -0
- package/dist/components/tl-event-card.d.ts +11 -0
- package/dist/components/tl-event-card.js +1 -0
- package/dist/components/tl-event-card2.js +1 -0
- package/dist/components/tl-event-list.d.ts +11 -0
- package/dist/components/tl-event-list.js +1 -0
- package/dist/components/tl-login.d.ts +11 -0
- package/dist/components/tl-login.js +1 -0
- package/dist/components/tl-login2.js +1 -0
- package/dist/components/tl-my-orders.d.ts +11 -0
- package/dist/components/tl-my-orders.js +1 -0
- package/dist/components/tl-occurrence-selector.d.ts +11 -0
- package/dist/components/tl-occurrence-selector.js +1 -0
- package/dist/components/tl-occurrence-selector2.js +1 -0
- package/dist/components/tl-order-confirmation.d.ts +11 -0
- package/dist/components/tl-order-confirmation.js +1 -0
- package/dist/components/tl-order-tickets.d.ts +11 -0
- package/dist/components/tl-order-tickets.js +1 -0
- package/dist/components/tl-order-tickets2.js +1 -0
- package/dist/components/tl-promo-code.d.ts +11 -0
- package/dist/components/tl-promo-code.js +1 -0
- package/dist/components/tl-seat-map.d.ts +11 -0
- package/dist/components/tl-seat-map.js +1 -0
- package/dist/components/tl-ticket-selector.d.ts +11 -0
- package/dist/components/tl-ticket-selector.js +1 -0
- package/dist/components/tl-ticket-selector2.js +1 -0
- package/dist/components/tl-ticket.d.ts +11 -0
- package/dist/components/tl-ticket.js +1 -0
- package/dist/components/tl-ticket2.js +1 -0
- package/dist/elements.docs.d.ts +454 -0
- package/dist/elements.docs.json +3008 -0
- package/dist/esm/index-Ba-RZTFI.js +3588 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/order-summary-BGekdjN9.js +103 -0
- package/dist/esm/sdk-connector-CqhvfyKV.js +102 -0
- package/dist/esm/ticketlayer-elements.js +20 -0
- package/dist/esm/tl-buy-modal.entry.js +125 -0
- package/dist/esm/tl-buy-tickets-button.entry.js +129 -0
- package/dist/esm/tl-buy-tickets-wrapper.entry.js +56 -0
- package/dist/esm/tl-cart-badge.entry.js +107 -0
- package/dist/esm/tl-cart-drawer.entry.js +65 -0
- package/dist/esm/tl-cart.entry.js +146 -0
- package/dist/esm/tl-checkout-wrapper.entry.js +55 -0
- package/dist/esm/tl-event-card.entry.js +138 -0
- package/dist/esm/tl-event-list.entry.js +78 -0
- package/dist/esm/tl-login.entry.js +182 -0
- package/dist/esm/tl-my-orders.entry.js +121 -0
- package/dist/esm/tl-occurrence-selector_2.entry.js +751 -0
- package/dist/esm/tl-order-confirmation.entry.js +144 -0
- package/dist/esm/tl-order-tickets_2.entry.js +3195 -0
- package/dist/esm/tl-promo-code.entry.js +73 -0
- package/dist/esm/tl-seat-map.entry.js +145 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/ticketlayer-elements/index.esm.js +1 -0
- package/dist/ticketlayer-elements/p-0291df4c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-10f01a1f.entry.js +1 -0
- package/dist/ticketlayer-elements/p-11273f8f.entry.js +1 -0
- package/dist/ticketlayer-elements/p-340ab4f5.entry.js +1 -0
- package/dist/ticketlayer-elements/p-41d22d7c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-82752e3b.entry.js +1 -0
- package/dist/ticketlayer-elements/p-976770f3.entry.js +1 -0
- package/dist/ticketlayer-elements/p-9a903ff6.entry.js +1 -0
- package/dist/ticketlayer-elements/p-9c9072c8.entry.js +1 -0
- package/dist/ticketlayer-elements/p-9d8163d6.entry.js +1 -0
- package/dist/ticketlayer-elements/p-BGekdjN9.js +1 -0
- package/dist/ticketlayer-elements/p-Ba-RZTFI.js +2 -0
- package/dist/ticketlayer-elements/p-CqhvfyKV.js +1 -0
- package/dist/ticketlayer-elements/p-a5c90b68.entry.js +1 -0
- package/dist/ticketlayer-elements/p-b6d479ad.entry.js +1 -0
- package/dist/ticketlayer-elements/p-dd43f015.entry.js +1 -0
- package/dist/ticketlayer-elements/p-eb640760.entry.js +1 -0
- package/dist/ticketlayer-elements/p-ee3aa227.entry.js +1 -0
- package/dist/ticketlayer-elements/p-fb9444c4.entry.js +1 -0
- package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -0
- package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -0
- package/dist/types/components/tl-buy-modal/tl-buy-modal.d.ts +54 -0
- package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +61 -0
- package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +52 -0
- package/dist/types/components/tl-cart/tl-cart.d.ts +80 -0
- package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +36 -0
- package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +35 -0
- package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +39 -0
- package/dist/types/components/tl-event-card/event-card-adapter.d.ts +23 -0
- package/dist/types/components/tl-event-card/tl-event-card.d.ts +55 -0
- package/dist/types/components/tl-event-list/tl-event-list.d.ts +30 -0
- package/dist/types/components/tl-login/tl-login.d.ts +59 -0
- package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +39 -0
- package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +208 -0
- package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +54 -0
- package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +21 -0
- package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +39 -0
- package/dist/types/components/tl-seat-map/tl-seat-map.d.ts +68 -0
- package/dist/types/components/tl-ticket/tl-ticket.d.ts +28 -0
- package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +78 -0
- package/dist/types/components.d.ts +1629 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/stencil-public-runtime.d.ts +1839 -0
- package/dist/types/utils/order-summary.d.ts +67 -0
- package/dist/types/utils/sdk-connector.d.ts +113 -0
- package/dist/types/utils/testing/mock-sdk.d.ts +36 -0
- package/elements.catalogue.json +968 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +101 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DfzcrE9-.js');
|
|
4
|
+
var sdkConnector = require('./sdk-connector-ClDF3013.js');
|
|
5
|
+
var orderSummary = require('./order-summary-ZMkJ5bez.js');
|
|
6
|
+
|
|
7
|
+
const tlPromoCodeCss = () => `:host{display:block;font-family:var(--tl-font-family, system-ui, sans-serif);color:var(--tl-foreground, #111827)}.field{display:flex;gap:var(--tl-spacing-2, 0.5rem)}.input{flex:1;min-width:0;padding:var(--tl-spacing-3, 0.75rem);font:inherit;font-size:0.875rem;color:var(--tl-foreground, #111827);background:var(--tl-background, #ffffff);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-md, 0.5rem);text-transform:uppercase}.input::placeholder{text-transform:none;color:var(--tl-muted-foreground, #6b7280)}.input:focus{outline:2px solid var(--tl-primary, #6366f1);outline-offset:1px}.apply{padding:var(--tl-spacing-3, 0.75rem) var(--tl-spacing-4, 1rem);font:inherit;font-size:0.875rem;font-weight:500;color:var(--tl-primary-foreground, #ffffff);background:var(--tl-primary, #6366f1);border:none;border-radius:var(--tl-radius-md, 0.5rem);cursor:pointer;white-space:nowrap}.apply:hover:not(:disabled){opacity:0.9}.apply:disabled,.input:disabled{opacity:0.6;cursor:not-allowed}.error{margin:var(--tl-spacing-2, 0.5rem) 0 0;font-size:0.8125rem;color:var(--tl-error, #ef4444)}.applied{display:flex;align-items:center;justify-content:space-between;gap:var(--tl-spacing-3, 0.75rem);padding:var(--tl-spacing-3, 0.75rem);font-size:0.875rem;background:var(--tl-muted, #f9fafb);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-md, 0.5rem)}.applied-text{display:flex;align-items:center;gap:var(--tl-spacing-2, 0.5rem)}.icon{width:1rem;height:1rem;flex-shrink:0;color:var(--tl-success, #10b981)}.code{font-family:var(--tl-font-family-mono, ui-monospace, monospace)}.link{padding:0;font:inherit;font-size:0.8125rem;color:var(--tl-primary, #6366f1);background:none;border:none;cursor:pointer;white-space:nowrap}.link:hover{text-decoration:underline}`;
|
|
8
|
+
|
|
9
|
+
const TlPromoCode = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.tlPromoApplied = index.createEvent(this, "tlPromoApplied");
|
|
13
|
+
this.tlError = index.createEvent(this, "tlError");
|
|
14
|
+
/** Input placeholder. */
|
|
15
|
+
this.placeholder = 'Promo or presale code';
|
|
16
|
+
/** Apply button label. */
|
|
17
|
+
this.buttonLabel = 'Apply';
|
|
18
|
+
this.code = '';
|
|
19
|
+
this.applying = false;
|
|
20
|
+
this.applied = null;
|
|
21
|
+
this.error = null;
|
|
22
|
+
this.handleInput = (e) => {
|
|
23
|
+
this.code = e.target.value;
|
|
24
|
+
this.error = null;
|
|
25
|
+
};
|
|
26
|
+
this.handleSubmit = (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
this.apply();
|
|
29
|
+
};
|
|
30
|
+
this.reset = () => {
|
|
31
|
+
this.applied = null;
|
|
32
|
+
this.error = null;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async apply() {
|
|
36
|
+
const code = this.code.trim();
|
|
37
|
+
if (!code) {
|
|
38
|
+
this.error = 'Enter a code';
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.applying = true;
|
|
42
|
+
this.error = null;
|
|
43
|
+
try {
|
|
44
|
+
const sdk = await sdkConnector.whenSDK();
|
|
45
|
+
const presale = sdk.getPresaleManager?.();
|
|
46
|
+
if (!presale)
|
|
47
|
+
throw new Error('Promo codes are not available');
|
|
48
|
+
const result = await presale.redeem(code);
|
|
49
|
+
// The SDK refreshed the cart on redeem; read the cached copy for the payload.
|
|
50
|
+
const cart = await sdk.getCartManager?.()?.get().catch(() => null) ?? null;
|
|
51
|
+
this.applied = { code: code.toUpperCase(), ...result, cart };
|
|
52
|
+
this.code = '';
|
|
53
|
+
this.tlPromoApplied.emit(this.applied);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
console.error('[tl-promo-code] Redeem failed:', err);
|
|
57
|
+
this.error = orderSummary.isAuthError(err)
|
|
58
|
+
? 'Sign in to use this code'
|
|
59
|
+
: orderSummary.errorMessage(err, 'That code could not be applied');
|
|
60
|
+
this.tlError.emit({ message: this.error });
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
this.applying = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
if (this.applied) {
|
|
68
|
+
return (index.h("div", { class: "applied", role: "status" }, index.h("span", { class: "applied-text" }, index.h("svg", { class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": "true" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" })), "Code ", index.h("strong", { class: "code" }, this.applied.code), this.applied.alreadyHeld ? ' was already applied' : ' applied'), index.h("button", { type: "button", class: "link", onClick: this.reset }, "Use a different code")));
|
|
69
|
+
}
|
|
70
|
+
return (index.h("form", { class: "promo", onSubmit: this.handleSubmit }, index.h("div", { class: "field" }, index.h("input", { class: "input", type: "text", autocomplete: "off", autoCapitalize: "characters", spellcheck: false, "aria-label": this.placeholder, placeholder: this.placeholder, value: this.code, disabled: this.applying, onInput: this.handleInput }), index.h("button", { type: "submit", class: "apply", disabled: this.applying }, this.applying ? 'Applying…' : this.buttonLabel)), this.error && (index.h("p", { class: "error", role: "alert" }, this.error))));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
TlPromoCode.style = tlPromoCodeCss();
|
|
74
|
+
|
|
75
|
+
exports.tl_promo_code = TlPromoCode;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DfzcrE9-.js');
|
|
4
|
+
var sdkConnector = require('./sdk-connector-ClDF3013.js');
|
|
5
|
+
|
|
6
|
+
const tlSeatMapCss = () => `:host{display:block;font-family:var(--tl-font-family, system-ui, -apple-system, sans-serif)}.seat-map-container{position:relative;overflow:hidden;border-radius:var(--tl-radius-md, 0.5rem);background:var(--tl-color-background, #ffffff)}.seat-map-iframe{width:100%;height:100%;border:none}.seat-map-iframe.hidden{display:none}.loading{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--tl-color-background, #ffffff);color:var(--tl-color-foreground, #0f172a);gap:1rem}.loading p{margin:0;font-size:0.875rem;color:var(--tl-color-muted-foreground, #64748b)}.spinner{width:40px;height:40px;border:3px solid var(--tl-color-border, #e2e8f0);border-top-color:var(--tl-color-primary, #e64b12);border-radius:50%;animation:tl-seat-map-spin 1s linear infinite}@keyframes tl-seat-map-spin{to{transform:rotate(360deg)}}.error{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--tl-color-background, #ffffff);color:var(--tl-color-error, #ef4444);padding:1.5rem;text-align:center}.error-title{margin:0 0 0.5rem;font-size:1.125rem;font-weight:600}.error-message{margin:0;font-size:0.875rem;opacity:0.9}`;
|
|
7
|
+
|
|
8
|
+
const TlSeatMap = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.tlReady = index.createEvent(this, "tlReady");
|
|
12
|
+
this.tlLoad = index.createEvent(this, "tlLoad");
|
|
13
|
+
this.tlError = index.createEvent(this, "tlError");
|
|
14
|
+
this.tlSeatAdded = index.createEvent(this, "tlSeatAdded");
|
|
15
|
+
this.tlSeatRemoved = index.createEvent(this, "tlSeatRemoved");
|
|
16
|
+
this.tlCartChange = index.createEvent(this, "tlCartChange");
|
|
17
|
+
/** Base URL for the hosted seat map (HBO URL) */
|
|
18
|
+
this.hboUrl = 'https://checkout.ticketlayer.com';
|
|
19
|
+
/** API URL for the seat map data */
|
|
20
|
+
this.apiUrl = 'https://api.ticketlayer.com';
|
|
21
|
+
/** Height of the seat map */
|
|
22
|
+
this.height = '600px';
|
|
23
|
+
/** Width of the seat map */
|
|
24
|
+
this.width = '100%';
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
// State
|
|
27
|
+
// -------------------------------------------------------------------------
|
|
28
|
+
this.isReady = false;
|
|
29
|
+
this.isLoading = true;
|
|
30
|
+
this.error = null;
|
|
31
|
+
this.seatsInCart = [];
|
|
32
|
+
// -------------------------------------------------------------------------
|
|
33
|
+
// Methods
|
|
34
|
+
// -------------------------------------------------------------------------
|
|
35
|
+
this.postToIframe = (type, data = {}) => {
|
|
36
|
+
if (this.iframeRef?.contentWindow) {
|
|
37
|
+
this.iframeRef.contentWindow.postMessage({ type, ...data }, '*');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.handleMessage = (event) => {
|
|
41
|
+
if (!event.data || !event.data.type)
|
|
42
|
+
return;
|
|
43
|
+
switch (event.data.type) {
|
|
44
|
+
case 'seatmap:ready':
|
|
45
|
+
this.isReady = true;
|
|
46
|
+
this.isLoading = false;
|
|
47
|
+
this.tlReady.emit();
|
|
48
|
+
// Send initial cart seats
|
|
49
|
+
this.postToIframe('seatmap:set-cart-seats', { seatIds: this.seatsInCart });
|
|
50
|
+
break;
|
|
51
|
+
case 'seatmap:loaded':
|
|
52
|
+
this.tlLoad.emit({ seatMapId: event.data.seatMapId });
|
|
53
|
+
break;
|
|
54
|
+
case 'seatmap:error':
|
|
55
|
+
this.error = event.data.error;
|
|
56
|
+
this.isLoading = false;
|
|
57
|
+
this.tlError.emit({ error: event.data.error });
|
|
58
|
+
break;
|
|
59
|
+
case 'seatmap:add-seat':
|
|
60
|
+
this.handleAddSeat(event.data.seatId, event.data.ticketTypeId);
|
|
61
|
+
break;
|
|
62
|
+
case 'seatmap:remove-seat':
|
|
63
|
+
this.handleRemoveSeat(event.data.seatId);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
this.handleAddSeat = async (seatId, ticketTypeId) => {
|
|
68
|
+
if (!sdkConnector.hasSDK()) {
|
|
69
|
+
console.warn('[tl-seat-map] SDK not available, cannot add seat');
|
|
70
|
+
this.postToIframe('seatmap:add-seat-failed', { seatId, error: 'SDK not available' });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const sdk = sdkConnector.getSDK();
|
|
75
|
+
await sdk.getCartManager().addSeat(seatId, ticketTypeId, this.occurrenceId);
|
|
76
|
+
this.postToIframe('seatmap:add-seat-confirmed', { seatId });
|
|
77
|
+
this.seatsInCart = [...this.seatsInCart, seatId];
|
|
78
|
+
this.tlSeatAdded.emit({ seatId, ticketTypeId });
|
|
79
|
+
this.tlCartChange.emit({ seatIds: this.seatsInCart });
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
console.error('[tl-seat-map] Failed to add seat:', err);
|
|
83
|
+
this.postToIframe('seatmap:add-seat-failed', { seatId, error: 'Failed to add seat' });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this.handleRemoveSeat = async (seatId) => {
|
|
87
|
+
if (!sdkConnector.hasSDK()) {
|
|
88
|
+
console.warn('[tl-seat-map] SDK not available, cannot remove seat');
|
|
89
|
+
this.postToIframe('seatmap:remove-seat-failed', { seatId, error: 'SDK not available' });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const sdk = sdkConnector.getSDK();
|
|
94
|
+
await sdk.getCartManager().removeSeat(seatId, this.occurrenceId);
|
|
95
|
+
this.postToIframe('seatmap:remove-seat-confirmed', { seatId });
|
|
96
|
+
this.seatsInCart = this.seatsInCart.filter(id => id !== seatId);
|
|
97
|
+
this.tlSeatRemoved.emit({ seatId });
|
|
98
|
+
this.tlCartChange.emit({ seatIds: this.seatsInCart });
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.error('[tl-seat-map] Failed to remove seat:', err);
|
|
102
|
+
this.postToIframe('seatmap:remove-seat-failed', { seatId, error: 'Failed to remove seat' });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// -------------------------------------------------------------------------
|
|
107
|
+
// Lifecycle
|
|
108
|
+
// -------------------------------------------------------------------------
|
|
109
|
+
componentWillLoad() {
|
|
110
|
+
// Add message listener
|
|
111
|
+
window.addEventListener('message', this.handleMessage);
|
|
112
|
+
}
|
|
113
|
+
disconnectedCallback() {
|
|
114
|
+
// Clean up message listener
|
|
115
|
+
window.removeEventListener('message', this.handleMessage);
|
|
116
|
+
}
|
|
117
|
+
watchOccurrenceId() {
|
|
118
|
+
// Reset state when occurrence changes
|
|
119
|
+
this.isReady = false;
|
|
120
|
+
this.isLoading = true;
|
|
121
|
+
this.error = null;
|
|
122
|
+
}
|
|
123
|
+
getIframeSrc() {
|
|
124
|
+
return `${this.hboUrl}/embed/seats?occurrenceId=${encodeURIComponent(this.occurrenceId)}&apiUrl=${encodeURIComponent(this.apiUrl)}`;
|
|
125
|
+
}
|
|
126
|
+
// -------------------------------------------------------------------------
|
|
127
|
+
// Render
|
|
128
|
+
// -------------------------------------------------------------------------
|
|
129
|
+
render() {
|
|
130
|
+
return (index.h("div", { key: 'f1efda6053825bdeb72aa277ad9fb5533fc56881', class: "seat-map-container", style: {
|
|
131
|
+
width: this.width,
|
|
132
|
+
height: this.height,
|
|
133
|
+
} }, this.isLoading && (index.h("div", { key: 'd6017235cb2e06fcc27184b382747dc8bcae5b6c', class: "loading" }, index.h("div", { key: '63618e07b6f4a2822418283fc83ab08aaec054a2', class: "spinner" }), index.h("p", { key: '0de2e4f71f78c5e662b03f5c0217ae43a2c4c1df' }, "Loading seat map..."))), this.error && (index.h("div", { key: 'a2b45dc5a66e18109cd4cf8677989e669117dcc0', class: "error" }, index.h("p", { key: 'c50b5527a2f6308b53e0389f94cacb2ebeef7262', class: "error-title" }, "Error"), index.h("p", { key: '1625a73993cbac40bfefb7913e0b735c0082a23f', class: "error-message" }, this.error))), index.h("iframe", { key: 'c7fc0441b436086d4717a87723108b1471c941ad', ref: (el) => (this.iframeRef = el), src: this.getIframeSrc(), class: {
|
|
134
|
+
'seat-map-iframe': true,
|
|
135
|
+
hidden: this.isLoading || !!this.error,
|
|
136
|
+
}, title: "Ticketlayer Seat Map", allow: "fullscreen" })));
|
|
137
|
+
}
|
|
138
|
+
get el() { return index.getElement(this); }
|
|
139
|
+
static get watchers() { return {
|
|
140
|
+
"occurrenceId": [{
|
|
141
|
+
"watchOccurrenceId": 0
|
|
142
|
+
}]
|
|
143
|
+
}; }
|
|
144
|
+
};
|
|
145
|
+
TlSeatMap.style = tlSeatMapCss();
|
|
146
|
+
|
|
147
|
+
exports.tl_seat_map = TlSeatMap;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/tl-buy-tickets-button/tl-buy-tickets-button.js",
|
|
4
|
+
"components/tl-cart/tl-cart.js",
|
|
5
|
+
"components/tl-event-card/tl-event-card.js",
|
|
6
|
+
"components/tl-login/tl-login.js",
|
|
7
|
+
"components/tl-occurrence-selector/tl-occurrence-selector.js",
|
|
8
|
+
"components/tl-promo-code/tl-promo-code.js",
|
|
9
|
+
"components/tl-ticket/tl-ticket.js",
|
|
10
|
+
"components/tl-ticket-selector/tl-ticket-selector.js",
|
|
11
|
+
"components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js",
|
|
12
|
+
"components/tl-checkout-wrapper/tl-checkout-wrapper.js",
|
|
13
|
+
"components/tl-buy-modal/tl-buy-modal.js",
|
|
14
|
+
"components/tl-cart-badge/tl-cart-badge.js",
|
|
15
|
+
"components/tl-cart-drawer/tl-cart-drawer.js",
|
|
16
|
+
"components/tl-event-list/tl-event-list.js",
|
|
17
|
+
"components/tl-my-orders/tl-my-orders.js",
|
|
18
|
+
"components/tl-order-tickets/tl-order-tickets.js",
|
|
19
|
+
"components/tl-order-confirmation/tl-order-confirmation.js",
|
|
20
|
+
"components/tl-seat-map/tl-seat-map.js"
|
|
21
|
+
],
|
|
22
|
+
"compiler": {
|
|
23
|
+
"name": "@stencil/core",
|
|
24
|
+
"version": "4.41.1",
|
|
25
|
+
"typescriptVersion": "5.8.3"
|
|
26
|
+
},
|
|
27
|
+
"collections": [],
|
|
28
|
+
"bundles": []
|
|
29
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* Local fallbacks; real values come from the channel theme's --tl-* vars,
|
|
3
|
+
which pierce the shadow boundary. */
|
|
4
|
+
--_bg: var(--tl-background, #ffffff);
|
|
5
|
+
--_fg: var(--tl-foreground, #111827);
|
|
6
|
+
--_muted: var(--tl-muted, #f3f4f6);
|
|
7
|
+
--_muted-fg: var(--tl-muted-foreground, #6b7280);
|
|
8
|
+
--_border: var(--tl-border, #e5e7eb);
|
|
9
|
+
--_primary: var(--tl-primary, #6366f1);
|
|
10
|
+
--_primary-fg: var(--tl-primary-foreground, #ffffff);
|
|
11
|
+
--_radius: var(--tl-radius-lg, var(--tl-radius, 0.75rem));
|
|
12
|
+
--_font: var(--tl-font-family, system-ui, -apple-system, sans-serif);
|
|
13
|
+
|
|
14
|
+
font-family: var(--_font);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.overlay {
|
|
18
|
+
position: fixed;
|
|
19
|
+
inset: 0;
|
|
20
|
+
z-index: 2147483646;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
padding: 16px;
|
|
25
|
+
background: rgba(8, 8, 16, 0.72);
|
|
26
|
+
backdrop-filter: blur(4px);
|
|
27
|
+
animation: tl-fade 0.18s ease-out;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.panel {
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 460px;
|
|
33
|
+
max-height: 90vh;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
background: var(--_bg);
|
|
38
|
+
color: var(--_fg);
|
|
39
|
+
border: 1px solid var(--_border);
|
|
40
|
+
border-radius: var(--_radius);
|
|
41
|
+
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
|
|
42
|
+
animation: tl-rise 0.22s cubic-bezier(0.16, 1, 0.3, 1);
|
|
43
|
+
transition: max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Wider on the date step so calendars / lots of timeslots have room. */
|
|
47
|
+
.panel--wide {
|
|
48
|
+
max-width: 720px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.panel-header {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 14px;
|
|
55
|
+
padding: 16px 18px;
|
|
56
|
+
border-bottom: 1px solid var(--_border);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.event-thumb {
|
|
60
|
+
flex: none;
|
|
61
|
+
width: 56px;
|
|
62
|
+
height: 56px;
|
|
63
|
+
border-radius: 12px;
|
|
64
|
+
background-size: cover;
|
|
65
|
+
background-position: center;
|
|
66
|
+
background-color: var(--_muted);
|
|
67
|
+
border: 1px solid var(--_border);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.titles {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 1px;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
flex: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.event-meta {
|
|
79
|
+
margin: 0;
|
|
80
|
+
font-size: 0.8rem;
|
|
81
|
+
color: var(--_muted-fg);
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.kicker {
|
|
88
|
+
font-size: 0.72rem;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
letter-spacing: 0.08em;
|
|
91
|
+
text-transform: uppercase;
|
|
92
|
+
color: var(--_primary);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.event-name {
|
|
96
|
+
margin: 0;
|
|
97
|
+
font-size: 1.18rem;
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
line-height: 1.25;
|
|
100
|
+
color: var(--_fg);
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
text-overflow: ellipsis;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.close-btn {
|
|
106
|
+
flex: none;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
width: 34px;
|
|
111
|
+
height: 34px;
|
|
112
|
+
border: 0;
|
|
113
|
+
border-radius: 999px;
|
|
114
|
+
background: var(--_muted);
|
|
115
|
+
color: var(--_muted-fg);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
transition: color 0.15s, background 0.15s;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.close-btn:hover {
|
|
121
|
+
color: var(--_fg);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.close-btn svg {
|
|
125
|
+
width: 16px;
|
|
126
|
+
height: 16px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.panel-body {
|
|
130
|
+
padding: 18px 22px 22px;
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.state-msg {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
gap: 10px;
|
|
139
|
+
padding: 40px 0;
|
|
140
|
+
color: var(--_muted-fg);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.state-msg.error {
|
|
144
|
+
color: #b91c1c;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.spinner {
|
|
148
|
+
width: 16px;
|
|
149
|
+
height: 16px;
|
|
150
|
+
border: 2px solid var(--_border);
|
|
151
|
+
border-top-color: var(--_primary);
|
|
152
|
+
border-radius: 999px;
|
|
153
|
+
animation: tl-spin 0.7s linear infinite;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.tickets-step {
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
gap: 6px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.back-link {
|
|
163
|
+
align-self: flex-start;
|
|
164
|
+
padding: 0;
|
|
165
|
+
border: 0;
|
|
166
|
+
background: none;
|
|
167
|
+
color: var(--_primary);
|
|
168
|
+
font-size: 0.85rem;
|
|
169
|
+
font-weight: 500;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.back-link:hover {
|
|
174
|
+
text-decoration: underline;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.occ-label {
|
|
178
|
+
margin: 2px 0 8px;
|
|
179
|
+
font-size: 0.9rem;
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
color: var(--_fg);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.done-step {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: center;
|
|
188
|
+
text-align: center;
|
|
189
|
+
gap: 6px;
|
|
190
|
+
padding: 16px 0 4px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.done-mark {
|
|
194
|
+
font-size: 2.4rem;
|
|
195
|
+
line-height: 1;
|
|
196
|
+
margin-bottom: 6px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.done-title {
|
|
200
|
+
margin: 0;
|
|
201
|
+
font-size: 1.1rem;
|
|
202
|
+
font-weight: 700;
|
|
203
|
+
color: var(--_fg);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.done-sub {
|
|
207
|
+
margin: 0 0 14px;
|
|
208
|
+
font-size: 0.9rem;
|
|
209
|
+
color: var(--_muted-fg);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.primary-btn {
|
|
213
|
+
width: 100%;
|
|
214
|
+
padding: 13px;
|
|
215
|
+
border: 0;
|
|
216
|
+
border-radius: var(--tl-radius-md, 0.5rem);
|
|
217
|
+
background: var(--_primary);
|
|
218
|
+
color: var(--_primary-fg);
|
|
219
|
+
font-size: 0.98rem;
|
|
220
|
+
font-weight: 600;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
transition: opacity 0.15s;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.primary-btn:hover {
|
|
226
|
+
opacity: 0.9;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.ghost-btn {
|
|
230
|
+
width: 100%;
|
|
231
|
+
margin-top: 8px;
|
|
232
|
+
padding: 12px;
|
|
233
|
+
border: 1px solid var(--_border);
|
|
234
|
+
border-radius: var(--tl-radius-md, 0.5rem);
|
|
235
|
+
background: transparent;
|
|
236
|
+
color: var(--_fg);
|
|
237
|
+
font-size: 0.95rem;
|
|
238
|
+
font-weight: 500;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
transition: background 0.15s;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.ghost-btn:hover {
|
|
244
|
+
background: var(--_muted);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@keyframes tl-fade {
|
|
248
|
+
from {
|
|
249
|
+
opacity: 0;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@keyframes tl-rise {
|
|
254
|
+
from {
|
|
255
|
+
opacity: 0;
|
|
256
|
+
transform: translateY(12px) scale(0.98);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@keyframes tl-spin {
|
|
261
|
+
to {
|
|
262
|
+
transform: rotate(360deg);
|
|
263
|
+
}
|
|
264
|
+
}
|