@gem-sdk/components 2.0.0-dev.697 → 2.0.0-dev.699

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.
@@ -3,13 +3,13 @@
3
3
  var core = require('@gem-sdk/core');
4
4
 
5
5
  const getTextProps = (props, text)=>{
6
- const { setting, styles, builderProps, classNames } = props;
6
+ const { setting, styles, builderProps, classNames, pageContext } = props;
7
7
  const isComparePrice = setting?.priceType === 'compare' || false;
8
8
  const colorClass = core.getGlobalColorClass('decoration', styles?.lineColor);
9
9
  const priceCompare = ()=>{
10
10
  return `
11
11
  {% if variant.compare_at_price %}
12
- {{ variant.compare_at_price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
12
+ {{ variant.compare_at_price | ${pageContext?.showPriceCurrency ? `money_with_currency` : `money`}}}
13
13
  {% else %}
14
14
 
15
15
  {% endif %}
@@ -18,7 +18,7 @@ const getTextProps = (props, text)=>{
18
18
  const defaultPrice = ()=>{
19
19
  return `
20
20
  {% if variant.price %}
21
- {{ variant.price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
21
+ {{ variant.price | ${pageContext?.showPriceCurrency ? `money_with_currency` : `money`}}}
22
22
  {% endif %}
23
23
  `;
24
24
  };
@@ -18,7 +18,7 @@ const useGpPrice = (props)=>{
18
18
  const { trigger } = core.useInteraction();
19
19
  const currentProduct = core.useProduct();
20
20
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
21
- const isUseCurrency = core.useShopStore((s)=>s.isUseCurrency);
21
+ const showPriceCurrency = core.useShopStore((s)=>s.showPriceCurrency);
22
22
  const quantityProduct = React.useMemo(()=>{
23
23
  if (bundleItem?.quantity) {
24
24
  return bundleItem.quantity;
@@ -111,7 +111,7 @@ const useGpPrice = (props)=>{
111
111
  });
112
112
  window.dispatchEvent(event);
113
113
  };
114
- const moneyFormatted = core.useFormatMoney(displayPrice ?? 0, isUseCurrency || false);
114
+ const moneyFormatted = core.useFormatMoney(displayPrice ?? 0, showPriceCurrency || false);
115
115
  const isNoComparePrice = isComparePrice && !displayPrice;
116
116
  const isNoComparePriceILP = mode !== 'edit' && isNoComparePrice;
117
117
  return {
@@ -11,7 +11,7 @@ var getAttr = require('./common/getAttr.js');
11
11
  var getTextData = require('./common/getTextData.js');
12
12
 
13
13
  const ProductPrice = (props)=>{
14
- const { style, setting, builderProps } = props;
14
+ const { style, setting, builderProps, pageContext } = props;
15
15
  const wrapperClasses = system.createClass(getClasses.getWrapperClasses(props));
16
16
  const wrapperAttrs = system.createAttr(getAttr.getAttrs(props));
17
17
  const textProps = getTextData.getTextProps(props);
@@ -20,7 +20,7 @@ const ProductPrice = (props)=>{
20
20
  uid: builderProps?.uid,
21
21
  locale: `{{shop.locale}}`,
22
22
  currency: `{{shop.currency}}`,
23
- moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
23
+ moneyFormat: `{{ ${pageContext?.showPriceCurrency ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
24
24
  });
25
25
  const renderScript = ()=>{
26
26
  const jsURL = core.isLocalEnv ? `{{ 'gp-product-price.js' | asset_url }}` : `${core.baseAssetURL}/assets-v2/gp-product-price.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
@@ -1,13 +1,13 @@
1
1
  import { getGlobalColorClass, cls } from '@gem-sdk/core';
2
2
 
3
3
  const getTextProps = (props, text)=>{
4
- const { setting, styles, builderProps, classNames } = props;
4
+ const { setting, styles, builderProps, classNames, pageContext } = props;
5
5
  const isComparePrice = setting?.priceType === 'compare' || false;
6
6
  const colorClass = getGlobalColorClass('decoration', styles?.lineColor);
7
7
  const priceCompare = ()=>{
8
8
  return `
9
9
  {% if variant.compare_at_price %}
10
- {{ variant.compare_at_price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
10
+ {{ variant.compare_at_price | ${pageContext?.showPriceCurrency ? `money_with_currency` : `money`}}}
11
11
  {% else %}
12
12
 
13
13
  {% endif %}
@@ -16,7 +16,7 @@ const getTextProps = (props, text)=>{
16
16
  const defaultPrice = ()=>{
17
17
  return `
18
18
  {% if variant.price %}
19
- {{ variant.price | ${setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`}}}
19
+ {{ variant.price | ${pageContext?.showPriceCurrency ? `money_with_currency` : `money`}}}
20
20
  {% endif %}
21
21
  `;
22
22
  };
@@ -16,7 +16,7 @@ const useGpPrice = (props)=>{
16
16
  const { trigger } = useInteraction();
17
17
  const currentProduct = useProduct();
18
18
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
19
- const isUseCurrency = useShopStore((s)=>s.isUseCurrency);
19
+ const showPriceCurrency = useShopStore((s)=>s.showPriceCurrency);
20
20
  const quantityProduct = useMemo(()=>{
21
21
  if (bundleItem?.quantity) {
22
22
  return bundleItem.quantity;
@@ -109,7 +109,7 @@ const useGpPrice = (props)=>{
109
109
  });
110
110
  window.dispatchEvent(event);
111
111
  };
112
- const moneyFormatted = useFormatMoney(displayPrice ?? 0, isUseCurrency || false);
112
+ const moneyFormatted = useFormatMoney(displayPrice ?? 0, showPriceCurrency || false);
113
113
  const isNoComparePrice = isComparePrice && !displayPrice;
114
114
  const isNoComparePriceILP = mode !== 'edit' && isNoComparePrice;
115
115
  return {
@@ -7,7 +7,7 @@ import { getAttrs } from './common/getAttr.js';
7
7
  import { getTextProps } from './common/getTextData.js';
8
8
 
9
9
  const ProductPrice = (props)=>{
10
- const { style, setting, builderProps } = props;
10
+ const { style, setting, builderProps, pageContext } = props;
11
11
  const wrapperClasses = createClass(getWrapperClasses(props));
12
12
  const wrapperAttrs = createAttr(getAttrs(props));
13
13
  const textProps = getTextProps(props);
@@ -16,7 +16,7 @@ const ProductPrice = (props)=>{
16
16
  uid: builderProps?.uid,
17
17
  locale: `{{shop.locale}}`,
18
18
  currency: `{{shop.currency}}`,
19
- moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
19
+ moneyFormat: `{{ ${pageContext?.showPriceCurrency ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
20
20
  });
21
21
  const renderScript = ()=>{
22
22
  const jsURL = isLocalEnv ? `{{ 'gp-product-price.js' | asset_url }}` : `${baseAssetURL}/assets-v2/gp-product-price.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
@@ -3501,6 +3501,7 @@ type ProductPriceProps = BasePropsWrap<{
3501
3501
  children?: ReactNode;
3502
3502
  classNames?: string;
3503
3503
  'bundle-item'?: bundleItem;
3504
+ pageContext?: PageContext;
3504
3505
  };
3505
3506
 
3506
3507
  type ProductButtonProps = BasePropsWrap<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.697",
3
+ "version": "2.0.0-dev.699",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "2.0.0-dev.697",
28
+ "@gem-sdk/core": "2.0.0-dev.699",
29
29
  "@gem-sdk/styles": "2.0.0-dev.695",
30
30
  "@gem-sdk/system": "2.0.0-dev.695",
31
31
  "@types/react-transition-group": "^4.4.5",