@sonordev/site-kit 2.5.7 → 2.5.9
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-TA2RGEE3.js → chunk-JPVTQNIS.js} +182 -18
- package/dist/chunk-JPVTQNIS.js.map +1 -0
- package/dist/{chunk-WET5VJRP.mjs → chunk-MNAMBNKE.mjs} +182 -18
- package/dist/chunk-MNAMBNKE.mjs.map +1 -0
- package/dist/commerce/index.js +45 -45
- package/dist/commerce/index.mjs +1 -1
- package/dist/index.js +25 -25
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-TA2RGEE3.js.map +0 -1
- package/dist/chunk-WET5VJRP.mjs.map +0 -1
|
@@ -6464,7 +6464,8 @@ function EventsWidget({
|
|
|
6464
6464
|
] })
|
|
6465
6465
|
] });
|
|
6466
6466
|
}
|
|
6467
|
-
const
|
|
6467
|
+
const groupedList = groupEventsByOffering(events).slice(0, limit);
|
|
6468
|
+
const displayEvents = effectiveView === "grid" ? events.slice(0, limit) : events;
|
|
6468
6469
|
return /* @__PURE__ */ jsxs("div", { className: `site-kit-events-widget ${className}`, children: [
|
|
6469
6470
|
(title || subtitle || showViewToggle) && /* @__PURE__ */ jsxs(
|
|
6470
6471
|
"div",
|
|
@@ -6577,16 +6578,31 @@ function EventsWidget({
|
|
|
6577
6578
|
}
|
|
6578
6579
|
),
|
|
6579
6580
|
effectiveView === "list" ? /* @__PURE__ */ jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
|
|
6580
|
-
/* @__PURE__ */ jsx("
|
|
6581
|
-
|
|
6581
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
6582
|
+
.sk-date-pills { display: flex; flex-wrap: wrap; gap: 0.375rem; }
|
|
6583
|
+
.sk-date-select-wrap { display: none; }
|
|
6584
|
+
@media (max-width: 640px) {
|
|
6585
|
+
.sk-date-pills { display: none; }
|
|
6586
|
+
.sk-date-select-wrap { display: block; }
|
|
6587
|
+
.site-kit-event-card { flex-direction: column !important; }
|
|
6588
|
+
.site-kit-event-card-image { width: 100% !important; min-width: 0 !important; min-height: 140px !important; }
|
|
6589
|
+
}
|
|
6590
|
+
` }),
|
|
6591
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: groupedList.map(({ event: eventItem, schedules: allSchedules }) => {
|
|
6592
|
+
const schedules = allSchedules.length > 0 ? allSchedules : eventItem.next_schedule ? [eventItem.next_schedule] : [];
|
|
6593
|
+
const isMulti = schedules.length > 1;
|
|
6594
|
+
const primarySchedule = schedules[0] || eventItem.next_schedule || eventItem.schedules?.[0];
|
|
6582
6595
|
const isFree = !eventItem.price || eventItem.price === 0;
|
|
6583
6596
|
const imageUrl = eventItem.featured_image_url;
|
|
6584
|
-
const uniqueKey =
|
|
6597
|
+
const uniqueKey = eventItem.id;
|
|
6585
6598
|
return /* @__PURE__ */ jsxs(
|
|
6586
6599
|
"div",
|
|
6587
6600
|
{
|
|
6588
6601
|
className: `site-kit-event-card ${eventCardClassName}`,
|
|
6589
|
-
onClick: () =>
|
|
6602
|
+
onClick: (e) => {
|
|
6603
|
+
if (e.target.closest("[data-sk-date-selector]")) return;
|
|
6604
|
+
if (!isMulti && primarySchedule) handleEventClick(eventItem, primarySchedule);
|
|
6605
|
+
},
|
|
6590
6606
|
style: {
|
|
6591
6607
|
display: "flex",
|
|
6592
6608
|
flexDirection: "row",
|
|
@@ -6595,12 +6611,12 @@ function EventsWidget({
|
|
|
6595
6611
|
background: "var(--sk-bg)",
|
|
6596
6612
|
border: "1px solid var(--sk-border)",
|
|
6597
6613
|
borderRadius: "0.75rem",
|
|
6598
|
-
cursor:
|
|
6614
|
+
cursor: !isMulti && primarySchedule ? "pointer" : "default",
|
|
6599
6615
|
transition: "all 150ms",
|
|
6600
6616
|
overflow: "hidden"
|
|
6601
6617
|
},
|
|
6602
6618
|
onMouseEnter: (e) => {
|
|
6603
|
-
if (
|
|
6619
|
+
if (!isMulti && primarySchedule) {
|
|
6604
6620
|
e.currentTarget.style.borderColor = "var(--sk-primary)";
|
|
6605
6621
|
e.currentTarget.style.boxShadow = "0 4px 6px -1px rgba(0, 0, 0, 0.1)";
|
|
6606
6622
|
}
|
|
@@ -6610,7 +6626,7 @@ function EventsWidget({
|
|
|
6610
6626
|
e.currentTarget.style.boxShadow = "none";
|
|
6611
6627
|
},
|
|
6612
6628
|
children: [
|
|
6613
|
-
/* @__PURE__ */ jsxs("div", { style: {
|
|
6629
|
+
/* @__PURE__ */ jsxs("div", { className: "site-kit-event-card-image", style: {
|
|
6614
6630
|
width: "160px",
|
|
6615
6631
|
minWidth: "160px",
|
|
6616
6632
|
flexShrink: 0,
|
|
@@ -6670,23 +6686,142 @@ function EventsWidget({
|
|
|
6670
6686
|
whiteSpace: "nowrap"
|
|
6671
6687
|
}, children: isFree ? "Free" : formatPrice(eventItem.price ?? 0, eventItem.currency) })
|
|
6672
6688
|
] }),
|
|
6673
|
-
|
|
6689
|
+
!isMulti && primarySchedule && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "1rem", fontSize: "0.875rem", color: "var(--sk-text-secondary)" }, children: [
|
|
6674
6690
|
/* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.375rem" }, children: [
|
|
6675
6691
|
/* @__PURE__ */ jsx(CalendarIcon, {}),
|
|
6676
|
-
formatDate(
|
|
6692
|
+
formatDate(primarySchedule.starts_at)
|
|
6677
6693
|
] }),
|
|
6678
6694
|
/* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.375rem" }, children: [
|
|
6679
6695
|
/* @__PURE__ */ jsx(ClockIcon, {}),
|
|
6680
|
-
formatTime(
|
|
6696
|
+
formatTime(primarySchedule.starts_at)
|
|
6681
6697
|
] }),
|
|
6682
6698
|
eventItem.location && /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.375rem" }, children: [
|
|
6683
6699
|
/* @__PURE__ */ jsx(LocationIcon, {}),
|
|
6684
6700
|
eventItem.location
|
|
6685
6701
|
] }),
|
|
6686
|
-
|
|
6687
|
-
color:
|
|
6688
|
-
fontWeight:
|
|
6689
|
-
}, children:
|
|
6702
|
+
primarySchedule.spots_remaining !== null && primarySchedule.spots_remaining !== void 0 && /* @__PURE__ */ jsx("span", { style: {
|
|
6703
|
+
color: primarySchedule.spots_remaining < 5 ? "var(--sk-error)" : "var(--sk-text-secondary)",
|
|
6704
|
+
fontWeight: primarySchedule.spots_remaining < 5 ? 500 : 400
|
|
6705
|
+
}, children: primarySchedule.spots_remaining === 0 ? "Sold Out" : `${primarySchedule.spots_remaining} spots left` })
|
|
6706
|
+
] }),
|
|
6707
|
+
isMulti && /* @__PURE__ */ jsxs("div", { "data-sk-date-selector": true, onClick: (e) => e.stopPropagation(), children: [
|
|
6708
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "1rem", fontSize: "0.875rem", color: "var(--sk-text-secondary)", marginBottom: "0.625rem" }, children: [
|
|
6709
|
+
/* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.375rem", fontWeight: 500, color: "var(--sk-text-primary)" }, children: [
|
|
6710
|
+
/* @__PURE__ */ jsx(CalendarIcon, {}),
|
|
6711
|
+
schedules.length,
|
|
6712
|
+
" dates available"
|
|
6713
|
+
] }),
|
|
6714
|
+
eventItem.location && /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.375rem" }, children: [
|
|
6715
|
+
/* @__PURE__ */ jsx(LocationIcon, {}),
|
|
6716
|
+
eventItem.location
|
|
6717
|
+
] }),
|
|
6718
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
6719
|
+
formatDate(schedules[0].starts_at),
|
|
6720
|
+
" \u2013 ",
|
|
6721
|
+
formatDate(schedules[schedules.length - 1].starts_at)
|
|
6722
|
+
] })
|
|
6723
|
+
] }),
|
|
6724
|
+
/* @__PURE__ */ jsx("div", { className: "sk-date-pills", children: schedules.map((s) => {
|
|
6725
|
+
const soldOut = s.spots_remaining === 0;
|
|
6726
|
+
const low = !soldOut && s.spots_remaining !== null && s.spots_remaining !== void 0 && s.spots_remaining < 5;
|
|
6727
|
+
return /* @__PURE__ */ jsxs(
|
|
6728
|
+
"button",
|
|
6729
|
+
{
|
|
6730
|
+
type: "button",
|
|
6731
|
+
onClick: () => !soldOut && handleEventClick(eventItem, s),
|
|
6732
|
+
disabled: soldOut,
|
|
6733
|
+
title: `${formatDate(s.starts_at)} \u2022 ${formatTime(s.starts_at)}${soldOut ? " (Sold Out)" : low ? ` (${s.spots_remaining} left)` : ""}`,
|
|
6734
|
+
style: {
|
|
6735
|
+
display: "inline-flex",
|
|
6736
|
+
alignItems: "center",
|
|
6737
|
+
gap: "0.375rem",
|
|
6738
|
+
padding: "0.5rem 0.875rem",
|
|
6739
|
+
borderRadius: "9999px",
|
|
6740
|
+
border: "1.5px solid var(--sk-primary)",
|
|
6741
|
+
background: soldOut ? "var(--sk-surface)" : "var(--sk-bg)",
|
|
6742
|
+
color: soldOut ? "var(--sk-text-secondary)" : "var(--sk-primary)",
|
|
6743
|
+
fontSize: "0.8125rem",
|
|
6744
|
+
fontWeight: 600,
|
|
6745
|
+
letterSpacing: "0.01em",
|
|
6746
|
+
cursor: soldOut ? "not-allowed" : "pointer",
|
|
6747
|
+
textDecoration: soldOut ? "line-through" : "none",
|
|
6748
|
+
transition: "all 150ms ease",
|
|
6749
|
+
whiteSpace: "nowrap",
|
|
6750
|
+
boxShadow: soldOut ? "none" : "0 1px 2px rgba(0,0,0,0.04)"
|
|
6751
|
+
},
|
|
6752
|
+
onMouseEnter: (e) => {
|
|
6753
|
+
if (!soldOut) {
|
|
6754
|
+
e.currentTarget.style.background = "var(--sk-primary)";
|
|
6755
|
+
e.currentTarget.style.color = "var(--sk-bg)";
|
|
6756
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
6757
|
+
e.currentTarget.style.boxShadow = "0 4px 10px -2px rgba(0,0,0,0.15)";
|
|
6758
|
+
}
|
|
6759
|
+
},
|
|
6760
|
+
onMouseLeave: (e) => {
|
|
6761
|
+
if (!soldOut) {
|
|
6762
|
+
e.currentTarget.style.background = "var(--sk-bg)";
|
|
6763
|
+
e.currentTarget.style.color = "var(--sk-primary)";
|
|
6764
|
+
e.currentTarget.style.transform = "none";
|
|
6765
|
+
e.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.04)";
|
|
6766
|
+
}
|
|
6767
|
+
},
|
|
6768
|
+
children: [
|
|
6769
|
+
formatDate(s.starts_at),
|
|
6770
|
+
" \xB7 ",
|
|
6771
|
+
formatTime(s.starts_at),
|
|
6772
|
+
low && /* @__PURE__ */ jsxs("span", { style: {
|
|
6773
|
+
marginLeft: "0.125rem",
|
|
6774
|
+
padding: "0.0625rem 0.375rem",
|
|
6775
|
+
borderRadius: "9999px",
|
|
6776
|
+
background: "var(--sk-error)",
|
|
6777
|
+
color: "var(--sk-bg)",
|
|
6778
|
+
fontWeight: 700,
|
|
6779
|
+
fontSize: "0.6875rem"
|
|
6780
|
+
}, children: [
|
|
6781
|
+
s.spots_remaining,
|
|
6782
|
+
" left"
|
|
6783
|
+
] })
|
|
6784
|
+
]
|
|
6785
|
+
},
|
|
6786
|
+
s.id
|
|
6787
|
+
);
|
|
6788
|
+
}) }),
|
|
6789
|
+
/* @__PURE__ */ jsx("div", { className: "sk-date-select-wrap", children: /* @__PURE__ */ jsxs(
|
|
6790
|
+
"select",
|
|
6791
|
+
{
|
|
6792
|
+
defaultValue: "",
|
|
6793
|
+
onChange: (e) => {
|
|
6794
|
+
const scheduleId = e.target.value;
|
|
6795
|
+
const s = schedules.find((x) => x.id === scheduleId);
|
|
6796
|
+
if (s) handleEventClick(eventItem, s);
|
|
6797
|
+
e.currentTarget.value = "";
|
|
6798
|
+
},
|
|
6799
|
+
style: {
|
|
6800
|
+
width: "100%",
|
|
6801
|
+
padding: "0.625rem 0.75rem",
|
|
6802
|
+
border: "1px solid var(--sk-border)",
|
|
6803
|
+
borderRadius: "0.5rem",
|
|
6804
|
+
background: "var(--sk-bg)",
|
|
6805
|
+
color: "var(--sk-text-primary)",
|
|
6806
|
+
fontSize: "0.875rem",
|
|
6807
|
+
fontWeight: 500,
|
|
6808
|
+
cursor: "pointer"
|
|
6809
|
+
},
|
|
6810
|
+
children: [
|
|
6811
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select a date to register\u2026" }),
|
|
6812
|
+
schedules.map((s) => {
|
|
6813
|
+
const soldOut = s.spots_remaining === 0;
|
|
6814
|
+
const low = !soldOut && s.spots_remaining !== null && s.spots_remaining !== void 0 && s.spots_remaining < 5;
|
|
6815
|
+
return /* @__PURE__ */ jsxs("option", { value: s.id, disabled: soldOut, children: [
|
|
6816
|
+
formatDate(s.starts_at),
|
|
6817
|
+
" \xB7 ",
|
|
6818
|
+
formatTime(s.starts_at),
|
|
6819
|
+
soldOut ? " \u2014 Sold Out" : low ? ` \u2014 ${s.spots_remaining} left` : ""
|
|
6820
|
+
] }, s.id);
|
|
6821
|
+
})
|
|
6822
|
+
]
|
|
6823
|
+
}
|
|
6824
|
+
) })
|
|
6690
6825
|
] })
|
|
6691
6826
|
] })
|
|
6692
6827
|
]
|
|
@@ -6694,7 +6829,7 @@ function EventsWidget({
|
|
|
6694
6829
|
uniqueKey
|
|
6695
6830
|
);
|
|
6696
6831
|
}) }),
|
|
6697
|
-
showViewAll &&
|
|
6832
|
+
showViewAll && groupedList.length >= limit && /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ jsx(
|
|
6698
6833
|
"a",
|
|
6699
6834
|
{
|
|
6700
6835
|
href: viewAllUrl,
|
|
@@ -6844,7 +6979,36 @@ function getApiKey2() {
|
|
|
6844
6979
|
}
|
|
6845
6980
|
return "";
|
|
6846
6981
|
}
|
|
6982
|
+
function groupEventsByOffering(events) {
|
|
6983
|
+
const groups = /* @__PURE__ */ new Map();
|
|
6984
|
+
for (const ev of events) {
|
|
6985
|
+
const incoming = (ev.schedules || []).filter(Boolean);
|
|
6986
|
+
const existing = groups.get(ev.id);
|
|
6987
|
+
if (existing) {
|
|
6988
|
+
for (const s of incoming) {
|
|
6989
|
+
if (!existing.schedules.some((x) => x.id === s.id)) {
|
|
6990
|
+
existing.schedules.push(s);
|
|
6991
|
+
}
|
|
6992
|
+
}
|
|
6993
|
+
} else {
|
|
6994
|
+
groups.set(ev.id, { event: ev, schedules: [...incoming] });
|
|
6995
|
+
}
|
|
6996
|
+
}
|
|
6997
|
+
for (const g of groups.values()) {
|
|
6998
|
+
g.schedules.sort(
|
|
6999
|
+
(a, b) => new Date(a.starts_at).getTime() - new Date(b.starts_at).getTime()
|
|
7000
|
+
);
|
|
7001
|
+
}
|
|
7002
|
+
return Array.from(groups.values()).sort((a, b) => {
|
|
7003
|
+
const aFirst = a.schedules[0]?.starts_at;
|
|
7004
|
+
const bFirst = b.schedules[0]?.starts_at;
|
|
7005
|
+
if (!aFirst && !bFirst) return 0;
|
|
7006
|
+
if (!aFirst) return 1;
|
|
7007
|
+
if (!bFirst) return -1;
|
|
7008
|
+
return new Date(aFirst).getTime() - new Date(bFirst).getTime();
|
|
7009
|
+
});
|
|
7010
|
+
}
|
|
6847
7011
|
|
|
6848
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 };
|
|
6849
|
-
//# sourceMappingURL=chunk-
|
|
6850
|
-
//# sourceMappingURL=chunk-
|
|
7013
|
+
//# sourceMappingURL=chunk-MNAMBNKE.mjs.map
|
|
7014
|
+
//# sourceMappingURL=chunk-MNAMBNKE.mjs.map
|