@ticketlayer/elements 0.4.0 → 1.0.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/cjs/{index-I9CoYv3k.js → index-DanPUX0s.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/ticket-selector-BYVL13k_.js +3623 -0
- package/dist/cjs/ticketlayer-elements.cjs.js +2 -2
- package/dist/cjs/tl-buy-modal.cjs.entry.js +3 -3
- package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +89 -74
- package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +61 -30
- package/dist/cjs/tl-cart-badge.cjs.entry.js +74 -61
- package/dist/cjs/tl-cart-drawer.cjs.entry.js +51 -23
- package/dist/cjs/tl-cart.cjs.entry.js +71 -103
- package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +51 -29
- package/dist/cjs/tl-event-card.cjs.entry.js +43 -105
- package/dist/cjs/tl-event-list.cjs.entry.js +72 -35
- package/dist/cjs/tl-login.cjs.entry.js +74 -141
- package/dist/cjs/tl-my-orders.cjs.entry.js +52 -92
- package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +153 -921
- package/dist/cjs/tl-order-confirmation.cjs.entry.js +71 -107
- package/dist/cjs/tl-order-tickets_2.cjs.entry.js +48 -74
- package/dist/cjs/tl-promo-code.cjs.entry.js +50 -47
- package/dist/cjs/tl-seat-map.cjs.entry.js +3 -3
- package/dist/cjs/web-query-Ce73jB4k.js +16 -0
- package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +2 -2
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +37 -0
- package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +105 -79
- package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +73 -30
- package/dist/collection/components/tl-cart/tl-cart.js +82 -107
- package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +62 -62
- package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +56 -24
- package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +61 -29
- package/dist/collection/components/tl-event-card/event-card-adapter.js +11 -23
- package/dist/collection/components/tl-event-card/tl-event-card.js +51 -84
- package/dist/collection/components/tl-event-list/tl-event-list.js +82 -38
- package/dist/collection/components/tl-login/tl-login.js +83 -147
- package/dist/collection/components/tl-my-orders/tl-my-orders.js +58 -96
- package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +137 -516
- package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +81 -115
- package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +57 -92
- package/dist/collection/components/tl-promo-code/tl-promo-code.js +55 -50
- package/dist/collection/components/tl-seat-map/tl-seat-map.js +2 -2
- package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +34 -20
- package/dist/collection/utils/order-summary.js +15 -135
- package/dist/collection/utils/testing/deep-text.js +29 -0
- package/dist/collection/utils/testing/fixtures.js +290 -0
- package/dist/collection/utils/testing/mock-sdk.js +13 -2
- package/dist/collection/utils/web-query.js +12 -0
- package/dist/collection/utils/web-storage.js +22 -0
- package/dist/components/ticket-selector.js +1 -0
- package/dist/components/tl-buy-modal.js +1 -1
- package/dist/components/tl-buy-tickets-button.js +1 -1
- package/dist/components/tl-buy-tickets-wrapper2.js +1 -1
- package/dist/components/tl-cart-badge.js +1 -1
- package/dist/components/tl-cart-drawer.js +1 -1
- package/dist/components/tl-cart2.js +1 -1
- package/dist/components/tl-checkout-wrapper2.js +1 -1
- package/dist/components/tl-event-card2.js +1 -1
- package/dist/components/tl-event-list.js +1 -1
- package/dist/components/tl-login2.js +1 -1
- package/dist/components/tl-my-orders.js +1 -1
- package/dist/components/tl-occurrence-selector2.js +1 -1
- package/dist/components/tl-order-confirmation.js +1 -1
- package/dist/components/tl-order-tickets2.js +1 -1
- package/dist/components/tl-promo-code.js +1 -1
- package/dist/components/tl-seat-map.js +1 -1
- package/dist/components/tl-ticket-selector2.js +1 -1
- package/dist/components/web-query.js +1 -0
- package/dist/elements.docs.json +34 -34
- package/dist/esm/{index-OoYV1faY.js → index-imfxp765.js} +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/ticket-selector-BwChnHVC.js +3606 -0
- package/dist/esm/ticketlayer-elements.js +3 -3
- package/dist/esm/tl-buy-modal.entry.js +3 -3
- package/dist/esm/tl-buy-tickets-button.entry.js +90 -75
- package/dist/esm/tl-buy-tickets-wrapper.entry.js +62 -31
- package/dist/esm/tl-cart-badge.entry.js +75 -62
- package/dist/esm/tl-cart-drawer.entry.js +52 -24
- package/dist/esm/tl-cart.entry.js +72 -104
- package/dist/esm/tl-checkout-wrapper.entry.js +52 -30
- package/dist/esm/tl-event-card.entry.js +44 -106
- package/dist/esm/tl-event-list.entry.js +73 -36
- package/dist/esm/tl-login.entry.js +75 -142
- package/dist/esm/tl-my-orders.entry.js +53 -93
- package/dist/esm/tl-occurrence-selector_2.entry.js +152 -920
- package/dist/esm/tl-order-confirmation.entry.js +72 -108
- package/dist/esm/tl-order-tickets_2.entry.js +49 -75
- package/dist/esm/tl-promo-code.entry.js +51 -48
- package/dist/esm/tl-seat-map.entry.js +3 -3
- package/dist/esm/web-query-Bdbb2lk5.js +14 -0
- package/dist/ticketlayer-elements/index.esm.js +1 -1
- package/dist/ticketlayer-elements/p-45923d2c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-492adc77.entry.js +1 -0
- package/dist/ticketlayer-elements/p-4cfc9e53.entry.js +1 -0
- package/dist/ticketlayer-elements/{p-ac264adc.entry.js → p-5135630e.entry.js} +1 -1
- package/dist/ticketlayer-elements/p-5bbce3b5.entry.js +1 -0
- package/dist/ticketlayer-elements/p-7d547721.entry.js +1 -0
- package/dist/ticketlayer-elements/p-7fe7b6ba.entry.js +1 -0
- package/dist/ticketlayer-elements/p-8122f0c1.entry.js +1 -0
- package/dist/ticketlayer-elements/p-98d40869.entry.js +1 -0
- package/dist/ticketlayer-elements/p-Bdbb2lk5.js +1 -0
- package/dist/ticketlayer-elements/p-BwChnHVC.js +1 -0
- package/dist/ticketlayer-elements/p-abec290a.entry.js +1 -0
- package/dist/ticketlayer-elements/p-ac79a3f6.entry.js +1 -0
- package/dist/ticketlayer-elements/p-d01f4429.entry.js +1 -0
- package/dist/ticketlayer-elements/p-d7ffaf46.entry.js +1 -0
- package/dist/ticketlayer-elements/p-e7170f3c.entry.js +1 -0
- package/dist/ticketlayer-elements/p-e787e862.entry.js +1 -0
- package/dist/ticketlayer-elements/p-f1ff931f.entry.js +1 -0
- package/dist/ticketlayer-elements/p-imfxp765.js +3 -0
- package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -1
- package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -1
- package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +40 -8
- package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +20 -1
- package/dist/types/components/tl-cart/tl-cart.d.ts +40 -42
- package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +22 -7
- package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +28 -5
- package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +18 -1
- package/dist/types/components/tl-event-card/event-card-adapter.d.ts +9 -20
- package/dist/types/components/tl-event-card/tl-event-card.d.ts +25 -28
- package/dist/types/components/tl-event-list/tl-event-list.d.ts +46 -6
- package/dist/types/components/tl-login/tl-login.d.ts +68 -22
- package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +30 -12
- package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +73 -161
- package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +48 -15
- package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +29 -31
- package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +28 -10
- package/dist/types/components/tl-ticket/tl-ticket.d.ts +2 -11
- package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +22 -4
- package/dist/types/components.d.ts +270 -62
- package/dist/types/utils/order-summary.d.ts +14 -97
- package/dist/types/utils/testing/deep-text.d.ts +13 -0
- package/dist/types/utils/testing/fixtures.d.ts +225 -0
- package/dist/types/utils/testing/mock-sdk.d.ts +14 -1
- package/dist/types/utils/web-query.d.ts +18 -0
- package/dist/types/utils/web-storage.d.ts +16 -0
- package/elements.catalogue.json +602 -50
- package/package.json +8 -6
- package/dist/cjs/money-BtmM2gt-.js +0 -118
- package/dist/cjs/order-summary-X3TlZxc2.js +0 -150
- package/dist/components/money.js +0 -1
- package/dist/components/order-summary.js +0 -1
- package/dist/esm/money-4ig0-WB6.js +0 -112
- package/dist/esm/order-summary-DiDtvfZM.js +0 -136
- package/dist/ticketlayer-elements/p-0814420f.entry.js +0 -1
- package/dist/ticketlayer-elements/p-0acabc26.entry.js +0 -1
- package/dist/ticketlayer-elements/p-109a3feb.entry.js +0 -1
- package/dist/ticketlayer-elements/p-1a4ba71c.entry.js +0 -1
- package/dist/ticketlayer-elements/p-318965c1.entry.js +0 -1
- package/dist/ticketlayer-elements/p-347c7fd1.entry.js +0 -1
- package/dist/ticketlayer-elements/p-3649c26d.entry.js +0 -1
- package/dist/ticketlayer-elements/p-40260cc9.entry.js +0 -1
- package/dist/ticketlayer-elements/p-4ig0-WB6.js +0 -1
- package/dist/ticketlayer-elements/p-55fd2f9f.entry.js +0 -1
- package/dist/ticketlayer-elements/p-62ee659b.entry.js +0 -1
- package/dist/ticketlayer-elements/p-7d4ecc2b.entry.js +0 -1
- package/dist/ticketlayer-elements/p-7f0abf95.entry.js +0 -1
- package/dist/ticketlayer-elements/p-BXpVGW51.js +0 -1
- package/dist/ticketlayer-elements/p-OoYV1faY.js +0 -3
- package/dist/ticketlayer-elements/p-a3c1b26c.entry.js +0 -1
- package/dist/ticketlayer-elements/p-aeb4c6fb.entry.js +0 -1
- package/dist/ticketlayer-elements/p-ba62541f.entry.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-imfxp765.js';
|
|
2
|
+
import { w as whenSDK, g as getSDK } from './sdk-connector-CqhvfyKV.js';
|
|
3
|
+
import { c as createElement, a as cartDrawerCore } from './ticket-selector-BwChnHVC.js';
|
|
3
4
|
|
|
4
5
|
const tlCartDrawerCss = () => `:host{--_bg:var(--tl-background);--_fg:var(--tl-foreground);--_muted-fg:var(--tl-muted-foreground);--_muted:var(--tl-muted);--_border:var(--tl-border);--_font:var(--tl-font-family);font-family:var(--_font)}.overlay{position:fixed;inset:0;z-index:2147483640;background:rgba(8, 8, 16, 0.6);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);opacity:0;pointer-events:none;transition:opacity 0.25s ease}.overlay.is-open{opacity:1;pointer-events:auto}.panel{position:fixed;top:0;bottom:0;width:min(420px, 100%);display:flex;flex-direction:column;background:var(--_bg);color:var(--_fg);box-shadow:0 0 48px rgba(0, 0, 0, 0.5);transition:transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);will-change:transform}.panel--right{right:0;border-left:1px solid var(--_border);transform:translateX(100%)}.panel--left{left:0;border-right:1px solid var(--_border);transform:translateX(-100%)}.panel.is-open{transform:translateX(0)}.drawer-header{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--_border)}.drawer-title{margin:0;font-size:1.1rem;font-weight:700}.close-btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:0;border-radius:999px;background:var(--_muted);color:var(--_muted-fg);cursor:pointer;transition:color 0.15s}.close-btn:hover{color:var(--_fg)}.close-btn svg{width:16px;height:16px}.drawer-body{flex:1;overflow-y:auto;padding:18px 20px}.drawer-footer{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 20px;border-top:1px solid var(--_border);font-size:11.5px;font-weight:500;color:var(--_muted-fg)}.drawer-footer a{color:inherit;text-decoration:none;opacity:0.9;transition:opacity 0.15s ease}.drawer-footer a:hover{opacity:1}.drawer-footer .pb-links{display:flex;gap:14px}.drawer-footer .pb-brand{display:inline-flex;align-items:center;gap:5px}.drawer-footer .pb-brand svg{display:block}.drawer-footer .pb-pre{opacity:0.7}.drawer-footer .pb-word{font-weight:700}`;
|
|
5
6
|
|
|
@@ -14,47 +15,74 @@ const TlCartDrawer = class {
|
|
|
14
15
|
this.heading = 'Your cart';
|
|
15
16
|
/** Controlled open state (also driven by the `ui:cart-requested` intent). */
|
|
16
17
|
this.open = false;
|
|
17
|
-
this.
|
|
18
|
+
this.element = createElement(cartDrawerCore, {
|
|
19
|
+
client: () => getSDK(),
|
|
20
|
+
clientReady: () => whenSDK(),
|
|
21
|
+
emit: (event, detail) => this.forward(event, detail),
|
|
22
|
+
});
|
|
23
|
+
/** The core's whole view. Assigning it is what makes Stencil re-render. */
|
|
24
|
+
this.view = this.element.view;
|
|
25
|
+
/** The one thing only a browser has. What Escape means is the core's answer. */
|
|
18
26
|
this.onKey = (e) => {
|
|
19
|
-
if (e.key === 'Escape'
|
|
20
|
-
this.setOpen(false);
|
|
27
|
+
if (e.key === 'Escape')
|
|
28
|
+
this.element.actions.setOpen(false);
|
|
21
29
|
};
|
|
22
|
-
this.close = () => this.setOpen(false);
|
|
30
|
+
this.close = () => this.element.actions.setOpen(false);
|
|
31
|
+
}
|
|
32
|
+
syncProps() {
|
|
33
|
+
this.element.setProps({ side: this.side, heading: this.heading, open: this.open });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The host moved `open`. The core follows it without announcing it, which is
|
|
37
|
+
* what the component's watcher did: an event here would be the host hearing
|
|
38
|
+
* its own write back.
|
|
39
|
+
*/
|
|
40
|
+
onOpenProp(v) {
|
|
41
|
+
this.element.setProps({ open: v });
|
|
42
|
+
this.element.actions.openChanged(v);
|
|
23
43
|
}
|
|
24
44
|
connectedCallback() {
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
this.syncProps();
|
|
46
|
+
this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
|
|
47
|
+
this.view = view;
|
|
48
|
+
// Reflect the core's state back onto the prop a host reads. Writing it
|
|
49
|
+
// re-enters onOpenProp, which is a no-op once the core already agrees.
|
|
50
|
+
if (this.open !== view.state.visible)
|
|
51
|
+
this.open = view.state.visible;
|
|
52
|
+
}));
|
|
53
|
+
this.view = this.element.view;
|
|
54
|
+
this.teardown = this.element.mount();
|
|
29
55
|
if (typeof document !== 'undefined')
|
|
30
56
|
document.addEventListener('keydown', this.onKey);
|
|
31
57
|
}
|
|
32
58
|
disconnectedCallback() {
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
59
|
+
this.teardown?.();
|
|
60
|
+
this.teardown = undefined;
|
|
61
|
+
this.unsubscribe?.();
|
|
62
|
+
this.unsubscribe = undefined;
|
|
35
63
|
if (typeof document !== 'undefined')
|
|
36
64
|
document.removeEventListener('keydown', this.onKey);
|
|
37
65
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
setOpen(v) {
|
|
42
|
-
if (this.visible === v)
|
|
43
|
-
return;
|
|
44
|
-
this.open = v;
|
|
45
|
-
this.visible = v;
|
|
46
|
-
if (v)
|
|
66
|
+
forward(event, _detail) {
|
|
67
|
+
if (event === 'tlOpen')
|
|
47
68
|
this.tlOpen.emit();
|
|
48
|
-
else
|
|
69
|
+
else if (event === 'tlClose')
|
|
49
70
|
this.tlClose.emit();
|
|
50
71
|
}
|
|
51
72
|
render() {
|
|
52
|
-
|
|
73
|
+
const { strings, derived } = this.view;
|
|
74
|
+
return (h(Host, { key: 'ab41f3557cd8dd2b182bbfc3ed631bca7839d4a9' }, h("div", { key: '70bbe63d1f9a2d449cb9ff970631c0c69a2eb757', class: { overlay: true, 'is-open': derived.visible }, onClick: (e) => {
|
|
53
75
|
if (e.target === e.currentTarget)
|
|
54
76
|
this.close();
|
|
55
|
-
} }, h("aside", { key: '
|
|
77
|
+
} }, h("aside", { key: 'eefe601ef6d2d8fc6bcfe62f1777d139875f875d', class: { panel: true, [derived.sideClass]: true, 'is-open': derived.visible }, role: "dialog", "aria-modal": "true", "aria-label": this.heading, "aria-hidden": derived.ariaHidden }, h("header", { key: '753d616182c3a903111dcaaf9b37f03186e17b48', class: "drawer-header" }, h("h2", { key: '3e839ddbc2a2da1f4c8eb0c1e38c421de13426cd', class: "drawer-title" }, this.heading), h("button", { key: '0d80fff5f425d6150fb391fd930161167b5f7d27', class: "close-btn", onClick: this.close, "aria-label": strings.close }, h("svg", { key: '7ffcbfb86f921d13deb5070140f21e4c7ca668f1', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: '53d690ef2ac8d1d73038c53fa3aa0146bde0fb51', d: "M6 6l12 12M18 6L6 18", "stroke-linecap": "round" })))), h("div", { key: 'a782b1527cde89656e5f776311f848c446d92d48', class: "drawer-body" }, h("tl-cart", { key: '3cd2c09f728cf14f0ea5b6ff4493b3e51e0dda62' })), h("footer", { key: '2df57237bbd548ae4af09098676d7e1315e11d71', class: "drawer-footer" }, h("div", { key: 'f02f5970181a2d83b70ac44188f00523a188771d', class: "pb-links" }, h("a", { key: 'd799da3a8c1c33b10a268500b02fda5523cd8bcf', href: strings.privacyHref, target: "_blank", rel: "noopener noreferrer" }, strings.privacy), h("a", { key: 'e928acb4c78cef8762d7ae8d258fa705554fd121', href: strings.reportAbuseHref, target: "_blank", rel: "noopener noreferrer" }, strings.reportAbuse)), h("a", { key: '39278516b8da6dd14fe8bf0d0379c32ccfeb1d29', class: "pb-brand", href: strings.brandHref, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '96b2cb7ac0a73cd0c60fb7977999a00b4989177e', class: "pb-pre" }, strings.poweredBy), h("svg", { key: 'b3950f83eab4a41e63a7919e6872a9ecdafab38b', width: "13", height: "13", viewBox: "0 0 50 50", fill: "none", "aria-hidden": "true" }, h("g", { key: '4c0c7ec66952f8a1956b3061f6bf2eb45c438989', transform: "matrix(0.0129 0 0 -0.0129 25.4752 25.4752)" }, h("path", { key: 'b1c9a143f0b2ad24da843323a4c1c550e9717d1b', fill: "currentColor", transform: "translate(-1781.5, -1759.4003)", d: "M 41 2973 c 1 -285 5 -734 9 -998 c 7 -444 9 -488 30 -580 c 81 -364 235 -634 512 -900 c 135 -130 263 -220 423 -299 c 156 -77 249 -109 409 -143 c 110 -23 142 -25 354 -24 c 230 1 310 8 427 37 c 241 60 453 162 640 309 c 82 64 252 234 317 315 c 210 264 340 604 355 926 l 6 121 l -69 6 c -86 8 -706 9 -755 1 l -36 -6 l -21 -125 c -34 -191 -98 -317 -236 -462 c -111 -115 -249 -198 -396 -238 c -98 -27 -356 -24 -463 5 c -100 27 -183 69 -273 137 c -226 173 -353 409 -354 660 c 0 44 -5 120 -10 169 c -6 49 -8 91 -6 94 c 3 3 65 -22 138 -55 c 140 -64 251 -103 358 -127 c 71 -17 295 -46 347 -46 l 33 0 l 0 434 l 0 434 l -67 7 c -147 14 -269 56 -393 133 c -222 139 -378 393 -397 648 l -6 71 l -75 7 c -41 3 -239 6 -439 6 l -363 0 l 1 -517 z" }))), h("span", { key: '053ca451a9674161799458e731862a93c954be23', class: "pb-word" }, strings.brand)))))));
|
|
56
78
|
}
|
|
57
79
|
static get watchers() { return {
|
|
80
|
+
"side": [{
|
|
81
|
+
"syncProps": 0
|
|
82
|
+
}],
|
|
83
|
+
"heading": [{
|
|
84
|
+
"syncProps": 0
|
|
85
|
+
}],
|
|
58
86
|
"open": [{
|
|
59
87
|
"onOpenProp": 0
|
|
60
88
|
}]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
2
|
-
import { w as whenSDK,
|
|
3
|
-
import { c as
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-imfxp765.js';
|
|
2
|
+
import { w as whenSDK, g as getSDK } from './sdk-connector-CqhvfyKV.js';
|
|
3
|
+
import { c as createElement, d as cartCore } from './ticket-selector-BwChnHVC.js';
|
|
4
4
|
|
|
5
5
|
const tlCartCss = () => `:host{display:block;font-family:var(--tl-font-family)}.skeleton-container{padding:var(--tl-spacing-4)}.skeleton-item{height:70px;background:var(--tl-color-muted);border-radius:var(--tl-radius-md);margin-bottom:var(--tl-spacing-3);animation:pulse 1.5s ease-in-out infinite}.skeleton-totals{height:100px;background:var(--tl-color-muted);border-radius:var(--tl-radius-md);animation:pulse 1.5s ease-in-out infinite}@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.5}}.empty-cart{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--tl-spacing-8);text-align:center}.empty-icon{width:48px;height:48px;color:var(--tl-color-muted-foreground);margin-bottom:var(--tl-spacing-4)}.empty-title{margin:0 0 var(--tl-spacing-2);font-size:16px;font-weight:600;color:var(--tl-color-foreground)}.empty-message{margin:0;font-size:14px;color:var(--tl-color-muted-foreground)}.cart{background:var(--tl-color-background)}.cart.compact .cart-items{margin-bottom:var(--tl-spacing-2)}.cart-items{margin-bottom:var(--tl-spacing-4)}.cart-item{display:flex;justify-content:space-between;align-items:flex-start;padding:var(--tl-spacing-3) 0;border-bottom:1px solid var(--tl-color-border);transition:opacity 0.2s}.cart-item:last-child{border-bottom:none}.cart-item.removing{opacity:0.5}.item-info{flex:1;min-width:0}.item-name{margin:0;font-weight:600;font-size:15px;color:var(--tl-color-foreground)}.item-event{margin:var(--tl-spacing-1) 0 0;font-size:14px;color:var(--tl-color-muted-foreground)}.item-date{margin:var(--tl-spacing-1) 0 0;font-size:13px;color:var(--tl-color-muted-foreground)}.item-quantity{margin:var(--tl-spacing-1) 0 0;font-size:13px;color:var(--tl-color-muted-foreground)}.item-actions{display:flex;align-items:center;gap:var(--tl-spacing-3);margin-left:var(--tl-spacing-4)}.item-price{margin:0;font-weight:600;font-size:15px;color:var(--tl-color-foreground);white-space:nowrap}.remove-btn{width:28px;height:28px;padding:0;border:none;background:transparent;border-radius:var(--tl-radius-sm);color:var(--tl-color-muted-foreground);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color 0.15s, color 0.15s}.remove-btn:hover:not(:disabled){background-color:var(--tl-color-destructive-bg);color:var(--tl-color-destructive)}.remove-btn:disabled{cursor:not-allowed;opacity:0.5}.remove-btn svg{width:16px;height:16px}.spinner{width:14px;height:14px;border:2px solid var(--tl-color-border);border-top-color:var(--tl-color-primary);border-radius:50%;animation:spin 0.6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.cart-totals{padding:var(--tl-spacing-3) 0;border-top:1px solid var(--tl-color-border)}.total-row{display:flex;justify-content:space-between;align-items:center;padding:var(--tl-spacing-1) 0}.total-row.subtotal,.total-row.fees,.total-row.discount{font-size:14px;color:var(--tl-color-muted-foreground)}.total-row.total{font-size:16px;font-weight:700;color:var(--tl-color-foreground);padding-top:var(--tl-spacing-2);border-top:1px solid var(--tl-color-border);margin-top:var(--tl-spacing-2)}.checkout-btn{width:100%;margin-top:var(--tl-spacing-4);padding:var(--tl-spacing-3) var(--tl-spacing-4);border-radius:var(--tl-radius-md);border:none;background-color:var(--tl-color-primary);color:var(--tl-color-primary-foreground);font-weight:600;font-size:16px;cursor:pointer;transition:opacity 0.15s, transform 0.1s}.checkout-btn:hover:not(:disabled){opacity:0.9}.checkout-btn:active:not(:disabled){transform:scale(0.98)}.checkout-btn:disabled{background-color:var(--tl-color-muted);color:var(--tl-color-muted-foreground);cursor:not-allowed}.cart.compact .item-info{flex-direction:row;align-items:center}.cart.compact .cart-totals{padding:var(--tl-spacing-2) 0}.cart.compact .total-row.total{margin-top:0;border-top:none;padding-top:0}`;
|
|
6
6
|
|
|
@@ -27,125 +27,93 @@ const TlCart = class {
|
|
|
27
27
|
* Compact mode - hides some details
|
|
28
28
|
*/
|
|
29
29
|
this.compact = false;
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
componentWillLoad() {
|
|
41
|
-
this.loadCart();
|
|
42
|
-
}
|
|
43
|
-
componentDidLoad() {
|
|
44
|
-
this.subscribeToCartUpdates();
|
|
45
|
-
}
|
|
46
|
-
disconnectedCallback() {
|
|
47
|
-
if (this.unsubscribe) {
|
|
48
|
-
this.unsubscribe();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async loadCart() {
|
|
52
|
-
try {
|
|
53
|
-
console.log('[tl-cart] Loading cart...');
|
|
54
|
-
this.loading = true;
|
|
55
|
-
this.error = null;
|
|
56
|
-
const sdk = await whenSDK();
|
|
57
|
-
const cartManager = sdk.getCartManager?.();
|
|
58
|
-
if (cartManager) {
|
|
59
|
-
const cartData = await cartManager.get();
|
|
60
|
-
console.log('[tl-cart] Cart loaded:', cartData);
|
|
61
|
-
this.cart = cartData;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
console.error('[tl-cart] Failed to load cart:', err);
|
|
66
|
-
this.error = err instanceof Error ? err.message : 'Failed to load cart';
|
|
67
|
-
this.tlError.emit({ message: this.error });
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
this.loading = false;
|
|
71
|
-
}
|
|
30
|
+
this.element = createElement(cartCore, {
|
|
31
|
+
client: () => getSDK(),
|
|
32
|
+
// What "the client is up" means on the web. The core waits on it in its
|
|
33
|
+
// own mount, subscribes there and loads there; the harness decides none
|
|
34
|
+
// of it (TKT-197).
|
|
35
|
+
clientReady: () => whenSDK(),
|
|
36
|
+
emit: (event, detail) => this.forward(event, detail),
|
|
37
|
+
});
|
|
38
|
+
/** The core's whole view. Assigning it is what makes Stencil re-render. */
|
|
39
|
+
this.view = this.element.view;
|
|
72
40
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return;
|
|
80
|
-
this.unsubscribe = cartManager.on?.('cart:updated', (cartData) => {
|
|
81
|
-
console.log('[tl-cart] Cart updated:', cartData);
|
|
82
|
-
this.cart = cartData;
|
|
83
|
-
this.tlCartUpdated.emit({ cart: cartData });
|
|
41
|
+
syncProps() {
|
|
42
|
+
this.element.setProps({
|
|
43
|
+
showCheckoutButton: this.showCheckoutButton,
|
|
44
|
+
checkoutLabel: this.checkoutLabel,
|
|
45
|
+
showRemoveButtons: this.showRemoveButtons,
|
|
46
|
+
compact: this.compact,
|
|
84
47
|
});
|
|
85
48
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
console.error('[tl-cart] Failed to remove item:', err);
|
|
101
|
-
this.error = err instanceof Error ? err.message : 'Failed to remove item';
|
|
102
|
-
this.tlError.emit({ message: this.error });
|
|
103
|
-
}
|
|
104
|
-
finally {
|
|
105
|
-
this.removingItemId = null;
|
|
106
|
-
}
|
|
49
|
+
/**
|
|
50
|
+
* On screen: render what the core says and put the core to work. For this
|
|
51
|
+
* element that means waiting for the client, subscribing to `cart:updated`
|
|
52
|
+
* and reading the cart - all of it the core's business.
|
|
53
|
+
*/
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
this.syncProps();
|
|
56
|
+
this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
|
|
57
|
+
this.view = view;
|
|
58
|
+
}));
|
|
59
|
+
this.view = this.element.view;
|
|
60
|
+
this.teardown = this.element.mount();
|
|
107
61
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Off screen: run the mount's teardown, which is what drops the cart
|
|
64
|
+
* subscription. Not `destroy()`: Stencil calls this for a DOM move as well
|
|
65
|
+
* as a removal, and a destroyed core never mounts again.
|
|
66
|
+
*/
|
|
67
|
+
disconnectedCallback() {
|
|
68
|
+
this.teardown?.();
|
|
69
|
+
this.teardown = undefined;
|
|
70
|
+
this.unsubscribe?.();
|
|
71
|
+
this.unsubscribe = undefined;
|
|
113
72
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
73
|
+
forward(event, detail) {
|
|
74
|
+
if (event === 'tlCheckout')
|
|
75
|
+
this.tlCheckout.emit(detail);
|
|
76
|
+
else if (event === 'tlItemRemoved')
|
|
77
|
+
this.tlItemRemoved.emit(detail);
|
|
78
|
+
else if (event === 'tlCartUpdated')
|
|
79
|
+
this.tlCartUpdated.emit(detail);
|
|
80
|
+
else if (event === 'tlError')
|
|
81
|
+
this.tlError.emit(detail);
|
|
123
82
|
}
|
|
124
83
|
renderSkeleton() {
|
|
125
84
|
return (h("div", { class: "skeleton-container" }, h("div", { class: "skeleton-item" }), h("div", { class: "skeleton-item" }), h("div", { class: "skeleton-totals" })));
|
|
126
85
|
}
|
|
127
86
|
renderEmptyCart() {
|
|
128
|
-
|
|
87
|
+
const strings = this.view.strings;
|
|
88
|
+
return (h("div", { class: "empty-cart" }, h("svg", { class: "empty-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1.5", d: "M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" })), h("p", { class: "empty-title" }, strings.emptyTitle), h("p", { class: "empty-message" }, strings.emptyMessage)));
|
|
129
89
|
}
|
|
130
|
-
renderCartItem(
|
|
131
|
-
|
|
132
|
-
return (h("div", { class: `cart-item ${isRemoving ? 'removing' : ''}`, key: item.id }, h("div", { class: "item-info" }, h("p", { class: "item-name" }, item.ticketTypeName), !this.compact && (h("p", { class: "item-event" }, item.eventName)), !this.compact && item.occurrenceDate && (h("p", { class: "item-date" }, this.formatDate(item.occurrenceDate))), h("p", { class: "item-quantity" }, "Qty: ", item.quantity)), h("div", { class: "item-actions" }, h("p", { class: "item-price" }, this.formatPrice(item.totalPrice, item.currency)), this.showRemoveButtons && (h("button", { class: "remove-btn", onClick: () => this.handleRemoveItem(item.id), disabled: isRemoving, "aria-label": "Remove item" }, isRemoving ? (h("span", { class: "spinner" })) : (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M6 18L18 6M6 6l12 12" }))))))));
|
|
90
|
+
renderCartItem(row) {
|
|
91
|
+
return (h("div", { class: `cart-item ${row.removing ? 'removing' : ''}`, key: row.id }, h("div", { class: "item-info" }, h("p", { class: "item-name" }, row.name), row.showEvent && h("p", { class: "item-event" }, row.eventName), row.showDate && h("p", { class: "item-date" }, row.dateLabel), h("p", { class: "item-quantity" }, row.quantityLabel)), h("div", { class: "item-actions" }, h("p", { class: "item-price" }, row.priceLabel), this.showRemoveButtons && (h("button", { class: "remove-btn", onClick: () => this.element.actions.removeItem(row.id), disabled: row.removing, "aria-label": this.view.strings.removeItem }, row.removing ? (h("span", { class: "spinner" })) : (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M6 18L18 6M6 6l12 12" }))))))));
|
|
133
92
|
}
|
|
134
93
|
render() {
|
|
135
|
-
|
|
94
|
+
const { status, strings, derived } = this.view;
|
|
95
|
+
if (status === 'loading') {
|
|
136
96
|
return this.renderSkeleton();
|
|
137
97
|
}
|
|
138
|
-
if (
|
|
98
|
+
if (status === 'empty') {
|
|
139
99
|
return this.renderEmptyCart();
|
|
140
100
|
}
|
|
141
|
-
|
|
142
|
-
// Money comes from the response through cartTotals: the fee row is shown
|
|
143
|
-
// when the surface expressed a fee, and the total is the server's figure,
|
|
144
|
-
// never a sum taken here.
|
|
145
|
-
const totals = cartTotals(this.cart);
|
|
146
|
-
const currency = totals.currency;
|
|
147
|
-
return (h("div", { class: `cart ${this.compact ? 'compact' : ''}` }, h("div", { class: "cart-items" }, items.map(item => this.renderCartItem(item))), h("div", { class: "cart-totals" }, !this.compact && (h("div", { class: "total-row subtotal" }, h("span", null, "Subtotal"), h("span", null, this.formatPrice(totals.subtotal, currency)))), totals.showFee && !this.compact && (h("div", { class: "total-row fees" }, h("span", null, totals.feeLabel), h("span", null, this.formatPrice(totals.fees, currency)))), totals.discount > 0 && !this.compact && (h("div", { class: "total-row discount" }, h("span", null, "Discount"), h("span", null, "-", this.formatPrice(totals.discount, currency)))), h("div", { class: "total-row total" }, h("span", null, "Total"), h("span", null, this.formatPrice(totals.total, currency)))), this.showCheckoutButton && (h("button", { class: "checkout-btn", onClick: this.handleCheckout, disabled: items.length === 0 }, this.checkoutLabel))));
|
|
101
|
+
return (h("div", { class: `cart ${this.compact ? 'compact' : ''}` }, h("div", { class: "cart-items" }, derived.rows.map((row) => this.renderCartItem(row))), h("div", { class: "cart-totals" }, derived.showSubtotalRow && (h("div", { class: "total-row subtotal" }, h("span", null, strings.subtotalRow), h("span", null, derived.subtotalLabel))), derived.showFeeRow && (h("div", { class: "total-row fees" }, h("span", null, derived.totals.feeLabel), h("span", null, derived.feeAmountLabel))), derived.showDiscountRow && (h("div", { class: "total-row discount" }, h("span", null, strings.discountRow), h("span", null, "-", derived.discountLabel))), h("div", { class: "total-row total" }, h("span", null, strings.totalRow), h("span", null, derived.totalLabel))), this.showCheckoutButton && (h("button", { class: "checkout-btn", onClick: () => this.element.actions.checkout(), disabled: derived.checkoutDisabled }, this.checkoutLabel))));
|
|
148
102
|
}
|
|
103
|
+
static get watchers() { return {
|
|
104
|
+
"showCheckoutButton": [{
|
|
105
|
+
"syncProps": 0
|
|
106
|
+
}],
|
|
107
|
+
"checkoutLabel": [{
|
|
108
|
+
"syncProps": 0
|
|
109
|
+
}],
|
|
110
|
+
"showRemoveButtons": [{
|
|
111
|
+
"syncProps": 0
|
|
112
|
+
}],
|
|
113
|
+
"compact": [{
|
|
114
|
+
"syncProps": 0
|
|
115
|
+
}]
|
|
116
|
+
}; }
|
|
149
117
|
};
|
|
150
118
|
TlCart.style = tlCartCss();
|
|
151
119
|
|
|
@@ -1,54 +1,76 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-imfxp765.js';
|
|
2
|
+
import { w as whenSDK, g as getSDK } from './sdk-connector-CqhvfyKV.js';
|
|
3
|
+
import { c as createElement, k as checkoutWrapperCore } from './ticket-selector-BwChnHVC.js';
|
|
3
4
|
|
|
4
5
|
const tlCheckoutWrapperCss = () => `tl-checkout-wrapper,.tl-checkout-wrapper{display:inline-block;cursor:pointer}tl-checkout-wrapper:focus,.tl-checkout-wrapper:focus{outline:2px solid var(--tl-ring);outline-offset:2px;border-radius:var(--tl-radius-sm)}tl-checkout-wrapper[disabled],tl-checkout-wrapper.tl-checkout-wrapper--disabled,.tl-checkout-wrapper--disabled{cursor:not-allowed;opacity:0.5}`;
|
|
5
6
|
|
|
6
7
|
const TlCheckoutWrapper = class {
|
|
7
8
|
constructor(hostRef) {
|
|
8
9
|
registerInstance(this, hostRef);
|
|
9
|
-
this.tlComplete = createEvent(this, "
|
|
10
|
-
this.tlError = createEvent(this, "
|
|
11
|
-
this.tlClose = createEvent(this, "
|
|
10
|
+
this.tlComplete = createEvent(this, "tlComplete");
|
|
11
|
+
this.tlError = createEvent(this, "tlError");
|
|
12
|
+
this.tlClose = createEvent(this, "tlClose");
|
|
12
13
|
/**
|
|
13
14
|
* Whether the wrapper is disabled
|
|
14
15
|
*/
|
|
15
16
|
this.disabled = false;
|
|
17
|
+
this.element = createElement(checkoutWrapperCore, {
|
|
18
|
+
client: () => getSDK(),
|
|
19
|
+
clientReady: () => whenSDK(),
|
|
20
|
+
emit: (event, detail) => this.forward(event, detail),
|
|
21
|
+
});
|
|
22
|
+
/** The core's whole view. Assigning it is what makes Stencil re-render. */
|
|
23
|
+
this.view = this.element.view;
|
|
16
24
|
this.handleClick = () => {
|
|
17
|
-
|
|
18
|
-
return;
|
|
19
|
-
if (!hasSDK()) {
|
|
20
|
-
console.error('[tl-checkout-wrapper] SDK not initialized. Call setSDK(ticketlayer) first.');
|
|
21
|
-
this.tlError.emit({ message: 'SDK not initialized' });
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const sdk = getSDK();
|
|
25
|
-
// Open the checkout modal via SDK
|
|
26
|
-
sdk.checkout.openModal({
|
|
27
|
-
onComplete: (order) => {
|
|
28
|
-
this.tlComplete.emit(order);
|
|
29
|
-
},
|
|
30
|
-
onError: (err) => {
|
|
31
|
-
this.tlError.emit({ message: err.message });
|
|
32
|
-
},
|
|
33
|
-
onClose: () => {
|
|
34
|
-
this.tlClose.emit();
|
|
35
|
-
},
|
|
36
|
-
});
|
|
25
|
+
this.element.actions.activate();
|
|
37
26
|
};
|
|
27
|
+
/** Enter and Space are a press on the web. The core knows nothing of keys. */
|
|
38
28
|
this.handleKeyDown = (e) => {
|
|
39
29
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
40
30
|
e.preventDefault();
|
|
41
|
-
this.
|
|
31
|
+
this.element.actions.activate();
|
|
42
32
|
}
|
|
43
33
|
};
|
|
44
34
|
}
|
|
35
|
+
syncProps() {
|
|
36
|
+
this.element.setProps({ disabled: this.disabled });
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
this.syncProps();
|
|
40
|
+
this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
|
|
41
|
+
this.view = view;
|
|
42
|
+
}));
|
|
43
|
+
this.view = this.element.view;
|
|
44
|
+
// Nothing to do on mount, and mounted anyway: a harness calls mount()
|
|
45
|
+
// unconditionally and pairs it with its teardown (TKT-197).
|
|
46
|
+
this.teardown = this.element.mount();
|
|
47
|
+
}
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
this.teardown?.();
|
|
50
|
+
this.teardown = undefined;
|
|
51
|
+
this.unsubscribe?.();
|
|
52
|
+
this.unsubscribe = undefined;
|
|
53
|
+
}
|
|
54
|
+
forward(event, detail) {
|
|
55
|
+
if (event === 'tlComplete')
|
|
56
|
+
this.tlComplete.emit(detail);
|
|
57
|
+
else if (event === 'tlError')
|
|
58
|
+
this.tlError.emit(detail);
|
|
59
|
+
else if (event === 'tlClose')
|
|
60
|
+
this.tlClose.emit();
|
|
61
|
+
}
|
|
45
62
|
render() {
|
|
46
|
-
|
|
63
|
+
const { interactive } = this.view.derived;
|
|
64
|
+
return (h(Host, { key: 'b261046c2627825258a5905662a79f436d713683', class: {
|
|
47
65
|
'tl-checkout-wrapper': true,
|
|
48
|
-
'tl-checkout-wrapper--disabled':
|
|
49
|
-
}, onClick: this.handleClick, onKeyDown: this.handleKeyDown, role: "button", tabindex:
|
|
66
|
+
'tl-checkout-wrapper--disabled': !interactive,
|
|
67
|
+
}, onClick: this.handleClick, onKeyDown: this.handleKeyDown, role: "button", tabindex: interactive ? 0 : -1, "aria-disabled": interactive ? null : 'true' }, h("slot", { key: '5be08d5007a755e3d88a06ae89c08e082e4ba052' })));
|
|
50
68
|
}
|
|
51
|
-
get
|
|
69
|
+
static get watchers() { return {
|
|
70
|
+
"disabled": [{
|
|
71
|
+
"syncProps": 0
|
|
72
|
+
}]
|
|
73
|
+
}; }
|
|
52
74
|
};
|
|
53
75
|
TlCheckoutWrapper.style = tlCheckoutWrapperCss();
|
|
54
76
|
|