@getmicdrop/venue-calendar 4.3.57 → 4.3.58

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 (114) hide show
  1. package/dist/AddOnCard-TEUXB3Sd.js +340 -0
  2. package/dist/{ArrowLeftIcon-DjqiKzR8.js → ArrowLeftIcon-C0jreEw8.js} +1 -1
  3. package/dist/{BlockPlaceholder-CgZr2Euq.js → BlockPlaceholder-DdoOD0gZ.js} +1 -1
  4. package/dist/{Calendar-CS_RqyU_.js → Calendar-BWLg7fOl.js} +3 -3
  5. package/dist/{CalendarFoundryView-DKZpskoX.js → CalendarFoundryView-apVO50Ap.js} +73 -75
  6. package/dist/{CalendarIcon-D9Z9YFz6.js → CalendarIcon-BOEpooZq.js} +1 -1
  7. package/dist/CartView-CTL1DQem.js +2293 -0
  8. package/dist/Checkout-B9OHWxzh.js +1933 -0
  9. package/dist/Checkout-D7Cgj12j.js +1076 -0
  10. package/dist/{CheckoutTimer-Ch4McYLj.js → CheckoutTimer-DPNmc1BX.js} +5 -5
  11. package/dist/{ChevronDownIcon-D9I-5bmz.js → ChevronDownIcon-Czxsi1W2.js} +1 -1
  12. package/dist/{CloseIcon-DPdjPdoi.js → CloseIcon-hLh5XXvh.js} +1 -1
  13. package/dist/{CollectionView-BBRXKR7L.js → CollectionView-LFCwHiPj.js} +13 -13
  14. package/dist/{Event-lTxMeEFL.js → Event-C63PLQhq.js} +431 -616
  15. package/dist/EventPage-CyDAwaQF.js +1200 -0
  16. package/dist/{Input-CDw-j5fQ.js → Input-dF1ZPavc.js} +1 -1
  17. package/dist/{MailIcon-C__hyCKr.js → MailIcon-T9SmOpQr.js} +1 -1
  18. package/dist/{PasswordInput-D3Pwparw.js → PasswordInput-B64o-TXR.js} +1 -1
  19. package/dist/{RecommendationsRail-BAdqxvuS.js → RecommendationsRail-Cb_c4ohM.js} +47 -47
  20. package/dist/ScarcityBadge-14VWzOL2.js +145 -0
  21. package/dist/{SeriesPage-iAbX0ZTM.js → SeriesPage-DeALgf5s.js} +3 -3
  22. package/dist/{Spinner-6QTo7mi8.js → Spinner-CW1KZMkc.js} +1 -1
  23. package/dist/{Success-B2T0Pbuw.js → Success-Dcd9bWCn.js} +85 -86
  24. package/dist/{TagIcon-DwWcRiXS.js → TagIcon-C8DU69Jv.js} +1 -1
  25. package/dist/{ViewTicketsEmbed-D8SEO2Zw.js → ViewTicketsEmbed-CWLSFG06.js} +14 -15
  26. package/dist/{WarningCircleIcon-C2fJjhKf.js → WarningCircleIcon-Cj8SHVfz.js} +26 -5
  27. package/dist/{WarningTriIcon-OqM9Rfwq.js → WarningTriIcon-CfCwvwsQ.js} +1 -1
  28. package/dist/__SKIP_NAVIGATION__-AOx8SI54.js +6 -0
  29. package/dist/api/api.cjs +1 -1
  30. package/dist/api/api.mjs +64 -32
  31. package/dist/api/cart-addons.d.ts +61 -0
  32. package/dist/api/index.d.ts +2 -0
  33. package/dist/{api-DMjowaFJ.js → api-Br260RVo.js} +190 -127
  34. package/dist/{constants-DC0xZ-Ja.js → constants-DWS8C09a.js} +3 -0
  35. package/dist/{copyToClipboard-CL9BmJA4.js → copyToClipboard-C_fcBdn4.js} +1 -1
  36. package/dist/{createErrorGate.svelte-DwTTmYou.js → createErrorGate.svelte-jZMaO7KA.js} +1 -1
  37. package/dist/{de-DWVo-yVF.js → de-BEfuIgIj.js} +3 -0
  38. package/dist/{defaultLabels-BaVkGLw4.js → defaultLabels-CqkC-rOG.js} +530 -427
  39. package/dist/{defaults-C6to4-1V.js → defaults-BLhQWNFt.js} +2 -2
  40. package/dist/{es-D2JTgwLx.js → es-Bd4g_HxR.js} +3 -0
  41. package/dist/{event-xgg-eiTq.js → event-DaWMe2IV.js} +1 -1
  42. package/dist/{event-transform-BF1WYBSP.js → event-transform-WnvEyzV-.js} +19 -19
  43. package/dist/{eventStatusStream-8vyVag0u.js → eventStatusStream-DgWemzCE.js} +1 -1
  44. package/dist/{fr-kMyKMhNC.js → fr-Blc79wvV.js} +3 -0
  45. package/dist/{href-DO3HKeJp.js → href-x-W1j8EY.js} +2 -2
  46. package/dist/{i18n-jISDKw5F.js → i18n-DFWp9lQ_.js} +2 -2
  47. package/dist/{i18n-toTFR5-t.js → i18n-DgjCm8g6.js} +93 -93
  48. package/dist/{id-ePSZ9pc6.js → id-DzzsiF4d.js} +3 -0
  49. package/dist/{it-CBG5vN1f.js → it-B4zXRsxu.js} +3 -0
  50. package/dist/{ja-BEOrhLFG.js → ja-eT4_QPKd.js} +3 -0
  51. package/dist/{ko-D8x_4jV4.js → ko-B8Fmrldj.js} +3 -0
  52. package/dist/locales/4.3.58/flow/de.js +1 -0
  53. package/dist/locales/4.3.58/flow/es.js +1 -0
  54. package/dist/locales/4.3.58/flow/fr.js +1 -0
  55. package/dist/locales/4.3.58/flow/id.js +1 -0
  56. package/dist/locales/4.3.58/flow/it.js +1 -0
  57. package/dist/locales/4.3.58/flow/ja.js +1 -0
  58. package/dist/locales/4.3.58/flow/ko.js +1 -0
  59. package/dist/locales/4.3.58/flow/nl.js +1 -0
  60. package/dist/locales/4.3.58/flow/pl.js +1 -0
  61. package/dist/locales/4.3.58/flow/pt-br.js +1 -0
  62. package/dist/locales/4.3.58/flow/tr.js +1 -0
  63. package/dist/locales/4.3.58/flow/zh.js +1 -0
  64. package/dist/{nl-Vc5Wd3re.js → nl-Dnug8LYt.js} +3 -0
  65. package/dist/{orders-FcXWw6b-.js → orders-DlyjunUM.js} +4 -4
  66. package/dist/{pixels-B85kohqd.js → pixels-n1zu1IhF.js} +1 -1
  67. package/dist/{pl-Dnjh6Wpy.js → pl-C3XxoYWF.js} +3 -0
  68. package/dist/{pt-br-BJa34BZo.js → pt-br-Y40SBe4b.js} +3 -0
  69. package/dist/{scarcity-CR1Pa81F.js → scarcity-KJNxIMxj.js} +100 -100
  70. package/dist/{serverTotals-DeOPPRj6.js → serverTotals-Cb7pt5Z-.js} +8 -8
  71. package/dist/{showcase-state-options-BGmvUaQ_.js → showcase-state-options-Ce1_tYvH.js} +1 -1
  72. package/dist/{to-event-card-props-DLOxO2oP.js → to-event-card-props-KoNvp_D9.js} +15 -16
  73. package/dist/{tr-Do7HmDL7.js → tr-2zIJ-vq2.js} +3 -0
  74. package/dist/{utils-DpC4fy4Z.js → utils-VHFV7pBb.js} +2 -2
  75. package/dist/venue-calendar.css +1 -1
  76. package/dist/venue-calendar.es.js +191 -192
  77. package/dist/venue-calendar.iife.js +21 -21
  78. package/dist/venue-calendar.umd.js +53 -53
  79. package/dist/{zh-Dn20V0BT.js → zh-vNYvCXO7.js} +3 -0
  80. package/package.json +220 -220
  81. package/dist/Badge-BsWJrQII.js +0 -108
  82. package/dist/CartView-Dz3Pet0D.js +0 -2294
  83. package/dist/Checkout-Bqe1P7Jr.js +0 -1849
  84. package/dist/Checkout-CFv2AX68.js +0 -1040
  85. package/dist/ClockIcon-C7nkbmvv.js +0 -25
  86. package/dist/EventPage-Cqkelq-1.js +0 -1201
  87. package/dist/ScarcityBadge-BXn6HM_K.js +0 -116
  88. package/dist/liveAnnouncer-D3xVL7qA.js +0 -32
  89. package/dist/locales/4.3.57/flow/de.js +0 -1
  90. package/dist/locales/4.3.57/flow/es.js +0 -1
  91. package/dist/locales/4.3.57/flow/fr.js +0 -1
  92. package/dist/locales/4.3.57/flow/id.js +0 -1
  93. package/dist/locales/4.3.57/flow/it.js +0 -1
  94. package/dist/locales/4.3.57/flow/ja.js +0 -1
  95. package/dist/locales/4.3.57/flow/ko.js +0 -1
  96. package/dist/locales/4.3.57/flow/nl.js +0 -1
  97. package/dist/locales/4.3.57/flow/pl.js +0 -1
  98. package/dist/locales/4.3.57/flow/pt-br.js +0 -1
  99. package/dist/locales/4.3.57/flow/tr.js +0 -1
  100. package/dist/locales/4.3.57/flow/zh.js +0 -1
  101. package/dist/order-totals-5X0jD77w.js +0 -151
  102. package/dist/promo-BNwWtZjP.js +0 -37
  103. /package/dist/locales/{4.3.57 → 4.3.58}/main/de.js +0 -0
  104. /package/dist/locales/{4.3.57 → 4.3.58}/main/es.js +0 -0
  105. /package/dist/locales/{4.3.57 → 4.3.58}/main/fr.js +0 -0
  106. /package/dist/locales/{4.3.57 → 4.3.58}/main/id.js +0 -0
  107. /package/dist/locales/{4.3.57 → 4.3.58}/main/it.js +0 -0
  108. /package/dist/locales/{4.3.57 → 4.3.58}/main/ja.js +0 -0
  109. /package/dist/locales/{4.3.57 → 4.3.58}/main/ko.js +0 -0
  110. /package/dist/locales/{4.3.57 → 4.3.58}/main/nl.js +0 -0
  111. /package/dist/locales/{4.3.57 → 4.3.58}/main/pl.js +0 -0
  112. /package/dist/locales/{4.3.57 → 4.3.58}/main/pt-br.js +0 -0
  113. /package/dist/locales/{4.3.57 → 4.3.58}/main/tr.js +0 -0
  114. /package/dist/locales/{4.3.57 → 4.3.58}/main/zh.js +0 -0
@@ -1,1040 +0,0 @@
1
- import { g as e, m as t, p as n } from "./sizing-CFDo_qh_.js";
2
- import { n as r, r as i, t as a } from "./CloseIcon-DPdjPdoi.js";
3
- import { r as o } from "./Input-CDw-j5fQ.js";
4
- import { E as s, f as c, x as l } from "./scarcity-CR1Pa81F.js";
5
- import { t as u } from "./TagIcon-DwWcRiXS.js";
6
- import { t as d } from "./WarningTriIcon-OqM9Rfwq.js";
7
- import { d as f, n as p } from "./z-index-Bo0dqmiq.js";
8
- import { I as m, k as h, n as g, t as _, y as v } from "./defaultLabels-BaVkGLw4.js";
9
- import { t as y } from "./Button-AZ8OLQqj.js";
10
- import { W as b, c as x, i as S, n as C, o as w, p as T, r as ee, t as E } from "./orders-FcXWw6b-.js";
11
- import { n as te, t as ne } from "./serverTotals-DeOPPRj6.js";
12
- import { a as D, i as O, n as k, r as A, t as j } from "./ModalFooter-ngqovl_z.js";
13
- import { c as re, d as ie, k as ae, o as M, s as oe } from "./api-DMjowaFJ.js";
14
- import { t as N } from "./event-transform-BF1WYBSP.js";
15
- import { t as se } from "./venue-BBoZBuhu.js";
16
- import { b as ce, g as le, h as ue, l as de, r as fe, v as pe } from "./utils-DpC4fy4Z.js";
17
- import { a as me, n as he } from "./promo-BNwWtZjP.js";
18
- import { r as ge } from "./order-totals-5X0jD77w.js";
19
- import _e, { n as P, t as ve } from "./Checkout-Bqe1P7Jr.js";
20
- import { n as ye } from "./buyerEmail-BfCq-gDt.js";
21
- import "svelte/internal/disclose-version";
22
- import * as F from "svelte/internal/client";
23
- import { onMount as be } from "svelte";
24
- //#region node_modules/@stripe/stripe-js/dist/index.mjs
25
- function I(e) {
26
- "@babel/helpers - typeof";
27
- return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
28
- return typeof e;
29
- } : function(e) {
30
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
31
- }, I(e);
32
- }
33
- var xe = "dahlia", L = function(e) {
34
- return e === 3 ? "v3" : e;
35
- }, Se = "https://js.stripe.com", R = `${Se}/${xe}/stripe.js`, z = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/, B = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/, V = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used", H = function(e) {
36
- return z.test(e) || B.test(e);
37
- }, U = function() {
38
- for (var e = document.querySelectorAll(`script[src^="${Se}"]`), t = 0; t < e.length; t++) {
39
- var n = e[t];
40
- if (H(n.src)) return n;
41
- }
42
- return null;
43
- }, Ce = function(e) {
44
- var t = e && !e.advancedFraudSignals ? "?advancedFraudSignals=false" : "", n = document.createElement("script");
45
- n.src = `${R}${t}`;
46
- var r = document.head || document.body;
47
- if (!r) throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
48
- return r.appendChild(n), n;
49
- }, we = function(e, t) {
50
- !e || !e._registerWrapper || e._registerWrapper({
51
- name: "stripe-js",
52
- version: "9.13.0",
53
- startTime: t
54
- });
55
- }, W = null, G = null, K = null, q = function(e) {
56
- return function(t) {
57
- e(Error("Failed to load Stripe.js", { cause: t }));
58
- };
59
- }, J = function(e, t) {
60
- return function() {
61
- window.Stripe ? e(window.Stripe) : t(/* @__PURE__ */ Error("Stripe.js not available"));
62
- };
63
- }, Te = function(e) {
64
- return W === null ? (W = new Promise(function(t, n) {
65
- if (typeof window > "u" || typeof document > "u") {
66
- t(null);
67
- return;
68
- }
69
- if (window.Stripe && e && console.warn(V), window.Stripe) {
70
- t(window.Stripe);
71
- return;
72
- }
73
- try {
74
- var r = U();
75
- if (r && e) console.warn(V);
76
- else if (!r) r = Ce(e);
77
- else if (r && K !== null && G !== null) {
78
- var i;
79
- r.removeEventListener("load", K), r.removeEventListener("error", G), (i = r.parentNode) == null || i.removeChild(r), r = Ce(e);
80
- }
81
- K = J(t, n), G = q(n), r.addEventListener("load", K), r.addEventListener("error", G);
82
- } catch (e) {
83
- n(e);
84
- return;
85
- }
86
- }), W.catch(function(e) {
87
- return W = null, Promise.reject(e);
88
- })) : W;
89
- }, Ee = function(e, t, n) {
90
- if (e === null) return null;
91
- var r = t[0];
92
- if (typeof r != "string") throw Error(`Expected publishable key to be of type string, got type ${I(r)} instead.`);
93
- var i = r.match(/^pk_test/), a = L(e.version), o = xe;
94
- i && a !== o && console.warn(`Stripe.js@${a} was loaded on the page, but @stripe/stripe-js@9.13.0 expected Stripe.js@${o}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);
95
- var s = e.apply(void 0, t);
96
- return we(s, n), s;
97
- }, Y, X = !1, De = function() {
98
- return Y || (Y = Te(null).catch(function(e) {
99
- return Y = null, Promise.reject(e);
100
- }), Y);
101
- };
102
- Promise.resolve().then(function() {
103
- return De();
104
- }).catch(function(e) {
105
- X || console.warn(e);
106
- });
107
- var Oe = function() {
108
- var e = [...arguments];
109
- X = !0;
110
- var t = Date.now();
111
- return De().then(function(n) {
112
- return Ee(n, e, t);
113
- });
114
- };
115
- //#endregion
116
- //#region src/lib/utils/stripe-errors.ts
117
- function Z(e, t = _) {
118
- let n = e?.code || e?.decline_code || "", r = e?.type || "", i = e?.message || "";
119
- if (n === "card_declined" || r === "card_error") {
120
- let n = e?.decline_code || "";
121
- return n === "insufficient_funds" ? {
122
- type: "card_declined",
123
- title: t.cardInsufficientFundsTitle || "Insufficient funds",
124
- message: t.cardInsufficientFundsMessage || "Your card has insufficient funds to complete this purchase",
125
- suggestion: t.cardInsufficientFundsSuggestion || "Please try a different payment method or contact your bank",
126
- retryable: !0
127
- } : n === "lost_card" || n === "stolen_card" ? {
128
- type: "card_declined",
129
- title: t.cardUnusableTitle || "Card cannot be used",
130
- message: t.cardUnusableMessage || "This card cannot be used for this transaction",
131
- suggestion: t.cardUnusableSuggestion || "Please use a different payment method",
132
- retryable: !0
133
- } : n === "expired_card" ? {
134
- type: "card_declined",
135
- title: t.cardExpiredTitle || "Card expired",
136
- message: t.cardExpiredMessage || "Your card has expired",
137
- suggestion: t.cardExpiredSuggestion || "Please use a different card or update your card details",
138
- retryable: !0
139
- } : n === "do_not_honor" ? {
140
- type: "card_declined",
141
- title: t.cardDeclinedTitle || "Card declined",
142
- message: t.cardDoNotHonorMessage || "Your bank declined this card",
143
- suggestion: t.cardDoNotHonorSuggestion || "Try another card or call your bank",
144
- retryable: !0
145
- } : {
146
- type: "card_declined",
147
- title: t.cardDeclinedTitle || "Card declined",
148
- message: t.cardDeclinedMessage || "Your card was declined by your bank",
149
- suggestion: t.cardDeclinedSuggestion || "Please try a different card or contact your bank for more information",
150
- retryable: !0
151
- };
152
- }
153
- return r === "api_connection_error" || i.includes("network") || i.includes("connection") ? {
154
- type: "network",
155
- title: t.connectionError || "Connection error",
156
- message: t.paymentConnectionErrorMessage || "We couldn't connect to the payment server",
157
- suggestion: t.paymentConnectionErrorSuggestion || "Please check your internet connection and try again",
158
- retryable: !0
159
- } : n === "rate_limit" ? {
160
- type: "rate_limit",
161
- title: t.tooManyAttemptsTitle || "Too many attempts",
162
- message: t.tooManyAttemptsMessage || "Too many payment attempts. Please wait a moment",
163
- suggestion: t.tooManyAttemptsSuggestion || "Wait 30 seconds before trying again",
164
- retryable: !0
165
- } : n === "incorrect_number" || n === "invalid_number" ? {
166
- type: "validation",
167
- title: t.invalidCardNumberTitle || "Invalid card number",
168
- message: t.invalidCardNumberMessage || "The card number you entered is invalid",
169
- suggestion: t.invalidCardNumberSuggestion || "Please check your card number and try again",
170
- retryable: !0
171
- } : n === "incorrect_cvc" || n === "invalid_cvc" ? {
172
- type: "validation",
173
- title: t.invalidCvcTitle || "Invalid security code",
174
- message: t.invalidCvcMessage || "The security code (CVC) is incorrect",
175
- suggestion: t.invalidCvcSuggestion || "Please check the 3-digit code on the back of your card",
176
- retryable: !0
177
- } : n === "invalid_expiry_month" || n === "invalid_expiry_year" ? {
178
- type: "validation",
179
- title: t.invalidExpiryTitle || "Invalid expiration date",
180
- message: t.invalidExpiryMessage || "The expiration date is invalid",
181
- suggestion: t.invalidExpirySuggestion || "Please check your card's expiration date",
182
- retryable: !0
183
- } : {
184
- type: "general",
185
- title: t.paymentFailedTitle || "Payment failed",
186
- message: i || t.paymentFailedMessage || "Something went wrong with your payment",
187
- suggestion: t.paymentFailedSuggestion || "Please try again or use a different payment method",
188
- retryable: !0
189
- };
190
- }
191
- //#endregion
192
- //#region src/components/Events/Checkout/GiftCardInput.svelte
193
- var Q = e("GiftCardInput"), ke = F.from_html("<div class=\"applied-card mb-2 svelte-emw0hd\"><div class=\"flex items-center gap-3\"><div class=\"applied-icon svelte-emw0hd\"><!></div> <div class=\"flex flex-col flex-1\"><span class=\"type-caption text-status-success-text\"> </span> <span class=\"type-body font-mono text-text-primary\"> </span></div> <span class=\"type-label text-accent-success\"> </span> <!></div></div>"), Ae = F.from_html("<div class=\"applied-card mb-3 svelte-emw0hd\"><div><!> <span> </span></div></div>"), je = F.from_html("<div class=\"flex items-center gap-1.5 mt-2 type-body text-accent-danger\"><!> <span> </span></div>"), Me = F.from_html("<div class=\"input-section svelte-emw0hd\"><div class=\"flex gap-2\"><input type=\"text\" name=\"giftCardCode\" autocomplete=\"off\" autocapitalize=\"characters\"/> <!></div> <!></div>"), Ne = F.from_html("<div class=\"mb-4\"><!> <!> <button type=\"button\"><!> <span> </span> <span class=\"toggle-indicator svelte-emw0hd\"> </span></button> <!></div>");
194
- function Pe(e, i) {
195
- F.push(i, !0);
196
- let o = F.prop(i, "onApplied", 3, () => {}), s = F.prop(i, "onRemoved", 3, () => {}), c = F.prop(i, "disabled", 3, !1), m = F.prop(i, "labels", 3, _), h = F.prop(i, "owedTotal", 3, 0), g = F.prop(i, "serverGiftCardAmount", 3, null), v = F.state(""), b = F.state(!1), x = F.state(""), S = F.state(F.proxy([])), C = F.state(!1), w = F.state(0);
197
- F.user_effect(() => {
198
- if (!i.cartId || F.get(S).length > 0 || g() === 0) return;
199
- let e = !1;
200
- return ee(i.cartId).then((t) => {
201
- if (e || !t?.giftCards?.length) return;
202
- let n = t.giftCards.filter((e) => typeof e.amount == "number");
203
- n.length !== t.giftCards.length && Q.error("Ignored applied gift card(s) with an unusable amount while restoring the panel"), n.length !== 0 && (F.set(S, n.map((e) => ({
204
- giftCardId: e.giftCardId,
205
- code: e.maskedCode,
206
- giftCardAmount: e.amount
207
- })), !0), F.set(w, F.get(S).reduce((e, t) => e + (t.giftCardAmount || 0), 0) + (h() || 0)));
208
- }).catch((e) => Q.error("Could not restore applied gift cards:", e)), () => {
209
- e = !0;
210
- };
211
- });
212
- let T = F.derived(() => F.get(S).reduce((e, t) => e + (t.giftCardAmount || 0), 0)), E = F.derived(() => Math.max(0, F.get(w) - F.get(T))), te = F.derived(() => F.get(S).length > 0 && F.get(E) <= 0);
213
- function ne() {
214
- if (F.get(S).length === 0) {
215
- s()();
216
- return;
217
- }
218
- o()({
219
- code: F.get(S).map((e) => e.code).join(", "),
220
- giftCardAmount: F.get(T),
221
- stripeAmount: F.get(E),
222
- requiresStripe: F.get(E) > 0,
223
- paymentType: F.get(E) > 0 ? "split" : "gift_card_only",
224
- orderTotal: F.get(w)
225
- });
226
- }
227
- async function D() {
228
- let e = F.get(v).trim().toUpperCase();
229
- if (!(!e || F.get(b) || !i.cartId)) {
230
- if (F.get(S).some((t) => t.code === e)) {
231
- F.set(x, m().giftCardAlreadyApplied || "That gift card is already applied", !0);
232
- return;
233
- }
234
- F.set(b, !0), F.set(x, "");
235
- try {
236
- let t = await M(i.cartId, e);
237
- t.valid ? (F.set(S, [...F.get(S), {
238
- code: t.giftCardCode || e,
239
- giftCardAmount: t.giftCardAmount || 0
240
- }], !0), F.set(w, F.get(T) + (t.stripeAmount || 0)), F.set(v, ""), F.set(C, !1), ne()) : F.set(x, t.error || m().invalidGiftCardCode || "Invalid gift card code", !0);
241
- } catch (e) {
242
- Q.error("Error applying gift card:", e);
243
- let t = e && typeof e == "object" && typeof e.message == "string" ? e.message : "";
244
- F.set(x, t || m().failedToApplyGiftCard || "Failed to apply gift card. Please try again", !0);
245
- }
246
- F.set(b, !1);
247
- }
248
- }
249
- async function O(e) {
250
- if (!(F.get(b) || !i.cartId)) {
251
- F.set(b, !0), F.set(x, "");
252
- try {
253
- let t = F.get(S).find((t) => t.code === e), n = await re(i.cartId, t?.giftCardId ? { giftCardId: t.giftCardId } : { code: e });
254
- n.success !== !1 && !n.error ? (F.set(S, F.get(S).filter((t) => t.code !== e), !0), typeof n.remainingTotal == "number" && F.set(w, F.get(T) + n.remainingTotal), ne()) : F.set(x, n.error || m().failedToRemoveGiftCard || "Failed to remove gift card. Please try again", !0);
255
- } catch (e) {
256
- Q.error("Error removing gift card:", e), F.set(x, m().failedToRemoveGiftCard || "Failed to remove gift card. Please try again", !0);
257
- }
258
- F.set(b, !1);
259
- }
260
- }
261
- function k(e) {
262
- e.key === "Enter" && !F.get(b) && D();
263
- }
264
- function A() {
265
- F.set(C, !F.get(C)), F.get(C) || (F.set(v, ""), F.set(x, ""));
266
- }
267
- var j = Ne(), ie = F.child(j);
268
- F.each(ie, 17, () => F.get(S), (e) => e.code, (e, t) => {
269
- var n = ke(), i = F.child(n), o = F.child(i), s = F.child(o);
270
- r(s, { size: "16" }), F.reset(o);
271
- var u = F.sibling(o, 2), d = F.child(u), h = F.child(d, !0);
272
- F.reset(d);
273
- var g = F.sibling(d, 2), _ = F.child(g, !0);
274
- F.reset(g), F.reset(u);
275
- var v = F.sibling(u, 2), x = F.child(v);
276
- F.reset(v);
277
- var S = F.sibling(v, 2);
278
- {
279
- let e = F.derived(() => m().removeGiftCard || "Remove gift card");
280
- y(S, {
281
- variant: "icon",
282
- size: "icon-sm",
283
- class: "rounded-full hover:bg-status-error-bg hover:text-accent-danger",
284
- onclick: () => O(F.get(t).code),
285
- get loading() {
286
- return F.get(b);
287
- },
288
- get disabled() {
289
- return c();
290
- },
291
- get "aria-label"() {
292
- return F.get(e);
293
- },
294
- children: (e, t) => {
295
- a(e, { size: "16" });
296
- },
297
- $$slots: { default: !0 }
298
- });
299
- }
300
- F.reset(i), F.reset(n), F.template_effect((e) => {
301
- F.set_text(h, m().giftCardApplied || "Gift card applied"), F.set_text(_, F.get(t).code), F.set_text(x, `-${e ?? ""}`);
302
- }, [() => l(F.get(t).giftCardAmount)]), F.transition(3, n, () => f, () => ({ duration: p.fast })), F.append(e, n);
303
- });
304
- var ae = F.sibling(ie, 2), oe = (e) => {
305
- var i = Ae(), a = F.child(i), o = F.child(a);
306
- r(o, { size: "16" });
307
- var s = F.sibling(o, 2), c = F.child(s, !0);
308
- F.reset(s), F.reset(a), F.reset(i), F.template_effect(() => {
309
- F.set_class(a, 1, `full-coverage-badge ${t.caption ?? ""} ${n.emphasis ?? ""}`, "svelte-emw0hd"), F.set_text(c, m().fullyCoveredByGiftCard || "Fully covered by gift card");
310
- }), F.append(e, i);
311
- };
312
- F.if(ae, (e) => {
313
- F.get(te) && e(oe);
314
- });
315
- var N = F.sibling(ae, 2), se = F.child(N);
316
- u(se, {
317
- size: "20",
318
- class: "gift-icon"
319
- });
320
- var ce = F.sibling(se, 2), le = F.child(ce, !0);
321
- F.reset(ce);
322
- var ue = F.sibling(ce, 2), de = F.child(ue, !0);
323
- F.reset(ue), F.reset(N);
324
- var fe = F.sibling(N, 2), pe = (e) => {
325
- var n = Me(), r = F.child(n), i = F.child(r);
326
- F.remove_input_defaults(i);
327
- let a;
328
- var o = F.sibling(i, 2);
329
- {
330
- let e = F.derived(() => !F.get(v).trim() || c());
331
- y(o, {
332
- variant: "default",
333
- size: "sm",
334
- class: "min-w-16 shrink-0",
335
- onclick: D,
336
- get loading() {
337
- return F.get(b);
338
- },
339
- get disabled() {
340
- return F.get(e);
341
- },
342
- children: (e, t) => {
343
- F.next();
344
- var n = F.text();
345
- F.template_effect(() => F.set_text(n, m().apply || "Apply")), F.append(e, n);
346
- },
347
- $$slots: { default: !0 }
348
- });
349
- }
350
- F.reset(r);
351
- var s = F.sibling(r, 2), l = (e) => {
352
- var t = je(), n = F.child(t);
353
- d(n, { size: "16" });
354
- var r = F.sibling(n, 2), i = F.child(r, !0);
355
- F.reset(r), F.reset(t), F.template_effect(() => F.set_text(i, F.get(x))), F.transition(3, t, () => f, () => ({ duration: p.micro })), F.append(e, t);
356
- };
357
- F.if(s, (e) => {
358
- F.get(x) && e(l);
359
- }), F.reset(n), F.template_effect(() => {
360
- F.set_attribute(i, "aria-label", m().enterGiftCardCode || "Enter gift card code"), F.set_attribute(i, "placeholder", m().enterGiftCardCode || "Enter gift card code"), i.disabled = F.get(b) || c(), a = F.set_class(i, 1, `gift-input ${t.body ?? ""}`, "svelte-emw0hd", a, { "has-error": !!F.get(x) });
361
- }), F.delegated("keydown", i, k), F.bind_value(i, () => F.get(v), (e) => F.set(v, e)), F.transition(3, n, () => f, () => ({ duration: p.fast })), F.append(e, n);
362
- };
363
- F.if(fe, (e) => {
364
- F.get(C) && e(pe);
365
- }), F.reset(j), F.template_effect(() => {
366
- F.set_class(N, 1, `gift-card-toggle ${t.label ?? ""}`, "svelte-emw0hd"), N.disabled = c(), F.set_attribute(N, "aria-expanded", F.get(C)), F.set_text(le, F.get(S).length > 0 ? m().addAnotherGiftCard || "Add another gift card" : m().haveAGiftCard || "Have a gift card?"), F.set_text(de, F.get(C) ? "-" : "+");
367
- }), F.delegated("click", N, A), F.append(e, j), F.pop();
368
- }
369
- F.delegate(["click", "keydown"]);
370
- //#endregion
371
- //#region src/components/Modals/EventUnavailableModal.svelte
372
- var Fe = F.from_html("<div class=\"flex flex-col items-center text-center pt-6 px-4 pb-4\"><div aria-hidden=\"true\"><!></div> <h3 id=\"event-unavailable-title\"> </h3> <p id=\"event-unavailable-body\" class=\"type-body tone-secondary max-w-72\"> </p></div>"), Ie = F.from_html("<!> <!>", 1);
373
- function Le(e, n) {
374
- F.push(n, !0);
375
- let r = F.prop(n, "open", 15, !1), a = F.prop(n, "onBackToEvents", 3, () => {}), s = F.prop(n, "labels", 3, _), c = F.derived(() => n.reason === "canceled"), l = F.derived(() => F.get(c) ? s().eventCanceledTitle || "Event canceled" : s().eventPostponedTitle || "Event postponed"), u = F.derived(() => F.get(c) ? s().eventCanceledBody || "This event was canceled — you weren't charged" : s().eventPostponedBody || "Sales are paused while this show is rescheduled — you weren't charged"), d = F.derived(() => s().backToEvents || "Back to events");
376
- D(e, {
377
- size: "sm",
378
- role: "alertdialog",
379
- class: "micdrop",
380
- get open() {
381
- return r();
382
- },
383
- set open(e) {
384
- r(e);
385
- },
386
- children: (e, n) => {
387
- var r = Ie(), s = F.first_child(r);
388
- O(s, {});
389
- var f = F.sibling(s, 2);
390
- A(f, {
391
- children: (e, n) => {
392
- var r = Ie(), s = F.first_child(r);
393
- k(s, {
394
- children: (e, n) => {
395
- var r = Fe(), a = F.child(r), s = F.child(a), d = (e) => {
396
- o(e, { size: "32" });
397
- }, f = (e) => {
398
- i(e, { size: "32" });
399
- };
400
- F.if(s, (e) => {
401
- F.get(c) ? e(d) : e(f, -1);
402
- }), F.reset(a);
403
- var p = F.sibling(a, 2), m = F.child(p, !0);
404
- F.reset(p);
405
- var h = F.sibling(p, 2), g = F.child(h, !0);
406
- F.reset(h), F.reset(r), F.template_effect(() => {
407
- F.set_class(a, 1, `w-16 h-16 rounded-full flex items-center justify-center mb-4 ${F.get(c) ? "bg-accent-danger/10 text-accent-danger" : "bg-accent-warning/10 text-accent-warning"}`), F.set_class(p, 1, `mb-2 ${t.heading ?? ""}`), F.set_text(m, F.get(l)), F.set_text(g, F.get(u));
408
- }), F.append(e, r);
409
- },
410
- $$slots: { default: !0 }
411
- });
412
- var f = F.sibling(s, 2);
413
- j(f, {
414
- children: (e, t) => {
415
- y(e, {
416
- size: "full",
417
- variant: "default",
418
- get onclick() {
419
- return a();
420
- },
421
- get "aria-label"() {
422
- return F.get(d);
423
- },
424
- children: (e, t) => {
425
- F.next();
426
- var n = F.text();
427
- F.template_effect(() => F.set_text(n, F.get(d))), F.append(e, n);
428
- },
429
- $$slots: { default: !0 }
430
- });
431
- },
432
- $$slots: { default: !0 }
433
- }), F.append(e, r);
434
- },
435
- $$slots: { default: !0 }
436
- }), F.append(e, r);
437
- },
438
- $$slots: { default: !0 }
439
- }), F.pop();
440
- }
441
- //#endregion
442
- //#region src/components/Views/Checkout.svelte
443
- var $ = e("Checkout"), Re = F.from_html("<div class=\"p-8 text-center\"><p class=\"text-accent-danger\"> </p></div>"), ze = F.from_html("<div class=\"p-8 text-center\"><p class=\"tone-muted\"> </p></div>"), Be = F.from_html("<!> <!>", 1);
444
- function Ve(e, t) {
445
- F.push(t, !0);
446
- let n = F.prop(t, "availableTickets", 23, () => []);
447
- F.prop(t, "value", 3, "");
448
- let r = F.prop(t, "venueId", 3, ""), i = F.prop(t, "organizationId", 3, ""), a = F.prop(t, "onNavigateBack", 3, void 0), o = F.prop(t, "initialError", 3, void 0), l = F.prop(t, "widgetId", 3, null), u = F.prop(t, "labels", 3, _), d = F.prop(t, "locale", 3, void 0);
449
- function f(e) {
450
- if (!e) return {};
451
- let t = { ...e.venue ?? {} };
452
- for (let n of [
453
- "askForPhoneAtCheckout",
454
- "requiredPhoneAtCheckout",
455
- "hasCustomCheckout",
456
- "requiredCustomCheckout",
457
- "questionPrompt"
458
- ]) e[n] !== void 0 && (t[n] = e[n]);
459
- return t;
460
- }
461
- let p = F.derived(() => (t.data || {}).id);
462
- F.derived(() => (t.data || {}).orgSlug);
463
- let y = F.derived(() => (t.data || {}).slug), ee = F.derived(() => (t.data || {}).event), D = F.derived(() => se(f(F.get(ee)))), O = F.derived(() => F.get(ee) ? {
464
- ...N(F.get(ee)),
465
- ...F.get(D)
466
- } : t.data && (t.data.id || F.get(p)) ? {
467
- id: t.data.id || F.get(p),
468
- eventID: t.data.id || F.get(p),
469
- venueID: t.data.venueID ?? t.data.venueId ?? null,
470
- venueId: t.data.venueId ?? t.data.venueID ?? null,
471
- eventTicketingType: 0,
472
- ticketType: 0,
473
- availableTickets: []
474
- } : null), k = F.state(""), A = F.state(F.proxy({})), j = F.state(F.proxy({})), re = F.state(F.proxy({})), M = F.state(F.proxy([])), I = F.state(""), xe = F.state(0), L = F.state(!1), Se = F.state(!1), R = F.state(!1), z = F.state(null), B = F.state(""), V = F.state(void 0), H = F.state(null), U = F.state(""), Ce = F.state(!1), we = F.state(""), W = F.state(null), G = F.derived(() => F.get(W) !== null), K = F.state(null), q = F.state(null), J = null, Te = F.state(!1);
475
- function Ee() {
476
- return {
477
- value: J?.total ?? null,
478
- currency: J?.currency || "USD"
479
- };
480
- }
481
- be(async () => {
482
- if (F.set(k, P(de) || P(ve.CHECKOUT_CARTID), !0), !F.get(k)) {
483
- F.set(Ce, !0), F.set(we, u().noCheckoutSession || "No checkout session found. Please select tickets first", !0);
484
- return;
485
- }
486
- T(F.get(O)?.eventID || F.get(O)?.id || F.get(p), l(), r() || F.get(O)?.venueID || F.get(O)?.venueId || null, F.get(k));
487
- let e = F.get(O)?.eventID || F.get(O)?.id || F.get(p);
488
- try {
489
- let t = le(e);
490
- F.set(A, t.quantities || {}, !0), F.set(j, t.donationAmounts || {}, !0), F.set(re, t.addOnQuantities || {}, !0), F.set(I, t.promocode || "", !0), F.set(xe, t.promoDiscountAmount || 0, !0), F.set(M, t.tickets || [], !0);
491
- } catch (e) {
492
- $.error("Error loading checkout state:", e), F.set(A, {}, !0), F.set(re, {}, !0), F.set(M, [], !0);
493
- }
494
- F.get(M).length > 0 && F.get(O) && (F.get(O).availableTickets = F.get(M), n(F.get(M)));
495
- let t = fe(F.get(O)?.venueID || F.get(O)?.venueId || r()).then((e) => ({ data: e }), (e) => ({ error: e }));
496
- await (Object.keys(F.get(A)).length > 0 ? X() : null);
497
- let i = {
498
- serviceFeeCents: 0,
499
- serviceFeePercentage: 0,
500
- serviceFeeChargeType: "both",
501
- maxServiceFeeCents: 0,
502
- absorbServiceFee: !1,
503
- taxPercentage: 0
504
- };
505
- try {
506
- let e = await t;
507
- if ("error" in e) throw e.error;
508
- let n = e.data;
509
- i = {
510
- serviceFeeCents: Number(n?.serviceFeeCents == null ? 0 : n.serviceFeeCents),
511
- serviceFeePercentage: Number(n?.serviceFeePercentage ?? 0),
512
- serviceFeeChargeType: String(n?.serviceFeeChargeType ?? "both"),
513
- maxServiceFeeCents: Number(n?.maxServiceFeeCents == null ? 0 : n.maxServiceFeeCents),
514
- absorbServiceFee: n?.absorbServiceFee === !0,
515
- taxPercentage: Number(n?.taxPercentage ?? 0)
516
- };
517
- } catch (e) {
518
- $.error("Error fetching venue data:", e);
519
- }
520
- let a = [...Q(F.get(A), F.get(M), i), ...ke(F.get(re), F.get(O)?.addOns)], c = 900, d = "", f, m;
521
- if (F.get(k)) {
522
- let e = pe(F.get(k));
523
- if (e) {
524
- let t = Math.max(0, Math.floor((e - Date.now()) / 1e3));
525
- t > 0 && (c = t);
526
- }
527
- try {
528
- let e = await S(F.get(k));
529
- if (e.error || (e.remainingExtensions !== void 0 && (f = e.remainingExtensions), e.canExtend !== void 0 && (m = e.canExtend)), !e.error && e.expiresAt) {
530
- let t = v(e.expiresAt).getTime();
531
- c = Math.max(0, Math.floor((t - Date.now()) / 1e3)), d = e.expiresAt, ce(F.get(k), t);
532
- }
533
- } catch {}
534
- }
535
- let h = P(`checkout-promo-discount-type-${e}`), g = [];
536
- try {
537
- let t = P(`checkout-promo-ticket-ids-${e}`), n = t ? JSON.parse(t) : [];
538
- Array.isArray(n) && (g = n);
539
- } catch {
540
- g = [];
541
- }
542
- let _ = s(a.filter((e) => he(g, e.ticketId)).reduce((e, t) => e + (t.subtotal == null ? 0 : t.subtotal), 0)), y = me(_, F.get(xe), h);
543
- if (F.set(q, {
544
- event: De(F.get(O), i),
545
- lines: a,
546
- timerStart: c,
547
- ...d ? { deadlineAt: d } : {},
548
- ...f === void 0 ? {} : { remainingExtensions: f },
549
- ...m === void 0 ? {} : { canExtend: m },
550
- promoApplied: !!F.get(I),
551
- promoDiscount: y,
552
- forceExpired: !1,
553
- ...J ? { serverTotals: J } : {}
554
- }, !0), o()) {
555
- let e = Z(typeof o() == "object" ? o() : {
556
- code: "card_declined",
557
- message: "Your card was declined. Please try a different payment method."
558
- }, u());
559
- F.set(H, {
560
- message: e.message,
561
- suggestion: e.suggestion
562
- }, !0);
563
- }
564
- });
565
- let Y = 0;
566
- async function X() {
567
- let e = ++Y;
568
- if (!F.get(k)) {
569
- $.error("Missing cartId!");
570
- return;
571
- }
572
- let t = Object.fromEntries(Object.entries(F.get(A)).filter(([e, t]) => t > 0));
573
- try {
574
- let n = Object.fromEntries(Object.entries(F.get(j)).filter(([, e]) => parseFloat(String(e)) > 0).map(([e, t]) => [parseInt(e, 10), parseFloat(String(t))]));
575
- if (F.get(I)) {
576
- let t = await ae(F.get(k), F.get(I));
577
- if (e !== Y) return;
578
- t.success ? F.set(U, "") : ($.error("Failed to apply promo code to cart:", t.error), F.set(U, (u().promoCodeNotApplied || "We couldn't apply promo code {code}. It isn't included in this total — go back to re-enter it, or continue at the full price").replace("{code}", F.get(I)), !0));
579
- }
580
- let r = await E(F.get(k), t, Object.keys(n).length > 0 ? n : void 0, void 0, d());
581
- if (e !== Y) return;
582
- if (!r) {
583
- F.set(H, { message: u().failedToCreatePaymentIntent || "Failed to create payment intent. Please try again" }, !0);
584
- return;
585
- }
586
- F.set(Te, !1), J = ne(r), F.get(q) && F.set(q, {
587
- ...F.get(q),
588
- serverTotals: J
589
- }, !0);
590
- let i = r;
591
- if (i.requires_stripe === !1 || i.payment_type === "free") {
592
- F.set(B, "free");
593
- return;
594
- }
595
- F.set(Te, J === null);
596
- let a = r.stripe_publishable_key;
597
- if (!a) {
598
- $.error("No Stripe publishable key in payment intent response"), F.set(H, { message: u().paymentConfigError || "Payment configuration error. Please try again" }, !0);
599
- return;
600
- }
601
- let o = await Oe(a);
602
- if (e !== Y) return;
603
- F.set(z, o, !0), r.client_secret ? F.set(B, r.client_secret, !0) : F.set(H, { message: u().failedToInitPayment || "Failed to initialize payment. Please try again" }, !0);
604
- } catch (t) {
605
- if ($.error("Failed to initialize Stripe payment:", t), e !== Y) return;
606
- F.set(H, { message: t.message || u().failedToInitPayment || "Failed to initialize payment. Please try again" }, !0);
607
- }
608
- }
609
- function De(e, t) {
610
- return e ? {
611
- id: e.id || e.eventID,
612
- title: e.name || e.title || "",
613
- slug: e.slug || F.get(y) || "",
614
- description: e.description || "",
615
- date: e.date || "",
616
- startDateTime: e.startDateTime || "",
617
- endDateTime: e.endDateTime || "",
618
- doorsOpenTime: e.doorsOpenTime || "",
619
- timezone: e.timeZone || e.timezone || g(),
620
- imageUrl: e.imageUrl || e.image || "",
621
- ...F.get(D),
622
- venue: {
623
- id: e.venueID || e.venueId || 0,
624
- name: e.venueName || e.venue?.name || "",
625
- address: e.venueAddress || "",
626
- timezone: e.timeZone || e.timezone || g(),
627
- serviceFeePercentage: t.serviceFeePercentage,
628
- serviceFeeCents: t.serviceFeeCents,
629
- taxPercentage: t.taxPercentage,
630
- serviceFeeChargeType: t.serviceFeeChargeType,
631
- maxServiceFeeCents: t.maxServiceFeeCents,
632
- absorbServiceFee: t.absorbServiceFee
633
- },
634
- performers: e.performers || [],
635
- addOns: e.addOns || [],
636
- tickets: (e.availableTickets || []).map((e) => ({
637
- id: e.ID || e.id,
638
- name: e.name || "",
639
- description: e.description || "",
640
- price: c(e.price),
641
- fee: 0,
642
- quantityAvailable: e.quantityAvailable || 0,
643
- quantityTotal: e.quantityTotal || 0,
644
- minPerOrder: e.minPerOrder || 1,
645
- maxPerOrder: e.maxPerOrder || 10,
646
- status: "on_sale",
647
- isDonation: ue(e),
648
- isHidden: !1
649
- })),
650
- faqs: e.faqs || [],
651
- status: "on_sale",
652
- isPasswordProtected: !1,
653
- isRegistrationEvent: e.eventTicketingType === 1 || e.ticketType === 1,
654
- totalTicketsRemaining: 100,
655
- totalTicketsCapacity: 100
656
- } : null;
657
- }
658
- function Q(e, t, n) {
659
- let r = [];
660
- for (let [i, a] of Object.entries(e)) {
661
- if (a <= 0) continue;
662
- let e = t.find((e) => String(e.ID) === i || String(e.id) === i);
663
- if (!e) continue;
664
- let o = ue(e), c = e.price;
665
- if (!o && (c == null || !Number.isFinite(c))) {
666
- r.push({
667
- ticketId: parseInt(i),
668
- ticketName: e.name || "",
669
- quantity: a,
670
- unitPrice: null,
671
- fee: 0,
672
- subtotal: null,
673
- isDonation: !1
674
- });
675
- continue;
676
- }
677
- let l = c ?? 0, u = ge(l, n, o);
678
- r.push({
679
- ticketId: parseInt(i),
680
- ticketName: e.name || "",
681
- quantity: a,
682
- unitPrice: l,
683
- fee: u,
684
- subtotal: s(l * a),
685
- isDonation: o
686
- });
687
- }
688
- return r;
689
- }
690
- function ke(e, t) {
691
- let n = t || [], r = [];
692
- for (let [t, i] of Object.entries(e || {})) {
693
- if (!(i > 0)) continue;
694
- let e = n.find((e) => String(e.id) === String(t));
695
- if (!e) continue;
696
- let a = h(m(Number(e.priceCents) || 0));
697
- r.push({
698
- ticketId: parseInt(t, 10),
699
- lineKey: `a:${t}`,
700
- kind: "addon",
701
- ticketName: e.name || "",
702
- quantity: i,
703
- unitPrice: a,
704
- fee: 0,
705
- subtotal: s(a * i),
706
- isDonation: !1
707
- });
708
- }
709
- return r;
710
- }
711
- let Ae = F.derived(() => Object.values(F.get(j)).some((e) => (Number(e) || 0) > 0)), je = F.derived(() => !F.get(Ae) && (!F.get(q) || F.get(q).lines.every((e) => e.unitPrice === 0)));
712
- async function Me(e) {
713
- if (!F.get(L)) {
714
- F.set(L, !0), F.set(H, null);
715
- try {
716
- if (F.get(R)) {
717
- F.set(H, { message: u().paymentReinitializing || "Updating your total. Please wait a moment and try again" }, !0);
718
- return;
719
- }
720
- if (F.get(K) && !F.get(K).requiresStripe) {
721
- await Ne(e);
722
- return;
723
- }
724
- if (F.get(je) || F.get(B) === "free" || J?.total === 0) {
725
- await Fe(e);
726
- return;
727
- }
728
- if (!F.get(V)) {
729
- F.set(H, {
730
- message: u().paymentFormNotReady || "Payment form is not ready. Please wait a moment and try again",
731
- blocking: !0
732
- }, !0), F.set(L, !1);
733
- return;
734
- }
735
- if (!F.get(z)) {
736
- F.set(H, {
737
- message: u().paymentSystemNotInitialized || "Payment system is not initialized. Please refresh the page",
738
- blocking: !0
739
- }, !0), F.set(L, !1);
740
- return;
741
- }
742
- let n = await w(F.get(k), Object.fromEntries(Object.entries(F.get(A)).filter(([e, t]) => t > 0)), Object.keys(F.get(j)).length > 0 ? Object.fromEntries(Object.entries(F.get(j)).filter(([, e]) => parseFloat(String(e)) > 0).map(([e, t]) => [parseInt(e, 10), parseFloat(String(t))])) : void 0, {
743
- firstName: e.firstName,
744
- lastName: e.lastName,
745
- email: e.email,
746
- phone: e.phone,
747
- questionAnswer: e.questionAnswer,
748
- mailingList: e.keepMeUpdated
749
- }, d());
750
- if (n.refusal) {
751
- F.set(H, { message: n.refusal }, !0), F.set(L, !1);
752
- return;
753
- }
754
- if (n.clientSecret && n.clientSecret !== F.get(B)) {
755
- F.set(B, n.clientSecret, !0), F.set(H, { message: u().paymentReinitializing || "Updating your total. Please wait a moment and try again" }, !0), F.set(L, !1);
756
- return;
757
- }
758
- let { error: a } = await F.get(V).submit();
759
- if (a) {
760
- let e = Z(a, u());
761
- F.set(H, {
762
- message: e.message,
763
- suggestion: e.suggestion
764
- }, !0), F.set(L, !1);
765
- return;
766
- }
767
- let o = await F.get(z).confirmPayment({
768
- elements: F.get(V),
769
- redirect: "if_required",
770
- confirmParams: { return_url: `${b()}${ie(F.get(O)?.id || F.get(O)?.eventID || F.get(p), F.get(O)?.slug || F.get(y) || "", {
771
- orderId: F.get(k),
772
- ticketCount: Object.values(F.get(A)).reduce((e, t) => e + (Number(t) || 0), 0)
773
- })}` }
774
- });
775
- if (o.error) {
776
- let e = Z(o.error, u());
777
- F.set(H, {
778
- message: e.message,
779
- suggestion: e.suggestion
780
- }, !0), F.set(L, !1);
781
- return;
782
- }
783
- let s = {
784
- id: F.get(k),
785
- paymentIntentId: o.paymentIntent.id,
786
- tickets: F.get(A),
787
- firstName: e.firstName,
788
- lastName: e.lastName,
789
- email: e.email,
790
- phone: e.phone,
791
- questionAnswer: e.questionAnswer,
792
- paymentMethod: "credit-card",
793
- mailingList: e.keepMeUpdated,
794
- saleType: "online"
795
- }, c = await x(F.get(k), s, d());
796
- if (c?.eventCanceled || c?.eventPostponed) {
797
- F.set(W, c.eventCanceled ? "canceled" : "postponed", !0), F.set(H, null);
798
- return;
799
- }
800
- if (c?.status === "Payment succeeded") {
801
- ye(F.get(k), e.email);
802
- let n = {
803
- orderId: F.get(k),
804
- eventId: F.get(O)?.id || F.get(O)?.eventID || null,
805
- event: F.get(O) || null,
806
- venueId: r() || F.get(O)?.venueId || null,
807
- organizationId: i() || F.get(O)?.organizationId || null,
808
- ...Ee()
809
- };
810
- t.onNavigateToSuccess && t.onNavigateToSuccess(n);
811
- } else c?.status === "Payment amount does not match the total price" ? F.set(H, { message: u().paymentAmountMismatch || "Payment amount mismatch. Please refresh and try again" }, !0) : F.set(H, { message: u().paymentValidationFailed || "Payment validation failed. Please try again" }, !0);
812
- } catch (e) {
813
- $.error("Payment execution error:", e);
814
- let t = Z(e, u());
815
- F.set(H, {
816
- message: t.message,
817
- suggestion: t.suggestion
818
- }, !0);
819
- } finally {
820
- F.set(L, !1);
821
- }
822
- }
823
- }
824
- async function Ne(e) {
825
- try {
826
- let n = await oe(F.get(k), {
827
- firstName: e.firstName,
828
- lastName: e.lastName,
829
- email: e.email,
830
- phoneNumber: e.phone || null,
831
- questionAnswer: e.questionAnswer,
832
- mailingList: e.keepMeUpdated
833
- }, d());
834
- if (n?.success) {
835
- ye(n.orderId || F.get(k), e.email);
836
- let a = {
837
- orderId: n.orderId || F.get(k),
838
- eventId: F.get(O)?.id || F.get(O)?.eventID || null,
839
- event: F.get(O) || null,
840
- venueId: r() || F.get(O)?.venueId || null,
841
- organizationId: i() || F.get(O)?.organizationId || null,
842
- paymentType: "gift_card_only",
843
- ...Ee()
844
- };
845
- t.onNavigateToSuccess && t.onNavigateToSuccess(a);
846
- } else F.set(H, { message: n?.error || u().failedToCompleteOrder || "Failed to complete order. Please try again" }, !0);
847
- } catch (e) {
848
- $.error("Gift card payment error:", e);
849
- let t = Z(e, u());
850
- F.set(H, {
851
- message: t.message,
852
- suggestion: t.suggestion
853
- }, !0);
854
- } finally {
855
- F.set(L, !1);
856
- }
857
- }
858
- async function Fe(e) {
859
- try {
860
- let n = Object.fromEntries(Object.entries(F.get(A)).filter(([e, t]) => t > 0)), a = Object.fromEntries(Object.entries(F.get(j)).filter(([, e]) => parseFloat(String(e)) > 0).map(([e, t]) => [parseInt(e, 10), parseFloat(String(t))])), o = await E(F.get(k), n, Object.keys(a).length > 0 ? a : void 0, {
861
- firstName: e.firstName,
862
- lastName: e.lastName,
863
- email: e.email,
864
- phone: e.phone,
865
- questionAnswer: e.questionAnswer,
866
- mailingList: e.keepMeUpdated
867
- }, d());
868
- if (o?.requires_stripe !== !1 && o?.payment_type !== "free" || o?.order_finalized === !1) {
869
- F.set(H, { message: u().failedToCompleteOrder || "Failed to complete order. Please try again" }, !0);
870
- return;
871
- }
872
- F.set(B, "free"), ye(F.get(k), e.email);
873
- let s = {
874
- orderId: F.get(k),
875
- eventId: F.get(O)?.id || F.get(O)?.eventID || null,
876
- event: F.get(O) || null,
877
- venueId: r() || F.get(O)?.venueId || null,
878
- organizationId: i() || F.get(O)?.organizationId || null,
879
- paymentType: "free",
880
- ...Ee()
881
- };
882
- t.onNavigateToSuccess && t.onNavigateToSuccess(s);
883
- } catch (e) {
884
- $.error("Free order completion error:", e);
885
- let t = Z(e, u());
886
- F.set(H, {
887
- message: t.message,
888
- suggestion: t.suggestion
889
- }, !0);
890
- } finally {
891
- F.set(L, !1);
892
- }
893
- }
894
- async function Ie(e) {
895
- if (F.set(K, e, !0), F.get(q) && J && F.set(q, {
896
- ...F.get(q),
897
- serverTotals: te(J, e)
898
- }, !0), !e.requiresStripe) Y++, F.set(V, void 0), F.set(z, null), F.set(B, "");
899
- else if (F.get(k) && Object.keys(F.get(A)).length > 0) {
900
- F.set(R, !0);
901
- try {
902
- await X();
903
- } finally {
904
- F.set(R, !1);
905
- }
906
- }
907
- }
908
- async function Ve() {
909
- if (F.set(K, null), F.get(q) && J && F.set(q, {
910
- ...F.get(q),
911
- serverTotals: J
912
- }, !0), F.get(k) && Object.keys(F.get(A)).length > 0) {
913
- F.set(R, !0);
914
- try {
915
- await X();
916
- } finally {
917
- F.set(R, !1);
918
- }
919
- }
920
- }
921
- function He() {
922
- a() ? a()() : window.history.back();
923
- }
924
- function Ue() {
925
- a() ? a()() : window.history.back();
926
- }
927
- function We() {
928
- F.set(W, null), He();
929
- }
930
- async function Ge() {
931
- if (!F.get(k)) return null;
932
- try {
933
- let e = await C(F.get(k));
934
- return e.success ? {
935
- newExpiryTime: e.newExpiryTime,
936
- remainingExtensions: e.remainingExtensions
937
- } : ($.error("Failed to extend session:", e.error), null);
938
- } catch (e) {
939
- return $.error("Error extending checkout session:", e), null;
940
- }
941
- }
942
- var Ke = Be(), qe = F.first_child(Ke), Je = (e) => {
943
- {
944
- let t = (e) => {
945
- {
946
- let t = F.derived(() => F.get(L) || F.get(R)), n = F.derived(() => F.get(q)?.serverTotals?.total ?? 0), r = F.derived(() => F.get(q)?.serverTotals?.giftCardAmount ?? null);
947
- Pe(e, {
948
- get cartId() {
949
- return F.get(k);
950
- },
951
- onApplied: Ie,
952
- onRemoved: Ve,
953
- get disabled() {
954
- return F.get(t);
955
- },
956
- get owedTotal() {
957
- return F.get(n);
958
- },
959
- get serverGiftCardAmount() {
960
- return F.get(r);
961
- },
962
- get labels() {
963
- return u();
964
- }
965
- });
966
- }
967
- }, n = F.derived(() => F.get(H) ?? (F.get(U) ? { message: F.get(U) } : null));
968
- _e(e, {
969
- get config() {
970
- return F.get(q);
971
- },
972
- onPlaceOrder: Me,
973
- onBack: He,
974
- onRetryExpired: Ue,
975
- onExtendSession: Ge,
976
- get stripe() {
977
- return F.get(z);
978
- },
979
- get paymentIntent() {
980
- return F.get(B);
981
- },
982
- get serverTotalsUnavailable() {
983
- return F.get(Te);
984
- },
985
- get repricing() {
986
- return F.get(R);
987
- },
988
- get paymentError() {
989
- return F.get(n);
990
- },
991
- get labels() {
992
- return u();
993
- },
994
- get locale() {
995
- return d();
996
- },
997
- get elements() {
998
- return F.get(V);
999
- },
1000
- set elements(e) {
1001
- F.set(V, e, !0);
1002
- },
1003
- get eventEnded() {
1004
- return F.get(Se);
1005
- },
1006
- set eventEnded(e) {
1007
- F.set(Se, e, !0);
1008
- },
1009
- giftCard: t,
1010
- $$slots: { giftCard: !0 }
1011
- });
1012
- }
1013
- }, Ye = (e) => {
1014
- var t = Re(), n = F.child(t), r = F.child(n, !0);
1015
- F.reset(n), F.reset(t), F.template_effect(() => F.set_text(r, F.get(we))), F.append(e, t);
1016
- }, Xe = (e) => {
1017
- var t = ze(), n = F.child(t), r = F.child(n, !0);
1018
- F.reset(n), F.reset(t), F.template_effect(() => F.set_text(r, u().loadingSecurePaymentForm || "Loading secure payment form...")), F.append(e, t);
1019
- };
1020
- F.if(qe, (e) => {
1021
- F.get(q) ? e(Je) : F.get(Ce) ? e(Ye, 1) : e(Xe, -1);
1022
- });
1023
- var Ze = F.sibling(qe, 2), Qe = (e) => {
1024
- Le(e, {
1025
- open: !0,
1026
- get reason() {
1027
- return F.get(W);
1028
- },
1029
- onBackToEvents: We,
1030
- get labels() {
1031
- return u();
1032
- }
1033
- });
1034
- };
1035
- F.if(Ze, (e) => {
1036
- F.get(G) && e(Qe);
1037
- }), F.append(e, Ke), F.pop();
1038
- }
1039
- //#endregion
1040
- export { Ve as default };