@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.
Files changed (97) hide show
  1. package/dist/AnalyticsProvider-SC4YOBFI.js +25 -0
  2. package/dist/{AnalyticsProvider-PIUZBIOK.js.map → AnalyticsProvider-SC4YOBFI.js.map} +1 -1
  3. package/dist/AnalyticsProvider-ZVZ2SNZR.mjs +4 -0
  4. package/dist/{AnalyticsProvider-FX5TLRQC.mjs.map → AnalyticsProvider-ZVZ2SNZR.mjs.map} +1 -1
  5. package/dist/EngageWidget-RWBCI4RM.mjs +4 -0
  6. package/dist/{EngageWidget-R7YFQBS5.mjs.map → EngageWidget-RWBCI4RM.mjs.map} +1 -1
  7. package/dist/EngageWidget-T2S5WUMJ.js +13 -0
  8. package/dist/{EngageWidget-I4AZTKFY.js.map → EngageWidget-T2S5WUMJ.js.map} +1 -1
  9. package/dist/SitemapSync-6I5JTLER.js +13 -0
  10. package/dist/{SitemapSync-4FRADGXF.js.map → SitemapSync-6I5JTLER.js.map} +1 -1
  11. package/dist/SitemapSync-6L45DHRH.mjs +4 -0
  12. package/dist/{SitemapSync-IJRJ32Y3.mjs.map → SitemapSync-6L45DHRH.mjs.map} +1 -1
  13. package/dist/analytics/index.d.mts +6 -1
  14. package/dist/analytics/index.d.ts +6 -1
  15. package/dist/analytics/index.js +19 -69
  16. package/dist/analytics/index.js.map +1 -1
  17. package/dist/analytics/index.mjs +2 -67
  18. package/dist/analytics/index.mjs.map +1 -1
  19. package/dist/{chunk-NZHVGBAF.js → chunk-5DAALKHB.js} +5 -5
  20. package/dist/{chunk-NZHVGBAF.js.map → chunk-5DAALKHB.js.map} +1 -1
  21. package/dist/chunk-AU4GIQQU.mjs +69 -0
  22. package/dist/chunk-AU4GIQQU.mjs.map +1 -0
  23. package/dist/{chunk-3QQDXQJE.js → chunk-DK2WNYQA.js} +7 -7
  24. package/dist/chunk-DK2WNYQA.js.map +1 -0
  25. package/dist/{chunk-TK76624B.mjs → chunk-FP66BKW6.mjs} +6 -3
  26. package/dist/chunk-FP66BKW6.mjs.map +1 -0
  27. package/dist/chunk-FRN4JQXL.js +72 -0
  28. package/dist/chunk-FRN4JQXL.js.map +1 -0
  29. package/dist/{chunk-JAXKHEOM.js → chunk-GTLIGQDM.js} +6 -2
  30. package/dist/chunk-GTLIGQDM.js.map +1 -0
  31. package/dist/{chunk-EGZEZR2I.mjs → chunk-HNCSTGVK.mjs} +3 -4
  32. package/dist/chunk-HNCSTGVK.mjs.map +1 -0
  33. package/dist/{chunk-6YXRLC6W.mjs → chunk-IZZ7XJYN.mjs} +184 -3
  34. package/dist/chunk-IZZ7XJYN.mjs.map +1 -0
  35. package/dist/{chunk-TLHRV3LZ.js → chunk-KYNUBF64.js} +184 -2
  36. package/dist/chunk-KYNUBF64.js.map +1 -0
  37. package/dist/{chunk-5TTTX6NN.mjs → chunk-RNOXXICL.mjs} +5 -5
  38. package/dist/{chunk-5TTTX6NN.mjs.map → chunk-RNOXXICL.mjs.map} +1 -1
  39. package/dist/{chunk-JB6I5PYV.js → chunk-V2WSPLCN.js} +2 -4
  40. package/dist/chunk-V2WSPLCN.js.map +1 -0
  41. package/dist/{chunk-GADRLCYH.mjs → chunk-VZMRZQ2D.mjs} +7 -7
  42. package/dist/chunk-VZMRZQ2D.mjs.map +1 -0
  43. package/dist/{chunk-W2TZYAUL.mjs → chunk-WW2DKGBM.mjs} +3 -4
  44. package/dist/chunk-WW2DKGBM.mjs.map +1 -0
  45. package/dist/{chunk-UOBK3SSF.js → chunk-YBQT623Y.js} +2 -4
  46. package/dist/chunk-YBQT623Y.js.map +1 -0
  47. package/dist/commerce/index.d.mts +11 -4
  48. package/dist/commerce/index.d.ts +11 -4
  49. package/dist/commerce/index.js +48 -42
  50. package/dist/commerce/index.mjs +3 -1
  51. package/dist/commerce/server.d.mts +1 -1
  52. package/dist/commerce/server.d.ts +1 -1
  53. package/dist/engage/index.d.mts +35 -2
  54. package/dist/engage/index.d.ts +35 -2
  55. package/dist/engage/index.js +32 -5
  56. package/dist/engage/index.js.map +1 -1
  57. package/dist/engage/index.mjs +30 -1
  58. package/dist/engage/index.mjs.map +1 -1
  59. package/dist/forms/index.js +20 -1
  60. package/dist/forms/index.js.map +1 -1
  61. package/dist/forms/index.mjs +20 -1
  62. package/dist/forms/index.mjs.map +1 -1
  63. package/dist/index.d.mts +2 -2
  64. package/dist/index.d.ts +2 -2
  65. package/dist/index.js +45 -44
  66. package/dist/index.js.map +1 -1
  67. package/dist/index.mjs +6 -5
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/layout/client.js +2 -2
  70. package/dist/layout/client.mjs +1 -1
  71. package/dist/layout/index.js +2 -2
  72. package/dist/layout/index.mjs +1 -1
  73. package/dist/seo/index.js +2 -2
  74. package/dist/seo/index.mjs +1 -1
  75. package/dist/sync/index.js +13 -19
  76. package/dist/sync/index.mjs +1 -1
  77. package/dist/{types-CGlnp43R.d.mts → types-CyUfjlzS.d.mts} +14 -1
  78. package/dist/{types-CGlnp43R.d.ts → types-CyUfjlzS.d.ts} +14 -1
  79. package/dist/{useEventModal-Dx1dItTJ.d.ts → useEventModal-CmPo7hkj.d.ts} +1 -1
  80. package/dist/{useEventModal-BVTx69XE.d.mts → useEventModal-shBjc8CK.d.mts} +1 -1
  81. package/package.json +1 -1
  82. package/dist/AnalyticsProvider-FX5TLRQC.mjs +0 -4
  83. package/dist/AnalyticsProvider-PIUZBIOK.js +0 -21
  84. package/dist/EngageWidget-I4AZTKFY.js +0 -13
  85. package/dist/EngageWidget-R7YFQBS5.mjs +0 -4
  86. package/dist/SitemapSync-4FRADGXF.js +0 -19
  87. package/dist/SitemapSync-IJRJ32Y3.mjs +0 -4
  88. package/dist/chunk-3QQDXQJE.js.map +0 -1
  89. package/dist/chunk-6YXRLC6W.mjs.map +0 -1
  90. package/dist/chunk-EGZEZR2I.mjs.map +0 -1
  91. package/dist/chunk-GADRLCYH.mjs.map +0 -1
  92. package/dist/chunk-JAXKHEOM.js.map +0 -1
  93. package/dist/chunk-JB6I5PYV.js.map +0 -1
  94. package/dist/chunk-TK76624B.mjs.map +0 -1
  95. package/dist/chunk-TLHRV3LZ.js.map +0 -1
  96. package/dist/chunk-UOBK3SSF.js.map +0 -1
  97. package/dist/chunk-W2TZYAUL.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
+ var chunkGTLIGQDM_js = require('./chunk-GTLIGQDM.js');
4
5
  var jsxRuntime = require('react/jsx-runtime');
5
6
  var React5 = require('react');
6
7
 
@@ -401,6 +402,10 @@ function OfferingCard({
401
402
  subscription: "Subscribe"
402
403
  }[offering.type] || "View Details";
403
404
  const handleClick = () => {
405
+ if (offering.external_url && typeof window !== "undefined") {
406
+ window.open(offering.external_url, "_blank", "noopener,noreferrer");
407
+ return;
408
+ }
404
409
  if (onCtaClick) {
405
410
  onCtaClick(offering);
406
411
  } else if (typeof window !== "undefined") {
@@ -792,6 +797,10 @@ function EventTile({
792
797
  const spotsRemaining = schedule ? getSpotsRemaining(schedule.capacity, schedule.current_registrations) : null;
793
798
  const defaultCtaText = event.price && event.price > 0 ? "Get Tickets" : "Register Free";
794
799
  const handleClick = async () => {
800
+ if (event.external_url) {
801
+ window.open(event.external_url, "_blank", "noopener,noreferrer");
802
+ return;
803
+ }
795
804
  if (onCtaClick) {
796
805
  onCtaClick(event);
797
806
  return;
@@ -1170,6 +1179,128 @@ function ProductEmbed({
1170
1179
  }
1171
1180
  ) });
1172
1181
  }
1182
+ var CM_PER_INCH = 2.54;
1183
+ function convertValue(value, fromUnit) {
1184
+ if (fromUnit === "inches") return Math.round(value * CM_PER_INCH * 10) / 10;
1185
+ return Math.round(value / CM_PER_INCH * 10) / 10;
1186
+ }
1187
+ function SizeChart({ chart, selectedSize, className }) {
1188
+ const [isOpen, setIsOpen] = React5.useState(false);
1189
+ const [showAlt, setShowAlt] = React5.useState(false);
1190
+ if (!chart?.measurements?.length || !chart?.rows?.length) return null;
1191
+ const primaryUnit = chart.unit;
1192
+ const altUnit = primaryUnit === "inches" ? "cm" : "inches";
1193
+ const activeUnit = showAlt ? altUnit : primaryUnit;
1194
+ const unitLabel = activeUnit === "cm" ? "cm" : "in";
1195
+ function getDisplayValues(row) {
1196
+ if (!showAlt) return row.values;
1197
+ if (row.values_alt && row.values_alt.length === row.values.length) {
1198
+ return row.values_alt;
1199
+ }
1200
+ return row.values.map((v) => convertValue(v, primaryUnit));
1201
+ }
1202
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1203
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
1204
+ /* @__PURE__ */ jsxRuntime.jsx(
1205
+ "button",
1206
+ {
1207
+ type: "button",
1208
+ onClick: () => setIsOpen(!isOpen),
1209
+ style: {
1210
+ background: "none",
1211
+ border: "none",
1212
+ padding: 0,
1213
+ cursor: "pointer",
1214
+ fontSize: "14px",
1215
+ color: "inherit",
1216
+ opacity: 0.7,
1217
+ textDecoration: "underline",
1218
+ textUnderlineOffset: "2px"
1219
+ },
1220
+ children: isOpen ? "Hide Size Chart" : "View Size Chart"
1221
+ }
1222
+ ),
1223
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
1224
+ "button",
1225
+ {
1226
+ type: "button",
1227
+ onClick: () => setShowAlt(!showAlt),
1228
+ style: {
1229
+ background: "none",
1230
+ border: "1px solid rgba(128,128,128,0.25)",
1231
+ borderRadius: "999px",
1232
+ padding: "2px 8px",
1233
+ cursor: "pointer",
1234
+ fontSize: "11px",
1235
+ lineHeight: 1.4,
1236
+ display: "flex",
1237
+ alignItems: "center",
1238
+ gap: 0
1239
+ },
1240
+ children: [
1241
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: showAlt ? 400 : 700, opacity: showAlt ? 0.45 : 1 }, children: "in" }),
1242
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 3px", opacity: 0.3 }, children: "/" }),
1243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: showAlt ? 700 : 400, opacity: showAlt ? 1 : 0.45 }, children: "cm" })
1244
+ ]
1245
+ }
1246
+ )
1247
+ ] }),
1248
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "12px", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1249
+ "table",
1250
+ {
1251
+ style: {
1252
+ width: "100%",
1253
+ borderCollapse: "collapse",
1254
+ fontSize: "13px",
1255
+ lineHeight: 1.5
1256
+ },
1257
+ children: [
1258
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1259
+ /* @__PURE__ */ jsxRuntime.jsx("th", { style: thStyle, children: "Size" }),
1260
+ chart.measurements.map((m) => /* @__PURE__ */ jsxRuntime.jsxs("th", { style: thStyle, children: [
1261
+ m,
1262
+ " ",
1263
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { opacity: 0.5, fontWeight: 400 }, children: [
1264
+ "(",
1265
+ unitLabel,
1266
+ ")"
1267
+ ] })
1268
+ ] }, m))
1269
+ ] }) }),
1270
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: chart.rows.map((row) => {
1271
+ const isSelected = selectedSize === row.size;
1272
+ const displayValues = getDisplayValues(row);
1273
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1274
+ "tr",
1275
+ {
1276
+ style: {
1277
+ backgroundColor: isSelected ? "rgba(57, 191, 176, 0.08)" : void 0
1278
+ },
1279
+ children: [
1280
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { ...tdStyle, fontWeight: 600 }, children: row.size }),
1281
+ displayValues.map((v, i) => /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle, children: v }, i))
1282
+ ]
1283
+ },
1284
+ row.size
1285
+ );
1286
+ }) })
1287
+ ]
1288
+ }
1289
+ ) })
1290
+ ] });
1291
+ }
1292
+ var thStyle = {
1293
+ padding: "8px 12px",
1294
+ textAlign: "left",
1295
+ fontWeight: 600,
1296
+ borderBottom: "1px solid rgba(128, 128, 128, 0.2)",
1297
+ whiteSpace: "nowrap"
1298
+ };
1299
+ var tdStyle = {
1300
+ padding: "8px 12px",
1301
+ borderBottom: "1px solid rgba(128, 128, 128, 0.1)",
1302
+ whiteSpace: "nowrap"
1303
+ };
1173
1304
  function ProductDetail({
1174
1305
  product: propProduct,
1175
1306
  slug,
@@ -1195,6 +1326,20 @@ function ProductDetail({
1195
1326
  const [quantity, setQuantity] = React5.useState(1);
1196
1327
  const [selectedImage, setSelectedImage] = React5.useState(0);
1197
1328
  const [checkingOut, setCheckingOut] = React5.useState(false);
1329
+ const analytics = chunkGTLIGQDM_js.useAnalyticsOptional();
1330
+ React5.useEffect(() => {
1331
+ if (!product || !analytics) return;
1332
+ analytics.trackEvent({
1333
+ name: "product_view",
1334
+ properties: {
1335
+ offering_id: product.id,
1336
+ name: product.name,
1337
+ price: product.price,
1338
+ type: product.type,
1339
+ category: product.category?.name
1340
+ }
1341
+ });
1342
+ }, [product?.id, analytics]);
1198
1343
  React5.useEffect(() => {
1199
1344
  if (propProduct) {
1200
1345
  setProduct(propProduct);
@@ -1257,11 +1402,31 @@ function ProductDetail({
1257
1402
  const isLowStock = product.track_inventory && inventoryCount !== void 0 && inventoryCount > 0 && inventoryCount <= 5;
1258
1403
  const needsVariantSelection = (product.is_clothing || (product.variants?.length ?? 0) > 0) && !selectedVariant;
1259
1404
  const handleAddToCart = () => {
1405
+ analytics?.trackEvent({
1406
+ name: "add_to_cart",
1407
+ properties: {
1408
+ offering_id: product.id,
1409
+ variant_id: selectedVariant?.id,
1410
+ quantity,
1411
+ price: selectedVariant?.price ?? product.price,
1412
+ name: product.name
1413
+ }
1414
+ });
1260
1415
  if (onAddToCart) {
1261
1416
  onAddToCart(product, selectedVariant, quantity);
1262
1417
  }
1263
1418
  };
1264
1419
  const handleBuyNow = async () => {
1420
+ analytics?.trackEvent({
1421
+ name: "add_to_cart",
1422
+ properties: {
1423
+ offering_id: product.id,
1424
+ variant_id: selectedVariant?.id,
1425
+ quantity,
1426
+ price: selectedVariant?.price ?? product.price,
1427
+ name: product.name
1428
+ }
1429
+ });
1265
1430
  if (onBuyNow) {
1266
1431
  onBuyNow(product, selectedVariant, quantity);
1267
1432
  return;
@@ -1438,6 +1603,13 @@ function ProductDetail({
1438
1603
  );
1439
1604
  }) })
1440
1605
  ] }),
1606
+ product.is_clothing && product.size_chart && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "0.75rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1607
+ SizeChart,
1608
+ {
1609
+ chart: product.size_chart,
1610
+ selectedSize: selectedVariant?.options?.["Size"]
1611
+ }
1612
+ ) }),
1441
1613
  showQuantity && !isOutOfStock && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "site-kit-product-detail__quantity", style: { marginTop: "1.5rem" }, children: [
1442
1614
  /* @__PURE__ */ jsxRuntime.jsx("label", { style: {
1443
1615
  display: "block",
@@ -2181,6 +2353,7 @@ function CheckoutForm({
2181
2353
  phone: ""
2182
2354
  });
2183
2355
  const isProduct = offering.type === "product";
2356
+ const analytics = chunkGTLIGQDM_js.useAnalyticsOptional();
2184
2357
  React5.useEffect(() => {
2185
2358
  fetchProcessorConfig().then((config) => {
2186
2359
  if (config?.processor) setProcessor(config.processor);
@@ -2222,6 +2395,14 @@ function CheckoutForm({
2222
2395
  e.preventDefault();
2223
2396
  setLoading(true);
2224
2397
  setError(null);
2398
+ analytics?.trackEvent({
2399
+ name: "checkout_start",
2400
+ properties: {
2401
+ offering_id: offering.id,
2402
+ total,
2403
+ quantity
2404
+ }
2405
+ });
2225
2406
  try {
2226
2407
  if (actualMode === "register" && isEvent && scheduleId) {
2227
2408
  const result = await registerForEvent(offering.id, scheduleId, customer);
@@ -4438,6 +4619,7 @@ exports.ProductEmbed = ProductEmbed;
4438
4619
  exports.ProductGrid = ProductGrid;
4439
4620
  exports.ProductPage = ProductPage;
4440
4621
  exports.RegistrationForm = RegistrationForm;
4622
+ exports.SizeChart = SizeChart;
4441
4623
  exports.UpcomingEvents = UpcomingEvents;
4442
4624
  exports.createCheckoutSession = createCheckoutSession;
4443
4625
  exports.fetchActiveProcessor = fetchActiveProcessor;
@@ -4465,5 +4647,5 @@ exports.isEventSoldOut = isEventSoldOut;
4465
4647
  exports.registerForEvent = registerForEvent;
4466
4648
  exports.useEventModal = useEventModal;
4467
4649
  exports.validateAddress = validateAddress;
4468
- //# sourceMappingURL=chunk-TLHRV3LZ.js.map
4469
- //# sourceMappingURL=chunk-TLHRV3LZ.js.map
4650
+ //# sourceMappingURL=chunk-KYNUBF64.js.map
4651
+ //# sourceMappingURL=chunk-KYNUBF64.js.map