@gem-sdk/components 2.0.0-staging.141 → 2.0.0-staging.143

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.
@@ -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,
@@ -59,7 +59,6 @@ const Row = ({ className, children, setting, builderAttrs, builderProps, styles,
59
59
  return core.template`
60
60
  ${core.RenderIf(!!styles?.preloadBgImage, `${core.RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${core.RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${core.RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
61
61
  ${core.template`
62
- ${core.RenderIf(!!isSection, `{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}`)}
63
62
  <${elementTag}
64
63
  class="gp-max-w-full ${isSection ? helpers.getSettingPreloadData('gps-lazy') : ''}"
65
64
  data-same-height-display-contents="${!!setting?.allowSameHeight}"
@@ -21,6 +21,7 @@ const IconListV2 = ({ builderProps, style, setting, styles, advanced, pageContex
21
21
  };
22
22
  const valueMap = getvalueMap();
23
23
  return core.template`
24
+ {% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
24
25
  <gp-icon-list
25
26
  ${{
26
27
  ...builderProps
@@ -290,7 +290,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
290
290
  'gp-data-hidden': `{% if variant.available %}true{% endif %}`
291
291
  },
292
292
  setting: {
293
- label: labelOutOfStockTranslate,
293
+ label: `${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}`,
294
294
  htmlType: 'button',
295
295
  iconAlign: iconAlign,
296
296
  iconSvg: iconSvg,
@@ -309,7 +309,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
309
309
  }
310
310
  },
311
311
  pageContext,
312
- nodePrice: composeNodePrice()
312
+ nodePrice: composeNodePrice(),
313
+ isForceValue: true
313
314
  })}
314
315
  </gp-product-button>
315
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>`)}
@@ -120,7 +120,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
120
120
  class="${appendTypoClass} gp-stock-counter-mark"
121
121
  style="${appendTypoStyle}"
122
122
  >
123
- {% if inventory_management == null or inventory_management != "shopify" and inventory_quantity <= 0 %}
123
+ {% if inventory_management == null and inventory_quantity <= 0 %}
124
124
  ${helpers.transformHighlighTag(unlimitedQuantityMessage ?? helpers$1.getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
125
125
  {% elsif available == false %}
126
126
  ${helpers.transformHighlighTag(outOfStockMessage || '', mainColor)}
@@ -42,6 +42,7 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
42
42
  displayText = styles?.typo?.attrs?.transform === 'capitalize' ? renderText?.toString().toLocaleLowerCase() : renderText;
43
43
  }
44
44
  return core.template`
45
+ {% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
45
46
  <gp-text data-id="${builderProps?.uidInteraction ?? builderProps?.uid}">
46
47
  <div
47
48
  ${{
@@ -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,
@@ -55,7 +55,6 @@ const Row = ({ className, children, setting, builderAttrs, builderProps, styles,
55
55
  return template`
56
56
  ${RenderIf(!!styles?.preloadBgImage, `${RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
57
57
  ${template`
58
- ${RenderIf(!!isSection, `{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}`)}
59
58
  <${elementTag}
60
59
  class="gp-max-w-full ${isSection ? getSettingPreloadData('gps-lazy') : ''}"
61
60
  data-same-height-display-contents="${!!setting?.allowSameHeight}"
@@ -17,6 +17,7 @@ const IconListV2 = ({ builderProps, style, setting, styles, advanced, pageContex
17
17
  };
18
18
  const valueMap = getvalueMap();
19
19
  return template`
20
+ {% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
20
21
  <gp-icon-list
21
22
  ${{
22
23
  ...builderProps
@@ -286,7 +286,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
286
286
  'gp-data-hidden': `{% if variant.available %}true{% endif %}`
287
287
  },
288
288
  setting: {
289
- label: labelOutOfStockTranslate,
289
+ label: `${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}`,
290
290
  htmlType: 'button',
291
291
  iconAlign: iconAlign,
292
292
  iconSvg: iconSvg,
@@ -305,7 +305,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
305
305
  }
306
306
  },
307
307
  pageContext,
308
- nodePrice: composeNodePrice()
308
+ nodePrice: composeNodePrice(),
309
+ isForceValue: true
309
310
  })}
310
311
  </gp-product-button>
311
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>`)}
@@ -116,7 +116,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
116
116
  class="${appendTypoClass} gp-stock-counter-mark"
117
117
  style="${appendTypoStyle}"
118
118
  >
119
- {% if inventory_management == null or inventory_management != "shopify" and inventory_quantity <= 0 %}
119
+ {% if inventory_management == null and inventory_quantity <= 0 %}
120
120
  ${transformHighlighTag(unlimitedQuantityMessage ?? getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
121
121
  {% elsif available == false %}
122
122
  ${transformHighlighTag(outOfStockMessage || '', mainColor)}
@@ -38,6 +38,7 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
38
38
  displayText = styles?.typo?.attrs?.transform === 'capitalize' ? renderText?.toString().toLocaleLowerCase() : renderText;
39
39
  }
40
40
  return template`
41
+ {% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
41
42
  <gp-text data-id="${builderProps?.uidInteraction ?? builderProps?.uid}">
42
43
  <div
43
44
  ${{
@@ -5277,10 +5277,11 @@ type ButtonLiquidProps = MixedProps & ButtonProps & {
5277
5277
  advanced?: any;
5278
5278
  pageContext?: PageContext;
5279
5279
  nodePrice?: string | null;
5280
+ isForceValue?: boolean;
5280
5281
  } & {
5281
5282
  dataId?: string;
5282
5283
  };
5283
- declare const Button: ({ className, builderProps, customAttrs, pageContext, setting, styles, style, wrapClassName, advanced, nodePrice, dataId, }: ButtonLiquidProps) => string;
5284
+ declare const Button: ({ className, builderProps, customAttrs, pageContext, setting, styles, style, wrapClassName, advanced, nodePrice, dataId, isForceValue, }: ButtonLiquidProps) => string;
5284
5285
 
5285
5286
  declare const Coupon: ({ setting, builderProps, builderAttrs, style, styles, advanced, pageContext, }: _gem_sdk_core.BaseProps<{
5286
5287
  copyContent?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.141",
3
+ "version": "2.0.0-staging.143",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",