@sonordev/site-kit 1.4.0 → 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.
@@ -3122,6 +3122,34 @@ function ProductDetail({
3122
3122
  ...product.variants?.map((v) => v.image_url).filter(Boolean) || []
3123
3123
  ].filter(Boolean);
3124
3124
  }, [product]);
3125
+ const currentPrice = product ? selectedVariant?.price ?? product.price ?? 0 : 0;
3126
+ const compareAtPrice = product?.compare_at_price;
3127
+ const hasDiscount = compareAtPrice != null && compareAtPrice > currentPrice;
3128
+ const discountPercent = hasDiscount ? Math.round((compareAtPrice - currentPrice) / compareAtPrice * 100) : 0;
3129
+ const inventoryCount = selectedVariant?.inventory_count ?? product?.inventory_count;
3130
+ const isOutOfStock = !!product?.track_inventory && inventoryCount != null && inventoryCount <= 0;
3131
+ const isLowStock = !!product?.track_inventory && inventoryCount != null && inventoryCount > 0 && inventoryCount <= 5;
3132
+ const needsVariantSelection = product ? (product.is_clothing || (product.variants?.length ?? 0) > 1) && !selectedVariant : false;
3133
+ const hasExternalUrl = !!product?.external_url;
3134
+ const isEvent = product?.type === "event" || product?.type === "class";
3135
+ const isService = product?.type === "service";
3136
+ const isFree = !currentPrice || currentPrice === 0;
3137
+ const needsShipping = !!processorConfig?.shipping_enabled && product?.type === "product";
3138
+ const schedule = product?.schedules?.[0] || product?.next_schedule;
3139
+ const checkoutSteps = useMemo(() => {
3140
+ const steps = ["customer-info"];
3141
+ if (needsShipping) steps.push("shipping", "rates");
3142
+ if (!isFree) steps.push("payment");
3143
+ return steps;
3144
+ }, [needsShipping, isFree]);
3145
+ const ctaLabel = useMemo(() => {
3146
+ if (isOutOfStock) return "Out of Stock";
3147
+ if (needsVariantSelection) return product?.is_clothing ? "Select Size" : "Select Option";
3148
+ if (hasExternalUrl) return product?.type === "event" ? "Get Tickets" : "Learn More";
3149
+ if (isEvent) return isFree ? "Register Free" : "Get Tickets";
3150
+ if (isService) return "Book Now";
3151
+ return isFree ? "Get It Free" : "Buy Now";
3152
+ }, [isOutOfStock, needsVariantSelection, hasExternalUrl, isEvent, isService, isFree, product?.is_clothing, product?.type]);
3125
3153
  if (!product) {
3126
3154
  if (loading) {
3127
3155
  return /* @__PURE__ */ jsxs("div", { className: `skc-detail ${className}`, style: customStyle, children: [
@@ -3149,30 +3177,6 @@ function ProductDetail({
3149
3177
  ] })
3150
3178
  ] });
3151
3179
  }
3152
- const currentPrice = selectedVariant?.price ?? product.price ?? 0;
3153
- const compareAtPrice = product.compare_at_price;
3154
- const hasDiscount = compareAtPrice != null && compareAtPrice > currentPrice;
3155
- const discountPercent = hasDiscount ? Math.round((compareAtPrice - currentPrice) / compareAtPrice * 100) : 0;
3156
- const inventoryCount = selectedVariant?.inventory_count ?? product.inventory_count;
3157
- const isOutOfStock = product.track_inventory && inventoryCount != null && inventoryCount <= 0;
3158
- const isLowStock = product.track_inventory && inventoryCount != null && inventoryCount > 0 && inventoryCount <= 5;
3159
- const needsVariantSelection = (product.is_clothing || (product.variants?.length ?? 0) > 1) && !selectedVariant;
3160
- const isEvent = product.type === "event";
3161
- const isService = product.type === "service";
3162
- const hasExternalUrl = !!product.external_url;
3163
- const isFree = !product.price || product.price === 0;
3164
- const needsShipping = !!processorConfig?.shipping_enabled && product.type === "product";
3165
- const schedule = product.schedules?.[0] || product.next_schedule;
3166
- const checkoutSteps = useMemo(() => {
3167
- const steps = ["customer-info"];
3168
- if (needsShipping) {
3169
- steps.push("shipping", "rates");
3170
- }
3171
- if (!isFree) {
3172
- steps.push("payment");
3173
- }
3174
- return steps;
3175
- }, [needsShipping, isFree]);
3176
3180
  const handleVariantChange = (variant) => {
3177
3181
  setSelectedVariant(variant);
3178
3182
  if (variant.image_url) {
@@ -3317,14 +3321,6 @@ function ProductDetail({
3317
3321
  setCheckoutResult(null);
3318
3322
  }
3319
3323
  };
3320
- const ctaLabel = useMemo(() => {
3321
- if (isOutOfStock) return "Out of Stock";
3322
- if (needsVariantSelection) return product.is_clothing ? "Select Size" : "Select Option";
3323
- if (hasExternalUrl) return product.type === "event" ? "Get Tickets" : "Learn More";
3324
- if (isEvent) return isFree ? "Register Free" : "Get Tickets";
3325
- if (isService) return "Book Now";
3326
- return isFree ? "Get It Free" : "Buy Now";
3327
- }, [isOutOfStock, needsVariantSelection, hasExternalUrl, isEvent, isService, isFree, product.is_clothing]);
3328
3324
  return /* @__PURE__ */ jsxs("div", { className: `skc-detail ${className}`, style: customStyle, children: [
3329
3325
  /* @__PURE__ */ jsx("style", { children: STYLE_BLOCK }),
3330
3326
  /* @__PURE__ */ jsxs("div", { className: `skc-detail-layout${layout === "stacked" ? " skc-stacked" : ""}`, children: [
@@ -6555,5 +6551,5 @@ function getApiKey2() {
6555
6551
  }
6556
6552
 
6557
6553
  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 };
6558
- //# sourceMappingURL=chunk-ULAQCW4X.mjs.map
6559
- //# sourceMappingURL=chunk-ULAQCW4X.mjs.map
6554
+ //# sourceMappingURL=chunk-KGNO6DZH.mjs.map
6555
+ //# sourceMappingURL=chunk-KGNO6DZH.mjs.map