@gem-sdk/components 2.1.27-staging.18 → 2.1.27-staging.19
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/button/components/Button.liquid.js +3 -3
- package/dist/cjs/product/components/ProductButton.js +1 -1
- package/dist/cjs/product/components/ProductButton.liquid.js +21 -3
- package/dist/cjs/third-party/configs/BoldProductOptions.js +2 -2
- package/dist/esm/button/components/Button.liquid.js +3 -3
- package/dist/esm/product/components/ProductButton.js +1 -1
- package/dist/esm/product/components/ProductButton.liquid.js +21 -3
- package/dist/esm/third-party/configs/BoldProductOptions.js +2 -2
- package/dist/types/index.d.ts +6 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
6
|
var helpers = require('../../helpers.js');
|
|
7
7
|
|
|
8
|
-
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId })=>{
|
|
8
|
+
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId, isForceValue = false })=>{
|
|
9
9
|
const { align, size, backgroundColor, textColor, roundedBtn, iconSpacing, globalSize } = styles;
|
|
10
10
|
const { label, iconSvg, btnLink, htmlType, disabled, loading, iconAlign, iconVisible, translate, disabledLoading = true } = setting;
|
|
11
11
|
const [wrapStyle, restStyle] = core.splitStyle([
|
|
@@ -70,7 +70,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
70
70
|
color: ${core.getSingleColorVariable(styles?.textColor?.hover)};
|
|
71
71
|
}
|
|
72
72
|
`;
|
|
73
|
-
const labelValDisplay = helpers.getDynamicSourceLocales({
|
|
73
|
+
const labelValDisplay = isForceValue ? label : helpers.getDynamicSourceLocales({
|
|
74
74
|
val: label,
|
|
75
75
|
uid: builderProps?.uidTranslate ?? builderProps?.uid,
|
|
76
76
|
settingId: translate ?? 'label',
|
|
@@ -161,7 +161,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
161
161
|
>${iconSvg}</span>`)}
|
|
162
162
|
<span
|
|
163
163
|
data-gp-text
|
|
164
|
-
class="${`gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
164
|
+
class="${`gp-content-product-button gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
165
165
|
${styles?.typo?.attrs?.italic ? '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]' : ''}`}"
|
|
166
166
|
style="${{
|
|
167
167
|
...nodePrice && appendTypoStyle,
|
|
@@ -218,7 +218,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
218
218
|
]);
|
|
219
219
|
const isInStock = core.useCurrentVariantInStock();
|
|
220
220
|
const isDisable = !isInStock || createCartLoading || addToCartLoading;
|
|
221
|
-
const label = !isInStock ? setting?.outOfStockLabel : setting?.label;
|
|
221
|
+
const label = !isInStock ? !currentVariant ? 'Unavailable' : setting?.outOfStockLabel : setting?.label;
|
|
222
222
|
if (!isInStock && isCustomOutOfStock) {
|
|
223
223
|
buttonStyles.backgroundColor = {
|
|
224
224
|
normal: oosBackground
|
|
@@ -188,6 +188,22 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
188
188
|
pageContext,
|
|
189
189
|
translate: setting?.translate
|
|
190
190
|
});
|
|
191
|
+
const labelUnavailableTranslate = helpers.getDynamicSourceLocales({
|
|
192
|
+
val: 'Unavailable',
|
|
193
|
+
uid: builderProps?.uid,
|
|
194
|
+
settingId: 'unavailableLabel',
|
|
195
|
+
isLiquid: true,
|
|
196
|
+
pageContext,
|
|
197
|
+
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
198
|
+
});
|
|
199
|
+
const labelOutOfStockTranslate = helpers.getDynamicSourceLocales({
|
|
200
|
+
val: setting?.outOfStockLabel,
|
|
201
|
+
uid: builderProps?.uid,
|
|
202
|
+
settingId: 'outOfStockLabel',
|
|
203
|
+
isLiquid: true,
|
|
204
|
+
pageContext,
|
|
205
|
+
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
206
|
+
});
|
|
191
207
|
return core.template /* liquid */ `
|
|
192
208
|
{%- liquid
|
|
193
209
|
assign inventory_quantity = variant.inventory_quantity | default: 0
|
|
@@ -195,6 +211,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
195
211
|
<gp-product-button
|
|
196
212
|
class="gp-product-button"
|
|
197
213
|
gp-data-wrapper="true"
|
|
214
|
+
label-out-of-Stock="${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}"
|
|
215
|
+
label-unavailable="${pageContext?.isPreviewing ? labelUnavailableTranslate : `{{${labelUnavailableTranslate}}}`}"
|
|
198
216
|
gp-data='${JSON.stringify({
|
|
199
217
|
setting: {
|
|
200
218
|
actionEffect: setting?.actionEffect,
|
|
@@ -272,8 +290,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
272
290
|
'gp-data-hidden': `{% if variant.available %}true{% endif %}`
|
|
273
291
|
},
|
|
274
292
|
setting: {
|
|
275
|
-
label:
|
|
276
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined,
|
|
293
|
+
label: `${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}`,
|
|
277
294
|
htmlType: 'button',
|
|
278
295
|
iconAlign: iconAlign,
|
|
279
296
|
iconSvg: iconSvg,
|
|
@@ -292,7 +309,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
292
309
|
}
|
|
293
310
|
},
|
|
294
311
|
pageContext,
|
|
295
|
-
nodePrice: composeNodePrice()
|
|
312
|
+
nodePrice: composeNodePrice(),
|
|
313
|
+
isForceValue: true
|
|
296
314
|
})}
|
|
297
315
|
</gp-product-button>
|
|
298
316
|
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var BoldProductOptionsConfig = {
|
|
6
6
|
id: 'bold-product-options',
|
|
7
|
-
label: '
|
|
8
|
-
logoUrl: 'https://
|
|
7
|
+
label: 'SC Product Options',
|
|
8
|
+
logoUrl: 'https://cdn.shopify.com/app-store/listing_images/9a0bf1159f79c6ab0660ec422f350445/icon/CP2Uwo_GuYIDEAE=.png',
|
|
9
9
|
tag: 'BoldProductOptions'
|
|
10
10
|
};
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { splitStyle, makeStyleResponsive, makeGlobalSize, composeTypographyClassName, composeTypographyStyle, composeBorderCss, composeCornerCss, getSingleColorVariable, template, cls, getGlobalColorStateClass, getGlobalColorStateStyle, composeRadius, getStyleShadowState, composeSize, getGradientBgrStyleForButton, RenderIf } from '@gem-sdk/core';
|
|
2
2
|
import { getInsertLinkData, getDynamicSourceLocales } from '../../helpers.js';
|
|
3
3
|
|
|
4
|
-
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId })=>{
|
|
4
|
+
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId, isForceValue = false })=>{
|
|
5
5
|
const { align, size, backgroundColor, textColor, roundedBtn, iconSpacing, globalSize } = styles;
|
|
6
6
|
const { label, iconSvg, btnLink, htmlType, disabled, loading, iconAlign, iconVisible, translate, disabledLoading = true } = setting;
|
|
7
7
|
const [wrapStyle, restStyle] = splitStyle([
|
|
@@ -66,7 +66,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
66
66
|
color: ${getSingleColorVariable(styles?.textColor?.hover)};
|
|
67
67
|
}
|
|
68
68
|
`;
|
|
69
|
-
const labelValDisplay = getDynamicSourceLocales({
|
|
69
|
+
const labelValDisplay = isForceValue ? label : getDynamicSourceLocales({
|
|
70
70
|
val: label,
|
|
71
71
|
uid: builderProps?.uidTranslate ?? builderProps?.uid,
|
|
72
72
|
settingId: translate ?? 'label',
|
|
@@ -157,7 +157,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
157
157
|
>${iconSvg}</span>`)}
|
|
158
158
|
<span
|
|
159
159
|
data-gp-text
|
|
160
|
-
class="${`gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
160
|
+
class="${`gp-content-product-button gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
161
161
|
${styles?.typo?.attrs?.italic ? '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]' : ''}`}"
|
|
162
162
|
style="${{
|
|
163
163
|
...nodePrice && appendTypoStyle,
|
|
@@ -214,7 +214,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
214
214
|
]);
|
|
215
215
|
const isInStock = useCurrentVariantInStock();
|
|
216
216
|
const isDisable = !isInStock || createCartLoading || addToCartLoading;
|
|
217
|
-
const label = !isInStock ? setting?.outOfStockLabel : setting?.label;
|
|
217
|
+
const label = !isInStock ? !currentVariant ? 'Unavailable' : setting?.outOfStockLabel : setting?.label;
|
|
218
218
|
if (!isInStock && isCustomOutOfStock) {
|
|
219
219
|
buttonStyles.backgroundColor = {
|
|
220
220
|
normal: oosBackground
|
|
@@ -184,6 +184,22 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
184
184
|
pageContext,
|
|
185
185
|
translate: setting?.translate
|
|
186
186
|
});
|
|
187
|
+
const labelUnavailableTranslate = getDynamicSourceLocales({
|
|
188
|
+
val: 'Unavailable',
|
|
189
|
+
uid: builderProps?.uid,
|
|
190
|
+
settingId: 'unavailableLabel',
|
|
191
|
+
isLiquid: true,
|
|
192
|
+
pageContext,
|
|
193
|
+
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
194
|
+
});
|
|
195
|
+
const labelOutOfStockTranslate = getDynamicSourceLocales({
|
|
196
|
+
val: setting?.outOfStockLabel,
|
|
197
|
+
uid: builderProps?.uid,
|
|
198
|
+
settingId: 'outOfStockLabel',
|
|
199
|
+
isLiquid: true,
|
|
200
|
+
pageContext,
|
|
201
|
+
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
202
|
+
});
|
|
187
203
|
return template /* liquid */ `
|
|
188
204
|
{%- liquid
|
|
189
205
|
assign inventory_quantity = variant.inventory_quantity | default: 0
|
|
@@ -191,6 +207,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
191
207
|
<gp-product-button
|
|
192
208
|
class="gp-product-button"
|
|
193
209
|
gp-data-wrapper="true"
|
|
210
|
+
label-out-of-Stock="${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}"
|
|
211
|
+
label-unavailable="${pageContext?.isPreviewing ? labelUnavailableTranslate : `{{${labelUnavailableTranslate}}}`}"
|
|
194
212
|
gp-data='${JSON.stringify({
|
|
195
213
|
setting: {
|
|
196
214
|
actionEffect: setting?.actionEffect,
|
|
@@ -268,8 +286,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
268
286
|
'gp-data-hidden': `{% if variant.available %}true{% endif %}`
|
|
269
287
|
},
|
|
270
288
|
setting: {
|
|
271
|
-
label:
|
|
272
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined,
|
|
289
|
+
label: `${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}`,
|
|
273
290
|
htmlType: 'button',
|
|
274
291
|
iconAlign: iconAlign,
|
|
275
292
|
iconSvg: iconSvg,
|
|
@@ -288,7 +305,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
288
305
|
}
|
|
289
306
|
},
|
|
290
307
|
pageContext,
|
|
291
|
-
nodePrice: composeNodePrice()
|
|
308
|
+
nodePrice: composeNodePrice(),
|
|
309
|
+
isForceValue: true
|
|
292
310
|
})}
|
|
293
311
|
</gp-product-button>
|
|
294
312
|
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-button.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-product-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var BoldProductOptionsConfig = {
|
|
2
2
|
id: 'bold-product-options',
|
|
3
|
-
label: '
|
|
4
|
-
logoUrl: 'https://
|
|
3
|
+
label: 'SC Product Options',
|
|
4
|
+
logoUrl: 'https://cdn.shopify.com/app-store/listing_images/9a0bf1159f79c6ab0660ec422f350445/icon/CP2Uwo_GuYIDEAE=.png',
|
|
5
5
|
tag: 'BoldProductOptions'
|
|
6
6
|
};
|
|
7
7
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1578,6 +1578,8 @@ type ProductButtonProps = BasePropsWrap<{
|
|
|
1578
1578
|
translate?: string;
|
|
1579
1579
|
outOfStockLabel?: string;
|
|
1580
1580
|
unavailableLabel?: string;
|
|
1581
|
+
labelUnavailableTranslate?: string;
|
|
1582
|
+
labelOutOfStockTranslate?: string;
|
|
1581
1583
|
actionEffect?: 'open-cart-drawer' | 'buy-now' | 'continue-shopping' | 'go-to-url';
|
|
1582
1584
|
customURL?: {
|
|
1583
1585
|
link?: string;
|
|
@@ -5408,10 +5410,11 @@ type ButtonLiquidProps = MixedProps & ButtonProps & {
|
|
|
5408
5410
|
advanced?: any;
|
|
5409
5411
|
pageContext?: PageContext;
|
|
5410
5412
|
nodePrice?: string | null;
|
|
5413
|
+
isForceValue?: boolean;
|
|
5411
5414
|
} & {
|
|
5412
5415
|
dataId?: string;
|
|
5413
5416
|
};
|
|
5414
|
-
declare const Button: ({ className, builderProps, customAttrs, pageContext, setting, styles, style, wrapClassName, advanced, nodePrice, dataId, }: ButtonLiquidProps) => string;
|
|
5417
|
+
declare const Button: ({ className, builderProps, customAttrs, pageContext, setting, styles, style, wrapClassName, advanced, nodePrice, dataId, isForceValue, }: ButtonLiquidProps) => string;
|
|
5415
5418
|
|
|
5416
5419
|
declare const Coupon: ({ setting, builderProps, builderAttrs, style, styles, advanced, pageContext, }: _gem_sdk_core.BaseProps<{
|
|
5417
5420
|
copyContent?: string | undefined;
|
|
@@ -5663,6 +5666,8 @@ declare const ProductButton: ({ setting, builderProps, builderAttrs, style, styl
|
|
|
5663
5666
|
translate?: string | undefined;
|
|
5664
5667
|
outOfStockLabel?: string | undefined;
|
|
5665
5668
|
unavailableLabel?: string | undefined;
|
|
5669
|
+
labelUnavailableTranslate?: string | undefined;
|
|
5670
|
+
labelOutOfStockTranslate?: string | undefined;
|
|
5666
5671
|
actionEffect?: "buy-now" | "open-cart-drawer" | "continue-shopping" | "go-to-url" | undefined;
|
|
5667
5672
|
customURL?: {
|
|
5668
5673
|
link?: string | undefined;
|