@gem-sdk/components 16.0.2 → 16.0.3
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 core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers=require("../../../helpers.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers=require("../../../helpers.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const Button=({setting:s,advanced:e,styles:t,builderProps:a,className:i=""})=>{let l=system.createClass({...!!i&&{[i]:!0},...classes.getButtonClasses({styles:t,uid:a?.uid})}),r=styles.getButtonStyles({styles:t,uid:a?.uid}),o=system.createStateOrContext({setting:{label:s?.label},totalVariant:"{{total_combinations}}"});return core.template`
|
|
2
2
|
${system.Liquid("{%- assign total_combinations = 1 -%}")}
|
|
3
3
|
${system.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
4
4
|
${system.Liquid(`
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
assign supported_payment_methods = shop.enabled_payment_types
|
|
8
8
|
-%}
|
|
9
9
|
`)}
|
|
10
|
-
<gp-product-dynamic data-id="${
|
|
10
|
+
<gp-product-dynamic data-id="${a?.uid}" data-translate-label='${s?.label}' class="${e?.cssClass}" gp-data='${JSON.stringify(o).replaceAll("'","'")}
|
|
11
11
|
'>
|
|
12
|
-
<div class="${
|
|
12
|
+
<div class="${l}">
|
|
13
13
|
{{ form | payment_button }}
|
|
14
14
|
</div>
|
|
15
15
|
{% style %}
|
|
16
|
-
${
|
|
16
|
+
${r}
|
|
17
17
|
{% endstyle %}
|
|
18
18
|
</gp-product-dynamic>
|
|
19
19
|
${system.If(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-dynamic-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-dynamic-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{template as t,isLocalEnv as s,baseAssetURL as a}from"@gem-sdk/core";import{createClass as i,createStateOrContext as e,Liquid as o,LiquidFor as n,If as l}from"@gem-sdk/system";import{
|
|
1
|
+
import{template as t,isLocalEnv as s,baseAssetURL as a}from"@gem-sdk/core";import{createClass as i,createStateOrContext as e,Liquid as o,LiquidFor as n,If as l}from"@gem-sdk/system";import{getSettingPreloadData as r}from"../../../helpers.js";import{getButtonClasses as d}from"./common/classes.js";import{getButtonStyles as p}from"./common/styles.js";let Button=({setting:m,advanced:c,styles:u,builderProps:y,className:g=""})=>{let _=i({...!!g&&{[g]:!0},...d({styles:u,uid:y?.uid})}),f=p({styles:u,uid:y?.uid}),$=e({setting:{label:m?.label},totalVariant:"{{total_combinations}}"});return t`
|
|
2
2
|
${o("{%- assign total_combinations = 1 -%}")}
|
|
3
3
|
${n("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
4
4
|
${o(`
|
|
@@ -7,14 +7,14 @@ import{template as t,isLocalEnv as s,baseAssetURL as a}from"@gem-sdk/core";impor
|
|
|
7
7
|
assign supported_payment_methods = shop.enabled_payment_types
|
|
8
8
|
-%}
|
|
9
9
|
`)}
|
|
10
|
-
<gp-product-dynamic data-id="${
|
|
10
|
+
<gp-product-dynamic data-id="${y?.uid}" data-translate-label='${m?.label}' class="${c?.cssClass}" gp-data='${JSON.stringify($).replaceAll("'","'")}
|
|
11
11
|
'>
|
|
12
|
-
<div class="${
|
|
12
|
+
<div class="${_}">
|
|
13
13
|
{{ form | payment_button }}
|
|
14
14
|
</div>
|
|
15
15
|
{% style %}
|
|
16
|
-
${
|
|
16
|
+
${f}
|
|
17
17
|
{% endstyle %}
|
|
18
18
|
</gp-product-dynamic>
|
|
19
|
-
${l(s,`<script ${
|
|
19
|
+
${l(s,`<script ${r('class="gps-link" delay',"src")}="{{ 'gp-product-dynamic-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${r('class="gps-link" delay',"src")}="${a}/assets-v2/gp-product-dynamic-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
20
20
|
`};export{Button as default};
|