@ticketlayer/elements 0.3.3 → 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 (179) hide show
  1. package/README.md +3 -2
  2. package/dist/cjs/{index-BpfoKd9Q.js → index-DanPUX0s.js} +1 -1
  3. package/dist/cjs/index.cjs.js +2 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/ticket-selector-BYVL13k_.js +3623 -0
  6. package/dist/cjs/ticketlayer-elements.cjs.js +2 -2
  7. package/dist/cjs/tl-buy-modal.cjs.entry.js +4 -4
  8. package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +89 -71
  9. package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +62 -31
  10. package/dist/cjs/tl-cart-badge.cjs.entry.js +75 -62
  11. package/dist/cjs/tl-cart-drawer.cjs.entry.js +52 -24
  12. package/dist/cjs/tl-cart.cjs.entry.js +72 -98
  13. package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +52 -30
  14. package/dist/cjs/tl-event-card.cjs.entry.js +44 -105
  15. package/dist/cjs/tl-event-list.cjs.entry.js +73 -36
  16. package/dist/cjs/tl-login.cjs.entry.js +75 -141
  17. package/dist/cjs/tl-my-orders.cjs.entry.js +53 -92
  18. package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +205 -641
  19. package/dist/cjs/tl-order-confirmation.cjs.entry.js +72 -105
  20. package/dist/cjs/tl-order-tickets_2.cjs.entry.js +50 -76
  21. package/dist/cjs/tl-promo-code.cjs.entry.js +51 -47
  22. package/dist/cjs/tl-seat-map.cjs.entry.js +4 -4
  23. package/dist/cjs/web-query-Ce73jB4k.js +16 -0
  24. package/dist/collection/components/tl-buy-modal/tl-buy-modal.css +12 -19
  25. package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +2 -2
  26. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +41 -4
  27. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +105 -76
  28. package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.css +2 -2
  29. package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +73 -30
  30. package/dist/collection/components/tl-cart/tl-cart.css +52 -51
  31. package/dist/collection/components/tl-cart/tl-cart.js +82 -101
  32. package/dist/collection/components/tl-cart-badge/tl-cart-badge.css +11 -11
  33. package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +62 -62
  34. package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.css +6 -6
  35. package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +56 -24
  36. package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.css +2 -2
  37. package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +61 -29
  38. package/dist/collection/components/tl-event-card/event-card-adapter.js +11 -23
  39. package/dist/collection/components/tl-event-card/tl-event-card.css +22 -22
  40. package/dist/collection/components/tl-event-card/tl-event-card.js +51 -84
  41. package/dist/collection/components/tl-event-list/tl-event-list.css +17 -17
  42. package/dist/collection/components/tl-event-list/tl-event-list.js +82 -38
  43. package/dist/collection/components/tl-login/tl-login.css +26 -26
  44. package/dist/collection/components/tl-login/tl-login.js +83 -147
  45. package/dist/collection/components/tl-my-orders/tl-my-orders.css +40 -40
  46. package/dist/collection/components/tl-my-orders/tl-my-orders.js +58 -96
  47. package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.css +54 -65
  48. package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +137 -516
  49. package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.css +38 -38
  50. package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +81 -113
  51. package/dist/collection/components/tl-order-tickets/tl-order-tickets.css +9 -9
  52. package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +57 -92
  53. package/dist/collection/components/tl-promo-code/tl-promo-code.css +25 -25
  54. package/dist/collection/components/tl-promo-code/tl-promo-code.js +55 -50
  55. package/dist/collection/components/tl-seat-map/tl-seat-map.css +10 -10
  56. package/dist/collection/components/tl-seat-map/tl-seat-map.js +2 -2
  57. package/dist/collection/components/tl-ticket/tl-ticket.css +13 -13
  58. package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.css +74 -49
  59. package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +95 -135
  60. package/dist/collection/utils/cart-totals.js +9 -0
  61. package/dist/collection/utils/order-summary.js +15 -99
  62. package/dist/collection/utils/testing/deep-text.js +29 -0
  63. package/dist/collection/utils/testing/fixtures.js +290 -0
  64. package/dist/collection/utils/testing/mock-sdk.js +13 -2
  65. package/dist/collection/utils/web-query.js +12 -0
  66. package/dist/collection/utils/web-storage.js +22 -0
  67. package/dist/components/ticket-selector.js +1 -0
  68. package/dist/components/tl-buy-modal.js +1 -1
  69. package/dist/components/tl-buy-tickets-button.js +1 -1
  70. package/dist/components/tl-buy-tickets-wrapper2.js +1 -1
  71. package/dist/components/tl-cart-badge.js +1 -1
  72. package/dist/components/tl-cart-drawer.js +1 -1
  73. package/dist/components/tl-cart2.js +1 -1
  74. package/dist/components/tl-checkout-wrapper2.js +1 -1
  75. package/dist/components/tl-event-card2.js +1 -1
  76. package/dist/components/tl-event-list.js +1 -1
  77. package/dist/components/tl-login2.js +1 -1
  78. package/dist/components/tl-my-orders.js +1 -1
  79. package/dist/components/tl-occurrence-selector2.js +1 -1
  80. package/dist/components/tl-order-confirmation.js +1 -1
  81. package/dist/components/tl-order-tickets2.js +1 -1
  82. package/dist/components/tl-promo-code.js +1 -1
  83. package/dist/components/tl-seat-map.js +1 -1
  84. package/dist/components/tl-ticket-selector2.js +1 -1
  85. package/dist/components/tl-ticket2.js +1 -1
  86. package/dist/components/web-query.js +1 -0
  87. package/dist/elements.docs.json +36 -36
  88. package/dist/esm/{index-CNX8hZa8.js → index-imfxp765.js} +1 -1
  89. package/dist/esm/index.js +2 -1
  90. package/dist/esm/loader.js +3 -3
  91. package/dist/esm/ticket-selector-BwChnHVC.js +3606 -0
  92. package/dist/esm/ticketlayer-elements.js +3 -3
  93. package/dist/esm/tl-buy-modal.entry.js +4 -4
  94. package/dist/esm/tl-buy-tickets-button.entry.js +90 -72
  95. package/dist/esm/tl-buy-tickets-wrapper.entry.js +63 -32
  96. package/dist/esm/tl-cart-badge.entry.js +76 -63
  97. package/dist/esm/tl-cart-drawer.entry.js +53 -25
  98. package/dist/esm/tl-cart.entry.js +73 -99
  99. package/dist/esm/tl-checkout-wrapper.entry.js +53 -31
  100. package/dist/esm/tl-event-card.entry.js +45 -106
  101. package/dist/esm/tl-event-list.entry.js +74 -37
  102. package/dist/esm/tl-login.entry.js +76 -142
  103. package/dist/esm/tl-my-orders.entry.js +54 -93
  104. package/dist/esm/tl-occurrence-selector_2.entry.js +206 -642
  105. package/dist/esm/tl-order-confirmation.entry.js +73 -106
  106. package/dist/esm/tl-order-tickets_2.entry.js +51 -77
  107. package/dist/esm/tl-promo-code.entry.js +52 -48
  108. package/dist/esm/tl-seat-map.entry.js +4 -4
  109. package/dist/esm/web-query-Bdbb2lk5.js +14 -0
  110. package/dist/ticketlayer-elements/index.esm.js +1 -1
  111. package/dist/ticketlayer-elements/p-45923d2c.entry.js +1 -0
  112. package/dist/ticketlayer-elements/p-492adc77.entry.js +1 -0
  113. package/dist/ticketlayer-elements/p-4cfc9e53.entry.js +1 -0
  114. package/dist/ticketlayer-elements/p-5135630e.entry.js +1 -0
  115. package/dist/ticketlayer-elements/p-5bbce3b5.entry.js +1 -0
  116. package/dist/ticketlayer-elements/p-7d547721.entry.js +1 -0
  117. package/dist/ticketlayer-elements/p-7fe7b6ba.entry.js +1 -0
  118. package/dist/ticketlayer-elements/p-8122f0c1.entry.js +1 -0
  119. package/dist/ticketlayer-elements/p-98d40869.entry.js +1 -0
  120. package/dist/ticketlayer-elements/p-Bdbb2lk5.js +1 -0
  121. package/dist/ticketlayer-elements/p-BwChnHVC.js +1 -0
  122. package/dist/ticketlayer-elements/p-abec290a.entry.js +1 -0
  123. package/dist/ticketlayer-elements/p-ac79a3f6.entry.js +1 -0
  124. package/dist/ticketlayer-elements/p-d01f4429.entry.js +1 -0
  125. package/dist/ticketlayer-elements/p-d7ffaf46.entry.js +1 -0
  126. package/dist/ticketlayer-elements/p-e7170f3c.entry.js +1 -0
  127. package/dist/ticketlayer-elements/p-e787e862.entry.js +1 -0
  128. package/dist/ticketlayer-elements/p-f1ff931f.entry.js +1 -0
  129. package/dist/ticketlayer-elements/p-imfxp765.js +3 -0
  130. package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -1
  131. package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -1
  132. package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +40 -8
  133. package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +20 -1
  134. package/dist/types/components/tl-cart/tl-cart.d.ts +40 -32
  135. package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +22 -7
  136. package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +28 -5
  137. package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +18 -1
  138. package/dist/types/components/tl-event-card/event-card-adapter.d.ts +9 -20
  139. package/dist/types/components/tl-event-card/tl-event-card.d.ts +25 -28
  140. package/dist/types/components/tl-event-list/tl-event-list.d.ts +46 -6
  141. package/dist/types/components/tl-login/tl-login.d.ts +68 -22
  142. package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +30 -12
  143. package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +73 -161
  144. package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +48 -15
  145. package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +29 -31
  146. package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +28 -10
  147. package/dist/types/components/tl-ticket/tl-ticket.d.ts +2 -11
  148. package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +61 -32
  149. package/dist/types/components.d.ts +302 -62
  150. package/dist/types/utils/cart-totals.d.ts +10 -0
  151. package/dist/types/utils/order-summary.d.ts +16 -65
  152. package/dist/types/utils/testing/deep-text.d.ts +13 -0
  153. package/dist/types/utils/testing/fixtures.d.ts +225 -0
  154. package/dist/types/utils/testing/mock-sdk.d.ts +14 -1
  155. package/dist/types/utils/web-query.d.ts +18 -0
  156. package/dist/types/utils/web-storage.d.ts +16 -0
  157. package/elements.catalogue.json +676 -55
  158. package/package.json +14 -6
  159. package/dist/cjs/order-summary-ZMkJ5bez.js +0 -116
  160. package/dist/components/order-summary.js +0 -1
  161. package/dist/esm/order-summary-BGekdjN9.js +0 -103
  162. package/dist/ticketlayer-elements/p-0b1d16f8.entry.js +0 -1
  163. package/dist/ticketlayer-elements/p-1471f6d8.entry.js +0 -1
  164. package/dist/ticketlayer-elements/p-1c51cbc1.entry.js +0 -1
  165. package/dist/ticketlayer-elements/p-5169f68b.entry.js +0 -1
  166. package/dist/ticketlayer-elements/p-895ba1f3.entry.js +0 -1
  167. package/dist/ticketlayer-elements/p-8d5722e1.entry.js +0 -1
  168. package/dist/ticketlayer-elements/p-917d8e09.entry.js +0 -1
  169. package/dist/ticketlayer-elements/p-9629029a.entry.js +0 -1
  170. package/dist/ticketlayer-elements/p-BGekdjN9.js +0 -1
  171. package/dist/ticketlayer-elements/p-CNX8hZa8.js +0 -3
  172. package/dist/ticketlayer-elements/p-a22714d0.entry.js +0 -1
  173. package/dist/ticketlayer-elements/p-bf73044b.entry.js +0 -1
  174. package/dist/ticketlayer-elements/p-e02079fa.entry.js +0 -1
  175. package/dist/ticketlayer-elements/p-e04ace15.entry.js +0 -1
  176. package/dist/ticketlayer-elements/p-e6fab1d5.entry.js +0 -1
  177. package/dist/ticketlayer-elements/p-f826b753.entry.js +0 -1
  178. package/dist/ticketlayer-elements/p-fa639d88.entry.js +0 -1
  179. package/dist/ticketlayer-elements/p-fbaca948.entry.js +0 -1
@@ -1,9 +1,6 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { type PresaleRedemption } from '../../utils/sdk-connector';
3
- export interface TlPromoApplied extends PresaleRedemption {
4
- code: string;
5
- cart: unknown | null;
6
- }
2
+ import { type PromoCodeDerived, type PromoCodeProps, type PromoCodeState, type PromoCodeStatus, type TlPromoApplied as CoreTlPromoApplied } from '@ticketlayer/elements-core';
3
+ export type TlPromoApplied = CoreTlPromoApplied;
7
4
  /**
8
5
  * tl-promo-code - an input plus Apply button that redeems a presale or promo
9
6
  * code for the current cart (POST /sales/presale-codes/redeem through the
@@ -13,6 +10,9 @@ export interface TlPromoApplied extends PresaleRedemption {
13
10
  * The API has no un-redeem, so the applied state offers only "use a different
14
11
  * code", which clears the input for another redemption.
15
12
  *
13
+ * The web harness for `promoCodeCore`: the redemption, the two error messages
14
+ * and every string are the core's (AGENTS.md, TKT-11).
15
+ *
16
16
  * Usage: <tl-promo-code></tl-promo-code>
17
17
  *
18
18
  * @event tlPromoApplied - a code was redeemed ({ code, benefit, alreadyHeld, cart })
@@ -23,17 +23,35 @@ export declare class TlPromoCode {
23
23
  placeholder: string;
24
24
  /** Apply button label. */
25
25
  buttonLabel: string;
26
- code: string;
27
- applying: boolean;
28
- applied: TlPromoApplied | null;
29
- error: string | null;
30
26
  tlPromoApplied: EventEmitter<TlPromoApplied>;
31
27
  tlError: EventEmitter<{
32
28
  message: string;
33
29
  }>;
30
+ private element;
31
+ private unsubscribe?;
32
+ private teardown?;
33
+ /** The core's whole view. Assigning it is what makes Stencil re-render. */
34
+ view: import("@ticketlayer/elements-core").ElementView<PromoCodeProps, PromoCodeState, PromoCodeDerived, PromoCodeStatus, {
35
+ applying: string;
36
+ codePrefix: string;
37
+ appliedSuffix: string;
38
+ alreadyHeldSuffix: string;
39
+ useDifferent: string;
40
+ enterCode: string;
41
+ notAvailable: string;
42
+ signIn: string;
43
+ rejected: string;
44
+ }>;
45
+ syncProps(): void;
46
+ /**
47
+ * This core has nothing to do on mount, and the harness calls `mount()`
48
+ * anyway: a harness never asks what a core's lifecycle means (TKT-197).
49
+ */
50
+ connectedCallback(): void;
51
+ disconnectedCallback(): void;
52
+ private forward;
34
53
  private handleInput;
35
54
  private handleSubmit;
36
- private apply;
37
55
  private reset;
38
56
  render(): any;
39
57
  }
@@ -1,14 +1,5 @@
1
- export interface TlTicketData {
2
- id: string;
3
- barcode: string;
4
- type: string;
5
- status: string;
6
- holderName: string | null;
7
- name: string;
8
- admissionStatus: string;
9
- eventOccurrenceId: string | null;
10
- seatLabel: string | null;
11
- }
1
+ import type { TlTicketData as CoreTlTicketData } from '@ticketlayer/elements-core';
2
+ export type TlTicketData = CoreTlTicketData;
12
3
  /**
13
4
  * tl-ticket - a single event ticket: a scannable QR (the redemption token),
14
5
  * ticket name / seat / holder, and a PDF download. Greys out + stamps
@@ -1,21 +1,16 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- export interface TlTicketType {
3
- id: string;
4
- occurrenceId: string;
5
- name: string;
6
- description?: string;
7
- price: number;
8
- currency: string;
9
- availableQuantity: number;
10
- maxPerOrder: number;
11
- minPerOrder: number;
12
- availabilityStatus: 'available' | 'limited' | 'sold_out';
13
- sortOrder: number;
14
- }
15
- export interface AddToCartItem {
16
- ticketTypeId: string;
17
- quantity: number;
18
- }
2
+ import { type AddToCartItem as CoreAddToCartItem, type TicketSelectorDerived, type TicketSelectorProps, type TicketSelectorState, type TicketSelectorStatus, type TlFeeQuote, type TlTicketType as CoreTlTicketType } from '@ticketlayer/elements-core';
3
+ export type AddToCartItem = CoreAddToCartItem;
4
+ export type TlTicketType = CoreTlTicketType;
5
+ /**
6
+ * The web harness for `ticketSelectorCore`.
7
+ *
8
+ * It renders and it forwards: every decision, every string and every sum is in
9
+ * `@ticketlayer/elements-core` (AGENTS.md, TKT-11). What is left here is the
10
+ * Stencil surface a host writes HTML against - the tag, the attributes, the
11
+ * three `tl*` events - plus the one thing that is genuinely web: finding the
12
+ * client the page published on `window.Ticketlayer`.
13
+ */
19
14
  export declare class TlTicketSelector {
20
15
  /**
21
16
  * Event ID
@@ -33,12 +28,6 @@ export declare class TlTicketSelector {
33
28
  * Button label
34
29
  */
35
30
  buttonLabel: string;
36
- ticketTypes: TlTicketType[];
37
- quantities: Record<string, number>;
38
- loading: boolean;
39
- error: string | null;
40
- adding: boolean;
41
- addSuccess: boolean;
42
31
  /**
43
32
  * Emitted when items are added to cart
44
33
  */
@@ -59,18 +48,58 @@ export declare class TlTicketSelector {
59
48
  tlError: EventEmitter<{
60
49
  message: string;
61
50
  }>;
51
+ private element;
52
+ private unsubscribe?;
53
+ private teardown?;
54
+ /** The core's whole view. Assigning it is what makes Stencil re-render. */
55
+ view: import("@ticketlayer/elements-core").ElementView<TicketSelectorProps, TicketSelectorState, TicketSelectorDerived, TicketSelectorStatus, {
56
+ selectTickets: string;
57
+ adding: string;
58
+ added: string;
59
+ limited: string;
60
+ soldOut: string;
61
+ ticketsRow: string;
62
+ totalRow: string;
63
+ decrease: string;
64
+ increase: string;
65
+ loadFailed: string;
66
+ addFailed: string;
67
+ noClient: string;
68
+ }>;
69
+ /**
70
+ * The fee the surface has quoted for this selection. Core state, exposed here
71
+ * because it is set from outside the element and not from an attribute: there
72
+ * is no quote operation on the buyer-facing surface yet, so it stays null and
73
+ * no fee row is rendered.
74
+ */
75
+ get feeQuote(): TlFeeQuote | null;
76
+ set feeQuote(quote: TlFeeQuote | null);
77
+ /**
78
+ * A new event or occurrence is a new subject: the element is torn down and
79
+ * mounted again, so whatever the core set up for the old one is undone
80
+ * before anything is set up for the new one.
81
+ */
62
82
  watchPropsChange(): void;
63
- componentWillLoad(): Promise<void>;
83
+ syncProps(): void;
84
+ /**
85
+ * On screen: render what the core says and put the core to work. What "to
86
+ * work" means is the core's own business - for this element, waiting for the
87
+ * client and reading the ticket types.
88
+ *
89
+ * `connectedCallback` and not `componentWillLoad` because this runs again
90
+ * when the element is moved in the DOM, and that is exactly when a mount and
91
+ * its teardown have to pair up.
92
+ */
93
+ connectedCallback(): void;
64
94
  /**
65
- * Wait for SDK to be ready, then load ticket types
95
+ * Off screen: run the mount's teardown, and nothing more. `destroy()` is
96
+ * terminal and Stencil calls this for a move as well as a removal, so
97
+ * destroying here would leave a re-inserted element frozen. The instance
98
+ * holds no listener and no subscription once these two have run.
66
99
  */
67
- private waitForSDKAndLoad;
68
- private loadTicketTypes;
69
- private handleQuantityChange;
70
- private calculateTotal;
71
- private getTotalItems;
72
- private handleAddToCart;
73
- private formatPrice;
100
+ disconnectedCallback(): void;
101
+ private remount;
102
+ private forward;
74
103
  private renderSkeleton;
75
104
  private renderError;
76
105
  private renderTicketRow;