@sonordev/site-kit 2.6.3 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HSSKX77P.mjs → chunk-FN7ADGWH.mjs} +729 -5
- package/dist/chunk-FN7ADGWH.mjs.map +1 -0
- package/dist/{chunk-D5ES7H7E.js → chunk-KCA5OLS4.js} +729 -4
- package/dist/chunk-KCA5OLS4.js.map +1 -0
- package/dist/commerce/index.d.mts +1 -1
- package/dist/commerce/index.d.ts +1 -1
- package/dist/commerce/index.js +49 -45
- package/dist/commerce/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -25
- package/dist/index.mjs +1 -1
- package/dist/{useEventModal-DvqBRau-.d.mts → useEventModal-4W_y1SYY.d.mts} +36 -3
- package/dist/{useEventModal-C4Dr4Psb.d.ts → useEventModal-CJLCmH5Y.d.ts} +36 -3
- package/package.json +1 -1
- package/dist/chunk-D5ES7H7E.js.map +0 -1
- package/dist/chunk-HSSKX77P.mjs.map +0 -1
|
@@ -5008,6 +5008,730 @@ function CheckoutForm({
|
|
|
5008
5008
|
] })
|
|
5009
5009
|
] }) });
|
|
5010
5010
|
}
|
|
5011
|
+
function loadSquareSDK2(environment) {
|
|
5012
|
+
return new Promise((resolve, reject) => {
|
|
5013
|
+
if (typeof window === "undefined") return reject(new Error("No window"));
|
|
5014
|
+
if (window.Square) return resolve();
|
|
5015
|
+
const script = document.createElement("script");
|
|
5016
|
+
script.src = environment === "sandbox" ? "https://sandbox.web.squarecdn.com/v1/square.js" : "https://web.squarecdn.com/v1/square.js";
|
|
5017
|
+
script.onload = () => resolve();
|
|
5018
|
+
script.onerror = () => reject(new Error("Failed to load Square SDK"));
|
|
5019
|
+
document.head.appendChild(script);
|
|
5020
|
+
});
|
|
5021
|
+
}
|
|
5022
|
+
var SINGLE_TICKET_KEY = "__single__";
|
|
5023
|
+
function EventCheckout({
|
|
5024
|
+
event,
|
|
5025
|
+
schedule: propSchedule,
|
|
5026
|
+
collectPhone = true,
|
|
5027
|
+
maxPerVariant = 10,
|
|
5028
|
+
cardLabel = "Card Details",
|
|
5029
|
+
submitText,
|
|
5030
|
+
onSuccess,
|
|
5031
|
+
onError,
|
|
5032
|
+
className = ""
|
|
5033
|
+
}) {
|
|
5034
|
+
const schedule = propSchedule || event.schedules?.[0] || event?.next_schedule;
|
|
5035
|
+
const variants = useMemo(
|
|
5036
|
+
() => event.variants ?? [],
|
|
5037
|
+
[event.variants]
|
|
5038
|
+
);
|
|
5039
|
+
const hasVariants = variants.length > 0;
|
|
5040
|
+
const currency = event.currency || "USD";
|
|
5041
|
+
const [qty, setQty] = useState(() => {
|
|
5042
|
+
if (hasVariants) {
|
|
5043
|
+
return Object.fromEntries(variants.map((v) => [v.id, 0]));
|
|
5044
|
+
}
|
|
5045
|
+
return { [SINGLE_TICKET_KEY]: 1 };
|
|
5046
|
+
});
|
|
5047
|
+
const [customer, setCustomer] = useState({
|
|
5048
|
+
email: "",
|
|
5049
|
+
name: "",
|
|
5050
|
+
phone: ""
|
|
5051
|
+
});
|
|
5052
|
+
const [loading, setLoading] = useState(false);
|
|
5053
|
+
const [error, setError] = useState(null);
|
|
5054
|
+
const [success, setSuccess] = useState(null);
|
|
5055
|
+
const [processorConfig, setProcessorConfig] = useState(null);
|
|
5056
|
+
const [squareCard, setSquareCard] = useState(null);
|
|
5057
|
+
const [cardReady, setCardReady] = useState(false);
|
|
5058
|
+
const cardContainerRef = useRef(null);
|
|
5059
|
+
const totalQuantity = useMemo(
|
|
5060
|
+
() => Object.values(qty).reduce((sum, n) => sum + (n || 0), 0),
|
|
5061
|
+
[qty]
|
|
5062
|
+
);
|
|
5063
|
+
const lineBreakdown = useMemo(() => {
|
|
5064
|
+
if (!hasVariants) {
|
|
5065
|
+
const q = qty[SINGLE_TICKET_KEY] || 0;
|
|
5066
|
+
const price = event.price ?? 0;
|
|
5067
|
+
return [
|
|
5068
|
+
{
|
|
5069
|
+
key: SINGLE_TICKET_KEY,
|
|
5070
|
+
name: "Ticket",
|
|
5071
|
+
unitPrice: price,
|
|
5072
|
+
quantity: q,
|
|
5073
|
+
subtotal: price * q,
|
|
5074
|
+
variantId: null
|
|
5075
|
+
}
|
|
5076
|
+
];
|
|
5077
|
+
}
|
|
5078
|
+
return variants.map((v) => {
|
|
5079
|
+
const q = qty[v.id] || 0;
|
|
5080
|
+
const price = v.price ?? event.price ?? 0;
|
|
5081
|
+
return {
|
|
5082
|
+
key: v.id,
|
|
5083
|
+
name: v.name,
|
|
5084
|
+
unitPrice: price,
|
|
5085
|
+
quantity: q,
|
|
5086
|
+
subtotal: price * q,
|
|
5087
|
+
variantId: v.id
|
|
5088
|
+
};
|
|
5089
|
+
});
|
|
5090
|
+
}, [variants, qty, hasVariants, event.price]);
|
|
5091
|
+
const subtotal = lineBreakdown.reduce((s, l) => s + l.subtotal, 0);
|
|
5092
|
+
const spotsRemaining = schedule ? getSpotsRemaining(schedule.capacity, schedule.current_registrations ?? void 0) ?? schedule.spots_remaining ?? null : null;
|
|
5093
|
+
const soldOut = schedule ? isEventSoldOut(schedule.capacity, schedule.current_registrations ?? void 0) : false;
|
|
5094
|
+
const overCapacity = spotsRemaining !== null && totalQuantity > spotsRemaining;
|
|
5095
|
+
useEffect(() => {
|
|
5096
|
+
let cancelled = false;
|
|
5097
|
+
let attachedCard = null;
|
|
5098
|
+
fetchProcessorConfig().then(async (config) => {
|
|
5099
|
+
if (cancelled) return;
|
|
5100
|
+
setProcessorConfig(config);
|
|
5101
|
+
if (config?.processor !== "square" || !config.squareAppId || !config.squareLocationId) {
|
|
5102
|
+
return;
|
|
5103
|
+
}
|
|
5104
|
+
try {
|
|
5105
|
+
await loadSquareSDK2(config.squareEnvironment || "production");
|
|
5106
|
+
if (cancelled) return;
|
|
5107
|
+
const Square = window.Square;
|
|
5108
|
+
const payments = Square.payments(config.squareAppId, config.squareLocationId);
|
|
5109
|
+
const card = await payments.card({
|
|
5110
|
+
style: {
|
|
5111
|
+
".input-container": {
|
|
5112
|
+
borderColor: "var(--sk-border, #d1d5db)",
|
|
5113
|
+
borderRadius: "6px"
|
|
5114
|
+
},
|
|
5115
|
+
".input-container.is-focus": {
|
|
5116
|
+
borderColor: "var(--sk-primary, #2563eb)"
|
|
5117
|
+
},
|
|
5118
|
+
".input-container.is-error": {
|
|
5119
|
+
borderColor: "#dc2626"
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5122
|
+
});
|
|
5123
|
+
if (cancelled) {
|
|
5124
|
+
await card.destroy?.().catch(() => {
|
|
5125
|
+
});
|
|
5126
|
+
return;
|
|
5127
|
+
}
|
|
5128
|
+
await card.attach("#sk-event-checkout-card");
|
|
5129
|
+
attachedCard = card;
|
|
5130
|
+
setSquareCard(card);
|
|
5131
|
+
setCardReady(true);
|
|
5132
|
+
} catch (err) {
|
|
5133
|
+
console.error("[EventCheckout] Square card init failed:", err);
|
|
5134
|
+
}
|
|
5135
|
+
});
|
|
5136
|
+
return () => {
|
|
5137
|
+
cancelled = true;
|
|
5138
|
+
if (attachedCard) {
|
|
5139
|
+
attachedCard.destroy?.().catch(() => {
|
|
5140
|
+
});
|
|
5141
|
+
}
|
|
5142
|
+
setSquareCard(null);
|
|
5143
|
+
setCardReady(false);
|
|
5144
|
+
};
|
|
5145
|
+
}, []);
|
|
5146
|
+
const updateQty = (key, delta) => {
|
|
5147
|
+
setQty((prev) => {
|
|
5148
|
+
const current = prev[key] ?? 0;
|
|
5149
|
+
const next = Math.max(0, Math.min(maxPerVariant, current + delta));
|
|
5150
|
+
return { ...prev, [key]: next };
|
|
5151
|
+
});
|
|
5152
|
+
setError(null);
|
|
5153
|
+
};
|
|
5154
|
+
const updateCustomer = (field, value) => {
|
|
5155
|
+
setCustomer((prev) => ({ ...prev, [field]: value }));
|
|
5156
|
+
};
|
|
5157
|
+
const handleSubmit = async (e) => {
|
|
5158
|
+
e.preventDefault();
|
|
5159
|
+
setError(null);
|
|
5160
|
+
if (!schedule) {
|
|
5161
|
+
setError("No event date available");
|
|
5162
|
+
return;
|
|
5163
|
+
}
|
|
5164
|
+
if (totalQuantity === 0) {
|
|
5165
|
+
setError("Select at least one ticket");
|
|
5166
|
+
return;
|
|
5167
|
+
}
|
|
5168
|
+
if (overCapacity) {
|
|
5169
|
+
setError(
|
|
5170
|
+
`Only ${spotsRemaining} spot${spotsRemaining === 1 ? "" : "s"} remaining. Please reduce quantity.`
|
|
5171
|
+
);
|
|
5172
|
+
return;
|
|
5173
|
+
}
|
|
5174
|
+
if (!customer.name || !customer.email) {
|
|
5175
|
+
setError("Name and email are required");
|
|
5176
|
+
return;
|
|
5177
|
+
}
|
|
5178
|
+
if (processorConfig?.processor !== "square") {
|
|
5179
|
+
setError("Inline checkout requires Square. Please contact support.");
|
|
5180
|
+
return;
|
|
5181
|
+
}
|
|
5182
|
+
if (!squareCard || !cardReady) {
|
|
5183
|
+
setError("Card form is still loading. Please wait a moment and try again.");
|
|
5184
|
+
return;
|
|
5185
|
+
}
|
|
5186
|
+
setLoading(true);
|
|
5187
|
+
try {
|
|
5188
|
+
const tokenResult = await squareCard.tokenize();
|
|
5189
|
+
if (tokenResult.status !== "OK") {
|
|
5190
|
+
const msg = tokenResult.errors?.[0]?.message || "Card verification failed. Please check your card details.";
|
|
5191
|
+
setError(msg);
|
|
5192
|
+
onError?.(msg);
|
|
5193
|
+
setLoading(false);
|
|
5194
|
+
return;
|
|
5195
|
+
}
|
|
5196
|
+
const lineItems = lineBreakdown.filter((l) => l.quantity > 0).map((l) => ({
|
|
5197
|
+
offeringId: event.id,
|
|
5198
|
+
variantId: l.variantId ?? void 0,
|
|
5199
|
+
scheduleId: schedule.id,
|
|
5200
|
+
quantity: l.quantity
|
|
5201
|
+
}));
|
|
5202
|
+
const result = await createCheckoutSession({
|
|
5203
|
+
offeringId: event.id,
|
|
5204
|
+
lineItems,
|
|
5205
|
+
customer,
|
|
5206
|
+
sourceId: tokenResult.token,
|
|
5207
|
+
successUrl: typeof window !== "undefined" ? window.location.href + "?registration=success" : void 0,
|
|
5208
|
+
cancelUrl: typeof window !== "undefined" ? window.location.href : void 0
|
|
5209
|
+
});
|
|
5210
|
+
if (result.success) {
|
|
5211
|
+
setSuccess(result);
|
|
5212
|
+
onSuccess?.(result);
|
|
5213
|
+
} else {
|
|
5214
|
+
setError(result.error || "Checkout failed");
|
|
5215
|
+
onError?.(result.error || "Checkout failed");
|
|
5216
|
+
}
|
|
5217
|
+
} catch (err) {
|
|
5218
|
+
const message = err instanceof Error ? err.message : "An error occurred";
|
|
5219
|
+
setError(message);
|
|
5220
|
+
onError?.(message);
|
|
5221
|
+
} finally {
|
|
5222
|
+
setLoading(false);
|
|
5223
|
+
}
|
|
5224
|
+
};
|
|
5225
|
+
if (success) {
|
|
5226
|
+
return /* @__PURE__ */ jsxs(
|
|
5227
|
+
"div",
|
|
5228
|
+
{
|
|
5229
|
+
className: `site-kit-event-checkout-success ${className}`,
|
|
5230
|
+
style: {
|
|
5231
|
+
padding: "2rem",
|
|
5232
|
+
textAlign: "center",
|
|
5233
|
+
background: "var(--sk-bg, #fff)",
|
|
5234
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
5235
|
+
borderRadius: "12px"
|
|
5236
|
+
},
|
|
5237
|
+
children: [
|
|
5238
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "3rem", marginBottom: "0.75rem" }, children: "\u{1F39F}\uFE0F" }),
|
|
5239
|
+
/* @__PURE__ */ jsx(
|
|
5240
|
+
"h3",
|
|
5241
|
+
{
|
|
5242
|
+
style: {
|
|
5243
|
+
margin: "0 0 0.5rem",
|
|
5244
|
+
fontSize: "1.5rem",
|
|
5245
|
+
color: "var(--sk-text-primary, #111)"
|
|
5246
|
+
},
|
|
5247
|
+
children: "You're booked!"
|
|
5248
|
+
}
|
|
5249
|
+
),
|
|
5250
|
+
/* @__PURE__ */ jsxs(
|
|
5251
|
+
"p",
|
|
5252
|
+
{
|
|
5253
|
+
style: {
|
|
5254
|
+
margin: "0 0 0.5rem",
|
|
5255
|
+
color: "var(--sk-text-secondary, #555)"
|
|
5256
|
+
},
|
|
5257
|
+
children: [
|
|
5258
|
+
"Confirmation #",
|
|
5259
|
+
success.confirmation_number || success.sale_id
|
|
5260
|
+
]
|
|
5261
|
+
}
|
|
5262
|
+
),
|
|
5263
|
+
/* @__PURE__ */ jsx(
|
|
5264
|
+
"p",
|
|
5265
|
+
{
|
|
5266
|
+
style: {
|
|
5267
|
+
margin: 0,
|
|
5268
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5269
|
+
fontSize: "0.9rem"
|
|
5270
|
+
},
|
|
5271
|
+
children: "Check your email for ticket details."
|
|
5272
|
+
}
|
|
5273
|
+
)
|
|
5274
|
+
]
|
|
5275
|
+
}
|
|
5276
|
+
);
|
|
5277
|
+
}
|
|
5278
|
+
if (soldOut) {
|
|
5279
|
+
return /* @__PURE__ */ jsxs(
|
|
5280
|
+
"div",
|
|
5281
|
+
{
|
|
5282
|
+
className: `site-kit-event-checkout-soldout ${className}`,
|
|
5283
|
+
style: {
|
|
5284
|
+
padding: "2rem",
|
|
5285
|
+
textAlign: "center",
|
|
5286
|
+
background: "var(--sk-surface, #f9fafb)",
|
|
5287
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
5288
|
+
borderRadius: "12px"
|
|
5289
|
+
},
|
|
5290
|
+
children: [
|
|
5291
|
+
/* @__PURE__ */ jsx("p", { style: { margin: 0, fontWeight: 600, fontSize: "1.125rem" }, children: "This cruise is sold out" }),
|
|
5292
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0.5rem 0 0", color: "var(--sk-text-secondary, #555)" }, children: "Check back soon for additional dates." })
|
|
5293
|
+
]
|
|
5294
|
+
}
|
|
5295
|
+
);
|
|
5296
|
+
}
|
|
5297
|
+
return /* @__PURE__ */ jsxs(
|
|
5298
|
+
"div",
|
|
5299
|
+
{
|
|
5300
|
+
className: `site-kit-event-checkout ${className}`,
|
|
5301
|
+
style: {
|
|
5302
|
+
background: "var(--sk-bg, #fff)",
|
|
5303
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
5304
|
+
borderRadius: "12px",
|
|
5305
|
+
padding: "1.5rem"
|
|
5306
|
+
},
|
|
5307
|
+
children: [
|
|
5308
|
+
schedule && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1.25rem" }, children: [
|
|
5309
|
+
/* @__PURE__ */ jsx(
|
|
5310
|
+
"div",
|
|
5311
|
+
{
|
|
5312
|
+
style: {
|
|
5313
|
+
fontSize: "0.75rem",
|
|
5314
|
+
textTransform: "uppercase",
|
|
5315
|
+
letterSpacing: "0.08em",
|
|
5316
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5317
|
+
marginBottom: "0.25rem"
|
|
5318
|
+
},
|
|
5319
|
+
children: "Date & Time"
|
|
5320
|
+
}
|
|
5321
|
+
),
|
|
5322
|
+
/* @__PURE__ */ jsxs(
|
|
5323
|
+
"div",
|
|
5324
|
+
{
|
|
5325
|
+
style: {
|
|
5326
|
+
fontSize: "1.125rem",
|
|
5327
|
+
fontWeight: 600,
|
|
5328
|
+
color: "var(--sk-text-primary, #111)"
|
|
5329
|
+
},
|
|
5330
|
+
children: [
|
|
5331
|
+
formatDate(schedule.starts_at),
|
|
5332
|
+
" \xB7 ",
|
|
5333
|
+
formatTime(schedule.starts_at)
|
|
5334
|
+
]
|
|
5335
|
+
}
|
|
5336
|
+
),
|
|
5337
|
+
spotsRemaining !== null && spotsRemaining <= 10 && spotsRemaining > 0 && /* @__PURE__ */ jsxs(
|
|
5338
|
+
"div",
|
|
5339
|
+
{
|
|
5340
|
+
style: {
|
|
5341
|
+
marginTop: "0.5rem",
|
|
5342
|
+
fontSize: "0.875rem",
|
|
5343
|
+
color: "var(--sk-warning, #b45309)",
|
|
5344
|
+
fontWeight: 500
|
|
5345
|
+
},
|
|
5346
|
+
children: [
|
|
5347
|
+
"Only ",
|
|
5348
|
+
spotsRemaining,
|
|
5349
|
+
" spot",
|
|
5350
|
+
spotsRemaining === 1 ? "" : "s",
|
|
5351
|
+
" left"
|
|
5352
|
+
]
|
|
5353
|
+
}
|
|
5354
|
+
)
|
|
5355
|
+
] }),
|
|
5356
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
|
|
5357
|
+
/* @__PURE__ */ jsx(
|
|
5358
|
+
"div",
|
|
5359
|
+
{
|
|
5360
|
+
style: {
|
|
5361
|
+
display: "flex",
|
|
5362
|
+
flexDirection: "column",
|
|
5363
|
+
gap: "0.75rem",
|
|
5364
|
+
marginBottom: "1.25rem"
|
|
5365
|
+
},
|
|
5366
|
+
children: lineBreakdown.map((line) => /* @__PURE__ */ jsxs(
|
|
5367
|
+
"div",
|
|
5368
|
+
{
|
|
5369
|
+
style: {
|
|
5370
|
+
display: "flex",
|
|
5371
|
+
alignItems: "center",
|
|
5372
|
+
justifyContent: "space-between",
|
|
5373
|
+
gap: "1rem",
|
|
5374
|
+
padding: "0.875rem 1rem",
|
|
5375
|
+
background: "var(--sk-surface, #f9fafb)",
|
|
5376
|
+
borderRadius: "8px",
|
|
5377
|
+
border: "1px solid var(--sk-border, #e5e7eb)"
|
|
5378
|
+
},
|
|
5379
|
+
children: [
|
|
5380
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5381
|
+
/* @__PURE__ */ jsx(
|
|
5382
|
+
"div",
|
|
5383
|
+
{
|
|
5384
|
+
style: {
|
|
5385
|
+
fontWeight: 600,
|
|
5386
|
+
color: "var(--sk-text-primary, #111)"
|
|
5387
|
+
},
|
|
5388
|
+
children: line.name
|
|
5389
|
+
}
|
|
5390
|
+
),
|
|
5391
|
+
/* @__PURE__ */ jsxs(
|
|
5392
|
+
"div",
|
|
5393
|
+
{
|
|
5394
|
+
style: {
|
|
5395
|
+
fontSize: "0.875rem",
|
|
5396
|
+
color: "var(--sk-text-secondary, #555)"
|
|
5397
|
+
},
|
|
5398
|
+
children: [
|
|
5399
|
+
formatPrice(line.unitPrice, currency),
|
|
5400
|
+
" each"
|
|
5401
|
+
]
|
|
5402
|
+
}
|
|
5403
|
+
)
|
|
5404
|
+
] }),
|
|
5405
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
5406
|
+
/* @__PURE__ */ jsx(
|
|
5407
|
+
"button",
|
|
5408
|
+
{
|
|
5409
|
+
type: "button",
|
|
5410
|
+
onClick: () => updateQty(line.key, -1),
|
|
5411
|
+
disabled: line.quantity === 0,
|
|
5412
|
+
"aria-label": `Decrease ${line.name} quantity`,
|
|
5413
|
+
style: {
|
|
5414
|
+
width: "32px",
|
|
5415
|
+
height: "32px",
|
|
5416
|
+
borderRadius: "50%",
|
|
5417
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5418
|
+
background: "var(--sk-bg, #fff)",
|
|
5419
|
+
color: "var(--sk-text-primary, #111)",
|
|
5420
|
+
cursor: line.quantity === 0 ? "not-allowed" : "pointer",
|
|
5421
|
+
opacity: line.quantity === 0 ? 0.4 : 1,
|
|
5422
|
+
fontSize: "1.25rem",
|
|
5423
|
+
lineHeight: 1,
|
|
5424
|
+
display: "flex",
|
|
5425
|
+
alignItems: "center",
|
|
5426
|
+
justifyContent: "center"
|
|
5427
|
+
},
|
|
5428
|
+
children: "\u2212"
|
|
5429
|
+
}
|
|
5430
|
+
),
|
|
5431
|
+
/* @__PURE__ */ jsx(
|
|
5432
|
+
"div",
|
|
5433
|
+
{
|
|
5434
|
+
style: {
|
|
5435
|
+
minWidth: "2.5rem",
|
|
5436
|
+
textAlign: "center",
|
|
5437
|
+
fontWeight: 600,
|
|
5438
|
+
fontSize: "1.125rem"
|
|
5439
|
+
},
|
|
5440
|
+
children: line.quantity
|
|
5441
|
+
}
|
|
5442
|
+
),
|
|
5443
|
+
/* @__PURE__ */ jsx(
|
|
5444
|
+
"button",
|
|
5445
|
+
{
|
|
5446
|
+
type: "button",
|
|
5447
|
+
onClick: () => updateQty(line.key, 1),
|
|
5448
|
+
disabled: line.quantity >= maxPerVariant,
|
|
5449
|
+
"aria-label": `Increase ${line.name} quantity`,
|
|
5450
|
+
style: {
|
|
5451
|
+
width: "32px",
|
|
5452
|
+
height: "32px",
|
|
5453
|
+
borderRadius: "50%",
|
|
5454
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5455
|
+
background: "var(--sk-bg, #fff)",
|
|
5456
|
+
color: "var(--sk-text-primary, #111)",
|
|
5457
|
+
cursor: line.quantity >= maxPerVariant ? "not-allowed" : "pointer",
|
|
5458
|
+
opacity: line.quantity >= maxPerVariant ? 0.4 : 1,
|
|
5459
|
+
fontSize: "1.25rem",
|
|
5460
|
+
lineHeight: 1,
|
|
5461
|
+
display: "flex",
|
|
5462
|
+
alignItems: "center",
|
|
5463
|
+
justifyContent: "center"
|
|
5464
|
+
},
|
|
5465
|
+
children: "+"
|
|
5466
|
+
}
|
|
5467
|
+
)
|
|
5468
|
+
] })
|
|
5469
|
+
]
|
|
5470
|
+
},
|
|
5471
|
+
line.key
|
|
5472
|
+
))
|
|
5473
|
+
}
|
|
5474
|
+
),
|
|
5475
|
+
/* @__PURE__ */ jsxs(
|
|
5476
|
+
"div",
|
|
5477
|
+
{
|
|
5478
|
+
style: {
|
|
5479
|
+
display: "flex",
|
|
5480
|
+
justifyContent: "space-between",
|
|
5481
|
+
alignItems: "baseline",
|
|
5482
|
+
padding: "0.75rem 0",
|
|
5483
|
+
borderTop: "1px solid var(--sk-border, #e5e7eb)",
|
|
5484
|
+
borderBottom: "1px solid var(--sk-border, #e5e7eb)",
|
|
5485
|
+
marginBottom: "1.25rem"
|
|
5486
|
+
},
|
|
5487
|
+
children: [
|
|
5488
|
+
/* @__PURE__ */ jsxs(
|
|
5489
|
+
"span",
|
|
5490
|
+
{
|
|
5491
|
+
style: {
|
|
5492
|
+
fontSize: "0.875rem",
|
|
5493
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5494
|
+
textTransform: "uppercase",
|
|
5495
|
+
letterSpacing: "0.06em"
|
|
5496
|
+
},
|
|
5497
|
+
children: [
|
|
5498
|
+
"Total (",
|
|
5499
|
+
totalQuantity,
|
|
5500
|
+
" ",
|
|
5501
|
+
totalQuantity === 1 ? "ticket" : "tickets",
|
|
5502
|
+
")"
|
|
5503
|
+
]
|
|
5504
|
+
}
|
|
5505
|
+
),
|
|
5506
|
+
/* @__PURE__ */ jsx(
|
|
5507
|
+
"span",
|
|
5508
|
+
{
|
|
5509
|
+
style: {
|
|
5510
|
+
fontSize: "1.5rem",
|
|
5511
|
+
fontWeight: 700,
|
|
5512
|
+
color: "var(--sk-text-primary, #111)"
|
|
5513
|
+
},
|
|
5514
|
+
children: formatPrice(subtotal, currency)
|
|
5515
|
+
}
|
|
5516
|
+
)
|
|
5517
|
+
]
|
|
5518
|
+
}
|
|
5519
|
+
),
|
|
5520
|
+
/* @__PURE__ */ jsxs(
|
|
5521
|
+
"div",
|
|
5522
|
+
{
|
|
5523
|
+
style: {
|
|
5524
|
+
display: "flex",
|
|
5525
|
+
flexDirection: "column",
|
|
5526
|
+
gap: "0.75rem",
|
|
5527
|
+
marginBottom: "1rem"
|
|
5528
|
+
},
|
|
5529
|
+
children: [
|
|
5530
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5531
|
+
/* @__PURE__ */ jsx(
|
|
5532
|
+
"label",
|
|
5533
|
+
{
|
|
5534
|
+
style: {
|
|
5535
|
+
display: "block",
|
|
5536
|
+
fontSize: "0.75rem",
|
|
5537
|
+
fontWeight: 600,
|
|
5538
|
+
textTransform: "uppercase",
|
|
5539
|
+
letterSpacing: "0.06em",
|
|
5540
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5541
|
+
marginBottom: "0.25rem"
|
|
5542
|
+
},
|
|
5543
|
+
children: "Full Name"
|
|
5544
|
+
}
|
|
5545
|
+
),
|
|
5546
|
+
/* @__PURE__ */ jsx(
|
|
5547
|
+
"input",
|
|
5548
|
+
{
|
|
5549
|
+
type: "text",
|
|
5550
|
+
required: true,
|
|
5551
|
+
value: customer.name,
|
|
5552
|
+
onChange: (e) => updateCustomer("name", e.target.value),
|
|
5553
|
+
placeholder: "John Smith",
|
|
5554
|
+
style: {
|
|
5555
|
+
width: "100%",
|
|
5556
|
+
padding: "0.625rem 0.75rem",
|
|
5557
|
+
borderRadius: "6px",
|
|
5558
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5559
|
+
fontSize: "1rem",
|
|
5560
|
+
background: "var(--sk-bg, #fff)",
|
|
5561
|
+
color: "var(--sk-text-primary, #111)"
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
)
|
|
5565
|
+
] }),
|
|
5566
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5567
|
+
/* @__PURE__ */ jsx(
|
|
5568
|
+
"label",
|
|
5569
|
+
{
|
|
5570
|
+
style: {
|
|
5571
|
+
display: "block",
|
|
5572
|
+
fontSize: "0.75rem",
|
|
5573
|
+
fontWeight: 600,
|
|
5574
|
+
textTransform: "uppercase",
|
|
5575
|
+
letterSpacing: "0.06em",
|
|
5576
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5577
|
+
marginBottom: "0.25rem"
|
|
5578
|
+
},
|
|
5579
|
+
children: "Email Address"
|
|
5580
|
+
}
|
|
5581
|
+
),
|
|
5582
|
+
/* @__PURE__ */ jsx(
|
|
5583
|
+
"input",
|
|
5584
|
+
{
|
|
5585
|
+
type: "email",
|
|
5586
|
+
required: true,
|
|
5587
|
+
value: customer.email,
|
|
5588
|
+
onChange: (e) => updateCustomer("email", e.target.value),
|
|
5589
|
+
placeholder: "john@example.com",
|
|
5590
|
+
style: {
|
|
5591
|
+
width: "100%",
|
|
5592
|
+
padding: "0.625rem 0.75rem",
|
|
5593
|
+
borderRadius: "6px",
|
|
5594
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5595
|
+
fontSize: "1rem",
|
|
5596
|
+
background: "var(--sk-bg, #fff)",
|
|
5597
|
+
color: "var(--sk-text-primary, #111)"
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5600
|
+
)
|
|
5601
|
+
] }),
|
|
5602
|
+
collectPhone && /* @__PURE__ */ jsxs("div", { children: [
|
|
5603
|
+
/* @__PURE__ */ jsx(
|
|
5604
|
+
"label",
|
|
5605
|
+
{
|
|
5606
|
+
style: {
|
|
5607
|
+
display: "block",
|
|
5608
|
+
fontSize: "0.75rem",
|
|
5609
|
+
fontWeight: 600,
|
|
5610
|
+
textTransform: "uppercase",
|
|
5611
|
+
letterSpacing: "0.06em",
|
|
5612
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5613
|
+
marginBottom: "0.25rem"
|
|
5614
|
+
},
|
|
5615
|
+
children: "Phone Number"
|
|
5616
|
+
}
|
|
5617
|
+
),
|
|
5618
|
+
/* @__PURE__ */ jsx(
|
|
5619
|
+
"input",
|
|
5620
|
+
{
|
|
5621
|
+
type: "tel",
|
|
5622
|
+
value: customer.phone || "",
|
|
5623
|
+
onChange: (e) => updateCustomer("phone", e.target.value),
|
|
5624
|
+
placeholder: "(555) 123-4567",
|
|
5625
|
+
style: {
|
|
5626
|
+
width: "100%",
|
|
5627
|
+
padding: "0.625rem 0.75rem",
|
|
5628
|
+
borderRadius: "6px",
|
|
5629
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5630
|
+
fontSize: "1rem",
|
|
5631
|
+
background: "var(--sk-bg, #fff)",
|
|
5632
|
+
color: "var(--sk-text-primary, #111)"
|
|
5633
|
+
}
|
|
5634
|
+
}
|
|
5635
|
+
)
|
|
5636
|
+
] })
|
|
5637
|
+
]
|
|
5638
|
+
}
|
|
5639
|
+
),
|
|
5640
|
+
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "1rem" }, children: [
|
|
5641
|
+
/* @__PURE__ */ jsx(
|
|
5642
|
+
"label",
|
|
5643
|
+
{
|
|
5644
|
+
style: {
|
|
5645
|
+
display: "block",
|
|
5646
|
+
fontSize: "0.75rem",
|
|
5647
|
+
fontWeight: 600,
|
|
5648
|
+
textTransform: "uppercase",
|
|
5649
|
+
letterSpacing: "0.06em",
|
|
5650
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5651
|
+
marginBottom: "0.25rem"
|
|
5652
|
+
},
|
|
5653
|
+
children: cardLabel
|
|
5654
|
+
}
|
|
5655
|
+
),
|
|
5656
|
+
/* @__PURE__ */ jsx(
|
|
5657
|
+
"div",
|
|
5658
|
+
{
|
|
5659
|
+
id: "sk-event-checkout-card",
|
|
5660
|
+
ref: cardContainerRef,
|
|
5661
|
+
style: {
|
|
5662
|
+
minHeight: "44px",
|
|
5663
|
+
border: "1px solid var(--sk-border, #d1d5db)",
|
|
5664
|
+
borderRadius: "6px",
|
|
5665
|
+
padding: "0.5rem 0.75rem",
|
|
5666
|
+
background: "var(--sk-bg, #fff)"
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
5669
|
+
),
|
|
5670
|
+
!cardReady && /* @__PURE__ */ jsx(
|
|
5671
|
+
"p",
|
|
5672
|
+
{
|
|
5673
|
+
style: {
|
|
5674
|
+
fontSize: "0.75rem",
|
|
5675
|
+
color: "var(--sk-text-secondary, #555)",
|
|
5676
|
+
marginTop: "0.25rem"
|
|
5677
|
+
},
|
|
5678
|
+
children: "Loading card form..."
|
|
5679
|
+
}
|
|
5680
|
+
)
|
|
5681
|
+
] }),
|
|
5682
|
+
error && /* @__PURE__ */ jsx(
|
|
5683
|
+
"div",
|
|
5684
|
+
{
|
|
5685
|
+
role: "alert",
|
|
5686
|
+
style: {
|
|
5687
|
+
marginBottom: "1rem",
|
|
5688
|
+
padding: "0.75rem 1rem",
|
|
5689
|
+
background: "rgba(220, 38, 38, 0.06)",
|
|
5690
|
+
border: "1px solid rgba(220, 38, 38, 0.25)",
|
|
5691
|
+
borderRadius: "6px",
|
|
5692
|
+
color: "#b91c1c",
|
|
5693
|
+
fontSize: "0.875rem"
|
|
5694
|
+
},
|
|
5695
|
+
children: error
|
|
5696
|
+
}
|
|
5697
|
+
),
|
|
5698
|
+
/* @__PURE__ */ jsx(
|
|
5699
|
+
"button",
|
|
5700
|
+
{
|
|
5701
|
+
type: "submit",
|
|
5702
|
+
disabled: loading || totalQuantity === 0 || !cardReady || overCapacity,
|
|
5703
|
+
style: {
|
|
5704
|
+
width: "100%",
|
|
5705
|
+
padding: "0.875rem 1rem",
|
|
5706
|
+
fontSize: "1rem",
|
|
5707
|
+
fontWeight: 600,
|
|
5708
|
+
borderRadius: "8px",
|
|
5709
|
+
border: "none",
|
|
5710
|
+
background: loading || totalQuantity === 0 || !cardReady || overCapacity ? "var(--sk-primary-hover, #94a3b8)" : "var(--sk-primary, #2563eb)",
|
|
5711
|
+
color: "var(--sk-primary-text, #fff)",
|
|
5712
|
+
cursor: loading || totalQuantity === 0 || !cardReady || overCapacity ? "not-allowed" : "pointer",
|
|
5713
|
+
transition: "background 0.15s ease"
|
|
5714
|
+
},
|
|
5715
|
+
children: loading ? "Processing..." : submitText ? submitText : totalQuantity === 0 ? "Select tickets" : `Buy ${formatPrice(subtotal, currency)}`
|
|
5716
|
+
}
|
|
5717
|
+
),
|
|
5718
|
+
/* @__PURE__ */ jsx(
|
|
5719
|
+
"p",
|
|
5720
|
+
{
|
|
5721
|
+
style: {
|
|
5722
|
+
textAlign: "center",
|
|
5723
|
+
fontSize: "0.75rem",
|
|
5724
|
+
color: "var(--sk-text-secondary, #888)",
|
|
5725
|
+
margin: "0.75rem 0 0"
|
|
5726
|
+
},
|
|
5727
|
+
children: "\u{1F512} Secure checkout powered by Square"
|
|
5728
|
+
}
|
|
5729
|
+
)
|
|
5730
|
+
] })
|
|
5731
|
+
]
|
|
5732
|
+
}
|
|
5733
|
+
);
|
|
5734
|
+
}
|
|
5011
5735
|
function RegistrationForm({
|
|
5012
5736
|
event,
|
|
5013
5737
|
scheduleId,
|
|
@@ -5646,7 +6370,7 @@ function CalendarView({
|
|
|
5646
6370
|
}, children: "Loading..." })
|
|
5647
6371
|
] });
|
|
5648
6372
|
}
|
|
5649
|
-
function
|
|
6373
|
+
function loadSquareSDK3(environment) {
|
|
5650
6374
|
return new Promise((resolve, reject) => {
|
|
5651
6375
|
if (typeof window === "undefined") return reject(new Error("No window"));
|
|
5652
6376
|
if (window.Square) return resolve();
|
|
@@ -5693,7 +6417,7 @@ function EventModal({
|
|
|
5693
6417
|
if (config?.processor) setProcessor(config.processor);
|
|
5694
6418
|
if (config?.processor === "square" && config.squareAppId && config.squareLocationId) {
|
|
5695
6419
|
try {
|
|
5696
|
-
await
|
|
6420
|
+
await loadSquareSDK3(config.squareEnvironment || "production");
|
|
5697
6421
|
const Square = window.Square;
|
|
5698
6422
|
const payments = Square.payments(config.squareAppId, config.squareLocationId);
|
|
5699
6423
|
const card = await payments.card({
|
|
@@ -7009,6 +7733,6 @@ function groupEventsByOffering(events) {
|
|
|
7009
7733
|
});
|
|
7010
7734
|
}
|
|
7011
7735
|
|
|
7012
|
-
export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, SizeChart, UpcomingEvents, createCheckoutSession, createPaymentIntent, fetchActiveProcessor, fetchCategories, fetchLatestOffering, fetchNextEvent, fetchOffering, fetchOfferings, fetchProcessorConfig, fetchProductBySlug, fetchProducts, fetchProductsPublic, fetchServices, fetchShippingRates, fetchUpcomingEvents, formatDate, formatDateRange, formatDateTime, formatPrice, formatTime, getOfferingUrl, getRelativeTimeUntil, getSpotsRemaining, isEventSoldOut, registerForEvent, useEventModal, validateAddress, validateDiscountCode };
|
|
7013
|
-
//# sourceMappingURL=chunk-
|
|
7014
|
-
//# sourceMappingURL=chunk-
|
|
7736
|
+
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, SizeChart, UpcomingEvents, createCheckoutSession, createPaymentIntent, fetchActiveProcessor, fetchCategories, fetchLatestOffering, fetchNextEvent, fetchOffering, fetchOfferings, fetchProcessorConfig, fetchProductBySlug, fetchProducts, fetchProductsPublic, fetchServices, fetchShippingRates, fetchUpcomingEvents, formatDate, formatDateRange, formatDateTime, formatPrice, formatTime, getOfferingUrl, getRelativeTimeUntil, getSpotsRemaining, isEventSoldOut, registerForEvent, useEventModal, validateAddress, validateDiscountCode };
|
|
7737
|
+
//# sourceMappingURL=chunk-FN7ADGWH.mjs.map
|
|
7738
|
+
//# sourceMappingURL=chunk-FN7ADGWH.mjs.map
|