@gem-sdk/components 17.0.0-dev.39 → 17.0.0-dev.41

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 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"),l=require("./AddToCartButton.liquid.js");exports.default=n=>{let{setting:u,builderProps:c,style:d,styles:p,pageContext:g}=n,{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`
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
2
  ${a.Liquid("{%- assign total_combinations = 1 -%}")}
3
3
  ${a.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
4
4
  {%- liquid
@@ -12,12 +12,12 @@
12
12
  class="gp-product-button"
13
13
  gp-label-out-of-stock="${b}"
14
14
  gp-label-unavailable="${f}"
15
- gp-data='${JSON.stringify(_).replaceAll("'","'")}'
15
+ gp-data='${JSON.stringify(_)}'
16
16
  data-variant-selection-required-message="${S}"
17
17
  gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
18
18
  >
19
- ${l.AddToCartButton({...n,style:m})}
20
- ${o.SoldOutButton({...n,style:m,label:b})}
19
+ ${n.AddToCartButton({...l,style:m})}
20
+ ${o.SoldOutButton({...l,style:m,label:b})}
21
21
  </gp-product-button>
22
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>`)}
23
23
  `};
@@ -1 +1 @@
1
- "use strict";var e=require("./constants.js");const t=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:t?.label?.replaceAll("'","&#039;"),errorMessage:o??t?.errorMessage?.replaceAll("'","&#039;"),successMessage:r??t?.successMessage?.replaceAll("'","&#039;"),outOfStockLabel:t?.outOfStockLabel?.replaceAll("'","&#039;"),customURL:{link:t?.customURL?.link?.replaceAll("'","&#039;"),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),exports.getRenderComparePriceSettings=e=>({lineThrough:!0,typo:t(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),exports.getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:t(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 }}"),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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react");exports.default=o=>{let{width:s,position:l}=o??{},{desktop:r,tablet:i,mobile:b}=o?.display||{},p=e.makeStyleResponsive("w",s),a=e.usePageStore(e=>"interaction"===e.sidebarMode),u=e.useCurrentDevice(),[d,n]=t.useState(!1),m=e.useStickyStore(e=>e.getFirstVisibleElement(u)),k=(e,t)=>({[`--left${t}`]:"top"==e?"0":"50%",[`--t${t}`]:"top"==e?"unset":"translateX(-50%)"}),c=t.useMemo(()=>({...k(l?.desktop,""),...k(l?.tablet??l?.desktop,"-tablet"),...k(l?.mobile??l?.tablet??l?.desktop,"-mobile")}),[l?.desktop,l?.mobile,l?.tablet]),f=t.useMemo(()=>{if(a&&l?.[u]==="top")return"40px"},[u,a,l]),x=t.useMemo(()=>{let e=e=>"after-first-cart-button"!==e||d?"block":"none";return{"--d":e(r),"--d-tablet":e(i??r),"--d-mobile":e(b??i??r)}},[r,i,b,d]),M=t.useMemo(()=>({"--top":f??"auto","--top-tablet":f??"auto","--top-mobile":f??"auto",[`--${l?.desktop}`]:f??"0px",[`--${l?.tablet??l?.desktop}-tablet`]:f??"0px",[`--${l?.mobile??l?.tablet??l?.desktop}-mobile`]:f??"0px"}),[f,l?.desktop,l?.mobile,l?.tablet]),v=e=>"top"==e?"sticky":"fixed",g=t.useMemo(()=>({"--pos":v(l?.desktop),"--pos-tablet":v(l?.tablet??l?.desktop),"--pos-mobile":v(l?.mobile??l?.tablet??l?.desktop)}),[l?.desktop,l?.mobile,l?.tablet]);return t.useEffect(()=>{if(!m)return;let e=new IntersectionObserver(([e])=>{e&&n(e.isIntersecting||e.boundingClientRect.top<=0)});return e.observe(m),()=>e.disconnect()},[m]),t.useEffect(()=>{n(!1)},[u]),{w:p,displayStyle:M,positionStyle:g,getCSSAlign:c,makeDisplaySettingStyles:x}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react");exports.default=o=>{let{width:s,position:l}=o??{},{desktop:r,tablet:i,mobile:b}=o?.display||{},p=e.makeStyleResponsive("w",s),a=e.usePageStore(e=>"interaction"===e.sidebarMode),u=e.useCurrentDevice(),[d,n]=t.useState(!1),m=e.useStickyStore(e=>e.getFirstVisibleElement(u)),k=(e,t)=>({[`--left${t}`]:"top"==e?"0":"50%",[`--t${t}`]:"top"==e?"unset":"translateX(-50%)"}),c=t.useMemo(()=>({...k(l?.desktop,""),...k(l?.tablet??l?.desktop,"-tablet"),...k(l?.mobile??l?.tablet??l?.desktop,"-mobile")}),[l?.desktop,l?.mobile,l?.tablet]),f=t.useMemo(()=>{if(a&&l?.[u]==="top")return"40px"},[u,a,l]),x=t.useMemo(()=>{let e=e=>"after-first-cart-button"!==e||d?"block":"none";return{"--d":e(r),"--d-tablet":e(i??r),"--d-mobile":e(b??i??r)}},[r,i,b,d]),M=t.useMemo(()=>({"--top":f??"auto","--top-tablet":f??"auto","--top-mobile":f??"auto",[`--${l?.desktop}`]:f??"0px",[`--${l?.tablet??l?.desktop}-tablet`]:f??"0px",[`--${l?.mobile??l?.tablet??l?.desktop}-mobile`]:f??"0px"}),[f,l?.desktop,l?.mobile,l?.tablet]),v=e=>"top"==e?"sticky":"fixed",g=t.useMemo(()=>({"--pos":v(l?.desktop),"--pos-tablet":v(l?.tablet??l?.desktop),"--pos-mobile":v(l?.mobile??l?.tablet??l?.desktop)}),[l?.desktop,l?.mobile,l?.tablet]);return t.useEffect(()=>{if(!m)return;let e=new IntersectionObserver(([e])=>{e&&n(e.isIntersecting||e.boundingClientRect.top<=0)});return e.observe(m),()=>e.disconnect()},[m,u]),{w:p,displayStyle:M,positionStyle:g,getCSSAlign:c,makeDisplaySettingStyles:x}};
@@ -1,6 +1,6 @@
1
- import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as e}from"./common/helpers.js";import{template as s,isLocalEnv as o,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 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(e({styles:$,setting:g,successMessage:E,errorMessage:q}));return s`
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
2
  ${i("{%- assign total_combinations = 1 -%}")}
3
- ${l("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
3
+ ${n("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
@@ -12,12 +12,12 @@ import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonStat
12
12
  class="gp-product-button"
13
13
  gp-label-out-of-stock="${S}"
14
14
  gp-label-unavailable="${j}"
15
- gp-data='${JSON.stringify(B).replaceAll("'","&#039;")}'
15
+ gp-data='${JSON.stringify(B)}'
16
16
  data-variant-selection-required-message="${k}"
17
17
  gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
18
18
  >
19
19
  ${m({...f,style:h})}
20
20
  ${d({...f,style:h,label:S})}
21
21
  </gp-product-button>
22
- ${n(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>`)}
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>`)}
23
23
  `};export{f as default};
@@ -1 +1 @@
1
- import{SEPARATOR as e}from"./constants.js";let t=e=>e?.enableIcon===!0,r=e=>({lineThrough:!1,typo:c(e?.priceTypo)}),a=e=>({lineThrough:!0,typo:c(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),o=({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:t?.label?.replaceAll("'","&#039;"),errorMessage:a??t?.errorMessage?.replaceAll("'","&#039;"),successMessage:r??t?.successMessage?.replaceAll("'","&#039;"),outOfStockLabel:t?.outOfStockLabel?.replaceAll("'","&#039;"),customURL:{link:t?.customURL?.link?.replaceAll("'","&#039;"),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),l=t=>({dot:e.DOT,"vertical-line":e.VERTICAL_LINE,"horizontal-line":e.HORIZONTAL_LINE})[t??"horizontal-line"]??e.HORIZONTAL_LINE,c=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);export{t as checkIconVisibility,o as getGPProductButtonState,a as getRenderComparePriceSettings,r as getRenderRegularPriceSettings,l 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;")},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 +1 @@
1
- import{makeStyleResponsive as t,usePageStore as e,useCurrentDevice as o,useStickyStore as l}from"@gem-sdk/core";import{useState as b,useMemo as i,useEffect as s}from"react";let p=p=>{let{width:r,position:a}=p??{},{desktop:d,tablet:n,mobile:m}=p?.display||{},k=t("w",r),u=e(t=>"interaction"===t.sidebarMode),c=o(),[f,x]=b(!1),$=l(t=>t.getFirstVisibleElement(c)),g=(t,e)=>({[`--left${e}`]:"top"==t?"0":"50%",[`--t${e}`]:"top"==t?"unset":"translateX(-50%)"}),y=i(()=>({...g(a?.desktop,""),...g(a?.tablet??a?.desktop,"-tablet"),...g(a?.mobile??a?.tablet??a?.desktop,"-mobile")}),[a?.desktop,a?.mobile,a?.tablet]),v=i(()=>{if(u&&a?.[c]==="top")return"40px"},[c,u,a]),w=i(()=>{let t=t=>"after-first-cart-button"!==t||f?"block":"none";return{"--d":t(d),"--d-tablet":t(n??d),"--d-mobile":t(m??n??d)}},[d,n,m,f]),I=i(()=>({"--top":v??"auto","--top-tablet":v??"auto","--top-mobile":v??"auto",[`--${a?.desktop}`]:v??"0px",[`--${a?.tablet??a?.desktop}-tablet`]:v??"0px",[`--${a?.mobile??a?.tablet??a?.desktop}-mobile`]:v??"0px"}),[v,a?.desktop,a?.mobile,a?.tablet]),C=t=>"top"==t?"sticky":"fixed",E=i(()=>({"--pos":C(a?.desktop),"--pos-tablet":C(a?.tablet??a?.desktop),"--pos-mobile":C(a?.mobile??a?.tablet??a?.desktop)}),[a?.desktop,a?.mobile,a?.tablet]);return s(()=>{if(!$)return;let t=new IntersectionObserver(([t])=>{t&&x(t.isIntersecting||t.boundingClientRect.top<=0)});return t.observe($),()=>t.disconnect()},[$]),s(()=>{x(!1)},[c]),{w:k,displayStyle:I,positionStyle:E,getCSSAlign:y,makeDisplaySettingStyles:w}};export{p as default};
1
+ import{makeStyleResponsive as t,usePageStore as e,useCurrentDevice as o,useStickyStore as l}from"@gem-sdk/core";import{useState as b,useMemo as i,useEffect as s}from"react";let p=p=>{let{width:r,position:a}=p??{},{desktop:d,tablet:n,mobile:m}=p?.display||{},k=t("w",r),u=e(t=>"interaction"===t.sidebarMode),c=o(),[f,x]=b(!1),$=l(t=>t.getFirstVisibleElement(c)),g=(t,e)=>({[`--left${e}`]:"top"==t?"0":"50%",[`--t${e}`]:"top"==t?"unset":"translateX(-50%)"}),y=i(()=>({...g(a?.desktop,""),...g(a?.tablet??a?.desktop,"-tablet"),...g(a?.mobile??a?.tablet??a?.desktop,"-mobile")}),[a?.desktop,a?.mobile,a?.tablet]),v=i(()=>{if(u&&a?.[c]==="top")return"40px"},[c,u,a]),w=i(()=>{let t=t=>"after-first-cart-button"!==t||f?"block":"none";return{"--d":t(d),"--d-tablet":t(n??d),"--d-mobile":t(m??n??d)}},[d,n,m,f]),I=i(()=>({"--top":v??"auto","--top-tablet":v??"auto","--top-mobile":v??"auto",[`--${a?.desktop}`]:v??"0px",[`--${a?.tablet??a?.desktop}-tablet`]:v??"0px",[`--${a?.mobile??a?.tablet??a?.desktop}-mobile`]:v??"0px"}),[v,a?.desktop,a?.mobile,a?.tablet]),C=t=>"top"==t?"sticky":"fixed",E=i(()=>({"--pos":C(a?.desktop),"--pos-tablet":C(a?.tablet??a?.desktop),"--pos-mobile":C(a?.mobile??a?.tablet??a?.desktop)}),[a?.desktop,a?.mobile,a?.tablet]);return s(()=>{if(!$)return;let t=new IntersectionObserver(([t])=>{t&&x(t.isIntersecting||t.boundingClientRect.top<=0)});return t.observe($),()=>t.disconnect()},[$,c]),{w:k,displayStyle:I,positionStyle:E,getCSSAlign:y,makeDisplaySettingStyles:w}};export{p as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "17.0.0-dev.39",
3
+ "version": "17.0.0-dev.41",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",