@gem-sdk/components 21.2.0 → 21.2.1

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),i=require("../../../helpers.js"),t=require("../../../text/components/Text.liquid.js"),a=require("@gem-sdk/system"),s=require("./common/classes.js"),r=require("./common/styles.js"),n=require("../../settings/product-discount-tag/configs/translate.js");exports.default=({setting:p,styles:c,builderProps:d,advanced:l,pageContext:o})=>{let{customContent:u}=p??{},g=p?.moneyWithCurrentFormat?"money_with_currency":"money",f=n.ProductTag?.customContent?.id?i.getDynamicSourceLocales({val:u?.prefix,uid:d?.uid,settingId:i.createSettingId({id:n.ProductTag.customContent.id,suffix:"prefix"}),isLiquid:!0,pageContext:o??{}}):u?.prefix,y=n.ProductTag?.customContent?.id?i.getDynamicSourceLocales({val:u?.suffix,uid:d?.uid,settingId:i.createSettingId({id:n.ProductTag.customContent.id,suffix:"suffix"}),isLiquid:!0,pageContext:o??{}}):u?.suffix,m=a.createStyle(r.getRootClass(c)),v=a.createStyle(r.getWrapperTextStyle(c)),x=a.createStyle(r.getContainerStyle(c)),S=a.createClass(s.getWrapperTextClass(c)),$=a.createClass(s.getContainerClass()),P=a.createClass(s.getProductTagClass(l)),C=u?.unit==="percentage";return e.template`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),i=require("../../../helpers.js"),t=require("../../../text/components/Text.liquid.js"),s=require("@gem-sdk/system"),a=require("./common/classes.js"),r=require("./common/styles.js"),n=require("../../settings/product-discount-tag/configs/translate.js");exports.default=({setting:p,styles:c,builderProps:d,advanced:l,pageContext:o})=>{let{customContent:u}=p??{},g=p?.moneyWithCurrentFormat?"money_with_currency":"money",f=n.ProductTag?.customContent?.id?i.getDynamicSourceLocales({val:u?.prefix,uid:d?.uid,settingId:i.createSettingId({id:n.ProductTag.customContent.id,suffix:"prefix"}),isLiquid:!0,pageContext:o??{}}):u?.prefix,y=n.ProductTag?.customContent?.id?i.getDynamicSourceLocales({val:u?.suffix,uid:d?.uid,settingId:i.createSettingId({id:n.ProductTag.customContent.id,suffix:"suffix"}),isLiquid:!0,pageContext:o??{}}):u?.suffix,m=s.createStyle(r.getRootClass(c)),v=s.createStyle(r.getWrapperTextStyle(c)),x=s.createStyle(r.getContainerStyle(c)),S=s.createClass(a.getWrapperTextClass(c)),$=s.createClass(a.getContainerClass()),P=s.createClass(a.getProductTagClass(l)),C=u?.unit==="percentage";return e.template`
2
2
  {% liquid
3
3
  assign price = variant.price | times: 1.0
4
4
  assign salePrice = variant.compare_at_price | times: 1.0
@@ -6,8 +6,8 @@
6
6
  assign prefixVal = ${o?.isPreviewing?JSON.stringify(f):f}
7
7
  assign suffixVal = ${o?.isPreviewing?JSON.stringify(y):y}
8
8
  %}
9
- ${a.LiquidIf("salePrice == null or price == null",a.Liquid(`{% assign pricePercentage = prefixVal ${a.If(C,"| append: ' 0% '",`| ${g} | append: ' '`)} | append: suffixVal %}`),`${a.If(C,`{% assign salePercent = priceSave | divided_by: salePrice | times: 100 | round %}
10
- {% assign pricePercentage = prefixVal | append: ' ' | append: salePercent | append: '% ' | append: suffixVal %}`,a.LiquidIf("priceSave > 0",`{% assign priceSaveMoney = priceSave | ${g} %}
9
+ ${s.LiquidIf("salePrice == null or price == null",s.Liquid(`{% assign pricePercentage = prefixVal ${s.If(C,"| append: ' 0% '",`| ${g} | append: ' '`)} | append: suffixVal %}`),`${s.If(C,`{% assign salePercent = priceSave | divided_by: salePrice | times: 100 | round %}
10
+ {% assign pricePercentage = prefixVal | append: ' ' | append: salePercent | append: '% ' | append: suffixVal %}`,s.LiquidIf("priceSave > 0",`{% assign priceSaveMoney = priceSave | ${g} %}
11
11
  {% assign pricePercentage = prefixVal | append: ' ' | append: priceSaveMoney | append: ' ' | append: suffixVal %}`,`{% assign priceSaveMoney = 0 | ${g} %}
12
12
  {% assign pricePercentage = prefixVal | append: ' ' | append: priceSaveMoney | append: ' ' | append: suffixVal %}`))}`)}
13
13
 
@@ -15,10 +15,10 @@
15
15
  class="${P}"
16
16
  style="${m}"
17
17
  data-id="${d?.uid}"
18
- data-disabled="${a.LiquidIf(`${a.If(C,"salePercent","priceSave")} > 0`,"false","true")}"
18
+ data-disabled="${s.LiquidIf(`${s.If(C,"salePercent","priceSave")} > 0`,"false","true")}"
19
19
  price-save="{{priceSave}}"
20
20
  >
21
- <script gp-data type="application/json">{"setting":${JSON.stringify(p).replaceAll("'","&#039;")}, "id": "${d?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": "{{ ${p?.moneyWithCurrentFormat?"shop.money_with_currency_format":"shop.money_format"} | replace: '"', '\\"' | escape }}"}</script>
21
+ <script gp-data type="application/json">{"setting":${JSON.stringify(p).replaceAll("'","&#039;")}, "id": "${d?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": {{ ${p?.moneyWithCurrentFormat?"shop.money_with_currency_format":"shop.money_format"} | json }}}</script>
22
22
  <div class="${$}" style="${x}">
23
23
  <div class="${S}" style="${v}">
24
24
  ${t.default({styles:c,id:`p-tag-${d?.uid}`,setting:{...p,text:"{{ pricePercentage }}",excludeFlex:!0,isForceValue:!0}})}
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),r=require("../../../helpers.js"),t=require("../../../text/components/Text.liquid.js"),s=require("@gem-sdk/system"),c=require("./common/classes.js"),p=require("./common/attrs.js"),o=require("./common/helpers.js");const a=a=>{let{style:i,setting:l,builderProps:u,pageContext:n}=a,d=s.createClass(c.getWrapperClasses(a)),m=s.createAttr(p.getAttrs(a)),y=o.getTextProps(a),g=s.createStateOrContext({priceType:l?.priceType,uid:u?.uid,locale:"{{shop.locale}}",currency:"{{shop.currency}}",moneyFormat:`{{ ${n?.showPriceCurrency?"shop.money_with_currency_format":"shop.money_format"} | replace: '"', '\\"' | escape }}`});return s.Liquid(e.template`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),r=require("../../../helpers.js"),t=require("../../../text/components/Text.liquid.js"),s=require("@gem-sdk/system"),c=require("./common/classes.js"),o=require("./common/attrs.js"),p=require("./common/helpers.js");const i=i=>{let{style:a,setting:l,builderProps:u,pageContext:n}=i,d=s.createClass(c.getWrapperClasses(i)),m=s.createAttr(o.getAttrs(i)),y=p.getTextProps(i),g=s.createStateOrContext({priceType:l?.priceType,uid:u?.uid,locale:"{{shop.locale}}",currency:"{{shop.currency}}"}),$=`"moneyFormat":{{ ${n?.showPriceCurrency?"shop.money_with_currency_format":"shop.money_format"} | json }}`,j=`${e.dataStringify(g).slice(0,-1)},${$}}`;return s.Liquid(e.template`
2
2
  <gp-product-price
3
3
  ${m}
4
4
  class="${d}"
5
- style="${i}"
5
+ style="${a}"
6
6
  >
7
- <script gp-data type="application/json">${e.dataStringify(g)}</script>
7
+ <script gp-data type="application/json">${j}</script>
8
8
  ${t.default({...y})}
9
9
  </gp-product-price>
10
10
  ${(()=>{let t=e.isLocalEnv?"{{ 'gp-product-price-v7-5.js' | asset_url }}":`${e.baseAssetURL}/assets-v2/gp-product-price-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${r.getSettingPreloadData('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`})()}
11
- `)};exports.ProductPrice=a,exports.default=a;
11
+ `)};exports.ProductPrice=i,exports.default=i;
@@ -1,4 +1,4 @@
1
- import{template as e,baseAssetURL as i,isLocalEnv as s}from"@gem-sdk/core";import{getDynamicSourceLocales as a,createSettingId as r,getSettingPreloadData as t}from"../../../helpers.js";import p from"../../../text/components/Text.liquid.js";import{createStyle as n,createClass as c,LiquidIf as o,Liquid as d,If as l}from"@gem-sdk/system";import{getWrapperTextClass as u,getContainerClass as g,getProductTagClass as f}from"./common/classes.js";import{getRootClass as m,getWrapperTextStyle as v,getContainerStyle as x}from"./common/styles.js";import{ProductTag as y}from"../../settings/product-discount-tag/configs/translate.js";let $=({setting:$,styles:S,builderProps:P,advanced:V,pageContext:_})=>{let{customContent:h}=$??{},j=$?.moneyWithCurrentFormat?"money_with_currency":"money",C=y?.customContent?.id?a({val:h?.prefix,uid:P?.uid,settingId:r({id:y.customContent.id,suffix:"prefix"}),isLiquid:!0,pageContext:_??{}}):h?.prefix,F=y?.customContent?.id?a({val:h?.suffix,uid:P?.uid,settingId:r({id:y.customContent.id,suffix:"suffix"}),isLiquid:!0,pageContext:_??{}}):h?.suffix,M=n(m(S)),q=n(v(S)),w=n(x(S)),E=c(u(S)),N=c(g()),O=c(f(V)),T=h?.unit==="percentage";return e`
1
+ import{template as e,baseAssetURL as i,isLocalEnv as s}from"@gem-sdk/core";import{getDynamicSourceLocales as a,createSettingId as t,getSettingPreloadData as r}from"../../../helpers.js";import p from"../../../text/components/Text.liquid.js";import{createStyle as n,createClass as c,LiquidIf as o,Liquid as d,If as l}from"@gem-sdk/system";import{getWrapperTextClass as u,getContainerClass as g,getProductTagClass as f}from"./common/classes.js";import{getRootClass as m,getWrapperTextStyle as v,getContainerStyle as x}from"./common/styles.js";import{ProductTag as y}from"../../settings/product-discount-tag/configs/translate.js";let $=({setting:$,styles:S,builderProps:P,advanced:V,pageContext:_})=>{let{customContent:h}=$??{},j=$?.moneyWithCurrentFormat?"money_with_currency":"money",C=y?.customContent?.id?a({val:h?.prefix,uid:P?.uid,settingId:t({id:y.customContent.id,suffix:"prefix"}),isLiquid:!0,pageContext:_??{}}):h?.prefix,F=y?.customContent?.id?a({val:h?.suffix,uid:P?.uid,settingId:t({id:y.customContent.id,suffix:"suffix"}),isLiquid:!0,pageContext:_??{}}):h?.suffix,M=n(m(S)),q=n(v(S)),w=n(x(S)),E=c(u(S)),N=c(g()),O=c(f(V)),T=h?.unit==="percentage";return e`
2
2
  {% liquid
3
3
  assign price = variant.price | times: 1.0
4
4
  assign salePrice = variant.compare_at_price | times: 1.0
@@ -18,7 +18,7 @@ import{template as e,baseAssetURL as i,isLocalEnv as s}from"@gem-sdk/core";impor
18
18
  data-disabled="${o(`${l(T,"salePercent","priceSave")} > 0`,"false","true")}"
19
19
  price-save="{{priceSave}}"
20
20
  >
21
- <script gp-data type="application/json">{"setting":${JSON.stringify($).replaceAll("'","&#039;")}, "id": "${P?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": "{{ ${$?.moneyWithCurrentFormat?"shop.money_with_currency_format":"shop.money_format"} | replace: '"', '\\"' | escape }}"}</script>
21
+ <script gp-data type="application/json">{"setting":${JSON.stringify($).replaceAll("'","&#039;")}, "id": "${P?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": {{ ${$?.moneyWithCurrentFormat?"shop.money_with_currency_format":"shop.money_format"} | json }}}</script>
22
22
  <div class="${N}" style="${w}">
23
23
  <div class="${E}" style="${q}">
24
24
  ${p({styles:S,id:`p-tag-${P?.uid}`,setting:{...$,text:"{{ pricePercentage }}",excludeFlex:!0,isForceValue:!0}})}
@@ -26,5 +26,5 @@ import{template as e,baseAssetURL as i,isLocalEnv as s}from"@gem-sdk/core";impor
26
26
  </div>
27
27
 
28
28
  </gp-product-tag>
29
- ${(()=>{let e=s?"{{ 'gp-product-tag-v7-5.js' | asset_url }}":`${i}/assets-v2/gp-product-tag-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${t('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`})()}
29
+ ${(()=>{let e=s?"{{ 'gp-product-tag-v7-5.js' | asset_url }}":`${i}/assets-v2/gp-product-tag-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${r('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`})()}
30
30
  `};export{$ as default};
@@ -1,11 +1,11 @@
1
- import{dataStringify as r,template as e,baseAssetURL as o,isLocalEnv as s}from"@gem-sdk/core";import{getSettingPreloadData as p}from"../../../helpers.js";import t from"../../../text/components/Text.liquid.js";import{createClass as c,createAttr as m,createStateOrContext as i,Liquid as a}from"@gem-sdk/system";import{getWrapperClasses as l}from"./common/classes.js";import{getAttrs as d}from"./common/attrs.js";import{getTextProps as n}from"./common/helpers.js";let u=u=>{let{style:f,setting:y,builderProps:$,pageContext:h}=u,g=c(l(u)),j=m(d(u)),P=n(u),_=i({priceType:y?.priceType,uid:$?.uid,locale:"{{shop.locale}}",currency:"{{shop.currency}}",moneyFormat:`{{ ${h?.showPriceCurrency?"shop.money_with_currency_format":"shop.money_format"} | replace: '"', '\\"' | escape }}`});return a(e`
1
+ import{dataStringify as r,template as e,baseAssetURL as o,isLocalEnv as s}from"@gem-sdk/core";import{getSettingPreloadData as t}from"../../../helpers.js";import p from"../../../text/components/Text.liquid.js";import{createClass as c,createAttr as m,createStateOrContext as i,Liquid as l}from"@gem-sdk/system";import{getWrapperClasses as a}from"./common/classes.js";import{getAttrs as n}from"./common/attrs.js";import{getTextProps as d}from"./common/helpers.js";let u=u=>{let{style:f,setting:y,builderProps:$,pageContext:h}=u,j=c(a(u)),g=m(n(u)),P=d(u),_=i({priceType:y?.priceType,uid:$?.uid,locale:"{{shop.locale}}",currency:"{{shop.currency}}"}),S=`"moneyFormat":{{ ${h?.showPriceCurrency?"shop.money_with_currency_format":"shop.money_format"} | json }}`,v=`${r(_).slice(0,-1)},${S}}`;return l(e`
2
2
  <gp-product-price
3
- ${j}
4
- class="${g}"
3
+ ${g}
4
+ class="${j}"
5
5
  style="${f}"
6
6
  >
7
- <script gp-data type="application/json">${r(_)}</script>
8
- ${t({...P})}
7
+ <script gp-data type="application/json">${v}</script>
8
+ ${p({...P})}
9
9
  </gp-product-price>
10
- ${(()=>{let r=s?"{{ 'gp-product-price-v7-5.js' | asset_url }}":`${o}/assets-v2/gp-product-price-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${p('class="gps-link" delay',"src")}="${r}" defer="defer"></script>`})()}
10
+ ${(()=>{let r=s?"{{ 'gp-product-price-v7-5.js' | asset_url }}":`${o}/assets-v2/gp-product-price-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${t('class="gps-link" delay',"src")}="${r}" defer="defer"></script>`})()}
11
11
  `)};export{u as ProductPrice,u as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "21.2.0",
3
+ "version": "21.2.1",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",