@getmicdrop/venue-calendar 4.3.56 → 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 (119) 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-BLHPU4ry.js → CalendarFoundryView-apVO50Ap.js} +1602 -1535
  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-CyN-mQCP.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-CkKwCXQj.js → CollectionView-LFCwHiPj.js} +13 -13
  14. package/dist/{Event-BfWRG4dm.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-DPxl9JCm.js → RecommendationsRail-Cb_c4ohM.js} +50 -50
  20. package/dist/ScarcityBadge-14VWzOL2.js +145 -0
  21. package/dist/{SeriesPage-B7z1yoAK.js → SeriesPage-DeALgf5s.js} +3 -3
  22. package/dist/Spinner-CW1KZMkc.js +19 -0
  23. package/dist/{Success-BzuOliUV.js → Success-Dcd9bWCn.js} +94 -95
  24. package/dist/{TagIcon-DwWcRiXS.js → TagIcon-C8DU69Jv.js} +1 -1
  25. package/dist/{ViewTicketsEmbed-BE8iTUF9.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 +226 -178
  31. package/dist/api/cart-addons.d.ts +61 -0
  32. package/dist/api/index.d.ts +4 -2
  33. package/dist/api/orders.d.ts +48 -0
  34. package/dist/api/transformers/venue.d.ts +14 -1
  35. package/dist/{api-BsBSvoNj.js → api-Br260RVo.js} +206 -143
  36. package/dist/{constants-CJyMUKEX.js → constants-DWS8C09a.js} +4 -0
  37. package/dist/{copyToClipboard-CL9BmJA4.js → copyToClipboard-C_fcBdn4.js} +1 -1
  38. package/dist/{createErrorGate.svelte-DwTTmYou.js → createErrorGate.svelte-jZMaO7KA.js} +1 -1
  39. package/dist/{de-CFh1o4IO.js → de-BEfuIgIj.js} +4 -0
  40. package/dist/{defaultLabels-BaVkGLw4.js → defaultLabels-CqkC-rOG.js} +530 -427
  41. package/dist/{defaults-BHXY6s4i.js → defaults-BLhQWNFt.js} +2 -2
  42. package/dist/{es-By1tBWcL.js → es-Bd4g_HxR.js} +4 -0
  43. package/dist/{event-xgg-eiTq.js → event-DaWMe2IV.js} +1 -1
  44. package/dist/{event-transform-oLpmof1H.js → event-transform-WnvEyzV-.js} +19 -19
  45. package/dist/{eventStatusStream-BIxriEut.js → eventStatusStream-DgWemzCE.js} +5 -5
  46. package/dist/{fr-BF6a7cw7.js → fr-Blc79wvV.js} +4 -0
  47. package/dist/{href-DO3HKeJp.js → href-x-W1j8EY.js} +2 -2
  48. package/dist/{i18n-8EWq-WHv.js → i18n-DFWp9lQ_.js} +2 -2
  49. package/dist/{i18n-JpkI3lvS.js → i18n-DgjCm8g6.js} +93 -93
  50. package/dist/{id-Lo_q281j.js → id-DzzsiF4d.js} +4 -0
  51. package/dist/{it-CQcRIzL4.js → it-B4zXRsxu.js} +4 -0
  52. package/dist/{ja-DOzvvYpK.js → ja-eT4_QPKd.js} +4 -0
  53. package/dist/{ko-b-vWxFpt.js → ko-B8Fmrldj.js} +4 -0
  54. package/dist/locales/4.3.58/flow/de.js +1 -0
  55. package/dist/locales/4.3.58/flow/es.js +1 -0
  56. package/dist/locales/4.3.58/flow/fr.js +1 -0
  57. package/dist/locales/4.3.58/flow/id.js +1 -0
  58. package/dist/locales/4.3.58/flow/it.js +1 -0
  59. package/dist/locales/4.3.58/flow/ja.js +1 -0
  60. package/dist/locales/4.3.58/flow/ko.js +1 -0
  61. package/dist/locales/4.3.58/flow/nl.js +1 -0
  62. package/dist/locales/4.3.58/flow/pl.js +1 -0
  63. package/dist/locales/4.3.58/flow/pt-br.js +1 -0
  64. package/dist/locales/4.3.58/flow/tr.js +1 -0
  65. package/dist/locales/4.3.58/flow/zh.js +1 -0
  66. package/dist/{nl-Dazc9kaV.js → nl-Dnug8LYt.js} +4 -0
  67. package/dist/{orders--luy9Lyn.js → orders-DlyjunUM.js} +60 -44
  68. package/dist/{pixels-FefBmhJt.js → pixels-n1zu1IhF.js} +9 -9
  69. package/dist/{pl-tSyy-lx_.js → pl-C3XxoYWF.js} +4 -0
  70. package/dist/{pt-br-BxzrK97M.js → pt-br-Y40SBe4b.js} +4 -0
  71. package/dist/{scarcity-CR1Pa81F.js → scarcity-KJNxIMxj.js} +100 -100
  72. package/dist/{serverTotals-DeOPPRj6.js → serverTotals-Cb7pt5Z-.js} +8 -8
  73. package/dist/{showcase-state-options-BGmvUaQ_.js → showcase-state-options-Ce1_tYvH.js} +1 -1
  74. package/dist/{to-event-card-props-DLOxO2oP.js → to-event-card-props-KoNvp_D9.js} +15 -16
  75. package/dist/{tr-DhAMB3UQ.js → tr-2zIJ-vq2.js} +4 -0
  76. package/dist/types/index.d.ts +14 -0
  77. package/dist/{utils-BFaSYuNA.js → utils-VHFV7pBb.js} +69 -69
  78. package/dist/{venue-CBos8YTa.js → venue-BBoZBuhu.js} +1 -0
  79. package/dist/venue-calendar.css +1 -1
  80. package/dist/venue-calendar.es.js +223 -224
  81. package/dist/venue-calendar.iife.js +31 -31
  82. package/dist/venue-calendar.umd.js +49 -49
  83. package/dist/{zh-C2-VLP_R.js → zh-vNYvCXO7.js} +4 -0
  84. package/package.json +220 -220
  85. package/dist/Badge-BsWJrQII.js +0 -108
  86. package/dist/CartView-DTXoQTOC.js +0 -2294
  87. package/dist/Checkout-B8ZkBxF_.js +0 -1023
  88. package/dist/Checkout-QIxYrkeK.js +0 -1832
  89. package/dist/ClockIcon-C7nkbmvv.js +0 -25
  90. package/dist/EventPage-dCTHvk7P.js +0 -1201
  91. package/dist/ScarcityBadge-BXn6HM_K.js +0 -116
  92. package/dist/Spinner-6UtYyNcF.js +0 -16
  93. package/dist/liveAnnouncer-D3xVL7qA.js +0 -32
  94. package/dist/locales/4.3.56/flow/de.js +0 -1
  95. package/dist/locales/4.3.56/flow/es.js +0 -1
  96. package/dist/locales/4.3.56/flow/fr.js +0 -1
  97. package/dist/locales/4.3.56/flow/id.js +0 -1
  98. package/dist/locales/4.3.56/flow/it.js +0 -1
  99. package/dist/locales/4.3.56/flow/ja.js +0 -1
  100. package/dist/locales/4.3.56/flow/ko.js +0 -1
  101. package/dist/locales/4.3.56/flow/nl.js +0 -1
  102. package/dist/locales/4.3.56/flow/pl.js +0 -1
  103. package/dist/locales/4.3.56/flow/pt-br.js +0 -1
  104. package/dist/locales/4.3.56/flow/tr.js +0 -1
  105. package/dist/locales/4.3.56/flow/zh.js +0 -1
  106. package/dist/order-totals-5X0jD77w.js +0 -151
  107. package/dist/promo-BNwWtZjP.js +0 -37
  108. /package/dist/locales/{4.3.56 → 4.3.58}/main/de.js +0 -0
  109. /package/dist/locales/{4.3.56 → 4.3.58}/main/es.js +0 -0
  110. /package/dist/locales/{4.3.56 → 4.3.58}/main/fr.js +0 -0
  111. /package/dist/locales/{4.3.56 → 4.3.58}/main/id.js +0 -0
  112. /package/dist/locales/{4.3.56 → 4.3.58}/main/it.js +0 -0
  113. /package/dist/locales/{4.3.56 → 4.3.58}/main/ja.js +0 -0
  114. /package/dist/locales/{4.3.56 → 4.3.58}/main/ko.js +0 -0
  115. /package/dist/locales/{4.3.56 → 4.3.58}/main/nl.js +0 -0
  116. /package/dist/locales/{4.3.56 → 4.3.58}/main/pl.js +0 -0
  117. /package/dist/locales/{4.3.56 → 4.3.58}/main/pt-br.js +0 -0
  118. /package/dist/locales/{4.3.56 → 4.3.58}/main/tr.js +0 -0
  119. /package/dist/locales/{4.3.56 → 4.3.58}/main/zh.js +0 -0
@@ -1,1023 +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 { U as b, f as x, i as S, n as C, r as ee, s as w, t as T } from "./orders--luy9Lyn.js";
11
- import { n as E, t as te } 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 ne, d as re, k as ie, o as M, s as ae } from "./api-BsBSvoNj.js";
14
- import { t as oe } from "./event-transform-oLpmof1H.js";
15
- import { t as N } from "./venue-CBos8YTa.js";
16
- import { b as se, g as ce, h as le, l as ue, r as de, v as fe } from "./utils-BFaSYuNA.js";
17
- import { a as pe, n as me } from "./promo-BNwWtZjP.js";
18
- import { r as he } from "./order-totals-5X0jD77w.js";
19
- import ge, { n as _e, t as ve } from "./Checkout-QIxYrkeK.js";
20
- import { n as ye } from "./buyerEmail-BfCq-gDt.js";
21
- import "svelte/internal/disclose-version";
22
- import * as P from "svelte/internal/client";
23
- import { onMount as be } from "svelte";
24
- //#region node_modules/@stripe/stripe-js/dist/index.mjs
25
- function F(e) {
26
- "@babel/helpers - typeof";
27
- return F = 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
- }, F(e);
32
- }
33
- var xe = "dahlia", I = function(e) {
34
- return e === 3 ? "v3" : e;
35
- }, L = "https://js.stripe.com", R = `${L}/${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^="${L}"]`), t = 0; t < e.length; t++) {
39
- var n = e[t];
40
- if (H(n.src)) return n;
41
- }
42
- return null;
43
- }, Se = 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
- }, Ce = 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
- }, we = 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 = Se(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 = Se(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
- }, Te = 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 ${F(r)} instead.`);
93
- var i = r.match(/^pk_test/), a = I(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 Ce(s, n), s;
97
- }, Y, X = !1, Ee = function() {
98
- return Y || (Y = we(null).catch(function(e) {
99
- return Y = null, Promise.reject(e);
100
- }), Y);
101
- };
102
- Promise.resolve().then(function() {
103
- return Ee();
104
- }).catch(function(e) {
105
- X || console.warn(e);
106
- });
107
- var De = function() {
108
- var e = [...arguments];
109
- X = !0;
110
- var t = Date.now();
111
- return Ee().then(function(n) {
112
- return Te(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"), Oe = P.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>"), ke = P.from_html("<div class=\"applied-card mb-3 svelte-emw0hd\"><div><!> <span> </span></div></div>"), Ae = P.from_html("<div class=\"flex items-center gap-1.5 mt-2 type-body text-accent-danger\"><!> <span> </span></div>"), je = P.from_html("<div class=\"input-section svelte-emw0hd\"><div class=\"flex gap-2\"><input type=\"text\" name=\"giftCardCode\" autocomplete=\"off\" autocapitalize=\"characters\"/> <!></div> <!></div>"), Me = P.from_html("<div class=\"mb-4\"><!> <!> <button type=\"button\"><!> <span> </span> <span class=\"toggle-indicator svelte-emw0hd\"> </span></button> <!></div>");
194
- function Ne(e, i) {
195
- P.push(i, !0);
196
- let o = P.prop(i, "onApplied", 3, () => {}), s = P.prop(i, "onRemoved", 3, () => {}), c = P.prop(i, "disabled", 3, !1), m = P.prop(i, "labels", 3, _), h = P.prop(i, "owedTotal", 3, 0), g = P.prop(i, "serverGiftCardAmount", 3, null), v = P.state(""), b = P.state(!1), x = P.state(""), S = P.state(P.proxy([])), C = P.state(!1), w = P.state(0);
197
- P.user_effect(() => {
198
- if (!i.cartId || P.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 && (P.set(S, n.map((e) => ({
204
- giftCardId: e.giftCardId,
205
- code: e.maskedCode,
206
- giftCardAmount: e.amount
207
- })), !0), P.set(w, P.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 = P.derived(() => P.get(S).reduce((e, t) => e + (t.giftCardAmount || 0), 0)), E = P.derived(() => Math.max(0, P.get(w) - P.get(T))), te = P.derived(() => P.get(S).length > 0 && P.get(E) <= 0);
213
- function D() {
214
- if (P.get(S).length === 0) {
215
- s()();
216
- return;
217
- }
218
- o()({
219
- code: P.get(S).map((e) => e.code).join(", "),
220
- giftCardAmount: P.get(T),
221
- stripeAmount: P.get(E),
222
- requiresStripe: P.get(E) > 0,
223
- paymentType: P.get(E) > 0 ? "split" : "gift_card_only",
224
- orderTotal: P.get(w)
225
- });
226
- }
227
- async function O() {
228
- let e = P.get(v).trim().toUpperCase();
229
- if (!(!e || P.get(b) || !i.cartId)) {
230
- if (P.get(S).some((t) => t.code === e)) {
231
- P.set(x, m().giftCardAlreadyApplied || "That gift card is already applied", !0);
232
- return;
233
- }
234
- P.set(b, !0), P.set(x, "");
235
- try {
236
- let t = await M(i.cartId, e);
237
- t.valid ? (P.set(S, [...P.get(S), {
238
- code: t.giftCardCode || e,
239
- giftCardAmount: t.giftCardAmount || 0
240
- }], !0), P.set(w, P.get(T) + (t.stripeAmount || 0)), P.set(v, ""), P.set(C, !1), D()) : P.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
- P.set(x, t || m().failedToApplyGiftCard || "Failed to apply gift card. Please try again", !0);
245
- }
246
- P.set(b, !1);
247
- }
248
- }
249
- async function k(e) {
250
- if (!(P.get(b) || !i.cartId)) {
251
- P.set(b, !0), P.set(x, "");
252
- try {
253
- let t = P.get(S).find((t) => t.code === e), n = await ne(i.cartId, t?.giftCardId ? { giftCardId: t.giftCardId } : { code: e });
254
- n.success !== !1 && !n.error ? (P.set(S, P.get(S).filter((t) => t.code !== e), !0), typeof n.remainingTotal == "number" && P.set(w, P.get(T) + n.remainingTotal), D()) : P.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), P.set(x, m().failedToRemoveGiftCard || "Failed to remove gift card. Please try again", !0);
257
- }
258
- P.set(b, !1);
259
- }
260
- }
261
- function A(e) {
262
- e.key === "Enter" && !P.get(b) && O();
263
- }
264
- function j() {
265
- P.set(C, !P.get(C)), P.get(C) || (P.set(v, ""), P.set(x, ""));
266
- }
267
- var re = Me(), ie = P.child(re);
268
- P.each(ie, 17, () => P.get(S), (e) => e.code, (e, t) => {
269
- var n = Oe(), i = P.child(n), o = P.child(i), s = P.child(o);
270
- r(s, { size: "16" }), P.reset(o);
271
- var u = P.sibling(o, 2), d = P.child(u), h = P.child(d, !0);
272
- P.reset(d);
273
- var g = P.sibling(d, 2), _ = P.child(g, !0);
274
- P.reset(g), P.reset(u);
275
- var v = P.sibling(u, 2), x = P.child(v);
276
- P.reset(v);
277
- var S = P.sibling(v, 2);
278
- {
279
- let e = P.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: () => k(P.get(t).code),
285
- get loading() {
286
- return P.get(b);
287
- },
288
- get disabled() {
289
- return c();
290
- },
291
- get "aria-label"() {
292
- return P.get(e);
293
- },
294
- children: (e, t) => {
295
- a(e, { size: "16" });
296
- },
297
- $$slots: { default: !0 }
298
- });
299
- }
300
- P.reset(i), P.reset(n), P.template_effect((e) => {
301
- P.set_text(h, m().giftCardApplied || "Gift card applied"), P.set_text(_, P.get(t).code), P.set_text(x, `-${e ?? ""}`);
302
- }, [() => l(P.get(t).giftCardAmount)]), P.transition(3, n, () => f, () => ({ duration: p.fast })), P.append(e, n);
303
- });
304
- var ae = P.sibling(ie, 2), oe = (e) => {
305
- var i = ke(), a = P.child(i), o = P.child(a);
306
- r(o, { size: "16" });
307
- var s = P.sibling(o, 2), c = P.child(s, !0);
308
- P.reset(s), P.reset(a), P.reset(i), P.template_effect(() => {
309
- P.set_class(a, 1, `full-coverage-badge ${t.caption ?? ""} ${n.emphasis ?? ""}`, "svelte-emw0hd"), P.set_text(c, m().fullyCoveredByGiftCard || "Fully covered by gift card");
310
- }), P.append(e, i);
311
- };
312
- P.if(ae, (e) => {
313
- P.get(te) && e(oe);
314
- });
315
- var N = P.sibling(ae, 2), se = P.child(N);
316
- u(se, {
317
- size: "20",
318
- class: "gift-icon"
319
- });
320
- var ce = P.sibling(se, 2), le = P.child(ce, !0);
321
- P.reset(ce);
322
- var ue = P.sibling(ce, 2), de = P.child(ue, !0);
323
- P.reset(ue), P.reset(N);
324
- var fe = P.sibling(N, 2), pe = (e) => {
325
- var n = je(), r = P.child(n), i = P.child(r);
326
- P.remove_input_defaults(i);
327
- let a;
328
- var o = P.sibling(i, 2);
329
- {
330
- let e = P.derived(() => !P.get(v).trim() || c());
331
- y(o, {
332
- variant: "default",
333
- size: "sm",
334
- class: "min-w-16 shrink-0",
335
- onclick: O,
336
- get loading() {
337
- return P.get(b);
338
- },
339
- get disabled() {
340
- return P.get(e);
341
- },
342
- children: (e, t) => {
343
- P.next();
344
- var n = P.text();
345
- P.template_effect(() => P.set_text(n, m().apply || "Apply")), P.append(e, n);
346
- },
347
- $$slots: { default: !0 }
348
- });
349
- }
350
- P.reset(r);
351
- var s = P.sibling(r, 2), l = (e) => {
352
- var t = Ae(), n = P.child(t);
353
- d(n, { size: "16" });
354
- var r = P.sibling(n, 2), i = P.child(r, !0);
355
- P.reset(r), P.reset(t), P.template_effect(() => P.set_text(i, P.get(x))), P.transition(3, t, () => f, () => ({ duration: p.micro })), P.append(e, t);
356
- };
357
- P.if(s, (e) => {
358
- P.get(x) && e(l);
359
- }), P.reset(n), P.template_effect(() => {
360
- P.set_attribute(i, "aria-label", m().enterGiftCardCode || "Enter gift card code"), P.set_attribute(i, "placeholder", m().enterGiftCardCode || "Enter gift card code"), i.disabled = P.get(b) || c(), a = P.set_class(i, 1, `gift-input ${t.body ?? ""}`, "svelte-emw0hd", a, { "has-error": !!P.get(x) });
361
- }), P.delegated("keydown", i, A), P.bind_value(i, () => P.get(v), (e) => P.set(v, e)), P.transition(3, n, () => f, () => ({ duration: p.fast })), P.append(e, n);
362
- };
363
- P.if(fe, (e) => {
364
- P.get(C) && e(pe);
365
- }), P.reset(re), P.template_effect(() => {
366
- P.set_class(N, 1, `gift-card-toggle ${t.label ?? ""}`, "svelte-emw0hd"), N.disabled = c(), P.set_attribute(N, "aria-expanded", P.get(C)), P.set_text(le, P.get(S).length > 0 ? m().addAnotherGiftCard || "Add another gift card" : m().haveAGiftCard || "Have a gift card?"), P.set_text(de, P.get(C) ? "-" : "+");
367
- }), P.delegated("click", N, j), P.append(e, re), P.pop();
368
- }
369
- P.delegate(["click", "keydown"]);
370
- //#endregion
371
- //#region src/components/Modals/EventUnavailableModal.svelte
372
- var Pe = P.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>"), Fe = P.from_html("<!> <!>", 1);
373
- function Ie(e, n) {
374
- P.push(n, !0);
375
- let r = P.prop(n, "open", 15, !1), a = P.prop(n, "onBackToEvents", 3, () => {}), s = P.prop(n, "labels", 3, _), c = P.derived(() => n.reason === "canceled"), l = P.derived(() => P.get(c) ? s().eventCanceledTitle || "Event canceled" : s().eventPostponedTitle || "Event postponed"), u = P.derived(() => P.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 = P.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 = Fe(), s = P.first_child(r);
388
- O(s, {});
389
- var f = P.sibling(s, 2);
390
- A(f, {
391
- children: (e, n) => {
392
- var r = Fe(), s = P.first_child(r);
393
- k(s, {
394
- children: (e, n) => {
395
- var r = Pe(), a = P.child(r), s = P.child(a), d = (e) => {
396
- o(e, { size: "32" });
397
- }, f = (e) => {
398
- i(e, { size: "32" });
399
- };
400
- P.if(s, (e) => {
401
- P.get(c) ? e(d) : e(f, -1);
402
- }), P.reset(a);
403
- var p = P.sibling(a, 2), m = P.child(p, !0);
404
- P.reset(p);
405
- var h = P.sibling(p, 2), g = P.child(h, !0);
406
- P.reset(h), P.reset(r), P.template_effect(() => {
407
- P.set_class(a, 1, `w-16 h-16 rounded-full flex items-center justify-center mb-4 ${P.get(c) ? "bg-accent-danger/10 text-accent-danger" : "bg-accent-warning/10 text-accent-warning"}`), P.set_class(p, 1, `mb-2 ${t.heading ?? ""}`), P.set_text(m, P.get(l)), P.set_text(g, P.get(u));
408
- }), P.append(e, r);
409
- },
410
- $$slots: { default: !0 }
411
- });
412
- var f = P.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 P.get(d);
423
- },
424
- children: (e, t) => {
425
- P.next();
426
- var n = P.text();
427
- P.template_effect(() => P.set_text(n, P.get(d))), P.append(e, n);
428
- },
429
- $$slots: { default: !0 }
430
- });
431
- },
432
- $$slots: { default: !0 }
433
- }), P.append(e, r);
434
- },
435
- $$slots: { default: !0 }
436
- }), P.append(e, r);
437
- },
438
- $$slots: { default: !0 }
439
- }), P.pop();
440
- }
441
- //#endregion
442
- //#region src/components/Views/Checkout.svelte
443
- var $ = e("Checkout"), Le = P.from_html("<div class=\"p-8 text-center\"><p class=\"text-accent-danger\"> </p></div>"), Re = P.from_html("<div class=\"p-8 text-center\"><p class=\"tone-muted\"> </p></div>"), ze = P.from_html("<!> <!>", 1);
444
- function Be(e, t) {
445
- P.push(t, !0);
446
- let n = P.prop(t, "availableTickets", 23, () => []);
447
- P.prop(t, "value", 3, "");
448
- let r = P.prop(t, "venueId", 3, ""), i = P.prop(t, "organizationId", 3, ""), a = P.prop(t, "onNavigateBack", 3, void 0), o = P.prop(t, "initialError", 3, void 0), l = P.prop(t, "widgetId", 3, null), u = P.prop(t, "labels", 3, _), d = P.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
- "questionPrompt"
457
- ]) e[n] !== void 0 && (t[n] = e[n]);
458
- return t;
459
- }
460
- let p = P.derived(() => (t.data || {}).id);
461
- P.derived(() => (t.data || {}).orgSlug);
462
- let y = P.derived(() => (t.data || {}).slug), ee = P.derived(() => (t.data || {}).event), D = P.derived(() => N(f(P.get(ee)))), O = P.derived(() => P.get(ee) ? {
463
- ...oe(P.get(ee)),
464
- ...P.get(D)
465
- } : t.data && (t.data.id || P.get(p)) ? {
466
- id: t.data.id || P.get(p),
467
- eventID: t.data.id || P.get(p),
468
- venueID: t.data.venueID ?? t.data.venueId ?? null,
469
- venueId: t.data.venueId ?? t.data.venueID ?? null,
470
- eventTicketingType: 0,
471
- ticketType: 0,
472
- availableTickets: []
473
- } : null), k = P.state(""), A = P.state(P.proxy({})), j = P.state(P.proxy({})), ne = P.state(P.proxy({})), M = P.state(P.proxy([])), F = P.state(""), xe = P.state(0), I = P.state(!1), L = P.state(!1), R = P.state(!1), z = P.state(null), B = P.state(""), V = P.state(void 0), H = P.state(null), U = P.state(""), Se = P.state(!1), Ce = P.state(""), W = P.state(null), G = P.derived(() => P.get(W) !== null), K = P.state(null), q = P.state(null), J = null, we = P.state(!1);
474
- function Te() {
475
- return {
476
- value: J?.total ?? null,
477
- currency: J?.currency || "USD"
478
- };
479
- }
480
- be(async () => {
481
- if (P.set(k, _e(ue) || _e(ve.CHECKOUT_CARTID), !0), !P.get(k)) {
482
- P.set(Se, !0), P.set(Ce, u().noCheckoutSession || "No checkout session found. Please select tickets first", !0);
483
- return;
484
- }
485
- x(P.get(O)?.eventID || P.get(O)?.id || P.get(p), l(), r() || P.get(O)?.venueID || P.get(O)?.venueId || null, P.get(k));
486
- let e = P.get(O)?.eventID || P.get(O)?.id || P.get(p);
487
- try {
488
- let t = ce(e);
489
- P.set(A, t.quantities || {}, !0), P.set(j, t.donationAmounts || {}, !0), P.set(ne, t.addOnQuantities || {}, !0), P.set(F, t.promocode || "", !0), P.set(xe, t.promoDiscountAmount || 0, !0), P.set(M, t.tickets || [], !0);
490
- } catch (e) {
491
- $.error("Error loading checkout state:", e), P.set(A, {}, !0), P.set(ne, {}, !0), P.set(M, [], !0);
492
- }
493
- P.get(M).length > 0 && P.get(O) && (P.get(O).availableTickets = P.get(M), n(P.get(M)));
494
- let t = de(P.get(O)?.venueID || P.get(O)?.venueId || r()).then((e) => ({ data: e }), (e) => ({ error: e }));
495
- await (Object.keys(P.get(A)).length > 0 ? X() : null);
496
- let i = {
497
- serviceFeeCents: 0,
498
- serviceFeePercentage: 0,
499
- serviceFeeChargeType: "both",
500
- maxServiceFeeCents: 0,
501
- absorbServiceFee: !1,
502
- taxPercentage: 0
503
- };
504
- try {
505
- let e = await t;
506
- if ("error" in e) throw e.error;
507
- let n = e.data;
508
- i = {
509
- serviceFeeCents: Number(n?.serviceFeeCents == null ? 0 : n.serviceFeeCents),
510
- serviceFeePercentage: Number(n?.serviceFeePercentage ?? 0),
511
- serviceFeeChargeType: String(n?.serviceFeeChargeType ?? "both"),
512
- maxServiceFeeCents: Number(n?.maxServiceFeeCents == null ? 0 : n.maxServiceFeeCents),
513
- absorbServiceFee: n?.absorbServiceFee === !0,
514
- taxPercentage: Number(n?.taxPercentage ?? 0)
515
- };
516
- } catch (e) {
517
- $.error("Error fetching venue data:", e);
518
- }
519
- let a = [...Q(P.get(A), P.get(M), i), ...Oe(P.get(ne), P.get(O)?.addOns)], c = 900, d = "", f, m;
520
- if (P.get(k)) {
521
- let e = fe(P.get(k));
522
- if (e) {
523
- let t = Math.max(0, Math.floor((e - Date.now()) / 1e3));
524
- t > 0 && (c = t);
525
- }
526
- try {
527
- let e = await S(P.get(k));
528
- if (e.error || (e.remainingExtensions !== void 0 && (f = e.remainingExtensions), e.canExtend !== void 0 && (m = e.canExtend)), !e.error && e.expiresAt) {
529
- let t = v(e.expiresAt).getTime();
530
- c = Math.max(0, Math.floor((t - Date.now()) / 1e3)), d = e.expiresAt, se(P.get(k), t);
531
- }
532
- } catch {}
533
- }
534
- let h = _e(`checkout-promo-discount-type-${e}`), g = [];
535
- try {
536
- let t = _e(`checkout-promo-ticket-ids-${e}`), n = t ? JSON.parse(t) : [];
537
- Array.isArray(n) && (g = n);
538
- } catch {
539
- g = [];
540
- }
541
- let _ = s(a.filter((e) => me(g, e.ticketId)).reduce((e, t) => e + (t.subtotal == null ? 0 : t.subtotal), 0)), y = pe(_, P.get(xe), h);
542
- if (P.set(q, {
543
- event: Ee(P.get(O), i),
544
- lines: a,
545
- timerStart: c,
546
- ...d ? { deadlineAt: d } : {},
547
- ...f === void 0 ? {} : { remainingExtensions: f },
548
- ...m === void 0 ? {} : { canExtend: m },
549
- promoApplied: !!P.get(F),
550
- promoDiscount: y,
551
- forceExpired: !1,
552
- ...J ? { serverTotals: J } : {}
553
- }, !0), o()) {
554
- let e = Z(typeof o() == "object" ? o() : {
555
- code: "card_declined",
556
- message: "Your card was declined. Please try a different payment method."
557
- }, u());
558
- P.set(H, {
559
- message: e.message,
560
- suggestion: e.suggestion
561
- }, !0);
562
- }
563
- });
564
- let Y = 0;
565
- async function X() {
566
- let e = ++Y;
567
- if (!P.get(k)) {
568
- $.error("Missing cartId!");
569
- return;
570
- }
571
- let t = Object.fromEntries(Object.entries(P.get(A)).filter(([e, t]) => t > 0));
572
- try {
573
- let n = Object.fromEntries(Object.entries(P.get(j)).filter(([, e]) => parseFloat(String(e)) > 0).map(([e, t]) => [parseInt(e, 10), parseFloat(String(t))]));
574
- if (P.get(F)) {
575
- let t = await ie(P.get(k), P.get(F));
576
- if (e !== Y) return;
577
- t.success ? P.set(U, "") : ($.error("Failed to apply promo code to cart:", t.error), P.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}", P.get(F)), !0));
578
- }
579
- let r = await T(P.get(k), t, Object.keys(n).length > 0 ? n : void 0, void 0, d());
580
- if (e !== Y) return;
581
- if (!r) {
582
- P.set(H, { message: u().failedToCreatePaymentIntent || "Failed to create payment intent. Please try again" }, !0);
583
- return;
584
- }
585
- P.set(we, !1), J = te(r), P.get(q) && P.set(q, {
586
- ...P.get(q),
587
- serverTotals: J
588
- }, !0);
589
- let i = r;
590
- if (i.requires_stripe === !1 || i.payment_type === "free") {
591
- P.set(B, "free");
592
- return;
593
- }
594
- P.set(we, J === null);
595
- let a = r.stripe_publishable_key;
596
- if (!a) {
597
- $.error("No Stripe publishable key in payment intent response"), P.set(H, { message: u().paymentConfigError || "Payment configuration error. Please try again" }, !0);
598
- return;
599
- }
600
- let o = await De(a);
601
- if (e !== Y) return;
602
- P.set(z, o, !0), r.client_secret ? P.set(B, r.client_secret, !0) : P.set(H, { message: u().failedToInitPayment || "Failed to initialize payment. Please try again" }, !0);
603
- } catch (t) {
604
- if ($.error("Failed to initialize Stripe payment:", t), e !== Y) return;
605
- P.set(H, { message: t.message || u().failedToInitPayment || "Failed to initialize payment. Please try again" }, !0);
606
- }
607
- }
608
- function Ee(e, t) {
609
- return e ? {
610
- id: e.id || e.eventID,
611
- title: e.name || e.title || "",
612
- slug: e.slug || P.get(y) || "",
613
- description: e.description || "",
614
- date: e.date || "",
615
- startDateTime: e.startDateTime || "",
616
- endDateTime: e.endDateTime || "",
617
- doorsOpenTime: e.doorsOpenTime || "",
618
- timezone: e.timeZone || e.timezone || g(),
619
- imageUrl: e.imageUrl || e.image || "",
620
- ...P.get(D),
621
- venue: {
622
- id: e.venueID || e.venueId || 0,
623
- name: e.venueName || e.venue?.name || "",
624
- address: e.venueAddress || "",
625
- timezone: e.timeZone || e.timezone || g(),
626
- serviceFeePercentage: t.serviceFeePercentage,
627
- serviceFeeCents: t.serviceFeeCents,
628
- taxPercentage: t.taxPercentage,
629
- serviceFeeChargeType: t.serviceFeeChargeType,
630
- maxServiceFeeCents: t.maxServiceFeeCents,
631
- absorbServiceFee: t.absorbServiceFee
632
- },
633
- performers: e.performers || [],
634
- addOns: e.addOns || [],
635
- tickets: (e.availableTickets || []).map((e) => ({
636
- id: e.ID || e.id,
637
- name: e.name || "",
638
- description: e.description || "",
639
- price: c(e.price),
640
- fee: 0,
641
- quantityAvailable: e.quantityAvailable || 0,
642
- quantityTotal: e.quantityTotal || 0,
643
- minPerOrder: e.minPerOrder || 1,
644
- maxPerOrder: e.maxPerOrder || 10,
645
- status: "on_sale",
646
- isDonation: le(e),
647
- isHidden: !1
648
- })),
649
- faqs: e.faqs || [],
650
- status: "on_sale",
651
- isPasswordProtected: !1,
652
- isRegistrationEvent: e.eventTicketingType === 1 || e.ticketType === 1,
653
- totalTicketsRemaining: 100,
654
- totalTicketsCapacity: 100
655
- } : null;
656
- }
657
- function Q(e, t, n) {
658
- let r = [];
659
- for (let [i, a] of Object.entries(e)) {
660
- if (a <= 0) continue;
661
- let e = t.find((e) => String(e.ID) === i || String(e.id) === i);
662
- if (!e) continue;
663
- let o = le(e), c = e.price;
664
- if (!o && (c == null || !Number.isFinite(c))) {
665
- r.push({
666
- ticketId: parseInt(i),
667
- ticketName: e.name || "",
668
- quantity: a,
669
- unitPrice: null,
670
- fee: 0,
671
- subtotal: null,
672
- isDonation: !1
673
- });
674
- continue;
675
- }
676
- let l = c ?? 0, u = he(l, n, o);
677
- r.push({
678
- ticketId: parseInt(i),
679
- ticketName: e.name || "",
680
- quantity: a,
681
- unitPrice: l,
682
- fee: u,
683
- subtotal: s(l * a),
684
- isDonation: o
685
- });
686
- }
687
- return r;
688
- }
689
- function Oe(e, t) {
690
- let n = t || [], r = [];
691
- for (let [t, i] of Object.entries(e || {})) {
692
- if (!(i > 0)) continue;
693
- let e = n.find((e) => String(e.id) === String(t));
694
- if (!e) continue;
695
- let a = h(m(Number(e.priceCents) || 0));
696
- r.push({
697
- ticketId: parseInt(t, 10),
698
- lineKey: `a:${t}`,
699
- kind: "addon",
700
- ticketName: e.name || "",
701
- quantity: i,
702
- unitPrice: a,
703
- fee: 0,
704
- subtotal: s(a * i),
705
- isDonation: !1
706
- });
707
- }
708
- return r;
709
- }
710
- let ke = P.derived(() => Object.values(P.get(j)).some((e) => (Number(e) || 0) > 0)), Ae = P.derived(() => !P.get(ke) && (!P.get(q) || P.get(q).lines.every((e) => e.unitPrice === 0)));
711
- async function je(e) {
712
- if (!P.get(I)) {
713
- P.set(I, !0), P.set(H, null);
714
- try {
715
- if (P.get(R)) {
716
- P.set(H, { message: u().paymentReinitializing || "Updating your total. Please wait a moment and try again" }, !0);
717
- return;
718
- }
719
- if (P.get(K) && !P.get(K).requiresStripe) {
720
- await Me(e);
721
- return;
722
- }
723
- if (P.get(Ae) || P.get(B) === "free" || J?.total === 0) {
724
- await Pe(e);
725
- return;
726
- }
727
- if (!P.get(V)) {
728
- P.set(H, {
729
- message: u().paymentFormNotReady || "Payment form is not ready. Please wait a moment and try again",
730
- blocking: !0
731
- }, !0), P.set(I, !1);
732
- return;
733
- }
734
- if (!P.get(z)) {
735
- P.set(H, {
736
- message: u().paymentSystemNotInitialized || "Payment system is not initialized. Please refresh the page",
737
- blocking: !0
738
- }, !0), P.set(I, !1);
739
- return;
740
- }
741
- let { error: n } = await P.get(V).submit();
742
- if (n) {
743
- let e = Z(n, u());
744
- P.set(H, {
745
- message: e.message,
746
- suggestion: e.suggestion
747
- }, !0), P.set(I, !1);
748
- return;
749
- }
750
- let a = await P.get(z).confirmPayment({
751
- elements: P.get(V),
752
- redirect: "if_required",
753
- confirmParams: { return_url: `${b()}${re(P.get(O)?.id || P.get(O)?.eventID || P.get(p), P.get(O)?.slug || P.get(y) || "", {
754
- orderId: P.get(k),
755
- ticketCount: Object.values(P.get(A)).reduce((e, t) => e + (Number(t) || 0), 0)
756
- })}` }
757
- });
758
- if (a.error) {
759
- let e = Z(a.error, u());
760
- P.set(H, {
761
- message: e.message,
762
- suggestion: e.suggestion
763
- }, !0), P.set(I, !1);
764
- return;
765
- }
766
- let o = {
767
- id: P.get(k),
768
- paymentIntentId: a.paymentIntent.id,
769
- tickets: P.get(A),
770
- firstName: e.firstName,
771
- lastName: e.lastName,
772
- email: e.email,
773
- phone: e.phone,
774
- questionAnswer: e.questionAnswer,
775
- paymentMethod: "credit-card",
776
- mailingList: e.keepMeUpdated,
777
- saleType: "online"
778
- }, s = await w(P.get(k), o, d());
779
- if (s?.eventCanceled || s?.eventPostponed) {
780
- P.set(W, s.eventCanceled ? "canceled" : "postponed", !0), P.set(H, null);
781
- return;
782
- }
783
- if (s?.status === "Payment succeeded") {
784
- ye(P.get(k), e.email);
785
- let n = {
786
- orderId: P.get(k),
787
- eventId: P.get(O)?.id || P.get(O)?.eventID || null,
788
- event: P.get(O) || null,
789
- venueId: r() || P.get(O)?.venueId || null,
790
- organizationId: i() || P.get(O)?.organizationId || null,
791
- ...Te()
792
- };
793
- t.onNavigateToSuccess && t.onNavigateToSuccess(n);
794
- } else s?.status === "Payment amount does not match the total price" ? P.set(H, { message: u().paymentAmountMismatch || "Payment amount mismatch. Please refresh and try again" }, !0) : P.set(H, { message: u().paymentValidationFailed || "Payment validation failed. Please try again" }, !0);
795
- } catch (e) {
796
- $.error("Payment execution error:", e);
797
- let t = Z(e, u());
798
- P.set(H, {
799
- message: t.message,
800
- suggestion: t.suggestion
801
- }, !0);
802
- } finally {
803
- P.set(I, !1);
804
- }
805
- }
806
- }
807
- async function Me(e) {
808
- try {
809
- let n = await ae(P.get(k), {
810
- firstName: e.firstName,
811
- lastName: e.lastName,
812
- email: e.email,
813
- phoneNumber: e.phone || null,
814
- questionAnswer: e.questionAnswer,
815
- mailingList: e.keepMeUpdated
816
- }, d());
817
- if (n?.success) {
818
- ye(n.orderId || P.get(k), e.email);
819
- let a = {
820
- orderId: n.orderId || P.get(k),
821
- eventId: P.get(O)?.id || P.get(O)?.eventID || null,
822
- event: P.get(O) || null,
823
- venueId: r() || P.get(O)?.venueId || null,
824
- organizationId: i() || P.get(O)?.organizationId || null,
825
- paymentType: "gift_card_only",
826
- ...Te()
827
- };
828
- t.onNavigateToSuccess && t.onNavigateToSuccess(a);
829
- } else P.set(H, { message: n?.error || u().failedToCompleteOrder || "Failed to complete order. Please try again" }, !0);
830
- } catch (e) {
831
- $.error("Gift card payment error:", e);
832
- let t = Z(e, u());
833
- P.set(H, {
834
- message: t.message,
835
- suggestion: t.suggestion
836
- }, !0);
837
- } finally {
838
- P.set(I, !1);
839
- }
840
- }
841
- async function Pe(e) {
842
- try {
843
- let n = Object.fromEntries(Object.entries(P.get(A)).filter(([e, t]) => t > 0)), a = Object.fromEntries(Object.entries(P.get(j)).filter(([, e]) => parseFloat(String(e)) > 0).map(([e, t]) => [parseInt(e, 10), parseFloat(String(t))])), o = await T(P.get(k), n, Object.keys(a).length > 0 ? a : void 0, {
844
- firstName: e.firstName,
845
- lastName: e.lastName,
846
- email: e.email,
847
- phone: e.phone,
848
- questionAnswer: e.questionAnswer,
849
- mailingList: e.keepMeUpdated
850
- }, d());
851
- if (o?.requires_stripe !== !1 && o?.payment_type !== "free" || o?.order_finalized === !1) {
852
- P.set(H, { message: u().failedToCompleteOrder || "Failed to complete order. Please try again" }, !0);
853
- return;
854
- }
855
- P.set(B, "free"), ye(P.get(k), e.email);
856
- let s = {
857
- orderId: P.get(k),
858
- eventId: P.get(O)?.id || P.get(O)?.eventID || null,
859
- event: P.get(O) || null,
860
- venueId: r() || P.get(O)?.venueId || null,
861
- organizationId: i() || P.get(O)?.organizationId || null,
862
- paymentType: "free",
863
- ...Te()
864
- };
865
- t.onNavigateToSuccess && t.onNavigateToSuccess(s);
866
- } catch (e) {
867
- $.error("Free order completion error:", e);
868
- let t = Z(e, u());
869
- P.set(H, {
870
- message: t.message,
871
- suggestion: t.suggestion
872
- }, !0);
873
- } finally {
874
- P.set(I, !1);
875
- }
876
- }
877
- async function Fe(e) {
878
- if (P.set(K, e, !0), P.get(q) && J && P.set(q, {
879
- ...P.get(q),
880
- serverTotals: E(J, e)
881
- }, !0), !e.requiresStripe) Y++, P.set(V, void 0), P.set(z, null), P.set(B, "");
882
- else if (P.get(k) && Object.keys(P.get(A)).length > 0) {
883
- P.set(R, !0);
884
- try {
885
- await X();
886
- } finally {
887
- P.set(R, !1);
888
- }
889
- }
890
- }
891
- async function Be() {
892
- if (P.set(K, null), P.get(q) && J && P.set(q, {
893
- ...P.get(q),
894
- serverTotals: J
895
- }, !0), P.get(k) && Object.keys(P.get(A)).length > 0) {
896
- P.set(R, !0);
897
- try {
898
- await X();
899
- } finally {
900
- P.set(R, !1);
901
- }
902
- }
903
- }
904
- function Ve() {
905
- a() ? a()() : window.history.back();
906
- }
907
- function He() {
908
- a() ? a()() : window.history.back();
909
- }
910
- function Ue() {
911
- P.set(W, null), Ve();
912
- }
913
- async function We() {
914
- if (!P.get(k)) return null;
915
- try {
916
- let e = await C(P.get(k));
917
- return e.success ? {
918
- newExpiryTime: e.newExpiryTime,
919
- remainingExtensions: e.remainingExtensions
920
- } : ($.error("Failed to extend session:", e.error), null);
921
- } catch (e) {
922
- return $.error("Error extending checkout session:", e), null;
923
- }
924
- }
925
- var Ge = ze(), Ke = P.first_child(Ge), qe = (e) => {
926
- {
927
- let t = (e) => {
928
- {
929
- let t = P.derived(() => P.get(I) || P.get(R)), n = P.derived(() => P.get(q)?.serverTotals?.total ?? 0), r = P.derived(() => P.get(q)?.serverTotals?.giftCardAmount ?? null);
930
- Ne(e, {
931
- get cartId() {
932
- return P.get(k);
933
- },
934
- onApplied: Fe,
935
- onRemoved: Be,
936
- get disabled() {
937
- return P.get(t);
938
- },
939
- get owedTotal() {
940
- return P.get(n);
941
- },
942
- get serverGiftCardAmount() {
943
- return P.get(r);
944
- },
945
- get labels() {
946
- return u();
947
- }
948
- });
949
- }
950
- }, n = P.derived(() => P.get(H) ?? (P.get(U) ? { message: P.get(U) } : null));
951
- ge(e, {
952
- get config() {
953
- return P.get(q);
954
- },
955
- onPlaceOrder: je,
956
- onBack: Ve,
957
- onRetryExpired: He,
958
- onExtendSession: We,
959
- get stripe() {
960
- return P.get(z);
961
- },
962
- get paymentIntent() {
963
- return P.get(B);
964
- },
965
- get serverTotalsUnavailable() {
966
- return P.get(we);
967
- },
968
- get repricing() {
969
- return P.get(R);
970
- },
971
- get paymentError() {
972
- return P.get(n);
973
- },
974
- get labels() {
975
- return u();
976
- },
977
- get locale() {
978
- return d();
979
- },
980
- get elements() {
981
- return P.get(V);
982
- },
983
- set elements(e) {
984
- P.set(V, e, !0);
985
- },
986
- get eventEnded() {
987
- return P.get(L);
988
- },
989
- set eventEnded(e) {
990
- P.set(L, e, !0);
991
- },
992
- giftCard: t,
993
- $$slots: { giftCard: !0 }
994
- });
995
- }
996
- }, Je = (e) => {
997
- var t = Le(), n = P.child(t), r = P.child(n, !0);
998
- P.reset(n), P.reset(t), P.template_effect(() => P.set_text(r, P.get(Ce))), P.append(e, t);
999
- }, Ye = (e) => {
1000
- var t = Re(), n = P.child(t), r = P.child(n, !0);
1001
- P.reset(n), P.reset(t), P.template_effect(() => P.set_text(r, u().loadingSecurePaymentForm || "Loading secure payment form...")), P.append(e, t);
1002
- };
1003
- P.if(Ke, (e) => {
1004
- P.get(q) ? e(qe) : P.get(Se) ? e(Je, 1) : e(Ye, -1);
1005
- });
1006
- var Xe = P.sibling(Ke, 2), Ze = (e) => {
1007
- Ie(e, {
1008
- open: !0,
1009
- get reason() {
1010
- return P.get(W);
1011
- },
1012
- onBackToEvents: Ue,
1013
- get labels() {
1014
- return u();
1015
- }
1016
- });
1017
- };
1018
- P.if(Xe, (e) => {
1019
- P.get(G) && e(Ze);
1020
- }), P.append(e, Ge), P.pop();
1021
- }
1022
- //#endregion
1023
- export { Be as default };