@gem-sdk/components 21.1.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.
- package/dist/cjs/product/components/product-discount-tag/ProductDiscountTag.liquid.js +5 -5
- package/dist/cjs/product/components/product-price/ProductPrice.liquid.js +4 -4
- package/dist/esm/product/components/product-discount-tag/ProductDiscountTag.liquid.js +3 -3
- package/dist/esm/product/components/product-price/ProductPrice.liquid.js +6 -6
- package/package.json +1 -1
|
@@ -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"),
|
|
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
|
-
${
|
|
10
|
-
{% assign pricePercentage = prefixVal | append: ' ' | append: salePercent | append: '% ' | append: suffixVal %}`,
|
|
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="${
|
|
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("'","'")}, "id": "${d?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat":
|
|
21
|
+
<script gp-data type="application/json">{"setting":${JSON.stringify(p).replaceAll("'","'")}, "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"),
|
|
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="${
|
|
5
|
+
style="${a}"
|
|
6
6
|
>
|
|
7
|
-
<script gp-data type="application/json">${
|
|
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=
|
|
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
|
|
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("'","'")}, "id": "${P?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat":
|
|
21
|
+
<script gp-data type="application/json">{"setting":${JSON.stringify($).replaceAll("'","'")}, "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 ${
|
|
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
|
|
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
|
-
${
|
|
4
|
-
class="${
|
|
3
|
+
${g}
|
|
4
|
+
class="${j}"
|
|
5
5
|
style="${f}"
|
|
6
6
|
>
|
|
7
|
-
<script gp-data type="application/json">${
|
|
8
|
-
${
|
|
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 ${
|
|
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};
|