@gem-sdk/components 8.0.0 → 8.0.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,14 +1,16 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var styles=require("./common/styles.js"),helpers$1=require("./common/helpers.js"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers=require("../../../helpers.js"),getButtonDynamicSourceLocales=require("./helpers/getButtonDynamicSourceLocales.js"),SoldOutButton_liquid=require("./SoldOutButton.liquid.js"),AddToCartButton_liquid=require("./AddToCartButton.liquid.js");const ProductButton=t=>{let{setting:e,builderProps:r,style:s,styles:o,pageContext:a}=t,{wrapStyle:l,restStyle:u}=styles.getSplitStyle(s),{outOfStockButtonLabel:i,unavailableButtonLabel:n,variantSelectionRequiredMessage:c}=getButtonDynamicSourceLocales.getButtonDynamicSourceLocales({setting:e,pageContext:a,builderProps:r}),{urlData:d}=helpers.getInsertLinkData("",e?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:e?.customURL),p=system.createStateOrContext(helpers$1.getGPProductButtonState(o,e)),g=()=>AddToCartButton_liquid.AddToCartButton({...t,style:u}),y=()=>SoldOutButton_liquid.SoldOutButton({...t,style:u,label:i}),S=()=>system.If(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var styles=require("./common/styles.js"),helpers$1=require("./common/helpers.js"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers=require("../../../helpers.js"),getButtonDynamicSourceLocales=require("./helpers/getButtonDynamicSourceLocales.js"),SoldOutButton_liquid=require("./SoldOutButton.liquid.js"),AddToCartButton_liquid=require("./AddToCartButton.liquid.js");const ProductButton=t=>{let{setting:e,builderProps:s,style:r,styles:o,pageContext:a}=t,{wrapStyle:i,restStyle:l}=styles.getSplitStyle(r),{outOfStockButtonLabel:u,unavailableButtonLabel:n,variantSelectionRequiredMessage:c}=getButtonDynamicSourceLocales.getButtonDynamicSourceLocales({setting:e,pageContext:a,builderProps:s}),{urlData:d}=helpers.getInsertLinkData("",e?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:e?.customURL),p=system.createStateOrContext(helpers$1.getGPProductButtonState(o,e)),g=()=>AddToCartButton_liquid.AddToCartButton({...t,style:l}),y=()=>SoldOutButton_liquid.SoldOutButton({...t,style:l,label:u}),m=()=>system.If(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
2
+ ${system.Liquid("{%- assign total_combinations = 1 -%}")}
3
+ ${system.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
2
4
  {%- liquid
3
5
  assign inventory_quantity = variant.inventory_quantity | default: 0
4
6
  assign is_in_stock = variant.available
5
7
  -%}
6
8
  <gp-product-button
7
- style="${l}"
9
+ style="${i}"
8
10
  gp-data-wrapper="true"
9
11
  gp-href="${d.href}"
10
12
  class="gp-product-button"
11
- gp-label-out-of-stock="${i}"
13
+ gp-label-out-of-stock="${u}"
12
14
  gp-label-unavailable="${n}"
13
15
  gp-data='${JSON.stringify(p).replaceAll("'","&#039;")}'
14
16
  data-variant-selection-required-message="${c}"
@@ -16,5 +18,5 @@
16
18
  ${g()}
17
19
  ${y()}
18
20
  </gp-product-button>
19
- ${S()}
21
+ ${m()}
20
22
  `};exports.default=ProductButton;
@@ -1,20 +1,22 @@
1
- import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as r}from"./common/helpers.js";import{template as e,isLocalEnv as s,baseAssetURL as o}from"@gem-sdk/core";import{createStateOrContext as a,If as i}from"@gem-sdk/system";import{getInsertLinkData as l,getSettingPreloadData as p}from"../../../helpers.js";import{getButtonDynamicSourceLocales as n}from"./helpers/getButtonDynamicSourceLocales.js";import{SoldOutButton as u}from"./SoldOutButton.liquid.js";import{AddToCartButton as c}from"./AddToCartButton.liquid.js";let ProductButton=d=>{let{setting:m,builderProps:f,style:g,styles:y,pageContext:$}=d,{wrapStyle:v,restStyle:b}=t(g),{outOfStockButtonLabel:j,unavailableButtonLabel:S,variantSelectionRequiredMessage:k}=n({setting:m,pageContext:$,builderProps:f}),{urlData:_}=l("",m?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:m?.customURL),h=a(r(y,m)),q=()=>c({...d,style:b}),B=()=>u({...d,style:b,label:j}),E=()=>i(s,`<script ${p('class="gps-link" delay',"src")}="{{ 'gp-product-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${p('class="gps-link" delay',"src")}="${o}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return e`
1
+ import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as o}from"./common/helpers.js";import{template as s,isLocalEnv as e,baseAssetURL as r}from"@gem-sdk/core";import{createStateOrContext as a,Liquid as i,LiquidFor as l,If as n}from"@gem-sdk/system";import{getInsertLinkData as p,getSettingPreloadData as u}from"../../../helpers.js";import{getButtonDynamicSourceLocales as c}from"./helpers/getButtonDynamicSourceLocales.js";import{SoldOutButton as m}from"./SoldOutButton.liquid.js";import{AddToCartButton as d}from"./AddToCartButton.liquid.js";let ProductButton=f=>{let{setting:g,builderProps:$,style:b,styles:v,pageContext:y}=f,{wrapStyle:_,restStyle:j}=t(b),{outOfStockButtonLabel:S,unavailableButtonLabel:h,variantSelectionRequiredMessage:k}=c({setting:g,pageContext:y,builderProps:$}),{urlData:q}=p("",g?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:g?.customURL),B=a(o(v,g)),E=()=>d({...f,style:j}),A=()=>m({...f,style:j,label:S}),w=()=>n(e,`<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")}="${r}/assets-v2/gp-product-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return s`
2
+ ${i("{%- assign total_combinations = 1 -%}")}
3
+ ${l("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
2
4
  {%- liquid
3
5
  assign inventory_quantity = variant.inventory_quantity | default: 0
4
6
  assign is_in_stock = variant.available
5
7
  -%}
6
8
  <gp-product-button
7
- style="${v}"
9
+ style="${_}"
8
10
  gp-data-wrapper="true"
9
- gp-href="${_.href}"
11
+ gp-href="${q.href}"
10
12
  class="gp-product-button"
11
- gp-label-out-of-stock="${j}"
12
- gp-label-unavailable="${S}"
13
- gp-data='${JSON.stringify(h).replaceAll("'","&#039;")}'
13
+ gp-label-out-of-stock="${S}"
14
+ gp-label-unavailable="${h}"
15
+ gp-data='${JSON.stringify(B).replaceAll("'","&#039;")}'
14
16
  data-variant-selection-required-message="${k}"
15
17
  >
16
- ${q()}
17
- ${B()}
18
+ ${E()}
19
+ ${A()}
18
20
  </gp-product-button>
19
- ${E()}
21
+ ${w()}
20
22
  `};export{ProductButton as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "8.0.0",
29
+ "@gem-sdk/core": "8.0.1",
30
30
  "@gem-sdk/styles": "7.0.0",
31
31
  "@gem-sdk/system": "7.0.0",
32
32
  "@types/react-transition-group": "^4.4.12",