@useinsider/guido 3.0.0-beta.34a1600 → 3.0.0-beta.39155d9

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.
Files changed (91) hide show
  1. package/dist/@types/config/schemas.js +10 -8
  2. package/dist/components/Guido.vue.js +3 -3
  3. package/dist/components/Guido.vue2.js +61 -60
  4. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  5. package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
  6. package/dist/composables/useCustomFieldAttributes.js +16 -0
  7. package/dist/composables/useHtmlValidator.js +40 -38
  8. package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
  9. package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
  10. package/dist/extensions/Blocks/Recommendation/block.js +40 -55
  11. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  12. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  13. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -36
  14. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
  15. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  16. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
  17. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
  18. package/dist/extensions/Blocks/Recommendation/controls/{main/layoutOrientation.js → layout/index.js} +27 -32
  19. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  20. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  21. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +78 -107
  23. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  24. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +64 -150
  25. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  26. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +191 -177
  27. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +8 -25
  28. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -6
  29. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  30. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  31. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  32. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  33. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +100 -94
  34. package/dist/extensions/Blocks/Recommendation/extension.js +27 -25
  35. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +125 -36
  36. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +111 -99
  37. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -2
  38. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
  39. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -33
  40. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
  41. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
  42. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
  43. package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
  44. package/dist/extensions/Blocks/common-control.js +41 -90
  45. package/dist/guido.css +1 -1
  46. package/dist/services/customFieldAttributesApi.js +21 -0
  47. package/dist/src/@types/config/schemas.d.ts +4 -0
  48. package/dist/src/components/Guido.vue.d.ts +1 -1
  49. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  50. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  51. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  52. package/dist/src/composables/useConfig.d.ts +2 -0
  53. package/dist/src/composables/useCustomFieldAttributes.d.ts +5 -0
  54. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  55. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  56. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -1
  57. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  58. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +25 -0
  60. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
  61. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
  62. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -2
  63. package/dist/src/extensions/Blocks/Recommendation/controls/{main/layoutOrientation.d.ts → layout/index.d.ts} +3 -3
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -5
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +20 -38
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -4
  67. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +1 -23
  68. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +15 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +15 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +15 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +15 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +18 -8
  73. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +60 -0
  74. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  75. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
  76. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
  77. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
  78. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
  79. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -13
  80. package/dist/src/extensions/Blocks/common-control.d.ts +2 -24
  81. package/dist/src/mock/api/custom-field-attributes.d.ts +2 -0
  82. package/dist/src/services/customFieldAttributesApi.d.ts +3 -0
  83. package/dist/src/stores/config.d.ts +18 -0
  84. package/dist/static/styles/components/wide-panel.css.js +0 -1
  85. package/dist/static/styles/customEditorStyle.css.js +0 -9
  86. package/dist/static/styles/variables.css.js +3 -0
  87. package/package.json +1 -1
  88. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +0 -58
  89. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +0 -65
  90. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +0 -28
  91. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +0 -34
@@ -1,11 +1,11 @@
1
- import { ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as c } from "../../../common-control.js";
1
+ import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as a } from "../../../common-control.js";
3
3
  import { RecommendationBlockId as l } from "../../constants/blockIds.js";
4
4
  import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as T } from "../../constants/selectors.js";
6
6
  import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
7
7
  const i = "data-text-after", u = "", p = ".omnibus-text-after";
8
- class g extends c {
8
+ class g extends a {
9
9
  getId() {
10
10
  return d.OMNIBUS_DISCOUNT_TEXT_AFTER;
11
11
  }
@@ -13,10 +13,10 @@ class g extends c {
13
13
  return `
14
14
  <div class="omnibus-discount-text-after-control-container">
15
15
  ${this._GuTwoColumns([
16
- this._GuLabel({ text: this.api.translate("Text After") }),
16
+ this._GuLabel({ text: "Text After" }),
17
17
  this._GuTextInput({
18
18
  name: "omnibusDiscountTextAfter",
19
- placeholder: this.api.translate("e.g., off!"),
19
+ placeholder: "e.g., off!",
20
20
  className: "es-180w"
21
21
  })
22
22
  ])}
@@ -57,10 +57,10 @@ class g extends c {
57
57
  o.modifyHtml(s).setAttribute(i, t);
58
58
  const r = s.querySelector(p);
59
59
  if (r) {
60
- const a = f(r, t);
61
- o.modifyHtml(r).setInnerHtml(a);
60
+ const m = f(r, t);
61
+ o.modifyHtml(r).setInnerHtml(m);
62
62
  }
63
- }), o.apply(new m("Update omnibus discount text after"));
63
+ }), o.apply(new c("Update omnibus discount text after"));
64
64
  }
65
65
  _listenToFormUpdates() {
66
66
  this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
@@ -1,11 +1,11 @@
1
- import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as c } from "../../../common-control.js";
3
- import { RecommendationBlockId as l } from "../../constants/blockIds.js";
1
+ import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as l } from "../../../common-control.js";
3
+ import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
4
  import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as T } from "../../constants/selectors.js";
6
6
  import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
7
7
  const i = "data-text-before", u = "", p = ".omnibus-text-before";
8
- class g extends c {
8
+ class g extends l {
9
9
  getId() {
10
10
  return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
11
11
  }
@@ -13,10 +13,10 @@ class g extends c {
13
13
  return `
14
14
  <div class="omnibus-discount-text-before-control-container">
15
15
  ${this._GuTwoColumns([
16
- this._GuLabel({ text: this.api.translate("Text Before") }),
16
+ this._GuLabel({ text: "Text Before" }),
17
17
  this._GuTextInput({
18
18
  name: "omnibusDiscountTextBefore",
19
- placeholder: this.api.translate("e.g., Save "),
19
+ placeholder: "e.g., Save ",
20
20
  className: "es-180w"
21
21
  })
22
22
  ])}
@@ -26,45 +26,45 @@ class g extends c {
26
26
  onRender() {
27
27
  this._setFormValues(), this._listenToFormUpdates();
28
28
  }
29
- onTemplateNodeUpdated(t) {
30
- super.onTemplateNodeUpdated(t), this._setFormValues();
29
+ onTemplateNodeUpdated(e) {
30
+ super.onTemplateNodeUpdated(e), this._setFormValues();
31
31
  }
32
32
  _setFormValues() {
33
- const t = this._getCurrentText();
33
+ const e = this._getCurrentText();
34
34
  this.api.updateValues({
35
- omnibusDiscountTextBefore: t
35
+ omnibusDiscountTextBefore: e
36
36
  });
37
37
  }
38
38
  _getCurrentText() {
39
39
  if (!this.currentNode || !("getAttribute" in this.currentNode))
40
40
  return u;
41
- const t = this.currentNode.getAttribute(i);
42
- return t === null ? u : t;
41
+ const e = this.currentNode.getAttribute(i);
42
+ return e === null ? u : e;
43
43
  }
44
- _onTextChange(t) {
44
+ _onTextChange(e) {
45
45
  if (!this.currentNode || !("closest" in this.currentNode))
46
46
  return;
47
- const e = this.currentNode.closest(T);
48
- if (!e || !("querySelectorAll" in e))
47
+ const t = this.currentNode.closest(T);
48
+ if (!t || !("querySelectorAll" in t))
49
49
  return;
50
50
  const n = Array.from(
51
- e.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_DISCOUNT}"]`)
51
+ t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_DISCOUNT}"]`)
52
52
  );
53
53
  if (!n.length)
54
54
  return;
55
55
  const o = this.api.getDocumentModifier();
56
56
  n.forEach((s) => {
57
- o.modifyHtml(s).setAttribute(i, t);
57
+ o.modifyHtml(s).setAttribute(i, e);
58
58
  const r = s.querySelector(p);
59
59
  if (r) {
60
- const m = f(r, t);
60
+ const m = f(r, e);
61
61
  o.modifyHtml(r).setInnerHtml(m);
62
62
  }
63
- }), o.apply(new a("Update omnibus discount text before"));
63
+ }), o.apply(new c("Update omnibus discount text before"));
64
64
  }
65
65
  _listenToFormUpdates() {
66
- this.api.onValueChanged("omnibusDiscountTextBefore", (t) => {
67
- typeof t == "string" && this._onTextChange(t);
66
+ this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
67
+ typeof e == "string" && this._onTextChange(e);
68
68
  });
69
69
  }
70
70
  }
@@ -1,11 +1,11 @@
1
- import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as c } from "../../../common-control.js";
1
+ import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as a } from "../../../common-control.js";
3
3
  import { RecommendationBlockId as l } from "../../constants/blockIds.js";
4
4
  import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as T } from "../../constants/selectors.js";
6
- import { preserveTextStyles as p } from "../../utils/preserveTextStyles.js";
7
- const s = "data-text-after", a = "", f = ".omnibus-text-after";
8
- class g extends c {
6
+ import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
7
+ const s = "data-text-after", m = "", p = ".omnibus-text-after";
8
+ class g extends a {
9
9
  getId() {
10
10
  return d.OMNIBUS_PRICE_TEXT_AFTER;
11
11
  }
@@ -13,10 +13,10 @@ class g extends c {
13
13
  return `
14
14
  <div class="omnibus-price-text-after-control-container">
15
15
  ${this._GuTwoColumns([
16
- this._GuLabel({ text: this.api.translate("Text After") }),
16
+ this._GuLabel({ text: "Text After" }),
17
17
  this._GuTextInput({
18
18
  name: "omnibusPriceTextAfter",
19
- placeholder: this.api.translate("e.g., (incl. VAT)"),
19
+ placeholder: "e.g., (incl. VAT)",
20
20
  className: "es-180w"
21
21
  })
22
22
  ])}
@@ -37,9 +37,9 @@ class g extends c {
37
37
  }
38
38
  _getCurrentText() {
39
39
  if (!this.currentNode || !("getAttribute" in this.currentNode))
40
- return a;
40
+ return m;
41
41
  const t = this.currentNode.getAttribute(s);
42
- return t === null ? a : t;
42
+ return t === null ? m : t;
43
43
  }
44
44
  _onTextChange(t) {
45
45
  if (!this.currentNode || !("closest" in this.currentNode))
@@ -55,12 +55,12 @@ class g extends c {
55
55
  const r = this.api.getDocumentModifier();
56
56
  n.forEach((i) => {
57
57
  r.modifyHtml(i).setAttribute(s, t);
58
- const o = i.querySelector(f);
58
+ const o = i.querySelector(p);
59
59
  if (o) {
60
- const m = p(o, t);
61
- r.modifyHtml(o).setInnerHtml(m);
60
+ const u = f(o, t);
61
+ r.modifyHtml(o).setInnerHtml(u);
62
62
  }
63
- }), r.apply(new u("Update omnibus price text after"));
63
+ }), r.apply(new c("Update omnibus price text after"));
64
64
  }
65
65
  _listenToFormUpdates() {
66
66
  this.api.onValueChanged("omnibusPriceTextAfter", (t) => {
@@ -1,11 +1,11 @@
1
- import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as c } from "../../../common-control.js";
3
- import { RecommendationBlockId as l } from "../../constants/blockIds.js";
1
+ import { ModificationDescription as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as l } from "../../../common-control.js";
3
+ import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
4
  import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
- import { BLOCK_ROOT_SELECTOR as p } from "../../constants/selectors.js";
6
- import { preserveTextStyles as T } from "../../utils/preserveTextStyles.js";
7
- const s = "data-text-before", a = "", f = ".omnibus-text-before";
8
- class g extends c {
5
+ import { BLOCK_ROOT_SELECTOR as T } from "../../constants/selectors.js";
6
+ import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
7
+ const s = "data-text-before", m = "", p = ".omnibus-text-before";
8
+ class g extends l {
9
9
  getId() {
10
10
  return d.OMNIBUS_PRICE_TEXT_BEFORE;
11
11
  }
@@ -13,10 +13,10 @@ class g extends c {
13
13
  return `
14
14
  <div class="omnibus-price-text-before-control-container">
15
15
  ${this._GuTwoColumns([
16
- this._GuLabel({ text: this.api.translate("Text Before") }),
16
+ this._GuLabel({ text: "Text Before" }),
17
17
  this._GuTextInput({
18
18
  name: "omnibusPriceTextBefore",
19
- placeholder: this.api.translate("e.g., Lowest 30-day price: "),
19
+ placeholder: "e.g., Lowest 30-day price: ",
20
20
  className: "es-180w"
21
21
  })
22
22
  ])}
@@ -37,30 +37,30 @@ class g extends c {
37
37
  }
38
38
  _getCurrentText() {
39
39
  if (!this.currentNode || !("getAttribute" in this.currentNode))
40
- return a;
40
+ return m;
41
41
  const e = this.currentNode.getAttribute(s);
42
- return e === null ? a : e;
42
+ return e === null ? m : e;
43
43
  }
44
44
  _onTextChange(e) {
45
45
  if (!this.currentNode || !("closest" in this.currentNode))
46
46
  return;
47
- const t = this.currentNode.closest(p);
47
+ const t = this.currentNode.closest(T);
48
48
  if (!t || !("querySelectorAll" in t))
49
49
  return;
50
50
  const n = Array.from(
51
- t.querySelectorAll(`[esd-extension-block-id="${l.OMNIBUS_PRICE}"]`)
51
+ t.querySelectorAll(`[esd-extension-block-id="${a.OMNIBUS_PRICE}"]`)
52
52
  );
53
53
  if (!n.length)
54
54
  return;
55
55
  const o = this.api.getDocumentModifier();
56
56
  n.forEach((i) => {
57
57
  o.modifyHtml(i).setAttribute(s, e);
58
- const r = i.querySelector(f);
58
+ const r = i.querySelector(p);
59
59
  if (r) {
60
- const m = T(r, e);
61
- o.modifyHtml(r).setInnerHtml(m);
60
+ const u = f(r, e);
61
+ o.modifyHtml(r).setInnerHtml(u);
62
62
  }
63
- }), o.apply(new u("Update omnibus price text before"));
63
+ }), o.apply(new c("Update omnibus price text before"));
64
64
  }
65
65
  _listenToFormUpdates() {
66
66
  this.api.onValueChanged("omnibusPriceTextBefore", (e) => {
@@ -1,16 +1,16 @@
1
1
  var G = Object.defineProperty;
2
- var P = (u, c, t) => c in u ? G(u, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[c] = t;
3
- var h = (u, c, t) => P(u, typeof c != "symbol" ? c + "" : c, t);
4
- import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as R } from "../../../common-control.js";
6
- import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as M } from "../../constants/selectors.js";
7
- import { SPACING_STEP as S, MAX_SPACING as _, MIN_SPACING as N, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as E } from "../../constants/layout.js";
8
- import { RecommendationConfigService as p } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as V } from "../../store/recommendation.js";
10
- import { safeGetStyle as A, safeGetParent as w } from "../../utils/tagName.js";
11
- import { getCurrentLayout as b, getBlockElement as B } from "../main/utils.js";
2
+ var R = (p, c, t) => c in p ? G(p, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[c] = t;
3
+ var h = (p, c, t) => R(p, typeof c != "symbol" ? c + "" : c, t);
4
+ import { EditorStatePropertyType as y, PreviewDeviceMode as w, ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as V } from "../../../common-control.js";
6
+ import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
7
+ import { SPACING_STEP as S, MAX_SPACING as _, MIN_SPACING as N, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as P } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as d } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as B } from "../../store/recommendation.js";
10
+ import { safeGetStyle as A, safeGetParent as U } from "../../utils/tagName.js";
11
+ import { getCurrentLayout as b, getBlockElement as x } from "../main/utils.js";
12
12
  import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
13
- const U = "recommendation-spacing-control", n = {
13
+ const W = "recommendation-spacing-control", i = {
14
14
  COLUMN_SPACING: "columnSpacing",
15
15
  COLUMN_SPACING_LABEL: "columnSpacingLabel",
16
16
  ROW_SPACING: "rowSpacing",
@@ -25,16 +25,16 @@ const U = "recommendation-spacing-control", n = {
25
25
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
26
26
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
27
27
  };
28
- function L(u, c) {
29
- if (!u)
28
+ function L(p, c) {
29
+ if (!p)
30
30
  return c;
31
- const t = parseFloat(u);
31
+ const t = parseFloat(p);
32
32
  return Number.isNaN(t) ? c : t;
33
33
  }
34
- class j extends R {
34
+ class X extends V {
35
35
  constructor() {
36
36
  super(...arguments);
37
- h(this, "store", V());
37
+ h(this, "store", B());
38
38
  h(this, "unsubscribeOrientation", null);
39
39
  /**
40
40
  * Debounced version of _onColumnSpacingChange
@@ -63,48 +63,39 @@ class j extends R {
63
63
  }, 300));
64
64
  }
65
65
  getId() {
66
- return U;
66
+ return W;
67
67
  }
68
68
  getTemplate() {
69
69
  return `
70
70
  <div class="spacing-control-container">
71
71
  ${this._GuTwoColumns([
72
- this._GuLabel({
73
- text: this.api.translate("Column Spacing (px)"),
74
- name: n.COLUMN_SPACING_LABEL
75
- }),
72
+ this._GuLabel({ text: "Column Spacing on Desktop (px)", name: i.COLUMN_SPACING_LABEL }),
76
73
  this._GuCounter({
77
- name: n.COLUMN_SPACING,
74
+ name: i.COLUMN_SPACING,
78
75
  minValue: N,
79
76
  maxValue: _,
80
77
  step: S
81
78
  }),
82
- this._GuLabel({
83
- text: this.api.translate("Row Spacing (px)"),
84
- name: n.ROW_SPACING_LABEL
85
- }),
79
+ this._GuLabel({ text: "Row Spacing on Desktop (px)", name: i.ROW_SPACING_LABEL }),
86
80
  this._GuCounter({
87
- name: n.ROW_SPACING,
81
+ name: i.ROW_SPACING,
88
82
  minValue: N,
89
83
  maxValue: _,
90
84
  step: S
91
85
  }),
92
86
  this._GuLabel({
93
- text: this.api.translate("Column Spacing on Mobile (px)"),
94
- name: n.MOBILE_COLUMN_SPACING_LABEL
87
+ text: "Column Spacing on Mobile (px)",
88
+ name: i.MOBILE_COLUMN_SPACING_LABEL
95
89
  }),
96
90
  this._GuCounter({
97
- name: n.MOBILE_COLUMN_SPACING,
91
+ name: i.MOBILE_COLUMN_SPACING,
98
92
  minValue: N,
99
93
  maxValue: _,
100
94
  step: S
101
95
  }),
102
- this._GuLabel({
103
- text: this.api.translate("Row Spacing on Mobile (px)"),
104
- name: n.MOBILE_ROW_SPACING_LABEL
105
- }),
96
+ this._GuLabel({ text: "Row Spacing on Mobile (px)", name: i.MOBILE_ROW_SPACING_LABEL }),
106
97
  this._GuCounter({
107
- name: n.MOBILE_ROW_SPACING,
98
+ name: i.MOBILE_ROW_SPACING,
108
99
  minValue: N,
109
100
  maxValue: _,
110
101
  step: S
@@ -114,7 +105,7 @@ class j extends R {
114
105
  `;
115
106
  }
116
107
  onRender() {
117
- this._setFormValues(), this._updateSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges();
108
+ this._setFormValues(), this._updateSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges(), this._subscribeToEditorModeChanges();
118
109
  }
119
110
  onTemplateNodeUpdated(t) {
120
111
  super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateSpacingVisibility();
@@ -123,23 +114,26 @@ class j extends R {
123
114
  this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
124
115
  }
125
116
  /**
126
- * Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
117
+ * Checks if the editor is currently in mobile preview mode
118
+ * using Stripo's EditorStatePropertyType API.
119
+ */
120
+ _isMobileMode() {
121
+ return this.api.getEditorState()[y.previewDeviceMode] === w.MOBILE;
122
+ }
123
+ /**
124
+ * Updates spacing control visibility based on layout orientation, editor mode,
125
+ * and products-per-row count.
127
126
  * - List layout: hide column spacing (products are full-width), hide ALL mobile
128
127
  * spacing controls (list is responsive — single row spacing applies to both views)
129
- * - Desktop controls: always visible for grid layout (column spacing needs 2+ per row)
130
- * - Mobile controls: visible when mobileLayoutEnabled is true (grid only)
128
+ * - Desktop mode: show desktop spacing, hide mobile spacing
129
+ * - Mobile mode: show mobile spacing, hide desktop spacing
130
+ * - 1 product per row: hide column spacing (no gap between single column)
131
131
  */
132
132
  _updateSpacingVisibility() {
133
133
  if (!this.api)
134
134
  return;
135
- const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || b(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, l = t.mobileCardsInRow > 1;
136
- this.api.setVisibility(n.COLUMN_SPACING, i && r), this.api.setVisibility(n.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(n.ROW_SPACING, !0), this.api.setVisibility(n.ROW_SPACING_LABEL, !0), this.api.setVisibility(
137
- n.MOBILE_COLUMN_SPACING,
138
- i && a && l
139
- ), this.api.setVisibility(
140
- n.MOBILE_COLUMN_SPACING_LABEL,
141
- i && a && l
142
- ), this.api.setVisibility(n.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(n.MOBILE_ROW_SPACING_LABEL, i && a);
135
+ const t = d.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, n = t.layout || e || b(this.currentNode), o = n === "grid", a = n === "list", r = this._isMobileMode(), l = t.cardsInRow > 1, u = t.mobileCardsInRow > 1;
136
+ this.api.setVisibility(i.COLUMN_SPACING, o && !r && l), this.api.setVisibility(i.COLUMN_SPACING_LABEL, o && !r && l), this.api.setVisibility(i.ROW_SPACING, a || !r), this.api.setVisibility(i.ROW_SPACING_LABEL, a || !r), this.api.setVisibility(i.MOBILE_COLUMN_SPACING, o && r && u), this.api.setVisibility(i.MOBILE_COLUMN_SPACING_LABEL, o && r && u), this.api.setVisibility(i.MOBILE_ROW_SPACING, !a && r), this.api.setVisibility(i.MOBILE_ROW_SPACING_LABEL, !a && r);
143
137
  }
144
138
  /**
145
139
  * Reads spacing values from node config first, falls back to DOM styles.
@@ -148,12 +142,12 @@ class j extends R {
148
142
  _setFormValues() {
149
143
  if (!this.api)
150
144
  return;
151
- const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), o = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
145
+ const t = d.hasConfig(this.currentNode), e = d.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), o = t ? e.rowSpacing : this._getStoredRowSpacing();
152
146
  this.api.updateValues({
153
- [n.COLUMN_SPACING]: o,
154
- [n.ROW_SPACING]: i,
155
- [n.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
156
- [n.MOBILE_ROW_SPACING]: e.mobileRowSpacing
147
+ [i.COLUMN_SPACING]: n,
148
+ [i.ROW_SPACING]: o,
149
+ [i.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
150
+ [i.MOBILE_ROW_SPACING]: e.mobileRowSpacing
157
151
  });
158
152
  }
159
153
  /**
@@ -168,13 +162,13 @@ class j extends R {
168
162
  return C;
169
163
  const t = this.currentNode.querySelector(m) ?? this.currentNode;
170
164
  if (b(this.currentNode) === "grid") {
171
- const d = t.querySelector(".recommendation-attribute-row"), s = d == null ? void 0 : d.querySelector("td"), I = A(s, "padding");
165
+ const u = t.querySelector(".recommendation-attribute-row"), s = u == null ? void 0 : u.querySelector("td"), I = A(s, "padding");
172
166
  if (!I)
173
167
  return C;
174
- const y = I.trim().split(/\s+/);
175
- return y.length < 2 ? C : L(y[1], C / 2) * 2;
168
+ const M = I.trim().split(/\s+/);
169
+ return M.length < 2 ? C : L(M[1], C / 2) * 2;
176
170
  }
177
- const o = t.querySelector(".product-card-wrapper"), i = w(o), a = A(i, "padding");
171
+ const n = t.querySelector(".product-card-wrapper"), o = U(n), a = A(o, "padding");
178
172
  if (!a)
179
173
  return C;
180
174
  const r = a.trim().split(/\s+/);
@@ -186,9 +180,9 @@ class j extends R {
186
180
  */
187
181
  _getStoredRowSpacing() {
188
182
  if (!this.currentNode)
189
- return E;
190
- const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer"), o = A(e, "height");
191
- return L(o, E);
183
+ return P;
184
+ const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer"), n = A(e, "height");
185
+ return L(n, P);
192
186
  }
193
187
  // ========================================================================
194
188
  // Desktop Spacing Handlers
@@ -200,22 +194,22 @@ class j extends R {
200
194
  _onColumnSpacingChange(t) {
201
195
  if (!this.currentNode)
202
196
  return;
203
- p.updateConfig(
197
+ d.updateConfig(
204
198
  this.api,
205
199
  this.currentNode,
206
200
  { columnSpacing: t },
207
201
  `Changed column spacing to ${t}px`
208
202
  ), this._storeDataAttribute(O.COLUMN_SPACING, t);
209
- const o = p.getConfig(this.currentNode).layout || b(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(m);
210
- l && (o === "grid" ? Array.from(
203
+ const n = d.getConfig(this.currentNode).layout || b(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(m);
204
+ l && (n === "grid" ? Array.from(
211
205
  l.querySelectorAll(".attribute-cell")
212
206
  ).forEach((s) => {
213
- i.modifyHtml(s).setStyle("padding", r);
207
+ o.modifyHtml(s).setStyle("padding", r);
214
208
  }) : Array.from(
215
209
  l.querySelectorAll(".product-card-wrapper")
216
210
  ).forEach((s) => {
217
- "parent" in s && s.parent() && i.modifyHtml(s.parent()).setStyle("padding", r);
218
- }), i.apply(new g(`Update column spacing to ${t}px`)));
211
+ "parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", r);
212
+ }), o.apply(new g(`Update column spacing to ${t}px`)));
219
213
  }
220
214
  /**
221
215
  * Handles row spacing changes for desktop.
@@ -224,7 +218,7 @@ class j extends R {
224
218
  _onRowSpacingChange(t) {
225
219
  if (!this.currentNode)
226
220
  return;
227
- p.updateConfig(
221
+ d.updateConfig(
228
222
  this.api,
229
223
  this.currentNode,
230
224
  { rowSpacing: t },
@@ -233,15 +227,15 @@ class j extends R {
233
227
  const e = this.currentNode.querySelector(m);
234
228
  if (!e)
235
229
  return;
236
- const o = Array.from(
230
+ const n = Array.from(
237
231
  e.querySelectorAll(".spacer")
238
232
  );
239
- if (!o.length)
233
+ if (!n.length)
240
234
  return;
241
- const i = this.api.getDocumentModifier(), a = `${t}px`;
242
- o.forEach((r) => {
243
- i.modifyHtml(r).setStyle("height", a);
244
- }), i.apply(new g(`Update row spacing to ${t}px`));
235
+ const o = this.api.getDocumentModifier(), a = `${t}px`;
236
+ n.forEach((r) => {
237
+ o.modifyHtml(r).setStyle("height", a);
238
+ }), o.apply(new g(`Update row spacing to ${t}px`));
245
239
  }
246
240
  // ========================================================================
247
241
  // Mobile Spacing Handlers
@@ -253,22 +247,22 @@ class j extends R {
253
247
  _onMobileColumnSpacingChange(t) {
254
248
  if (!this.currentNode)
255
249
  return;
256
- p.updateConfig(
250
+ d.updateConfig(
257
251
  this.api,
258
252
  this.currentNode,
259
253
  { mobileColumnSpacing: t },
260
254
  `Changed mobile column spacing to ${t}px`
261
255
  ), this._storeDataAttribute(O.MOBILE_COLUMN_SPACING, t);
262
- const o = p.getConfig(this.currentNode).layout || b(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(M);
263
- l && (o === "grid" ? Array.from(
256
+ const n = d.getConfig(this.currentNode).layout || b(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(E);
257
+ l && (n === "grid" ? Array.from(
264
258
  l.querySelectorAll(".attribute-cell")
265
259
  ).forEach((s) => {
266
- i.modifyHtml(s).setStyle("padding", r);
260
+ o.modifyHtml(s).setStyle("padding", r);
267
261
  }) : Array.from(
268
262
  l.querySelectorAll(".product-card-wrapper")
269
263
  ).forEach((s) => {
270
- "parent" in s && s.parent() && i.modifyHtml(s.parent()).setStyle("padding", r);
271
- }), i.apply(new g(`Update mobile column spacing to ${t}px`)));
264
+ "parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", r);
265
+ }), o.apply(new g(`Update mobile column spacing to ${t}px`)));
272
266
  }
273
267
  /**
274
268
  * Handles row spacing changes for mobile.
@@ -277,24 +271,24 @@ class j extends R {
277
271
  _onMobileRowSpacingChange(t) {
278
272
  if (!this.currentNode)
279
273
  return;
280
- p.updateConfig(
274
+ d.updateConfig(
281
275
  this.api,
282
276
  this.currentNode,
283
277
  { mobileRowSpacing: t },
284
278
  `Changed mobile row spacing to ${t}px`
285
279
  ), this._storeDataAttribute(O.MOBILE_ROW_SPACING, t);
286
- const e = this.currentNode.querySelector(M);
280
+ const e = this.currentNode.querySelector(E);
287
281
  if (!e)
288
282
  return;
289
- const o = Array.from(
283
+ const n = Array.from(
290
284
  e.querySelectorAll(".spacer")
291
285
  );
292
- if (!o.length)
286
+ if (!n.length)
293
287
  return;
294
- const i = this.api.getDocumentModifier(), a = `${t}px`;
295
- o.forEach((r) => {
296
- i.modifyHtml(r).setStyle("height", a);
297
- }), i.apply(new g(`Update mobile row spacing to ${t}px`));
288
+ const o = this.api.getDocumentModifier(), a = `${t}px`;
289
+ n.forEach((r) => {
290
+ o.modifyHtml(r).setStyle("height", a);
291
+ }), o.apply(new g(`Update mobile row spacing to ${t}px`));
298
292
  }
299
293
  // ========================================================================
300
294
  // Data Attribute Storage
@@ -303,23 +297,23 @@ class j extends R {
303
297
  * Stores a spacing value as a data attribute on the block root element
304
298
  */
305
299
  _storeDataAttribute(t, e) {
306
- const o = B(this.currentNode);
307
- o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new g(`Store ${t}`));
300
+ const n = x(this.currentNode);
301
+ n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new g(`Store ${t}`));
308
302
  }
309
303
  // ========================================================================
310
304
  // Event Listeners
311
305
  // ========================================================================
312
306
  _listenToFormUpdates() {
313
- this.api.onValueChanged(n.COLUMN_SPACING, (t) => {
307
+ this.api.onValueChanged(i.COLUMN_SPACING, (t) => {
314
308
  const e = parseInt(t);
315
309
  Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
316
- }), this.api.onValueChanged(n.ROW_SPACING, (t) => {
310
+ }), this.api.onValueChanged(i.ROW_SPACING, (t) => {
317
311
  const e = parseInt(t);
318
312
  Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
319
- }), this.api.onValueChanged(n.MOBILE_COLUMN_SPACING, (t) => {
313
+ }), this.api.onValueChanged(i.MOBILE_COLUMN_SPACING, (t) => {
320
314
  const e = parseInt(t);
321
315
  Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
322
- }), this.api.onValueChanged(n.MOBILE_ROW_SPACING, (t) => {
316
+ }), this.api.onValueChanged(i.MOBILE_ROW_SPACING, (t) => {
323
317
  const e = parseInt(t);
324
318
  Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
325
319
  });
@@ -333,8 +327,20 @@ class j extends R {
333
327
  t.type === "patch object" && (this._updateSpacingVisibility(), this._setFormValues());
334
328
  });
335
329
  }
330
+ /**
331
+ * Subscribes to editor preview mode changes via Stripo API.
332
+ * Toggles which spacing controls (desktop/mobile) are visible.
333
+ */
334
+ _subscribeToEditorModeChanges() {
335
+ this.api.onEditorStatePropUpdated(
336
+ y.previewDeviceMode,
337
+ () => {
338
+ this._updateSpacingVisibility();
339
+ }
340
+ );
341
+ }
336
342
  }
337
343
  export {
338
- U as SPACING_CONTROL_ID,
339
- j as SpacingControl
344
+ W as SPACING_CONTROL_ID,
345
+ X as SpacingControl
340
346
  };