@sonordev/site-kit 1.3.2 → 1.3.4

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-TLHRV3LZ.js → chunk-MSBWUOIU.js} +176 -2
  34. package/dist/chunk-MSBWUOIU.js.map +1 -0
  35. package/dist/{chunk-5TTTX6NN.mjs → chunk-RNOXXICL.mjs} +5 -5
  36. package/dist/{chunk-5TTTX6NN.mjs.map → chunk-RNOXXICL.mjs.map} +1 -1
  37. package/dist/{chunk-6YXRLC6W.mjs → chunk-SQXUPIMK.mjs} +176 -3
  38. package/dist/chunk-SQXUPIMK.mjs.map +1 -0
  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-CnIJF-kB.d.mts} +12 -1
  78. package/dist/{types-CGlnp43R.d.ts → types-CnIJF-kB.d.ts} +12 -1
  79. package/dist/{useEventModal-BVTx69XE.d.mts → useEventModal-BFhhrNfN.d.mts} +1 -1
  80. package/dist/{useEventModal-Dx1dItTJ.d.ts → useEventModal-Cp5mbphv.d.ts} +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
 
@@ -1170,6 +1171,128 @@ function ProductEmbed({
1170
1171
  }
1171
1172
  ) });
1172
1173
  }
1174
+ var CM_PER_INCH = 2.54;
1175
+ function convertValue(value, fromUnit) {
1176
+ if (fromUnit === "inches") return Math.round(value * CM_PER_INCH * 10) / 10;
1177
+ return Math.round(value / CM_PER_INCH * 10) / 10;
1178
+ }
1179
+ function SizeChart({ chart, selectedSize, className }) {
1180
+ const [isOpen, setIsOpen] = React5.useState(false);
1181
+ const [showAlt, setShowAlt] = React5.useState(false);
1182
+ if (!chart?.measurements?.length || !chart?.rows?.length) return null;
1183
+ const primaryUnit = chart.unit;
1184
+ const altUnit = primaryUnit === "inches" ? "cm" : "inches";
1185
+ const activeUnit = showAlt ? altUnit : primaryUnit;
1186
+ const unitLabel = activeUnit === "cm" ? "cm" : "in";
1187
+ function getDisplayValues(row) {
1188
+ if (!showAlt) return row.values;
1189
+ if (row.values_alt && row.values_alt.length === row.values.length) {
1190
+ return row.values_alt;
1191
+ }
1192
+ return row.values.map((v) => convertValue(v, primaryUnit));
1193
+ }
1194
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1195
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
1196
+ /* @__PURE__ */ jsxRuntime.jsx(
1197
+ "button",
1198
+ {
1199
+ type: "button",
1200
+ onClick: () => setIsOpen(!isOpen),
1201
+ style: {
1202
+ background: "none",
1203
+ border: "none",
1204
+ padding: 0,
1205
+ cursor: "pointer",
1206
+ fontSize: "14px",
1207
+ color: "inherit",
1208
+ opacity: 0.7,
1209
+ textDecoration: "underline",
1210
+ textUnderlineOffset: "2px"
1211
+ },
1212
+ children: isOpen ? "Hide Size Chart" : "View Size Chart"
1213
+ }
1214
+ ),
1215
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
1216
+ "button",
1217
+ {
1218
+ type: "button",
1219
+ onClick: () => setShowAlt(!showAlt),
1220
+ style: {
1221
+ background: "none",
1222
+ border: "1px solid rgba(128,128,128,0.25)",
1223
+ borderRadius: "999px",
1224
+ padding: "2px 8px",
1225
+ cursor: "pointer",
1226
+ fontSize: "11px",
1227
+ lineHeight: 1.4,
1228
+ display: "flex",
1229
+ alignItems: "center",
1230
+ gap: 0
1231
+ },
1232
+ children: [
1233
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: showAlt ? 400 : 700, opacity: showAlt ? 0.45 : 1 }, children: "in" }),
1234
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 3px", opacity: 0.3 }, children: "/" }),
1235
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: showAlt ? 700 : 400, opacity: showAlt ? 1 : 0.45 }, children: "cm" })
1236
+ ]
1237
+ }
1238
+ )
1239
+ ] }),
1240
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "12px", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1241
+ "table",
1242
+ {
1243
+ style: {
1244
+ width: "100%",
1245
+ borderCollapse: "collapse",
1246
+ fontSize: "13px",
1247
+ lineHeight: 1.5
1248
+ },
1249
+ children: [
1250
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1251
+ /* @__PURE__ */ jsxRuntime.jsx("th", { style: thStyle, children: "Size" }),
1252
+ chart.measurements.map((m) => /* @__PURE__ */ jsxRuntime.jsxs("th", { style: thStyle, children: [
1253
+ m,
1254
+ " ",
1255
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { opacity: 0.5, fontWeight: 400 }, children: [
1256
+ "(",
1257
+ unitLabel,
1258
+ ")"
1259
+ ] })
1260
+ ] }, m))
1261
+ ] }) }),
1262
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: chart.rows.map((row) => {
1263
+ const isSelected = selectedSize === row.size;
1264
+ const displayValues = getDisplayValues(row);
1265
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1266
+ "tr",
1267
+ {
1268
+ style: {
1269
+ backgroundColor: isSelected ? "rgba(57, 191, 176, 0.08)" : void 0
1270
+ },
1271
+ children: [
1272
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { ...tdStyle, fontWeight: 600 }, children: row.size }),
1273
+ displayValues.map((v, i) => /* @__PURE__ */ jsxRuntime.jsx("td", { style: tdStyle, children: v }, i))
1274
+ ]
1275
+ },
1276
+ row.size
1277
+ );
1278
+ }) })
1279
+ ]
1280
+ }
1281
+ ) })
1282
+ ] });
1283
+ }
1284
+ var thStyle = {
1285
+ padding: "8px 12px",
1286
+ textAlign: "left",
1287
+ fontWeight: 600,
1288
+ borderBottom: "1px solid rgba(128, 128, 128, 0.2)",
1289
+ whiteSpace: "nowrap"
1290
+ };
1291
+ var tdStyle = {
1292
+ padding: "8px 12px",
1293
+ borderBottom: "1px solid rgba(128, 128, 128, 0.1)",
1294
+ whiteSpace: "nowrap"
1295
+ };
1173
1296
  function ProductDetail({
1174
1297
  product: propProduct,
1175
1298
  slug,
@@ -1195,6 +1318,20 @@ function ProductDetail({
1195
1318
  const [quantity, setQuantity] = React5.useState(1);
1196
1319
  const [selectedImage, setSelectedImage] = React5.useState(0);
1197
1320
  const [checkingOut, setCheckingOut] = React5.useState(false);
1321
+ const analytics = chunkGTLIGQDM_js.useAnalyticsOptional();
1322
+ React5.useEffect(() => {
1323
+ if (!product || !analytics) return;
1324
+ analytics.trackEvent({
1325
+ name: "product_view",
1326
+ properties: {
1327
+ offering_id: product.id,
1328
+ name: product.name,
1329
+ price: product.price,
1330
+ type: product.type,
1331
+ category: product.category?.name
1332
+ }
1333
+ });
1334
+ }, [product?.id, analytics]);
1198
1335
  React5.useEffect(() => {
1199
1336
  if (propProduct) {
1200
1337
  setProduct(propProduct);
@@ -1257,11 +1394,31 @@ function ProductDetail({
1257
1394
  const isLowStock = product.track_inventory && inventoryCount !== void 0 && inventoryCount > 0 && inventoryCount <= 5;
1258
1395
  const needsVariantSelection = (product.is_clothing || (product.variants?.length ?? 0) > 0) && !selectedVariant;
1259
1396
  const handleAddToCart = () => {
1397
+ analytics?.trackEvent({
1398
+ name: "add_to_cart",
1399
+ properties: {
1400
+ offering_id: product.id,
1401
+ variant_id: selectedVariant?.id,
1402
+ quantity,
1403
+ price: selectedVariant?.price ?? product.price,
1404
+ name: product.name
1405
+ }
1406
+ });
1260
1407
  if (onAddToCart) {
1261
1408
  onAddToCart(product, selectedVariant, quantity);
1262
1409
  }
1263
1410
  };
1264
1411
  const handleBuyNow = async () => {
1412
+ analytics?.trackEvent({
1413
+ name: "add_to_cart",
1414
+ properties: {
1415
+ offering_id: product.id,
1416
+ variant_id: selectedVariant?.id,
1417
+ quantity,
1418
+ price: selectedVariant?.price ?? product.price,
1419
+ name: product.name
1420
+ }
1421
+ });
1265
1422
  if (onBuyNow) {
1266
1423
  onBuyNow(product, selectedVariant, quantity);
1267
1424
  return;
@@ -1438,6 +1595,13 @@ function ProductDetail({
1438
1595
  );
1439
1596
  }) })
1440
1597
  ] }),
1598
+ product.is_clothing && product.size_chart && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "0.75rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1599
+ SizeChart,
1600
+ {
1601
+ chart: product.size_chart,
1602
+ selectedSize: selectedVariant?.options?.["Size"]
1603
+ }
1604
+ ) }),
1441
1605
  showQuantity && !isOutOfStock && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "site-kit-product-detail__quantity", style: { marginTop: "1.5rem" }, children: [
1442
1606
  /* @__PURE__ */ jsxRuntime.jsx("label", { style: {
1443
1607
  display: "block",
@@ -2181,6 +2345,7 @@ function CheckoutForm({
2181
2345
  phone: ""
2182
2346
  });
2183
2347
  const isProduct = offering.type === "product";
2348
+ const analytics = chunkGTLIGQDM_js.useAnalyticsOptional();
2184
2349
  React5.useEffect(() => {
2185
2350
  fetchProcessorConfig().then((config) => {
2186
2351
  if (config?.processor) setProcessor(config.processor);
@@ -2222,6 +2387,14 @@ function CheckoutForm({
2222
2387
  e.preventDefault();
2223
2388
  setLoading(true);
2224
2389
  setError(null);
2390
+ analytics?.trackEvent({
2391
+ name: "checkout_start",
2392
+ properties: {
2393
+ offering_id: offering.id,
2394
+ total,
2395
+ quantity
2396
+ }
2397
+ });
2225
2398
  try {
2226
2399
  if (actualMode === "register" && isEvent && scheduleId) {
2227
2400
  const result = await registerForEvent(offering.id, scheduleId, customer);
@@ -4438,6 +4611,7 @@ exports.ProductEmbed = ProductEmbed;
4438
4611
  exports.ProductGrid = ProductGrid;
4439
4612
  exports.ProductPage = ProductPage;
4440
4613
  exports.RegistrationForm = RegistrationForm;
4614
+ exports.SizeChart = SizeChart;
4441
4615
  exports.UpcomingEvents = UpcomingEvents;
4442
4616
  exports.createCheckoutSession = createCheckoutSession;
4443
4617
  exports.fetchActiveProcessor = fetchActiveProcessor;
@@ -4465,5 +4639,5 @@ exports.isEventSoldOut = isEventSoldOut;
4465
4639
  exports.registerForEvent = registerForEvent;
4466
4640
  exports.useEventModal = useEventModal;
4467
4641
  exports.validateAddress = validateAddress;
4468
- //# sourceMappingURL=chunk-TLHRV3LZ.js.map
4469
- //# sourceMappingURL=chunk-TLHRV3LZ.js.map
4642
+ //# sourceMappingURL=chunk-MSBWUOIU.js.map
4643
+ //# sourceMappingURL=chunk-MSBWUOIU.js.map