@gem-sdk/components 17.0.0-dev.106 → 17.0.0-dev.107

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,23 +1,25 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/styles.js"),e=require("./common/helpers.js"),s=require("@gem-sdk/core"),a=require("@gem-sdk/system"),r=require("../../../helpers.js"),i=require("./helpers/getButtonDynamicSourceLocales.js"),o=require("./SoldOutButton.liquid.js"),n=require("./AddToCartButton.liquid.js");exports.default=l=>{let{setting:u,builderProps:c,style:d,styles:p,pageContext:g}=l,{wrapStyle:y,restStyle:m}=t.getSplitStyle(d),{outOfStockButtonLabel:b,unavailableButtonLabel:f,variantSelectionRequiredMessage:S,successMessage:q,errorMessage:v}=i.getButtonDynamicSourceLocales({setting:u,pageContext:g,builderProps:c}),{urlData:$}=r.getInsertLinkData("",u?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:u?.customURL),_=a.createStateOrContext(e.getGPProductButtonState({styles:p,setting:u,successMessage:q,errorMessage:v}));return s.template`
2
- ${a.Liquid("{%- assign total_combinations = 1 -%}")}
3
- ${a.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./common/styles.js"),t=require("./common/helpers.js"),s=require("@gem-sdk/core"),r=require("@gem-sdk/system"),a=require("../../../helpers.js"),o=require("./helpers/getButtonDynamicSourceLocales.js"),i=require("./SoldOutButton.liquid.js"),n=require("./AddToCartButton.liquid.js");exports.default=l=>{let{setting:u,builderProps:c,style:p,styles:d,pageContext:g}=l,{wrapStyle:m,restStyle:y}=e.getSplitStyle(p),{outOfStockButtonLabel:S,unavailableButtonLabel:b,variantSelectionRequiredMessage:f,successMessage:q,errorMessage:v}=o.getButtonDynamicSourceLocales({setting:u,pageContext:g,builderProps:c}),{urlData:$}=a.getInsertLinkData("",u?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:u?.customURL),_=r.createStateOrContext(t.getGPProductButtonState({styles:d,setting:u})),h=t.escapeSingleQuoteForAttr(q??u?.successMessage),j=t.escapeSingleQuoteForAttr(v??u?.errorMessage);return s.template`
2
+ ${r.Liquid("{%- assign total_combinations = 1 -%}")}
3
+ ${r.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
4
4
  {%- liquid
5
5
  assign inventory_quantity = variant.inventory_quantity | default: 0
6
6
  assign is_in_stock = variant.available
7
7
  -%}
8
8
  <gp-product-button
9
- style="${y}"
9
+ style="${m}"
10
10
  gp-data-wrapper="true"
11
11
  gp-href="${$.href}"
12
12
  class="gp-product-button"
13
- gp-label-out-of-stock="${b}"
14
- gp-label-unavailable="${f}"
13
+ gp-label-out-of-stock="${S}"
14
+ gp-label-unavailable="${b}"
15
15
  gp-data='${JSON.stringify(_)}'
16
- data-variant-selection-required-message="${S}"
16
+ data-variant-selection-required-message="${f}"
17
17
  gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
18
+ gp-error-message="${j}"
19
+ gp-success-message="${h}"
18
20
  >
19
- ${n.AddToCartButton({...l,style:m})}
20
- ${o.SoldOutButton({...l,style:m,label:b})}
21
+ ${n.AddToCartButton({...l,style:y})}
22
+ ${i.SoldOutButton({...l,style:y,label:S})}
21
23
  </gp-product-button>
22
- ${a.If(s.isLocalEnv,`<script ${r.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${r.getSettingPreloadData('class="gps-link" delay',"src")}="${s.baseAssetURL}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
24
+ ${r.If(s.isLocalEnv,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="${s.baseAssetURL}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
23
25
  `};
@@ -1 +1 @@
1
- "use strict";var e=require("./constants.js");const t=/^\s*\{\{[\s\S]*\}\}\s*$/,r=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),s=e=>{if(null==e)return e;let s=e.toString();return t.test(s)?r(s):s.replaceAll("'","&#39;").replaceAll("’","&#39;")},o=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);exports.checkIconVisibility=e=>e?.enableIcon===!0,exports.getGPProductButtonState=({styles:e,setting:t,successMessage:r,errorMessage:o})=>({styles:{errorTypo:e?.errorTypo,successTypo:e?.successTypo},setting:{errorType:t?.errorType,actionEffect:t?.actionEffect,enableMessage:t?.enableMessage,label:s(t?.label),errorMessage:s(o??t?.errorMessage),successMessage:s(r??t?.successMessage),outOfStockLabel:s(t?.outOfStockLabel),customURL:{link:s(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),exports.getRenderComparePriceSettings=e=>({lineThrough:!0,typo:o(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),exports.getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:o(e?.priceTypo)}),exports.renderSeparator=t=>({dot:e.SEPARATOR.DOT,"vertical-line":e.SEPARATOR.VERTICAL_LINE,"horizontal-line":e.SEPARATOR.HORIZONTAL_LINE})[t??"horizontal-line"]??e.SEPARATOR.HORIZONTAL_LINE;
1
+ "use strict";var e=require("./constants.js");const t=/^\s*\{\{[\s\S]*\}\}\s*$/,r=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),o=e=>{if(null==e)return e;let o=e.toString();return t.test(o)?r(o):o.replaceAll("'","&#39;").replaceAll("’","&#39;").replaceAll('"',"&quot;")},a=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);exports.checkIconVisibility=e=>e?.enableIcon===!0,exports.escapeSingleQuoteForAttr=o,exports.getGPProductButtonState=({styles:e,setting:t})=>({styles:{errorTypo:e?.errorTypo,successTypo:e?.successTypo},setting:{errorType:t?.errorType,actionEffect:t?.actionEffect,enableMessage:t?.enableMessage,label:o(t?.label),outOfStockLabel:o(t?.outOfStockLabel),customURL:{link:o(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),exports.getRenderComparePriceSettings=e=>({lineThrough:!0,typo:a(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),exports.getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:a(e?.priceTypo)}),exports.renderSeparator=t=>({dot:e.SEPARATOR.DOT,"vertical-line":e.SEPARATOR.VERTICAL_LINE,"horizontal-line":e.SEPARATOR.HORIZONTAL_LINE})[t??"horizontal-line"]??e.SEPARATOR.HORIZONTAL_LINE;
@@ -1,23 +1,25 @@
1
- import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as s}from"./common/helpers.js";import{template as e,isLocalEnv as o,baseAssetURL as r}from"@gem-sdk/core";import{createStateOrContext as a,Liquid as i,LiquidFor as n,If as l}from"@gem-sdk/system";import{getInsertLinkData as p,getSettingPreloadData as c}from"../../../helpers.js";import{getButtonDynamicSourceLocales as u}from"./helpers/getButtonDynamicSourceLocales.js";import{SoldOutButton as d}from"./SoldOutButton.liquid.js";import{AddToCartButton as m}from"./AddToCartButton.liquid.js";let f=f=>{let{setting:g,builderProps:b,style:y,styles:$,pageContext:v}=f,{wrapStyle:_,restStyle:h}=t(y),{outOfStockButtonLabel:S,unavailableButtonLabel:j,variantSelectionRequiredMessage:k,successMessage:E,errorMessage:q}=u({setting:g,pageContext:v,builderProps:b}),{urlData:A}=p("",g?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:g?.customURL),B=a(s({styles:$,setting:g,successMessage:E,errorMessage:q}));return e`
2
- ${i("{%- assign total_combinations = 1 -%}")}
3
- ${n("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
1
+ import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as s,escapeSingleQuoteForAttr as e}from"./common/helpers.js";import{template as r,isLocalEnv as o,baseAssetURL as a}from"@gem-sdk/core";import{createStateOrContext as i,Liquid as n,LiquidFor as l,If as p}from"@gem-sdk/system";import{getInsertLinkData as c,getSettingPreloadData as u}from"../../../helpers.js";import{getButtonDynamicSourceLocales as m}from"./helpers/getButtonDynamicSourceLocales.js";import{SoldOutButton as d}from"./SoldOutButton.liquid.js";import{AddToCartButton as g}from"./AddToCartButton.liquid.js";let f=f=>{let{setting:$,builderProps:b,style:y,styles:v,pageContext:_}=f,{wrapStyle:h,restStyle:S}=t(y),{outOfStockButtonLabel:j,unavailableButtonLabel:k,variantSelectionRequiredMessage:E,successMessage:q,errorMessage:A}=m({setting:$,pageContext:_,builderProps:b}),{urlData:B}=c("",$?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:$?.customURL),G=i(s({styles:v,setting:$})),M=e(q??$?.successMessage),P=e(A??$?.errorMessage);return r`
2
+ ${n("{%- assign total_combinations = 1 -%}")}
3
+ ${l("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
4
4
  {%- liquid
5
5
  assign inventory_quantity = variant.inventory_quantity | default: 0
6
6
  assign is_in_stock = variant.available
7
7
  -%}
8
8
  <gp-product-button
9
- style="${_}"
9
+ style="${h}"
10
10
  gp-data-wrapper="true"
11
- gp-href="${A.href}"
11
+ gp-href="${B.href}"
12
12
  class="gp-product-button"
13
- gp-label-out-of-stock="${S}"
14
- gp-label-unavailable="${j}"
15
- gp-data='${JSON.stringify(B)}'
16
- data-variant-selection-required-message="${k}"
13
+ gp-label-out-of-stock="${j}"
14
+ gp-label-unavailable="${k}"
15
+ gp-data='${JSON.stringify(G)}'
16
+ data-variant-selection-required-message="${E}"
17
17
  gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
18
+ gp-error-message="${P}"
19
+ gp-success-message="${M}"
18
20
  >
19
- ${m({...f,style:h})}
20
- ${d({...f,style:h,label:S})}
21
+ ${g({...f,style:S})}
22
+ ${d({...f,style:S,label:j})}
21
23
  </gp-product-button>
22
- ${l(o,`<script ${c('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${c('class="gps-link" delay',"src")}="${r}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
24
+ ${p(o,`<script ${u('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${u('class="gps-link" delay',"src")}="${a}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
23
25
  `};export{f as default};
@@ -1 +1 @@
1
- import{SEPARATOR as e}from"./constants.js";let t=/^\s*\{\{[\s\S]*\}\}\s*$/,r=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),o=e=>{if(null==e)return e;let o=e.toString();return t.test(o)?r(o):o.replaceAll("'","&#39;").replaceAll("’","&#39;")},a=e=>e?.enableIcon===!0,s=e=>({lineThrough:!1,typo:n(e?.priceTypo)}),l=e=>({lineThrough:!0,typo:n(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),c=({styles:e,setting:t,successMessage:r,errorMessage:a})=>({styles:{errorTypo:e?.errorTypo,successTypo:e?.successTypo},setting:{errorType:t?.errorType,actionEffect:t?.actionEffect,enableMessage:t?.enableMessage,label:o(t?.label),errorMessage:o(a??t?.errorMessage),successMessage:o(r??t?.successMessage),outOfStockLabel:o(t?.outOfStockLabel),customURL:{link:o(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),i=t=>({dot:e.DOT,"vertical-line":e.VERTICAL_LINE,"horizontal-line":e.HORIZONTAL_LINE})[t??"horizontal-line"]??e.HORIZONTAL_LINE,n=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);export{a as checkIconVisibility,c as getGPProductButtonState,l as getRenderComparePriceSettings,s as getRenderRegularPriceSettings,i as renderSeparator};
1
+ import{SEPARATOR as e}from"./constants.js";let t=/^\s*\{\{[\s\S]*\}\}\s*$/,r=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),o=e=>{if(null==e)return e;let o=e.toString();return t.test(o)?r(o):o.replaceAll("'","&#39;").replaceAll("’","&#39;").replaceAll('"',"&quot;")},a=e=>e?.enableIcon===!0,l=e=>({lineThrough:!1,typo:s(e?.priceTypo)}),i=e=>({lineThrough:!0,typo:s(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),c=({styles:e,setting:t})=>({styles:{errorTypo:e?.errorTypo,successTypo:e?.successTypo},setting:{errorType:t?.errorType,actionEffect:t?.actionEffect,enableMessage:t?.enableMessage,label:o(t?.label),outOfStockLabel:o(t?.outOfStockLabel),customURL:{link:o(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),n=t=>({dot:e.DOT,"vertical-line":e.VERTICAL_LINE,"horizontal-line":e.HORIZONTAL_LINE})[t??"horizontal-line"]??e.HORIZONTAL_LINE,s=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);export{a as checkIconVisibility,o as escapeSingleQuoteForAttr,c as getGPProductButtonState,i as getRenderComparePriceSettings,l as getRenderRegularPriceSettings,n as renderSeparator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "17.0.0-dev.106",
3
+ "version": "17.0.0-dev.107",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",