storefront-layouts 1.0.9 → 1.0.13
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/components/shipping/ProductDeliveryInfoSection.d.ts.map +1 -1
- package/dist/components/shipping/ProductDeliveryInfoSection.js +10 -3
- package/dist/components/ui/address-selector.d.ts.map +1 -1
- package/dist/components/ui/address-selector.js +4 -3
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/checkout-button.d.ts.map +1 -1
- package/dist/components/ui/checkout-button.js +2 -1
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +15 -4
- package/dist/components/ui/route-skeleton-loader.d.ts.map +1 -1
- package/dist/components/ui/route-skeleton-loader.js +6 -2
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +2 -2
- package/dist/components/ui/skeletons/checkout-skeleton.js +1 -1
- package/dist/editor/blocks/defaults/clothing-minimal-home.js +1 -1
- package/dist/editor/blocks/migrate-clothing-minimal.js +1 -1
- package/dist/hooks/use-pdp-variation.d.ts +57 -0
- package/dist/hooks/use-pdp-variation.d.ts.map +1 -0
- package/dist/hooks/use-pdp-variation.js +69 -0
- package/dist/hooks/use-product-by-slug.d.ts.map +1 -1
- package/dist/hooks/use-product-by-slug.js +0 -5
- package/dist/hooks/use-product-variation-selection.js +1 -1
- package/dist/hooks/use-shipping-quote.d.ts +1 -0
- package/dist/hooks/use-shipping-quote.d.ts.map +1 -1
- package/dist/hooks/use-shipping-quote.js +3 -0
- package/dist/layouts/booking/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/booking/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/booking-agenda/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/booking-agenda/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/clothing/components/ClothingHomePage.d.ts.map +1 -1
- package/dist/layouts/clothing/components/ClothingHomePage.js +40 -2
- package/dist/layouts/clothing/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/clothing/pages/ProductDetailPage.js +127 -209
- package/dist/layouts/clothing/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/clothing/pages/ProductsPage.js +2 -5
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.js +5 -3
- package/dist/layouts/clothing-minimal/components/clothing-minimal-block-render.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/components/clothing-minimal-block-render.js +13 -4
- package/dist/layouts/clothing-minimal/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/clothing-minimal/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/pages/ProductsPage.js +2 -5
- package/dist/layouts/electronics/components/ElectronicsGridProductCard.js +1 -1
- package/dist/layouts/electronics/components/ElectronicsStoreHeader.d.ts.map +1 -1
- package/dist/layouts/electronics/components/ElectronicsStoreHeader.js +10 -9
- package/dist/layouts/electronics/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/electronics/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/electronics/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/electronics/pages/ProductsPage.js +2 -5
- package/dist/layouts/electronics-grid/components/ElectronicsGridProductCard.js +1 -1
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.js +4 -5
- package/dist/layouts/electronics-grid/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/electronics-grid/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/pages/ProductsPage.js +2 -5
- package/dist/layouts/food/pages/MenuPage.js +1 -1
- package/dist/layouts/food/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/food/pages/ProductDetailPage.js +37 -140
- package/dist/layouts/food/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/food/pages/ProductsPage.js +2 -5
- package/dist/layouts/food-modern/pages/MenuPage.js +1 -1
- package/dist/layouts/food-modern/pages/ProductDetailPage.d.ts.map +1 -1
- package/dist/layouts/food-modern/pages/ProductDetailPage.js +130 -223
- package/dist/layouts/food-modern/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/food-modern/pages/ProductsPage.js +2 -5
- package/dist/layouts/motivational-speaker/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/motivational-speaker/pages/ProductsPage.js +2 -5
- package/dist/layouts/shared/components/PdpColorSwatch.d.ts +11 -0
- package/dist/layouts/shared/components/PdpColorSwatch.d.ts.map +1 -0
- package/dist/layouts/shared/components/PdpColorSwatch.js +29 -0
- package/dist/layouts/shared/components/PdpVariationSelectors.d.ts +13 -0
- package/dist/layouts/shared/components/PdpVariationSelectors.d.ts.map +1 -0
- package/dist/layouts/shared/components/PdpVariationSelectors.js +65 -0
- package/dist/layouts/shared/components/StoreCartSheet.d.ts +8 -0
- package/dist/layouts/shared/components/StoreCartSheet.d.ts.map +1 -0
- package/dist/layouts/shared/components/StoreCartSheet.js +16 -0
- package/dist/layouts/shared/components/StoreHeader.d.ts.map +1 -1
- package/dist/layouts/shared/components/StoreHeader.js +13 -12
- package/dist/layouts/shared/components/headers/ClothingMinimalHeader.d.ts.map +1 -1
- package/dist/layouts/shared/components/headers/ClothingMinimalHeader.js +5 -7
- package/dist/layouts/shared/pages/CartPage.d.ts.map +1 -1
- package/dist/layouts/shared/pages/CartPage.js +6 -5
- package/dist/layouts/shared/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/layouts/shared/pages/CheckoutPage.js +209 -107
- package/dist/layouts/shared/product-category-filter-chip.d.ts +2 -0
- package/dist/layouts/shared/product-category-filter-chip.d.ts.map +1 -0
- package/dist/layouts/shared/product-category-filter-chip.js +6 -0
- package/dist/lib/pdp-cart-actions.d.ts +5 -0
- package/dist/lib/pdp-cart-actions.d.ts.map +1 -0
- package/dist/lib/pdp-cart-actions.js +19 -0
- package/dist/lib/product-variation-utils.d.ts +17 -0
- package/dist/lib/product-variation-utils.d.ts.map +1 -1
- package/dist/lib/product-variation-utils.js +193 -14
- package/dist/lib/services/checkout.service.d.ts +11 -0
- package/dist/lib/services/checkout.service.d.ts.map +1 -1
- package/dist/lib/services/shipping.service.d.ts +3 -0
- package/dist/lib/services/shipping.service.d.ts.map +1 -1
- package/dist/lib/store-config-utils.d.ts.map +1 -1
- package/dist/lib/store-config-utils.js +104 -11
- package/dist/lib/store-context.d.ts.map +1 -1
- package/dist/lib/store-context.js +23 -8
- package/dist/lib/utils/asset-helpers.d.ts +2 -0
- package/dist/lib/utils/asset-helpers.d.ts.map +1 -1
- package/dist/lib/utils/asset-helpers.js +24 -0
- package/dist/styles/index.css +143 -45
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductDeliveryInfoSection.d.ts","sourceRoot":"","sources":["../../../src/components/shipping/ProductDeliveryInfoSection.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAQnE,UAAU,+BAA+B;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,oBAAoB,CAAC;IACtC,qBAAqB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACtE,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;CACzE;AAED,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,GACR,EAAE,+BAA+B,+
|
|
1
|
+
{"version":3,"file":"ProductDeliveryInfoSection.d.ts","sourceRoot":"","sources":["../../../src/components/shipping/ProductDeliveryInfoSection.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAQnE,UAAU,+BAA+B;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,oBAAoB,CAAC;IACtC,qBAAqB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACtE,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;CACzE;AAED,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,GACR,EAAE,+BAA+B,+BAqIjC"}
|
|
@@ -11,9 +11,16 @@ export function ProductDeliveryInfoSection({ storeConfig, currency, productCurre
|
|
|
11
11
|
return null;
|
|
12
12
|
const displayCurrency = productCurrency || currency;
|
|
13
13
|
const automatedShipping = isAutomatedShippingEnabled(storeConfig);
|
|
14
|
-
return (_jsxs("div", { className: "mb-8 border-t border-b border-gray-100 py-6", children: [_jsxs("h3", { className: "font-bold text-gray-900 flex items-center gap-2 text-sm mb-4 uppercase tracking-wider", children: [_jsx(Truck, { className: "h-4 w-4" }), " Delivery Information"] }), !automatedShipping ? (_jsx(MerchantHandledDeliveryNotice, { storeName: storeConfig.name })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-4 p-4 bg-gray-50 rounded-lg border border-gray-200", children: [_jsx("p", { className: "text-xs font-semibold text-gray-700 mb-3 uppercase tracking-wider", children: "Calculate Shipping" }), _jsx(ShippingQuoteAddressForm, { address: shippingAddress, onChange: updateShippingAddress, onToast: onToast }), shippingError && (_jsx("p", { className: "text-xs text-red-600 mt-2", children: shippingError }))] }),
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return (_jsxs("div", { className: "mb-8 border-t border-b border-gray-100 py-6", children: [_jsxs("h3", { className: "font-bold text-gray-900 flex items-center gap-2 text-sm mb-4 uppercase tracking-wider", children: [_jsx(Truck, { className: "h-4 w-4" }), " Delivery Information"] }), !automatedShipping ? (_jsx(MerchantHandledDeliveryNotice, { storeName: storeConfig.name })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-4 p-4 bg-gray-50 rounded-lg border border-gray-200", children: [_jsx("p", { className: "text-xs font-semibold text-gray-700 mb-3 uppercase tracking-wider", children: "Calculate Shipping" }), _jsx(ShippingQuoteAddressForm, { address: shippingAddress, onChange: updateShippingAddress, onToast: onToast }), shippingError && (_jsx("p", { className: "text-xs text-red-600 mt-2", children: shippingError }))] }), (() => {
|
|
15
|
+
const remainingForFreeShipping = freeShippingThreshold !== undefined && !freeShippingEligible
|
|
16
|
+
? freeShippingThreshold - productPrice * quantity
|
|
17
|
+
: 0;
|
|
18
|
+
if (!(remainingForFreeShipping > 0))
|
|
19
|
+
return null;
|
|
20
|
+
return (_jsxs("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: [_jsxs("p", { className: "text-xs font-medium text-blue-900 mb-1", children: ["Spend", ' ', formatCurrency(remainingForFreeShipping, displayCurrency), ' ', "more for free shipping"] }), _jsx("div", { className: "w-full bg-blue-200 rounded-full h-2", children: _jsx("div", { className: "bg-blue-600 h-2 rounded-full transition-all", style: {
|
|
21
|
+
width: `${Math.min(100, ((productPrice * quantity) / freeShippingThreshold) * 100)}%`,
|
|
22
|
+
} }) })] }));
|
|
23
|
+
})(), isCalculatingShipping ? (_jsx("div", { className: "flex items-center justify-center p-8", children: _jsxs("div", { className: "flex items-center gap-2 text-gray-600", children: [_jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-gray-900" }), _jsx("span", { className: "text-sm font-medium", children: "Calculating shipping..." })] }) })) : shippingMethods.length > 0 ? (_jsx("div", { className: "space-y-0 divide-y divide-gray-100 border border-gray-100 rounded-lg overflow-hidden", children: shippingMethods.map((method, index) => (_jsxs("div", { className: cn('flex items-center justify-between p-4 bg-white hover:bg-gray-50 transition-colors group', freeShippingEligible && method.cost === 0 && 'bg-green-50 border-green-200'), children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: cn('p-2 rounded-full group-hover:bg-white transition-colors border', freeShippingEligible && method.cost === 0
|
|
17
24
|
? 'bg-green-100 border-green-300'
|
|
18
25
|
: 'bg-gray-50 border-gray-100'), children: freeShippingEligible && method.cost === 0 ? (_jsx(CheckCircle, { className: "h-4 w-4 text-green-700" })) : (_jsx(Truck, { className: "h-4 w-4 text-gray-900" })) }), _jsxs("div", { children: [_jsxs("p", { className: "font-bold text-gray-900 text-sm", children: [method.name, freeShippingEligible && method.cost === 0 && (_jsx("span", { className: "ml-2 text-xs font-normal text-green-700 bg-green-100 px-2 py-0.5 rounded-full", children: "FREE" }))] }), _jsx("p", { className: "text-[11px] text-gray-500 font-medium mt-0.5", children: method.description || method.estimatedDays
|
|
19
26
|
? `${method.estimatedDaysMin || method.estimatedDays}-${method.estimatedDaysMax || method.estimatedDays} business days`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-selector.d.ts","sourceRoot":"","sources":["../../../src/components/ui/address-selector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAI1D,UAAU,oBAAoB;IAC5B,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAiB,EACjB,eAAe,GAChB,EAAE,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"address-selector.d.ts","sourceRoot":"","sources":["../../../src/components/ui/address-selector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAI1D,UAAU,oBAAoB;IAC5B,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAiB,EACjB,eAAe,GAChB,EAAE,oBAAoB,+BAmEtB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronDown, MapPin } from 'lucide-react';
|
|
4
|
+
import { cn } from '../../lib/utils/index.js';
|
|
4
5
|
export function AddressSelector({ addresses, selectedAddressId, onSelect, isLoading = false, isAuthenticated, }) {
|
|
5
6
|
if (!isAuthenticated) {
|
|
6
7
|
return null;
|
|
@@ -15,7 +16,7 @@ export function AddressSelector({ addresses, selectedAddressId, onSelect, isLoad
|
|
|
15
16
|
return parts.join(', ');
|
|
16
17
|
};
|
|
17
18
|
if (isLoading) {
|
|
18
|
-
return (_jsx("div", { className: "mb-
|
|
19
|
+
return (_jsx("div", { className: "mb-5 p-4 bg-gray-50 rounded-sm border border-gray-200", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "w-4 h-4 border-2 border-gray-300 border-t-gray-900 rounded-full animate-spin" }), _jsx("span", { className: "text-sm font-medium text-gray-600", children: "Loading addresses..." })] }) }));
|
|
19
20
|
}
|
|
20
|
-
return (_jsxs("div", { className: "mb-
|
|
21
|
+
return (_jsxs("div", { className: "mb-5 pb-5 border-b border-gray-100 space-y-1.5", children: [_jsx("label", { className: "text-sm font-medium text-gray-700 block", children: "Saved address" }), _jsxs("div", { className: "space-y-2", children: [addresses.length > 0 && (_jsxs("div", { className: "relative", children: [_jsxs("select", { value: selectedAddressId || '', onChange: (e) => onSelect(e.target.value || null), className: cn('w-full appearance-none px-4 py-3 pr-11 rounded-none border border-gray-200 bg-white text-base text-gray-900', 'focus:outline-none focus:ring-0 focus:border-gray-900 transition-colors font-normal'), children: [_jsx("option", { value: "", children: "Add new address" }), addresses.map((address) => (_jsxs("option", { value: address.id, children: [address.label ? `${address.label} - ` : '', formatAddress(address), address.isDefault ? ' (Default)' : ''] }, address.id)))] }), _jsx(ChevronDown, { className: "pointer-events-none absolute right-3.5 top-1/2 h-5 w-5 -translate-y-1/2 text-gray-400", "aria-hidden": true })] })), addresses.length === 0 && (_jsxs("div", { className: "flex items-start gap-3 p-3.5 rounded-sm border border-gray-200 bg-gray-50", children: [_jsx(MapPin, { className: "w-4 h-4 text-gray-500 mt-0.5 shrink-0" }), _jsx("p", { className: "text-sm text-gray-600 leading-snug", children: "No saved addresses yet. Fill in the form below to continue." })] }))] })] }));
|
|
21
22
|
}
|
|
@@ -5,7 +5,7 @@ import { cn } from "../../lib/utils/index.js";
|
|
|
5
5
|
const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
|
-
default: "bg-[#1b0029] text-white hover:bg-[#220033]
|
|
8
|
+
default: "bg-[#1b0029] text-white hover:bg-[#220033]",
|
|
9
9
|
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
10
10
|
outline: "border border-[#1b0029]/15 bg-white text-[#1b0029] shadow-xs hover:bg-[#f7f5f0] hover:text-[#1b0029]",
|
|
11
11
|
secondary: "bg-[#f7f5f0] text-[#1b0029] hover:bg-[#ece8de]",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkout-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACrD;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,QAAqB,EACrB,OAAmB,EACnB,IAAW,GACZ,EAAE,mBAAmB,+
|
|
1
|
+
{"version":3,"file":"checkout-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkout-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACrD;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,QAAqB,EACrB,OAAmB,EACnB,IAAW,GACZ,EAAE,mBAAmB,+BAsCrB"}
|
|
@@ -6,7 +6,7 @@ import { useToast } from './toast.js';
|
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
import { CHECKOUT_UNAVAILABLE_MESSAGE } from '../../lib/checkout-availability.js';
|
|
8
8
|
export function CheckoutButton({ storeConfig, className, children = 'Checkout', variant = 'default', size = 'lg', }) {
|
|
9
|
-
const { cart } = useStore();
|
|
9
|
+
const { cart, setIsCartOpen } = useStore();
|
|
10
10
|
const { addToast } = useToast();
|
|
11
11
|
const router = useRouter();
|
|
12
12
|
const checkoutDisabled = storeConfig.checkoutEnabled === false;
|
|
@@ -20,6 +20,7 @@ export function CheckoutButton({ storeConfig, className, children = 'Checkout',
|
|
|
20
20
|
addToast('Your cart is empty', 'error');
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
+
setIsCartOpen(false);
|
|
23
24
|
router.push(`/${storeConfig.slug}/checkout`);
|
|
24
25
|
};
|
|
25
26
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: handleCheckout, disabled: isDisabled, variant: variant, size: size, className: className, title: checkoutDisabled ? CHECKOUT_UNAVAILABLE_MESSAGE : undefined, children: checkoutDisabled ? 'Checkout unavailable' : children }), checkoutDisabled && (_jsx("p", { className: "mt-2 text-sm text-muted-foreground text-center", children: CHECKOUT_UNAVAILABLE_MESSAGE }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/product-card.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/product-card.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAqBjD,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAsRxG"}
|
|
@@ -7,6 +7,7 @@ import { ProductRating } from './product-rating.js';
|
|
|
7
7
|
import { ShoppingCart, Heart, Eye, Share2 } from 'lucide-react';
|
|
8
8
|
import { shareProductLink } from '../../lib/utils/product-share.js';
|
|
9
9
|
import Link from 'next/link';
|
|
10
|
+
import { useRouter } from 'next/navigation';
|
|
10
11
|
import { cn, formatCurrency } from '../../lib/utils/index.js';
|
|
11
12
|
import { resolveProductImageUrls } from '../../lib/utils/product-images.js';
|
|
12
13
|
import { useStore } from '../../lib/store-context.js';
|
|
@@ -20,7 +21,10 @@ import { getProductStockInfo } from '../../lib/inventory-utils.js';
|
|
|
20
21
|
import { richFieldHasContent, richFieldPlainTextForDisplay } from '../../lib/rich-html.js';
|
|
21
22
|
import { trackStorefrontEvent } from '../../lib/mixpanel.js';
|
|
22
23
|
export function ProductCard({ product, storeSlug, onAddToCart, onQuickView, className }) {
|
|
24
|
+
const router = useRouter();
|
|
23
25
|
const [isHovered, setIsHovered] = useState(false);
|
|
26
|
+
const hasVariationOptions = (product.variants?.length ?? 0) > 0;
|
|
27
|
+
const productHref = `/${storeSlug}/products/${product.slug}`;
|
|
24
28
|
const { toggleWishlist, isInWishlist, isWishlistLoading, store } = useStore();
|
|
25
29
|
const { addToast } = useToast();
|
|
26
30
|
const { startPageLoading } = useLoading();
|
|
@@ -127,12 +131,19 @@ export function ProductCard({ product, storeSlug, onAddToCart, onQuickView, clas
|
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
|
-
return (_jsxs("div", { "data-product-card": true, className: cn("group relative flex flex-col h-full bg-white rounded-lg overflow-hidden border border-gray-100 hover:border-gray-300 transition-all duration-300 hover:shadow-md", className), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsxs("div", { className: "relative aspect-[3/4] bg-gray-50 overflow-hidden", children: [_jsx(Link, { href: `/${storeSlug}/products/${product.slug}`, onClick: handleProductClick, className: "block w-full h-full", children: _jsx(ImageWithFallback, { src: currentImage, alt: product.name, className: cn("w-full h-full object-cover transition-all duration-700 ease-in-out", isHovered && !hasSecondImage ? "scale-110" : "scale-100", isOutOfStock && "grayscale"), skeletonAspectRatio: "3/4", lazy: true }) }), isOutOfStock && (_jsx(OutOfStockOverlay, { badgePosition: "center" })), (isActiveLimitedTimeOffer(product) || (product.compareAtPrice != null && product.compareAtPrice > product.price) || (product.rating && product.rating >= 4.8)) && (_jsxs("div", { className: "absolute top-3 left-3 flex flex-col gap-2 z-10", children: [_jsx(LimitedTimeOfferBadge, { product: product, compact: true }), product.compareAtPrice != null && product.compareAtPrice > product.price && (_jsx("span", { className: "bg-red-500 text-white text-[10px] font-bold px-2.5 py-1 rounded-full uppercase tracking-wider shadow-sm", children: "Sale" })), !isActiveLimitedTimeOffer(product) && !(product.compareAtPrice != null && product.compareAtPrice > product.price) && product.rating && product.rating >= 4.8 && (_jsx("span", { className: "bg-white/90 backdrop-blur-sm text-slate-900 text-[10px] font-bold px-2.5 py-1 rounded-full uppercase tracking-wider shadow-sm border border-gray-100", children: "Top Rated" }))] })), _jsxs("div", { className: "absolute top-3 right-3 z-30 flex flex-col gap-2 opacity-0 group-hover:opacity-100 transform translate-x-2 group-hover:translate-x-0 transition-all duration-300", children: [_jsx("button", { type: "button", onClick: handleShareClick, className: "p-2 rounded-full bg-white/80 backdrop-blur-sm hover:bg-white transition-all duration-300 shadow-sm text-slate-600 hover:text-slate-900", title: "Share product", "aria-label": "Share product", children: _jsx(Share2, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: handleWishlistClick, disabled: isLoading, className: cn("p-2 rounded-full bg-white/80 backdrop-blur-sm hover:bg-white transition-all duration-300 shadow-sm disabled:opacity-50 disabled:cursor-not-allowed", inWishlist ? "text-red-500" : "text-slate-600 hover:text-red-500"), title: inWishlist ? "Remove from wishlist" : "Add to wishlist", children: isLoading ? (_jsx(ButtonLoader, { className: "text-red-500" })) : (_jsx(Heart, { className: cn("h-4 w-4", inWishlist && "fill-current") })) })] }), _jsxs("div", { className: "absolute bottom-4 inset-x-4
|
|
134
|
+
return (_jsxs("div", { "data-product-card": true, className: cn("group relative flex flex-col h-full bg-white rounded-lg overflow-hidden border border-gray-100 hover:border-gray-300 transition-all duration-300 hover:shadow-md", className), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsxs("div", { className: "relative aspect-[3/4] bg-gray-50 overflow-hidden", children: [_jsx(Link, { href: `/${storeSlug}/products/${product.slug}`, onClick: handleProductClick, className: "block w-full h-full", children: _jsx(ImageWithFallback, { src: currentImage, alt: product.name, className: cn("w-full h-full object-cover transition-all duration-700 ease-in-out", isHovered && !hasSecondImage ? "scale-110" : "scale-100", isOutOfStock && "grayscale"), skeletonAspectRatio: "3/4", lazy: true }) }), isOutOfStock && (_jsx(OutOfStockOverlay, { badgePosition: "center" })), (isActiveLimitedTimeOffer(product) || (product.compareAtPrice != null && product.compareAtPrice > product.price) || (product.rating && product.rating >= 4.8)) && (_jsxs("div", { className: "absolute top-3 left-3 flex flex-col gap-2 z-10", children: [_jsx(LimitedTimeOfferBadge, { product: product, compact: true }), product.compareAtPrice != null && product.compareAtPrice > product.price && (_jsx("span", { className: "bg-red-500 text-white text-[10px] font-bold px-2.5 py-1 rounded-full uppercase tracking-wider shadow-sm", children: "Sale" })), !isActiveLimitedTimeOffer(product) && !(product.compareAtPrice != null && product.compareAtPrice > product.price) && product.rating && product.rating >= 4.8 && (_jsx("span", { className: "bg-white/90 backdrop-blur-sm text-slate-900 text-[10px] font-bold px-2.5 py-1 rounded-full uppercase tracking-wider shadow-sm border border-gray-100", children: "Top Rated" }))] })), _jsxs("div", { className: "absolute top-3 right-3 z-30 flex flex-col gap-2 opacity-0 group-hover:opacity-100 transform translate-x-2 group-hover:translate-x-0 transition-all duration-300", children: [_jsx("button", { type: "button", onClick: handleShareClick, className: "p-2 rounded-full bg-white/80 backdrop-blur-sm hover:bg-white transition-all duration-300 shadow-sm text-slate-600 hover:text-slate-900", title: "Share product", "aria-label": "Share product", children: _jsx(Share2, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: handleWishlistClick, disabled: isLoading, className: cn("p-2 rounded-full bg-white/80 backdrop-blur-sm hover:bg-white transition-all duration-300 shadow-sm disabled:opacity-50 disabled:cursor-not-allowed", inWishlist ? "text-red-500" : "text-slate-600 hover:text-red-500"), title: inWishlist ? "Remove from wishlist" : "Add to wishlist", children: isLoading ? (_jsx(ButtonLoader, { className: "text-red-500" })) : (_jsx(Heart, { className: cn("h-4 w-4", inWishlist && "fill-current") })) })] }), _jsxs("div", { className: "absolute bottom-4 inset-x-4 grid grid-cols-[2.5rem_1fr] gap-2 opacity-0 translate-y-4 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-300 ease-out z-20", children: [_jsx(Link, { href: `/${storeSlug}/products/${product.slug}`, className: "h-10 w-10 flex items-center justify-center rounded-full bg-white text-slate-900 hover:bg-slate-900 hover:text-white border border-transparent shadow-lg transition-colors duration-200", title: "View Details", onClick: trackProductClick, children: _jsx(Eye, { className: "h-4 w-4" }) }), _jsxs(Button, { type: "button", variant: "outline", onClick: async (e) => {
|
|
131
135
|
e.preventDefault();
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
if (isOutOfStock)
|
|
138
|
+
return;
|
|
139
|
+
if (hasVariationOptions) {
|
|
140
|
+
trackProductClick();
|
|
141
|
+
startPageLoading(productHref);
|
|
142
|
+
router.push(productHref);
|
|
143
|
+
return;
|
|
134
144
|
}
|
|
135
|
-
|
|
145
|
+
await onAddToCart(product);
|
|
146
|
+
}, disabled: isOutOfStock, className: cn('h-10 w-full min-w-0 justify-center gap-2 rounded-full border-0 bg-white px-4 text-slate-900 shadow-lg hover:bg-slate-900 hover:text-white font-semibold transition-colors duration-200 [&_svg]:text-current hover:[&_svg]:text-current', isOutOfStock && 'opacity-50 cursor-not-allowed'), children: [_jsx(ShoppingCart, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), "Add to cart"] })] })] }), _jsxs("div", { className: "p-4 flex flex-col flex-1 space-y-2", children: [_jsx(Link, { href: `/${storeSlug}/products/${product.slug}`, className: "group-hover:text-blue-600 transition-colors duration-300", onClick: () => {
|
|
136
147
|
trackProductClick();
|
|
137
148
|
startPageLoading(`/${storeSlug}/products/${product.slug}`);
|
|
138
149
|
}, children: _jsx("h3", { className: "font-bold text-slate-900 text-base leading-tight line-clamp-1", children: product.name }) }), richFieldHasContent(product.description) && (_jsx("p", { className: "text-xs text-slate-500 line-clamp-1", children: richFieldPlainTextForDisplay(product.description) })), _jsxs("div", { className: "mt-auto pt-2 flex items-center justify-between", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-lg font-bold text-slate-900", children: formatCurrency(product.price, product.currency || 'USD') }), product.compareAtPrice != null && product.compareAtPrice > product.price && (_jsx("span", { className: "text-sm text-slate-400 line-through font-medium", children: formatCurrency(product.compareAtPrice, product.currency || 'USD') }))] }), _jsx(ProductRating, { rating: product.rating, reviewCount: product.reviewCount, size: "sm", showReviewCount: false, className: "shrink-0" })] })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-skeleton-loader.d.ts","sourceRoot":"","sources":["../../../src/components/ui/route-skeleton-loader.tsx"],"names":[],"mappings":"AAUA,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"route-skeleton-loader.d.ts","sourceRoot":"","sources":["../../../src/components/ui/route-skeleton-loader.tsx"],"names":[],"mappings":"AAUA,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,wBAAwB,+BA2HlG"}
|
|
@@ -49,11 +49,15 @@ export function RouteSkeletonLoader({ className, pathname: pathnameProp }) {
|
|
|
49
49
|
const routeType = getRouteType(pathname);
|
|
50
50
|
// Category and product list pages SSR real content quickly — a full-screen overlay
|
|
51
51
|
// only blocks the shell and makes empty categories feel stuck.
|
|
52
|
-
if (routeType === 'category-detail' ||
|
|
52
|
+
if (routeType === 'category-detail' ||
|
|
53
|
+
routeType === 'categories' ||
|
|
54
|
+
routeType === 'products' ||
|
|
55
|
+
routeType === 'checkout') {
|
|
53
56
|
return null;
|
|
54
57
|
}
|
|
55
58
|
const renderSkeleton = () => {
|
|
56
|
-
|
|
59
|
+
const renderableRouteType = routeType;
|
|
60
|
+
switch (renderableRouteType) {
|
|
57
61
|
case 'homepage':
|
|
58
62
|
// Use spinner loader for homepage instead of skeleton
|
|
59
63
|
// Spinner is centered in fixed position overlay
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACpC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC5C,sFAAsF;IACtF,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAc,EACd,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,gBAAwB,EACxB,eAAsB,EACtB,eAAe,EACf,MAAc,EACd,WAAuB,EACvB,iBAA4B,EAC5B,cAAc,GACf,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACpC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC5C,sFAAsF;IACtF,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAc,EACd,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,gBAAwB,EACxB,eAAsB,EACtB,eAAe,EACf,MAAc,EACd,WAAuB,EACvB,iBAA4B,EAC5B,cAAc,GACf,EAAE,UAAU,qBA4GZ"}
|
|
@@ -35,9 +35,9 @@ export function Sheet({ isOpen, onClose, title, children, side = 'right', classN
|
|
|
35
35
|
const rootZ = isOverlay ? OVERLAY_ROOT_Z : 'z-[110]';
|
|
36
36
|
const backdropZ = isOverlay ? 'z-0' : 'z-[105]';
|
|
37
37
|
const panelZ = isOverlay ? 'z-10' : 'z-[110]';
|
|
38
|
-
const sheetContent = (_jsxs("div", { className: cn(
|
|
38
|
+
const sheetContent = (_jsxs("div", { className: cn('fixed inset-0', isOverlay ? undefined : 'pointer-events-none', rootZ), children: [_jsx("div", { className: cn(isOverlay ? 'absolute inset-0' : 'fixed inset-0', backdropZ, 'transition-opacity pointer-events-auto', backdropClassName ?? 'bg-black/60 backdrop-blur-sm'), onClick: onClose, "aria-hidden": "true" }), _jsxs("div", { role: "dialog", "aria-modal": "true", "data-login-panel": dataLoginPanel, "aria-labelledby": ariaLabelledBy || (title && !hideBuiltInTitle ? 'sheet-title' : undefined), className: cn('bg-white shadow-xl transition ease-in-out duration-300 transform flex flex-col pointer-events-auto', isOverlay ? 'fixed top-0 bottom-0 h-dvh max-h-dvh supports-[height:100dvh]:h-dvh' : 'fixed', panelZ, side === 'left' ? 'left-0' : 'right-0', !isOverlay && (side === 'left' ? 'top-0 bottom-0 left-0' : 'top-0 bottom-0 right-0 h-dvh max-h-dvh'), overlayMobileMode === 'fullscreen' &&
|
|
39
39
|
isOverlay &&
|
|
40
|
-
'max-sm:inset-0 max-sm:left-0 max-sm:right-0 max-sm:w-screen max-sm:max-w-[100dvw] max-sm:rounded-none', 'w-full max-w-
|
|
40
|
+
'max-sm:inset-0 max-sm:left-0 max-sm:right-0 max-sm:w-screen max-sm:max-w-[100dvw] max-sm:rounded-none', 'w-full max-w-[min(28rem,100dvw)] translate-x-0 opacity-100 box-border overflow-hidden', className), style: style, children: [showCloseButton && !hideBuiltInTitle ? (_jsxs("div", { className: "flex items-center justify-between shrink-0 px-6 pt-6 pb-2", children: [title ? (_jsx("h2", { id: "sheet-title", className: "text-lg font-semibold text-[#1b0029]", children: title })) : (_jsx("span", {})), _jsx(Button, { variant: "ghost", size: "icon", onClick: onClose, className: cn('rounded-full shrink-0', closeButtonClassName), "aria-label": "Close", children: _jsx(X, { className: "h-4 w-4" }) })] })) : null, _jsx("div", { className: cn('flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-6 pb-6', contentClassName), children: children })] })] }));
|
|
41
41
|
if (portal && typeof document !== 'undefined') {
|
|
42
42
|
return createPortal(sheetContent, document.body);
|
|
43
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
export function CheckoutSkeleton() {
|
|
3
|
-
return (_jsx("div", { className: "min-h-screen bg-gray-50/50 py-12 px-4 sm:px-6 lg:px-8 font-sans animate-pulse", children: _jsxs("div", { className: "container mx-auto max-w-6xl", children: [_jsxs("div", { className: "mb-10 flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-10 h-10 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-24" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-8 h-8 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" }), _jsx("div", { className: "w-8 h-0.5 bg-gray-200" }), _jsx("div", { className: "w-8 h-8 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" })] })] }), _jsxs("div", { className: "flex flex-col lg:flex-row gap-10", children: [_jsxs("div", { className: "flex-1 space-y-8", children: [_jsxs("section", { className: "bg-white p-8 rounded-
|
|
3
|
+
return (_jsx("div", { className: "min-h-screen bg-gray-50/50 py-12 px-4 sm:px-6 lg:px-8 font-sans animate-pulse", children: _jsxs("div", { className: "container mx-auto max-w-6xl", children: [_jsxs("div", { className: "mb-10 flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-10 h-10 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-24" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-8 h-8 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" }), _jsx("div", { className: "w-8 h-0.5 bg-gray-200" }), _jsx("div", { className: "w-8 h-8 bg-gray-200 rounded-full" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" })] })] }), _jsxs("div", { className: "flex flex-col lg:flex-row gap-10", children: [_jsxs("div", { className: "flex-1 space-y-8", children: [_jsxs("section", { className: "bg-white p-8 rounded-lg shadow-sm border border-gray-100", children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx("div", { className: "w-10 h-10 bg-gray-200 rounded-md" }), _jsx("div", { className: "h-6 bg-gray-200 rounded w-48" })] }), _jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-32 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }) })] }), _jsxs("section", { className: "bg-white p-8 rounded-lg shadow-sm border border-gray-100", children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx("div", { className: "w-10 h-10 bg-gray-200 rounded-md" }), _jsx("div", { className: "h-6 bg-gray-200 rounded w-40" })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-5", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-24 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-24 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5 md:col-span-2", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-20 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-20 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-16 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-24 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-20 ml-1" }), _jsx("div", { className: "h-12 bg-gray-200 rounded-md" })] })] })] }), _jsxs("section", { className: "bg-white p-8 rounded-lg shadow-sm border border-gray-100", children: [_jsxs("div", { className: "flex items-center gap-3 mb-6", children: [_jsx("div", { className: "w-10 h-10 bg-gray-200 rounded-md" }), _jsx("div", { className: "h-6 bg-gray-200 rounded w-40" })] }), _jsx("div", { className: "space-y-3", children: _jsxs("div", { className: "flex items-center justify-between p-4 border-2 border-gray-200 rounded-md", children: [_jsxs("div", { className: "flex items-center gap-4 flex-1", children: [_jsx("div", { className: "w-5 h-5 bg-gray-200 rounded-full" }), _jsxs("div", { className: "flex-1 space-y-2", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-32" }), _jsx("div", { className: "h-3 bg-gray-200 rounded w-48" })] })] }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-16" })] }) })] }), _jsx("div", { className: "h-14 bg-gray-200 rounded-2xl" })] }), _jsx("div", { className: "w-full lg:w-[400px] flex-shrink-0", children: _jsxs("div", { className: "bg-white p-8 rounded-lg shadow-lg border border-gray-100 sticky top-8", children: [_jsx("div", { className: "h-7 bg-gray-200 rounded w-32 mb-6" }), _jsx("div", { className: "space-y-6 mb-8", children: _jsxs("div", { className: "flex gap-4", children: [_jsx("div", { className: "w-20 h-20 bg-gray-200 rounded-md flex-shrink-0" }), _jsxs("div", { className: "flex-1 py-1 space-y-2", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-full" }), _jsx("div", { className: "h-3 bg-gray-200 rounded w-2/3" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" })] })] }) }), _jsxs("div", { className: "space-y-4 pt-6 border-t-2 border-gray-50", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-20" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-24" })] }), _jsxs("div", { className: "flex justify-between", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded w-24" }), _jsx("div", { className: "h-4 bg-gray-200 rounded w-20" })] }), _jsxs("div", { className: "flex justify-between items-end pt-4 mt-2 border-t border-gray-100", children: [_jsx("div", { className: "h-5 bg-gray-200 rounded w-28" }), _jsx("div", { className: "h-8 bg-gray-200 rounded w-32" })] })] })] }) })] })] }) }));
|
|
4
4
|
}
|
|
@@ -46,7 +46,7 @@ export function migrateClothingMinimalHomeSectionToBlocks(sectionKey, section) {
|
|
|
46
46
|
const left = base[0];
|
|
47
47
|
const right = base[1];
|
|
48
48
|
if (left?.innerBlocks?.[0]) {
|
|
49
|
-
left.innerBlocks[0].attributes.text = badge || '
|
|
49
|
+
left.innerBlocks[0].attributes.text = badge || '';
|
|
50
50
|
}
|
|
51
51
|
if (left?.innerBlocks?.[1]) {
|
|
52
52
|
left.innerBlocks[1].attributes.content =
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { StoreProduct } from '../lib/store-types.js';
|
|
2
|
+
export declare function usePdpVariation(product?: StoreProduct): {
|
|
3
|
+
optionGroups: Record<string, string[]>;
|
|
4
|
+
selectedAttributes: Record<string, string>;
|
|
5
|
+
setAttribute: (key: string, value: string) => void;
|
|
6
|
+
isOptionAvailable: (key: string, value: string) => boolean;
|
|
7
|
+
selectedVariation: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
price?: number;
|
|
12
|
+
sku?: string;
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
attributes?: Record<string, string>;
|
|
15
|
+
stock?: number;
|
|
16
|
+
inStock?: boolean;
|
|
17
|
+
images?: string[] | string;
|
|
18
|
+
compareAtPrice?: number;
|
|
19
|
+
};
|
|
20
|
+
galleryImages: string[];
|
|
21
|
+
displayPrice: number;
|
|
22
|
+
displayCompareAt: number;
|
|
23
|
+
displaySKU: string;
|
|
24
|
+
stockView: {
|
|
25
|
+
name: string;
|
|
26
|
+
trackInventory?: boolean;
|
|
27
|
+
availableStock?: number;
|
|
28
|
+
inStock: boolean;
|
|
29
|
+
lowStockThreshold?: number;
|
|
30
|
+
} | {
|
|
31
|
+
inStock: boolean;
|
|
32
|
+
};
|
|
33
|
+
isOutOfStock: boolean;
|
|
34
|
+
selectedColor: string;
|
|
35
|
+
selectedSize: string;
|
|
36
|
+
setSelectedColor: (value: string) => void;
|
|
37
|
+
setSelectedSize: (value: string) => void;
|
|
38
|
+
colorVariants: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
attributes: {
|
|
43
|
+
color: string;
|
|
44
|
+
};
|
|
45
|
+
}[];
|
|
46
|
+
sizeVariants: {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
value: string;
|
|
50
|
+
attributes: {
|
|
51
|
+
size: string;
|
|
52
|
+
};
|
|
53
|
+
}[];
|
|
54
|
+
getOptionImage: (attributeKey: string, value: string) => string;
|
|
55
|
+
variationLabel: string;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=use-pdp-variation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-pdp-variation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-pdp-variation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AActD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY;;;wBAW5C,MAAM,SAAS,MAAM;6BAerB,MAAM,SAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBL,OAAO;;;;;8BAKc,MAAM;6BACP,MAAM;;;;;;;;;;;;;;;;;mCA0CjB,MAAM,SAAS,MAAM;;EAIvD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { findMatchingVariation, formatVariationLabel, getVariationOptionGroups, getVariationOptionImage, isVariationOptionAvailable, reconcileSelectedAttributes, resolveProductGalleryImageUrls, resolveVariantPrice, resolveVariantSKU, resolveVariantStockProduct, } from '../lib/product-variation-utils.js';
|
|
4
|
+
export function usePdpVariation(product) {
|
|
5
|
+
const variants = product?.variants;
|
|
6
|
+
const optionGroups = useMemo(() => getVariationOptionGroups(variants), [variants]);
|
|
7
|
+
const [selectedAttributes, setSelectedAttributes] = useState({});
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setSelectedAttributes({});
|
|
10
|
+
}, [product?.id]);
|
|
11
|
+
const setAttribute = useCallback((key, value) => {
|
|
12
|
+
setSelectedAttributes((previous) => {
|
|
13
|
+
if (value &&
|
|
14
|
+
!isVariationOptionAvailable(variants, previous, key, value)) {
|
|
15
|
+
return previous;
|
|
16
|
+
}
|
|
17
|
+
return reconcileSelectedAttributes(variants, previous, key, value);
|
|
18
|
+
});
|
|
19
|
+
}, [variants]);
|
|
20
|
+
const isOptionAvailable = useCallback((key, value) => isVariationOptionAvailable(variants, selectedAttributes, key, value), [variants, selectedAttributes]);
|
|
21
|
+
const selectedVariation = useMemo(() => findMatchingVariation(variants, selectedAttributes), [variants, selectedAttributes]);
|
|
22
|
+
const galleryImages = useMemo(() => (product ? resolveProductGalleryImageUrls(product, selectedVariation) : []), [product, selectedVariation]);
|
|
23
|
+
const displayPrice = product ? resolveVariantPrice(product, selectedVariation) : 0;
|
|
24
|
+
const displayCompareAt = selectedVariation?.compareAtPrice != null &&
|
|
25
|
+
Number.isFinite(Number(selectedVariation.compareAtPrice))
|
|
26
|
+
? Number(selectedVariation.compareAtPrice)
|
|
27
|
+
: product?.compareAtPrice;
|
|
28
|
+
const displaySKU = product ? resolveVariantSKU(product, selectedVariation) : 'N/A';
|
|
29
|
+
const stockView = product
|
|
30
|
+
? resolveVariantStockProduct(product, selectedVariation)
|
|
31
|
+
: { inStock: false };
|
|
32
|
+
const selectedColor = selectedAttributes.color || '';
|
|
33
|
+
const selectedSize = selectedAttributes.size || '';
|
|
34
|
+
const setSelectedColor = useCallback((value) => setAttribute('color', value), [setAttribute]);
|
|
35
|
+
const setSelectedSize = useCallback((value) => setAttribute('size', value), [setAttribute]);
|
|
36
|
+
const colorVariants = useMemo(() => (optionGroups.color || []).map((value) => ({
|
|
37
|
+
id: value,
|
|
38
|
+
name: 'Name / Color',
|
|
39
|
+
value,
|
|
40
|
+
attributes: { color: value },
|
|
41
|
+
})), [optionGroups.color]);
|
|
42
|
+
const sizeVariants = useMemo(() => (optionGroups.size || []).map((value) => ({
|
|
43
|
+
id: value,
|
|
44
|
+
name: 'Size',
|
|
45
|
+
value,
|
|
46
|
+
attributes: { size: value },
|
|
47
|
+
})), [optionGroups.size]);
|
|
48
|
+
return {
|
|
49
|
+
optionGroups,
|
|
50
|
+
selectedAttributes,
|
|
51
|
+
setAttribute,
|
|
52
|
+
isOptionAvailable,
|
|
53
|
+
selectedVariation,
|
|
54
|
+
galleryImages,
|
|
55
|
+
displayPrice,
|
|
56
|
+
displayCompareAt,
|
|
57
|
+
displaySKU,
|
|
58
|
+
stockView,
|
|
59
|
+
isOutOfStock: !stockView.inStock,
|
|
60
|
+
selectedColor,
|
|
61
|
+
selectedSize,
|
|
62
|
+
setSelectedColor,
|
|
63
|
+
setSelectedSize,
|
|
64
|
+
colorVariants,
|
|
65
|
+
sizeVariants,
|
|
66
|
+
getOptionImage: (attributeKey, value) => getVariationOptionImage(variants, attributeKey, value, product),
|
|
67
|
+
variationLabel: formatVariationLabel(selectedVariation),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-product-by-slug.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-by-slug.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,YAAY;;;;
|
|
1
|
+
{"version":3,"file":"use-product-by-slug.d.ts","sourceRoot":"","sources":["../../src/hooks/use-product-by-slug.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,YAAY;;;;EA8B9B"}
|
|
@@ -7,11 +7,6 @@ export function useProductBySlug(storeId, slug, initialProduct) {
|
|
|
7
7
|
const [relatedProducts, setRelatedProducts] = useState([]);
|
|
8
8
|
const [isLoading, setIsLoading] = useState(!initialProduct);
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
if (initialProduct) {
|
|
11
|
-
setProduct(initialProduct);
|
|
12
|
-
setIsLoading(false);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
10
|
let cancelled = false;
|
|
16
11
|
setIsLoading(true);
|
|
17
12
|
productService
|
|
@@ -6,7 +6,7 @@ export function useProductVariationSelection(variants) {
|
|
|
6
6
|
const [selectedAttributes, setSelectedAttributes] = useState({});
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
setSelectedAttributes({});
|
|
9
|
-
}, [
|
|
9
|
+
}, [variants]);
|
|
10
10
|
const setAttribute = useCallback((key, value) => {
|
|
11
11
|
setSelectedAttributes((previous) => {
|
|
12
12
|
if (!value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-shipping-quote.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shipping-quote.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAIrB,MAAM,6BAA6B,CAAC;AAErC,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,OAAc,EACd,YAAY,EACZ,cAAc,GACf,EAAE,uBAAuB;;;
|
|
1
|
+
{"version":3,"file":"use-shipping-quote.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shipping-quote.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAIrB,MAAM,6BAA6B,CAAC;AAErC,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,OAAc,EACd,YAAY,EACZ,cAAc,GACf,EAAE,uBAAuB;;;2BAYkB,OAAO,CAAC,oBAAoB,CAAC;;;;;;;;EAwExE"}
|
|
@@ -12,6 +12,7 @@ export function useShippingQuote({ storeId, productId, productPrice, currency, q
|
|
|
12
12
|
const [error, setError] = useState(null);
|
|
13
13
|
const [freeShippingEligible, setFreeShippingEligible] = useState(false);
|
|
14
14
|
const [freeShippingThreshold, setFreeShippingThreshold] = useState();
|
|
15
|
+
const [freeShippingEnabled, setFreeShippingEnabled] = useState(false);
|
|
15
16
|
const updateAddress = useCallback((patch) => {
|
|
16
17
|
setAddress((prev) => ({ ...prev, ...patch }));
|
|
17
18
|
}, []);
|
|
@@ -35,6 +36,7 @@ export function useShippingQuote({ storeId, productId, productPrice, currency, q
|
|
|
35
36
|
setMethods(result.methods || []);
|
|
36
37
|
setFreeShippingEligible(result.freeShippingEligible || false);
|
|
37
38
|
setFreeShippingThreshold(result.freeShippingThreshold);
|
|
39
|
+
setFreeShippingEnabled(result.freeShippingEnabled === true);
|
|
38
40
|
}
|
|
39
41
|
catch (err) {
|
|
40
42
|
const message = err instanceof Error ? err.message : 'Failed to calculate shipping';
|
|
@@ -75,6 +77,7 @@ export function useShippingQuote({ storeId, productId, productPrice, currency, q
|
|
|
75
77
|
error,
|
|
76
78
|
freeShippingEligible,
|
|
77
79
|
freeShippingThreshold,
|
|
80
|
+
freeShippingEnabled,
|
|
78
81
|
recalculate: calculate,
|
|
79
82
|
};
|
|
80
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/booking/pages/ProductDetailPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAA8C,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/booking/pages/ProductDetailPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAA8C,MAAM,mBAAmB,CAAC;AAiC5F,UAAU,sBAAsB;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAsHD,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,sBAAsB,+BA44BpG"}
|