@sonordev/site-kit 1.4.1 → 1.4.2

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.
@@ -3128,6 +3128,34 @@ function ProductDetail({
3128
3128
  ...product.variants?.map((v) => v.image_url).filter(Boolean) || []
3129
3129
  ].filter(Boolean);
3130
3130
  }, [product]);
3131
+ const currentPrice = product ? selectedVariant?.price ?? product.price ?? 0 : 0;
3132
+ const compareAtPrice = product?.compare_at_price;
3133
+ const hasDiscount = compareAtPrice != null && compareAtPrice > currentPrice;
3134
+ const discountPercent = hasDiscount ? Math.round((compareAtPrice - currentPrice) / compareAtPrice * 100) : 0;
3135
+ const inventoryCount = selectedVariant?.inventory_count ?? product?.inventory_count;
3136
+ const isOutOfStock = !!product?.track_inventory && inventoryCount != null && inventoryCount <= 0;
3137
+ const isLowStock = !!product?.track_inventory && inventoryCount != null && inventoryCount > 0 && inventoryCount <= 5;
3138
+ const needsVariantSelection = product ? (product.is_clothing || (product.variants?.length ?? 0) > 1) && !selectedVariant : false;
3139
+ const hasExternalUrl = !!product?.external_url;
3140
+ const isEvent = product?.type === "event" || product?.type === "class";
3141
+ const isService = product?.type === "service";
3142
+ const isFree = !currentPrice || currentPrice === 0;
3143
+ const needsShipping = !!processorConfig?.shipping_enabled && product?.type === "product";
3144
+ const schedule = product?.schedules?.[0] || product?.next_schedule;
3145
+ const checkoutSteps = React5.useMemo(() => {
3146
+ const steps = ["customer-info"];
3147
+ if (needsShipping) steps.push("shipping", "rates");
3148
+ if (!isFree) steps.push("payment");
3149
+ return steps;
3150
+ }, [needsShipping, isFree]);
3151
+ const ctaLabel = React5.useMemo(() => {
3152
+ if (isOutOfStock) return "Out of Stock";
3153
+ if (needsVariantSelection) return product?.is_clothing ? "Select Size" : "Select Option";
3154
+ if (hasExternalUrl) return product?.type === "event" ? "Get Tickets" : "Learn More";
3155
+ if (isEvent) return isFree ? "Register Free" : "Get Tickets";
3156
+ if (isService) return "Book Now";
3157
+ return isFree ? "Get It Free" : "Buy Now";
3158
+ }, [isOutOfStock, needsVariantSelection, hasExternalUrl, isEvent, isService, isFree, product?.is_clothing, product?.type]);
3131
3159
  if (!product) {
3132
3160
  if (loading) {
3133
3161
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `skc-detail ${className}`, style: customStyle, children: [
@@ -3155,30 +3183,6 @@ function ProductDetail({
3155
3183
  ] })
3156
3184
  ] });
3157
3185
  }
3158
- const currentPrice = selectedVariant?.price ?? product.price ?? 0;
3159
- const compareAtPrice = product.compare_at_price;
3160
- const hasDiscount = compareAtPrice != null && compareAtPrice > currentPrice;
3161
- const discountPercent = hasDiscount ? Math.round((compareAtPrice - currentPrice) / compareAtPrice * 100) : 0;
3162
- const inventoryCount = selectedVariant?.inventory_count ?? product.inventory_count;
3163
- const isOutOfStock = product.track_inventory && inventoryCount != null && inventoryCount <= 0;
3164
- const isLowStock = product.track_inventory && inventoryCount != null && inventoryCount > 0 && inventoryCount <= 5;
3165
- const needsVariantSelection = (product.is_clothing || (product.variants?.length ?? 0) > 1) && !selectedVariant;
3166
- const isEvent = product.type === "event";
3167
- const isService = product.type === "service";
3168
- const hasExternalUrl = !!product.external_url;
3169
- const isFree = !product.price || product.price === 0;
3170
- const needsShipping = !!processorConfig?.shipping_enabled && product.type === "product";
3171
- const schedule = product.schedules?.[0] || product.next_schedule;
3172
- const checkoutSteps = React5.useMemo(() => {
3173
- const steps = ["customer-info"];
3174
- if (needsShipping) {
3175
- steps.push("shipping", "rates");
3176
- }
3177
- if (!isFree) {
3178
- steps.push("payment");
3179
- }
3180
- return steps;
3181
- }, [needsShipping, isFree]);
3182
3186
  const handleVariantChange = (variant) => {
3183
3187
  setSelectedVariant(variant);
3184
3188
  if (variant.image_url) {
@@ -3323,14 +3327,6 @@ function ProductDetail({
3323
3327
  setCheckoutResult(null);
3324
3328
  }
3325
3329
  };
3326
- const ctaLabel = React5.useMemo(() => {
3327
- if (isOutOfStock) return "Out of Stock";
3328
- if (needsVariantSelection) return product.is_clothing ? "Select Size" : "Select Option";
3329
- if (hasExternalUrl) return product.type === "event" ? "Get Tickets" : "Learn More";
3330
- if (isEvent) return isFree ? "Register Free" : "Get Tickets";
3331
- if (isService) return "Book Now";
3332
- return isFree ? "Get It Free" : "Buy Now";
3333
- }, [isOutOfStock, needsVariantSelection, hasExternalUrl, isEvent, isService, isFree, product.is_clothing]);
3334
3330
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `skc-detail ${className}`, style: customStyle, children: [
3335
3331
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: STYLE_BLOCK }),
3336
3332
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `skc-detail-layout${layout === "stacked" ? " skc-stacked" : ""}`, children: [
@@ -6603,5 +6599,5 @@ exports.isEventSoldOut = isEventSoldOut;
6603
6599
  exports.registerForEvent = registerForEvent;
6604
6600
  exports.useEventModal = useEventModal;
6605
6601
  exports.validateAddress = validateAddress;
6606
- //# sourceMappingURL=chunk-EDQSKBFX.js.map
6607
- //# sourceMappingURL=chunk-EDQSKBFX.js.map
6602
+ //# sourceMappingURL=chunk-B46F5RXP.js.map
6603
+ //# sourceMappingURL=chunk-B46F5RXP.js.map