@gem-sdk/components 2.1.27-staging.11 → 2.1.27-staging.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/collection/components/CollectionPaginator.liquid.js +1 -1
- package/dist/cjs/collection/setting/CollectionPaginator.js +5 -0
- package/dist/cjs/product/components/ProductTag.js +9 -1
- package/dist/esm/collection/components/CollectionPaginator.liquid.js +1 -1
- package/dist/esm/collection/setting/CollectionPaginator.js +5 -0
- package/dist/esm/product/components/ProductTag.js +10 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ var helpers = require('../../helpers.js');
|
|
|
7
7
|
|
|
8
8
|
const CollectionPaginator = ({ setting, builderProps, pageContext })=>{
|
|
9
9
|
const { layout, previousText, nextText, typographyPaginator, normalColor, activeColor, align, typo, translate } = setting ?? {};
|
|
10
|
-
const numberOfProductOfProductList = pageContext?.numberOfProductOfProductList || 0;
|
|
10
|
+
const numberOfProductOfProductList = setting?.numberOfProducts || pageContext?.numberOfProductOfProductList || 0;
|
|
11
11
|
const limit = numberOfProductOfProductList > 0 ? numberOfProductOfProductList : 4;
|
|
12
12
|
const appendTypoClass = core.composeTypographyClassName(typo, typographyPaginator);
|
|
13
13
|
const appendTypoStyle = core.composeTypographyStyle(typo, typographyPaginator);
|
|
@@ -18,9 +18,17 @@ const ProductTag = ({ setting, styles, builderProps, ...passProps })=>{
|
|
|
18
18
|
const mode = core.useEditorMode();
|
|
19
19
|
const product = core.useProduct();
|
|
20
20
|
const currentVariant = core.useCurrentVariant();
|
|
21
|
+
const { quantity, hasUpdatePrice } = core.useQuantity();
|
|
22
|
+
const quantityProduct = React.useMemo(()=>{
|
|
23
|
+
return hasUpdatePrice && customContent?.unit !== 'percentage' ? quantity || 1 : 1;
|
|
24
|
+
}, [
|
|
25
|
+
hasUpdatePrice,
|
|
26
|
+
customContent?.unit,
|
|
27
|
+
quantity
|
|
28
|
+
]);
|
|
21
29
|
const price = currentVariant?.price ?? 0;
|
|
22
30
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
23
|
-
const priceSave = salePrice - price;
|
|
31
|
+
const priceSave = (salePrice - price) * quantityProduct;
|
|
24
32
|
const moneyFormatted = core.useFormatMoney(priceSave < 0 ? 0 : priceSave, setting?.moneyWithCurrentFormat || false);
|
|
25
33
|
const customDisplayWithUnit = React.useMemo(()=>{
|
|
26
34
|
if (!salePrice && salePrice !== 0 || !price && price !== 0) return `${customContent?.unit === 'percentage' ? '0%' : moneyFormatted}`;
|
|
@@ -3,7 +3,7 @@ import { getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js
|
|
|
3
3
|
|
|
4
4
|
const CollectionPaginator = ({ setting, builderProps, pageContext })=>{
|
|
5
5
|
const { layout, previousText, nextText, typographyPaginator, normalColor, activeColor, align, typo, translate } = setting ?? {};
|
|
6
|
-
const numberOfProductOfProductList = pageContext?.numberOfProductOfProductList || 0;
|
|
6
|
+
const numberOfProductOfProductList = setting?.numberOfProducts || pageContext?.numberOfProductOfProductList || 0;
|
|
7
7
|
const limit = numberOfProductOfProductList > 0 ? numberOfProductOfProductList : 4;
|
|
8
8
|
const appendTypoClass = composeTypographyClassName(typo, typographyPaginator);
|
|
9
9
|
const appendTypoStyle = composeTypographyStyle(typo, typographyPaginator);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useMoneyFormat, makeGlobalSize, useEditorMode, useProduct, useCurrentVariant, useFormatMoney, useProductBundleDiscount, formatMoney, getGlobalColorClass, cls, makeStyleResponsive, makeStyle, getRadiusCSSFromGlobal, getCustomRadius } from '@gem-sdk/core';
|
|
2
|
+
import { useMoneyFormat, makeGlobalSize, useEditorMode, useProduct, useCurrentVariant, useQuantity, useFormatMoney, useProductBundleDiscount, formatMoney, getGlobalColorClass, cls, makeStyleResponsive, makeStyle, getRadiusCSSFromGlobal, getCustomRadius } from '@gem-sdk/core';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import Text from '../../text/components/Text.js';
|
|
5
5
|
import { DiscountType } from './constants/product-bundle.js';
|
|
@@ -14,9 +14,17 @@ const ProductTag = ({ setting, styles, builderProps, ...passProps })=>{
|
|
|
14
14
|
const mode = useEditorMode();
|
|
15
15
|
const product = useProduct();
|
|
16
16
|
const currentVariant = useCurrentVariant();
|
|
17
|
+
const { quantity, hasUpdatePrice } = useQuantity();
|
|
18
|
+
const quantityProduct = useMemo(()=>{
|
|
19
|
+
return hasUpdatePrice && customContent?.unit !== 'percentage' ? quantity || 1 : 1;
|
|
20
|
+
}, [
|
|
21
|
+
hasUpdatePrice,
|
|
22
|
+
customContent?.unit,
|
|
23
|
+
quantity
|
|
24
|
+
]);
|
|
17
25
|
const price = currentVariant?.price ?? 0;
|
|
18
26
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
19
|
-
const priceSave = salePrice - price;
|
|
27
|
+
const priceSave = (salePrice - price) * quantityProduct;
|
|
20
28
|
const moneyFormatted = useFormatMoney(priceSave < 0 ? 0 : priceSave, setting?.moneyWithCurrentFormat || false);
|
|
21
29
|
const customDisplayWithUnit = useMemo(()=>{
|
|
22
30
|
if (!salePrice && salePrice !== 0 || !price && price !== 0) return `${customContent?.unit === 'percentage' ? '0%' : moneyFormatted}`;
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.1.27-staging.
|
|
3
|
+
"version": "2.1.27-staging.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@gem-sdk/core": "2.1.27-staging.9",
|
|
25
|
-
"@gem-sdk/styles": "2.1.27-staging.
|
|
25
|
+
"@gem-sdk/styles": "2.1.27-staging.13",
|
|
26
26
|
"@types/react-transition-group": "^4.4.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|