@gem-sdk/components 16.2.0 → 16.3.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-button/ProductButton.liquid.js +1 -1
- package/dist/cjs/product/components/product-button/common/helpers.js +1 -1
- package/dist/esm/product/components/product-button/ProductButton.liquid.js +5 -5
- package/dist/esm/product/components/product-button/common/helpers.js +1 -1
- package/dist/types/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
class="gp-product-button"
|
|
13
13
|
gp-label-out-of-stock="${u}"
|
|
14
14
|
gp-label-unavailable="${n}"
|
|
15
|
-
gp-data='${JSON.stringify(y)
|
|
15
|
+
gp-data='${JSON.stringify(y)}'
|
|
16
16
|
data-variant-selection-required-message="${c}"
|
|
17
17
|
gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
|
|
18
18
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var constants=require("./constants.js");const checkIconVisibility=e=>e?.enableIcon===!0,getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:removeColorFromTypo(e?.priceTypo)}),getRenderComparePriceSettings=e=>({lineThrough:!0,typo:removeColorFromTypo(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),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
|
|
1
|
+
"use strict";var constants=require("./constants.js");const LIQUID_EXPRESSION_REGEX=/^\s*\{\{[\s\S]*\}\}\s*$/,appendLiquidEscapeFilter=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),escapeSingleQuoteForAttr=e=>{if(null==e)return e;let t=e.toString();return LIQUID_EXPRESSION_REGEX.test(t)?appendLiquidEscapeFilter(t):t.replaceAll("'","'").replaceAll("’","'")},checkIconVisibility=e=>e?.enableIcon===!0,getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:removeColorFromTypo(e?.priceTypo)}),getRenderComparePriceSettings=e=>({lineThrough:!0,typo:removeColorFromTypo(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),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:escapeSingleQuoteForAttr(t?.label),errorMessage:escapeSingleQuoteForAttr(o??t?.errorMessage),successMessage:escapeSingleQuoteForAttr(r??t?.successMessage),outOfStockLabel:escapeSingleQuoteForAttr(t?.outOfStockLabel),customURL:{link:escapeSingleQuoteForAttr(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),renderSeparator=e=>{let t=e??"horizontal-line";return({dot:constants.SEPARATOR.DOT,"vertical-line":constants.SEPARATOR.VERTICAL_LINE,"horizontal-line":constants.SEPARATOR.HORIZONTAL_LINE})[t]??constants.SEPARATOR.HORIZONTAL_LINE},removeColorFromTypo=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);exports.checkIconVisibility=checkIconVisibility,exports.getGPProductButtonState=getGPProductButtonState,exports.getRenderComparePriceSettings=getRenderComparePriceSettings,exports.getRenderRegularPriceSettings=getRenderRegularPriceSettings,exports.renderSeparator=renderSeparator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonState as
|
|
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 n,If as l}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 d}from"./SoldOutButton.liquid.js";import{AddToCartButton as m}from"./AddToCartButton.liquid.js";let ProductButton=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}=c({setting:g,pageContext:v,builderProps:b}),{urlData:B}=p("",g?.actionEffect==="open-cart-drawer"?{link:"/cart",target:"_self"}:g?.customURL),P=a(o({styles:$,setting:g,successMessage:E,errorMessage:q})),A=()=>m({...f,style:h}),G=()=>d({...f,style:h,label:S}),w=()=>l(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
2
|
${i("{%- assign total_combinations = 1 -%}")}
|
|
3
|
-
${
|
|
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
|
|
@@ -8,15 +8,15 @@ import{getSplitStyle as t}from"./common/styles.js";import{getGPProductButtonStat
|
|
|
8
8
|
<gp-product-button
|
|
9
9
|
style="${_}"
|
|
10
10
|
gp-data-wrapper="true"
|
|
11
|
-
gp-href="${
|
|
11
|
+
gp-href="${B.href}"
|
|
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(
|
|
15
|
+
gp-data='${JSON.stringify(P)}'
|
|
16
16
|
data-variant-selection-required-message="${k}"
|
|
17
17
|
gp-enable-third-partycart="{{shop.metafields.GEMPAGES.enableThirdPartyCart}}"
|
|
18
18
|
>
|
|
19
|
-
${
|
|
19
|
+
${A()}
|
|
20
20
|
${G()}
|
|
21
21
|
</gp-product-button>
|
|
22
22
|
${w()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEPARATOR as e}from"./constants.js";let checkIconVisibility=e=>e?.enableIcon===!0,getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:removeColorFromTypo(e?.priceTypo)}),getRenderComparePriceSettings=e=>({lineThrough:!0,typo:removeColorFromTypo(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),getGPProductButtonState=({styles:e,setting:
|
|
1
|
+
import{SEPARATOR as e}from"./constants.js";let LIQUID_EXPRESSION_REGEX=/^\s*\{\{[\s\S]*\}\}\s*$/,appendLiquidEscapeFilter=e=>e.replace(/\s*\}\}\s*$/," | escape }}"),escapeSingleQuoteForAttr=e=>{if(null==e)return e;let t=e.toString();return LIQUID_EXPRESSION_REGEX.test(t)?appendLiquidEscapeFilter(t):t.replaceAll("'","'").replaceAll("’","'")},checkIconVisibility=e=>e?.enableIcon===!0,getRenderRegularPriceSettings=e=>({lineThrough:!1,typo:removeColorFromTypo(e?.priceTypo)}),getRenderComparePriceSettings=e=>({lineThrough:!0,typo:removeColorFromTypo(e?.compareAtPriceTypo),opacityPrice:e?.opacityPrice}),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:escapeSingleQuoteForAttr(t?.label),errorMessage:escapeSingleQuoteForAttr(o??t?.errorMessage),successMessage:escapeSingleQuoteForAttr(r??t?.successMessage),outOfStockLabel:escapeSingleQuoteForAttr(t?.outOfStockLabel),customURL:{link:escapeSingleQuoteForAttr(t?.customURL?.link),target:t?.customURL?.target}},variantID:"{{variant.id}}",disabled:"{{variant.available}}",totalVariant:"{{total_combinations}}"}),renderSeparator=t=>{let r=t??"horizontal-line";return({dot:e.DOT,"vertical-line":e.VERTICAL_LINE,"horizontal-line":e.HORIZONTAL_LINE})[r]??e.HORIZONTAL_LINE},removeColorFromTypo=e=>(e?.attrs&&e?.attrs.color&&delete e.attrs.color,e);export{checkIconVisibility,getGPProductButtonState,getRenderComparePriceSettings,getRenderRegularPriceSettings,renderSeparator};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -150,6 +150,7 @@ type TextProps = BasePropsWrap<TextSettingProps, TextStyleProps> & Omit<React.Co
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
type ObjectFit$2 = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
153
|
+
type IImageStorageType = 'THEME' | 'FILE_CONTENT' | 'SHOPIFY_CDN';
|
|
153
154
|
type BaseImageData = {
|
|
154
155
|
alt?: string;
|
|
155
156
|
src?: string;
|
|
@@ -158,7 +159,7 @@ type BaseImageData = {
|
|
|
158
159
|
base64?: string;
|
|
159
160
|
backupFileKey?: string;
|
|
160
161
|
backupFilePath?: string;
|
|
161
|
-
storage?:
|
|
162
|
+
storage?: IImageStorageType;
|
|
162
163
|
metafieldDefinitionKey?: string;
|
|
163
164
|
};
|
|
164
165
|
type SharedProps = {
|
|
@@ -2132,7 +2133,7 @@ type ImageComparisonItem = {
|
|
|
2132
2133
|
height?: number;
|
|
2133
2134
|
backupFileKey?: string;
|
|
2134
2135
|
backupFilePath?: string;
|
|
2135
|
-
storage?:
|
|
2136
|
+
storage?: IImageStorageType;
|
|
2136
2137
|
metafieldDefinitionKey?: string;
|
|
2137
2138
|
};
|
|
2138
2139
|
type ImageTab = 'left' | 'right';
|