@gem-sdk/components 2.0.0-dev.436 → 2.0.0-dev.437

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.
@@ -12,8 +12,10 @@ const ProductSku = ({ setting, builderProps, styles })=>{
12
12
  const currentVariant = core.useCurrentVariant();
13
13
  const product$1 = core.useProduct();
14
14
  const isDefaultVariant = product.checkDefaultVariant(product$1);
15
+ // remove underlineLink from element 7.5
16
+ if (styles?.disableHoverColor) delete styles.underlineLink;
15
17
  const textContent = setting?.label && setting.label.trim().length ? `${setting.label} ${currentVariant?.sku ?? ''}` : `${currentVariant?.sku ?? ''}`;
16
- if (isDefaultVariant) {
18
+ if (isDefaultVariant || !isDefaultVariant && !currentVariant?.sku) {
17
19
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
18
20
  "data-id": builderProps?.uid,
19
21
  children: /*#__PURE__*/ jsxRuntime.jsx("p", {
@@ -22,15 +24,6 @@ const ProductSku = ({ setting, builderProps, styles })=>{
22
24
  })
23
25
  });
24
26
  }
25
- if (!isDefaultVariant && !currentVariant?.sku) {
26
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
27
- "data-id": builderProps?.uid,
28
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
29
- className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
30
- children: "This variant does not have a SKU"
31
- })
32
- });
33
- }
34
27
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
35
28
  id: `sku-${builderProps?.uid}`,
36
29
  children: /*#__PURE__*/ jsxRuntime.jsx(Text.default, {
@@ -5,18 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var core = require('@gem-sdk/core');
6
6
  var helpers = require('../../../helpers.js');
7
7
  var Text_liquid = require('../../../text/components/Text.liquid.js');
8
+ var system = require('@gem-sdk/system');
8
9
 
9
10
  const ProductSku = ({ setting, styles, advanced, builderProps })=>{
10
11
  const labelContent = setting?.label && setting.label.trim().length ? `${setting.label}` : '';
12
+ // remove underlineLink from element 7.5
13
+ if (styles?.disableHoverColor) delete styles.underlineLink;
14
+ const renderScript = ()=>{
15
+ const jsURL = core.isLocalEnv ? `{{ 'gp-product-sku.js' | asset_url }}` : `${core.baseAssetURL}/assets-v2/gp-product-sku.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
16
+ return `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${jsURL}" defer="defer"></script>`;
17
+ };
11
18
  return core.template`
12
- {%- unless product -%}
13
- <p>Product not found</p>
14
- {%- else -%}
15
- {% assign currentVariant = product.selected_or_first_available_variant %}
16
- <gp-product-sku gp-data='${JSON.stringify({
19
+ ${system.LiquidUnless('product', `<p>Product not found</p>`, `{% assign currentVariant = product.selected_or_first_available_variant %}
20
+ <gp-product-sku gp-data='${JSON.stringify({
17
21
  label: labelContent
18
22
  })}'>
19
- ${Text_liquid.default({
23
+ ${Text_liquid.default({
20
24
  styles: styles,
21
25
  setting: {
22
26
  ...setting,
@@ -27,10 +31,8 @@ const ProductSku = ({ setting, styles, advanced, builderProps })=>{
27
31
  builderProps,
28
32
  className: 'gp-product-sku'
29
33
  })}
30
- </gp-product-sku>
31
- ${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-sku.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-sku.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
32
- {%- endunless -%}
33
- `;
34
+ </gp-product-sku>
35
+ ${renderScript()}`)}`;
34
36
  };
35
37
 
36
38
  exports.default = ProductSku;
@@ -14,6 +14,7 @@ const SettingUIV2 = [
14
14
  iconName: 'polaris-text-block',
15
15
  getValueFromSettingID: 'label',
16
16
  defaultValueWhenClear: '',
17
+ compoDefaultValue: 'SKU: ',
17
18
  controls: [
18
19
  {
19
20
  label: {
@@ -8,8 +8,10 @@ const ProductSku = ({ setting, builderProps, styles })=>{
8
8
  const currentVariant = useCurrentVariant();
9
9
  const product = useProduct();
10
10
  const isDefaultVariant = checkDefaultVariant(product);
11
+ // remove underlineLink from element 7.5
12
+ if (styles?.disableHoverColor) delete styles.underlineLink;
11
13
  const textContent = setting?.label && setting.label.trim().length ? `${setting.label} ${currentVariant?.sku ?? ''}` : `${currentVariant?.sku ?? ''}`;
12
- if (isDefaultVariant) {
14
+ if (isDefaultVariant || !isDefaultVariant && !currentVariant?.sku) {
13
15
  return /*#__PURE__*/ jsx("div", {
14
16
  "data-id": builderProps?.uid,
15
17
  children: /*#__PURE__*/ jsx("p", {
@@ -18,15 +20,6 @@ const ProductSku = ({ setting, builderProps, styles })=>{
18
20
  })
19
21
  });
20
22
  }
21
- if (!isDefaultVariant && !currentVariant?.sku) {
22
- return /*#__PURE__*/ jsx("div", {
23
- "data-id": builderProps?.uid,
24
- children: /*#__PURE__*/ jsx("p", {
25
- className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
26
- children: "This variant does not have a SKU"
27
- })
28
- });
29
- }
30
23
  return /*#__PURE__*/ jsx("div", {
31
24
  id: `sku-${builderProps?.uid}`,
32
25
  children: /*#__PURE__*/ jsx(Text, {
@@ -1,18 +1,22 @@
1
- import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
1
+ import { template, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getSettingPreloadData } from '../../../helpers.js';
3
3
  import Text from '../../../text/components/Text.liquid.js';
4
+ import { LiquidUnless } from '@gem-sdk/system';
4
5
 
5
6
  const ProductSku = ({ setting, styles, advanced, builderProps })=>{
6
7
  const labelContent = setting?.label && setting.label.trim().length ? `${setting.label}` : '';
8
+ // remove underlineLink from element 7.5
9
+ if (styles?.disableHoverColor) delete styles.underlineLink;
10
+ const renderScript = ()=>{
11
+ const jsURL = isLocalEnv ? `{{ 'gp-product-sku.js' | asset_url }}` : `${baseAssetURL}/assets-v2/gp-product-sku.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
12
+ return `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${jsURL}" defer="defer"></script>`;
13
+ };
7
14
  return template`
8
- {%- unless product -%}
9
- <p>Product not found</p>
10
- {%- else -%}
11
- {% assign currentVariant = product.selected_or_first_available_variant %}
12
- <gp-product-sku gp-data='${JSON.stringify({
15
+ ${LiquidUnless('product', `<p>Product not found</p>`, `{% assign currentVariant = product.selected_or_first_available_variant %}
16
+ <gp-product-sku gp-data='${JSON.stringify({
13
17
  label: labelContent
14
18
  })}'>
15
- ${Text({
19
+ ${Text({
16
20
  styles: styles,
17
21
  setting: {
18
22
  ...setting,
@@ -23,10 +27,8 @@ const ProductSku = ({ setting, styles, advanced, builderProps })=>{
23
27
  builderProps,
24
28
  className: 'gp-product-sku'
25
29
  })}
26
- </gp-product-sku>
27
- ${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-sku.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-product-sku.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
28
- {%- endunless -%}
29
- `;
30
+ </gp-product-sku>
31
+ ${renderScript()}`)}`;
30
32
  };
31
33
 
32
34
  export { ProductSku as default };
@@ -12,6 +12,7 @@ const SettingUIV2 = [
12
12
  iconName: 'polaris-text-block',
13
13
  getValueFromSettingID: 'label',
14
14
  defaultValueWhenClear: '',
15
+ compoDefaultValue: 'SKU: ',
15
16
  controls: [
16
17
  {
17
18
  label: {
@@ -2313,8 +2313,6 @@ type OpenConfig = NoticeConfig & {
2313
2313
  duration?: number | null;
2314
2314
  };
2315
2315
  type Placement = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
2316
-
2317
- type OptionalConfig = Partial<OpenConfig>;
2318
2316
  type NotificationConfig = {
2319
2317
  getContainer?: () => HTMLElement;
2320
2318
  closeIcon?: React.ReactNode;
@@ -2324,11 +2322,13 @@ type NotificationConfig = {
2324
2322
  /** @private Trigger when all the notification closed. */
2325
2323
  onAllRemoved?: VoidFunction;
2326
2324
  };
2325
+ type OptionalConfig = Partial<OpenConfig>;
2327
2326
  type NotificationAPI = {
2328
2327
  open: (config: OptionalConfig) => void;
2329
2328
  close: (key: React.Key) => void;
2330
2329
  destroy: () => void;
2331
2330
  };
2331
+
2332
2332
  declare function useNotification(rootConfig?: NotificationConfig): [NotificationAPI, React.ReactElement];
2333
2333
 
2334
2334
  declare const Notify: React.ForwardRefExoticComponent<Omit<NoticeConfig, "onClose"> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.436",
3
+ "version": "2.0.0-dev.437",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",