@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.
Files changed (161) hide show
  1. package/dist/cjs/{index-I9CoYv3k.js → index-DanPUX0s.js} +1 -1
  2. package/dist/cjs/index.cjs.js +2 -1
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/ticket-selector-BYVL13k_.js +3623 -0
  5. package/dist/cjs/ticketlayer-elements.cjs.js +2 -2
  6. package/dist/cjs/tl-buy-modal.cjs.entry.js +3 -3
  7. package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +89 -74
  8. package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +61 -30
  9. package/dist/cjs/tl-cart-badge.cjs.entry.js +74 -61
  10. package/dist/cjs/tl-cart-drawer.cjs.entry.js +51 -23
  11. package/dist/cjs/tl-cart.cjs.entry.js +71 -103
  12. package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +51 -29
  13. package/dist/cjs/tl-event-card.cjs.entry.js +43 -105
  14. package/dist/cjs/tl-event-list.cjs.entry.js +72 -35
  15. package/dist/cjs/tl-login.cjs.entry.js +74 -141
  16. package/dist/cjs/tl-my-orders.cjs.entry.js +52 -92
  17. package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +153 -921
  18. package/dist/cjs/tl-order-confirmation.cjs.entry.js +71 -107
  19. package/dist/cjs/tl-order-tickets_2.cjs.entry.js +48 -74
  20. package/dist/cjs/tl-promo-code.cjs.entry.js +50 -47
  21. package/dist/cjs/tl-seat-map.cjs.entry.js +3 -3
  22. package/dist/cjs/web-query-Ce73jB4k.js +16 -0
  23. package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +2 -2
  24. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +37 -0
  25. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +105 -79
  26. package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +73 -30
  27. package/dist/collection/components/tl-cart/tl-cart.js +82 -107
  28. package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +62 -62
  29. package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +56 -24
  30. package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +61 -29
  31. package/dist/collection/components/tl-event-card/event-card-adapter.js +11 -23
  32. package/dist/collection/components/tl-event-card/tl-event-card.js +51 -84
  33. package/dist/collection/components/tl-event-list/tl-event-list.js +82 -38
  34. package/dist/collection/components/tl-login/tl-login.js +83 -147
  35. package/dist/collection/components/tl-my-orders/tl-my-orders.js +58 -96
  36. package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +137 -516
  37. package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +81 -115
  38. package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +57 -92
  39. package/dist/collection/components/tl-promo-code/tl-promo-code.js +55 -50
  40. package/dist/collection/components/tl-seat-map/tl-seat-map.js +2 -2
  41. package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +34 -20
  42. package/dist/collection/utils/order-summary.js +15 -135
  43. package/dist/collection/utils/testing/deep-text.js +29 -0
  44. package/dist/collection/utils/testing/fixtures.js +290 -0
  45. package/dist/collection/utils/testing/mock-sdk.js +13 -2
  46. package/dist/collection/utils/web-query.js +12 -0
  47. package/dist/collection/utils/web-storage.js +22 -0
  48. package/dist/components/ticket-selector.js +1 -0
  49. package/dist/components/tl-buy-modal.js +1 -1
  50. package/dist/components/tl-buy-tickets-button.js +1 -1
  51. package/dist/components/tl-buy-tickets-wrapper2.js +1 -1
  52. package/dist/components/tl-cart-badge.js +1 -1
  53. package/dist/components/tl-cart-drawer.js +1 -1
  54. package/dist/components/tl-cart2.js +1 -1
  55. package/dist/components/tl-checkout-wrapper2.js +1 -1
  56. package/dist/components/tl-event-card2.js +1 -1
  57. package/dist/components/tl-event-list.js +1 -1
  58. package/dist/components/tl-login2.js +1 -1
  59. package/dist/components/tl-my-orders.js +1 -1
  60. package/dist/components/tl-occurrence-selector2.js +1 -1
  61. package/dist/components/tl-order-confirmation.js +1 -1
  62. package/dist/components/tl-order-tickets2.js +1 -1
  63. package/dist/components/tl-promo-code.js +1 -1
  64. package/dist/components/tl-seat-map.js +1 -1
  65. package/dist/components/tl-ticket-selector2.js +1 -1
  66. package/dist/components/web-query.js +1 -0
  67. package/dist/elements.docs.json +34 -34
  68. package/dist/esm/{index-OoYV1faY.js → index-imfxp765.js} +1 -1
  69. package/dist/esm/index.js +2 -1
  70. package/dist/esm/loader.js +3 -3
  71. package/dist/esm/ticket-selector-BwChnHVC.js +3606 -0
  72. package/dist/esm/ticketlayer-elements.js +3 -3
  73. package/dist/esm/tl-buy-modal.entry.js +3 -3
  74. package/dist/esm/tl-buy-tickets-button.entry.js +90 -75
  75. package/dist/esm/tl-buy-tickets-wrapper.entry.js +62 -31
  76. package/dist/esm/tl-cart-badge.entry.js +75 -62
  77. package/dist/esm/tl-cart-drawer.entry.js +52 -24
  78. package/dist/esm/tl-cart.entry.js +72 -104
  79. package/dist/esm/tl-checkout-wrapper.entry.js +52 -30
  80. package/dist/esm/tl-event-card.entry.js +44 -106
  81. package/dist/esm/tl-event-list.entry.js +73 -36
  82. package/dist/esm/tl-login.entry.js +75 -142
  83. package/dist/esm/tl-my-orders.entry.js +53 -93
  84. package/dist/esm/tl-occurrence-selector_2.entry.js +152 -920
  85. package/dist/esm/tl-order-confirmation.entry.js +72 -108
  86. package/dist/esm/tl-order-tickets_2.entry.js +49 -75
  87. package/dist/esm/tl-promo-code.entry.js +51 -48
  88. package/dist/esm/tl-seat-map.entry.js +3 -3
  89. package/dist/esm/web-query-Bdbb2lk5.js +14 -0
  90. package/dist/ticketlayer-elements/index.esm.js +1 -1
  91. package/dist/ticketlayer-elements/p-45923d2c.entry.js +1 -0
  92. package/dist/ticketlayer-elements/p-492adc77.entry.js +1 -0
  93. package/dist/ticketlayer-elements/p-4cfc9e53.entry.js +1 -0
  94. package/dist/ticketlayer-elements/{p-ac264adc.entry.js → p-5135630e.entry.js} +1 -1
  95. package/dist/ticketlayer-elements/p-5bbce3b5.entry.js +1 -0
  96. package/dist/ticketlayer-elements/p-7d547721.entry.js +1 -0
  97. package/dist/ticketlayer-elements/p-7fe7b6ba.entry.js +1 -0
  98. package/dist/ticketlayer-elements/p-8122f0c1.entry.js +1 -0
  99. package/dist/ticketlayer-elements/p-98d40869.entry.js +1 -0
  100. package/dist/ticketlayer-elements/p-Bdbb2lk5.js +1 -0
  101. package/dist/ticketlayer-elements/p-BwChnHVC.js +1 -0
  102. package/dist/ticketlayer-elements/p-abec290a.entry.js +1 -0
  103. package/dist/ticketlayer-elements/p-ac79a3f6.entry.js +1 -0
  104. package/dist/ticketlayer-elements/p-d01f4429.entry.js +1 -0
  105. package/dist/ticketlayer-elements/p-d7ffaf46.entry.js +1 -0
  106. package/dist/ticketlayer-elements/p-e7170f3c.entry.js +1 -0
  107. package/dist/ticketlayer-elements/p-e787e862.entry.js +1 -0
  108. package/dist/ticketlayer-elements/p-f1ff931f.entry.js +1 -0
  109. package/dist/ticketlayer-elements/p-imfxp765.js +3 -0
  110. package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -1
  111. package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -1
  112. package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +40 -8
  113. package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +20 -1
  114. package/dist/types/components/tl-cart/tl-cart.d.ts +40 -42
  115. package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +22 -7
  116. package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +28 -5
  117. package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +18 -1
  118. package/dist/types/components/tl-event-card/event-card-adapter.d.ts +9 -20
  119. package/dist/types/components/tl-event-card/tl-event-card.d.ts +25 -28
  120. package/dist/types/components/tl-event-list/tl-event-list.d.ts +46 -6
  121. package/dist/types/components/tl-login/tl-login.d.ts +68 -22
  122. package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +30 -12
  123. package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +73 -161
  124. package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +48 -15
  125. package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +29 -31
  126. package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +28 -10
  127. package/dist/types/components/tl-ticket/tl-ticket.d.ts +2 -11
  128. package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +22 -4
  129. package/dist/types/components.d.ts +270 -62
  130. package/dist/types/utils/order-summary.d.ts +14 -97
  131. package/dist/types/utils/testing/deep-text.d.ts +13 -0
  132. package/dist/types/utils/testing/fixtures.d.ts +225 -0
  133. package/dist/types/utils/testing/mock-sdk.d.ts +14 -1
  134. package/dist/types/utils/web-query.d.ts +18 -0
  135. package/dist/types/utils/web-storage.d.ts +16 -0
  136. package/elements.catalogue.json +602 -50
  137. package/package.json +8 -6
  138. package/dist/cjs/money-BtmM2gt-.js +0 -118
  139. package/dist/cjs/order-summary-X3TlZxc2.js +0 -150
  140. package/dist/components/money.js +0 -1
  141. package/dist/components/order-summary.js +0 -1
  142. package/dist/esm/money-4ig0-WB6.js +0 -112
  143. package/dist/esm/order-summary-DiDtvfZM.js +0 -136
  144. package/dist/ticketlayer-elements/p-0814420f.entry.js +0 -1
  145. package/dist/ticketlayer-elements/p-0acabc26.entry.js +0 -1
  146. package/dist/ticketlayer-elements/p-109a3feb.entry.js +0 -1
  147. package/dist/ticketlayer-elements/p-1a4ba71c.entry.js +0 -1
  148. package/dist/ticketlayer-elements/p-318965c1.entry.js +0 -1
  149. package/dist/ticketlayer-elements/p-347c7fd1.entry.js +0 -1
  150. package/dist/ticketlayer-elements/p-3649c26d.entry.js +0 -1
  151. package/dist/ticketlayer-elements/p-40260cc9.entry.js +0 -1
  152. package/dist/ticketlayer-elements/p-4ig0-WB6.js +0 -1
  153. package/dist/ticketlayer-elements/p-55fd2f9f.entry.js +0 -1
  154. package/dist/ticketlayer-elements/p-62ee659b.entry.js +0 -1
  155. package/dist/ticketlayer-elements/p-7d4ecc2b.entry.js +0 -1
  156. package/dist/ticketlayer-elements/p-7f0abf95.entry.js +0 -1
  157. package/dist/ticketlayer-elements/p-BXpVGW51.js +0 -1
  158. package/dist/ticketlayer-elements/p-OoYV1faY.js +0 -3
  159. package/dist/ticketlayer-elements/p-a3c1b26c.entry.js +0 -1
  160. package/dist/ticketlayer-elements/p-aeb4c6fb.entry.js +0 -1
  161. package/dist/ticketlayer-elements/p-ba62541f.entry.js +0 -1
@@ -1,7 +1,7 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-OoYV1faY.js';
2
- import { o as onSDKEvent, w as whenSDK } from './sdk-connector-CqhvfyKV.js';
3
- import { e as errorMessage, r as resolveOccurrence, o as orderEventName, c as formatDateTime, d as orderCustomerEmail, g as orderTotals, a as formatPrice, h as ticketItems } from './order-summary-DiDtvfZM.js';
4
- import './money-4ig0-WB6.js';
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 { w as webQuery } from './web-query-Bdbb2lk5.js';
4
+ import { c as createElement, o as orderConfirmationCore } from './ticket-selector-BwChnHVC.js';
5
5
 
6
6
  const tlOrderConfirmationCss = () => `:host{display:block;font-family:var(--tl-font-family);color:var(--tl-foreground)}.confirmation{text-align:center}.check{width:4rem;height:4rem;margin:0 auto var(--tl-spacing-4);display:flex;align-items:center;justify-content:center;border-radius:9999px;background:var(--tl-success);color:var(--tl-success-foreground)}.check svg{width:2rem;height:2rem}.title{margin:0 0 var(--tl-spacing-2);font-size:1.875rem;font-weight:700;line-height:1.2}.lead{margin:0 0 var(--tl-spacing-6);color:var(--tl-muted-foreground)}.error{margin:0 0 var(--tl-spacing-6);font-size:0.875rem;color:var(--tl-error)}.summary{text-align:left;padding:var(--tl-spacing-6);margin-bottom:var(--tl-spacing-6);background:var(--tl-muted);border:1px solid var(--tl-border);border-radius:var(--tl-radius-lg)}.rows{display:grid;gap:var(--tl-spacing-2);margin:0 0 var(--tl-spacing-4);padding:0 0 var(--tl-spacing-4);border-bottom:1px solid var(--tl-border)}.row{display:flex;justify-content:space-between;gap:var(--tl-spacing-4);font-size:0.875rem}.row dt{color:var(--tl-muted-foreground)}.row dd{margin:0;text-align:right;overflow-wrap:anywhere}.reference{font-family:var(--tl-font-family-mono);font-weight:600}.lines{list-style:none;margin:0;padding:0;display:grid;gap:var(--tl-spacing-2)}.line{display:flex;justify-content:space-between;gap:var(--tl-spacing-4);font-size:0.875rem}.totals{margin-top:var(--tl-spacing-3);padding-top:var(--tl-spacing-3);border-top:1px solid var(--tl-border);display:grid;gap:var(--tl-spacing-1);font-size:0.875rem}.total-row{display:flex;justify-content:space-between;color:var(--tl-muted-foreground)}.total-row.discount{color:var(--tl-success)}.total-row.total{margin-top:var(--tl-spacing-1);font-size:1rem;font-weight:600;color:var(--tl-foreground)}.tickets{text-align:left}.subtitle{margin:0 0 var(--tl-spacing-4);font-size:1.125rem;font-weight:600}.hint{margin:var(--tl-spacing-3) 0 0;font-size:0.75rem;color:var(--tl-muted-foreground)}.skeleton-line,.skeleton-block{background:var(--tl-secondary);border-radius:var(--tl-radius-md);animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;margin:0 auto var(--tl-spacing-3)}.skeleton-line{height:1rem}.skeleton-line.short{width:40%;height:1.75rem}.skeleton-line.long{width:70%}.skeleton-block{height:8rem}@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.5}}`;
7
7
 
@@ -14,131 +14,95 @@ const TlOrderConfirmation = class {
14
14
  this.showTickets = true;
15
15
  /** Columns for the ticket grid. */
16
16
  this.columns = 2;
17
- this.order = null;
18
- this.resolvedOrderId = null;
19
- this.loading = false;
20
- this.error = null;
21
- this.paymentFailed = false;
22
- this.occurrence = null;
23
- this.signedInCustomer = null;
24
- }
25
- watchOrderId(next) {
26
- this.resolvedOrderId = next || this.orderIdFromUrl();
27
- this.load();
17
+ this.element = createElement(orderConfirmationCore, {
18
+ client: () => getSDK(),
19
+ clientReady: () => whenSDK(),
20
+ query: webQuery,
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;
28
25
  }
29
- async componentWillLoad() {
30
- const params = this.urlParams();
31
- // Stripe returns with ?redirect_status=; anything but succeeded is not paid.
32
- const redirect = params?.get('redirect_status');
33
- this.paymentFailed = !!redirect && redirect !== 'succeeded';
34
- this.resolvedOrderId = this.orderId || this.orderIdFromUrl();
35
- if (this.resolvedOrderId && !this.paymentFailed) {
36
- await this.load();
37
- }
26
+ /**
27
+ * A new order id is a new subject, and the core resolves it again the way
28
+ * the mount did - the prop first, the link second. Not a remount: the
29
+ * `checkout:completed` subscription belongs to the element rather than to
30
+ * the order it is showing.
31
+ */
32
+ watchOrderId() {
33
+ this.syncProps();
34
+ this.element.actions.orderIdChanged();
38
35
  }
39
- componentDidLoad() {
40
- // A page that mounts before checkout: pick the order up when the SDK completes it.
41
- this.unsubscribe = onSDKEvent('checkout:completed', (payload) => {
42
- const order = payload;
43
- if (!order?.id)
44
- return;
45
- this.paymentFailed = false;
46
- this.order = order;
47
- this.resolvedOrderId = order.id;
48
- this.tlOrderLoaded.emit({ order });
49
- // Re-read for tickets, which are issued after the order is created.
50
- this.load();
36
+ syncProps() {
37
+ this.element.setProps({
38
+ orderId: this.orderId,
39
+ customerEmail: this.customerEmail,
40
+ showTickets: this.showTickets,
41
+ columns: this.columns,
51
42
  });
52
43
  }
44
+ connectedCallback() {
45
+ this.syncProps();
46
+ this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
47
+ this.view = view;
48
+ }));
49
+ this.view = this.element.view;
50
+ this.teardown = this.element.mount();
51
+ }
52
+ /**
53
+ * Off screen: run the mount's teardown, which drops the
54
+ * `checkout:completed` subscription. Not `destroy()`: Stencil calls this for
55
+ * a DOM move as well as a removal, and a destroyed core never mounts again.
56
+ */
53
57
  disconnectedCallback() {
58
+ this.teardown?.();
59
+ this.teardown = undefined;
54
60
  this.unsubscribe?.();
61
+ this.unsubscribe = undefined;
55
62
  }
56
- urlParams() {
57
- if (typeof window === 'undefined' || !window.location?.search)
58
- return null;
59
- return new URLSearchParams(window.location.search);
60
- }
61
- orderIdFromUrl() {
62
- return this.urlParams()?.get('orderId') || null;
63
- }
64
- async load() {
65
- const id = this.resolvedOrderId;
66
- if (!id)
67
- return;
68
- try {
69
- this.loading = !this.order;
70
- this.error = null;
71
- const sdk = await whenSDK();
72
- const orders = sdk.getOrdersManager?.();
73
- if (!orders)
74
- throw new Error('Orders are not available');
75
- const order = (await orders.get(id));
76
- if (!order)
77
- throw new Error('Order not found');
78
- this.order = order;
79
- this.signedInCustomer = sdk.getAuthManager?.()?.customer ?? null;
80
- this.tlOrderLoaded.emit({ order });
81
- this.resolveEvent(sdk, order);
82
- }
83
- catch (err) {
84
- console.error('[tl-order-confirmation] Failed to load order:', err);
85
- this.error = errorMessage(err, 'Failed to load your order');
86
- this.tlError.emit({ message: this.error });
87
- }
88
- finally {
89
- this.loading = false;
90
- }
91
- }
92
- // The order view has no event name or date; look them up from the first
93
- // ticket's occurrence. Non-blocking and best effort.
94
- async resolveEvent(sdk, order) {
95
- const occurrenceId = order.tickets?.find((t) => t.eventOccurrenceId)?.eventOccurrenceId;
96
- if (!occurrenceId)
97
- return;
98
- try {
99
- const resolved = await resolveOccurrence(sdk, occurrenceId);
100
- if (resolved && this.order?.id === order.id)
101
- this.occurrence = resolved;
102
- }
103
- catch {
104
- // Leave the event line at what the order gives us.
105
- }
63
+ forward(event, detail) {
64
+ if (event === 'tlOrderLoaded')
65
+ this.tlOrderLoaded.emit(detail);
66
+ else if (event === 'tlError')
67
+ this.tlError.emit(detail);
106
68
  }
107
- renderRows(order) {
108
- const email = this.customerEmail || orderCustomerEmail(order, this.signedInCustomer);
109
- const eventName = this.occurrence?.eventName || orderEventName(order);
110
- const startsAt = this.occurrence?.startsAt;
111
- return (h("dl", { class: "rows" }, h("div", { class: "row" }, h("dt", null, "Order reference"), h("dd", { class: "reference" }, order.orderNumber)), email && (h("div", { class: "row" }, h("dt", null, "Email"), h("dd", null, email))), eventName && (h("div", { class: "row" }, h("dt", null, "Event"), h("dd", null, eventName))), startsAt && (h("div", { class: "row" }, h("dt", null, "Date"), h("dd", null, formatDateTime(startsAt))))));
69
+ renderRows() {
70
+ return (h("dl", { class: "rows" }, this.view.derived.rows.map((row) => (h("div", { class: "row", key: row.label }, h("dt", null, row.label), h("dd", { class: row.reference ? 'reference' : undefined }, row.value))))));
112
71
  }
113
- // Money comes from orderTotals: the booking fee is its own row named after
114
- // the channel's fee profile, the subtotal is the ticket lines alone (the
115
- // order's own `subtotal` folds the fee line into it) and the total is the
116
- // order's figure, so what is shown is what was charged.
117
- renderTotals(order) {
118
- const totals = orderTotals(order);
119
- const c = totals.currency;
120
- return (h("div", { class: "totals" }, h("div", { class: "total-row" }, h("span", null, "Subtotal"), h("span", null, formatPrice(totals.subtotal, c))), totals.showFee && (h("div", { class: "total-row fee" }, h("span", null, totals.feeLabel), h("span", null, formatPrice(totals.fees, c)))), totals.tax > 0 && (h("div", { class: "total-row" }, h("span", null, "Tax"), h("span", null, formatPrice(totals.tax, c)))), totals.discount > 0 && (h("div", { class: "total-row discount" }, h("span", null, "Discount"), h("span", null, "-", formatPrice(totals.discount, c)))), h("div", { class: "total-row total" }, h("span", null, "Total"), h("span", null, formatPrice(totals.total, c)))));
72
+ // Money comes from the core's orderTotals: the booking fee is its own row
73
+ // named after the channel's fee profile, the subtotal is the ticket lines
74
+ // alone (the order's own `subtotal` folds the fee line into it) and the
75
+ // total is the order's figure, so what is shown is what was charged.
76
+ renderTotals() {
77
+ const { strings, derived } = this.view;
78
+ return (h("div", { class: "totals" }, h("div", { class: "total-row" }, h("span", null, strings.subtotalRow), h("span", null, derived.subtotalLabel)), derived.totals.showFee && (h("div", { class: "total-row fee" }, h("span", null, derived.totals.feeLabel), h("span", null, derived.feeAmountLabel))), derived.showTaxRow && (h("div", { class: "total-row" }, h("span", null, strings.taxRow), h("span", null, derived.taxLabel))), 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))));
121
79
  }
122
80
  render() {
123
- if (this.paymentFailed) {
124
- return (h("div", { class: "confirmation" }, h("h1", { class: "title" }, "Payment not completed"), h("p", { class: "lead" }, "Your payment wasn't completed. Your cart is still saved, so you can try again.")));
81
+ const { status, state, strings, derived } = this.view;
82
+ if (status === 'payment-failed') {
83
+ return (h("div", { class: "confirmation" }, h("h1", { class: "title" }, strings.paymentFailedTitle), h("p", { class: "lead" }, strings.paymentFailedLead)));
125
84
  }
126
85
  // Nothing to show yet: no order in props, URL or from checkout.
127
- if (!this.resolvedOrderId && !this.order) {
86
+ if (status === 'idle') {
128
87
  return null;
129
88
  }
130
- if (this.loading) {
89
+ if (status === 'loading') {
131
90
  return (h("div", { class: "confirmation" }, h("div", { class: "skeleton-line short" }), h("div", { class: "skeleton-line long" }), h("div", { class: "skeleton-block" })));
132
91
  }
133
- const order = this.order;
134
- const orderId = order?.id || this.resolvedOrderId;
135
- return (h("div", { class: "confirmation" }, h("div", { class: "check", "aria-hidden": "true" }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" }))), h("h1", { class: "title" }, "You're going!"), h("p", { class: "lead" }, order?.orderNumber
136
- ? `Order ${order.orderNumber} is confirmed. Your tickets are on their way to your email.`
137
- : 'Your order is confirmed. Your tickets are on their way to your email.'), this.error && !order && (h("p", { class: "error" }, "We couldn't load your order details yet. ", this.error)), order && Array.isArray(order.items) && (h("div", { class: "summary" }, this.renderRows(order), h("ul", { class: "lines" }, ticketItems(order).map((item, i) => (h("li", { class: "line", key: i }, h("span", { class: "line-name" }, item.quantity, " x ", item.name), h("span", { class: "line-price" }, formatPrice(item.subtotal, order.currency)))))), this.renderTotals(order))), this.showTickets && order && (h("div", { class: "tickets" }, h("h2", { class: "subtitle" }, "Your tickets"), h("tl-order-tickets", { orderId: orderId, columns: this.columns }), h("p", { class: "hint" }, "Show these QR codes at the door for entry. Use Download PDF on a ticket to save it.")))));
92
+ return (h("div", { class: "confirmation" }, h("div", { class: "check", "aria-hidden": "true" }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" }))), h("h1", { class: "title" }, strings.title), h("p", { class: "lead" }, derived.leadText), derived.showError && (h("p", { class: "error" }, strings.errorPrefix, state.error)), derived.showSummary && (h("div", { class: "summary" }, this.renderRows(), h("ul", { class: "lines" }, derived.lines.map((line, i) => (h("li", { class: "line", key: i }, h("span", { class: "line-name" }, line.label), h("span", { class: "line-price" }, line.priceLabel))))), this.renderTotals())), derived.showTickets && (h("div", { class: "tickets" }, h("h2", { class: "subtitle" }, strings.ticketsTitle), h("tl-order-tickets", { orderId: derived.ticketsOrderId, columns: this.columns }), h("p", { class: "hint" }, strings.ticketsHint)))));
138
93
  }
139
94
  static get watchers() { return {
140
95
  "orderId": [{
141
96
  "watchOrderId": 0
97
+ }],
98
+ "customerEmail": [{
99
+ "syncProps": 0
100
+ }],
101
+ "showTickets": [{
102
+ "syncProps": 0
103
+ }],
104
+ "columns": [{
105
+ "syncProps": 0
142
106
  }]
143
107
  }; }
144
108
  };
@@ -1,5 +1,6 @@
1
- import { r as registerInstance, h } from './index-OoYV1faY.js';
2
- import { w as whenSDK } from './sdk-connector-CqhvfyKV.js';
1
+ import { r as registerInstance, h } from './index-imfxp765.js';
2
+ import { w as whenSDK, g as getSDK } from './sdk-connector-CqhvfyKV.js';
3
+ import { c as createElement, i as orderTicketsCore } from './ticket-selector-BwChnHVC.js';
3
4
 
4
5
  const tlOrderTicketsCss = () => `:host{display:block;font-family:var(--tl-font-family)}.grid{display:grid;gap:var(--tl-spacing-4);grid-template-columns:1fr}@media (min-width: 480px){.grid.cols-2{grid-template-columns:repeat(2, 1fr)}.grid.cols-3{grid-template-columns:repeat(3, 1fr)}}.state{padding:var(--tl-spacing-6);text-align:center;color:var(--tl-muted-foreground);font-size:0.875rem}.state.error{color:var(--tl-error)}.state.issuing{display:flex;align-items:center;justify-content:center;gap:var(--tl-spacing-2)}.spinner{width:0.875rem;height:0.875rem;border:2px solid var(--tl-border);border-top-color:var(--tl-primary);border-radius:50%;animation:tl-spin 0.7s linear infinite;flex:none}@keyframes tl-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spinner{animation:none;border-top-color:var(--tl-border)}}`;
5
6
 
@@ -8,97 +9,70 @@ const TlOrderTickets = class {
8
9
  registerInstance(this, hostRef);
9
10
  /** Columns in the grid (default 2). */
10
11
  this.columns = 2;
11
- this.tickets = [];
12
- this.loading = true;
13
- this.error = null;
14
- /** The order loaded, but has no tickets yet and we are still waiting. */
15
- this.issuing = false;
16
- this.poll = 0;
12
+ this.element = createElement(orderTicketsCore, {
13
+ client: () => getSDK(),
14
+ clientReady: () => whenSDK(),
15
+ emit: (event, detail) => this.forward(event, detail),
16
+ });
17
+ /** The core's whole view. Assigning it is what makes Stencil re-render. */
18
+ this.view = this.element.view;
17
19
  }
20
+ /** A different order: forget this one and read again, from the top. */
18
21
  watchOrder() {
19
- this.reset();
20
- this.load();
22
+ this.syncProps();
23
+ this.element.actions.orderIdChanged();
21
24
  }
22
- async componentWillLoad() {
23
- await this.load();
25
+ syncProps() {
26
+ this.element.setProps({ orderId: this.orderId, columns: this.columns });
27
+ }
28
+ connectedCallback() {
29
+ this.syncProps();
30
+ this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
31
+ this.view = view;
32
+ }));
33
+ this.view = this.element.view;
34
+ this.teardown = this.element.mount();
24
35
  }
36
+ /**
37
+ * Off screen: run the mount's teardown, which is what stops the polling.
38
+ * Not `destroy()`: Stencil calls this for a DOM move as well as a removal,
39
+ * and a destroyed core never mounts again.
40
+ */
25
41
  disconnectedCallback() {
26
- this.stopPolling();
42
+ this.teardown?.();
43
+ this.teardown = undefined;
44
+ this.unsubscribe?.();
45
+ this.unsubscribe = undefined;
27
46
  }
28
- reset() {
29
- this.stopPolling();
30
- this.poll = 0;
31
- this.tickets = [];
32
- this.issuing = false;
33
- }
34
- stopPolling() {
35
- if (this.timer !== undefined) {
36
- clearTimeout(this.timer);
37
- this.timer = undefined;
38
- }
39
- }
40
- async load() {
41
- try {
42
- this.error = null;
43
- const sdk = await whenSDK();
44
- const orders = sdk.getOrdersManager?.();
45
- if (!orders)
46
- throw new Error('Tickets are not available');
47
- const order = (await orders.get(this.orderId));
48
- this.tickets = order?.tickets ?? [];
49
- if (this.tickets.length > 0) {
50
- // Arrived. Stop asking.
51
- this.issuing = false;
52
- this.stopPolling();
53
- }
54
- else {
55
- const delay = TlOrderTickets.POLL_DELAYS_MS[this.poll];
56
- // `undefined` once the schedule runs out: give up waiting, and say so.
57
- this.issuing = delay !== undefined;
58
- if (delay !== undefined) {
59
- this.poll += 1;
60
- this.stopPolling();
61
- this.timer = setTimeout(() => this.load(), delay);
62
- }
63
- }
64
- }
65
- catch (err) {
66
- // A failed request is a different thing from an order with no tickets,
67
- // and stops the polling: retrying a 403 a dozen times helps nobody.
68
- this.stopPolling();
69
- this.issuing = false;
70
- this.error = err instanceof Error ? err.message : 'Failed to load tickets';
71
- }
72
- finally {
73
- this.loading = false;
74
- }
47
+ /** The core declares no events, so nothing ever reaches here. */
48
+ forward(_event, _detail) {
49
+ // Intentionally empty: tl-order-tickets announces nothing to its host.
75
50
  }
76
51
  render() {
77
- if (this.loading) {
78
- return h("div", { class: "state" }, "Loading tickets\u2026");
52
+ const { status, state, strings, derived } = this.view;
53
+ if (status === 'loading') {
54
+ return h("div", { class: "state" }, strings.loading);
55
+ }
56
+ if (status === 'error') {
57
+ return h("div", { class: "state error" }, state.error);
79
58
  }
80
- if (this.error) {
81
- return h("div", { class: "state error" }, this.error);
59
+ if (status === 'issuing') {
60
+ return (h("div", { class: "state issuing", role: "status", "aria-live": "polite" }, h("span", { class: "spinner", "aria-hidden": "true" }), strings.preparing));
82
61
  }
83
- if (this.tickets.length === 0) {
84
- return this.issuing ? (h("div", { class: "state issuing", role: "status", "aria-live": "polite" }, h("span", { class: "spinner", "aria-hidden": "true" }), "Preparing your tickets\u2026")) : (h("div", { class: "state", role: "status" }, "Your tickets are taking longer than usual. They will be emailed to you as soon as they are ready."));
62
+ if (status === 'delayed') {
63
+ return (h("div", { class: "state", role: "status" }, strings.delayed));
85
64
  }
86
- return (h("div", { class: `grid cols-${this.columns}` }, this.tickets.map((t) => (h("tl-ticket", { key: t.id, ticket: t, orderId: this.orderId })))));
65
+ return (h("div", { class: `grid cols-${derived.columns}` }, derived.tickets.map((t) => (h("tl-ticket", { key: t.id, ticket: t, orderId: derived.orderId })))));
87
66
  }
88
67
  static get watchers() { return {
89
68
  "orderId": [{
90
69
  "watchOrder": 0
70
+ }],
71
+ "columns": [{
72
+ "syncProps": 0
91
73
  }]
92
74
  }; }
93
75
  };
94
- /**
95
- * Gaps between polls, in milliseconds. Front-loaded because issuance
96
- * usually lands in the first few seconds, then widening so a genuinely
97
- * stuck order is not hammered. Sums to roughly one minute.
98
- */
99
- TlOrderTickets.POLL_DELAYS_MS = [
100
- 1000, 1500, 2000, 3000, 4000, 5000, 6000, 8000, 10000, 12000,
101
- ];
102
76
  TlOrderTickets.style = tlOrderTicketsCss();
103
77
 
104
78
  function getDefaultExportFromCjs (x) {
@@ -1,7 +1,6 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-OoYV1faY.js';
2
- import { w as whenSDK } from './sdk-connector-CqhvfyKV.js';
3
- import { e as errorMessage, i as isAuthError } from './order-summary-DiDtvfZM.js';
4
- import './money-4ig0-WB6.js';
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, p as promoCodeCore } from './ticket-selector-BwChnHVC.js';
5
4
 
6
5
  const tlPromoCodeCss = () => `:host{display:block;font-family:var(--tl-font-family);color:var(--tl-foreground)}.field{display:flex;gap:var(--tl-spacing-2)}.input{flex:1;min-width:0;padding:var(--tl-spacing-3);font:inherit;font-size:0.875rem;color:var(--tl-foreground);background:var(--tl-background);border:1px solid var(--tl-border);border-radius:var(--tl-radius-md);text-transform:uppercase}.input::placeholder{text-transform:none;color:var(--tl-muted-foreground)}.input:focus{outline:2px solid var(--tl-primary);outline-offset:1px}.apply{padding:var(--tl-spacing-3) var(--tl-spacing-4);font:inherit;font-size:0.875rem;font-weight:500;color:var(--tl-primary-foreground);background:var(--tl-primary);border:none;border-radius:var(--tl-radius-md);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 0;font-size:0.8125rem;color:var(--tl-error)}.applied{display:flex;align-items:center;justify-content:space-between;gap:var(--tl-spacing-3);padding:var(--tl-spacing-3);font-size:0.875rem;background:var(--tl-muted);border:1px solid var(--tl-border);border-radius:var(--tl-radius-md)}.applied-text{display:flex;align-items:center;gap:var(--tl-spacing-2)}.icon{width:1rem;height:1rem;flex-shrink:0;color:var(--tl-success)}.code{font-family:var(--tl-font-family-mono)}.link{padding:0;font:inherit;font-size:0.8125rem;color:var(--tl-primary);background:none;border:none;cursor:pointer;white-space:nowrap}.link:hover{text-decoration:underline}`;
7
6
 
@@ -14,60 +13,64 @@ const TlPromoCode = class {
14
13
  this.placeholder = 'Promo or presale code';
15
14
  /** Apply button label. */
16
15
  this.buttonLabel = 'Apply';
17
- this.code = '';
18
- this.applying = false;
19
- this.applied = null;
20
- this.error = null;
16
+ this.element = createElement(promoCodeCore, {
17
+ client: () => getSDK(),
18
+ clientReady: () => whenSDK(),
19
+ emit: (event, detail) => this.forward(event, detail),
20
+ });
21
+ /** The core's whole view. Assigning it is what makes Stencil re-render. */
22
+ this.view = this.element.view;
21
23
  this.handleInput = (e) => {
22
- this.code = e.target.value;
23
- this.error = null;
24
+ this.element.actions.setCode(e.target.value);
24
25
  };
25
26
  this.handleSubmit = (e) => {
26
27
  e.preventDefault();
27
- this.apply();
28
- };
29
- this.reset = () => {
30
- this.applied = null;
31
- this.error = null;
28
+ this.element.actions.apply();
32
29
  };
30
+ this.reset = () => this.element.actions.reset();
33
31
  }
34
- async apply() {
35
- const code = this.code.trim();
36
- if (!code) {
37
- this.error = 'Enter a code';
38
- return;
39
- }
40
- this.applying = true;
41
- this.error = null;
42
- try {
43
- const sdk = await whenSDK();
44
- const presale = sdk.getPresaleManager?.();
45
- if (!presale)
46
- throw new Error('Promo codes are not available');
47
- const result = await presale.redeem(code);
48
- // The SDK refreshed the cart on redeem; read the cached copy for the payload.
49
- const cart = await sdk.getCartManager?.()?.get().catch(() => null) ?? null;
50
- this.applied = { code: code.toUpperCase(), ...result, cart };
51
- this.code = '';
52
- this.tlPromoApplied.emit(this.applied);
53
- }
54
- catch (err) {
55
- console.error('[tl-promo-code] Redeem failed:', err);
56
- this.error = isAuthError(err)
57
- ? 'Sign in to use this code'
58
- : errorMessage(err, 'That code could not be applied');
59
- this.tlError.emit({ message: this.error });
60
- }
61
- finally {
62
- this.applying = false;
63
- }
32
+ syncProps() {
33
+ this.element.setProps({ placeholder: this.placeholder, buttonLabel: this.buttonLabel });
34
+ }
35
+ /**
36
+ * This core has nothing to do on mount, and the harness calls `mount()`
37
+ * anyway: a harness never asks what a core's lifecycle means (TKT-197).
38
+ */
39
+ connectedCallback() {
40
+ this.syncProps();
41
+ this.unsubscribe ?? (this.unsubscribe = this.element.subscribe((view) => {
42
+ this.view = view;
43
+ }));
44
+ this.view = this.element.view;
45
+ this.teardown = this.element.mount();
46
+ }
47
+ disconnectedCallback() {
48
+ this.teardown?.();
49
+ this.teardown = undefined;
50
+ this.unsubscribe?.();
51
+ this.unsubscribe = undefined;
52
+ }
53
+ forward(event, detail) {
54
+ if (event === 'tlPromoApplied')
55
+ this.tlPromoApplied.emit(detail);
56
+ else if (event === 'tlError')
57
+ this.tlError.emit(detail);
64
58
  }
65
59
  render() {
66
- if (this.applied) {
67
- return (h("div", { class: "applied", role: "status" }, h("span", { class: "applied-text" }, h("svg", { class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": "true" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" })), "Code ", h("strong", { class: "code" }, this.applied.code), this.applied.alreadyHeld ? ' was already applied' : ' applied'), h("button", { type: "button", class: "link", onClick: this.reset }, "Use a different code")));
60
+ const { status, state, strings, derived } = this.view;
61
+ if (status === 'applied') {
62
+ return (h("div", { class: "applied", role: "status" }, h("span", { class: "applied-text" }, h("svg", { class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": "true" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M5 13l4 4L19 7" })), strings.codePrefix, h("strong", { class: "code" }, derived.appliedCode), derived.appliedSuffix), h("button", { type: "button", class: "link", onClick: this.reset }, strings.useDifferent)));
68
63
  }
69
- return (h("form", { class: "promo", onSubmit: this.handleSubmit }, h("div", { class: "field" }, 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 }), h("button", { type: "submit", class: "apply", disabled: this.applying }, this.applying ? 'Applying…' : this.buttonLabel)), this.error && (h("p", { class: "error", role: "alert" }, this.error))));
64
+ return (h("form", { class: "promo", onSubmit: this.handleSubmit }, h("div", { class: "field" }, h("input", { class: "input", type: "text", autocomplete: "off", autoCapitalize: "characters", spellcheck: false, "aria-label": this.placeholder, placeholder: this.placeholder, value: state.code, disabled: derived.disabled, onInput: this.handleInput }), h("button", { type: "submit", class: "apply", disabled: derived.disabled }, derived.actionLabel)), state.error && (h("p", { class: "error", role: "alert" }, state.error))));
70
65
  }
66
+ static get watchers() { return {
67
+ "placeholder": [{
68
+ "syncProps": 0
69
+ }],
70
+ "buttonLabel": [{
71
+ "syncProps": 0
72
+ }]
73
+ }; }
71
74
  };
72
75
  TlPromoCode.style = tlPromoCodeCss();
73
76
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, a as getElement } from './index-OoYV1faY.js';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-imfxp765.js';
2
2
  import { h as hasSDK, g as getSDK } from './sdk-connector-CqhvfyKV.js';
3
3
 
4
4
  const tlSeatMapCss = () => `:host{display:block;font-family:var(--tl-font-family)}.seat-map-container{position:relative;overflow:hidden;border-radius:var(--tl-radius-md);background:var(--tl-color-background)}.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);color:var(--tl-color-foreground);gap:1rem}.loading p{margin:0;font-size:0.875rem;color:var(--tl-color-muted-foreground)}.spinner{width:40px;height:40px;border:3px solid var(--tl-color-border);border-top-color:var(--tl-color-primary);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);color:var(--tl-color-error);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}`;
@@ -125,10 +125,10 @@ const TlSeatMap = class {
125
125
  // Render
126
126
  // -------------------------------------------------------------------------
127
127
  render() {
128
- return (h("div", { key: 'c9beadc1792d7825ac3f99e6abc8b181e28fd1b6', class: "seat-map-container", style: {
128
+ return (h("div", { key: '1c6a23b0aa021c58fa62c106a92a2e970ca7f6d1', class: "seat-map-container", style: {
129
129
  width: this.width,
130
130
  height: this.height,
131
- } }, this.isLoading && (h("div", { key: 'ad792ea35f433a268c81722ce4e7d0e34780d337', class: "loading" }, h("div", { key: 'dd3e0657b16c2f265f59fbaa2ac39c559c2093b7', class: "spinner" }), h("p", { key: '2714e3073d0e5cddc50d530aa1cf46a7f73ba96f' }, "Loading seat map..."))), this.error && (h("div", { key: '3de9d73ab89a1ee963e73b4192d5c93e9667f11b', class: "error" }, h("p", { key: '0fea5c828b5b212ffdb45c9c7702d241e2b79cc4', class: "error-title" }, "Error"), h("p", { key: 'f2c090b982bb1ee6fb7d347d8860b4ce4798a891', class: "error-message" }, this.error))), h("iframe", { key: '8023219fdd467ec736f9627190690a6f73df3bb3', ref: (el) => (this.iframeRef = el), src: this.getIframeSrc(), class: {
131
+ } }, this.isLoading && (h("div", { key: '4a09ddbdbd38eb68675bb320cf33fd3ead5974a4', class: "loading" }, h("div", { key: 'c622ba1f996427f0624cfda2c782abd49ec72e19', class: "spinner" }), h("p", { key: '802f42554fc238a1ddc0f8a0f6a6b0de89bdfb60' }, "Loading seat map..."))), this.error && (h("div", { key: 'dde73e2430bad68c0a67306c0aa2b44810007cc5', class: "error" }, h("p", { key: '392d51bbc47ab34eab5670aa7a2faf800dabe638', class: "error-title" }, "Error"), h("p", { key: 'fcf6810f767f34bf3490c1af21320d262bdb961b', class: "error-message" }, this.error))), h("iframe", { key: '2333206fa6eb4fe6cdcbb1d30864d56d54583e1f', ref: (el) => (this.iframeRef = el), src: this.getIframeSrc(), class: {
132
132
  'seat-map-iframe': true,
133
133
  hidden: this.isLoading || !!this.error,
134
134
  }, title: "Ticketlayer Seat Map", allow: "fullscreen" })));
@@ -0,0 +1,14 @@
1
+ const webQuery = {
2
+ get(name) {
3
+ if (typeof window === 'undefined' || !window.location?.search)
4
+ return null;
5
+ try {
6
+ return new URLSearchParams(window.location.search).get(name);
7
+ }
8
+ catch {
9
+ return null;
10
+ }
11
+ },
12
+ };
13
+
14
+ export { webQuery as w };
@@ -1 +1 @@
1
- export{g as getSDK,h as hasSDK,o as onSDKEvent,s as setSDK,w as whenSDK}from"./p-CqhvfyKV.js";export{tl_buy_tickets_wrapper as TlBuyTicketsWrapper}from"./tl-buy-tickets-wrapper.entry.esm.js";export{tl_checkout_wrapper as TlCheckoutWrapper}from"./tl-checkout-wrapper.entry.esm.js";import"./p-OoYV1faY.js";
1
+ export{g as getSDK,h as hasSDK,o as onSDKEvent,s as setSDK,w as whenSDK}from"./p-CqhvfyKV.js";export{tl_buy_tickets_wrapper as TlBuyTicketsWrapper}from"./tl-buy-tickets-wrapper.entry.esm.js";export{tl_checkout_wrapper as TlCheckoutWrapper}from"./tl-checkout-wrapper.entry.esm.js";import"./p-imfxp765.js";import"./p-BwChnHVC.js";
@@ -0,0 +1 @@
1
+ import{r as t,c as o,h as r}from"./p-imfxp765.js";import{w as e,g as i}from"./p-CqhvfyKV.js";import{c as a,d as s}from"./p-BwChnHVC.js";const n=class{constructor(r){t(this,r),this.tlCheckout=o(this,"tlCheckout"),this.tlItemRemoved=o(this,"tlItemRemoved"),this.tlCartUpdated=o(this,"tlCartUpdated"),this.tlError=o(this,"tlError"),this.showCheckoutButton=!0,this.checkoutLabel="Checkout",this.showRemoveButtons=!0,this.compact=!1,this.element=a(s,{client:()=>i(),clientReady:()=>e(),emit:(t,o)=>this.forward(t,o)}),this.view=this.element.view}syncProps(){this.element.setProps({showCheckoutButton:this.showCheckoutButton,checkoutLabel:this.checkoutLabel,showRemoveButtons:this.showRemoveButtons,compact:this.compact})}connectedCallback(){this.syncProps(),this.unsubscribe??(this.unsubscribe=this.element.subscribe((t=>{this.view=t}))),this.view=this.element.view,this.teardown=this.element.mount()}disconnectedCallback(){this.teardown?.(),this.teardown=void 0,this.unsubscribe?.(),this.unsubscribe=void 0}forward(t,o){"tlCheckout"===t?this.tlCheckout.emit(o):"tlItemRemoved"===t?this.tlItemRemoved.emit(o):"tlCartUpdated"===t?this.tlCartUpdated.emit(o):"tlError"===t&&this.tlError.emit(o)}renderSkeleton(){return r("div",{class:"skeleton-container"},r("div",{class:"skeleton-item"}),r("div",{class:"skeleton-item"}),r("div",{class:"skeleton-totals"}))}renderEmptyCart(){const t=this.view.strings;return r("div",{class:"empty-cart"},r("svg",{class:"empty-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},r("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"})),r("p",{class:"empty-title"},t.emptyTitle),r("p",{class:"empty-message"},t.emptyMessage))}renderCartItem(t){return r("div",{class:"cart-item "+(t.removing?"removing":""),key:t.id},r("div",{class:"item-info"},r("p",{class:"item-name"},t.name),t.showEvent&&r("p",{class:"item-event"},t.eventName),t.showDate&&r("p",{class:"item-date"},t.dateLabel),r("p",{class:"item-quantity"},t.quantityLabel)),r("div",{class:"item-actions"},r("p",{class:"item-price"},t.priceLabel),this.showRemoveButtons&&r("button",{class:"remove-btn",onClick:()=>this.element.actions.removeItem(t.id),disabled:t.removing,"aria-label":this.view.strings.removeItem},t.removing?r("span",{class:"spinner"}):r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},r("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})))))}render(){const{status:t,strings:o,derived:e}=this.view;return"loading"===t?this.renderSkeleton():"empty"===t?this.renderEmptyCart():r("div",{class:"cart "+(this.compact?"compact":"")},r("div",{class:"cart-items"},e.rows.map((t=>this.renderCartItem(t)))),r("div",{class:"cart-totals"},e.showSubtotalRow&&r("div",{class:"total-row subtotal"},r("span",null,o.subtotalRow),r("span",null,e.subtotalLabel)),e.showFeeRow&&r("div",{class:"total-row fees"},r("span",null,e.totals.feeLabel),r("span",null,e.feeAmountLabel)),e.showDiscountRow&&r("div",{class:"total-row discount"},r("span",null,o.discountRow),r("span",null,"-",e.discountLabel)),r("div",{class:"total-row total"},r("span",null,o.totalRow),r("span",null,e.totalLabel))),this.showCheckoutButton&&r("button",{class:"checkout-btn",onClick:()=>this.element.actions.checkout(),disabled:e.checkoutDisabled},this.checkoutLabel))}static get watchers(){return{showCheckoutButton:[{syncProps:0}],checkoutLabel:[{syncProps:0}],showRemoveButtons:[{syncProps:0}],compact:[{syncProps:0}]}}};n.style=":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}";export{n as tl_cart}