@useinsider/guido 2.0.0-beta.da696d5 → 2.0.0-beta.dbde199

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 (111) hide show
  1. package/dist/extensions/Blocks/Items/controls/cardComposition.js +13 -4
  2. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +158 -68
  3. package/dist/extensions/Blocks/Recommendation/constants.js +10 -1
  4. package/dist/extensions/Blocks/Recommendation/control.js +91 -61
  5. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
  6. package/dist/extensions/Blocks/Recommendation/controls/index.js +272 -0
  7. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
  8. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +71 -0
  9. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +71 -0
  10. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +71 -0
  11. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +71 -0
  12. package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +60 -0
  13. package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +160 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
  15. package/dist/extensions/Blocks/Recommendation/extension.js +16 -40
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +124 -71
  17. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +89 -65
  18. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +56 -19
  19. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +74 -45
  20. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +25 -0
  21. package/dist/extensions/Blocks/controlFactories.js +70 -70
  22. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +363 -290
  23. package/dist/package.json.js +1 -1
  24. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +54 -3
  25. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +41 -1
  26. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +5 -2
  27. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +25 -0
  28. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +654 -0
  29. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +15 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +15 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +15 -0
  33. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +15 -0
  34. package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +16 -0
  35. package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +50 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +60 -0
  37. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +3 -3
  38. package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +15 -7
  40. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +19 -0
  41. package/dist/static/styles/components/wide-panel.css.js +0 -4
  42. package/dist/static/styles/customEditorStyle.css.js +13 -0
  43. package/package.json +3 -3
  44. package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -13
  45. package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -13
  46. package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -13
  47. package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -13
  48. package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -13
  49. package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -13
  50. package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -13
  51. package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -13
  52. package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -13
  53. package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -13
  54. package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -13
  55. package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +0 -13
  56. package/dist/extensions/Blocks/Recommendation/controls/image/size.js +0 -13
  57. package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -13
  58. package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -13
  59. package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -13
  60. package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -13
  61. package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -13
  62. package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -13
  63. package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -13
  64. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +0 -13
  65. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +0 -13
  66. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +0 -13
  67. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +0 -13
  68. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +0 -13
  69. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +0 -13
  70. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +0 -13
  71. package/dist/extensions/Blocks/Recommendation/controls/price/align.js +0 -13
  72. package/dist/extensions/Blocks/Recommendation/controls/price/background.js +0 -13
  73. package/dist/extensions/Blocks/Recommendation/controls/price/color.js +0 -13
  74. package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +0 -13
  75. package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +0 -13
  76. package/dist/extensions/Blocks/Recommendation/controls/price/size.js +0 -13
  77. package/dist/extensions/Blocks/Recommendation/controls/price/style.js +0 -13
  78. package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
  79. package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
  80. package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
  81. package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
  82. package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
  83. package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
  84. package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
  85. package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
  86. package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
  87. package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
  88. package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
  89. package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +0 -5
  90. package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +0 -5
  91. package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
  92. package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
  93. package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
  94. package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
  95. package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
  96. package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
  97. package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
  98. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +0 -5
  99. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +0 -5
  100. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +0 -5
  101. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +0 -5
  102. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +0 -5
  103. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +0 -5
  104. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +0 -5
  105. package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +0 -5
  106. package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +0 -5
  107. package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +0 -5
  108. package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +0 -5
  109. package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +0 -5
  110. package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +0 -5
  111. package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +0 -5
@@ -0,0 +1,160 @@
1
+ import { ModificationDescription as M } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as w } from "../../common-control.js";
3
+ import { RecommendationControlId as N, ATTR_DATA_PRICE_INLINE as E, RecommendationBlockId as g } from "../constants.js";
4
+ const k = N.PRICE_INLINE_LAYOUT, b = ".recommendation-attribute-row", B = "tr.recommendation-product-row", m = "data-attribute-type", T = "data-inline-merged", C = "data-visibility";
5
+ class V extends w {
6
+ getId() {
7
+ return k;
8
+ }
9
+ getTemplate() {
10
+ return `
11
+ <div class="container">
12
+ ${this._GuTwoColumns([
13
+ this._GuLabel({ text: "Move to Next Line" }),
14
+ this._GuToggle("priceNextLine")
15
+ ])}
16
+ <div style="color: #666; font-size: 12px; margin-top: 8px; padding-left: 8px;">
17
+ When disabled, Price and Old Price will appear side by side
18
+ </div>
19
+ </div>
20
+ `;
21
+ }
22
+ onRender() {
23
+ this._initializePriceInlineState(), this._registerValueChangeListener();
24
+ }
25
+ onTemplateNodeUpdated(e) {
26
+ super.onTemplateNodeUpdated(e), this._initializePriceInlineState();
27
+ }
28
+ /**
29
+ * Reads the current price inline state from the block's data attribute
30
+ * and updates the toggle UI
31
+ * Note: Toggle ON = separate rows (next line), Toggle OFF = inline (same row)
32
+ */
33
+ _initializePriceInlineState() {
34
+ const r = !this._readPriceInlineState();
35
+ this.api.updateValues({
36
+ priceNextLine: r
37
+ });
38
+ }
39
+ /**
40
+ * Reads the price inline state from the block wrapper's data attribute
41
+ */
42
+ _readPriceInlineState() {
43
+ if (!this.currentNode || !("getAttribute" in this.currentNode))
44
+ return !1;
45
+ const e = this.currentNode.getAttribute(E);
46
+ return console.debug("inline attr", e), e === "1" || e === "true";
47
+ }
48
+ /**
49
+ * Registers listener for toggle changes
50
+ */
51
+ _registerValueChangeListener() {
52
+ this.api.onValueChanged("priceNextLine", (e) => {
53
+ const r = !e;
54
+ this._applyPriceInlineLayout(r);
55
+ });
56
+ }
57
+ /**
58
+ * Applies the price inline layout by restructuring the DOM
59
+ * When enabling inline: Merges Old Price content into Price row (side by side)
60
+ * When disabling inline: Separates them back into individual rows
61
+ */
62
+ _applyPriceInlineLayout(e) {
63
+ if (!this.currentNode)
64
+ return;
65
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(E, e ? "1" : "0").apply(new M("Update price inline attribute"));
66
+ const r = this.currentNode.querySelectorAll(B);
67
+ if (!(r != null && r.length))
68
+ return;
69
+ const i = this.api.getDocumentModifier();
70
+ r.forEach((t) => {
71
+ e ? this._mergeOldPriceIntoPrice(t, i) : this._separateOldPriceFromPrice(t, i);
72
+ }), i.apply(new M(
73
+ e ? "Merge price rows into inline layout" : "Separate price rows"
74
+ ));
75
+ }
76
+ /**
77
+ * Merges Old Price content into the same row as Price (inline layout)
78
+ * Creates a structure where both prices are side by side in one row
79
+ */
80
+ _mergeOldPriceIntoPrice(e, r) {
81
+ const i = e.querySelector(
82
+ `${b}[${m}="productPrice"]`
83
+ ), t = e.querySelector(
84
+ `${b}[${m}="productOldPrice"]`
85
+ );
86
+ if (!i || !t || "getAttribute" in t && t.getAttribute(T) === "1" || !("querySelectorAll" in i) || !("querySelectorAll" in t))
87
+ return;
88
+ const a = Array.from(i.querySelectorAll("table.product-card-wrapper")), u = Array.from(t.querySelectorAll("table.product-card-wrapper"));
89
+ a.length !== u.length || a.length === 0 || (a.forEach((o, _) => {
90
+ const s = u[_];
91
+ if (!o || !s || !("querySelector" in o) || !("querySelector" in s))
92
+ return;
93
+ const c = `[esd-extension-block-id="${g.PRICE}"]`, f = `[esd-extension-block-id="${g.OLD_PRICE}"]`, n = o.querySelector(c), l = s.querySelector(f);
94
+ if (!n || !l || !("getOuterHTML" in n) || !("getOuterHTML" in l))
95
+ return;
96
+ const h = n.getOuterHTML(), P = `
97
+ <tr data-inline-price-wrapper="1">
98
+ <td width="50%" style="vertical-align: middle;">
99
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
100
+ <tbody>
101
+ <tr><td>${l.getOuterHTML()}</td></tr>
102
+ </tbody>
103
+ </table>
104
+ </td>
105
+ <td width="50%" style="vertical-align: middle;">
106
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
107
+ <tbody>
108
+ <tr><td>${h}</td></tr>
109
+ </tbody>
110
+ </table>
111
+ </td>
112
+ </tr>
113
+ `, y = o.querySelector(".product-attribute-cell");
114
+ if (!y)
115
+ return;
116
+ const d = y.querySelector("tbody");
117
+ d && r.modifyHtml(d).setInnerHtml(P);
118
+ }), r.modifyHtml(t).setStyle("display", "none").setAttribute(T, "1"));
119
+ }
120
+ /**
121
+ * Separates Old Price from Price row back into individual rows
122
+ * Restores the original separate row structure
123
+ */
124
+ _separateOldPriceFromPrice(e, r) {
125
+ const i = e.querySelector(
126
+ `${b}[${m}="productPrice"]`
127
+ ), t = e.querySelector(
128
+ `${b}[${m}="productOldPrice"]`
129
+ );
130
+ if (!i || !t || !("getAttribute" in t) || !(t.getAttribute(T) === "1") || !("querySelectorAll" in i) || !("querySelectorAll" in t))
131
+ return;
132
+ const u = Array.from(i.querySelectorAll("table.product-card-wrapper")), o = Array.from(t.querySelectorAll("table.product-card-wrapper"));
133
+ u.forEach((c, f) => {
134
+ if (!c || !("querySelector" in c))
135
+ return;
136
+ const n = o[f];
137
+ if (!n || !("querySelector" in n))
138
+ return;
139
+ const l = c.querySelector('[data-inline-price-wrapper="1"]');
140
+ if (!l || !("querySelectorAll" in l))
141
+ return;
142
+ const p = Array.from(l.querySelectorAll("td")).filter((O) => "getAttribute" in O && O.getAttribute("width") === "50%");
143
+ if (p.length !== 2)
144
+ return;
145
+ const P = `[esd-extension-block-id="${g.OLD_PRICE}"]`, y = `[esd-extension-block-id="${g.PRICE}"]`, d = p[0].querySelector(P), A = p[1].querySelector(y);
146
+ if (!d || !A || !("getOuterHTML" in d) || !("getOuterHTML" in A))
147
+ return;
148
+ const H = A.getOuterHTML(), R = d.getOuterHTML(), S = c.querySelector(".product-attribute-cell"), L = S == null ? void 0 : S.querySelector("tbody");
149
+ L && r.modifyHtml(L).setInnerHtml(`<tr><td>${H}</td></tr>`);
150
+ const I = n.querySelector(".product-attribute-cell"), q = I == null ? void 0 : I.querySelector("tbody");
151
+ q && r.modifyHtml(q).setInnerHtml(`<tr><td>${R}</td></tr>`);
152
+ });
153
+ const s = t.getAttribute(C) === "0" ? "none" : "table-row";
154
+ r.modifyHtml(t).setStyle("display", s).removeAttribute(T);
155
+ }
156
+ }
157
+ export {
158
+ k as PRICE_INLINE_LAYOUT_CONTROL_ID,
159
+ V as PriceInlineLayoutControl
160
+ };
@@ -0,0 +1,188 @@
1
+ var C = Object.defineProperty;
2
+ var g = (i, r, e) => r in i ? C(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
3
+ var S = (i, r, e) => g(i, typeof r != "symbol" ? r + "" : r, e);
4
+ import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as m } from "../../common-control.js";
6
+ import { useDebounceFn as d } from "../../../../node_modules/@vueuse/shared/index.js";
7
+ const _ = "recommendation-spacing-control", c = {
8
+ COLUMN_SPACING: "columnSpacing",
9
+ ROW_SPACING: "rowSpacing"
10
+ }, N = {
11
+ COLUMN_SPACING: "data-column-spacing",
12
+ ROW_SPACING: "data-row-spacing"
13
+ }, n = {
14
+ COLUMN_SPACING: 10,
15
+ // 5px on each side = 10px total
16
+ ROW_SPACING: 20
17
+ }, p = {
18
+ MIN_SPACING: 0,
19
+ MAX_SPACING: 50,
20
+ STEP: 5
21
+ };
22
+ class G extends m {
23
+ constructor() {
24
+ super(...arguments);
25
+ /**
26
+ * Debounced version of _onColumnSpacingChange
27
+ * Prevents excessive DOM updates when user rapidly adjusts the counter
28
+ */
29
+ S(this, "_debouncedOnColumnSpacingChange", d((e) => {
30
+ this._onColumnSpacingChange(e);
31
+ }, 300));
32
+ /**
33
+ * Debounced version of _onRowSpacingChange
34
+ * Prevents excessive DOM updates when user rapidly adjusts the counter
35
+ */
36
+ S(this, "_debouncedOnRowSpacingChange", d((e) => {
37
+ this._onRowSpacingChange(e);
38
+ }, 300));
39
+ }
40
+ getId() {
41
+ return _;
42
+ }
43
+ getTemplate() {
44
+ return `
45
+ <div class="spacing-control-container">
46
+ ${this._GuTwoColumns([
47
+ this._GuLabel({ text: "Column Spacing (px)" }),
48
+ this._GuCounter({
49
+ name: c.COLUMN_SPACING,
50
+ minValue: p.MIN_SPACING,
51
+ maxValue: p.MAX_SPACING,
52
+ step: p.STEP
53
+ }),
54
+ this._GuLabel({ text: "Row Spacing (px)" }),
55
+ this._GuCounter({
56
+ name: c.ROW_SPACING,
57
+ minValue: p.MIN_SPACING,
58
+ maxValue: p.MAX_SPACING,
59
+ step: p.STEP
60
+ })
61
+ ])}
62
+ </div>
63
+ `;
64
+ }
65
+ onRender() {
66
+ this._setFormValues(), this._listenToFormUpdates();
67
+ }
68
+ onTemplateNodeUpdated(e) {
69
+ super.onTemplateNodeUpdated(e), this._setFormValues();
70
+ }
71
+ /**
72
+ * Reads spacing values from data attributes or returns defaults
73
+ */
74
+ _setFormValues() {
75
+ const e = this._getStoredColumnSpacing(), t = this._getStoredRowSpacing();
76
+ this.api.updateValues({
77
+ [c.COLUMN_SPACING]: e,
78
+ [c.ROW_SPACING]: t
79
+ });
80
+ }
81
+ /**
82
+ * Gets stored column spacing from the first product card wrapper's parent element's padding
83
+ * Reads the actual padding value instead of relying on data attributes
84
+ *
85
+ * The padding is applied as "0 {halfSpacing}px" on the parent TD element,
86
+ * so we need to extract the horizontal padding value and multiply by 2 to get total spacing.
87
+ */
88
+ _getStoredColumnSpacing() {
89
+ if (!this.currentNode)
90
+ return n.COLUMN_SPACING;
91
+ const e = this.currentNode.querySelector(".product-card-wrapper");
92
+ if (!e || !("parent" in e) || typeof e.parent != "function")
93
+ return n.COLUMN_SPACING;
94
+ const t = e.parent();
95
+ if (!t || !("getStyle" in t))
96
+ return n.COLUMN_SPACING;
97
+ const o = t.getStyle("padding");
98
+ if (!o)
99
+ return n.COLUMN_SPACING;
100
+ const u = o.trim().split(/\s+/);
101
+ if (u.length < 2)
102
+ return n.COLUMN_SPACING;
103
+ const [, a] = u, s = parseFloat(a);
104
+ return Number.isNaN(s) ? n.COLUMN_SPACING : s * 2;
105
+ }
106
+ /**
107
+ * Gets stored row spacing from the first spacer element's height style
108
+ * Reads the actual height value instead of relying on data attributes
109
+ */
110
+ _getStoredRowSpacing() {
111
+ if (!this.currentNode)
112
+ return n.ROW_SPACING;
113
+ const e = this.currentNode.querySelector(".spacer");
114
+ if (!e || !("getStyle" in e))
115
+ return n.ROW_SPACING;
116
+ const t = e.getStyle("height");
117
+ if (!t)
118
+ return n.ROW_SPACING;
119
+ const o = parseFloat(t);
120
+ return Number.isNaN(o) ? n.ROW_SPACING : o;
121
+ }
122
+ /**
123
+ * Handles column spacing changes
124
+ * Applies horizontal padding to all product card wrappers
125
+ */
126
+ _onColumnSpacingChange(e) {
127
+ if (!this.currentNode)
128
+ return;
129
+ const t = Array.from(
130
+ this.currentNode.querySelectorAll(".product-card-wrapper")
131
+ );
132
+ if (!t)
133
+ return;
134
+ const o = this.api.getDocumentModifier(), a = `0 ${e / 2}px`;
135
+ console.debug("padding", a), t.forEach((s) => {
136
+ "parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", a);
137
+ }), o.apply(new l(`Update column spacing to ${e}px`));
138
+ }
139
+ /**
140
+ * Handles row spacing changes
141
+ * Applies height to all spacer elements between product rows
142
+ */
143
+ _onRowSpacingChange(e) {
144
+ if (!this.currentNode)
145
+ return;
146
+ this._storeRowSpacing(e);
147
+ const t = Array.from(
148
+ this.currentNode.querySelectorAll(".spacer")
149
+ );
150
+ if (console.debug("spacerCells", t), console.debug("spacing", e), !t.length)
151
+ return;
152
+ const o = this.api.getDocumentModifier(), u = `${e}px`;
153
+ t.forEach((a) => {
154
+ o.modifyHtml(a).setStyle("height", u);
155
+ }), o.apply(new l(`Update row spacing to ${e}px`));
156
+ }
157
+ /**
158
+ * Stores column spacing value in block data attribute
159
+ */
160
+ _storeColumnSpacing(e) {
161
+ if (!this.currentNode)
162
+ return;
163
+ const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
164
+ t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.COLUMN_SPACING, e.toString()).apply(new l("Store column spacing"));
165
+ }
166
+ /**
167
+ * Stores row spacing value in block data attribute
168
+ */
169
+ _storeRowSpacing(e) {
170
+ if (!this.currentNode)
171
+ return;
172
+ const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
173
+ t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N.ROW_SPACING, e.toString()).apply(new l("Store row spacing"));
174
+ }
175
+ _listenToFormUpdates() {
176
+ this.api.onValueChanged(c.COLUMN_SPACING, (e) => {
177
+ const t = parseInt(e);
178
+ Number.isNaN(t) || this._debouncedOnColumnSpacingChange(t);
179
+ }), this.api.onValueChanged(c.ROW_SPACING, (e) => {
180
+ const t = parseInt(e);
181
+ Number.isNaN(t) || this._debouncedOnRowSpacingChange(t);
182
+ });
183
+ }
184
+ }
185
+ export {
186
+ _ as SPACING_CONTROL_ID,
187
+ G as SpacingControl
188
+ };
@@ -1,45 +1,21 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { RecommendationBlock as r } from "./block.js";
2
+ import { RecommendationBlock as n } from "./block.js";
3
3
  import { RecommendationCardCompositionControl as t } from "./cardCompositionControl.js";
4
- import { RecommendationBlockControl as n } from "./control.js";
5
- import { ButtonAlignControl as d } from "./controls/button/align.js";
6
- import { ButtonBorderControl as l } from "./controls/button/border.js";
7
- import { ButtonBorderRadiusControl as m } from "./controls/button/borderRadius.js";
8
- import { ButtonColorControl as i } from "./controls/button/color.js";
9
- import { ButtonFitToContentControl as C } from "./controls/button/fitToContent.js";
10
- import { ButtonFontFamilyControl as a } from "./controls/button/fontFamily.js";
11
- import { ButtonMarginsControl as e } from "./controls/button/margins.js";
12
- import { ButtonPaddingsControl as p } from "./controls/button/paddings.js";
13
- import { ButtonTextControl as f } from "./controls/button/text.js";
14
- import { ButtonTextSizeControl as c } from "./controls/button/textSize.js";
15
- import { ButtonTextStyleAndFontColorControl as s } from "./controls/button/textStyleAndFontColor.js";
16
- import { ImageMarginsControl as g } from "./controls/image/margins.js";
17
- import { ImageSizeControl as B } from "./controls/image/size.js";
18
- import { NameAlignControl as P } from "./controls/name/align.js";
19
- import { NameBackgroundControl as u } from "./controls/name/background.js";
20
- import { NameColorControl as y } from "./controls/name/color.js";
21
- import { NameFontFamilyControl as S } from "./controls/name/fontFamily.js";
22
- import { NamePaddingsControl as F } from "./controls/name/paddings.js";
23
- import { NameSizeControl as R } from "./controls/name/size.js";
24
- import { NameStyleControl as N } from "./controls/name/style.js";
25
- import { OldPriceAlignControl as O } from "./controls/oldPrice/align.js";
26
- import { OldPriceBackgroundControl as k } from "./controls/oldPrice/background.js";
27
- import { OldPriceColorControl as x } from "./controls/oldPrice/color.js";
28
- import { OldPriceFontFamilyControl as z } from "./controls/oldPrice/fontFamily.js";
29
- import { OldPricePaddingsControl as A } from "./controls/oldPrice/paddings.js";
30
- import { OldPriceSizeControl as I } from "./controls/oldPrice/size.js";
31
- import { OldPriceStyleControl as T } from "./controls/oldPrice/style.js";
32
- import { PriceAlignControl as w } from "./controls/price/align.js";
33
- import { PriceBackgroundControl as h } from "./controls/price/background.js";
34
- import { PriceColorControl as M } from "./controls/price/color.js";
35
- import { PriceFontFamilyControl as b } from "./controls/price/fontFamily.js";
36
- import { PricePaddingsControl as E } from "./controls/price/paddings.js";
37
- import { PriceSizeControl as j } from "./controls/price/size.js";
38
- import { PriceStyleControl as q } from "./controls/price/style.js";
39
- import { RecommendationIconsRegistry as v } from "./iconsRegistry.js";
40
- import D from "./recommendation.css.js";
41
- import { SettingsPanel as G } from "./settingsPanel.js";
42
- const Io = new o().addBlock(r).withSettingsPanelRegistry(G).addControl(n).addControl(d).addControl(l).addControl(m).addControl(i).addControl(C).addControl(a).addControl(e).addControl(p).addControl(f).addControl(c).addControl(s).addControl(g).addControl(B).addControl(P).addControl(u).addControl(y).addControl(S).addControl(F).addControl(R).addControl(N).addControl(O).addControl(k).addControl(x).addControl(z).addControl(A).addControl(I).addControl(T).addControl(w).addControl(h).addControl(M).addControl(b).addControl(E).addControl(j).addControl(q).addControl(t).addStyles(D).withIconsRegistry(v).build();
4
+ import { RecommendationBlockControl as r } from "./control.js";
5
+ import { ButtonAlignControl as l, ButtonBorderControl as d, ButtonBorderRadiusControl as C, ButtonColorControl as i, ButtonFitToContentControl as a, ButtonFontFamilyControl as e, ButtonMarginsControl as m, ButtonPaddingsControl as c, ButtonTextControl as s, ButtonTextSizeControl as u, ButtonTextStyleAndFontColorControl as P, ImageMarginsControl as g, ImageSizeControl as O, NameAlignControl as p, NameBackgroundControl as B, NameColorControl as f, NameFontFamilyControl as S, NameLineSpacingControl as b, NamePaddingsControl as y, NameSizeControl as F, NameStyleControl as x, OldPriceAlignControl as D, OldPriceBackgroundControl as T, OldPriceColorControl as k, OldPriceFontFamilyControl as A, OldPriceLineSpacingControl as N, OldPricePaddingsControl as R, OldPriceSizeControl as z, OldPriceStyleControl as L, OmnibusPriceAlignControl as I, OmnibusPriceBackgroundControl as w, OmnibusPriceColorControl as h, OmnibusPriceFontFamilyControl as M, OmnibusPriceLineSpacingControl as E, OmnibusPricePaddingsControl as H, OmnibusPriceSizeControl as j, OmnibusPriceStyleControl as q, OmnibusDiscountAlignControl as v, OmnibusDiscountBackgroundControl as G, OmnibusDiscountColorControl as J, OmnibusDiscountFontFamilyControl as K, OmnibusDiscountLineSpacingControl as Q, OmnibusDiscountPaddingsControl as U, OmnibusDiscountSizeControl as V, OmnibusDiscountStyleControl as W, PriceAlignControl as X, PriceBackgroundControl as Y, PriceColorControl as Z, PriceFontFamilyControl as _, PriceLineSpacingControl as $, PricePaddingsControl as oo, PriceSizeControl as no, PriceStyleControl as to } from "./controls/index.js";
6
+ import { RecommendationIconsRegistry as ro } from "./iconsRegistry.js";
7
+ import lo from "./recommendation.css.js";
8
+ import { SettingsPanel as Co } from "./settingsPanel.js";
9
+ import { CardBackgroundColorControl as io } from "./controls/cardBackgroundColorControl.js";
10
+ import { SpacingControl as ao } from "./controls/spacingControl.js";
11
+ import { PriceInlineLayoutControl as eo } from "./controls/priceInlineLayoutControl.js";
12
+ import { NameTextTrimControl as mo } from "./controls/nameTextTrimControl.js";
13
+ import { OmnibusPriceTextBeforeControl as co } from "./controls/omnibusPriceTextBeforeControl.js";
14
+ import { OmnibusPriceTextAfterControl as so } from "./controls/omnibusPriceTextAfterControl.js";
15
+ import { OmnibusDiscountTextBeforeControl as uo } from "./controls/omnibusDiscountTextBeforeControl.js";
16
+ import { OmnibusDiscountTextAfterControl as Po } from "./controls/omnibusDiscountTextAfterControl.js";
17
+ import { PriceHideControl as go } from "./controls/priceHideControl.js";
18
+ const Io = new o().addBlock(n).withSettingsPanelRegistry(Co).addControl(r).addControl(io).addControl(ao).addControl(eo).addControl(l).addControl(d).addControl(C).addControl(i).addControl(a).addControl(e).addControl(m).addControl(c).addControl(s).addControl(u).addControl(P).addControl(g).addControl(O).addControl(p).addControl(B).addControl(f).addControl(S).addControl(b).addControl(y).addControl(F).addControl(x).addControl(mo).addControl(D).addControl(T).addControl(k).addControl(A).addControl(N).addControl(R).addControl(z).addControl(L).addControl(I).addControl(w).addControl(h).addControl(M).addControl(E).addControl(H).addControl(j).addControl(q).addControl(co).addControl(so).addControl(v).addControl(G).addControl(J).addControl(K).addControl(Q).addControl(U).addControl(V).addControl(W).addControl(uo).addControl(Po).addControl(X).addControl(Y).addControl(Z).addControl(_).addControl(go).addControl($).addControl(oo).addControl(no).addControl(to).addControl(t).addStyles(lo).withIconsRegistry(ro).build();
43
19
  export {
44
20
  Io as default
45
21
  };
@@ -1,117 +1,170 @@
1
- import { SettingsPanelRegistry as N, SettingsPanelTab as _, SettingsTab as E, ContainerControls as S, TextControls as L } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { SettingsPanelRegistry as E, SettingsPanelTab as I, SettingsTab as N, ContainerControls as S, TextControls as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { BLOCK_ID as R } from "./block.js";
3
- import { COMPOSITION_CONTROL_BLOCK_ID as C } from "./cardCompositionControl.js";
4
- import { RecommendationBlockId as I, RecommendationControlId as T } from "./constants.js";
5
- import { CONTROL_BLOCK_ID as e } from "./control.js";
6
- class G extends N {
3
+ import { COMPOSITION_CONTROL_BLOCK_ID as L } from "./cardCompositionControl.js";
4
+ import { RecommendationBlockId as T, RecommendationControlId as _ } from "./constants.js";
5
+ import { CONTROL_BLOCK_ID as A } from "./control.js";
6
+ import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackgroundColorControl.js";
7
+ import { PRICE_INLINE_LAYOUT_CONTROL_ID as D } from "./controls/priceInlineLayoutControl.js";
8
+ import { SPACING_CONTROL_ID as B } from "./controls/spacingControl.js";
9
+ class Y extends E {
7
10
  registerBlockControls(O) {
8
11
  O[R] = [
9
- new _(
10
- E.SETTINGS,
12
+ new I(
13
+ N.SETTINGS,
11
14
  [
12
- e,
15
+ A,
16
+ D,
13
17
  S.EXTERNAL_INDENTS
14
18
  ]
15
19
  ),
16
- new _(
17
- E.STYLES,
20
+ new I(
21
+ N.STYLES,
18
22
  [
19
- L.TEXT_BLOCK_BACKGROUND_COLOR
23
+ C.TEXT_BLOCK_BACKGROUND_COLOR,
24
+ U,
25
+ B
20
26
  ]
21
27
  ),
22
- new _(
28
+ new I(
23
29
  "Card Composition",
24
30
  [
25
- C
31
+ L
26
32
  ]
27
33
  ).withLabel("Card Composition")
28
- ], O[I.NAME] = [
29
- new _(
30
- E.SETTINGS,
34
+ ], O[T.NAME] = [
35
+ new I(
36
+ N.SETTINGS,
31
37
  [
32
- T.NAME_BACKGROUND,
33
- T.NAME_COLOR,
34
- T.NAME_SIZE,
35
- T.NAME_STYLE,
36
- T.NAME_FONT_FAMILY
38
+ _.NAME_STYLE,
39
+ _.NAME_ALIGN,
40
+ _.NAME_TEXT_TRIM,
41
+ _.NAME_PADDINGS
37
42
  ]
38
43
  ),
39
- new _(
40
- E.STYLES,
44
+ new I(
45
+ N.STYLES,
41
46
  [
42
- T.NAME_ALIGN,
43
- T.NAME_PADDINGS
47
+ _.NAME_BACKGROUND,
48
+ _.NAME_FONT_FAMILY,
49
+ _.NAME_LINE_SPACING,
50
+ _.NAME_SIZE,
51
+ _.NAME_COLOR
44
52
  ]
45
53
  )
46
- ], O[I.PRICE] = [
47
- new _(
48
- E.SETTINGS,
54
+ ], O[T.PRICE] = [
55
+ new I(
56
+ N.SETTINGS,
49
57
  [
50
- T.PRICE_BACKGROUND,
51
- T.PRICE_COLOR,
52
- T.PRICE_SIZE,
53
- T.PRICE_STYLE,
54
- T.PRICE_FONT_FAMILY
58
+ _.PRICE_STYLE,
59
+ _.PRICE_ALIGN,
60
+ _.PRICE_HIDE_IF_SAME,
61
+ _.PRICE_PADDINGS
55
62
  ]
56
63
  ),
57
- new _(
58
- E.STYLES,
64
+ new I(
65
+ N.STYLES,
59
66
  [
60
- T.PRICE_ALIGN,
61
- T.PRICE_PADDINGS
67
+ _.PRICE_BACKGROUND,
68
+ _.PRICE_FONT_FAMILY,
69
+ _.PRICE_LINE_SPACING,
70
+ _.PRICE_SIZE,
71
+ _.PRICE_COLOR
62
72
  ]
63
73
  )
64
- ], O[I.OLD_PRICE] = [
65
- new _(
66
- E.SETTINGS,
74
+ ], O[T.OLD_PRICE] = [
75
+ new I(
76
+ N.SETTINGS,
67
77
  [
68
- T.OLD_PRICE_BACKGROUND,
69
- T.OLD_PRICE_COLOR,
70
- T.OLD_PRICE_SIZE,
71
- T.OLD_PRICE_STYLE,
72
- T.OLD_PRICE_FONT_FAMILY
78
+ _.OLD_PRICE_STYLE,
79
+ _.OLD_PRICE_ALIGN,
80
+ _.OLD_PRICE_PADDINGS
73
81
  ]
74
82
  ),
75
- new _(
76
- E.STYLES,
83
+ new I(
84
+ N.STYLES,
77
85
  [
78
- T.OLD_PRICE_ALIGN,
79
- T.OLD_PRICE_PADDINGS
86
+ _.OLD_PRICE_BACKGROUND,
87
+ _.OLD_PRICE_FONT_FAMILY,
88
+ _.OLD_PRICE_LINE_SPACING,
89
+ _.OLD_PRICE_SIZE,
90
+ _.OLD_PRICE_COLOR
80
91
  ]
81
92
  )
82
- ], O[I.BUTTON] = [
83
- new _(
84
- E.SETTINGS,
93
+ ], O[T.OMNIBUS_PRICE] = [
94
+ new I(
95
+ N.SETTINGS,
85
96
  [
86
- T.BUTTON_TEXT,
87
- T.BUTTON_ALIGN,
88
- T.BUTTON_MARGINS,
89
- T.BUTTON_PADDINGS
97
+ _.OMNIBUS_PRICE_TEXT_BEFORE,
98
+ _.OMNIBUS_PRICE_TEXT_AFTER,
99
+ _.OMNIBUS_PRICE_STYLE,
100
+ _.OMNIBUS_PRICE_ALIGN,
101
+ _.OMNIBUS_PRICE_PADDINGS
90
102
  ]
91
103
  ),
92
- new _(
93
- E.STYLES,
104
+ new I(
105
+ N.STYLES,
94
106
  [
95
- T.BUTTON_COLOR,
96
- T.BUTTON_FONT_FAMILY,
97
- T.BUTTON_TEXT_SIZE,
98
- T.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
99
- T.BUTTON_FIT_TO_CONTENT,
100
- T.BUTTON_BORDER_RADIUS,
101
- T.BUTTON_BORDER
107
+ _.OMNIBUS_PRICE_BACKGROUND,
108
+ _.OMNIBUS_PRICE_FONT_FAMILY,
109
+ _.OMNIBUS_PRICE_LINE_SPACING,
110
+ _.OMNIBUS_PRICE_SIZE,
111
+ _.OMNIBUS_PRICE_COLOR
102
112
  ]
103
113
  )
104
- ], O[I.IMAGE] = [
105
- new _(
106
- E.SETTINGS,
114
+ ], O[T.OMNIBUS_DISCOUNT] = [
115
+ new I(
116
+ N.SETTINGS,
107
117
  [
108
- T.IMAGE_SIZE,
109
- T.IMAGE_MARGINS
118
+ _.OMNIBUS_DISCOUNT_TEXT_BEFORE,
119
+ _.OMNIBUS_DISCOUNT_TEXT_AFTER,
120
+ _.OMNIBUS_DISCOUNT_STYLE,
121
+ _.OMNIBUS_DISCOUNT_ALIGN,
122
+ _.OMNIBUS_DISCOUNT_PADDINGS
123
+ ]
124
+ ),
125
+ new I(
126
+ N.STYLES,
127
+ [
128
+ _.OMNIBUS_DISCOUNT_BACKGROUND,
129
+ _.OMNIBUS_DISCOUNT_FONT_FAMILY,
130
+ _.OMNIBUS_DISCOUNT_LINE_SPACING,
131
+ _.OMNIBUS_DISCOUNT_SIZE,
132
+ _.OMNIBUS_DISCOUNT_COLOR
133
+ ]
134
+ )
135
+ ], O[T.BUTTON] = [
136
+ new I(
137
+ N.SETTINGS,
138
+ [
139
+ _.BUTTON_TEXT,
140
+ _.BUTTON_ALIGN,
141
+ _.BUTTON_PADDINGS,
142
+ _.BUTTON_MARGINS
143
+ ]
144
+ ),
145
+ new I(
146
+ N.STYLES,
147
+ [
148
+ _.BUTTON_COLOR,
149
+ _.BUTTON_FONT_FAMILY,
150
+ _.BUTTON_TEXT_SIZE,
151
+ _.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
152
+ _.BUTTON_FIT_TO_CONTENT,
153
+ _.BUTTON_BORDER_RADIUS,
154
+ _.BUTTON_BORDER
155
+ ]
156
+ )
157
+ ], O[T.IMAGE] = [
158
+ new I(
159
+ N.SETTINGS,
160
+ [
161
+ _.IMAGE_SIZE,
162
+ _.IMAGE_MARGINS
110
163
  ]
111
164
  )
112
165
  ];
113
166
  }
114
167
  }
115
168
  export {
116
- G as SettingsPanel
169
+ Y as SettingsPanel
117
170
  };