@sonordev/site-kit 1.3.3 → 1.3.5
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/AnalyticsProvider-SC4YOBFI.js +25 -0
- package/dist/{AnalyticsProvider-PIUZBIOK.js.map → AnalyticsProvider-SC4YOBFI.js.map} +1 -1
- package/dist/AnalyticsProvider-ZVZ2SNZR.mjs +4 -0
- package/dist/{AnalyticsProvider-FX5TLRQC.mjs.map → AnalyticsProvider-ZVZ2SNZR.mjs.map} +1 -1
- package/dist/EngageWidget-RWBCI4RM.mjs +4 -0
- package/dist/{EngageWidget-R7YFQBS5.mjs.map → EngageWidget-RWBCI4RM.mjs.map} +1 -1
- package/dist/EngageWidget-T2S5WUMJ.js +13 -0
- package/dist/{EngageWidget-I4AZTKFY.js.map → EngageWidget-T2S5WUMJ.js.map} +1 -1
- package/dist/SitemapSync-6I5JTLER.js +13 -0
- package/dist/{SitemapSync-4FRADGXF.js.map → SitemapSync-6I5JTLER.js.map} +1 -1
- package/dist/SitemapSync-6L45DHRH.mjs +4 -0
- package/dist/{SitemapSync-IJRJ32Y3.mjs.map → SitemapSync-6L45DHRH.mjs.map} +1 -1
- package/dist/analytics/index.d.mts +6 -1
- package/dist/analytics/index.d.ts +6 -1
- package/dist/analytics/index.js +19 -69
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +2 -67
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/{chunk-NZHVGBAF.js → chunk-5DAALKHB.js} +5 -5
- package/dist/{chunk-NZHVGBAF.js.map → chunk-5DAALKHB.js.map} +1 -1
- package/dist/chunk-AU4GIQQU.mjs +69 -0
- package/dist/chunk-AU4GIQQU.mjs.map +1 -0
- package/dist/{chunk-3QQDXQJE.js → chunk-DK2WNYQA.js} +7 -7
- package/dist/chunk-DK2WNYQA.js.map +1 -0
- package/dist/{chunk-TK76624B.mjs → chunk-FP66BKW6.mjs} +6 -3
- package/dist/chunk-FP66BKW6.mjs.map +1 -0
- package/dist/chunk-FRN4JQXL.js +72 -0
- package/dist/chunk-FRN4JQXL.js.map +1 -0
- package/dist/{chunk-JAXKHEOM.js → chunk-GTLIGQDM.js} +6 -2
- package/dist/chunk-GTLIGQDM.js.map +1 -0
- package/dist/{chunk-EGZEZR2I.mjs → chunk-HNCSTGVK.mjs} +3 -4
- package/dist/chunk-HNCSTGVK.mjs.map +1 -0
- package/dist/{chunk-6YXRLC6W.mjs → chunk-IZZ7XJYN.mjs} +184 -3
- package/dist/chunk-IZZ7XJYN.mjs.map +1 -0
- package/dist/{chunk-TLHRV3LZ.js → chunk-KYNUBF64.js} +184 -2
- package/dist/chunk-KYNUBF64.js.map +1 -0
- package/dist/{chunk-5TTTX6NN.mjs → chunk-RNOXXICL.mjs} +5 -5
- package/dist/{chunk-5TTTX6NN.mjs.map → chunk-RNOXXICL.mjs.map} +1 -1
- package/dist/{chunk-JB6I5PYV.js → chunk-V2WSPLCN.js} +2 -4
- package/dist/chunk-V2WSPLCN.js.map +1 -0
- package/dist/{chunk-GADRLCYH.mjs → chunk-VZMRZQ2D.mjs} +7 -7
- package/dist/chunk-VZMRZQ2D.mjs.map +1 -0
- package/dist/{chunk-W2TZYAUL.mjs → chunk-WW2DKGBM.mjs} +3 -4
- package/dist/chunk-WW2DKGBM.mjs.map +1 -0
- package/dist/{chunk-UOBK3SSF.js → chunk-YBQT623Y.js} +2 -4
- package/dist/chunk-YBQT623Y.js.map +1 -0
- package/dist/commerce/index.d.mts +11 -4
- package/dist/commerce/index.d.ts +11 -4
- package/dist/commerce/index.js +48 -42
- package/dist/commerce/index.mjs +3 -1
- package/dist/commerce/server.d.mts +1 -1
- package/dist/commerce/server.d.ts +1 -1
- package/dist/engage/index.d.mts +35 -2
- package/dist/engage/index.d.ts +35 -2
- package/dist/engage/index.js +32 -5
- package/dist/engage/index.js.map +1 -1
- package/dist/engage/index.mjs +30 -1
- package/dist/engage/index.mjs.map +1 -1
- package/dist/forms/index.js +20 -1
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +20 -1
- package/dist/forms/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +45 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/dist/layout/client.js +2 -2
- package/dist/layout/client.mjs +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/index.mjs +1 -1
- package/dist/seo/index.js +2 -2
- package/dist/seo/index.mjs +1 -1
- package/dist/sync/index.js +13 -19
- package/dist/sync/index.mjs +1 -1
- package/dist/{types-CGlnp43R.d.mts → types-CyUfjlzS.d.mts} +14 -1
- package/dist/{types-CGlnp43R.d.ts → types-CyUfjlzS.d.ts} +14 -1
- package/dist/{useEventModal-Dx1dItTJ.d.ts → useEventModal-CmPo7hkj.d.ts} +1 -1
- package/dist/{useEventModal-BVTx69XE.d.mts → useEventModal-shBjc8CK.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/AnalyticsProvider-FX5TLRQC.mjs +0 -4
- package/dist/AnalyticsProvider-PIUZBIOK.js +0 -21
- package/dist/EngageWidget-I4AZTKFY.js +0 -13
- package/dist/EngageWidget-R7YFQBS5.mjs +0 -4
- package/dist/SitemapSync-4FRADGXF.js +0 -19
- package/dist/SitemapSync-IJRJ32Y3.mjs +0 -4
- package/dist/chunk-3QQDXQJE.js.map +0 -1
- package/dist/chunk-6YXRLC6W.mjs.map +0 -1
- package/dist/chunk-EGZEZR2I.mjs.map +0 -1
- package/dist/chunk-GADRLCYH.mjs.map +0 -1
- package/dist/chunk-JAXKHEOM.js.map +0 -1
- package/dist/chunk-JB6I5PYV.js.map +0 -1
- package/dist/chunk-TK76624B.mjs.map +0 -1
- package/dist/chunk-TLHRV3LZ.js.map +0 -1
- package/dist/chunk-UOBK3SSF.js.map +0 -1
- package/dist/chunk-W2TZYAUL.mjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { useAnalyticsOptional } from './chunk-FP66BKW6.mjs';
|
|
2
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import React5, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
4
5
|
|
|
@@ -395,6 +396,10 @@ function OfferingCard({
|
|
|
395
396
|
subscription: "Subscribe"
|
|
396
397
|
}[offering.type] || "View Details";
|
|
397
398
|
const handleClick = () => {
|
|
399
|
+
if (offering.external_url && typeof window !== "undefined") {
|
|
400
|
+
window.open(offering.external_url, "_blank", "noopener,noreferrer");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
398
403
|
if (onCtaClick) {
|
|
399
404
|
onCtaClick(offering);
|
|
400
405
|
} else if (typeof window !== "undefined") {
|
|
@@ -786,6 +791,10 @@ function EventTile({
|
|
|
786
791
|
const spotsRemaining = schedule ? getSpotsRemaining(schedule.capacity, schedule.current_registrations) : null;
|
|
787
792
|
const defaultCtaText = event.price && event.price > 0 ? "Get Tickets" : "Register Free";
|
|
788
793
|
const handleClick = async () => {
|
|
794
|
+
if (event.external_url) {
|
|
795
|
+
window.open(event.external_url, "_blank", "noopener,noreferrer");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
789
798
|
if (onCtaClick) {
|
|
790
799
|
onCtaClick(event);
|
|
791
800
|
return;
|
|
@@ -1164,6 +1173,128 @@ function ProductEmbed({
|
|
|
1164
1173
|
}
|
|
1165
1174
|
) });
|
|
1166
1175
|
}
|
|
1176
|
+
var CM_PER_INCH = 2.54;
|
|
1177
|
+
function convertValue(value, fromUnit) {
|
|
1178
|
+
if (fromUnit === "inches") return Math.round(value * CM_PER_INCH * 10) / 10;
|
|
1179
|
+
return Math.round(value / CM_PER_INCH * 10) / 10;
|
|
1180
|
+
}
|
|
1181
|
+
function SizeChart({ chart, selectedSize, className }) {
|
|
1182
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1183
|
+
const [showAlt, setShowAlt] = useState(false);
|
|
1184
|
+
if (!chart?.measurements?.length || !chart?.rows?.length) return null;
|
|
1185
|
+
const primaryUnit = chart.unit;
|
|
1186
|
+
const altUnit = primaryUnit === "inches" ? "cm" : "inches";
|
|
1187
|
+
const activeUnit = showAlt ? altUnit : primaryUnit;
|
|
1188
|
+
const unitLabel = activeUnit === "cm" ? "cm" : "in";
|
|
1189
|
+
function getDisplayValues(row) {
|
|
1190
|
+
if (!showAlt) return row.values;
|
|
1191
|
+
if (row.values_alt && row.values_alt.length === row.values.length) {
|
|
1192
|
+
return row.values_alt;
|
|
1193
|
+
}
|
|
1194
|
+
return row.values.map((v) => convertValue(v, primaryUnit));
|
|
1195
|
+
}
|
|
1196
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
1197
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
|
|
1198
|
+
/* @__PURE__ */ jsx(
|
|
1199
|
+
"button",
|
|
1200
|
+
{
|
|
1201
|
+
type: "button",
|
|
1202
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1203
|
+
style: {
|
|
1204
|
+
background: "none",
|
|
1205
|
+
border: "none",
|
|
1206
|
+
padding: 0,
|
|
1207
|
+
cursor: "pointer",
|
|
1208
|
+
fontSize: "14px",
|
|
1209
|
+
color: "inherit",
|
|
1210
|
+
opacity: 0.7,
|
|
1211
|
+
textDecoration: "underline",
|
|
1212
|
+
textUnderlineOffset: "2px"
|
|
1213
|
+
},
|
|
1214
|
+
children: isOpen ? "Hide Size Chart" : "View Size Chart"
|
|
1215
|
+
}
|
|
1216
|
+
),
|
|
1217
|
+
isOpen && /* @__PURE__ */ jsxs(
|
|
1218
|
+
"button",
|
|
1219
|
+
{
|
|
1220
|
+
type: "button",
|
|
1221
|
+
onClick: () => setShowAlt(!showAlt),
|
|
1222
|
+
style: {
|
|
1223
|
+
background: "none",
|
|
1224
|
+
border: "1px solid rgba(128,128,128,0.25)",
|
|
1225
|
+
borderRadius: "999px",
|
|
1226
|
+
padding: "2px 8px",
|
|
1227
|
+
cursor: "pointer",
|
|
1228
|
+
fontSize: "11px",
|
|
1229
|
+
lineHeight: 1.4,
|
|
1230
|
+
display: "flex",
|
|
1231
|
+
alignItems: "center",
|
|
1232
|
+
gap: 0
|
|
1233
|
+
},
|
|
1234
|
+
children: [
|
|
1235
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: showAlt ? 400 : 700, opacity: showAlt ? 0.45 : 1 }, children: "in" }),
|
|
1236
|
+
/* @__PURE__ */ jsx("span", { style: { margin: "0 3px", opacity: 0.3 }, children: "/" }),
|
|
1237
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: showAlt ? 700 : 400, opacity: showAlt ? 1 : 0.45 }, children: "cm" })
|
|
1238
|
+
]
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
] }),
|
|
1242
|
+
isOpen && /* @__PURE__ */ jsx("div", { style: { marginTop: "12px", overflowX: "auto" }, children: /* @__PURE__ */ jsxs(
|
|
1243
|
+
"table",
|
|
1244
|
+
{
|
|
1245
|
+
style: {
|
|
1246
|
+
width: "100%",
|
|
1247
|
+
borderCollapse: "collapse",
|
|
1248
|
+
fontSize: "13px",
|
|
1249
|
+
lineHeight: 1.5
|
|
1250
|
+
},
|
|
1251
|
+
children: [
|
|
1252
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1253
|
+
/* @__PURE__ */ jsx("th", { style: thStyle, children: "Size" }),
|
|
1254
|
+
chart.measurements.map((m) => /* @__PURE__ */ jsxs("th", { style: thStyle, children: [
|
|
1255
|
+
m,
|
|
1256
|
+
" ",
|
|
1257
|
+
/* @__PURE__ */ jsxs("span", { style: { opacity: 0.5, fontWeight: 400 }, children: [
|
|
1258
|
+
"(",
|
|
1259
|
+
unitLabel,
|
|
1260
|
+
")"
|
|
1261
|
+
] })
|
|
1262
|
+
] }, m))
|
|
1263
|
+
] }) }),
|
|
1264
|
+
/* @__PURE__ */ jsx("tbody", { children: chart.rows.map((row) => {
|
|
1265
|
+
const isSelected = selectedSize === row.size;
|
|
1266
|
+
const displayValues = getDisplayValues(row);
|
|
1267
|
+
return /* @__PURE__ */ jsxs(
|
|
1268
|
+
"tr",
|
|
1269
|
+
{
|
|
1270
|
+
style: {
|
|
1271
|
+
backgroundColor: isSelected ? "rgba(57, 191, 176, 0.08)" : void 0
|
|
1272
|
+
},
|
|
1273
|
+
children: [
|
|
1274
|
+
/* @__PURE__ */ jsx("td", { style: { ...tdStyle, fontWeight: 600 }, children: row.size }),
|
|
1275
|
+
displayValues.map((v, i) => /* @__PURE__ */ jsx("td", { style: tdStyle, children: v }, i))
|
|
1276
|
+
]
|
|
1277
|
+
},
|
|
1278
|
+
row.size
|
|
1279
|
+
);
|
|
1280
|
+
}) })
|
|
1281
|
+
]
|
|
1282
|
+
}
|
|
1283
|
+
) })
|
|
1284
|
+
] });
|
|
1285
|
+
}
|
|
1286
|
+
var thStyle = {
|
|
1287
|
+
padding: "8px 12px",
|
|
1288
|
+
textAlign: "left",
|
|
1289
|
+
fontWeight: 600,
|
|
1290
|
+
borderBottom: "1px solid rgba(128, 128, 128, 0.2)",
|
|
1291
|
+
whiteSpace: "nowrap"
|
|
1292
|
+
};
|
|
1293
|
+
var tdStyle = {
|
|
1294
|
+
padding: "8px 12px",
|
|
1295
|
+
borderBottom: "1px solid rgba(128, 128, 128, 0.1)",
|
|
1296
|
+
whiteSpace: "nowrap"
|
|
1297
|
+
};
|
|
1167
1298
|
function ProductDetail({
|
|
1168
1299
|
product: propProduct,
|
|
1169
1300
|
slug,
|
|
@@ -1189,6 +1320,20 @@ function ProductDetail({
|
|
|
1189
1320
|
const [quantity, setQuantity] = useState(1);
|
|
1190
1321
|
const [selectedImage, setSelectedImage] = useState(0);
|
|
1191
1322
|
const [checkingOut, setCheckingOut] = useState(false);
|
|
1323
|
+
const analytics = useAnalyticsOptional();
|
|
1324
|
+
useEffect(() => {
|
|
1325
|
+
if (!product || !analytics) return;
|
|
1326
|
+
analytics.trackEvent({
|
|
1327
|
+
name: "product_view",
|
|
1328
|
+
properties: {
|
|
1329
|
+
offering_id: product.id,
|
|
1330
|
+
name: product.name,
|
|
1331
|
+
price: product.price,
|
|
1332
|
+
type: product.type,
|
|
1333
|
+
category: product.category?.name
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
}, [product?.id, analytics]);
|
|
1192
1337
|
useEffect(() => {
|
|
1193
1338
|
if (propProduct) {
|
|
1194
1339
|
setProduct(propProduct);
|
|
@@ -1251,11 +1396,31 @@ function ProductDetail({
|
|
|
1251
1396
|
const isLowStock = product.track_inventory && inventoryCount !== void 0 && inventoryCount > 0 && inventoryCount <= 5;
|
|
1252
1397
|
const needsVariantSelection = (product.is_clothing || (product.variants?.length ?? 0) > 0) && !selectedVariant;
|
|
1253
1398
|
const handleAddToCart = () => {
|
|
1399
|
+
analytics?.trackEvent({
|
|
1400
|
+
name: "add_to_cart",
|
|
1401
|
+
properties: {
|
|
1402
|
+
offering_id: product.id,
|
|
1403
|
+
variant_id: selectedVariant?.id,
|
|
1404
|
+
quantity,
|
|
1405
|
+
price: selectedVariant?.price ?? product.price,
|
|
1406
|
+
name: product.name
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1254
1409
|
if (onAddToCart) {
|
|
1255
1410
|
onAddToCart(product, selectedVariant, quantity);
|
|
1256
1411
|
}
|
|
1257
1412
|
};
|
|
1258
1413
|
const handleBuyNow = async () => {
|
|
1414
|
+
analytics?.trackEvent({
|
|
1415
|
+
name: "add_to_cart",
|
|
1416
|
+
properties: {
|
|
1417
|
+
offering_id: product.id,
|
|
1418
|
+
variant_id: selectedVariant?.id,
|
|
1419
|
+
quantity,
|
|
1420
|
+
price: selectedVariant?.price ?? product.price,
|
|
1421
|
+
name: product.name
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1259
1424
|
if (onBuyNow) {
|
|
1260
1425
|
onBuyNow(product, selectedVariant, quantity);
|
|
1261
1426
|
return;
|
|
@@ -1432,6 +1597,13 @@ function ProductDetail({
|
|
|
1432
1597
|
);
|
|
1433
1598
|
}) })
|
|
1434
1599
|
] }),
|
|
1600
|
+
product.is_clothing && product.size_chart && /* @__PURE__ */ jsx("div", { style: { marginTop: "0.75rem" }, children: /* @__PURE__ */ jsx(
|
|
1601
|
+
SizeChart,
|
|
1602
|
+
{
|
|
1603
|
+
chart: product.size_chart,
|
|
1604
|
+
selectedSize: selectedVariant?.options?.["Size"]
|
|
1605
|
+
}
|
|
1606
|
+
) }),
|
|
1435
1607
|
showQuantity && !isOutOfStock && /* @__PURE__ */ jsxs("div", { className: "site-kit-product-detail__quantity", style: { marginTop: "1.5rem" }, children: [
|
|
1436
1608
|
/* @__PURE__ */ jsx("label", { style: {
|
|
1437
1609
|
display: "block",
|
|
@@ -2175,6 +2347,7 @@ function CheckoutForm({
|
|
|
2175
2347
|
phone: ""
|
|
2176
2348
|
});
|
|
2177
2349
|
const isProduct = offering.type === "product";
|
|
2350
|
+
const analytics = useAnalyticsOptional();
|
|
2178
2351
|
useEffect(() => {
|
|
2179
2352
|
fetchProcessorConfig().then((config) => {
|
|
2180
2353
|
if (config?.processor) setProcessor(config.processor);
|
|
@@ -2216,6 +2389,14 @@ function CheckoutForm({
|
|
|
2216
2389
|
e.preventDefault();
|
|
2217
2390
|
setLoading(true);
|
|
2218
2391
|
setError(null);
|
|
2392
|
+
analytics?.trackEvent({
|
|
2393
|
+
name: "checkout_start",
|
|
2394
|
+
properties: {
|
|
2395
|
+
offering_id: offering.id,
|
|
2396
|
+
total,
|
|
2397
|
+
quantity
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2219
2400
|
try {
|
|
2220
2401
|
if (actualMode === "register" && isEvent && scheduleId) {
|
|
2221
2402
|
const result = await registerForEvent(offering.id, scheduleId, customer);
|
|
@@ -4418,6 +4599,6 @@ function getApiKey() {
|
|
|
4418
4599
|
return "";
|
|
4419
4600
|
}
|
|
4420
4601
|
|
|
4421
|
-
export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, UpcomingEvents, createCheckoutSession, 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 };
|
|
4422
|
-
//# sourceMappingURL=chunk-
|
|
4423
|
-
//# sourceMappingURL=chunk-
|
|
4602
|
+
export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, SizeChart, UpcomingEvents, createCheckoutSession, 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 };
|
|
4603
|
+
//# sourceMappingURL=chunk-IZZ7XJYN.mjs.map
|
|
4604
|
+
//# sourceMappingURL=chunk-IZZ7XJYN.mjs.map
|