@anker-in/headless-ui 1.0.20-alpha.1761293811592 → 1.0.20-alpha.1761299957235
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/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/{ProductProvider.d.ts → BizProductProvider.d.ts} +8 -4
- package/dist/cjs/biz-components/Listing/BizProductProvider.js +2 -0
- package/dist/cjs/biz-components/Listing/BizProductProvider.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +21 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +3 -3
- package/dist/cjs/biz-components/Listing/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/index.js +1 -1
- package/dist/cjs/biz-components/Listing/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/types.d.ts +7 -0
- package/dist/cjs/biz-components/Listing/types.js +1 -1
- package/dist/cjs/biz-components/Listing/types.js.map +1 -1
- package/dist/cjs/biz-components/index.d.ts +1 -1
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/{ProductProvider.d.ts → BizProductProvider.d.ts} +8 -4
- package/dist/esm/biz-components/Listing/BizProductProvider.js +2 -0
- package/dist/esm/biz-components/Listing/BizProductProvider.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -4
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +21 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +3 -3
- package/dist/esm/biz-components/Listing/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/index.js +1 -1
- package/dist/esm/biz-components/Listing/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/types.d.ts +7 -0
- package/dist/esm/biz-components/index.d.ts +1 -1
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/biz-components/Listing/ProductProvider.js +0 -2
- package/dist/cjs/biz-components/Listing/ProductProvider.js.map +0 -7
- package/dist/esm/biz-components/Listing/ProductProvider.js +0 -2
- package/dist/esm/biz-components/Listing/ProductProvider.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductSummary/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Button, Container, Grid, GridItem, Picture, Heading } from '../../../../../components'\nimport type { ProductSummaryProps } from './types'\nimport { useProductContext } from '../../../ProductProvider'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils'\nimport { useAiuiContext } from '../../../../AiuiProvider'\nimport type { BundleListItem, ProductVariant } from '../../../types/product'\nimport { cn } from '../../../../../helpers'\nimport Decimal from 'decimal.js'\n\nconst ProductSummary = ({}: ProductSummaryProps) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n onAddToCart,\n onBuyNow,\n savingDetail,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n } = useProductContext()\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n const { bundleVariant, giftVariant } = useRecommendBuyProducts() || {}\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift ? undefined : giftVariant,\n })\n }, [bundleVariant, giftVariant, joinedRecommendBuyProducts])\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"ipc-product-summary bg-[#F5F5F7] mt-16\">\n <Grid className=\"px-4 py-6 tablet:p-8\">\n <GridItem className=\"col-span-12 desktop:col-start-1 desktop:col-span-5\">\n <Heading\n className=\"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]\"\n html={`${product.title} is ready <br/><span>Just the way you want it.</span>`}\n />\n <div className=\"aspect-[644/320]\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"h-full w-full\"\n imgClassName=\"object-contain h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"col-span-12 mt-8 desktop:col-start-7 laptop:mt-0 desktop:col-span-6 flex flex-col gap-6 justify-between\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"shrink-0 flex items-center gap-4\">\n <Picture source={variant.image?.url || product?.images?.[0]?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={product.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${selectedOptions.color || selectedOptions.colour || selectedOptions.couleur}`}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n {joinedRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, gift: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n }}\n giftStatus={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift}\n />\n )}\n {joinedRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, bundle: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n }}\n bundleStatus={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n {(initialRecommendBuyProducts?.bundle || initialRecommendBuyProducts?.gift) && (\n <div className=\"mt-6\">\n <Text className=\"text-sm desktop:text-[18px] font-bold\" html={'Recommend Buy'} />\n <div className=\"flex flex-col gap-6 mt-6\">\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ gift })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n }}\n giftStatus={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ bundle })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n }}\n bundleStatus={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl desktop:text-2xl font-bold text-right\"\n html={`${copyWriting?.totalPrice} ${formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}`}\n />\n\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"flex gap-3 mt-2\">\n <Button size=\"lg\" variant=\"secondary\" className=\"w-1/2\" onClick={() => onAddToCart?.()}>\n {copyWriting?.addToCart}\n </Button>\n <Button size=\"lg\" variant=\"primary\" className=\"w-1/2\" onClick={() => onBuyNow?.()}>\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift } = useProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale)\n giftVariant = checkedGift || firstAvailableGift\n\n return { bundleVariant, giftVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleStatus,\n bundleListItem,\n}: {\n bundleOperation: (bundle: BundleListItem) => void\n bundleStatus: boolean\n bundleListItem: BundleListItem\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { variant, setCheckedBundle } = useProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"flex items-center justify-between\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center gap-4\" key={bundleVariant.variant.id}>\n <Picture source={bundleVariant?.variant?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n )\n })}\n <div className=\"flex flex-col items-end gap-1 justify-center\">\n {bundleStatus && (\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({\n amount: bundleVariants[0]?.price,\n locale,\n currencyCode: bundleVariants[0]?.variant?.price?.currencyCode,\n })}\n />\n )}\n <Button\n size={bundleStatus ? 'icon' : 'lg'}\n variant={bundleStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedBundle?.(bundleStatus ? undefined : bundleListItem)\n bundleOperation(bundleListItem)\n }}\n className={cn('shrink-0 size-auto', {\n underline: bundleStatus,\n })}\n >\n {bundleStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n giftStatus,\n gift,\n}: {\n giftOperation: (gift: ProductVariant) => void\n giftStatus: boolean\n gift: ProductVariant\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { freeGift, setCheckedGift } = useProductContext()\n const { freeLabel } = freeGift || {}\n\n return (\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <Picture source={gift?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={gift?.product?.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${freeLabel}`}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end gap-2 justify-center\">\n {giftStatus && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"text-base desktop:text-2xl font-bold\" html={freeLabel} />\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n <Button\n size={giftStatus ? 'icon' : 'lg'}\n variant={giftStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedGift?.(giftStatus ? undefined : gift)\n giftOperation(gift)\n }}\n className={cn('shrink-0 size-auto', {\n underline: giftStatus,\n })}\n >\n {giftStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductSummary\n"],
|
|
5
|
-
"mappings": "AAkDQ,OACE,OAAAA,EADF,QAAAC,MAAA,oBAlDR,OAAS,QAAAC,EAAM,UAAAC,EAAmB,QAAAC,EAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,MAAe,4BAE1E,OAAS,
|
|
6
|
-
"names": ["jsx", "jsxs", "Text", "Button", "Grid", "GridItem", "Picture", "Heading", "
|
|
4
|
+
"sourcesContent": ["import { Text, Button, Container, Grid, GridItem, Picture, Heading } from '../../../../../components'\nimport type { ProductSummaryProps } from './types'\nimport { useBizProductContext } from '../../../BizProductProvider'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils'\nimport { useAiuiContext } from '../../../../AiuiProvider'\nimport type { BundleListItem, ProductVariant } from '../../../types/product'\nimport { cn } from '../../../../../helpers'\nimport Decimal from 'decimal.js'\n\nconst ProductSummary = ({}: ProductSummaryProps) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n onAddToCart,\n onBuyNow,\n savingDetail,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n } = useBizProductContext()\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n const { bundleVariant, giftVariant } = useRecommendBuyProducts() || {}\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift ? undefined : giftVariant,\n })\n }, [bundleVariant, giftVariant, joinedRecommendBuyProducts])\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"ipc-product-summary bg-[#F5F5F7] mt-16\">\n <Grid className=\"px-4 py-6 tablet:p-8\">\n <GridItem className=\"col-span-12 desktop:col-start-1 desktop:col-span-5\">\n <Heading\n className=\"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]\"\n html={`${product.title} is ready <br/><span>Just the way you want it.</span>`}\n />\n <div className=\"aspect-[644/320]\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"h-full w-full\"\n imgClassName=\"object-contain h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"col-span-12 mt-8 desktop:col-start-7 laptop:mt-0 desktop:col-span-6 flex flex-col gap-6 justify-between\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"shrink-0 flex items-center gap-4\">\n <Picture source={variant.image?.url || product?.images?.[0]?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]\"\n html={product.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${selectedOptions.color || selectedOptions.colour || selectedOptions.couleur}`}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n {joinedRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, gift: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n }}\n giftStatus={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift}\n />\n )}\n {joinedRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, bundle: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n }}\n bundleStatus={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n {(initialRecommendBuyProducts?.bundle || initialRecommendBuyProducts?.gift) && (\n <div className=\"mt-6\">\n <Text className=\"text-sm desktop:text-[18px] font-bold\" html={'Recommend Buy'} />\n <div className=\"flex flex-col gap-6 mt-6\">\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ gift })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n }}\n giftStatus={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ bundle })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n }}\n bundleStatus={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl desktop:text-2xl font-bold text-right\"\n html={`${copyWriting?.totalPrice} ${formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}`}\n />\n\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"flex gap-3 mt-2\">\n <Button size=\"lg\" variant=\"secondary\" className=\"w-1/2\" onClick={() => onAddToCart?.()}>\n {copyWriting?.addToCart}\n </Button>\n <Button size=\"lg\" variant=\"primary\" className=\"w-1/2\" onClick={() => onBuyNow?.()}>\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift } = useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale)\n giftVariant = checkedGift || firstAvailableGift\n\n return { bundleVariant, giftVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleStatus,\n bundleListItem,\n}: {\n bundleOperation: (bundle: BundleListItem) => void\n bundleStatus: boolean\n bundleListItem: BundleListItem\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"flex items-center justify-between\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center gap-4\" key={bundleVariant.variant.id}>\n <Picture source={bundleVariant?.variant?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n )\n })}\n <div className=\"flex flex-col items-end gap-1 justify-center\">\n {bundleStatus && (\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({\n amount: bundleVariants[0]?.price,\n locale,\n currencyCode: bundleVariants[0]?.variant?.price?.currencyCode,\n })}\n />\n )}\n <Button\n size={bundleStatus ? 'icon' : 'lg'}\n variant={bundleStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedBundle?.(bundleStatus ? undefined : bundleListItem)\n bundleOperation(bundleListItem)\n }}\n className={cn('shrink-0 size-auto', {\n underline: bundleStatus,\n })}\n >\n {bundleStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n giftStatus,\n gift,\n}: {\n giftOperation: (gift: ProductVariant) => void\n giftStatus: boolean\n gift: ProductVariant\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n\n return (\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <Picture source={gift?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={gift?.product?.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${freeLabel}`}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end gap-2 justify-center\">\n {giftStatus && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"text-base desktop:text-2xl font-bold\" html={freeLabel} />\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n <Button\n size={giftStatus ? 'icon' : 'lg'}\n variant={giftStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedGift?.(giftStatus ? undefined : gift)\n giftOperation(gift)\n }}\n className={cn('shrink-0 size-auto', {\n underline: giftStatus,\n })}\n >\n {giftStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductSummary\n"],
|
|
5
|
+
"mappings": "AAkDQ,OACE,OAAAA,EADF,QAAAC,MAAA,oBAlDR,OAAS,QAAAC,EAAM,UAAAC,EAAmB,QAAAC,EAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,MAAe,4BAE1E,OAAS,wBAAAC,MAA4B,8BACrC,OAAS,aAAAC,EAAW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AClC,UAAWyC,CACb,CAAC,EAEA,SAAAA,EAAa,SAAW,QAC3B,GACF,GACF,CAEJ,EAEA,IAAOG,EAAQ1C",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "Button", "Grid", "GridItem", "Picture", "Heading", "useBizProductContext", "useEffect", "useMemo", "useState", "formatPrice", "useAiuiContext", "cn", "Decimal", "ProductSummary", "locale", "copyWriting", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "onAddToCart", "onBuyNow", "savingDetail", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "bundleVariant", "giftVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "comparePriceRemovedFreeGift", "ProductGiftSummary", "gift", "ProductBundleSummary", "bundle", "checkedBundle", "freeGift", "checkedGift", "bundleList", "giftList", "availableBundleList", "v", "firstAvailableBundle", "firstAvailableGift", "bundleOperation", "bundleStatus", "bundleListItem", "setCheckedBundle", "bundleVariants", "giftOperation", "giftStatus", "setCheckedGift", "freeLabel", "ProductSummary_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Text as o,Button as b}from"../../../../../components";import{useAiuiContext as f}from"../../../../AiuiProvider/index.js";import{
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Text as o,Button as b}from"../../../../../components";import{useAiuiContext as f}from"../../../../AiuiProvider/index.js";import{useBizProductContext as v}from"../../../BizProductProvider.js";import{useMemo as g}from"react";import{formatPrice as n}from"../../../utils";import c from"decimal.js";const N=()=>{const{copyWriting:a,locale:i="us"}=f(),{variant:t,finalPrice:s,totalSavings:y,comparePrice:m,onAddToCart:x,onBuyNow:p,savingDetail:r,coupon:d}=v();console.log(r,"savingDetail");const u=g(()=>new c(m).minus(r.freeGift).toNumber(),[m,r]);return l("div",{className:"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4",children:[t.availableForSale?l("div",{className:"flex items-center justify-between tablet:flex-col desktop:items-end",children:[l("div",{className:"flex items-center gap-1",children:[e(o,{className:"text-xl font-bold leading-[1.2] tablet:text-2xl",html:n({amount:s,currencyCode:t.price.currencyCode,locale:i})}),d&&e(o,{className:"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl",html:n({amount:u,currencyCode:t.price.currencyCode,locale:i})})]}),d&&e(o,{className:"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl",html:`${a?.totalSavings} ${n({amount:new c(u).minus(new c(s)).toNumber(),currencyCode:t.price.currencyCode,locale:i})}`})]}):e(o,{className:"text-[20px] font-bold text-[#999999]",html:a?.soldOut??"Sold Out"}),l("div",{className:"flex items-center gap-2 mt-2 tablet:mt-0",children:[e(b,{variant:"secondary",disabled:!t.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>x?.(),children:a?.addToCart??"Add to Cart"}),e(b,{variant:"primary",disabled:!t.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>p?.(),children:a?.buyNow??"Buy Now"})]})]})};var A=N;export{A as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ProductActions/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Button } from '../../../../../components'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Text", "Button", "useAiuiContext", "
|
|
4
|
+
"sourcesContent": ["import { Text, Button } from '../../../../../components'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo } from 'react'\nimport { formatPrice } from '../../../utils'\nimport Decimal from 'decimal.js'\n\nconst ProductActions = () => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const { variant, finalPrice, totalSavings, comparePrice, onAddToCart, onBuyNow, savingDetail, coupon } =\n useBizProductContext()\n\n console.log(savingDetail, 'savingDetail')\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4\">\n {variant.availableForSale ? (\n <div className=\"flex items-center justify-between tablet:flex-col desktop:items-end\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-xl font-bold leading-[1.2] tablet:text-2xl\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon &&<Text\n className=\"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />}\n </div>\n {coupon && (\n <Text\n className=\"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl\"\n html={`${copyWriting?.totalSavings} ${formatPrice({ amount: new Decimal(comparePriceRemovedFreeGift).minus(new Decimal(finalPrice)).toNumber(), currencyCode: variant.price.currencyCode, locale })}`}\n />\n )}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"flex items-center gap-2 mt-2 tablet:mt-0\">\n <Button\n variant=\"secondary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onAddToCart?.()}\n >\n {copyWriting?.addToCart ?? 'Add to Cart'}\n </Button>\n <Button\n variant=\"primary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onBuyNow?.()}\n >\n {copyWriting?.buyNow ?? 'Buy Now'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductActions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AEAX,EAACE,EAAA,CAAK,UAAU,uCAAuC,KAAMQ,GAAa,SAAW,WAAY,EAEnGT,EAAC,OAAI,UAAU,2CACb,UAAAD,EAACG,EAAA,CACC,QAAQ,YACR,SAAU,CAACS,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMI,IAAc,EAE5B,SAAAN,GAAa,WAAa,cAC7B,EACAV,EAACG,EAAA,CACC,QAAQ,UACR,SAAU,CAACS,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMK,IAAW,EAEzB,SAAAP,GAAa,QAAU,UAC1B,GACF,GACF,CAEJ,EAEA,IAAOW,EAAQZ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "Button", "useAiuiContext", "useBizProductContext", "useMemo", "formatPrice", "Decimal", "ProductActions", "copyWriting", "locale", "variant", "finalPrice", "totalSavings", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "coupon", "comparePriceRemovedFreeGift", "ProductActions_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as a}from"react/jsx-runtime";import"../../../../AiuiProvider/index.js";import{cn as f}from"../../../../../helpers/index.js";import{useState as c,useCallback as p,useRef as x}from"react";import{gsap as N}from"gsap";import{
|
|
1
|
+
import{jsx as t,jsxs as a}from"react/jsx-runtime";import"../../../../AiuiProvider/index.js";import{cn as f}from"../../../../../helpers/index.js";import{useState as c,useCallback as p,useRef as x}from"react";import{gsap as N}from"gsap";import{useBizProductContext as S}from"../../../BizProductProvider.js";const h=({tabs:l,purchaseBarHeight:s,onSpyNavItemClick:i})=>{const[n,r]=c(!1),[o,m]=c(l?.[0]),d=x(null),{renderRating:u}=S(),b=p(e=>{m(e),i?.(e),r(!1)},[]),v=p(()=>{r(!n),N.fromTo(d?.current,{height:0},{height:"auto",duration:.5,ease:"power2.inOut"})},[n]);return a("div",{children:[t("button",{className:"text-sm h-[28px] font-bold leading-[28px] px-[10px] border rounded-full border-black",onClick:v,children:o?.label}),a("div",{className:f("absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0",{hidden:!n}),style:{height:`calc(100dvh - ${s}px)`},children:[a("div",{ref:d,className:"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white",children:[l?.map(e=>t("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",onClick:()=>b(e),children:e.label},e.id)),t("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",children:u})]}),t("div",{className:"flex-1",onClick:()=>r(!1)})]})]})},y=({tabs:l,onSpyNavItemClick:s})=>{const[i,n]=c(l?.[0]),r=p(o=>{n(o),s?.(o)},[]);return t("div",{className:"flex gap-8",children:l?.map(o=>a("button",{className:"text-sm relative py-[10px] font-bold",onClick:()=>r(o),children:[o.label,t("div",{className:f("absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0",{"w-full":i?.id===o.id})})]},o.id))})};export{y as DesktopScrollSpyNav,h as MobileScrollSpyNav};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport { useState, useCallback, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport {
|
|
5
|
-
"mappings": "AA0BM,cAAAA,EAcE,QAAAC,MAdF,oBA1BN,MAA+B,oCAC/B,OAAS,MAAAC,MAAU,kCACnB,OAAS,YAAAC,EAAU,eAAAC,EAAa,UAAAC,MAAc,QAC9C,OAAS,QAAAC,MAAY,OAErB,OAAS,
|
|
6
|
-
"names": ["jsx", "jsxs", "cn", "useState", "useCallback", "useRef", "gsap", "
|
|
4
|
+
"sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport { useState, useCallback, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\n\nconst MobileScrollSpyNav = ({ tabs, purchaseBarHeight, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [dropdownOpen, setDropdownOpen] = useState(false)\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n const dropdownRef = useRef<HTMLDivElement>(null)\n const { renderRating } = useBizProductContext()\n \n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n setDropdownOpen(false)\n }, [])\n\n const onDropdownOpen = useCallback(() => {\n setDropdownOpen(!dropdownOpen)\n gsap.fromTo(dropdownRef?.current, { height: 0 }, { height: 'auto', duration: 0.5, ease: 'power2.inOut' })\n }, [dropdownOpen])\n\n return (\n <div>\n <button\n className=\"text-sm h-[28px] font-bold leading-[28px] px-[10px] border rounded-full border-black\"\n onClick={onDropdownOpen}\n >\n {activeTab?.label}\n </button>\n <div\n className={cn('absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0', {\n ['hidden']: !dropdownOpen,\n })}\n style={{\n height: `calc(100dvh - ${purchaseBarHeight}px)`,\n }}\n >\n <div ref={dropdownRef} className=\"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white\">\n {tabs?.map(tab => (\n <button\n className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\"\n key={tab.id}\n onClick={() => onTabClick(tab)}\n >\n {tab.label}\n </button>\n ))}\n <button className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\">{renderRating}</button>\n </div>\n <div className=\"flex-1\" onClick={() => setDropdownOpen(false)} />\n </div>\n </div>\n )\n}\n\nconst DesktopScrollSpyNav = ({ tabs, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n\n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n }, [])\n\n return (\n <div className=\"flex gap-8\">\n {tabs?.map(tab => (\n <button className=\"text-sm relative py-[10px] font-bold\" key={tab.id} onClick={() => onTabClick(tab)}>\n {tab.label}\n <div\n className={cn('absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0', {\n 'w-full': activeTab?.id === tab.id,\n })}\n />\n </button>\n ))}\n </div>\n )\n}\n\nexport { MobileScrollSpyNav, DesktopScrollSpyNav }\n"],
|
|
5
|
+
"mappings": "AA0BM,cAAAA,EAcE,QAAAC,MAdF,oBA1BN,MAA+B,oCAC/B,OAAS,MAAAC,MAAU,kCACnB,OAAS,YAAAC,EAAU,eAAAC,EAAa,UAAAC,MAAc,QAC9C,OAAS,QAAAC,MAAY,OAErB,OAAS,wBAAAC,MAA4B,iCAErC,MAAMC,EAAqB,CAAC,CAAE,KAAAC,EAAM,kBAAAC,EAAmB,kBAAAC,CAAkB,IAAyB,CAChG,KAAM,CAACC,EAAcC,CAAe,EAAIV,EAAS,EAAK,EAChD,CAACW,EAAWC,CAAY,EAAIZ,EAASM,IAAO,CAAC,CAAC,EAC9CO,EAAcX,EAAuB,IAAI,EACzC,CAAE,aAAAY,CAAa,EAAIV,EAAqB,EAExCW,EAAad,EAAae,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,EACvBN,EAAgB,EAAK,CACvB,EAAG,CAAC,CAAC,EAECO,EAAiBhB,EAAY,IAAM,CACvCS,EAAgB,CAACD,CAAY,EAC7BN,EAAK,OAAOU,GAAa,QAAS,CAAE,OAAQ,CAAE,EAAG,CAAE,OAAQ,OAAQ,SAAU,GAAK,KAAM,cAAe,CAAC,CAC1G,EAAG,CAACJ,CAAY,CAAC,EAEjB,OACEX,EAAC,OACC,UAAAD,EAAC,UACC,UAAU,uFACV,QAASoB,EAER,SAAAN,GAAW,MACd,EACAb,EAAC,OACC,UAAWC,EAAG,mEAAoE,CAC/E,OAAW,CAACU,CACf,CAAC,EACD,MAAO,CACL,OAAQ,iBAAiBF,CAAiB,KAC5C,EAEA,UAAAT,EAAC,OAAI,IAAKe,EAAa,UAAU,mEAC9B,UAAAP,GAAM,IAAIU,GACTnB,EAAC,UACC,UAAU,qDAEV,QAAS,IAAMkB,EAAWC,CAAG,EAE5B,SAAAA,EAAI,OAHAA,EAAI,EAIX,CACD,EACDnB,EAAC,UAAO,UAAU,qDAAsD,SAAAiB,EAAa,GACvF,EACAjB,EAAC,OAAI,UAAU,SAAS,QAAS,IAAMa,EAAgB,EAAK,EAAG,GACjE,GACF,CAEJ,EAEMQ,EAAsB,CAAC,CAAE,KAAAZ,EAAM,kBAAAE,CAAkB,IAAyB,CAC9E,KAAM,CAACG,EAAWC,CAAY,EAAIZ,EAASM,IAAO,CAAC,CAAC,EAE9CS,EAAad,EAAae,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,CACzB,EAAG,CAAC,CAAC,EAEL,OACEnB,EAAC,OAAI,UAAU,aACZ,SAAAS,GAAM,IAAIU,GACTlB,EAAC,UAAO,UAAU,uCAAoD,QAAS,IAAMiB,EAAWC,CAAG,EAChG,UAAAA,EAAI,MACLnB,EAAC,OACC,UAAWE,EAAG,0FAA2F,CACvG,SAAUY,GAAW,KAAOK,EAAI,EAClC,CAAC,EACH,IAN4DA,EAAI,EAOlE,CACD,EACH,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "cn", "useState", "useCallback", "useRef", "gsap", "useBizProductContext", "MobileScrollSpyNav", "tabs", "purchaseBarHeight", "onSpyNavItemClick", "dropdownOpen", "setDropdownOpen", "activeTab", "setActiveTab", "dropdownRef", "renderRating", "onTabClick", "tab", "onDropdownOpen", "DesktopScrollSpyNav"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useEffect as m,useState as n,useMemo as u}from"react";import{Heading as d,Container as f}from"../../../../components";import"gsap";import"../../../AiuiProvider/index.js";import"../../../../helpers/index.js";import{ProductActions as b}from"../index.js";import{
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useEffect as m,useState as n,useMemo as u}from"react";import{Heading as d,Container as f}from"../../../../components";import"gsap";import"../../../AiuiProvider/index.js";import"../../../../helpers/index.js";import{ProductActions as b}from"../index.js";import{useBizProductContext as h}from"../../BizProductProvider.js";import{MobileScrollSpyNav as y,DesktopScrollSpyNav as x}from"./ScrollSpyNav/index.js";const v=({onSpyNavItemClick:r})=>{const[p,i]=n(0),{isMobile:g,product:t,renderRating:l,isDesktop:o}=h(),s=u(()=>t?.payload?.components?.find(c=>c.componentKey==="PurchaseBar")?.data||[],[t?.payload]);return m(()=>{i(document.querySelector("#purchase-bar")?.clientHeight||0)},[]),e("div",{id:"purchase-bar",className:"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]",children:e(f,{className:"py-3 desktop:pt-6 desktop:pb-0",children:a("div",{className:"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full",children:[a("div",{className:"flex-1 tablet:flex-none",children:[e(d,{size:2,className:"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]",html:t?.title}),o&&a("div",{className:"flex justify-between gap-8 items-center mt-3",children:[e(x,{tabs:s,onSpyNavItemClick:r}),l]})]}),o?e(b,{}):e(y,{tabs:s,purchaseBarHeight:p,onSpyNavItemClick:r})]})})})};var R=v;export{R as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/biz-components/Listing/components/PurchaseBar/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useRef, useState, useMemo } from 'react'\nimport { Text, Heading, Button, Container } from '../../../../components'\nimport type { PurchaseBarProps, ScrollSpyNavProps, ScrollSpyNavItem } from './types.js'\nimport { gsap } from 'gsap'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ProductActions } from '../index.js'\nimport {
|
|
5
|
-
"mappings": "AA2BY,cAAAA,EAME,QAAAC,MANF,oBA3BZ,OAAsB,aAAAC,EAAmB,YAAAC,EAAU,WAAAC,MAAe,QAClE,OAAe,WAAAC,EAAiB,aAAAC,MAAiB,yBAEjD,MAAqB,OACrB,MAA+B,iCAC/B,MAAmB,+BACnB,OAAS,kBAAAC,MAAsB,cAC/B,OAAS,
|
|
6
|
-
"names": ["jsx", "jsxs", "useEffect", "useState", "useMemo", "Heading", "Container", "ProductActions", "
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useRef, useState, useMemo } from 'react'\nimport { Text, Heading, Button, Container } from '../../../../components'\nimport type { PurchaseBarProps, ScrollSpyNavProps, ScrollSpyNavItem } from './types.js'\nimport { gsap } from 'gsap'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ProductActions } from '../index.js'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { MobileScrollSpyNav, DesktopScrollSpyNav } from './ScrollSpyNav/index.js'\n\nconst PurchaseBar = ({ onSpyNavItemClick }: PurchaseBarProps) => {\n const [purchaseBarHeight, setPurchaseBarHeight] = useState(0)\n const { isMobile, product, renderRating, isDesktop } = useBizProductContext()\n\n const PurchaseBarData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'PurchaseBar')?.data || []\n }, [product?.payload])\n\n useEffect(() => {\n setPurchaseBarHeight(document.querySelector('#purchase-bar')?.clientHeight || 0)\n }, [])\n\n return (\n <div id=\"purchase-bar\" className=\"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]\">\n <Container className=\"py-3 desktop:pt-6 desktop:pb-0\">\n <div className=\"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full\">\n <div className=\"flex-1 tablet:flex-none\">\n <Heading\n size={2}\n className=\"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]\"\n html={product?.title}\n />\n {isDesktop && (\n <div className=\"flex justify-between gap-8 items-center mt-3\">\n <DesktopScrollSpyNav tabs={PurchaseBarData} onSpyNavItemClick={onSpyNavItemClick} />\n {renderRating}\n </div>\n )}\n </div>\n {!isDesktop ? (\n <MobileScrollSpyNav\n tabs={PurchaseBarData}\n purchaseBarHeight={purchaseBarHeight}\n onSpyNavItemClick={onSpyNavItemClick}\n />\n ) : (\n <ProductActions />\n )}\n </div>\n </Container>\n </div>\n )\n}\n\nexport default PurchaseBar\n"],
|
|
5
|
+
"mappings": "AA2BY,cAAAA,EAME,QAAAC,MANF,oBA3BZ,OAAsB,aAAAC,EAAmB,YAAAC,EAAU,WAAAC,MAAe,QAClE,OAAe,WAAAC,EAAiB,aAAAC,MAAiB,yBAEjD,MAAqB,OACrB,MAA+B,iCAC/B,MAAmB,+BACnB,OAAS,kBAAAC,MAAsB,cAC/B,OAAS,wBAAAC,MAA4B,8BACrC,OAAS,sBAAAC,EAAoB,uBAAAC,MAA2B,0BAExD,MAAMC,EAAc,CAAC,CAAE,kBAAAC,CAAkB,IAAwB,CAC/D,KAAM,CAACC,EAAmBC,CAAoB,EAAIX,EAAS,CAAC,EACtD,CAAE,SAAAY,EAAU,QAAAC,EAAS,aAAAC,EAAc,UAAAC,CAAU,EAAIV,EAAqB,EAEtEW,EAAkBf,EAAQ,IACvBY,GAAS,SAAS,YAAY,KAAMI,GAAcA,EAAK,eAAiB,aAAa,GAAG,MAAQ,CAAC,EACvG,CAACJ,GAAS,OAAO,CAAC,EAErB,OAAAd,EAAU,IAAM,CACdY,EAAqB,SAAS,cAAc,eAAe,GAAG,cAAgB,CAAC,CACjF,EAAG,CAAC,CAAC,EAGHd,EAAC,OAAI,GAAG,eAAe,UAAU,uEAC/B,SAAAA,EAACM,EAAA,CAAU,UAAU,iCACnB,SAAAL,EAAC,OAAI,UAAU,iFACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACK,EAAA,CACC,KAAM,EACN,UAAU,mFACV,KAAMW,GAAS,MACjB,EACCE,GACCjB,EAAC,OAAI,UAAU,+CACb,UAAAD,EAACU,EAAA,CAAoB,KAAMS,EAAiB,kBAAmBP,EAAmB,EACjFK,GACH,GAEJ,EACEC,EAOAlB,EAACO,EAAA,EAAe,EANhBP,EAACS,EAAA,CACC,KAAMU,EACN,kBAAmBN,EACnB,kBAAmBD,EACrB,GAIJ,EACF,EACF,CAEJ,EAEA,IAAOS,EAAQV",
|
|
6
|
+
"names": ["jsx", "jsxs", "useEffect", "useState", "useMemo", "Heading", "Container", "ProductActions", "useBizProductContext", "MobileScrollSpyNav", "DesktopScrollSpyNav", "PurchaseBar", "onSpyNavItemClick", "purchaseBarHeight", "setPurchaseBarHeight", "isMobile", "product", "renderRating", "isDesktop", "PurchaseBarData", "item", "PurchaseBar_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useBizProductContext as p}from"../BizProductProvider";import{checkItemAvailableForProduct as g}from"../utils/helper";import{useAiuiContext as b}from"../../AiuiProvider/index.js";const x=({variant:t})=>{const{coupon:s,product:u,bundle:o,freeGift:i,memberFunctionResult:l,creditsRedemptionAmount:f,discount:B}=p(),{trackingData:n}=b(),c=Math.max(l?.withCouponMemberTotalSave??0,l?.withoutCouponMaxMemberTotalSave??0),r=!!(n?.paidShipping&&t.requiresShipping&&!t?.metafields?.global?.presell&&!t?.metafields?.global?.HideShipping),a=n?.freeGift,m=a?.excludeProducts?.map(e=>typeof e=="object"&&"sku"in e?e.sku:e)??[],d=n?.levelDiscount&&g({product:u,variant:t,item:n?.levelDiscount});return{commonCoupon:{enable:!!s,config:s??{}},freeGift:{enable:!!i&&!!i?.giftList?.length,config:i},bundle:{enable:!!o&&!!o?.bundleList?.length&&Math.max(...o?.bundleList?.map(e=>e.savings??0))>0,config:o},memberDiscount:{enable:c>0,config:{amount:c,description:l?.labels?.find(e=>e.key==="benefit_tab_string")?.value}},creditsRedemption:{enable:!!f&&f>0,config:{amount:f,label:n?.creditsRedemptionLabel}},paidShipping:{enable:r,config:{}},fullGift:{enable:!!(a&&!m.includes(t.sku)),config:a??{}},levelDiscount:{enable:!!d,config:n?.levelDiscount??{}}}};export{x as useBenefits};
|
|
2
2
|
//# sourceMappingURL=useBenefits.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/biz-components/Listing/hooks/useBenefits.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,OAAS,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { useBizProductContext } from '../BizProductProvider'\nimport type { ProductVariant, FreeGift, Bundle } from '../types/product'\nimport { checkItemAvailableForProduct } from '../utils/helper'\n\n\nimport { useAiuiContext } from '../../AiuiProvider/index.js'\n\ninterface BenefitsParams {\n variant: ProductVariant\n}\n\ninterface BenefitItemConfig<T extends Record<string, any> = Record<string, any>> {\n enable: boolean\n config?: T // \u539F\u59CB\u914D\u7F6E\n}\n\ninterface BenefitsResult {\n /**\n * \u901A\u7528\u4F18\u60E0\u5238\n */\n commonCoupon?: BenefitItemConfig\n /**\n * \u4E70\u8D60\n */\n freeGift: BenefitItemConfig<FreeGift>\n /**\n * \u6346\u7ED1\u6298\u6263\n */\n bundle: BenefitItemConfig<Bundle>\n /**\n * \u4F1A\u5458\u4EF7\n */\n memberDiscount: BenefitItemConfig\n /**\n * \u79EF\u5206\u62B5\u73B0\n */\n creditsRedemption: BenefitItemConfig\n /**\n * \u9AD8\u6807\u7269\u6D41\n */\n paidShipping: BenefitItemConfig\n\n /**\n * \u6EE1\u8D60\n */\n fullGift: BenefitItemConfig\n\n /**\n * \u6EE1\u51CF\u6298\u6263\n */\n levelDiscount: BenefitItemConfig\n}\n\n/**\n * \u5546\u54C1\u6743\u76CA\n * \u83B7\u53D6\u5F53\u524Dsku \u6240\u6709\u7684\u6743\u76CA\n * \u5305\u62EC \u901A\u7528\u4F18\u60E0\u5238\uFF0C\u4F1A\u5458\u4EF7\uFF0C\u6EE1\u51CF\uFF0C\u6346\u7ED1\u6298\u6263\uFF0C\u4E70\u8D60 \uFF0C\u6EE1\u8D60 \uFF0C\u79EF\u5206\u62B5\u73B0\n * @returns\n */\nexport const useBenefits = ({\n variant,\n}: BenefitsParams): BenefitsResult => {\n const { coupon, product, bundle, freeGift, memberFunctionResult, creditsRedemptionAmount, discount } = useBizProductContext()\n\n const { trackingData } = useAiuiContext()\n\n const total = Math.max(\n memberFunctionResult?.withCouponMemberTotalSave ?? 0,\n memberFunctionResult?.withoutCouponMaxMemberTotalSave ?? 0\n )\n\n // \u9AD8\u6807\u7269\u6D41\n const showPaidShipping = Boolean(\n trackingData?.paidShipping &&\n variant.requiresShipping &&\n !variant?.metafields?.global?.presell &&\n !variant?.metafields?.global?.HideShipping\n )\n\n // \u811A\u672C\u6EE1\u8D60\n const fullGift = trackingData?.freeGift\n const excludeProducts =\n fullGift?.excludeProducts?.map((item: any) => (typeof item === 'object' && 'sku' in item ? item.sku : item)) ?? []\n\n const showLevelDiscount =\n trackingData?.levelDiscount &&\n checkItemAvailableForProduct({ product, variant, item: trackingData?.levelDiscount })\n\n return {\n commonCoupon: {\n enable: Boolean(coupon),\n config: coupon ?? {},\n },\n freeGift: {\n enable: Boolean(freeGift) && !!freeGift?.giftList?.length,\n config: freeGift,\n },\n bundle: {\n enable:\n Boolean(bundle) &&\n !!bundle?.bundleList?.length &&\n Math.max(...bundle?.bundleList?.map(item => item.savings ?? 0)) > 0, // \u6709\u4F18\u60E0\u624D\u5C55\u793A\n config: bundle,\n },\n memberDiscount: {\n enable: total > 0,\n config: {\n amount: total,\n description: memberFunctionResult?.labels?.find((item: any) => item.key === 'benefit_tab_string')?.value,\n },\n },\n creditsRedemption: {\n enable: Boolean(creditsRedemptionAmount) && creditsRedemptionAmount! > 0,\n config: { amount: creditsRedemptionAmount, label: trackingData?.creditsRedemptionLabel },\n },\n paidShipping: {\n enable: showPaidShipping,\n config: {},\n },\n fullGift: {\n enable: Boolean(fullGift && !excludeProducts.includes(variant.sku)),\n config: fullGift ?? {},\n },\n levelDiscount: {\n enable: Boolean(showLevelDiscount),\n config: trackingData?.levelDiscount ?? {},\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,wBAErC,OAAS,gCAAAC,MAAoC,kBAG7C,OAAS,kBAAAC,MAAsB,8BAsDxB,MAAMC,EAAc,CAAC,CAC1B,QAAAC,CACF,IAAsC,CACpC,KAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,OAAAC,EAAQ,SAAAC,EAAU,qBAAAC,EAAsB,wBAAAC,EAAyB,SAAAC,CAAS,EAAIX,EAAqB,EAEtH,CAAE,aAAAY,CAAa,EAAIV,EAAe,EAElCW,EAAQ,KAAK,IACjBJ,GAAsB,2BAA6B,EACnDA,GAAsB,iCAAmC,CAC3D,EAGMK,EAAmB,GACvBF,GAAc,cACZR,EAAQ,kBACR,CAACA,GAAS,YAAY,QAAQ,SAC9B,CAACA,GAAS,YAAY,QAAQ,cAI5BW,EAAWH,GAAc,SACzBI,EACJD,GAAU,iBAAiB,IAAKE,GAAe,OAAOA,GAAS,UAAY,QAASA,EAAOA,EAAK,IAAMA,CAAK,GAAK,CAAC,EAE7GC,EACJN,GAAc,eACdX,EAA6B,CAAE,QAAAK,EAAS,QAAAF,EAAS,KAAMQ,GAAc,aAAc,CAAC,EAEtF,MAAO,CACL,aAAc,CACZ,OAAQ,EAAQP,EAChB,OAAQA,GAAU,CAAC,CACrB,EACA,SAAU,CACR,OAAQ,EAAQG,GAAa,CAAC,CAACA,GAAU,UAAU,OACnD,OAAQA,CACV,EACA,OAAQ,CACN,OACE,EAAQD,GACR,CAAC,CAACA,GAAQ,YAAY,QACtB,KAAK,IAAI,GAAGA,GAAQ,YAAY,IAAIU,GAAQA,EAAK,SAAW,CAAC,CAAC,EAAI,EACpE,OAAQV,CACV,EACA,eAAgB,CACd,OAAQM,EAAQ,EAChB,OAAQ,CACN,OAAQA,EACR,YAAaJ,GAAsB,QAAQ,KAAMQ,GAAcA,EAAK,MAAQ,oBAAoB,GAAG,KACrG,CACF,EACA,kBAAmB,CACjB,OAAQ,EAAQP,GAA4BA,EAA2B,EACvE,OAAQ,CAAE,OAAQA,EAAyB,MAAOE,GAAc,sBAAuB,CACzF,EACA,aAAc,CACZ,OAAQE,EACR,OAAQ,CAAC,CACX,EACA,SAAU,CACR,OAAQ,GAAQC,GAAY,CAACC,EAAgB,SAASZ,EAAQ,GAAG,GACjE,OAAQW,GAAY,CAAC,CACvB,EACA,cAAe,CACb,OAAQ,EAAQG,EAChB,OAAQN,GAAc,eAAiB,CAAC,CAC1C,CACF,CACF",
|
|
6
|
+
"names": ["useBizProductContext", "checkItemAvailableForProduct", "useAiuiContext", "useBenefits", "variant", "coupon", "product", "bundle", "freeGift", "memberFunctionResult", "creditsRedemptionAmount", "discount", "trackingData", "total", "showPaidShipping", "fullGift", "excludeProducts", "item", "showLevelDiscount"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ProductContextType } from './
|
|
1
|
+
import { type ProductContextType } from './BizProductProvider.js';
|
|
2
2
|
declare const Listing: React.FC<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>;
|
|
3
3
|
export default Listing;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as q}from"react/jsx-runtime";import{useAiuiContext as z}from"../AiuiProvider/index.js";import{PurchaseBar as G,ProductActions as L}from"./components/index.js";import O from"./BizProductProvider.js";import{ProductCard as T}from"./components/index.js";import{useMediaQuery as t}from"react-responsive";const i=({product:r,renderRating:n,variant:d,selectedOptions:c,setSelectedOptions:a,isLogin:j,finalPrice:s,coupon:p,comparePrice:l,totalSavings:m,savingDetail:u,freeGift:y,bundle:f,checkedBundle:P,checkedGift:v,setCheckedBundle:C,setCheckedGift:S,compareData:g,selectedVariants:h,onAddToCart:k,onBuyNow:B,openModal:N,setSavingDetail:x,openSignInPopup:I,openAuthCodePopup:A,renderAffirm:D,renderKlarna:b,renderPaypal:w})=>{const{locale:F}=z(),o=t({query:"(max-width: 768px)"}),M=t({query:"(min-width: 1440px)"});return e(O,{product:r,isMobile:o,isDesktop:M,freeGift:y,renderRating:n,finalPrice:s,comparePrice:l,totalSavings:m,savingDetail:u,variant:d,selectedOptions:c,setSelectedOptions:a,bundle:f,coupon:p,checkedBundle:P,checkedGift:v,setCheckedBundle:C,setCheckedGift:S,compareData:g,selectedVariants:h,onAddToCart:k,onBuyNow:B,openModal:N,setSavingDetail:x,openSignInPopup:I,openAuthCodePopup:A,renderAffirm:D,renderKlarna:b,renderPaypal:w,children:q("div",{id:"ipc-listing",children:[e(G,{onSpyNavItemClick:R=>{console.log(R)}}),o&&e("div",{className:"fixed bottom-0 left-0 w-full z-[60]",children:e(L,{})}),e(T,{})]})})};i.displayName="Listing";var U=i;export{U as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Listing/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useAiuiContext } from '../AiuiProvider/index.js'\nimport { PurchaseBar, ProductActions } from './components/index.js'\nimport type { ScrollSpyNavItem } from './components/PurchaseBar/types.js'\nimport
|
|
5
|
-
"mappings": "AA+EM,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/EN,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,eAAAC,EAAa,kBAAAC,MAAsB,wBAE5C,OAAOC,
|
|
6
|
-
"names": ["jsx", "jsxs", "useAiuiContext", "PurchaseBar", "ProductActions", "
|
|
4
|
+
"sourcesContent": ["import { useAiuiContext } from '../AiuiProvider/index.js'\nimport { PurchaseBar, ProductActions } from './components/index.js'\nimport type { ScrollSpyNavItem } from './components/PurchaseBar/types.js'\nimport BizProductProvider, { type ProductContextType } from './BizProductProvider.js'\nimport { ProductCard } from './components/index.js'\n\nimport { useMediaQuery } from 'react-responsive'\n\nconst Listing: React.FC<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>> = ({\n product,\n renderRating,\n variant,\n selectedOptions,\n setSelectedOptions,\n isLogin,\n finalPrice,\n coupon,\n comparePrice,\n totalSavings,\n savingDetail,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n openModal,\n setSavingDetail,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n}) => {\n const { locale } = useAiuiContext()\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isDesktop = useMediaQuery({ query: '(min-width: 1440px)' })\n\n const onSpyNavItemClick = (tab: ScrollSpyNavItem) => {\n console.log(tab)\n }\n\n return (\n <BizProductProvider\n product={product}\n isMobile={isMobile}\n isDesktop={isDesktop}\n freeGift={freeGift}\n renderRating={renderRating}\n finalPrice={finalPrice}\n comparePrice={comparePrice}\n totalSavings={totalSavings}\n savingDetail={savingDetail}\n variant={variant}\n selectedOptions={selectedOptions}\n setSelectedOptions={setSelectedOptions}\n bundle={bundle}\n coupon={coupon}\n checkedBundle={checkedBundle}\n checkedGift={checkedGift}\n setCheckedBundle={setCheckedBundle}\n setCheckedGift={setCheckedGift}\n compareData={compareData}\n selectedVariants={selectedVariants}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n openModal={openModal}\n setSavingDetail={setSavingDetail}\n openSignInPopup={openSignInPopup}\n openAuthCodePopup={openAuthCodePopup}\n renderAffirm={renderAffirm}\n renderKlarna={renderKlarna}\n renderPaypal={renderPaypal}\n >\n <div id=\"ipc-listing\">\n <PurchaseBar onSpyNavItemClick={onSpyNavItemClick} />\n {isMobile && (\n <div className=\"fixed bottom-0 left-0 w-full z-[60]\">\n <ProductActions />\n </div>\n )}\n <ProductCard />\n </div>\n </BizProductProvider>\n )\n}\n\nListing.displayName = 'Listing'\n\nexport default Listing\n"],
|
|
5
|
+
"mappings": "AA+EM,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/EN,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,eAAAC,EAAa,kBAAAC,MAAsB,wBAE5C,OAAOC,MAAqD,0BAC5D,OAAS,eAAAC,MAAmB,wBAE5B,OAAS,iBAAAC,MAAqB,mBAE9B,MAAMC,EAA8G,CAAC,CACnH,QAAAC,EACA,aAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,WAAAC,EACA,OAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,IAAM,CACJ,KAAM,CAAE,OAAAC,CAAO,EAAInC,EAAe,EAE5BoC,EAAW/B,EAAc,CAAE,MAAO,oBAAqB,CAAC,EACxDgC,EAAYhC,EAAc,CAAE,MAAO,qBAAsB,CAAC,EAMhE,OACEP,EAACK,EAAA,CACC,QAASI,EACT,SAAU6B,EACV,UAAWC,EACX,SAAUnB,EACV,aAAcV,EACd,WAAYK,EACZ,aAAcE,EACd,aAAcC,EACd,aAAcC,EACd,QAASR,EACT,gBAAiBC,EACjB,mBAAoBC,EACpB,OAAQQ,EACR,OAAQL,EACR,cAAeM,EACf,YAAaC,EACb,iBAAkBC,EAClB,eAAgBC,EAChB,YAAaC,EACb,iBAAkBC,EAClB,YAAaC,EACb,SAAUC,EACV,UAAWC,EACX,gBAAiBC,EACjB,gBAAiBC,EACjB,kBAAmBC,EACnB,aAAcC,EACd,aAAcC,EACd,aAAcC,EAEd,SAAAnC,EAAC,OAAI,GAAG,cACN,UAAAD,EAACG,EAAA,CAAY,kBArCQqC,GAA0B,CACnD,QAAQ,IAAIA,CAAG,CACjB,EAmCyD,EAClDF,GACCtC,EAAC,OAAI,UAAU,sCACb,SAAAA,EAACI,EAAA,EAAe,EAClB,EAEFJ,EAACM,EAAA,EAAY,GACf,EACF,CAEJ,EAEAE,EAAQ,YAAc,UAEtB,IAAOiC,EAAQjC",
|
|
6
|
+
"names": ["jsx", "jsxs", "useAiuiContext", "PurchaseBar", "ProductActions", "BizProductProvider", "ProductCard", "useMediaQuery", "Listing", "product", "renderRating", "variant", "selectedOptions", "setSelectedOptions", "isLogin", "finalPrice", "coupon", "comparePrice", "totalSavings", "savingDetail", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "compareData", "selectedVariants", "onAddToCart", "onBuyNow", "openModal", "setSavingDetail", "openSignInPopup", "openAuthCodePopup", "renderAffirm", "renderKlarna", "renderPaypal", "locale", "isMobile", "isDesktop", "tab", "Listing_default"]
|
|
7
7
|
}
|
|
@@ -40,7 +40,7 @@ export { default as Paginator } from './Paginator/index.js';
|
|
|
40
40
|
export { default as CollectionsBanner } from './CollectionsBanner/index.js';
|
|
41
41
|
export { default as TextMarquee } from './TextMarquee/index.js';
|
|
42
42
|
export { default as CollectionShelves } from './CollectionShelves/index.js';
|
|
43
|
-
export { default as
|
|
43
|
+
export { default as BizProductProvider } from './Listing/BizProductProvider.js';
|
|
44
44
|
export { default as PurchaseBar } from './Listing/components/PurchaseBar/index.js';
|
|
45
45
|
export { default as ProductActions } from './Listing/components/PurchaseBar/ProductActions/index.js';
|
|
46
46
|
export { default as ProductCard } from './Listing/components/ProductCard/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as t}from"./BrandEquity/index.js";import{default as o}from"./MemberEquity/index.js";import{default as l}from"./Slogan/index.js";import{default as p}from"./Title/index.js";import{default as s}from"./Spacer/index.js";import{default as x}from"./ShelfDisplay/index.js";import{default as c}from"./Evaluate/index.js";import{default as P}from"./Category/index.js";import{default as y}from"./HeroBanner/index.js";import{default as g}from"./AccordionCards/index.js";import{default as G}from"./Graphic/index.js";import{default as S}from"./MediaPlayerBase/index.js";import{default as A}from"./MediaPlayerSticky/index.js";import{default as q}from"./MediaPlayerMulti/index.js";import{default as k}from"./Marquee/index.js";import{default as b}from"./WhyChoose/index.js";import{default as H}from"./Faq/index.js";import{MarqueeItem as I,MarqueeImageContent as j,MarqueeTextContent as W}from"./Marquee/index.js";import{default as N}from"./MultiLayoutGraphicBlock/index.js";import{default as _}from"./GraphicAttractionBlock/index.js";import{default as
|
|
1
|
+
import{default as t}from"./BrandEquity/index.js";import{default as o}from"./MemberEquity/index.js";import{default as l}from"./Slogan/index.js";import{default as p}from"./Title/index.js";import{default as s}from"./Spacer/index.js";import{default as x}from"./ShelfDisplay/index.js";import{default as c}from"./Evaluate/index.js";import{default as P}from"./Category/index.js";import{default as y}from"./HeroBanner/index.js";import{default as g}from"./AccordionCards/index.js";import{default as G}from"./Graphic/index.js";import{default as S}from"./MediaPlayerBase/index.js";import{default as A}from"./MediaPlayerSticky/index.js";import{default as q}from"./MediaPlayerMulti/index.js";import{default as k}from"./Marquee/index.js";import{default as b}from"./WhyChoose/index.js";import{default as H}from"./Faq/index.js";import{MarqueeItem as I,MarqueeImageContent as j,MarqueeTextContent as W}from"./Marquee/index.js";import{default as N}from"./MultiLayoutGraphicBlock/index.js";import{default as _}from"./GraphicAttractionBlock/index.js";import{default as R}from"./HeaderNavigation/index.js";import{default as K}from"./FooterNavigation/index.js";import{default as U}from"./Listing/index.js";import{default as X}from"./SearchPage/index.js";import{IPC_SEARCH_PAGE as Z,SearchPageTabType as $}from"./SearchPage/types.js";import{withLayout as re}from"../shared/Styles.js";import{default as ae}from"./AiuiProvider/index.js";import{default as fe}from"./Tabs/index.js";import{default as ue}from"./CreativeModule/index.js";import{default as de}from"./GraphicOverlay/index.js";import{default as me}from"./CollectionsFilters/index.js";import{default as ie}from"./CollectionsFilters/FilterList.js";import{default as ne}from"./CollectionsFilters/FilterHeader.js";import{default as he}from"./CollectionsFilters/FilterCardWrap.js";import{default as Be}from"./CollectionsFilters/FilterCardWrapItem.js";import{default as Ce}from"./Paginator/index.js";import{default as Me}from"./CollectionsBanner/index.js";import{default as Fe}from"./TextMarquee/index.js";import{default as Te}from"./CollectionShelves/index.js";import{default as ve}from"./Listing/BizProductProvider.js";import{default as Le}from"./Listing/components/PurchaseBar/index.js";import{default as Ee}from"./Listing/components/PurchaseBar/ProductActions/index.js";import{default as De}from"./Listing/components/ProductCard/index.js";import{default as je}from"./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js";import{default as we}from"./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js";import{default as Oe}from"./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js";import{default as ze}from"./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js";import{default as Je}from"./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js";import{default as Qe}from"./Listing/components/ProductCard/ProductGridBox.js";import{default as Ve}from"./Listing/components/ProductCard/ProductGallery/index.js";import{default as Ye}from"./Listing/components/ProductCard/ProductDetail/index.js";import{default as $e}from"./Listing/components/ProductCard/ProductSummary/index.js";import{default as rr}from"./Listing/components/ProductCard/ProductDetail/BenefitsTab";import{default as ar}from"./Listing/components/PaidShipping/index.js";import{default as fr}from"./GraphicMore/index.js";import{default as ur}from"./Features/index.js";import{default as dr}from"./AplusDesc/index.js";import{default as mr}from"./GiftBox/index.js";import{default as ir}from"./SelectStore/index.js";import{default as nr}from"./DownLoad/index.js";import{default as hr}from"./FootCharger/index.js";import{default as Br}from"./Specs/index.js";import{default as Cr}from"./TabsGroup/index.js";export{g as AccordionCards,ae as AiuiProvider,dr as AplusDesc,rr as BenefitsTab,ve as BizProductProvider,t as BrandEquity,P as Category,Te as CollectionShelves,Me as CollectionsBanner,me as CollectionsFilters,ue as CreativeModule,nr as DownLoad,c as Evaluate,H as Faq,ur as Features,he as FilterCardWrap,Be as FilterCardWrapItem,ne as FilterHeader,ie as FilterList,hr as FootCharger,K as FooterNavigation,mr as GiftBox,G as Graphic,_ as GraphicAttractionBlock,fr as GraphicMore,de as GraphicOverlay,R as HeaderNavigation,y as HeroBanner,Z as IPC_SEARCH_PAGE,U as Listing,k as Marquee,j as MarqueeImageContent,I as MarqueeItem,W as MarqueeTextContent,S as MediaPlayerBase,q as MediaPlayerMulti,A as MediaPlayerSticky,o as MemberEquity,N as MultiLayoutGraphicBlock,Ce as Paginator,ar as PaidShipping,Ee as ProductActions,je as ProductBenefitsTabs,Je as ProductBundle,De as ProductCard,Ye as ProductDetail,Oe as ProductFreeGift,Ve as ProductGallery,Qe as ProductGridBox,we as ProductHighlight,ze as ProductOptions,$e as ProductSummary,Le as PurchaseBar,X as SearchPage,$ as SearchPageTabType,ir as SelectStore,x as ShelfDisplay,l as Slogan,s as Spacer,Br as Specs,Cr as TabGroup,fe as Tabs,Fe as TextMarquee,p as Title,b as WhyChoose,re as withLayout};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/biz-components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { default as HeaderNavigation } from './HeaderNavigation/index.js'\nexport { default as FooterNavigation } from './FooterNavigation/index.js'\nexport { default as Listing } from './Listing/index.js'\nexport { default as SearchPage } from './SearchPage/index.js'\nexport type { SearchPageProps } from './SearchPage/types.js'\nexport { IPC_SEARCH_PAGE, SearchPageTabType } from './SearchPage/types.js'\n\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\nexport { default as GraphicOverlay } from './GraphicOverlay/index.js'\nexport { default as CollectionsFilters } from './CollectionsFilters/index.js'\nexport { default as FilterList } from './CollectionsFilters/FilterList.js'\nexport { default as FilterHeader } from './CollectionsFilters/FilterHeader.js'\nexport { default as FilterCardWrap } from './CollectionsFilters/FilterCardWrap.js'\nexport { default as FilterCardWrapItem } from './CollectionsFilters/FilterCardWrapItem.js'\nexport { default as Paginator } from './Paginator/index.js'\nexport { default as CollectionsBanner } from './CollectionsBanner/index.js'\nexport { default as TextMarquee } from './TextMarquee/index.js'\nexport { default as CollectionShelves } from './CollectionShelves/index.js'\nexport { default as
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAAwB,mBACjC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA6B,wBACtC,OAAoB,WAAXA,MAAiC,4BAC1C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAAkC,6BAC3C,OAAoB,WAAXA,MAAoC,+BAC7C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA4B,uBACrC,OAAoB,WAAXA,MAAsB,iBAC/B,OAAS,eAAAC,EAAa,uBAAAC,EAAqB,sBAAAC,MAA0B,qBACrE,OAAoB,WAAXH,MAA0C,qCAEnD,OAAoB,WAAXA,MAAyC,oCAElD,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA6B,wBAEtC,OAAS,mBAAAI,EAAiB,qBAAAC,MAAyB,wBAEnD,OAAS,cAAAC,OAAkB,sBAC3B,OAAoB,WAAXN,OAA+B,0BACxC,OAAoB,WAAXA,OAAuB,kBAChC,OAAoB,WAAXA,OAAiC,4BAC1C,OAAoB,WAAXA,OAAiC,4BAC1C,OAAoB,WAAXA,OAAqC,gCAC9C,OAAoB,WAAXA,OAA6B,qCACtC,OAAoB,WAAXA,OAA+B,uCACxC,OAAoB,WAAXA,OAAiC,yCAC1C,OAAoB,WAAXA,OAAqC,6CAC9C,OAAoB,WAAXA,OAA4B,uBACrC,OAAoB,WAAXA,OAAoC,+BAC7C,OAAoB,WAAXA,OAA8B,yBACvC,OAAoB,WAAXA,OAAoC,+BAC7C,OAAoB,WAAXA,
|
|
4
|
+
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { default as HeaderNavigation } from './HeaderNavigation/index.js'\nexport { default as FooterNavigation } from './FooterNavigation/index.js'\nexport { default as Listing } from './Listing/index.js'\nexport { default as SearchPage } from './SearchPage/index.js'\nexport type { SearchPageProps } from './SearchPage/types.js'\nexport { IPC_SEARCH_PAGE, SearchPageTabType } from './SearchPage/types.js'\n\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\nexport { default as GraphicOverlay } from './GraphicOverlay/index.js'\nexport { default as CollectionsFilters } from './CollectionsFilters/index.js'\nexport { default as FilterList } from './CollectionsFilters/FilterList.js'\nexport { default as FilterHeader } from './CollectionsFilters/FilterHeader.js'\nexport { default as FilterCardWrap } from './CollectionsFilters/FilterCardWrap.js'\nexport { default as FilterCardWrapItem } from './CollectionsFilters/FilterCardWrapItem.js'\nexport { default as Paginator } from './Paginator/index.js'\nexport { default as CollectionsBanner } from './CollectionsBanner/index.js'\nexport { default as TextMarquee } from './TextMarquee/index.js'\nexport { default as CollectionShelves } from './CollectionShelves/index.js'\nexport { default as BizProductProvider } from './Listing/BizProductProvider.js'\nexport { default as PurchaseBar } from './Listing/components/PurchaseBar/index.js'\nexport { default as ProductActions } from './Listing/components/PurchaseBar/ProductActions/index.js'\nexport { default as ProductCard } from './Listing/components/ProductCard/index.js'\nexport { default as ProductBenefitsTabs } from './Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js'\nexport { default as ProductHighlight } from './Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js'\nexport { default as ProductFreeGift } from './Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js'\nexport { default as ProductOptions } from './Listing/components/ProductCard/ProductDetail/ProductOptions/index.js'\nexport { default as ProductBundle } from './Listing/components/ProductCard/ProductDetail/ProductBundle/index.js'\nexport { default as ProductGridBox } from './Listing/components/ProductCard/ProductGridBox.js'\nexport { default as ProductGallery } from './Listing/components/ProductCard/ProductGallery/index.js'\nexport { default as ProductDetail } from './Listing/components/ProductCard/ProductDetail/index.js'\nexport { default as ProductSummary } from './Listing/components/ProductCard/ProductSummary/index.js'\nexport { default as BenefitsTab } from './Listing/components/ProductCard/ProductDetail/BenefitsTab'\nexport { default as PaidShipping } from './Listing/components/PaidShipping/index.js'\nexport { default as GraphicMore } from './GraphicMore/index.js'\nexport { default as Features } from './Features/index.js'\nexport { default as AplusDesc } from './AplusDesc/index.js'\nexport { default as GiftBox } from './GiftBox/index.js'\nexport { default as SelectStore } from './SelectStore/index.js'\nexport { default as DownLoad } from './DownLoad/index.js'\nexport { default as FootCharger } from './FootCharger/index.js'\nexport { default as Specs } from './Specs/index.js'\nexport { default as TabGroup } from './TabsGroup/index.js'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAAwB,mBACjC,OAAoB,WAAXA,MAAyB,oBAClC,OAAoB,WAAXA,MAA+B,0BACxC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA2B,sBACpC,OAAoB,WAAXA,MAA6B,wBACtC,OAAoB,WAAXA,MAAiC,4BAC1C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAAkC,6BAC3C,OAAoB,WAAXA,MAAoC,+BAC7C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA4B,uBACrC,OAAoB,WAAXA,MAAsB,iBAC/B,OAAS,eAAAC,EAAa,uBAAAC,EAAqB,sBAAAC,MAA0B,qBACrE,OAAoB,WAAXH,MAA0C,qCAEnD,OAAoB,WAAXA,MAAyC,oCAElD,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAAmC,8BAC5C,OAAoB,WAAXA,MAA0B,qBACnC,OAAoB,WAAXA,MAA6B,wBAEtC,OAAS,mBAAAI,EAAiB,qBAAAC,MAAyB,wBAEnD,OAAS,cAAAC,OAAkB,sBAC3B,OAAoB,WAAXN,OAA+B,0BACxC,OAAoB,WAAXA,OAAuB,kBAChC,OAAoB,WAAXA,OAAiC,4BAC1C,OAAoB,WAAXA,OAAiC,4BAC1C,OAAoB,WAAXA,OAAqC,gCAC9C,OAAoB,WAAXA,OAA6B,qCACtC,OAAoB,WAAXA,OAA+B,uCACxC,OAAoB,WAAXA,OAAiC,yCAC1C,OAAoB,WAAXA,OAAqC,6CAC9C,OAAoB,WAAXA,OAA4B,uBACrC,OAAoB,WAAXA,OAAoC,+BAC7C,OAAoB,WAAXA,OAA8B,yBACvC,OAAoB,WAAXA,OAAoC,+BAC7C,OAAoB,WAAXA,OAAqC,kCAC9C,OAAoB,WAAXA,OAA8B,4CACvC,OAAoB,WAAXA,OAAiC,2DAC1C,OAAoB,WAAXA,OAA8B,4CACvC,OAAoB,WAAXA,OAAsC,8EAC/C,OAAoB,WAAXA,OAAmC,2EAC5C,OAAoB,WAAXA,OAAkC,0EAC3C,OAAoB,WAAXA,OAAiC,yEAC1C,OAAoB,WAAXA,OAAgC,wEACzC,OAAoB,WAAXA,OAAiC,qDAC1C,OAAoB,WAAXA,OAAiC,2DAC1C,OAAoB,WAAXA,OAAgC,0DACzC,OAAoB,WAAXA,OAAiC,2DAC1C,OAAoB,WAAXA,OAA8B,6DACvC,OAAoB,WAAXA,OAA+B,6CACxC,OAAoB,WAAXA,OAA8B,yBACvC,OAAoB,WAAXA,OAA2B,sBACpC,OAAoB,WAAXA,OAA4B,uBACrC,OAAoB,WAAXA,OAA0B,qBACnC,OAAoB,WAAXA,OAA8B,yBACvC,OAAoB,WAAXA,OAA2B,sBACpC,OAAoB,WAAXA,OAA8B,yBACvC,OAAoB,WAAXA,OAAwB,mBACjC,OAAoB,WAAXA,OAA2B",
|
|
6
6
|
"names": ["default", "MarqueeItem", "MarqueeImageContent", "MarqueeTextContent", "IPC_SEARCH_PAGE", "SearchPageTabType", "withLayout"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},E=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of j(e))!J.call(t,n)&&n!==r&&d(t,n,{get:()=>e[n],enumerable:!(i=W(e,n))||i.enumerable});return t};var K=t=>E(d({},"__esModule",{value:!0}),t);var Q={};U(Q,{ProductContext:()=>a,default:()=>H,useProductContext:()=>q});module.exports=K(Q);var c=require("react/jsx-runtime"),o=require("react");const a=(0,o.createContext)({}),q=()=>{if(!(0,o.useContext)(a))throw new Error("useProductContext must be used in <ProductProvider>");return(0,o.useContext)(a)},z=({product:t,isLogin:e,profile:r,isMobile:i,isDesktop:n,children:u,renderRating:s,freeGift:l,bundle:p,checkedBundle:m,checkedGift:P,setCheckedBundle:b,setCheckedGift:g,variant:f,selectedOptions:y,setSelectedOptions:C,compareData:h,coupon:v,finalPrice:S,comparePrice:R,totalSavings:x,savingDetail:B,setSavingDetail:D,selectedVariants:_,onAddToCart:A,onBuyNow:V,creditsRedemptionAmount:k,memberFunctionResult:M,openModal:w,openSignInPopup:F,openAuthCodePopup:I,renderAffirm:L,renderKlarna:N,renderPaypal:T})=>{const[G,O]=(0,o.useState)({bundle:void 0,gift:void 0});return(0,c.jsx)(a.Provider,{value:{product:t,variant:f,isMobile:i,isDesktop:n,isLogin:e,profile:r,coupon:v,renderRating:s,finalPrice:S,comparePrice:R,savingDetail:B,setSavingDetail:D,totalSavings:x,selectedOptions:y,setSelectedOptions:C,freeGift:l,checkedGift:P,setCheckedGift:g,checkedBundle:m,setCheckedBundle:b,bundle:p,compareData:h,selectedVariants:_,onAddToCart:A,onBuyNow:V,joinedRecommendBuyProducts:G,setJoinedRecommendBuyProducts:O,creditsRedemptionAmount:k,memberFunctionResult:M,openModal:w,openSignInPopup:F,openAuthCodePopup:I,renderAffirm:L,renderKlarna:N,renderPaypal:T},children:u})};var H=z;
|
|
2
|
-
//# sourceMappingURL=ProductProvider.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/biz-components/Listing/ProductProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData } from './types.js'\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n\nexport type SavingDetail = { coupon: number; bundle: number; member: number; freeGift: number; compare: number }\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\n\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n originalPrice: number\n withCouponMemberTotalSave: number\n withoutCouponMaxMemberTotalSave?: number\n labels: {\n key: string\n value: string\n desc: string\n }[]\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n setSavingDetail: Dispatch<SetStateAction<SavingDetail>>\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n // productSummaryStatus: {\n // bundleSummary: boolean\n // giftSummary: boolean\n // }\n joinedRecommendBuyProducts: { bundle?: BundleListItem; gift?: ProductVariant }\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<{ bundle?: BundleListItem; gift?: ProductVariant }>>\n // setProductSummaryStatus?: Dispatch<SetStateAction<{ bundleSummary: boolean; giftSummary: boolean }>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n creditsRedemptionAmount?: number\n memberFunctionResult?: FunctionMemberPriceResult\n openModal: ({ title, content, domContent }: ModalData) => void\n openSignInPopup?: () => void\n openAuthCodePopup?: () => void\n renderAffirm?: React.ReactNode\n renderKlarna?: React.ReactNode\n renderPaypal?: React.ReactNode\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const ProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useProductContext = () => {\n const context = useContext(ProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(ProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n profile,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n setSavingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<{ bundle?: BundleListItem; gift?: ProductVariant }>({\n bundle: undefined,\n gift: undefined,\n })\n return (\n <ProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n profile,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n setSavingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n }}\n >\n {children}\n </ProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,YAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GA8LI,IAAAM,EAAA,6BA9LJC,EAQO,iBAmIA,MAAML,KAAiB,iBAAkC,CAAC,CAAuB,EAE3EE,EAAoB,IAAM,CAErC,GAAI,IADY,cAAWF,CAAc,EAEvC,MAAM,IAAI,MAAM,qDAAqD,EAEvE,SAAO,cAAWA,CAAc,CAClC,EAEMM,EAAkB,CAAC,CACvB,QAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,wBAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,IAAmH,CACjH,KAAM,CAACC,EAA4BC,CAA6B,KAAI,YAA6D,CAC/H,OAAQ,OACR,KAAM,MACR,CAAC,EACD,SACE,OAAC1C,EAAe,SAAf,CACC,MAAO,CACL,QAAAO,EACA,QAAAa,EACA,SAAAV,EACA,UAAAC,EACA,QAAAH,EACA,QAAAC,EACA,OAAAe,EACA,aAAAX,EACA,WAAAY,EACA,aAAAC,EACA,aAAAE,EACA,gBAAAC,EACA,aAAAF,EACA,gBAAAN,EACA,mBAAAC,EACA,SAAAR,EACA,YAAAG,EACA,eAAAE,EACA,cAAAH,EACA,iBAAAE,EACA,OAAAH,EACA,YAAAQ,EACA,iBAAAO,EACA,YAAAC,EACA,SAAAC,EACA,2BAAAS,EACA,8BAAAC,EACA,wBAAAT,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,EAEC,SAAA5B,EACH,CAEJ,EAEA,IAAOX,EAAQK",
|
|
6
|
-
"names": ["ProductProvider_exports", "__export", "ProductContext", "ProductProvider_default", "useProductContext", "__toCommonJS", "import_jsx_runtime", "import_react", "ProductProvider", "product", "isLogin", "profile", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "setSavingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "creditsRedemptionAmount", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "renderAffirm", "renderKlarna", "renderPaypal", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as j}from"react/jsx-runtime";import{createContext as G,useContext as n,useState as O}from"react";const e=G({}),K=()=>{if(!n(e))throw new Error("useProductContext must be used in <ProductProvider>");return n(e)},W=({product:t,isLogin:o,profile:r,isMobile:i,isDesktop:a,children:d,renderRating:c,freeGift:u,bundle:s,checkedBundle:l,checkedGift:p,setCheckedBundle:m,setCheckedGift:P,variant:b,selectedOptions:g,setSelectedOptions:f,compareData:y,coupon:C,finalPrice:h,comparePrice:v,totalSavings:S,savingDetail:R,setSavingDetail:x,selectedVariants:B,onAddToCart:D,onBuyNow:_,creditsRedemptionAmount:A,memberFunctionResult:V,openModal:k,openSignInPopup:M,openAuthCodePopup:w,renderAffirm:F,renderKlarna:I,renderPaypal:L})=>{const[N,T]=O({bundle:void 0,gift:void 0});return j(e.Provider,{value:{product:t,variant:b,isMobile:i,isDesktop:a,isLogin:o,profile:r,coupon:C,renderRating:c,finalPrice:h,comparePrice:v,savingDetail:R,setSavingDetail:x,totalSavings:S,selectedOptions:g,setSelectedOptions:f,freeGift:u,checkedGift:p,setCheckedGift:P,checkedBundle:l,setCheckedBundle:m,bundle:s,compareData:y,selectedVariants:B,onAddToCart:D,onBuyNow:_,joinedRecommendBuyProducts:N,setJoinedRecommendBuyProducts:T,creditsRedemptionAmount:A,memberFunctionResult:V,openModal:k,openSignInPopup:M,openAuthCodePopup:w,renderAffirm:F,renderKlarna:I,renderPaypal:L},children:d})};var q=W;export{e as ProductContext,q as default,K as useProductContext};
|
|
2
|
-
//# sourceMappingURL=ProductProvider.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/biz-components/Listing/ProductProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData } from './types.js'\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n\nexport type SavingDetail = { coupon: number; bundle: number; member: number; freeGift: number; compare: number }\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\n\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n originalPrice: number\n withCouponMemberTotalSave: number\n withoutCouponMaxMemberTotalSave?: number\n labels: {\n key: string\n value: string\n desc: string\n }[]\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n setSavingDetail: Dispatch<SetStateAction<SavingDetail>>\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n // productSummaryStatus: {\n // bundleSummary: boolean\n // giftSummary: boolean\n // }\n joinedRecommendBuyProducts: { bundle?: BundleListItem; gift?: ProductVariant }\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<{ bundle?: BundleListItem; gift?: ProductVariant }>>\n // setProductSummaryStatus?: Dispatch<SetStateAction<{ bundleSummary: boolean; giftSummary: boolean }>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n creditsRedemptionAmount?: number\n memberFunctionResult?: FunctionMemberPriceResult\n openModal: ({ title, content, domContent }: ModalData) => void\n openSignInPopup?: () => void\n openAuthCodePopup?: () => void\n renderAffirm?: React.ReactNode\n renderKlarna?: React.ReactNode\n renderPaypal?: React.ReactNode\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const ProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useProductContext = () => {\n const context = useContext(ProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(ProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n profile,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n setSavingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<{ bundle?: BundleListItem; gift?: ProductVariant }>({\n bundle: undefined,\n gift: undefined,\n })\n return (\n <ProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n profile,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n setSavingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n }}\n >\n {children}\n </ProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
-
"mappings": "AA8LI,cAAAA,MAAA,oBA9LJ,OACE,iBAAAC,EAEA,cAAAC,EAIA,YAAAC,MACK,QAmIA,MAAMC,EAAiBH,EAAkC,CAAC,CAAuB,EAE3EI,EAAoB,IAAM,CAErC,GAAI,CADYH,EAAWE,CAAc,EAEvC,MAAM,IAAI,MAAM,qDAAqD,EAEvE,OAAOF,EAAWE,CAAc,CAClC,EAEME,EAAkB,CAAC,CACvB,QAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,wBAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,IAAmH,CACjH,KAAM,CAACC,EAA4BC,CAA6B,EAAIvC,EAA6D,CAC/H,OAAQ,OACR,KAAM,MACR,CAAC,EACD,OACEH,EAACI,EAAe,SAAf,CACC,MAAO,CACL,QAAAG,EACA,QAAAa,EACA,SAAAV,EACA,UAAAC,EACA,QAAAH,EACA,QAAAC,EACA,OAAAe,EACA,aAAAX,EACA,WAAAY,EACA,aAAAC,EACA,aAAAE,EACA,gBAAAC,EACA,aAAAF,EACA,gBAAAN,EACA,mBAAAC,EACA,SAAAR,EACA,YAAAG,EACA,eAAAE,EACA,cAAAH,EACA,iBAAAE,EACA,OAAAH,EACA,YAAAQ,EACA,iBAAAO,EACA,YAAAC,EACA,SAAAC,EACA,2BAAAS,EACA,8BAAAC,EACA,wBAAAT,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,EAEC,SAAA5B,EACH,CAEJ,EAEA,IAAO+B,EAAQrC",
|
|
6
|
-
"names": ["jsx", "createContext", "useContext", "useState", "ProductContext", "useProductContext", "ProductProvider", "product", "isLogin", "profile", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "setSavingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "creditsRedemptionAmount", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "renderAffirm", "renderKlarna", "renderPaypal", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "ProductProvider_default"]
|
|
7
|
-
}
|