@anker-in/headless-ui 1.0.26-alpha.1762236947129 → 1.0.26-alpha.1762243303200
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/AiuiProvider/index.d.ts +4 -0
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +118 -0
- 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/LearnMore.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.d.ts +10 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.d.ts +25 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +12 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.d.ts +30 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +37 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +40 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +30 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.d.ts +43 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.d.ts +21 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.d.ts +5 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.d.ts +1 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +37 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.d.ts +6 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/types.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.d.ts +4 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.d.ts +10 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/types.d.ts +12 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/index.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/components/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/const.d.ts +29 -0
- package/dist/cjs/biz-components/Listing/const.js +2 -0
- package/dist/cjs/biz-components/Listing/const.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/use-options.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/hooks/use-options.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/use-options.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant-media.d.ts +14 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant-media.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant-media.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant.d.ts +5 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/use-variant.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.d.ts +50 -0
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/useCopy.d.ts +5 -0
- package/dist/cjs/biz-components/Listing/hooks/useCopy.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/useCopy.js.map +7 -0
- package/dist/cjs/biz-components/Listing/index.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/index.js +2 -0
- package/dist/cjs/biz-components/Listing/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/types/graphql.d.ts +7473 -0
- package/dist/cjs/biz-components/Listing/types/graphql.js +2 -0
- package/dist/cjs/biz-components/Listing/types/graphql.js.map +7 -0
- package/dist/cjs/biz-components/Listing/types/product.d.ts +141 -0
- package/dist/cjs/biz-components/Listing/types/product.js +2 -0
- package/dist/cjs/biz-components/Listing/types/product.js.map +7 -0
- package/dist/cjs/biz-components/Listing/types/productMetafields.d.js +2 -0
- package/dist/cjs/biz-components/Listing/types/productMetafields.d.js.map +7 -0
- package/dist/cjs/biz-components/Listing/types/type-helper.d.ts +5 -0
- package/dist/cjs/biz-components/Listing/types/type-helper.js +2 -0
- package/dist/cjs/biz-components/Listing/types/type-helper.js.map +7 -0
- package/dist/cjs/biz-components/Listing/types.d.ts +28 -0
- package/dist/cjs/biz-components/Listing/types.js +2 -0
- package/dist/cjs/biz-components/Listing/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/utils/helper.d.ts +36 -0
- package/dist/cjs/biz-components/Listing/utils/helper.js +2 -0
- package/dist/cjs/biz-components/Listing/utils/helper.js.map +7 -0
- package/dist/cjs/biz-components/Listing/utils/index.d.ts +37 -0
- package/dist/cjs/biz-components/Listing/utils/index.js +2 -0
- package/dist/cjs/biz-components/Listing/utils/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/utils/textFormat.d.ts +73 -0
- package/dist/cjs/biz-components/Listing/utils/textFormat.js +2 -0
- package/dist/cjs/biz-components/Listing/utils/textFormat.js.map +7 -0
- package/dist/cjs/biz-components/TabWithImage/TabWithImage.js +1 -1
- package/dist/cjs/biz-components/TabWithImage/TabWithImage.js.map +2 -2
- package/dist/cjs/biz-components/TabsWithMedia/TabsWithMedia.js.map +2 -2
- package/dist/cjs/biz-components/index.d.ts +17 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/checkbox.d.ts +1 -0
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +3 -3
- package/dist/esm/biz-components/AiuiProvider/index.d.ts +4 -0
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +118 -0
- 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/LearnMore.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.d.ts +10 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.d.ts +25 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +12 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.d.ts +30 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +37 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +40 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +30 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/types.d.ts +43 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/types.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.d.ts +21 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.d.ts +5 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/ShopifyColorOption.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.d.ts +1 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/SpecsModal.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +37 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.d.ts +6 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +3 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/types.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/types.js +1 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.d.ts +4 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.d.ts +10 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js +1 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.d.ts +3 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/types.d.ts +12 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/types.js +1 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/index.d.ts +3 -0
- package/dist/esm/biz-components/Listing/components/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/const.d.ts +29 -0
- package/dist/esm/biz-components/Listing/const.js +2 -0
- package/dist/esm/biz-components/Listing/const.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/use-options.d.ts +3 -0
- package/dist/esm/biz-components/Listing/hooks/use-options.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/use-options.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant-media.d.ts +14 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant-media.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant-media.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant.d.ts +5 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/use-variant.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/useBenefits.d.ts +50 -0
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/useCopy.d.ts +5 -0
- package/dist/esm/biz-components/Listing/hooks/useCopy.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/useCopy.js.map +7 -0
- package/dist/esm/biz-components/Listing/index.d.ts +3 -0
- package/dist/esm/biz-components/Listing/index.js +2 -0
- package/dist/esm/biz-components/Listing/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/types/graphql.d.ts +7473 -0
- package/dist/esm/biz-components/Listing/types/graphql.js +2 -0
- package/dist/esm/biz-components/Listing/types/graphql.js.map +7 -0
- package/dist/esm/biz-components/Listing/types/product.d.ts +141 -0
- package/dist/esm/biz-components/Listing/types/product.js +2 -0
- package/dist/esm/biz-components/Listing/types/product.js.map +7 -0
- package/dist/esm/biz-components/Listing/types/productMetafields.d.js +2 -0
- package/dist/esm/biz-components/Listing/types/productMetafields.d.js.map +7 -0
- package/dist/esm/biz-components/Listing/types/type-helper.d.ts +5 -0
- package/dist/esm/biz-components/Listing/types/type-helper.js +1 -0
- package/dist/esm/biz-components/Listing/types/type-helper.js.map +7 -0
- package/dist/esm/biz-components/Listing/types.d.ts +28 -0
- package/dist/esm/biz-components/Listing/types.js +1 -0
- package/dist/esm/biz-components/Listing/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/utils/helper.d.ts +36 -0
- package/dist/esm/biz-components/Listing/utils/helper.js +2 -0
- package/dist/esm/biz-components/Listing/utils/helper.js.map +7 -0
- package/dist/esm/biz-components/Listing/utils/index.d.ts +37 -0
- package/dist/esm/biz-components/Listing/utils/index.js +2 -0
- package/dist/esm/biz-components/Listing/utils/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/utils/textFormat.d.ts +73 -0
- package/dist/esm/biz-components/Listing/utils/textFormat.js +2 -0
- package/dist/esm/biz-components/Listing/utils/textFormat.js.map +7 -0
- package/dist/esm/biz-components/TabWithImage/TabWithImage.js +1 -1
- package/dist/esm/biz-components/TabWithImage/TabWithImage.js.map +2 -2
- package/dist/esm/biz-components/TabsWithMedia/TabsWithMedia.js.map +2 -2
- package/dist/esm/biz-components/index.d.ts +17 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/dist/esm/components/checkbox.d.ts +1 -0
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.js.map +3 -3
- package/dist/tokens/base.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { CurrencyCode, Image, Media, Product as ShopifyProduct, ProductVariant as ShopifyProductVariant } from './graphql';
|
|
2
|
+
import { DiscountType } from '../const';
|
|
3
|
+
export type ProductPrice = {
|
|
4
|
+
amount: number;
|
|
5
|
+
currencyCode: CurrencyCode;
|
|
6
|
+
};
|
|
7
|
+
export type ProductOption = {
|
|
8
|
+
__typename?: 'MultipleChoiceOption';
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
values: ProductOptionValues[];
|
|
12
|
+
};
|
|
13
|
+
export type ProductOptionValues = {
|
|
14
|
+
label: string;
|
|
15
|
+
hexColors?: string[];
|
|
16
|
+
};
|
|
17
|
+
export type ProductVariant = {
|
|
18
|
+
id: string | number;
|
|
19
|
+
options: ProductOption[];
|
|
20
|
+
sku: string;
|
|
21
|
+
metafields?: Record<string, any>;
|
|
22
|
+
price: ProductPrice;
|
|
23
|
+
product: Product;
|
|
24
|
+
coupons: VariantCoupon[];
|
|
25
|
+
weight?: number;
|
|
26
|
+
payload?: any;
|
|
27
|
+
} & Omit<ShopifyProductVariant, 'options' | 'metafields' | 'price'>;
|
|
28
|
+
export type Product = {
|
|
29
|
+
path?: string;
|
|
30
|
+
images: Image[];
|
|
31
|
+
media: ProductMedia[];
|
|
32
|
+
variants: ProductVariant[];
|
|
33
|
+
price: ProductPrice;
|
|
34
|
+
options: ProductOption[];
|
|
35
|
+
metafields?: {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
slug: string;
|
|
39
|
+
payload?: any;
|
|
40
|
+
} & Omit<ShopifyProduct, 'metafields' | 'images' | 'variants' | 'price' | 'options' | 'media'>;
|
|
41
|
+
export type GetProductBody = {
|
|
42
|
+
handles: string;
|
|
43
|
+
locale?: string;
|
|
44
|
+
};
|
|
45
|
+
export type ProductTypes = {
|
|
46
|
+
product: Product;
|
|
47
|
+
getBody: GetProductBody;
|
|
48
|
+
};
|
|
49
|
+
export type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {
|
|
50
|
+
data: {
|
|
51
|
+
products: Pick<T['product'], 'path'>[];
|
|
52
|
+
};
|
|
53
|
+
variables: {
|
|
54
|
+
first?: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {
|
|
58
|
+
data: {
|
|
59
|
+
products: T['product'][];
|
|
60
|
+
};
|
|
61
|
+
variables: {
|
|
62
|
+
relevance?: 'featured' | 'best_selling' | 'newest';
|
|
63
|
+
ids?: string[];
|
|
64
|
+
first?: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type GetProductOperation<T extends ProductTypes = ProductTypes> = {
|
|
68
|
+
data: {
|
|
69
|
+
product?: T['product'];
|
|
70
|
+
};
|
|
71
|
+
variables: {
|
|
72
|
+
path: string;
|
|
73
|
+
slug?: never;
|
|
74
|
+
} | {
|
|
75
|
+
path?: never;
|
|
76
|
+
slug: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export type Options = Record<string, string>;
|
|
80
|
+
export type ProductMedia = Media & {
|
|
81
|
+
sources?: {
|
|
82
|
+
url: string;
|
|
83
|
+
altText: string;
|
|
84
|
+
}[];
|
|
85
|
+
image?: {
|
|
86
|
+
url: string;
|
|
87
|
+
altText: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export type VariantCoupon = {
|
|
91
|
+
title: string;
|
|
92
|
+
starts_at: string;
|
|
93
|
+
ends_at: string | null;
|
|
94
|
+
variant_shopify_id: number;
|
|
95
|
+
value_type: DiscountType;
|
|
96
|
+
value: string;
|
|
97
|
+
currency: string;
|
|
98
|
+
fixed_value: string;
|
|
99
|
+
value_style: string;
|
|
100
|
+
variant_price4wscode: number;
|
|
101
|
+
discount_type: string;
|
|
102
|
+
amazon_deal: boolean;
|
|
103
|
+
cdi_id: number;
|
|
104
|
+
cdi_updated_at: string;
|
|
105
|
+
};
|
|
106
|
+
export type ScriptDiscount = {
|
|
107
|
+
type: DiscountType;
|
|
108
|
+
excludeSkus: string[];
|
|
109
|
+
discount: number;
|
|
110
|
+
};
|
|
111
|
+
export type FreeGift = {
|
|
112
|
+
title: string;
|
|
113
|
+
note: string;
|
|
114
|
+
soldOutLabel: string;
|
|
115
|
+
freeLabel: string;
|
|
116
|
+
giftList: ProductVariant[];
|
|
117
|
+
count: number;
|
|
118
|
+
showCoupon: boolean;
|
|
119
|
+
[key: string]: any;
|
|
120
|
+
};
|
|
121
|
+
export type BundleListItem = {
|
|
122
|
+
id: string;
|
|
123
|
+
price: number;
|
|
124
|
+
comparePrice: number;
|
|
125
|
+
savings: number;
|
|
126
|
+
variants: {
|
|
127
|
+
price: number;
|
|
128
|
+
quantity: number;
|
|
129
|
+
label: string;
|
|
130
|
+
variant: ProductVariant;
|
|
131
|
+
}[];
|
|
132
|
+
};
|
|
133
|
+
export type Bundle = {
|
|
134
|
+
title: string;
|
|
135
|
+
soldOutLabel: string;
|
|
136
|
+
youSaveText: string;
|
|
137
|
+
showCoupon: boolean;
|
|
138
|
+
bundleList: BundleListItem[];
|
|
139
|
+
showAtListing: boolean;
|
|
140
|
+
[key: string]: any;
|
|
141
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of a(t))!u.call(e,r)&&r!==n&&o(e,r,{get:()=>t[r],enumerable:!(i=s(t,r))||i.enumerable});return e};var d=e=>p(o({},"__esModule",{value:!0}),e);var c={};module.exports=d(c);var y=require("../const");
|
|
2
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/types/product.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n CurrencyCode,\n Image,\n Media,\n Product as ShopifyProduct,\n ProductVariant as ShopifyProductVariant,\n} from './graphql'\nimport { DiscountType } from '../const'\n\nexport type ProductPrice = {\n amount: number\n currencyCode: CurrencyCode\n}\n\nexport type ProductOption = {\n __typename?: 'MultipleChoiceOption'\n id: string\n name: string\n values: ProductOptionValues[]\n}\n\nexport type ProductOptionValues = {\n label: string\n hexColors?: string[]\n}\n\nexport type ProductVariant = {\n id: string | number\n options: ProductOption[]\n sku: string\n metafields?: Record<string, any>\n price: ProductPrice\n product: Product\n coupons: VariantCoupon[]\n weight?: number\n payload?: any\n} & Omit<ShopifyProductVariant, 'options' | 'metafields' | 'price'>\n\nexport type Product = {\n path?: string\n images: Image[]\n media: ProductMedia[]\n variants: ProductVariant[]\n price: ProductPrice\n options: ProductOption[]\n metafields?: { [key: string]: any }\n slug: string\n payload?: any\n} & Omit<ShopifyProduct, 'metafields' | 'images' | 'variants' | 'price' | 'options' | 'media'>\n\nexport type GetProductBody = {\n handles: string\n locale?: string\n}\n\nexport type ProductTypes = {\n product: Product\n getBody: GetProductBody\n}\n\nexport type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: Pick<T['product'], 'path'>[] }\n variables: { first?: number }\n}\n\nexport type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: T['product'][] }\n variables: {\n relevance?: 'featured' | 'best_selling' | 'newest'\n ids?: string[]\n first?: number\n }\n}\n\nexport type GetProductOperation<T extends ProductTypes = ProductTypes> = {\n data: { product?: T['product'] }\n variables: { path: string; slug?: never } | { path?: never; slug: string }\n}\n\nexport type Options = Record<string, string>\n\nexport type ProductMedia = Media & {\n sources?: {\n url: string\n altText: string\n }[]\n image?: {\n url: string\n altText: string\n }\n}\n\nexport type VariantCoupon = {\n title: string\n starts_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n ends_at: string | null // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\u6216 null\n variant_shopify_id: number\n value_type: DiscountType\n value: string // \u8D1F\u6570\u7684\u767E\u5206\u6BD4\u503C\n currency: string\n fixed_value: string // \u56FA\u5B9A\u503C\n value_style: string // \u5E26\u6709\u8D27\u5E01\u7B26\u53F7\u7684\u503C\n variant_price4wscode: number\n discount_type: string // \u5047\u8BBE discount_type \u662F\u4E00\u4E2A\u5B57\u7B26\u4E32\n amazon_deal: boolean\n cdi_id: number\n cdi_updated_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n}\n\nexport type ScriptDiscount = {\n type: DiscountType\n excludeSkus: string[]\n discount: number\n}\n\nexport type FreeGift = {\n title: string\n note: string\n soldOutLabel: string\n freeLabel: string\n giftList: ProductVariant[]\n count: number\n showCoupon: boolean\n [key: string]: any\n}\n\nexport type BundleListItem = {\n id: string\n price: number\n comparePrice: number\n savings: number\n variants: {\n price: number\n quantity: number\n label: string\n variant: ProductVariant\n }[]\n}\n\nexport type Bundle = {\n title: string\n soldOutLabel: string\n youSaveText: string\n showCoupon: boolean\n bundleList: BundleListItem[]\n showAtListing: boolean\n [key: string]: any\n}"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAOA,IAAAE,EAA6B",
|
|
6
|
+
"names": ["product_exports", "__toCommonJS", "import_const"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var u=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of l(e))!a.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(n=o(e,s))||n.enumerable});return t};var p=t=>u(i({},"__esModule",{value:!0}),t);var b={};module.exports=p(b);var g=require("@projectTypes/product");
|
|
2
|
+
//# sourceMappingURL=productMetafields.d.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/types/productMetafields.d.ts"],
|
|
4
|
+
"sourcesContent": ["import { DiscountType } from '@projectTypes/product'\n\n// \u6EE1\u8D60\nexport type VariantFreeGiftMetafields = {\n count: number // \u6700\u591A\u9009\u62E9\u793C\u54C1\u6570\u91CF\uFF0C\u4E70\u4E00\u8D60X\n showDiscounts: boolean\n list: {\n handle: string\n sku: string\n }[]\n labels: string[]\n}\n\n// bundle\nexport type VariantBundleMetafields = {\n list: {\n handle: string\n sku: string\n price: number\n qty: number\n label: string\n }[][]\n title: string\n discount_type: DiscountType\n showDiscounts: boolean\n labels: string[]\n}\n\n// \u6EE1\u51CF\\\u5C0Fb\u6298\u6263 metafields\nexport type VariantPriceDropMetafields = {\n showDiscounts: boolean\n discountType: DiscountType\n rules: {\n value: number\n }[]\n labels: string[]\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAA,IAAAE,EAA6B",
|
|
6
|
+
"names": ["productMetafields_d_exports", "__toCommonJS", "import_product"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var n=(t,e,T,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!K.call(t,r)&&r!==T&&o(t,r,{get:()=>e[r],enumerable:!(i=a(e,r))||i.enumerable});return t};var l=t=>n(o({},"__esModule",{value:!0}),t);var x={};module.exports=l(x);
|
|
2
|
+
//# sourceMappingURL=type-helper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/types/type-helper.ts"],
|
|
4
|
+
"sourcesContent": ["export type PartialRecord<K extends string | number | symbol, T> = Partial<Record<K, T>>\n\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type Replace<T, K extends keyof T, V> = Omit<T, K> & { [P in K]: V }\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["type_helper_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Product } from './types/product';
|
|
2
|
+
export type CompareProductItem = {
|
|
3
|
+
handle: string;
|
|
4
|
+
shortName: string;
|
|
5
|
+
compareProductCollection?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CompareItem = {
|
|
8
|
+
product: Product;
|
|
9
|
+
} & CompareProductItem;
|
|
10
|
+
export type CompareData = {
|
|
11
|
+
data: {
|
|
12
|
+
availableCompareList: Array<CompareItem>;
|
|
13
|
+
currentProductCompareData?: CompareItem;
|
|
14
|
+
options: {
|
|
15
|
+
value: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
specificationKeys?: string[];
|
|
19
|
+
};
|
|
20
|
+
show: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type DiscountData = {
|
|
23
|
+
codeSavings: number;
|
|
24
|
+
scriptSavings: number;
|
|
25
|
+
totalSavings: number;
|
|
26
|
+
comparePrice: number;
|
|
27
|
+
finalPrice: number;
|
|
28
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var c=(e,t,p,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of i(t))!n.call(e,r)&&r!==p&&a(e,r,{get:()=>t[r],enumerable:!(o=m(t,r))||o.enumerable});return e};var s=e=>c(a({},"__esModule",{value:!0}),e);var u={};module.exports=s(u);
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/Listing/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Product } from './types/product'\n\nexport type CompareProductItem = {\n handle: string\n shortName: string\n compareProductCollection?: string\n}\n\nexport type CompareItem = { product: Product } & CompareProductItem\n\nexport type CompareData = {\n data: {\n availableCompareList: Array<CompareItem>\n currentProductCompareData?: CompareItem\n options: { value: string; text: string }[]\n specificationKeys?: string[]\n }\n show: boolean\n}\n\nexport type DiscountData = {\n codeSavings: number\n scriptSavings: number\n totalSavings: number\n comparePrice: number\n finalPrice: number\n}"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Product, ProductMedia, ProductVariant } from '../types/product';
|
|
2
|
+
export type SchemaVariant = {
|
|
3
|
+
variant: {
|
|
4
|
+
handle: string;
|
|
5
|
+
sku: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare function isObjEmpty(obj?: Record<string, any>): boolean;
|
|
9
|
+
export declare function atobID(id: string): string | undefined;
|
|
10
|
+
export declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
|
|
11
|
+
export declare const getThemeLocale: (locale: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* 生成 metafieldIdentifiers 查询参数
|
|
14
|
+
*/
|
|
15
|
+
export declare const getNormalCoupon: ({ variant }: {
|
|
16
|
+
variant?: ProductVariant;
|
|
17
|
+
}) => import("../types/product").VariantCoupon | undefined;
|
|
18
|
+
export declare function replaceUmlaut(str: string): string;
|
|
19
|
+
export declare function handle(str: string): string;
|
|
20
|
+
export declare function getVariantImageIndex({ mediaList, variant, }: {
|
|
21
|
+
variant: ProductVariant;
|
|
22
|
+
mediaList: ProductMedia[];
|
|
23
|
+
}): null | number;
|
|
24
|
+
export declare function getVariantMediaList({ product, variant }: {
|
|
25
|
+
variant: ProductVariant;
|
|
26
|
+
product: Product;
|
|
27
|
+
}): ProductMedia[];
|
|
28
|
+
export declare const checkItemAvailableForProduct: ({ product, item, variant, }: {
|
|
29
|
+
product: Product;
|
|
30
|
+
variant: ProductVariant;
|
|
31
|
+
item?: {
|
|
32
|
+
includeTags?: string[];
|
|
33
|
+
includeProducts?: SchemaVariant[];
|
|
34
|
+
excludeProducts?: SchemaVariant[];
|
|
35
|
+
};
|
|
36
|
+
}) => string | boolean | SchemaVariant | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of l(t))!f.call(e,a)&&a!==r&&u(e,a,{get:()=>t[a],enumerable:!(n=d(t,a))||n.enumerable});return e};var m=e=>p(u({},"__esModule",{value:!0}),e);var I={};g(I,{atobID:()=>P,btoaID:()=>x,checkItemAvailableForProduct:()=>v,getNormalCoupon:()=>V,getThemeLocale:()=>y,getVariantImageIndex:()=>o,getVariantMediaList:()=>k,handle:()=>b,isObjEmpty:()=>h,replaceUmlaut:()=>c});module.exports=m(I);var s=require("../const");function h(e){return e?Object.keys(e).length===0:!0}function P(e){return e&&typeof e=="string"&&e.includes("/")?e.split("/").pop()?.split("?")?.shift():e}function x(e,t="ProductVariant"){return`gid://shopify/${t}/${e}`}const y=e=>e==="eu-de"?"de":e==="eu-en"?"eu":e==="au"?"au":e,V=({variant:e})=>e?.coupons?.find(t=>t.discount_type!==s.CouponChannel.WSCH),i={\u00DC:"U",\u00C4:"A",\u00D6:"O",\u00FC:"u",\u00E4:"a",\u00F6:"o",\u00DF:"ss",\u00E8:"e"};function c(e){return e.replace(/[\u00dc|\u00c4|\u00d6][a-z]/g,t=>{const r=i[t.slice(0,1)];return r.charAt(0)+r.charAt(1).toLowerCase()+t.slice(1)}).replace(new RegExp("["+Object.keys(i).join("|")+"]","g"),t=>i[t])}function b(e){return c(e).replace(/ /g,"-").replace(/[^a-zA-Z0-9-]/g,"").toLowerCase()}function o({mediaList:e,variant:t}){const r=t?.image?.url;return r?e.map(n=>n.image?.url).findIndex(n=>n==r):null}function k({product:e,variant:t}){const r=o({mediaList:e.media,variant:t});if(r!==null){const n=e.variants.filter(a=>t.id!==a.id).map(a=>o({mediaList:e.media,variant:a})).find(a=>a!==null&&a>r)||-1;return e.media.slice(r,n===-1?e.media.length:n)}else return e.media}const v=({product:e,item:t,variant:r})=>t?Number(t?.includeTags?.length)>0?e.tags?.find(n=>t?.includeTags?.includes(n)):Number(t?.includeProducts?.length)>0?t.includeProducts?.find(n=>n?.variant?.handle===e.handle&&n?.variant?.sku===r.sku):Number(t?.excludeProducts?.length)>0?!t.excludeProducts?.find(n=>n?.variant?.handle===e.handle&&n?.variant?.sku===r.sku):!0:!1;
|
|
2
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/utils/helper.ts"],
|
|
4
|
+
"sourcesContent": ["// \u6539\u7EC4\u4EF6\u5BA2\u6237\u7AEF\u6267\u884C\n// import { SchemaVariant } from '@projectTypes/template'\nimport type { Product, ProductMedia, ProductVariant } from '../types/product'\nimport { CouponChannel } from '../const'\n// import Cookies from 'js-cookie'\n// import { Attribute, HasMetafieldsIdentifier } from 'lib/shopify/gql'\n// import { HasMetafieldQueryRoot } from 'lib/shopify/types/fetcher'\n// import { useEffect, useState } from 'react'\n\n// import { PartialRecord } from './type-helper'\n\nexport type SchemaVariant = {\n variant: {\n handle: string\n sku: string\n }\n}\n\n// \u5224\u65AD\u5BF9\u8C61\u662F\u5426\u4E3A\u7A7A\nexport function isObjEmpty(obj?: Record<string, any>) {\n if (!obj) return true\n else {\n return Object.keys(obj).length === 0\n }\n}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n\nexport function btoaID(id: string, type: 'ProductVariant' | 'Product' = 'ProductVariant') {\n return `gid://shopify/${type}/${id}`\n}\n\n// \u76AE\u80A4\u7AD9\u4E09\u7EA7\u57DF\u540D\nexport const getThemeLocale = (locale: string) => {\n if (locale === 'eu-de') return 'de'\n if (locale === 'eu-en') return 'eu'\n if (locale === 'au') return 'au'\n return locale\n}\n\n/**\n * \u751F\u6210 metafieldIdentifiers \u67E5\u8BE2\u53C2\u6570\n */\n// export function constructMetafieldIdentifiersQueryParams<T extends HasMetafieldQueryRoot>(\n// metafieldIdentifiers: PartialRecord<T, HasMetafieldsIdentifier[]> = {},\n// ): PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]> {\n// const identifiers = Object.entries(metafieldIdentifiers).reduce(\n// (queryInput, [key, value]) => {\n// const metafieldIdentifiers = value as HasMetafieldsIdentifier[]\n// queryInput[`${key}MetafieldIdentifiers`] = metafieldIdentifiers\n// .filter((item) => !item.namespace.startsWith(metafieldNamespacePrefix))\n// .map((item) => ({\n// namespace: `${metafieldNamespacePrefix}combo`,\n// key: item.namespace,\n// }))\n// .concat(metafieldIdentifiers)\n// return queryInput\n// },\n// {} as PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]>,\n// )\n// return identifiers\n// }\n\n// export function cleanShopKey(shop: Shop) {\n// const { privacyPolicy, refundPolicy, shippingPolicy, termsOfService, subscriptionPolicy, ...otherShop } = shop\n// return otherShop\n// }\n\n// export const delHtmlTag = (str?: string) => {\n// return str ? String(str).replace(/<[^>]+>/g, '') : ''\n// }\n\nexport const getNormalCoupon = ({ variant }: { variant?: ProductVariant }) => {\n return variant?.coupons?.find(coupon => coupon.discount_type !== CouponChannel.WSCH)\n}\n\n// export const setCartSecretCookie = ({ cart }) => {\n// const key = cart.id.split('?key=')[1]\n// const id = cart.id.split('?key=')[0].split('gid://shopify/Cart/')[1]\n// Cookies.set(id, key, {\n// Domain: window.location.hostname.split('.').reverse().slice(0, 2).reverse().join('.'),\n// })\n// }\n\n// export const languageCode = (locale: string) =>\n// ({\n// us: 'US',\n// uk: 'GB',\n// ca: 'CA',\n// fr: 'FR',\n// au: 'AU',\n// my: 'MY',\n// vn: 'VN',\n// it: 'IT',\n// de: 'DE',\n// cl: 'CL',\n// })[locale] || 'US'\n\n// shopify \u7684\u7279\u6B8A\u6587\u4EF6\u8F6C\u6362\u89C4\u5219\nconst umlautMap = {\n '\\u00dc': 'U',\n '\\u00c4': 'A',\n '\\u00d6': 'O',\n '\\u00fc': 'u',\n '\\u00e4': 'a',\n '\\u00f6': 'o',\n '\\u00df': 'ss',\n '\\u00E8': 'e',\n}\n\n// \u66FF\u6362\u5B57\u7B26\u4E32\u4E2D\u7684\u7279\u6B8A\u5B57\u7B26\nexport function replaceUmlaut(str: string) {\n return str\n .replace(/[\\u00dc|\\u00c4|\\u00d6][a-z]/g, a => {\n const big = umlautMap[a.slice(0, 1) as keyof typeof umlautMap]\n return big.charAt(0) + big.charAt(1).toLowerCase() + a.slice(1)\n })\n .replace(new RegExp('[' + Object.keys(umlautMap).join('|') + ']', 'g'), a => umlautMap[a as keyof typeof umlautMap])\n}\n\n// \u5C06\u5B57\u7B26\u4E32\u8F6C\u6362\u4E3A slug\nexport function handle(str: string) {\n return replaceUmlaut(str)\n .replace(/ /g, '-')\n .replace(/[^a-zA-Z0-9-]/g, '')\n .toLowerCase()\n}\n\n// get variant image index\nexport function getVariantImageIndex({\n mediaList,\n variant,\n}: {\n variant: ProductVariant\n mediaList: ProductMedia[]\n}): null | number {\n const src = variant?.image?.url\n return src ? mediaList.map(media => media.image?.url).findIndex(imageSrc => imageSrc == src) : null\n}\n\n// get images belong to variant\nexport function getVariantMediaList({ product, variant }: { variant: ProductVariant; product: Product }) {\n const currentVariantImageIndex = getVariantImageIndex({ mediaList: product.media, variant })\n\n if (currentVariantImageIndex !== null) {\n const nextVariantImageIndex =\n product.variants\n .filter(v => variant.id !== v.id)\n .map(v => getVariantImageIndex({ mediaList: product.media, variant: v }))\n .find(index => index !== null && index > currentVariantImageIndex) || -1\n\n // current variant images, if no next variant found, return images from current index to the end\n return product.media.slice(\n currentVariantImageIndex,\n nextVariantImageIndex === -1 ? product.media.length : nextVariantImageIndex\n )\n } else {\n // if no variant image found, return all images\n return product.media\n }\n}\n\n// // \u901A\u8FC7\u9009\u62E9 option \u83B7\u53D6 variant\n// export function getVariantFromSelectedOptions({\n// product,\n// selectedOptions,\n// }: {\n// product: Product\n// selectedOptions: Record<string, string>\n// }) {\n// return product.variants.find((variant) => {\n// return Object.entries(selectedOptions).every(([key, value]) =>\n// variant.options.find((option) => {\n// if (option.__typename === 'MultipleChoiceOption' && option.name === key) {\n// return option.values.find((v) => v.label === value)\n// }\n// }),\n// )\n// })\n// }\n\n// export const getURLParameter = (name, url = window.location.href) => {\n// name = name.replace(/[\\[\\]]/g, '\\\\$&') // \u5C06\u65B9\u62EC\u53F7\u8F6C\u4E49\uFF0C\u4EE5\u4FBF\u5728\u6B63\u5219\u8868\u8FBE\u5F0F\u4E2D\u4F7F\u7528\n// var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)') // \u521B\u5EFA\u5339\u914D\u53C2\u6570\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\n// var results = regex.exec(url) // \u5728URL\u4E2D\u67E5\u627E\u5339\u914D\u7684\u53C2\u6570\n// if (!results) return null // \u5982\u679C\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u53C2\u6570\uFF0C\u5219\u8FD4\u56DEnull\n// if (!results[2]) return '' // \u5982\u679C\u53C2\u6570\u7684\u503C\u4E3A\u7A7A\uFF0C\u5219\u8FD4\u56DE\u7A7A\u5B57\u7B26\u4E32\n// return decodeURIComponent(results[2]) // \u8FD4\u56DE\u89E3\u7801\u540E\u7684\u53C2\u6570\u503C\n// }\n\nexport const checkItemAvailableForProduct = ({\n product,\n item,\n variant,\n}: {\n product: Product\n variant: ProductVariant\n item?: {\n includeTags?: string[]\n includeProducts?: SchemaVariant[]\n excludeProducts?: SchemaVariant[]\n }\n}) => {\n if (item) {\n if (Number(item?.includeTags?.length) > 0) {\n return product.tags?.find((tag) => item?.includeTags?.includes(tag))\n } else if (Number(item?.includeProducts?.length) > 0) {\n return item.includeProducts?.find((p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku)\n } else if (Number(item?.excludeProducts?.length) > 0) {\n return !item.excludeProducts?.find(\n (p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku,\n )\n } else {\n return true\n }\n } else {\n return false\n }\n}\n// export const getReferralAttributes = () => {\n// const inviteCode = Cookies.get('invite_code')\n// const playModeId = Cookies.get('playModeId')\n// const popup = Cookies.get('_popup')\n// if (inviteCode && playModeId) {\n// return popup\n// ? [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// { key: '_popup', value: popup },\n// ]\n// : [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// ]\n// }\n// return []\n// }\n\n// export function useH2Toc(htmlContent: string) {\n// const [toc, setToc] = useState<{ updatedHtmlContent: string; dataList: { url: string; text: string }[] }>({\n// updatedHtmlContent: htmlContent,\n// dataList: [],\n// })\n\n// useEffect(() => {\n// if (typeof window === 'undefined' || typeof document === 'undefined') return\n// const div = document.createElement('div')\n// div.innerHTML = htmlContent\n// const h2s = div.querySelectorAll('h2')\n// const dataList: { url: string; text: string }[] = []\n// h2s.forEach((h2, idx) => {\n// const text = (h2.textContent || '').trim()\n// if (!text) return\n// const id = encodeURIComponent(text).replace(/'/g, ''')\n// h2.setAttribute('id', id)\n// dataList.push({ url: id, text })\n// })\n// setToc({ updatedHtmlContent: div.innerHTML, dataList })\n// }, [htmlContent])\n\n// return toc\n// }\n\n// export const isAttributesEqual = (oldAttributes: Attribute[], newAttributes: Attribute[]) => {\n// // \u6BD4\u5BF9\u4E24\u4E2A\u6570\u636E\u662F\u5426\u5B8C\u5168\u76F8\u540C\n// // \u68C0\u67E5\u6570\u7EC4\u957F\u5EA6\u662F\u5426\u76F8\u540C\n// if (oldAttributes?.length !== newAttributes?.length) {\n// return false\n// }\n\n// // \u5C06\u6570\u7EC4\u8F6C\u6362\u4E3A Map \u4EE5\u4FBF\u5FEB\u901F\u67E5\u627E\n// const oldMap = new Map(oldAttributes.map((attr) => [attr.key, attr.value]))\n// const newMap = new Map(newAttributes.map((attr) => [attr.key, attr.value]))\n\n// // \u68C0\u67E5\u6240\u6709 key \u662F\u5426\u90FD\u5B58\u5728\u4E14\u503C\u76F8\u540C\n// for (const [key, value] of newMap) {\n// if (!oldMap.has(key) || oldMap.get(key) !== value) {\n// return false\n// }\n// }\n\n// return true\n// }\n\n// // \u68C0\u67E5\u8F93\u5165\u6846\u4E2D\u7684\u7279\u6B8A\u7B26\u53F7\n// export function validateSpecialCharacters(input: string): { isValid: boolean; invalidChars: string[] } {\n// // \u5B9A\u4E49\u4E0D\u5141\u8BB8\u7684\u7279\u6B8A\u7B26\u53F7\n// const invalidSpecialChars = /[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?`~]/g\n\n// const matches = input.match(invalidSpecialChars)\n// const invalidChars = matches ? [...new Set(matches)] : []\n\n// return {\n// isValid: invalidChars.length === 0,\n// invalidChars,\n// }\n// }\n\n// // \u83B7\u53D6\u7279\u6B8A\u7B26\u53F7\u7684\u9519\u8BEF\u63D0\u793A\u4FE1\u606F\n// export function getSpecialCharErrorMessage(invalidChars: string[]): string {\n// if (invalidChars.length === 0) return ''\n\n// const uniqueChars = [...new Set(invalidChars)]\n// if (uniqueChars.length === 1) {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u7279\u6B8A\u7B26\u53F7: ${uniqueChars[0]}`\n// } else {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u4EE5\u4E0B\u7279\u6B8A\u7B26\u53F7: ${uniqueChars.join(', ')}`\n// }\n// }"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["helper_exports", "__export", "atobID", "btoaID", "checkItemAvailableForProduct", "getNormalCoupon", "getThemeLocale", "getVariantImageIndex", "getVariantMediaList", "handle", "isObjEmpty", "replaceUmlaut", "__toCommonJS", "import_const", "obj", "id", "type", "locale", "variant", "coupon", "umlautMap", "str", "a", "big", "mediaList", "src", "media", "imageSrc", "product", "currentVariantImageIndex", "nextVariantImageIndex", "v", "index", "item", "tag", "p"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Options, Product, ProductOption, ProductVariant } from '../types/product';
|
|
2
|
+
export declare function optionsConstructor(options: ProductOption[]): Options;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the first available variant of a product.
|
|
5
|
+
* If no variant is available, it returns the first variant in the list.
|
|
6
|
+
*
|
|
7
|
+
* @param product - The product object.
|
|
8
|
+
* @returns The first available variant of the product.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getFirstAvailableVariant: (product: Product) => ProductVariant;
|
|
11
|
+
export declare const getVariantBySku: (product: Product, sku: string) => ProductVariant | undefined;
|
|
12
|
+
export declare const languageTerritory: (locale: string) => string;
|
|
13
|
+
export declare function formatPrice({ amount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
14
|
+
amount: number;
|
|
15
|
+
currencyCode: string;
|
|
16
|
+
locale: string;
|
|
17
|
+
maximumFractionDigits?: number;
|
|
18
|
+
minimumFractionDigits?: number;
|
|
19
|
+
removeTrailingZeros?: boolean;
|
|
20
|
+
}): string;
|
|
21
|
+
export declare function formatVariantPrice({ amount, baseAmount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
22
|
+
baseAmount: number;
|
|
23
|
+
amount: number;
|
|
24
|
+
currencyCode: string;
|
|
25
|
+
locale: string;
|
|
26
|
+
maximumFractionDigits?: number;
|
|
27
|
+
minimumFractionDigits?: number;
|
|
28
|
+
removeTrailingZeros?: boolean;
|
|
29
|
+
}): {
|
|
30
|
+
price: string;
|
|
31
|
+
basePrice: string | undefined;
|
|
32
|
+
discount: string | null;
|
|
33
|
+
};
|
|
34
|
+
export declare function getVariantFromSelectedOptions({ product, selectedOptions, }: {
|
|
35
|
+
product: Product;
|
|
36
|
+
selectedOptions: Record<string, string>;
|
|
37
|
+
}): ProductVariant | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var v=(r,e)=>{for(var n in e)c(r,n,{get:e[n],enumerable:!0})},O=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of b(e))!P.call(r,i)&&i!==n&&c(r,i,{get:()=>e[i],enumerable:!(t=y(e,i))||t.enumerable});return r};var C=r=>O(c({},"__esModule",{value:!0}),r);var $={};v($,{formatPrice:()=>d,formatVariantPrice:()=>x,getFirstAvailableVariant:()=>S,getVariantBySku:()=>k,getVariantFromSelectedOptions:()=>V,languageTerritory:()=>f,optionsConstructor:()=>F});module.exports=C($);var u=require("../const");function F(r){return r.reduce((e,n)=>(e[n.name]=n.values[0].label,e),{})}const S=r=>r.variants.find(e=>e.availableForSale)||r.variants[0],k=(r,e)=>r.variants.find(n=>n.sku===e),f=r=>({us:"en-us",uk:"en-gb",ca:"en-ca",au:"en-au",eu:"en-eu",pl:"pl-pl",fr:"fr-fr",de:"de-de",vn:"vi-vn",sg:"en-sg","ae-en":"en-ae",plus:"en-us",cl:"es-cl",es:"es-es",se:"en-se",dk:"en-dk",is:"en-is",no:"en-no",fi:"en-fi"})[r]||"";function d({amount:r,currencyCode:e,locale:n,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:a=!1}){let o=new Intl.NumberFormat(f(n),{style:"currency",currency:e||"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t}).format(r);return["eu-de","eu-en","de","eu"].includes(n)&&(o=o?.toString()?.replace(/[\s]/g,"")),a&&(o=o.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),o}function x({amount:r,baseAmount:e,currencyCode:n,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:s}){if(typeof Intl>"u")return{price:`${u.PRICE_SYMBOL[t]}${r}`,basePrice:`${u.PRICE_SYMBOL[t]}${e}`,discount:`${u.PRICE_SYMBOL[t]}${e-r||0}`};const o=e>r,p=new Intl.NumberFormat(f(t),{style:"percent"}),m=o?p.format((e-r)/e):null,l=d({amount:r,currencyCode:n,locale:t,removeTrailingZeros:s}),g=o?d({amount:e,currencyCode:n,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:s}):void 0;return{price:l,basePrice:g,discount:m}}function V({product:r,selectedOptions:e}){return r.variants.find(n=>Object.entries(e).every(([t,i])=>n.options.find(a=>{if(a.__typename==="MultipleChoiceOption"&&a.name===t)return a.values.find(s=>s.label===i)})))}
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/utils/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { PRICE_SYMBOL } from '../const'\nimport type { Options, Product, ProductOption, ProductVariant } from '../types/product'\n\nexport function optionsConstructor(options: ProductOption[]): Options {\n return options.reduce((pre: any, cur: any) => {\n pre[cur.name] = cur.values[0].label\n return pre\n }, {})\n}\n\n/**\n * Returns the first available variant of a product.\n * If no variant is available, it returns the first variant in the list.\n *\n * @param product - The product object.\n * @returns The first available variant of the product.\n */\nexport const getFirstAvailableVariant = (product: Product) =>\n product.variants.find((variant: ProductVariant) => variant.availableForSale) || product.variants[0]\n\nexport const getVariantBySku = (product: Product, sku: string) =>\n product.variants.find((variant: ProductVariant) => variant.sku === sku)\n\nexport const languageTerritory = (locale: string) =>\n // https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_territory_information.html\n ({\n us: 'en-us',\n uk: 'en-gb',\n ca: 'en-ca',\n au: 'en-au',\n eu: 'en-eu',\n pl: 'pl-pl',\n fr: 'fr-fr',\n de: 'de-de',\n vn: 'vi-vn',\n sg: 'en-sg',\n 'ae-en': 'en-ae',\n plus: 'en-us',\n cl: 'es-cl',\n es: 'es-es',\n // Nordic countries\n se: 'en-se',\n dk: 'en-dk',\n is: 'en-is',\n no: 'en-no',\n fi: 'en-fi',\n })[locale] || ''\n\nexport function formatPrice({\n amount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros = false,\n}: {\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n const formatCurrency = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'currency',\n currency: currencyCode || 'USD',\n minimumFractionDigits: maximumFractionDigits === 0 ? 0 : minimumFractionDigits,\n maximumFractionDigits,\n })\n\n let formattedValue = formatCurrency.format(amount)\n\n if (['eu-de', 'eu-en', 'de', 'eu'].includes(locale)) {\n formattedValue = formattedValue?.toString()?.replace(/[\\s]/g, '')\n }\n\n if (removeTrailingZeros) {\n // Adjust the regex to match comma as decimal separator\n formattedValue = formattedValue\n .replace(/(\\.\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\.0+\\b/, '')\n .replace(/(\\,\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\,0+\\b/, '')\n }\n\n return formattedValue\n}\n\nexport function formatVariantPrice({\n amount,\n baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n}: {\n baseAmount: number\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n if (typeof Intl === 'undefined') {\n return {\n price: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${amount}`,\n basePrice: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount}`,\n discount: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount - amount || 0}`,\n }\n }\n\n const hasDiscount = baseAmount > amount\n const formatDiscount = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'percent',\n })\n const discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null\n\n const price = formatPrice({ amount, currencyCode, locale, removeTrailingZeros })\n const basePrice = hasDiscount\n ? formatPrice({\n amount: baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n })\n : undefined\n\n return { price, basePrice, discount }\n}\n\nexport function getVariantFromSelectedOptions({\n product,\n selectedOptions,\n}: {\n product: Product\n selectedOptions: Record<string, string>\n}) {\n return product.variants.find(variant => {\n return Object.entries(selectedOptions).every(([key, value]) =>\n variant.options.find(option => {\n if (option.__typename === 'MultipleChoiceOption' && option.name === key) {\n return option.values.find(v => v.label === value)\n }\n })\n )\n })\n}"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["utils_exports", "__export", "formatPrice", "formatVariantPrice", "getFirstAvailableVariant", "getVariantBySku", "getVariantFromSelectedOptions", "languageTerritory", "optionsConstructor", "__toCommonJS", "import_const", "options", "pre", "cur", "product", "variant", "sku", "locale", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice", "selectedOptions", "key", "value", "option", "v"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 字符串模板替换工具函数
|
|
3
|
+
* 使用单次遍历和正则表达式缓存来提高性能
|
|
4
|
+
*/
|
|
5
|
+
type ReplacementMap = Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* 字符串模板替换函数
|
|
8
|
+
* @param template 模板字符串,如 "Hello {name}, you have {count} messages"
|
|
9
|
+
* @param replacements 替换对象,如 { name: "John", count: "5" }
|
|
10
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
11
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
12
|
+
* @returns 替换后的字符串
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* replaceTemplate("Hello {name}!", { name: "World" })
|
|
17
|
+
* // => "Hello World!"
|
|
18
|
+
*
|
|
19
|
+
* replaceTemplate("Price: {{amount}}", { amount: "$100" }, "{{", "}}")
|
|
20
|
+
* // => "Price: $100"
|
|
21
|
+
*
|
|
22
|
+
* replaceTemplate("You have {count} items", { count: "5", unused: "test" })
|
|
23
|
+
* // => "You have 5 items" (unused 键会被忽略)
|
|
24
|
+
*
|
|
25
|
+
* replaceTemplate("Hello ${name}!", { name: "World" }, "${", "}")
|
|
26
|
+
* // => "Hello World!"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function replaceTemplate(template: string, replacements: ReplacementMap, beginSeg?: string, endSeg?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* 批量字符串模板替换函数(用于一次性替换多个模板)
|
|
32
|
+
* @param templates 模板字符串数组
|
|
33
|
+
* @param replacements 替换对象
|
|
34
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
35
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
36
|
+
* @returns 替换后的字符串数组
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* replaceTemplates(
|
|
41
|
+
* ["Hello {name}!", "You have {count} items"],
|
|
42
|
+
* { name: "John", count: "5" }
|
|
43
|
+
* )
|
|
44
|
+
* // => ["Hello John!", "You have 5 items"]
|
|
45
|
+
*
|
|
46
|
+
* replaceTemplates(
|
|
47
|
+
* ["Hello {{name}}!", "Price: {{amount}}"],
|
|
48
|
+
* { name: "John", amount: "$100" },
|
|
49
|
+
* "{{",
|
|
50
|
+
* "}}"
|
|
51
|
+
* )
|
|
52
|
+
* // => ["Hello John!", "Price: $100"]
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function replaceTemplates(templates: string[], replacements: ReplacementMap, beginSeg?: string, endSeg?: string): string[];
|
|
56
|
+
/**
|
|
57
|
+
* 从模板字符串中提取所有占位符键名
|
|
58
|
+
* @param template 模板字符串
|
|
59
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
60
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
61
|
+
* @returns 占位符键名数组(去重)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* extractPlaceholders("Hello {name}, you have {count} new {count} messages")
|
|
66
|
+
* // => ["name", "count"]
|
|
67
|
+
*
|
|
68
|
+
* extractPlaceholders("Hello {{name}}, price is {{amount}}", "{{", "}}")
|
|
69
|
+
* // => ["name", "amount"]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractPlaceholders(template: string, beginSeg?: string, endSeg?: string): string[];
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var R=(e,n)=>{for(var r in n)i(e,r,{get:n[r],enumerable:!0})},d=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of f(n))!l.call(e,t)&&t!==r&&i(e,t,{get:()=>n[t],enumerable:!(s=x(n,t))||s.enumerable});return e};var h=e=>d(i({},"__esModule",{value:!0}),e);var y={};R(y,{extractPlaceholders:()=>$,replaceTemplate:()=>u,replaceTemplates:()=>E});module.exports=h(y);const c=new Map;function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e,n){const r=`${e}|${n}`;if(c.has(r))return c.get(r);const s=o(e),t=o(n),g=new RegExp(`${s}([a-zA-Z0-9_-]+)${t}`,"g");return c.set(r,g),g}function u(e,n,r="{",s="}"){if(!e||!n||Object.keys(n).length===0)return e;const t=p(r,s);return e.replace(t,(g,a)=>n[a]!==void 0?n[a]:g)}function E(e,n,r="{",s="}"){return e.map(t=>u(t,n,r,s))}function $(e,n="{",r="}"){if(!e)return[];const s=p(n,r),t=new Set;let g;for(;(g=s.exec(e))!==null;)t.add(g[1]);return Array.from(t)}
|
|
2
|
+
//# sourceMappingURL=textFormat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/utils/textFormat.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u5DE5\u5177\u51FD\u6570\n * \u4F7F\u7528\u5355\u6B21\u904D\u5386\u548C\u6B63\u5219\u8868\u8FBE\u5F0F\u7F13\u5B58\u6765\u63D0\u9AD8\u6027\u80FD\n */\n\ntype ReplacementMap = Record<string, string>\n\n// \u7F13\u5B58\u6B63\u5219\u8868\u8FBE\u5F0F\u4EE5\u63D0\u9AD8\u6027\u80FD\nconst regexCache = new Map<string, RegExp>()\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nfunction escapeRegExp(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u83B7\u53D6\u6216\u521B\u5EFA\u6B63\u5219\u8868\u8FBE\u5F0F\uFF08\u5E26\u7F13\u5B58\uFF09\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u5982 \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u5982 \"}\"\n * @returns \u7F16\u8BD1\u540E\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\n */\nfunction getRegex(beginSeg: string, endSeg: string): RegExp {\n const cacheKey = `${beginSeg}|${endSeg}`\n\n if (regexCache.has(cacheKey)) {\n return regexCache.get(cacheKey)!\n }\n\n // \u8F6C\u4E49\u7279\u6B8A\u5B57\u7B26\uFF0C\u6784\u5EFA\u6B63\u5219\u8868\u8FBE\u5F0F\n // \u5339\u914D beginSeg + key + endSeg\uFF0Ckey \u53EF\u4EE5\u662F\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u8FDE\u5B57\u7B26\n const escapedBegin = escapeRegExp(beginSeg)\n const escapedEnd = escapeRegExp(endSeg)\n const regex = new RegExp(`${escapedBegin}([a-zA-Z0-9_-]+)${escapedEnd}`, 'g')\n\n regexCache.set(cacheKey, regex)\n return regex\n}\n\n/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u51FD\u6570\n * @param template \u6A21\u677F\u5B57\u7B26\u4E32\uFF0C\u5982 \"Hello {name}, you have {count} messages\"\n * @param replacements \u66FF\u6362\u5BF9\u8C61\uFF0C\u5982 { name: \"John\", count: \"5\" }\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\n *\n * @example\n * ```ts\n * replaceTemplate(\"Hello {name}!\", { name: \"World\" })\n * // => \"Hello World!\"\n *\n * replaceTemplate(\"Price: {{amount}}\", { amount: \"$100\" }, \"{{\", \"}}\")\n * // => \"Price: $100\"\n *\n * replaceTemplate(\"You have {count} items\", { count: \"5\", unused: \"test\" })\n * // => \"You have 5 items\" (unused \u952E\u4F1A\u88AB\u5FFD\u7565)\n *\n * replaceTemplate(\"Hello ${name}!\", { name: \"World\" }, \"${\", \"}\")\n * // => \"Hello World!\"\n * ```\n */\nexport function replaceTemplate(\n template: string,\n replacements: ReplacementMap,\n beginSeg: string = '{',\n endSeg: string = '}',\n): string {\n if (!template) return template\n if (!replacements || Object.keys(replacements).length === 0) return template\n\n const regex = getRegex(beginSeg, endSeg)\n\n // \u4F7F\u7528 replace \u65B9\u6CD5\u8FDB\u884C\u66FF\u6362\uFF0C\u6027\u80FD\u4F18\u4E8E\u624B\u52A8\u904D\u5386\n return template.replace(regex, (match, key) => {\n // \u5982\u679C key \u5B58\u5728\u4E8E replacements \u4E2D\uFF0C\u5219\u8FD4\u56DE\u5BF9\u5E94\u7684\u503C\n // \u5426\u5219\u4FDD\u6301\u539F\u6837\uFF08\u8FD4\u56DE\u6574\u4E2A\u5339\u914D\u5185\u5BB9\uFF09\n return replacements[key] !== undefined ? replacements[key] : match\n })\n}\n\n/**\n * \u6279\u91CF\u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u51FD\u6570\uFF08\u7528\u4E8E\u4E00\u6B21\u6027\u66FF\u6362\u591A\u4E2A\u6A21\u677F\uFF09\n * @param templates \u6A21\u677F\u5B57\u7B26\u4E32\u6570\u7EC4\n * @param replacements \u66FF\u6362\u5BF9\u8C61\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\u6570\u7EC4\n *\n * @example\n * ```ts\n * replaceTemplates(\n * [\"Hello {name}!\", \"You have {count} items\"],\n * { name: \"John\", count: \"5\" }\n * )\n * // => [\"Hello John!\", \"You have 5 items\"]\n *\n * replaceTemplates(\n * [\"Hello {{name}}!\", \"Price: {{amount}}\"],\n * { name: \"John\", amount: \"$100\" },\n * \"{{\",\n * \"}}\"\n * )\n * // => [\"Hello John!\", \"Price: $100\"]\n * ```\n */\nexport function replaceTemplates(\n templates: string[],\n replacements: ReplacementMap,\n beginSeg: string = '{',\n endSeg: string = '}',\n): string[] {\n return templates.map((template) => replaceTemplate(template, replacements, beginSeg, endSeg))\n}\n\n/**\n * \u4ECE\u6A21\u677F\u5B57\u7B26\u4E32\u4E2D\u63D0\u53D6\u6240\u6709\u5360\u4F4D\u7B26\u952E\u540D\n * @param template \u6A21\u677F\u5B57\u7B26\u4E32\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u5360\u4F4D\u7B26\u952E\u540D\u6570\u7EC4\uFF08\u53BB\u91CD\uFF09\n *\n * @example\n * ```ts\n * extractPlaceholders(\"Hello {name}, you have {count} new {count} messages\")\n * // => [\"name\", \"count\"]\n *\n * extractPlaceholders(\"Hello {{name}}, price is {{amount}}\", \"{{\", \"}}\")\n * // => [\"name\", \"amount\"]\n * ```\n */\nexport function extractPlaceholders(template: string, beginSeg: string = '{', endSeg: string = '}'): string[] {\n if (!template) return []\n\n const regex = getRegex(beginSeg, endSeg)\n const keys = new Set<string>()\n let match: RegExpExecArray | null\n\n // \u4F7F\u7528 exec \u5FAA\u73AF\u66FF\u4EE3 matchAll \u4EE5\u4FDD\u8BC1\u517C\u5BB9\u6027\n while ((match = regex.exec(template)) !== null) {\n keys.add(match[1])\n }\n\n return Array.from(keys)\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,oBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAL,GAQA,MAAMM,EAAa,IAAI,IAOvB,SAASC,EAAaC,EAAqB,CACzC,OAAOA,EAAI,QAAQ,sBAAuB,MAAM,CAClD,CAQA,SAASC,EAASC,EAAkBC,EAAwB,CAC1D,MAAMC,EAAW,GAAGF,CAAQ,IAAIC,CAAM,GAEtC,GAAIL,EAAW,IAAIM,CAAQ,EACzB,OAAON,EAAW,IAAIM,CAAQ,EAKhC,MAAMC,EAAeN,EAAaG,CAAQ,EACpCI,EAAaP,EAAaI,CAAM,EAChCI,EAAQ,IAAI,OAAO,GAAGF,CAAY,mBAAmBC,CAAU,GAAI,GAAG,EAE5E,OAAAR,EAAW,IAAIM,EAAUG,CAAK,EACvBA,CACT,CAyBO,SAASZ,EACda,EACAC,EACAP,EAAmB,IACnBC,EAAiB,IACT,CAER,GADI,CAACK,GACD,CAACC,GAAgB,OAAO,KAAKA,CAAY,EAAE,SAAW,EAAG,OAAOD,EAEpE,MAAMD,EAAQN,EAASC,EAAUC,CAAM,EAGvC,OAAOK,EAAS,QAAQD,EAAO,CAACG,EAAOC,IAG9BF,EAAaE,CAAG,IAAM,OAAYF,EAAaE,CAAG,EAAID,CAC9D,CACH,CA2BO,SAASd,EACdgB,EACAH,EACAP,EAAmB,IACnBC,EAAiB,IACP,CACV,OAAOS,EAAU,IAAKJ,GAAab,EAAgBa,EAAUC,EAAcP,EAAUC,CAAM,CAAC,CAC9F,CAkBO,SAAST,EAAoBc,EAAkBN,EAAmB,IAAKC,EAAiB,IAAe,CAC5G,GAAI,CAACK,EAAU,MAAO,CAAC,EAEvB,MAAMD,EAAQN,EAASC,EAAUC,CAAM,EACjCU,EAAO,IAAI,IACjB,IAAIH,EAGJ,MAAQA,EAAQH,EAAM,KAAKC,CAAQ,KAAO,MACxCK,EAAK,IAAIH,EAAM,CAAC,CAAC,EAGnB,OAAO,MAAM,KAAKG,CAAI,CACxB",
|
|
6
|
+
"names": ["textFormat_exports", "__export", "extractPlaceholders", "replaceTemplate", "replaceTemplates", "__toCommonJS", "regexCache", "escapeRegExp", "str", "getRegex", "beginSeg", "endSeg", "cacheKey", "escapedBegin", "escapedEnd", "regex", "template", "replacements", "match", "key", "templates", "keys"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var E=Object.create;var d=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var P=(e,a)=>{for(var
|
|
1
|
+
"use strict";"use client";var E=Object.create;var d=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var P=(e,a)=>{for(var o in a)d(e,o,{get:a[o],enumerable:!0})},y=(e,a,o,c)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of L(a))!W.call(e,p)&&p!==o&&d(e,p,{get:()=>a[p],enumerable:!(c=H(a,p))||c.enumerable});return e};var R=(e,a,o)=>(o=e!=null?E(M(e)):{},y(a||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),z=e=>y(d({},"__esModule",{value:!0}),e);var j={};P(j,{default:()=>$});module.exports=z(j);var t=require("react/jsx-runtime"),i=R(require("react")),n=require("../../components/index.js"),b=require("../../helpers/utils.js"),T=require("../../shared/Styles.js"),I=require("../../hooks/useExposure.js"),f=require("framer-motion");const A="image",S="tab_with_image",w=i.default.forwardRef(({data:e,className:a},o)=>{const{title:c,subtitle:p,desc:v,image:C,mobileImage:_,datalist:s=[]}=e,u=(0,i.useRef)(null);(0,I.useExposure)(u,{componentType:A,componentName:S,componentTitle:c,componentDescription:v}),(0,i.useImperativeHandle)(o,()=>u.current);const N=(r,m)=>{k(r),m.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[l,k]=(0,i.useState)(0),h=(0,i.useRef)([]),[g,D]=(0,i.useState)({left:0,width:0});return(0,i.useEffect)(()=>{const r=h.current[l];if(r){const{offsetLeft:m,offsetWidth:x}=r;D({left:m,width:x})}},[l,s.length]),(0,t.jsxs)("section",{ref:u,"data-ui-component-id":"TabWithImage",className:(0,b.cn)("flex text-[#fff] l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]",a),children:[(0,t.jsxs)("div",{className:"inline-flex flex-col justify-center min-md:gap-[24px] laptop:basis-[36%]",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Heading,{as:"h3",size:4,html:c}),(0,t.jsx)(n.Text,{as:"p",size:1,html:v,className:"mt-[4px] text-[14px] tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]"})]}),(0,t.jsx)("div",{className:"relative md:overflow-hidden md:overflow-x-scroll md:scrollbar-hidden",children:(0,t.jsxs)("div",{className:"relative inline-flex rounded-[24px] bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[(0,t.jsx)("div",{className:"absolute bottom-0 top-0 rounded-[24px] bg-white transition-all duration-300 ease-in-out",style:{left:g.left,width:g.width}}),s.map((r,m)=>(0,t.jsx)("div",{ref:x=>{h.current[m]=x},onClick:x=>N(m,x),className:(0,b.cn)("relative z-10 cursor-pointer rounded-[24px] px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px] min-xxl:px-[28px] min-xxl:py-[15px]",l===m?"text-black":"text-white"),children:(0,t.jsx)(n.Heading,{as:"h1",size:1,html:r?.title,className:"text-balance-normal !whitespace-nowrap md:text-[14px]"})},m))]})})]}),(0,t.jsx)("div",{className:" relative w-full flex-shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]",children:(0,t.jsx)(f.AnimatePresence,{mode:"wait",children:s[l]&&(0,t.jsx)(f.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"absolute left-0 top-0 w-full",children:(0,t.jsx)(n.Picture,{source:`${s[l].image.url} ,${s[l].imgPad?.url||s[l].image.url} 1440, ${s[l].imageMob?.url||s[l].image.url} 767`,alt:s[l].image.alt,className:"rounded-[16px] md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] "})},s[l].image.url)})})]})});w.displayName="TabWithImage";var $=(0,T.withLayout)(w);
|
|
2
2
|
//# sourceMappingURL=TabWithImage.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/TabWithImage/TabWithImage.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { Heading, Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport type { TabWithImageProps, TabWithImageDataItem } from './types.js'\nimport { motion, AnimatePresence } from 'framer-motion'\n\nconst componentType = 'image'\nconst componentName = 'tab_with_image'\n\nconst TabWithImage = React.forwardRef<HTMLDivElement, TabWithImageProps>(({ data, className }, ref) => {\n const { title, subtitle, desc, image, mobileImage, datalist = [] } = data\n\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: desc,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const handleClick = (index: number, e: React.MouseEvent<HTMLDivElement>) => {\n setActiveIndex(index)\n ;(e.target as HTMLElement).scrollIntoView({\n behavior: 'smooth', // \u5E73\u6ED1\u6EDA\u52A8\n inline: 'center', // \u6A2A\u5411\u5C45\u4E2D\u5BF9\u9F50\n block: 'nearest', // \u5782\u76F4\u65B9\u5411\u4E0D\u52A8\n })\n }\n\n const [activeIndex, setActiveIndex] = useState(0)\n const tabRefs = useRef<Array<HTMLDivElement | null>>([]) // \u8BB0\u5F55\u6BCF\u4E2Atab\u7684\u4F4D\u7F6E\n const [sliderStyle, setSliderStyle] = useState({ left: 0, width: 0 })\n\n useEffect(() => {\n const current = tabRefs.current[activeIndex]\n if (current) {\n const { offsetLeft, offsetWidth } = current\n setSliderStyle({ left: offsetLeft, width: offsetWidth })\n }\n }, [activeIndex, datalist.length])\n\n return (\n <section\n ref={boxRef}\n data-ui-component-id=\"TabWithImage\"\n className={cn('flex text-[#fff] l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]', className)}\n >\n <div className=\"inline-flex flex-col justify-center min-md:gap-[24px] laptop:basis-[36%]\">\n <div>\n <Heading as={'h3'} size={4} html={title} />\n <Text\n as={'p'}\n size={1}\n html={desc}\n className=\"mt-[4px] text-[14px] tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n />\n </div>\n\n <div className=\"relative md:overflow-hidden md:overflow-x-scroll md:scrollbar-hidden\">\n <div className=\"relative inline-flex rounded-[24px] bg-[#1D1D1F] px-[4px] md:my-[24px]\">\n {/* \u6ED1\u52A8\u80CC\u666F */}\n <div\n className=\"absolute bottom-0 top-0 rounded-[24px] bg-white transition-all duration-300 ease-in-out\"\n style={{\n left: sliderStyle.left,\n width: sliderStyle.width,\n }}\n />\n\n {/* Tab Items */}\n {datalist.map((item: TabWithImageDataItem, index: number) => (\n <div\n key={index}\n ref={el => {\n tabRefs.current[index] = el\n }}\n onClick={e => handleClick(index, e)}\n className={cn(\n 'relative z-10 cursor-pointer rounded-[24px] px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px] min-xxl:px-[28px] min-xxl:py-[15px]',\n activeIndex === index ? 'text-black' : 'text-white'\n )}\n >\n <Heading\n as=\"h1\"\n size={1}\n html={item?.title}\n className=\"text-balance-normal !whitespace-nowrap md:text-[14px]\"\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n <div className=\" relative w-full flex-shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]\">\n <AnimatePresence mode=\"wait\">\n <motion.div\n
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsDQ,IAAAI,EAAA,6BArDRC,EAAwE,oBACxEC,EAAuC,qCACvCC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA4B,sCAE5BC,EAAwC,yBAExC,MAAMC,EAAgB,QAChBC,EAAgB,iBAEhBC,EAAe,EAAAC,QAAM,WAA8C,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACrG,KAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,SAAAC,EAAW,CAAC,CAAE,EAAIR,EAE/DS,KAAS,UAAuB,IAAI,KAE1C,eAAYA,EAAQ,CAClB,cAAAb,EACA,cAAAC,EACA,eAAgBM,EAChB,qBAAsBE,CACxB,CAAC,KAED,uBAAoBH,EAAK,IAAMO,EAAO,OAAyB,EAE/D,MAAMC,EAAc,CAACC,EAAeC,IAAwC,CAC1EC,EAAeF,CAAK,EAClBC,EAAE,OAAuB,eAAe,CACxC,SAAU,SACV,OAAQ,SACR,MAAO,SACT,CAAC,CACH,EAEM,CAACE,EAAaD,CAAc,KAAI,YAAS,CAAC,EAC1CE,KAAU,UAAqC,CAAC,CAAC,EACjD,CAACC,EAAaC,CAAc,KAAI,YAAS,CAAE,KAAM,EAAG,MAAO,CAAE,CAAC,EAEpE,sBAAU,IAAM,CACd,MAAMC,EAAUH,EAAQ,QAAQD,CAAW,EAC3C,GAAII,EAAS,CACX,KAAM,CAAE,WAAAC,EAAY,YAAAC,CAAY,EAAIF,EACpCD,EAAe,CAAE,KAAME,EAAY,MAAOC,CAAY,CAAC,CACzD,CACF,EAAG,CAACN,EAAaN,EAAS,MAAM,CAAC,KAG/B,QAAC,WACC,IAAKC,EACL,uBAAqB,eACrB,aAAW,MAAG,oFAAqFR,CAAS,EAE5G,qBAAC,OAAI,UAAU,2EACb,qBAAC,OACC,oBAAC,WAAQ,GAAI,KAAM,KAAM,EAAG,KAAME,EAAO,KACzC,OAAC,QACC,GAAI,IACJ,KAAM,EACN,KAAME,EACN,UAAU,wGACZ,GACF,KAEA,OAAC,OAAI,UAAU,uEACb,oBAAC,OAAI,UAAU,yEAEb,oBAAC,OACC,UAAU,0FACV,MAAO,CACL,KAAMW,EAAY,KAClB,MAAOA,EAAY,KACrB,EACF,EAGCR,EAAS,IAAI,CAACa,EAA4BV,OACzC,OAAC,OAEC,IAAKW,GAAM,CACTP,EAAQ,QAAQJ,CAAK,EAAIW,CAC3B,EACA,QAASV,GAAKF,EAAYC,EAAOC,CAAC,EAClC,aAAW,MACT,mMACAE,IAAgBH,EAAQ,aAAe,YACzC,EAEA,mBAAC,WACC,GAAG,KACH,KAAM,EACN,KAAMU,GAAM,MACZ,UAAU,wDACZ,GAfKV,CAgBP,CACD,GACH,EACF,GACF,KACA,OAAC,OAAI,UAAU,8LACb,mBAAC,mBAAgB,KAAK,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { Heading, Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport type { TabWithImageProps, TabWithImageDataItem } from './types.js'\nimport { motion, AnimatePresence } from 'framer-motion'\n\nconst componentType = 'image'\nconst componentName = 'tab_with_image'\n\nconst TabWithImage = React.forwardRef<HTMLDivElement, TabWithImageProps>(({ data, className }, ref) => {\n const { title, subtitle, desc, image, mobileImage, datalist = [] } = data\n\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: desc,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const handleClick = (index: number, e: React.MouseEvent<HTMLDivElement>) => {\n setActiveIndex(index)\n ;(e.target as HTMLElement).scrollIntoView({\n behavior: 'smooth', // \u5E73\u6ED1\u6EDA\u52A8\n inline: 'center', // \u6A2A\u5411\u5C45\u4E2D\u5BF9\u9F50\n block: 'nearest', // \u5782\u76F4\u65B9\u5411\u4E0D\u52A8\n })\n }\n\n const [activeIndex, setActiveIndex] = useState(0)\n const tabRefs = useRef<Array<HTMLDivElement | null>>([]) // \u8BB0\u5F55\u6BCF\u4E2Atab\u7684\u4F4D\u7F6E\n const [sliderStyle, setSliderStyle] = useState({ left: 0, width: 0 })\n\n useEffect(() => {\n const current = tabRefs.current[activeIndex]\n if (current) {\n const { offsetLeft, offsetWidth } = current\n setSliderStyle({ left: offsetLeft, width: offsetWidth })\n }\n }, [activeIndex, datalist.length])\n\n return (\n <section\n ref={boxRef}\n data-ui-component-id=\"TabWithImage\"\n className={cn('flex text-[#fff] l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]', className)}\n >\n <div className=\"inline-flex flex-col justify-center min-md:gap-[24px] laptop:basis-[36%]\">\n <div>\n <Heading as={'h3'} size={4} html={title} />\n <Text\n as={'p'}\n size={1}\n html={desc}\n className=\"mt-[4px] text-[14px] tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n />\n </div>\n\n <div className=\"relative md:overflow-hidden md:overflow-x-scroll md:scrollbar-hidden\">\n <div className=\"relative inline-flex rounded-[24px] bg-[#1D1D1F] px-[4px] md:my-[24px]\">\n {/* \u6ED1\u52A8\u80CC\u666F */}\n <div\n className=\"absolute bottom-0 top-0 rounded-[24px] bg-white transition-all duration-300 ease-in-out\"\n style={{\n left: sliderStyle.left,\n width: sliderStyle.width,\n }}\n />\n\n {/* Tab Items */}\n {datalist.map((item: TabWithImageDataItem, index: number) => (\n <div\n key={index}\n ref={el => {\n tabRefs.current[index] = el\n }}\n onClick={e => handleClick(index, e)}\n className={cn(\n 'relative z-10 cursor-pointer rounded-[24px] px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px] min-xxl:px-[28px] min-xxl:py-[15px]',\n activeIndex === index ? 'text-black' : 'text-white'\n )}\n >\n <Heading\n as=\"h1\"\n size={1}\n html={item?.title}\n className=\"text-balance-normal !whitespace-nowrap md:text-[14px]\"\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n <div className=\" relative w-full flex-shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]\">\n <AnimatePresence mode=\"wait\">\n {datalist[activeIndex] && (\n <motion.div\n key={datalist[activeIndex].image.url}\n {...({\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: { duration: 0.3 },\n } as any)}\n className=\"absolute left-0 top-0 w-full\"\n >\n <Picture\n source={`${datalist[activeIndex].image.url} ,${datalist[activeIndex].imgPad?.url || datalist[activeIndex].image.url} 1440, ${datalist[activeIndex].imageMob?.url || datalist[activeIndex].image.url} 767`}\n alt={datalist[activeIndex].image.alt}\n className=\"rounded-[16px] md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] \"\n />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n </section>\n )\n})\n\nTabWithImage.displayName = 'TabWithImage'\n\nexport default withLayout(TabWithImage)\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["TabWithImage_exports", "__export", "TabWithImage_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_Styles", "import_useExposure", "import_framer_motion", "componentType", "componentName", "TabWithImage", "React", "data", "className", "ref", "title", "subtitle", "desc", "image", "mobileImage", "datalist", "boxRef", "handleClick", "index", "e", "setActiveIndex", "activeIndex", "tabRefs", "sliderStyle", "setSliderStyle", "current", "offsetLeft", "offsetWidth", "item", "el"]
|
|
7
7
|
}
|