@ticketlayer/elements 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -0
  3. package/dist/cjs/index-DfzcrE9-.js +3598 -0
  4. package/dist/cjs/index.cjs.js +16 -0
  5. package/dist/cjs/loader.cjs.js +12 -0
  6. package/dist/cjs/order-summary-ZMkJ5bez.js +116 -0
  7. package/dist/cjs/sdk-connector-ClDF3013.js +108 -0
  8. package/dist/cjs/ticketlayer-elements.cjs.js +24 -0
  9. package/dist/cjs/tl-buy-modal.cjs.entry.js +127 -0
  10. package/dist/cjs/tl-buy-tickets-button.cjs.entry.js +131 -0
  11. package/dist/cjs/tl-buy-tickets-wrapper.cjs.entry.js +58 -0
  12. package/dist/cjs/tl-cart-badge.cjs.entry.js +109 -0
  13. package/dist/cjs/tl-cart-drawer.cjs.entry.js +67 -0
  14. package/dist/cjs/tl-cart.cjs.entry.js +148 -0
  15. package/dist/cjs/tl-checkout-wrapper.cjs.entry.js +57 -0
  16. package/dist/cjs/tl-event-card.cjs.entry.js +140 -0
  17. package/dist/cjs/tl-event-list.cjs.entry.js +80 -0
  18. package/dist/cjs/tl-login.cjs.entry.js +184 -0
  19. package/dist/cjs/tl-my-orders.cjs.entry.js +123 -0
  20. package/dist/cjs/tl-occurrence-selector_2.cjs.entry.js +754 -0
  21. package/dist/cjs/tl-order-confirmation.cjs.entry.js +146 -0
  22. package/dist/cjs/tl-order-tickets_2.cjs.entry.js +3198 -0
  23. package/dist/cjs/tl-promo-code.cjs.entry.js +75 -0
  24. package/dist/cjs/tl-seat-map.cjs.entry.js +147 -0
  25. package/dist/collection/collection-manifest.json +29 -0
  26. package/dist/collection/components/tl-buy-modal/tl-buy-modal.css +264 -0
  27. package/dist/collection/components/tl-buy-modal/tl-buy-modal.js +249 -0
  28. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.css +120 -0
  29. package/dist/collection/components/tl-buy-tickets-button/tl-buy-tickets-button.js +412 -0
  30. package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.css +23 -0
  31. package/dist/collection/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.js +192 -0
  32. package/dist/collection/components/tl-cart/tl-cart.css +251 -0
  33. package/dist/collection/components/tl-cart/tl-cart.js +314 -0
  34. package/dist/collection/components/tl-cart-badge/tl-cart-badge.css +138 -0
  35. package/dist/collection/components/tl-cart-badge/tl-cart-badge.js +217 -0
  36. package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.css +98 -0
  37. package/dist/collection/components/tl-cart-drawer/tl-cart-drawer.js +185 -0
  38. package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.css +23 -0
  39. package/dist/collection/components/tl-checkout-wrapper/tl-checkout-wrapper.js +148 -0
  40. package/dist/collection/components/tl-event-card/event-card-adapter.js +23 -0
  41. package/dist/collection/components/tl-event-card/tl-event-card.css +175 -0
  42. package/dist/collection/components/tl-event-card/tl-event-card.js +205 -0
  43. package/dist/collection/components/tl-event-list/tl-event-list.css +134 -0
  44. package/dist/collection/components/tl-event-list/tl-event-list.js +171 -0
  45. package/dist/collection/components/tl-login/tl-login.css +133 -0
  46. package/dist/collection/components/tl-login/tl-login.js +309 -0
  47. package/dist/collection/components/tl-my-orders/tl-my-orders.css +204 -0
  48. package/dist/collection/components/tl-my-orders/tl-my-orders.js +221 -0
  49. package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.css +658 -0
  50. package/dist/collection/components/tl-occurrence-selector/tl-occurrence-selector.js +707 -0
  51. package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.css +176 -0
  52. package/dist/collection/components/tl-order-confirmation/tl-order-confirmation.js +298 -0
  53. package/dist/collection/components/tl-order-tickets/tl-order-tickets.css +30 -0
  54. package/dist/collection/components/tl-order-tickets/tl-order-tickets.js +122 -0
  55. package/dist/collection/components/tl-promo-code/tl-promo-code.css +106 -0
  56. package/dist/collection/components/tl-promo-code/tl-promo-code.js +181 -0
  57. package/dist/collection/components/tl-seat-map/tl-seat-map.css +85 -0
  58. package/dist/collection/components/tl-seat-map/tl-seat-map.js +366 -0
  59. package/dist/collection/components/tl-ticket/tl-ticket.css +90 -0
  60. package/dist/collection/components/tl-ticket/tl-ticket.js +129 -0
  61. package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.css +205 -0
  62. package/dist/collection/components/tl-ticket-selector/tl-ticket-selector.js +332 -0
  63. package/dist/collection/index.js +10 -0
  64. package/dist/collection/utils/order-summary.js +101 -0
  65. package/dist/collection/utils/sdk-connector.js +100 -0
  66. package/dist/collection/utils/testing/mock-sdk.js +95 -0
  67. package/dist/components/index.d.ts +35 -0
  68. package/dist/components/index.js +1 -0
  69. package/dist/components/order-summary.js +1 -0
  70. package/dist/components/sdk-connector.js +1 -0
  71. package/dist/components/tl-buy-modal.d.ts +11 -0
  72. package/dist/components/tl-buy-modal.js +1 -0
  73. package/dist/components/tl-buy-tickets-button.d.ts +11 -0
  74. package/dist/components/tl-buy-tickets-button.js +1 -0
  75. package/dist/components/tl-buy-tickets-wrapper.d.ts +11 -0
  76. package/dist/components/tl-buy-tickets-wrapper.js +1 -0
  77. package/dist/components/tl-buy-tickets-wrapper2.js +1 -0
  78. package/dist/components/tl-cart-badge.d.ts +11 -0
  79. package/dist/components/tl-cart-badge.js +1 -0
  80. package/dist/components/tl-cart-drawer.d.ts +11 -0
  81. package/dist/components/tl-cart-drawer.js +1 -0
  82. package/dist/components/tl-cart.d.ts +11 -0
  83. package/dist/components/tl-cart.js +1 -0
  84. package/dist/components/tl-cart2.js +1 -0
  85. package/dist/components/tl-checkout-wrapper.d.ts +11 -0
  86. package/dist/components/tl-checkout-wrapper.js +1 -0
  87. package/dist/components/tl-checkout-wrapper2.js +1 -0
  88. package/dist/components/tl-event-card.d.ts +11 -0
  89. package/dist/components/tl-event-card.js +1 -0
  90. package/dist/components/tl-event-card2.js +1 -0
  91. package/dist/components/tl-event-list.d.ts +11 -0
  92. package/dist/components/tl-event-list.js +1 -0
  93. package/dist/components/tl-login.d.ts +11 -0
  94. package/dist/components/tl-login.js +1 -0
  95. package/dist/components/tl-login2.js +1 -0
  96. package/dist/components/tl-my-orders.d.ts +11 -0
  97. package/dist/components/tl-my-orders.js +1 -0
  98. package/dist/components/tl-occurrence-selector.d.ts +11 -0
  99. package/dist/components/tl-occurrence-selector.js +1 -0
  100. package/dist/components/tl-occurrence-selector2.js +1 -0
  101. package/dist/components/tl-order-confirmation.d.ts +11 -0
  102. package/dist/components/tl-order-confirmation.js +1 -0
  103. package/dist/components/tl-order-tickets.d.ts +11 -0
  104. package/dist/components/tl-order-tickets.js +1 -0
  105. package/dist/components/tl-order-tickets2.js +1 -0
  106. package/dist/components/tl-promo-code.d.ts +11 -0
  107. package/dist/components/tl-promo-code.js +1 -0
  108. package/dist/components/tl-seat-map.d.ts +11 -0
  109. package/dist/components/tl-seat-map.js +1 -0
  110. package/dist/components/tl-ticket-selector.d.ts +11 -0
  111. package/dist/components/tl-ticket-selector.js +1 -0
  112. package/dist/components/tl-ticket-selector2.js +1 -0
  113. package/dist/components/tl-ticket.d.ts +11 -0
  114. package/dist/components/tl-ticket.js +1 -0
  115. package/dist/components/tl-ticket2.js +1 -0
  116. package/dist/elements.docs.d.ts +454 -0
  117. package/dist/elements.docs.json +3008 -0
  118. package/dist/esm/index-Ba-RZTFI.js +3588 -0
  119. package/dist/esm/index.js +4 -0
  120. package/dist/esm/loader.js +10 -0
  121. package/dist/esm/order-summary-BGekdjN9.js +103 -0
  122. package/dist/esm/sdk-connector-CqhvfyKV.js +102 -0
  123. package/dist/esm/ticketlayer-elements.js +20 -0
  124. package/dist/esm/tl-buy-modal.entry.js +125 -0
  125. package/dist/esm/tl-buy-tickets-button.entry.js +129 -0
  126. package/dist/esm/tl-buy-tickets-wrapper.entry.js +56 -0
  127. package/dist/esm/tl-cart-badge.entry.js +107 -0
  128. package/dist/esm/tl-cart-drawer.entry.js +65 -0
  129. package/dist/esm/tl-cart.entry.js +146 -0
  130. package/dist/esm/tl-checkout-wrapper.entry.js +55 -0
  131. package/dist/esm/tl-event-card.entry.js +138 -0
  132. package/dist/esm/tl-event-list.entry.js +78 -0
  133. package/dist/esm/tl-login.entry.js +182 -0
  134. package/dist/esm/tl-my-orders.entry.js +121 -0
  135. package/dist/esm/tl-occurrence-selector_2.entry.js +751 -0
  136. package/dist/esm/tl-order-confirmation.entry.js +144 -0
  137. package/dist/esm/tl-order-tickets_2.entry.js +3195 -0
  138. package/dist/esm/tl-promo-code.entry.js +73 -0
  139. package/dist/esm/tl-seat-map.entry.js +145 -0
  140. package/dist/index.cjs.js +1 -0
  141. package/dist/index.js +1 -0
  142. package/dist/ticketlayer-elements/index.esm.js +1 -0
  143. package/dist/ticketlayer-elements/p-0291df4c.entry.js +1 -0
  144. package/dist/ticketlayer-elements/p-10f01a1f.entry.js +1 -0
  145. package/dist/ticketlayer-elements/p-11273f8f.entry.js +1 -0
  146. package/dist/ticketlayer-elements/p-340ab4f5.entry.js +1 -0
  147. package/dist/ticketlayer-elements/p-41d22d7c.entry.js +1 -0
  148. package/dist/ticketlayer-elements/p-82752e3b.entry.js +1 -0
  149. package/dist/ticketlayer-elements/p-976770f3.entry.js +1 -0
  150. package/dist/ticketlayer-elements/p-9a903ff6.entry.js +1 -0
  151. package/dist/ticketlayer-elements/p-9c9072c8.entry.js +1 -0
  152. package/dist/ticketlayer-elements/p-9d8163d6.entry.js +1 -0
  153. package/dist/ticketlayer-elements/p-BGekdjN9.js +1 -0
  154. package/dist/ticketlayer-elements/p-Ba-RZTFI.js +2 -0
  155. package/dist/ticketlayer-elements/p-CqhvfyKV.js +1 -0
  156. package/dist/ticketlayer-elements/p-a5c90b68.entry.js +1 -0
  157. package/dist/ticketlayer-elements/p-b6d479ad.entry.js +1 -0
  158. package/dist/ticketlayer-elements/p-dd43f015.entry.js +1 -0
  159. package/dist/ticketlayer-elements/p-eb640760.entry.js +1 -0
  160. package/dist/ticketlayer-elements/p-ee3aa227.entry.js +1 -0
  161. package/dist/ticketlayer-elements/p-fb9444c4.entry.js +1 -0
  162. package/dist/ticketlayer-elements/ticketlayer-elements.css +1 -0
  163. package/dist/ticketlayer-elements/ticketlayer-elements.esm.js +1 -0
  164. package/dist/types/components/tl-buy-modal/tl-buy-modal.d.ts +54 -0
  165. package/dist/types/components/tl-buy-tickets-button/tl-buy-tickets-button.d.ts +61 -0
  166. package/dist/types/components/tl-buy-tickets-wrapper/tl-buy-tickets-wrapper.d.ts +52 -0
  167. package/dist/types/components/tl-cart/tl-cart.d.ts +80 -0
  168. package/dist/types/components/tl-cart-badge/tl-cart-badge.d.ts +36 -0
  169. package/dist/types/components/tl-cart-drawer/tl-cart-drawer.d.ts +35 -0
  170. package/dist/types/components/tl-checkout-wrapper/tl-checkout-wrapper.d.ts +39 -0
  171. package/dist/types/components/tl-event-card/event-card-adapter.d.ts +23 -0
  172. package/dist/types/components/tl-event-card/tl-event-card.d.ts +55 -0
  173. package/dist/types/components/tl-event-list/tl-event-list.d.ts +30 -0
  174. package/dist/types/components/tl-login/tl-login.d.ts +59 -0
  175. package/dist/types/components/tl-my-orders/tl-my-orders.d.ts +39 -0
  176. package/dist/types/components/tl-occurrence-selector/tl-occurrence-selector.d.ts +208 -0
  177. package/dist/types/components/tl-order-confirmation/tl-order-confirmation.d.ts +54 -0
  178. package/dist/types/components/tl-order-tickets/tl-order-tickets.d.ts +21 -0
  179. package/dist/types/components/tl-promo-code/tl-promo-code.d.ts +39 -0
  180. package/dist/types/components/tl-seat-map/tl-seat-map.d.ts +68 -0
  181. package/dist/types/components/tl-ticket/tl-ticket.d.ts +28 -0
  182. package/dist/types/components/tl-ticket-selector/tl-ticket-selector.d.ts +78 -0
  183. package/dist/types/components.d.ts +1629 -0
  184. package/dist/types/index.d.ts +14 -0
  185. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  186. package/dist/types/utils/order-summary.d.ts +67 -0
  187. package/dist/types/utils/sdk-connector.d.ts +113 -0
  188. package/dist/types/utils/testing/mock-sdk.d.ts +36 -0
  189. package/elements.catalogue.json +968 -0
  190. package/loader/cdn.js +1 -0
  191. package/loader/index.cjs.js +1 -0
  192. package/loader/index.d.ts +24 -0
  193. package/loader/index.es2017.js +1 -0
  194. package/loader/index.js +2 -0
  195. package/package.json +101 -0
@@ -0,0 +1,184 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DfzcrE9-.js');
4
+ var sdkConnector = require('./sdk-connector-ClDF3013.js');
5
+ var orderSummary = require('./order-summary-ZMkJ5bez.js');
6
+
7
+ const tlLoginCss = () => `:host{display:block;font-family:var(--tl-font-family, system-ui, sans-serif);color:var(--tl-foreground, #111827)}.login{display:flex;flex-direction:column;gap:var(--tl-spacing-3, 0.75rem);padding:var(--tl-spacing-6, 1.5rem);background:var(--tl-background, #ffffff);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-lg, 0.75rem)}.title{margin:0;font-size:1.25rem;font-weight:600}.lead{margin:0;font-size:0.875rem;color:var(--tl-muted-foreground, #6b7280)}.label{font-size:0.875rem;font-weight:500}.input{padding:var(--tl-spacing-3, 0.75rem);font:inherit;font-size:0.9375rem;color:var(--tl-foreground, #111827);background:var(--tl-background, #ffffff);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-md, 0.5rem)}.input:focus{outline:2px solid var(--tl-primary, #6366f1);outline-offset:1px}.code-input{font-family:var(--tl-font-family-mono, ui-monospace, monospace);font-size:1.25rem;letter-spacing:0.25em;text-align:center}.primary,.secondary{padding:var(--tl-spacing-3, 0.75rem) var(--tl-spacing-4, 1rem);font:inherit;font-size:0.9375rem;font-weight:600;border-radius:var(--tl-radius-md, 0.5rem);cursor:pointer}.primary{color:var(--tl-primary-foreground, #ffffff);background:var(--tl-primary, #6366f1);border:none}.primary:hover:not(:disabled){opacity:0.9}.secondary{color:var(--tl-foreground, #111827);background:var(--tl-secondary, #f3f4f6);border:1px solid var(--tl-border, #e5e7eb)}.primary:disabled,.secondary:disabled,.input:disabled{opacity:0.6;cursor:not-allowed}.link{padding:0;font:inherit;font-size:0.875rem;color:var(--tl-primary, #6366f1);background:none;border:none;cursor:pointer}.link:hover{text-decoration:underline}.actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--tl-spacing-4, 1rem)}.error{margin:0;font-size:0.8125rem;color:var(--tl-error, #ef4444)}.notice{margin:0;font-size:0.8125rem;color:var(--tl-success, #10b981)}.signed-in{flex-direction:row;align-items:center;justify-content:space-between;flex-wrap:wrap}.signed-in-text{margin:0;font-size:0.875rem;overflow-wrap:anywhere}`;
8
+
9
+ const TlLogin = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.tlAuthChanged = index.createEvent(this, "tlAuthChanged");
13
+ this.tlMagicLinkSent = index.createEvent(this, "tlMagicLinkSent");
14
+ this.tlError = index.createEvent(this, "tlError");
15
+ /** Heading for the email step. */
16
+ this.heading = 'Sign in';
17
+ /** Offer a "enter the code" path alongside the emailed link (default true). */
18
+ this.allowCodeEntry = true;
19
+ this.phase = 'email';
20
+ this.email = '';
21
+ this.code = '';
22
+ this.busy = false;
23
+ this.error = null;
24
+ this.notice = null;
25
+ this.customer = null;
26
+ this.auth = null;
27
+ this.unsubscribes = [];
28
+ // A magic-link code is single-use; never exchange the URL code twice.
29
+ this.urlCodeUsed = false;
30
+ this.handleEmailInput = (e) => {
31
+ this.email = e.target.value;
32
+ this.error = null;
33
+ };
34
+ this.handleCodeInput = (e) => {
35
+ this.code = e.target.value;
36
+ this.error = null;
37
+ };
38
+ this.handleEmailSubmit = (e) => {
39
+ e.preventDefault();
40
+ this.requestLink();
41
+ };
42
+ this.handleCodeSubmit = (e) => {
43
+ e.preventDefault();
44
+ this.exchange(this.code.trim());
45
+ };
46
+ }
47
+ async componentWillLoad() {
48
+ const sdk = await sdkConnector.whenSDK().catch(() => null);
49
+ if (!sdk) {
50
+ this.error = 'Sign-in is not available right now';
51
+ return;
52
+ }
53
+ this.auth = sdk.getAuthManager?.() ?? null;
54
+ if (!this.auth) {
55
+ this.error = 'Sign-in is not available with this SDK';
56
+ return;
57
+ }
58
+ this.syncFromSDK();
59
+ // The session hydrates after the SDK publishes; follow both signals.
60
+ this.unsubscribes.push(sdk.on('auth:changed', () => this.syncFromSDK()));
61
+ this.unsubscribes.push(sdk.on('session:changed', () => this.syncFromSDK()));
62
+ const urlCode = this.codeFromUrl();
63
+ if (urlCode && !this.auth.authenticated) {
64
+ await this.exchange(urlCode);
65
+ }
66
+ }
67
+ disconnectedCallback() {
68
+ this.unsubscribes.forEach((off) => off());
69
+ this.unsubscribes = [];
70
+ }
71
+ codeFromUrl() {
72
+ if (typeof window === 'undefined' || !window.location?.search || this.urlCodeUsed)
73
+ return null;
74
+ const code = new URLSearchParams(window.location.search).get('code');
75
+ if (code)
76
+ this.urlCodeUsed = true;
77
+ return code;
78
+ }
79
+ syncFromSDK() {
80
+ if (!this.auth)
81
+ return;
82
+ if (this.auth.authenticated) {
83
+ this.customer = this.auth.customer ?? null;
84
+ this.phase = 'signed-in';
85
+ }
86
+ else if (this.phase === 'signed-in') {
87
+ this.customer = null;
88
+ this.phase = 'email';
89
+ }
90
+ }
91
+ async requestLink(resend = false) {
92
+ const email = this.email.trim();
93
+ if (!email) {
94
+ this.error = 'Enter your email address';
95
+ return;
96
+ }
97
+ if (!this.auth)
98
+ return;
99
+ this.busy = true;
100
+ this.error = null;
101
+ this.notice = null;
102
+ try {
103
+ // Always reports success; account existence is never revealed.
104
+ await this.auth.requestMagicLink({ email });
105
+ this.phase = 'sent';
106
+ this.notice = resend ? 'Sent again. Check your inbox.' : null;
107
+ this.tlMagicLinkSent.emit({ email });
108
+ }
109
+ catch (err) {
110
+ console.error('[tl-login] Magic-link request failed:', err);
111
+ this.error = orderSummary.errorMessage(err, 'Could not send your sign-in link');
112
+ this.tlError.emit({ message: this.error });
113
+ }
114
+ finally {
115
+ this.busy = false;
116
+ }
117
+ }
118
+ async exchange(code) {
119
+ if (!code) {
120
+ this.error = 'Enter the code from your email';
121
+ return;
122
+ }
123
+ if (!this.auth)
124
+ return;
125
+ const previous = this.phase;
126
+ this.busy = true;
127
+ this.error = null;
128
+ this.phase = 'verifying';
129
+ try {
130
+ const res = (await this.auth.exchange(code));
131
+ this.customer = this.auth.customer ?? res?.customer ?? null;
132
+ this.phase = 'signed-in';
133
+ this.code = '';
134
+ this.tlAuthChanged.emit({ customer: this.customer, authenticated: true });
135
+ }
136
+ catch (err) {
137
+ console.error('[tl-login] Code exchange failed:', err);
138
+ this.phase = previous === 'verifying' || previous === 'email' ? 'email' : 'code';
139
+ this.error = 'That code did not work. Check it and try again, or request a new link.';
140
+ this.tlError.emit({ message: this.error });
141
+ }
142
+ finally {
143
+ this.busy = false;
144
+ }
145
+ }
146
+ async signOut() {
147
+ if (!this.auth)
148
+ return;
149
+ this.busy = true;
150
+ try {
151
+ await this.auth.logout();
152
+ }
153
+ catch (err) {
154
+ console.error('[tl-login] Sign out failed:', err);
155
+ }
156
+ finally {
157
+ this.busy = false;
158
+ this.customer = null;
159
+ this.phase = 'email';
160
+ this.tlAuthChanged.emit({ customer: null, authenticated: false });
161
+ }
162
+ }
163
+ renderError() {
164
+ return this.error ? (index.h("p", { class: "error", role: "alert" }, this.error)) : null;
165
+ }
166
+ render() {
167
+ if (this.phase === 'signed-in') {
168
+ return (index.h("div", { class: "login signed-in" }, index.h("p", { class: "signed-in-text" }, "Signed in as ", index.h("strong", null, this.customer?.email ?? 'your account')), index.h("button", { type: "button", class: "secondary", disabled: this.busy, onClick: () => this.signOut() }, "Sign out")));
169
+ }
170
+ if (this.phase === 'verifying') {
171
+ return (index.h("div", { class: "login" }, index.h("h2", { class: "title" }, "Signing you in\u2026"), index.h("p", { class: "lead" }, "Just a moment.")));
172
+ }
173
+ if (this.phase === 'sent') {
174
+ return (index.h("div", { class: "login" }, index.h("h2", { class: "title" }, "Check your inbox"), index.h("p", { class: "lead" }, "We've sent a sign-in link to ", index.h("strong", null, this.email), ". Open it on this device to continue."), this.notice && index.h("p", { class: "notice" }, this.notice), this.renderError(), index.h("div", { class: "actions" }, index.h("button", { type: "button", class: "secondary", disabled: this.busy, onClick: () => this.requestLink(true) }, this.busy ? 'Sending…' : 'Resend link'), this.allowCodeEntry && (index.h("button", { type: "button", class: "link", onClick: () => (this.phase = 'code') }, "Enter the code instead")), index.h("button", { type: "button", class: "link", onClick: () => (this.phase = 'email') }, "Use a different email"))));
175
+ }
176
+ if (this.phase === 'code') {
177
+ return (index.h("form", { class: "login", onSubmit: this.handleCodeSubmit }, index.h("h2", { class: "title" }, "Enter your code"), index.h("p", { class: "lead" }, "Type the 6-digit code from the email we sent to ", index.h("strong", null, this.email), "."), index.h("label", { class: "label", htmlFor: "tl-login-code" }, "Code"), index.h("input", { id: "tl-login-code", class: "input code-input", type: "text", inputmode: "numeric", autocomplete: "one-time-code", placeholder: "123456", value: this.code, disabled: this.busy, onInput: this.handleCodeInput }), this.renderError(), index.h("button", { type: "submit", class: "primary", disabled: this.busy }, this.busy ? 'Checking…' : 'Sign in'), index.h("div", { class: "actions" }, index.h("button", { type: "button", class: "link", onClick: () => this.requestLink(true) }, "Resend link"), index.h("button", { type: "button", class: "link", onClick: () => (this.phase = 'sent') }, "Back"))));
178
+ }
179
+ return (index.h("form", { class: "login", onSubmit: this.handleEmailSubmit }, index.h("h2", { class: "title" }, this.heading), index.h("p", { class: "lead" }, "Enter your email and we'll send you a secure sign-in link. No password needed."), index.h("label", { class: "label", htmlFor: "tl-login-email" }, "Email address"), index.h("input", { id: "tl-login-email", class: "input", type: "email", autocomplete: "email", placeholder: "you@example.com", required: true, value: this.email, disabled: this.busy || !this.auth, onInput: this.handleEmailInput }), this.renderError(), index.h("button", { type: "submit", class: "primary", disabled: this.busy || !this.auth }, this.busy ? 'Sending link…' : 'Email me a sign-in link')));
180
+ }
181
+ };
182
+ TlLogin.style = tlLoginCss();
183
+
184
+ exports.tl_login = TlLogin;
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DfzcrE9-.js');
4
+ var sdkConnector = require('./sdk-connector-ClDF3013.js');
5
+ var orderSummary = require('./order-summary-ZMkJ5bez.js');
6
+
7
+ const tlMyOrdersCss = () => `:host{display:block;font-family:var(--tl-font-family, system-ui, sans-serif);color:var(--tl-foreground, #111827)}.orders{display:flex;flex-direction:column;gap:var(--tl-spacing-4, 1rem)}.order-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--tl-spacing-3, 0.75rem)}.order{background:var(--tl-background, #ffffff);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-lg, 0.75rem);overflow:hidden;transition:border-color 0.2s ease, box-shadow 0.2s ease}.order:hover,.order.expanded{border-color:var(--tl-primary, #6366f1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.order-row{display:flex;align-items:center;justify-content:space-between;gap:var(--tl-spacing-4, 1rem);width:100%;padding:var(--tl-spacing-4, 1rem);font:inherit;color:inherit;text-align:left;background:none;border:none;cursor:pointer}.order-main{display:flex;flex-direction:column;gap:var(--tl-spacing-1, 0.25rem);min-width:0}.order-number{font-size:0.75rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em;color:var(--tl-muted-foreground, #6b7280)}.order-event{font-size:1rem;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.order-meta{display:flex;flex-wrap:wrap;gap:var(--tl-spacing-3, 0.75rem);font-size:0.8125rem;color:var(--tl-muted-foreground, #6b7280)}.order-side{display:flex;align-items:center;gap:var(--tl-spacing-3, 0.75rem);flex-shrink:0}.order-total{font-weight:600}.status{padding:0.125rem 0.5rem;font-size:0.75rem;font-weight:500;border-radius:9999px;background:var(--tl-secondary, #f3f4f6);color:var(--tl-secondary-foreground, #111827)}.status-success{background:var(--tl-success, #10b981);color:var(--tl-success-foreground, #ffffff)}.status-info{background:var(--tl-primary, #6366f1);color:var(--tl-primary-foreground, #ffffff)}.status-warning{background:var(--tl-warning, #f59e0b);color:var(--tl-warning-foreground, #ffffff)}.status-error{background:var(--tl-error, #ef4444);color:var(--tl-error-foreground, #ffffff)}.chevron{width:1.125rem;height:1.125rem;color:var(--tl-muted-foreground, #6b7280);transition:transform 0.2s ease}.expanded .chevron{transform:rotate(90deg)}.order-tickets{padding:0 var(--tl-spacing-4, 1rem) var(--tl-spacing-4, 1rem);border-top:1px solid var(--tl-border, #e5e7eb);padding-top:var(--tl-spacing-4, 1rem)}@media (max-width: 480px){.order-row{flex-direction:column;align-items:stretch}.order-side{justify-content:space-between}}.signin{text-align:center}.signin-title,.state-title{margin:0;font-size:1.125rem;font-weight:600}.signin-text,.state-text{margin:var(--tl-spacing-1, 0.25rem) 0 0;font-size:0.875rem;color:var(--tl-muted-foreground, #6b7280)}.state{padding:var(--tl-spacing-8, 2rem) var(--tl-spacing-4, 1rem);text-align:center;background:var(--tl-background, #ffffff);border:1px solid var(--tl-border, #e5e7eb);border-radius:var(--tl-radius-lg, 0.75rem)}.state.error .state-title{color:var(--tl-error, #ef4444)}.empty-icon{width:3rem;height:3rem;margin:0 auto var(--tl-spacing-3, 0.75rem);color:var(--tl-primary, #6366f1)}.skeleton{height:5rem;background:var(--tl-secondary, #f3f4f6);border-radius:var(--tl-radius-lg, 0.75rem);animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.5}}`;
8
+
9
+ const TlMyOrders = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.tlOrderSelect = index.createEvent(this, "tlOrderSelect");
13
+ this.tlError = index.createEvent(this, "tlError");
14
+ /** Copy for the empty state. */
15
+ this.emptyMessage = "When you buy tickets they'll show up here, ready to view and download.";
16
+ /** Columns for the expanded ticket grid. */
17
+ this.columns = 2;
18
+ this.orders = [];
19
+ this.authenticated = false;
20
+ this.loading = true;
21
+ this.error = null;
22
+ this.expandedId = null;
23
+ this.sdk = null;
24
+ this.unsubscribes = [];
25
+ }
26
+ async componentWillLoad() {
27
+ this.sdk = await sdkConnector.whenSDK().catch(() => null);
28
+ if (!this.sdk) {
29
+ this.loading = false;
30
+ this.error = 'Orders are not available right now';
31
+ return;
32
+ }
33
+ // Older SDKs have no auth accessor: try the list and let a 401 decide.
34
+ const auth = this.sdk.getAuthManager?.();
35
+ this.authenticated = auth ? auth.authenticated : true;
36
+ // The session hydrates after the SDK publishes; follow both signals.
37
+ this.unsubscribes.push(this.sdk.on('auth:changed', () => this.syncAuth()));
38
+ this.unsubscribes.push(this.sdk.on('session:changed', () => this.syncAuth()));
39
+ if (this.authenticated) {
40
+ await this.load();
41
+ }
42
+ else {
43
+ this.loading = false;
44
+ }
45
+ }
46
+ disconnectedCallback() {
47
+ this.unsubscribes.forEach((off) => off());
48
+ this.unsubscribes = [];
49
+ }
50
+ syncAuth() {
51
+ const auth = this.sdk?.getAuthManager?.();
52
+ if (!auth)
53
+ return;
54
+ const was = this.authenticated;
55
+ this.authenticated = auth.authenticated;
56
+ if (this.authenticated && !was) {
57
+ this.load();
58
+ }
59
+ else if (!this.authenticated && was) {
60
+ this.orders = [];
61
+ this.expandedId = null;
62
+ }
63
+ }
64
+ async load() {
65
+ if (!this.sdk)
66
+ return;
67
+ try {
68
+ this.loading = true;
69
+ this.error = null;
70
+ const orders = this.sdk.getOrdersManager?.();
71
+ if (!orders)
72
+ throw new Error('Orders are not available');
73
+ const list = (await orders.mine());
74
+ this.orders = list ?? [];
75
+ this.authenticated = true;
76
+ }
77
+ catch (err) {
78
+ if (orderSummary.isAuthError(err)) {
79
+ // Not signed in: fall through to the inline login rather than an error.
80
+ this.authenticated = false;
81
+ this.orders = [];
82
+ }
83
+ else {
84
+ console.error('[tl-my-orders] Failed to load orders:', err);
85
+ this.error = orderSummary.errorMessage(err, 'Failed to load your orders');
86
+ this.tlError.emit({ message: this.error });
87
+ }
88
+ }
89
+ finally {
90
+ this.loading = false;
91
+ }
92
+ }
93
+ toggle(orderId) {
94
+ const opening = this.expandedId !== orderId;
95
+ this.expandedId = opening ? orderId : null;
96
+ if (opening)
97
+ this.tlOrderSelect.emit({ orderId });
98
+ }
99
+ renderRow(order) {
100
+ const expanded = this.expandedId === order.id;
101
+ const count = orderSummary.ticketCount(order);
102
+ const tone = orderSummary.statusTone(order.status);
103
+ return (index.h("li", { class: { order: true, expanded }, key: order.id }, index.h("button", { type: "button", class: "order-row", "aria-expanded": expanded ? 'true' : 'false', onClick: () => this.toggle(order.id) }, index.h("span", { class: "order-main" }, index.h("span", { class: "order-number" }, "Order ", order.orderNumber), index.h("span", { class: "order-event" }, orderSummary.orderEventName(order) ?? 'Order'), index.h("span", { class: "order-meta" }, order.createdAt && index.h("span", null, orderSummary.formatDate(order.createdAt)), index.h("span", null, count, " ticket", count === 1 ? '' : 's'))), index.h("span", { class: "order-side" }, index.h("span", { class: "order-total" }, orderSummary.formatPrice(order.total, order.currency)), index.h("span", { class: `status status-${tone}` }, orderSummary.statusLabel(order.status)), index.h("svg", { class: "chevron", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": "true" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 18l6-6-6-6" })))), expanded && (index.h("div", { class: "order-tickets" }, index.h("tl-order-tickets", { orderId: order.id, columns: this.columns })))));
104
+ }
105
+ render() {
106
+ if (this.loading) {
107
+ return (index.h("div", { class: "orders" }, [0, 1, 2].map((i) => (index.h("div", { class: "skeleton", key: i })))));
108
+ }
109
+ if (!this.authenticated) {
110
+ return (index.h("div", { class: "orders" }, index.h("div", { class: "signin" }, index.h("p", { class: "signin-title" }, "Sign in to see your orders"), index.h("p", { class: "signin-text" }, "Your tickets and order history live in your account.")), index.h("tl-login", null)));
111
+ }
112
+ if (this.error) {
113
+ return (index.h("div", { class: "orders" }, index.h("div", { class: "state error" }, index.h("p", { class: "state-title" }, "Could not load your orders"), index.h("p", { class: "state-text" }, this.error))));
114
+ }
115
+ if (this.orders.length === 0) {
116
+ return (index.h("div", { class: "orders" }, index.h("div", { class: "state empty" }, index.h("svg", { class: "empty-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": "true" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1.5", d: "M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z" }), index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1.5", d: "M13 5v2M13 17v2M13 11v2" })), index.h("p", { class: "state-title" }, "No orders yet"), index.h("p", { class: "state-text" }, this.emptyMessage))));
117
+ }
118
+ return (index.h("div", { class: "orders" }, index.h("ul", { class: "order-list" }, this.orders.map((o) => this.renderRow(o)))));
119
+ }
120
+ };
121
+ TlMyOrders.style = tlMyOrdersCss();
122
+
123
+ exports.tl_my_orders = TlMyOrders;