@gem-sdk/components 2.0.0-dev.278 → 2.0.0-dev.289
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/accordion/components/Accordion.js +60 -179
- package/dist/cjs/accordion/components/Accordion.liquid.js +77 -101
- package/dist/cjs/accordion/components/AccordionItem.js +126 -280
- package/dist/cjs/accordion/components/AccordionItem.liquid.js +77 -215
- package/dist/cjs/accordion/components/common/classes.js +55 -0
- package/dist/cjs/accordion/components/common/index.js +146 -0
- package/dist/cjs/accordion/components/common/styles.js +131 -0
- package/dist/cjs/accordion/hooks/useAccordion.js +145 -0
- package/dist/cjs/accordion/hooks/useAccordionItem.js +119 -0
- package/dist/cjs/article/components/ArticleImage.js +0 -1
- package/dist/cjs/article/components/ArticlePagination.js +1 -1
- package/dist/cjs/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/cjs/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/cjs/banner/components/HeroBannerItem.js +0 -6
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/cjs/banner/setting/setting.js +28 -3
- package/dist/cjs/banner/setting/uiV2.js +10 -97
- package/dist/cjs/builder.js +18 -20
- package/dist/cjs/cart/components/CartLineImage.js +0 -2
- package/dist/cjs/code/common/classes.js +11 -0
- package/dist/cjs/code/common/styles.js +15 -0
- package/dist/cjs/code/components/CSSCode.js +9 -99
- package/dist/cjs/code/components/CSSCode.liquid.js +11 -11
- package/dist/cjs/code/hooks/useCSSCode.js +102 -0
- package/dist/cjs/code/setting/CSSCode.js +7 -121
- package/dist/cjs/code/setting/config/setting.js +77 -0
- package/dist/cjs/code/setting/config/uiV1.js +52 -0
- package/dist/cjs/code/setting/config/uiV2.js +58 -0
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/cjs/form/components/contact/Contact.js +6 -2
- package/dist/cjs/form/components/contact/common/composeStyles.js +21 -0
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.js +6 -4
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.liquid.js +2 -4
- package/dist/cjs/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/cjs/form/components/form-checkbox/common/composeStyles.js +23 -10
- package/dist/cjs/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/form-email/FormEmail.js +18 -10
- package/dist/cjs/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/cjs/form/components/newsletter/Newsletter.js +7 -2
- package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/cjs/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/cjs/form/components/textarea/TextArea.js +16 -8
- package/dist/cjs/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/textfield/TextField.js +17 -9
- package/dist/cjs/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/cjs/form/setting/contact/Contact.js +5 -1
- package/dist/cjs/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/cjs/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/cjs/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/cjs/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/cjs/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/cjs/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/cjs/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/cjs/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/cjs/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/cjs/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/cjs/header/components/kind/basic/index.js +1 -0
- package/dist/cjs/header/components/kind/modern/index.js +1 -1
- package/dist/cjs/helpers.js +53 -0
- package/dist/cjs/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/cjs/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/cjs/image/components/AdaptiveImage.js +63 -49
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +56 -44
- package/dist/cjs/image/components/Image.js +65 -154
- package/dist/cjs/image/components/Image.liquid.js +68 -103
- package/dist/cjs/image/components/Modal3d.liquid.js +54 -21
- package/dist/cjs/image/components/NextImage.js +26 -59
- package/dist/cjs/image/components/NextImage.liquid.js +27 -115
- package/dist/cjs/image/components/Video.liquid.js +38 -13
- package/dist/cjs/image/components/common/attributes.js +115 -0
- package/dist/cjs/image/components/common/classes.js +57 -0
- package/dist/cjs/image/components/common/constants.js +15 -0
- package/dist/cjs/image/components/common/data.js +24 -0
- package/dist/cjs/image/components/common/helpers.js +75 -0
- package/dist/cjs/image/components/common/styles.js +88 -0
- package/dist/cjs/image/components/helpers/getNextImageLiquidAttrs.js +80 -0
- package/dist/cjs/image/components/helpers/getNextImageReactAttrs.js +40 -0
- package/dist/cjs/image/components/hooks/useCheckNoImage.js +25 -0
- package/dist/cjs/image/helpers/getSrcSet.js +0 -2
- package/dist/cjs/image/next.js +1 -5
- package/dist/cjs/image/setting/configs/settings.js +14 -8
- package/dist/cjs/image/setting/configs/uiV2.js +61 -15
- package/dist/cjs/image/setting/index.js +1 -3
- package/dist/cjs/image-comparison/components/CompareImage.js +1 -1
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/cjs/index.js +91 -91
- package/dist/cjs/index.liquid.js +8 -8
- package/dist/cjs/post-purchase/callout-banner/components/CalloutText.js +2 -1
- package/dist/cjs/post-purchase/callout-banner/components/common/getClasses.js +5 -2
- package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +2 -4
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -11
- package/dist/cjs/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/cjs/post-purchase/countdown-timer/components/TextCountdown.js +12 -26
- package/dist/cjs/post-purchase/countdown-timer/components/common/getClasses.js +24 -0
- package/dist/cjs/post-purchase/countdown-timer/components/common/getStyles.js +21 -0
- package/dist/cjs/post-purchase/countdown-timer/hooks/useCountdownTimer.js +18 -1
- package/dist/cjs/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +18 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/cjs/post-purchase/countdown-timer/settings/config/preset.js +26 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/setting.js +243 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV1.js +125 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV2.js +185 -0
- package/dist/cjs/post-purchase/image/common/getClasses.js +1 -1
- package/dist/cjs/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +24 -26
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +5 -5
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/cjs/product/components/Product.liquid.js +1 -1
- package/dist/cjs/product/components/ProductBundle/common/classes.js +25 -0
- package/dist/cjs/product/components/ProductBundle/common/index.js +5 -0
- package/dist/cjs/product/components/ProductBundle/common/styles.js +89 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.js +82 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +74 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +69 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +46 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.js +23 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +14 -0
- package/dist/cjs/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +20 -215
- package/dist/cjs/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +56 -0
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/cjs/product/components/ProductButton.js +2 -2
- package/dist/cjs/product/components/ProductButton.liquid.js +2 -2
- package/dist/cjs/product/components/ProductPrice/common/getAttr.js +23 -0
- package/dist/cjs/product/components/ProductPrice/common/getClasses.js +19 -0
- package/dist/cjs/product/components/ProductPrice/common/getTextData.js +40 -0
- package/dist/cjs/product/components/ProductPrice/hooks/useGpPrice.js +126 -0
- package/dist/cjs/product/components/ProductPrice/index.js +54 -0
- package/dist/cjs/product/components/ProductPrice/index.liquid.js +43 -0
- package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +5 -5
- package/dist/cjs/product/next.js +3 -3
- package/dist/cjs/product/setting/index.js +2 -2
- package/dist/cjs/product/setting/product/configs/presets.js +1 -0
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/cjs/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/cjs/setting.js +5 -2
- package/dist/esm/accordion/components/Accordion.js +61 -180
- package/dist/esm/accordion/components/Accordion.liquid.js +78 -102
- package/dist/esm/accordion/components/AccordionItem.js +129 -281
- package/dist/esm/accordion/components/AccordionItem.liquid.js +76 -214
- package/dist/esm/accordion/components/common/classes.js +44 -0
- package/dist/esm/accordion/components/common/index.js +136 -0
- package/dist/esm/accordion/components/common/styles.js +122 -0
- package/dist/esm/accordion/hooks/useAccordion.js +141 -0
- package/dist/esm/accordion/hooks/useAccordionItem.js +115 -0
- package/dist/esm/article/components/ArticleImage.js +0 -1
- package/dist/esm/article/components/ArticlePagination.js +1 -1
- package/dist/esm/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/esm/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/esm/banner/components/HeroBannerItem.js +0 -6
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/esm/banner/setting/setting.js +28 -3
- package/dist/esm/banner/setting/uiV2.js +10 -97
- package/dist/esm/builder.js +3 -5
- package/dist/esm/cart/components/CartLineImage.js +0 -2
- package/dist/esm/code/common/classes.js +9 -0
- package/dist/esm/code/common/styles.js +13 -0
- package/dist/esm/code/components/CSSCode.js +9 -99
- package/dist/esm/code/components/CSSCode.liquid.js +12 -12
- package/dist/esm/code/hooks/useCSSCode.js +98 -0
- package/dist/esm/code/setting/CSSCode.js +7 -121
- package/dist/esm/code/setting/config/setting.js +75 -0
- package/dist/esm/code/setting/config/uiV1.js +50 -0
- package/dist/esm/code/setting/config/uiV2.js +56 -0
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/esm/form/components/contact/Contact.js +7 -3
- package/dist/esm/form/components/contact/common/composeStyles.js +19 -0
- package/dist/esm/form/components/form-checkbox/FormCheckbox.js +7 -5
- package/dist/esm/form/components/form-checkbox/FormCheckbox.liquid.js +3 -5
- package/dist/esm/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/esm/form/components/form-checkbox/common/composeStyles.js +25 -11
- package/dist/esm/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/esm/form/components/form-email/FormEmail.js +18 -10
- package/dist/esm/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/esm/form/components/newsletter/Newsletter.js +8 -3
- package/dist/esm/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/esm/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/esm/form/components/textarea/TextArea.js +16 -8
- package/dist/esm/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/esm/form/components/textfield/TextField.js +17 -9
- package/dist/esm/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/esm/form/setting/contact/Contact.js +5 -1
- package/dist/esm/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/esm/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/esm/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/esm/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/esm/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/esm/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/esm/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/esm/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/esm/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/esm/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/esm/header/components/kind/basic/index.js +1 -0
- package/dist/esm/header/components/kind/modern/index.js +1 -1
- package/dist/esm/helpers.js +52 -1
- package/dist/esm/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/esm/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/esm/image/components/AdaptiveImage.js +64 -50
- package/dist/esm/image/components/AdaptiveImage.liquid.js +57 -45
- package/dist/esm/image/components/Image.js +66 -155
- package/dist/esm/image/components/Image.liquid.js +69 -104
- package/dist/esm/image/components/Modal3d.liquid.js +55 -22
- package/dist/esm/image/components/NextImage.js +26 -59
- package/dist/esm/image/components/NextImage.liquid.js +28 -116
- package/dist/esm/image/components/Video.liquid.js +38 -13
- package/dist/esm/image/components/common/attributes.js +108 -0
- package/dist/esm/image/components/common/classes.js +51 -0
- package/dist/esm/image/components/common/constants.js +11 -0
- package/dist/esm/image/components/common/data.js +22 -0
- package/dist/esm/image/components/common/helpers.js +69 -0
- package/dist/esm/image/components/common/styles.js +80 -0
- package/dist/esm/image/components/helpers/getNextImageLiquidAttrs.js +78 -0
- package/dist/esm/image/components/helpers/getNextImageReactAttrs.js +38 -0
- package/dist/esm/image/components/hooks/useCheckNoImage.js +23 -0
- package/dist/esm/image/helpers/getSrcSet.js +1 -2
- package/dist/esm/image/next.js +1 -5
- package/dist/esm/image/setting/configs/settings.js +14 -8
- package/dist/esm/image/setting/configs/uiV2.js +61 -15
- package/dist/esm/image/setting/index.js +1 -3
- package/dist/esm/image-comparison/components/CompareImage.js +1 -1
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/esm/index.js +4 -5
- package/dist/esm/index.liquid.js +3 -3
- package/dist/esm/post-purchase/callout-banner/components/CalloutText.js +2 -1
- package/dist/esm/post-purchase/callout-banner/components/common/getClasses.js +5 -2
- package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +2 -4
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -11
- package/dist/esm/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/esm/post-purchase/countdown-timer/components/TextCountdown.js +13 -27
- package/dist/esm/post-purchase/countdown-timer/components/common/getClasses.js +21 -0
- package/dist/esm/post-purchase/countdown-timer/components/common/getStyles.js +19 -0
- package/dist/esm/post-purchase/countdown-timer/hooks/useCountdownTimer.js +19 -3
- package/dist/esm/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +16 -0
- package/dist/esm/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/esm/post-purchase/countdown-timer/settings/config/preset.js +24 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/setting.js +241 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV1.js +123 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV2.js +183 -0
- package/dist/esm/post-purchase/image/common/getClasses.js +1 -1
- package/dist/esm/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +25 -27
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +5 -5
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/esm/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/esm/product/components/Product.liquid.js +1 -1
- package/dist/esm/product/components/ProductBundle/common/classes.js +19 -0
- package/dist/esm/product/components/ProductBundle/common/index.js +3 -0
- package/dist/esm/product/components/ProductBundle/common/styles.js +80 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.js +78 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +70 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +65 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +42 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.js +19 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +10 -0
- package/dist/esm/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +21 -216
- package/dist/esm/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +52 -0
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/esm/product/components/ProductButton.js +1 -1
- package/dist/esm/product/components/ProductButton.liquid.js +1 -1
- package/dist/esm/product/components/ProductPrice/common/getAttr.js +21 -0
- package/dist/esm/product/components/ProductPrice/common/getClasses.js +17 -0
- package/dist/esm/product/components/ProductPrice/common/getTextData.js +38 -0
- package/dist/esm/product/components/ProductPrice/hooks/useGpPrice.js +124 -0
- package/dist/esm/product/components/ProductPrice/index.js +50 -0
- package/dist/esm/product/components/ProductPrice/index.liquid.js +38 -0
- package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
- package/dist/esm/product/next.js +3 -3
- package/dist/esm/product/setting/index.js +2 -2
- package/dist/esm/product/setting/product/configs/presets.js +1 -0
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/esm/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/esm/setting.js +5 -2
- package/dist/types/index.d.ts +174 -257
- package/package.json +2 -2
- package/dist/cjs/image/components/BackgroundImage.js +0 -102
- package/dist/cjs/image/components/Img.js +0 -28
- package/dist/cjs/image/components/helpers.js +0 -12
- package/dist/cjs/image/setting/BackgroundImage.js +0 -364
- package/dist/cjs/product/components/ProductBundleDiscount.liquid.js +0 -81
- package/dist/cjs/product/components/ProductBundleDiscountItem.js +0 -42
- package/dist/cjs/product/components/ProductBundleDiscountItem.liquid.js +0 -103
- package/dist/cjs/product/components/ProductPrice.js +0 -209
- package/dist/cjs/product/components/ProductPrice.liquid.js +0 -88
- package/dist/esm/image/components/BackgroundImage.js +0 -98
- package/dist/esm/image/components/Img.js +0 -24
- package/dist/esm/image/components/helpers.js +0 -9
- package/dist/esm/image/setting/BackgroundImage.js +0 -360
- package/dist/esm/product/components/ProductBundleDiscount.liquid.js +0 -77
- package/dist/esm/product/components/ProductBundleDiscountItem.js +0 -36
- package/dist/esm/product/components/ProductBundleDiscountItem.liquid.js +0 -99
- package/dist/esm/product/components/ProductPrice.js +0 -205
- package/dist/esm/product/components/ProductPrice.liquid.js +0 -83
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@gem-sdk/core');
|
|
6
|
-
var helpers = require('../../helpers.js');
|
|
7
|
-
|
|
8
|
-
const ProductBundleDiscount = ({ rawChildren, builderProps, setting, styles, advanced })=>{
|
|
9
|
-
const sizeSettings = core.makeGlobalSize(styles?.size);
|
|
10
|
-
const makeAlign = ()=>{
|
|
11
|
-
const alignment = styles?.align === 'left' ? 'start' : styles?.align === 'right' ? 'end' : 'center';
|
|
12
|
-
return {
|
|
13
|
-
...core.makeStyle({
|
|
14
|
-
ai: alignment
|
|
15
|
-
})
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
const renderBundleItem = (i)=>{
|
|
19
|
-
return core.template`
|
|
20
|
-
<div style="${{
|
|
21
|
-
...sizeSettings.width
|
|
22
|
-
}}">
|
|
23
|
-
${core.RenderChildren({
|
|
24
|
-
...rawChildren[i],
|
|
25
|
-
parentSetting: setting,
|
|
26
|
-
parentStyles: styles,
|
|
27
|
-
index: i,
|
|
28
|
-
bundleItem: '{{attr1[0]}}={{attr1[2]}} {{attr2[0]}}={{attr2[2]}} {{attr3[0]}}={{attr3[2]}} {{attr4[0]}}={{attr4[2]}} {{attr5[0]}}={{attr5[2]}}'
|
|
29
|
-
})}
|
|
30
|
-
</div>
|
|
31
|
-
`;
|
|
32
|
-
};
|
|
33
|
-
return core.template`
|
|
34
|
-
<gp-product-bundle-discount
|
|
35
|
-
${{
|
|
36
|
-
...builderProps
|
|
37
|
-
}}
|
|
38
|
-
data-id="${builderProps?.uid}"
|
|
39
|
-
use-product-compare-at-price="${setting?.useProductCompareAtPrice}"
|
|
40
|
-
gp-data='${JSON.stringify({
|
|
41
|
-
styles,
|
|
42
|
-
settings: {
|
|
43
|
-
selectItemDefault: setting?.selectItemDefault,
|
|
44
|
-
hideNoDiscountItem: setting?.hideNoDiscountItem,
|
|
45
|
-
hasPreSelectItem: setting?.hasPreSelectItem
|
|
46
|
-
}
|
|
47
|
-
})}'
|
|
48
|
-
style="${{
|
|
49
|
-
...sizeSettings.gap,
|
|
50
|
-
...makeAlign()
|
|
51
|
-
}}"
|
|
52
|
-
class="${core.cls({
|
|
53
|
-
'gp-flex-col': setting?.layout === 'vertical-layout'
|
|
54
|
-
}, 'gp-flex')} ${advanced?.cssClass}">
|
|
55
|
-
{%- assign gempages_product_bundle = product.metafields.gp_discount.gp_discount_selected_products -%}
|
|
56
|
-
{% assign productBundleItem = gempages_product_bundle | split: '($1)' %}
|
|
57
|
-
${rawChildren?.map((_, i)=>{
|
|
58
|
-
return core.template`
|
|
59
|
-
{% for productBundle in productBundleItem %}
|
|
60
|
-
{% assign attrs = productBundle | split: '($3)' %}
|
|
61
|
-
{% assign attr1 = attrs[0] | split: '($:)' %}
|
|
62
|
-
{% assign attr2 = attrs[1] | split: '($:)' %}
|
|
63
|
-
{% assign attr3 = attrs[2] | split: '($:)' %}
|
|
64
|
-
{% assign attr4 = attrs[3] | split: '($:)' %}
|
|
65
|
-
{% assign attr5 = attrs[4] | split: '($:)' %}
|
|
66
|
-
|
|
67
|
-
{% if forloop.index0 == ${i} %}
|
|
68
|
-
${renderBundleItem(i)}
|
|
69
|
-
{% endif %}
|
|
70
|
-
{% endfor %}
|
|
71
|
-
`;
|
|
72
|
-
}).join('')}
|
|
73
|
-
</gp-product-bundle-discount>
|
|
74
|
-
|
|
75
|
-
{% if productBundleItem %}
|
|
76
|
-
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-bundle-discount.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-bundle-discount.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
77
|
-
{% endif %}
|
|
78
|
-
`;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
exports.default = ProductBundleDiscount;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var ChildrenDroppable = require('../../grid/components/ChildrenDroppable.js');
|
|
9
|
-
|
|
10
|
-
const MINIMUM_CHILD = 1;
|
|
11
|
-
const BODY_CHILD_INDEX = 0;
|
|
12
|
-
const ProductBundleDiscountItem = ({ children, builderProps })=>{
|
|
13
|
-
const styles = `
|
|
14
|
-
.${builderProps?.uid} {
|
|
15
|
-
width: 100%
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const childForBody = React.useMemo(()=>{
|
|
19
|
-
if (React.Children.count(children) >= MINIMUM_CHILD) {
|
|
20
|
-
return children;
|
|
21
|
-
}
|
|
22
|
-
return /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {
|
|
23
|
-
styles: styles
|
|
24
|
-
});
|
|
25
|
-
}, [
|
|
26
|
-
children,
|
|
27
|
-
styles
|
|
28
|
-
]);
|
|
29
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
30
|
-
className: "gp-min-h-0",
|
|
31
|
-
children: [
|
|
32
|
-
/*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
33
|
-
children: styles
|
|
34
|
-
}),
|
|
35
|
-
childForBody
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.BODY_CHILD_INDEX = BODY_CHILD_INDEX;
|
|
41
|
-
exports.MINIMUM_CHILD = MINIMUM_CHILD;
|
|
42
|
-
exports.default = ProductBundleDiscountItem;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@gem-sdk/core');
|
|
6
|
-
|
|
7
|
-
const ProductBundleDiscountItem = ({ children, parentSetting, parentStyles, index, bundleItem })=>{
|
|
8
|
-
const sizeSettings = core.makeGlobalSize(parentStyles?.size);
|
|
9
|
-
if (core.isEmptyChildren(children)) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
const selected = !parentSetting?.hasPreSelectItem ? -1 : parentSetting?.selectItemDefault ?? 0;
|
|
13
|
-
const getIcon = ()=>{
|
|
14
|
-
if (parentSetting?.enableIcon) {
|
|
15
|
-
return core.template`
|
|
16
|
-
<div
|
|
17
|
-
class="gp-flex-none bundle-icon-section"
|
|
18
|
-
style="${{
|
|
19
|
-
...core.makeStyleResponsive('w', parentSetting.iconSize, 'px'),
|
|
20
|
-
...core.makeStyleResponsive('h', parentSetting.iconSize, 'px'),
|
|
21
|
-
...parentSetting?.layout !== 'horizontal-layout' ? core.makeStyle({
|
|
22
|
-
mr: parentSetting.iconSpacing
|
|
23
|
-
}) : core.makeStyle({
|
|
24
|
-
mb: parentSetting.iconSpacing
|
|
25
|
-
})
|
|
26
|
-
}}"
|
|
27
|
-
>
|
|
28
|
-
<svg
|
|
29
|
-
style="${{
|
|
30
|
-
...core.getGlobalColorStateStyle('c', parentStyles?.iconColor)
|
|
31
|
-
}}"
|
|
32
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
33
|
-
viewBox="0 0 256 256"
|
|
34
|
-
fill="currentColor"
|
|
35
|
-
data-id="508817616304734568"
|
|
36
|
-
>
|
|
37
|
-
<path
|
|
38
|
-
fill="currentColor"
|
|
39
|
-
strokeLinecap="round"
|
|
40
|
-
strokeLinejoin="round"
|
|
41
|
-
d="M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"
|
|
42
|
-
></path>
|
|
43
|
-
</svg>
|
|
44
|
-
</div>`;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const isSelected = (i)=>{
|
|
48
|
-
return selected === i;
|
|
49
|
-
};
|
|
50
|
-
return core.template`
|
|
51
|
-
<div
|
|
52
|
-
${bundleItem}
|
|
53
|
-
class="product-bundle-item cursor-pointer"
|
|
54
|
-
style="${{
|
|
55
|
-
...sizeSettings.padding,
|
|
56
|
-
...core.makeStyleState('bg', parentStyles?.backgroundColor),
|
|
57
|
-
...core.makeStyle({
|
|
58
|
-
bg: isSelected(index) ? parentStyles?.backgroundColor?.active : parentStyles?.backgroundColor?.normal
|
|
59
|
-
}),
|
|
60
|
-
...core.composeRadius(parentStyles?.roundedBundle),
|
|
61
|
-
...core.getStyleShadowState(parentStyles?.boxShadowBundle, 'box-shadow', parentStyles?.hasBoxShadowBundle),
|
|
62
|
-
...core.handleConvertBorderWidth(parentStyles?.borderBundle),
|
|
63
|
-
...core.handleConvertBorderStyle(parentStyles?.borderBundle),
|
|
64
|
-
...core.handleConvertBorderColor(parentStyles?.borderBundle),
|
|
65
|
-
...isSelected(index) ? core.getStyleShadow({
|
|
66
|
-
value: parentStyles?.boxShadowBundle?.active,
|
|
67
|
-
styleAppliedFor: 'box-shadow',
|
|
68
|
-
isEnableShadow: parentStyles?.hasBoxShadowBundle?.active
|
|
69
|
-
}) : {
|
|
70
|
-
...core.getStyleShadow({
|
|
71
|
-
value: parentStyles?.boxShadowBundle?.normal,
|
|
72
|
-
styleAppliedFor: 'box-shadow',
|
|
73
|
-
isEnableShadow: parentStyles?.hasBoxShadowBundle?.normal
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
...isSelected(index) ? core.getBorderStyle(parentStyles?.borderBundle?.active) : {
|
|
77
|
-
...core.handleConvertBorderWidth(parentStyles?.borderBundle),
|
|
78
|
-
...core.handleConvertBorderStyle(parentStyles?.borderBundle),
|
|
79
|
-
...core.handleConvertBorderColor(parentStyles?.borderBundle)
|
|
80
|
-
},
|
|
81
|
-
...isSelected(index) ? core.getRadiusStyleActiveState({
|
|
82
|
-
active: {
|
|
83
|
-
...parentStyles?.roundedBundle?.active ? parentStyles?.roundedBundle?.active : parentStyles?.roundedBundle?.normal,
|
|
84
|
-
radiusType: 'custom'
|
|
85
|
-
}
|
|
86
|
-
}) : {}
|
|
87
|
-
}}"
|
|
88
|
-
>
|
|
89
|
-
<div class="${core.cls({
|
|
90
|
-
'gp-items-center': parentSetting?.layout === 'vertical-layout' ? parentSetting?.iconPosition === 'center' : parentSetting?.iconHorizontalPosition === 'center',
|
|
91
|
-
'gp-items-start': parentSetting?.layout === 'vertical-layout' ? parentSetting?.iconPosition === 'baseline' : parentSetting?.iconHorizontalPosition === 'baseline',
|
|
92
|
-
'gp-flex-col': parentSetting?.layout === 'horizontal-layout'
|
|
93
|
-
}, 'gp-flex gp-justify-center')}">
|
|
94
|
-
${getIcon()}
|
|
95
|
-
<div class="gp-w-full">
|
|
96
|
-
${children}
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
`;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
exports.default = ProductBundleDiscountItem;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var core = require('@gem-sdk/core');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var Text = require('../../text/components/Text.js');
|
|
10
|
-
var common = require('./ProductVariants/common.js');
|
|
11
|
-
var NoDataState = require('../../common/components/NoDataState.js');
|
|
12
|
-
var TooltipHover = require('../../common/components/TooltipHover.js');
|
|
13
|
-
|
|
14
|
-
const ProductPrice = (props)=>{
|
|
15
|
-
const { builderAttrs, style, children, setting, styles, builderProps, classNames } = props;
|
|
16
|
-
const elementRef = React.useRef(null);
|
|
17
|
-
const bundleItem = props['bundle-item'];
|
|
18
|
-
const mode = core.useEditorMode();
|
|
19
|
-
const { quantity, hasUpdatePrice } = core.useQuantity();
|
|
20
|
-
const currentVariant = core.useCurrentVariant();
|
|
21
|
-
const { useProductCompareAtPrice } = core.useProductBundleDiscount();
|
|
22
|
-
const currentProduct = core.useProduct();
|
|
23
|
-
const price = currentVariant?.price ?? 0;
|
|
24
|
-
const salePrice = currentVariant?.salePrice ?? 0;
|
|
25
|
-
const [hasThickness, setHasThickness] = React.useState(true);
|
|
26
|
-
const { trigger } = core.useInteraction();
|
|
27
|
-
const quantityProduct = React.useMemo(()=>{
|
|
28
|
-
if (bundleItem?.quantity) {
|
|
29
|
-
return bundleItem.quantity;
|
|
30
|
-
}
|
|
31
|
-
return hasUpdatePrice ? quantity || 1 : 1;
|
|
32
|
-
}, [
|
|
33
|
-
quantity,
|
|
34
|
-
hasUpdatePrice,
|
|
35
|
-
bundleItem?.quantity
|
|
36
|
-
]);
|
|
37
|
-
const bundleDiscount = React.useMemo(()=>{
|
|
38
|
-
const value = parseInt(bundleItem?.discountValue);
|
|
39
|
-
if (bundleItem?.discountType === 'percentage') {
|
|
40
|
-
return price * quantityProduct * value / 100;
|
|
41
|
-
}
|
|
42
|
-
return value;
|
|
43
|
-
}, [
|
|
44
|
-
bundleItem?.discountType,
|
|
45
|
-
bundleItem?.discountValue,
|
|
46
|
-
price,
|
|
47
|
-
quantityProduct
|
|
48
|
-
]);
|
|
49
|
-
const priceCompare = React.useMemo(()=>{
|
|
50
|
-
if (bundleItem?.discountValue) {
|
|
51
|
-
if (useProductCompareAtPrice) {
|
|
52
|
-
return (salePrice || price) * quantityProduct;
|
|
53
|
-
}
|
|
54
|
-
return price * quantityProduct;
|
|
55
|
-
}
|
|
56
|
-
return salePrice * quantityProduct;
|
|
57
|
-
}, [
|
|
58
|
-
bundleItem?.discountValue,
|
|
59
|
-
price,
|
|
60
|
-
quantityProduct,
|
|
61
|
-
salePrice,
|
|
62
|
-
useProductCompareAtPrice
|
|
63
|
-
]);
|
|
64
|
-
const displayPrice = React.useMemo(()=>{
|
|
65
|
-
const quantityPrice = price * quantityProduct;
|
|
66
|
-
if (styles?.priceType === 'compare') {
|
|
67
|
-
return priceCompare;
|
|
68
|
-
}
|
|
69
|
-
if (bundleDiscount) {
|
|
70
|
-
return Math.max(0, quantityPrice - bundleDiscount);
|
|
71
|
-
}
|
|
72
|
-
return quantityPrice;
|
|
73
|
-
}, [
|
|
74
|
-
styles?.priceType,
|
|
75
|
-
price,
|
|
76
|
-
quantityProduct,
|
|
77
|
-
bundleDiscount,
|
|
78
|
-
priceCompare
|
|
79
|
-
]);
|
|
80
|
-
const dispatchInteractionChangePrice = (value, type)=>{
|
|
81
|
-
trigger({
|
|
82
|
-
event: type === 'price' ? 'gp:rollback:price-change' : 'gp:rollback:compare-price-change',
|
|
83
|
-
selector: `[data-id="${builderProps?.uid}"]`,
|
|
84
|
-
element: elementRef.current
|
|
85
|
-
});
|
|
86
|
-
trigger({
|
|
87
|
-
event: type === 'price' ? 'gp:price-change' : 'gp:compare-price-change',
|
|
88
|
-
data: value,
|
|
89
|
-
selector: `[data-id="${builderProps?.uid}"]`,
|
|
90
|
-
element: elementRef.current
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
common.useTransition((oldPrice)=>{
|
|
94
|
-
if (oldPrice !== price) {
|
|
95
|
-
dispatchInteractionChangePrice(price, 'price');
|
|
96
|
-
}
|
|
97
|
-
}, [
|
|
98
|
-
price
|
|
99
|
-
]);
|
|
100
|
-
common.useTransition((oldPriceCompare)=>{
|
|
101
|
-
if (oldPriceCompare !== salePrice) {
|
|
102
|
-
dispatchInteractionChangePrice(salePrice, 'compare');
|
|
103
|
-
}
|
|
104
|
-
}, [
|
|
105
|
-
salePrice
|
|
106
|
-
]);
|
|
107
|
-
const emitNoDataSignal = ()=>{
|
|
108
|
-
if (mode !== 'edit') return;
|
|
109
|
-
const event = new CustomEvent('editor:product-source-no-data-warning', {
|
|
110
|
-
bubbles: true,
|
|
111
|
-
detail: {
|
|
112
|
-
uid: builderProps?.uid,
|
|
113
|
-
value: !displayPrice && styles?.priceType === 'compare',
|
|
114
|
-
tag: 'ProductPrice'
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
window.dispatchEvent(event);
|
|
118
|
-
};
|
|
119
|
-
React.useEffect(()=>{
|
|
120
|
-
/* Support line-through on Safari */ if (!core.isSafari()) return;
|
|
121
|
-
setHasThickness(false);
|
|
122
|
-
setTimeout(()=>{
|
|
123
|
-
setHasThickness(true);
|
|
124
|
-
}, 50);
|
|
125
|
-
}, [
|
|
126
|
-
styles?.thickness
|
|
127
|
-
]);
|
|
128
|
-
const moneyFormatted = core.useFormatMoney(displayPrice ?? 0, setting?.moneyWithCurrentFormat || false);
|
|
129
|
-
if (mode !== 'edit' && styles?.priceType === 'compare' && !displayPrice) return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
130
|
-
...builderAttrs,
|
|
131
|
-
className: core.cls(builderProps?.uid),
|
|
132
|
-
"data-id": builderProps?.uid,
|
|
133
|
-
ref: elementRef,
|
|
134
|
-
style: {
|
|
135
|
-
visibility: 'hidden',
|
|
136
|
-
opacity: 0,
|
|
137
|
-
maxWidth: 0,
|
|
138
|
-
maxHeight: 0
|
|
139
|
-
},
|
|
140
|
-
id: `shopify-text-element-${builderProps?.uid}`
|
|
141
|
-
});
|
|
142
|
-
const colorClass = core.getGlobalColorClass('decoration', styles?.lineColor);
|
|
143
|
-
const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
|
|
144
|
-
if (!displayPrice && styles?.priceType === 'compare') {
|
|
145
|
-
return /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
|
|
146
|
-
elementType: "secondary",
|
|
147
|
-
description: "No compare price",
|
|
148
|
-
rawMode: true
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
152
|
-
...builderAttrs,
|
|
153
|
-
className: core.cls(builderProps?.uid),
|
|
154
|
-
"data-id": builderProps?.uid,
|
|
155
|
-
ref: elementRef,
|
|
156
|
-
style: {
|
|
157
|
-
...style
|
|
158
|
-
},
|
|
159
|
-
id: `shopify-text-element-${builderProps?.uid}`,
|
|
160
|
-
"data-product-id": currentProductId,
|
|
161
|
-
"aria-hidden": "true",
|
|
162
|
-
onClick: emitNoDataSignal,
|
|
163
|
-
children: [
|
|
164
|
-
!displayPrice && mode === 'edit' ? /*#__PURE__*/ jsxRuntime.jsx(TooltipHover.default, {
|
|
165
|
-
enable: true,
|
|
166
|
-
text: 'Not be displayed when published',
|
|
167
|
-
position: 'bottom',
|
|
168
|
-
width: '205px',
|
|
169
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
|
|
170
|
-
builderAttrs: builderAttrs,
|
|
171
|
-
elementType: "secondary",
|
|
172
|
-
children: children,
|
|
173
|
-
description: "No compare price",
|
|
174
|
-
rawMode: true
|
|
175
|
-
})
|
|
176
|
-
}) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
177
|
-
children: [
|
|
178
|
-
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
179
|
-
styles: styles,
|
|
180
|
-
setting: {
|
|
181
|
-
text: moneyFormatted,
|
|
182
|
-
excludeFlex: true
|
|
183
|
-
},
|
|
184
|
-
style: {
|
|
185
|
-
...core.getStyleShadow({
|
|
186
|
-
value: setting?.boxShadowPrice,
|
|
187
|
-
styleAppliedFor: 'box-shadow',
|
|
188
|
-
isEnableShadow: setting?.hasBoxShadowPrice
|
|
189
|
-
}),
|
|
190
|
-
...core.getGlobalColorStateStyle('c', styles?.parentTextColor),
|
|
191
|
-
...setting?.opacityPrice ? core.makeStyle({
|
|
192
|
-
op: `${setting?.opacityPrice}%`
|
|
193
|
-
}) : {}
|
|
194
|
-
},
|
|
195
|
-
className: core.cls({
|
|
196
|
-
'gp-money': styles?.priceType === 'regular',
|
|
197
|
-
'gp-product-compare-price': styles?.priceType === 'compare',
|
|
198
|
-
'gp-line-through': styles?.priceType === 'compare' && styles?.lineThrough && hasThickness
|
|
199
|
-
}, core.getGlobalColorStateClass('text', styles?.parentTextColor), colorClass, classNames)
|
|
200
|
-
}),
|
|
201
|
-
children
|
|
202
|
-
]
|
|
203
|
-
}),
|
|
204
|
-
core.filterToolbarPreview(children, true)
|
|
205
|
-
]
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
exports.default = ProductPrice;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@gem-sdk/core');
|
|
6
|
-
var helpers = require('../../helpers.js');
|
|
7
|
-
var Text_liquid = require('../../text/components/Text.liquid.js');
|
|
8
|
-
|
|
9
|
-
const ProductPrice = ({ setting, styles, builderProps, builderAttrs, style, advanced, classNames })=>{
|
|
10
|
-
const colorClass = core.getGlobalColorClass('decoration', styles?.lineColor);
|
|
11
|
-
const isComparePrice = styles?.priceType === 'compare' || false;
|
|
12
|
-
const priceCompare = ()=>{
|
|
13
|
-
return `
|
|
14
|
-
{% if variant.compare_at_price %}
|
|
15
|
-
{{ variant.compare_at_price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
|
|
16
|
-
{% else %}
|
|
17
|
-
|
|
18
|
-
{% endif %}
|
|
19
|
-
`;
|
|
20
|
-
};
|
|
21
|
-
const defaultPrice = ()=>{
|
|
22
|
-
return `
|
|
23
|
-
{% if variant.price %}
|
|
24
|
-
{{ variant.price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
|
|
25
|
-
{% endif %}
|
|
26
|
-
`;
|
|
27
|
-
};
|
|
28
|
-
const getDataHidden = ()=>{
|
|
29
|
-
if (isComparePrice) {
|
|
30
|
-
return `{% if variant.compare_at_price > variant.price and variant.compare_at_price >= 0 %}false{% else %}true{% endif %}`;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
34
|
-
return core.template /*liquid*/ `
|
|
35
|
-
<gp-product-price
|
|
36
|
-
data-id="${builderProps?.uid}"
|
|
37
|
-
class="${core.cls(builderProps?.uid, advanced?.cssClass, classNames)} gp-product-price group-data-[state=loading]:gp-invisible data-[hidden=true]:gp-hidden"
|
|
38
|
-
gp-data='${core.dataStringify({
|
|
39
|
-
priceType: styles?.priceType,
|
|
40
|
-
uid: builderProps?.uid,
|
|
41
|
-
locale: `{{shop.locale}}`,
|
|
42
|
-
currency: `{{shop.currency}}`,
|
|
43
|
-
moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
|
|
44
|
-
})}'
|
|
45
|
-
${{
|
|
46
|
-
...builderAttrs
|
|
47
|
-
}}
|
|
48
|
-
style="${{
|
|
49
|
-
...style
|
|
50
|
-
}}"
|
|
51
|
-
data-hidden="${getDataHidden()}"
|
|
52
|
-
>
|
|
53
|
-
${Text_liquid.default({
|
|
54
|
-
id: `p-price-${builderProps?.uid}`,
|
|
55
|
-
styles: {
|
|
56
|
-
...styles
|
|
57
|
-
},
|
|
58
|
-
style: {
|
|
59
|
-
...core.getStyleShadow({
|
|
60
|
-
value: setting?.boxShadowPrice,
|
|
61
|
-
styleAppliedFor: 'box-shadow',
|
|
62
|
-
isEnableShadow: setting?.hasBoxShadowPrice
|
|
63
|
-
}),
|
|
64
|
-
...core.getGlobalColorStateStyle('c', styles?.parentTextColor),
|
|
65
|
-
...setting?.opacityPrice ? core.makeStyle({
|
|
66
|
-
op: `${setting?.opacityPrice}%`
|
|
67
|
-
}) : {}
|
|
68
|
-
},
|
|
69
|
-
elementAttrs: {
|
|
70
|
-
type: styles?.priceType
|
|
71
|
-
},
|
|
72
|
-
setting: {
|
|
73
|
-
text: `${isComparePrice ? priceCompare() : defaultPrice()}`,
|
|
74
|
-
excludeFlex: true
|
|
75
|
-
},
|
|
76
|
-
className: core.cls('gp-price', {
|
|
77
|
-
'gp-money': !isComparePrice,
|
|
78
|
-
'gp-product-compare-price': isComparePrice,
|
|
79
|
-
'gp-line-through': isComparePrice && styles?.lineThrough
|
|
80
|
-
}, colorClass, core.getGlobalColorStateClass('text', styles?.parentTextColor))
|
|
81
|
-
})}
|
|
82
|
-
</gp-product-price>
|
|
83
|
-
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-price.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-price.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
84
|
-
`;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.ProductPrice = ProductPrice;
|
|
88
|
-
exports.default = ProductPrice;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { getResponsiveValueByScreen, composeRadius, getStyleShadowState, makeStyleResponsive, cls, getGlobalColorStateClass, getGlobalColorStateStyle, makeStyleState, isEmptyChildren } from '@gem-sdk/core';
|
|
4
|
-
import Image from 'next/image';
|
|
5
|
-
import { useMemo, useCallback } from 'react';
|
|
6
|
-
import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
|
|
7
|
-
|
|
8
|
-
const BgImage = ({ setting, styles, builderAttrs, style, children })=>{
|
|
9
|
-
const { priority, vw, image } = setting ?? {};
|
|
10
|
-
const sizes = [];
|
|
11
|
-
const desktop = getResponsiveValueByScreen(vw, 'desktop');
|
|
12
|
-
const tablet = getResponsiveValueByScreen(vw, 'tablet');
|
|
13
|
-
const mobile = getResponsiveValueByScreen(vw, 'mobile');
|
|
14
|
-
const originalAspect = useMemo(()=>{
|
|
15
|
-
if (image?.width && image?.height) {
|
|
16
|
-
return `${image.width}/${image.height}`;
|
|
17
|
-
}
|
|
18
|
-
return undefined;
|
|
19
|
-
}, [
|
|
20
|
-
image?.height,
|
|
21
|
-
image?.width
|
|
22
|
-
]);
|
|
23
|
-
const getAspectByScreen = useCallback((screen)=>{
|
|
24
|
-
switch(screen){
|
|
25
|
-
case 'tablet':
|
|
26
|
-
return styles?.aspectRatio?.tablet === 'custom' ? `${getResponsiveValueByScreen(styles?.aspectWidth, screen)}/${getResponsiveValueByScreen(styles?.aspectHeight, screen)}` : styles?.aspectRatio?.tablet === 'auto' ? originalAspect : styles?.aspectRatio?.tablet;
|
|
27
|
-
case 'mobile':
|
|
28
|
-
return styles?.aspectRatio?.mobile === 'custom' ? `${getResponsiveValueByScreen(styles?.aspectWidth, screen)}/${getResponsiveValueByScreen(styles?.aspectHeight, screen)}` : styles?.aspectRatio?.mobile === 'auto' ? originalAspect : styles?.aspectRatio?.mobile;
|
|
29
|
-
default:
|
|
30
|
-
return styles?.aspectRatio?.desktop === 'custom' ? `${getResponsiveValueByScreen(styles?.aspectWidth, screen)}/${getResponsiveValueByScreen(styles?.aspectHeight, screen)}` : styles?.aspectRatio?.desktop === 'auto' ? originalAspect : styles?.aspectRatio?.desktop;
|
|
31
|
-
}
|
|
32
|
-
}, [
|
|
33
|
-
originalAspect,
|
|
34
|
-
styles?.aspectHeight,
|
|
35
|
-
styles?.aspectRatio?.desktop,
|
|
36
|
-
styles?.aspectRatio?.mobile,
|
|
37
|
-
styles?.aspectRatio?.tablet,
|
|
38
|
-
styles?.aspectWidth
|
|
39
|
-
]);
|
|
40
|
-
const aspectRatio = useMemo(()=>({
|
|
41
|
-
desktop: getAspectByScreen('desktop'),
|
|
42
|
-
tablet: getAspectByScreen('tablet'),
|
|
43
|
-
mobile: getAspectByScreen('mobile')
|
|
44
|
-
}), [
|
|
45
|
-
getAspectByScreen
|
|
46
|
-
]);
|
|
47
|
-
const opacity = {
|
|
48
|
-
normal: styles?.opacity?.normal !== undefined ? styles?.opacity?.normal / 100 : undefined,
|
|
49
|
-
hover: styles?.opacity?.hover !== undefined ? styles?.opacity?.hover / 100 : undefined,
|
|
50
|
-
focus: styles?.opacity?.focus !== undefined ? styles?.opacity?.focus / 100 : undefined
|
|
51
|
-
};
|
|
52
|
-
if (mobile) {
|
|
53
|
-
sizes.push(`(max-width: 767px) ${Math.round(100 / mobile)}vw`);
|
|
54
|
-
}
|
|
55
|
-
if (tablet) {
|
|
56
|
-
sizes.push(`(max-width: 1024px) ${Math.round(100 / tablet)}vw`);
|
|
57
|
-
}
|
|
58
|
-
if (desktop) {
|
|
59
|
-
sizes.push(`${Math.round(100 / desktop)}vw`);
|
|
60
|
-
} else {
|
|
61
|
-
sizes.push(`100vw`);
|
|
62
|
-
}
|
|
63
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
64
|
-
...builderAttrs,
|
|
65
|
-
className: "gp-relative",
|
|
66
|
-
style: {
|
|
67
|
-
...composeRadius(styles?.rounded),
|
|
68
|
-
...getStyleShadowState(styles?.boxShadow, 'box-shadow', styles?.hasBoxShadow),
|
|
69
|
-
...makeStyleResponsive('ta', styles?.align),
|
|
70
|
-
...makeStyleResponsive('aspect', aspectRatio)
|
|
71
|
-
},
|
|
72
|
-
children: [
|
|
73
|
-
/*#__PURE__*/ jsx(Image, {
|
|
74
|
-
className: "gp-z-[-2]",
|
|
75
|
-
loading: priority ? 'eager' : 'lazy',
|
|
76
|
-
src: image?.src ?? 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png',
|
|
77
|
-
priority: priority,
|
|
78
|
-
alt: setting?.alt ?? 'Image',
|
|
79
|
-
title: setting?.title,
|
|
80
|
-
sizes: sizes.join(', '),
|
|
81
|
-
style: {
|
|
82
|
-
...makeStyleResponsive('objf', styles?.layout),
|
|
83
|
-
...style
|
|
84
|
-
}
|
|
85
|
-
}),
|
|
86
|
-
/*#__PURE__*/ jsx("div", {
|
|
87
|
-
className: cls('gp-absolute gp-inset-0 gp-z-[-1] gp-transition-opacity', getGlobalColorStateClass('bg', styles?.opacityColor)),
|
|
88
|
-
style: {
|
|
89
|
-
...getGlobalColorStateStyle('bgc', styles?.opacityColor),
|
|
90
|
-
...makeStyleState('op', opacity)
|
|
91
|
-
}
|
|
92
|
-
}),
|
|
93
|
-
isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
|
|
94
|
-
]
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export { BgImage as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { makeStyleResponsiveState, makeStyleResponsive } from '@gem-sdk/core';
|
|
4
|
-
|
|
5
|
-
const Img = ({ layout, borderRadius, aspectRatio, image, alt, style, ...props })=>{
|
|
6
|
-
return /*#__PURE__*/ jsx("img", {
|
|
7
|
-
...props,
|
|
8
|
-
src: image?.src,
|
|
9
|
-
alt: alt,
|
|
10
|
-
style: {
|
|
11
|
-
...style,
|
|
12
|
-
...makeStyleResponsiveState('radius', borderRadius),
|
|
13
|
-
...makeStyleResponsive('aspect', aspectRatio),
|
|
14
|
-
...makeStyleResponsive('objf', layout)
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
Img.defaultProps = {
|
|
19
|
-
layout: {
|
|
20
|
-
desktop: 'cover'
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { Img as default };
|