@useinsider/guido 2.1.0-beta.7d0f92a → 2.1.0-beta.860ef21

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 (132) hide show
  1. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
  2. package/dist/composables/useHtmlValidator.js +84 -106
  3. package/dist/composables/useRecommendation.js +21 -54
  4. package/dist/config/compiler/recommendationCompilerRules.js +39 -45
  5. package/dist/config/migrator/recommendationMigrator.js +2 -2
  6. package/dist/enums/extensions/recommendationBlock.js +1 -1
  7. package/dist/enums/recommendation.js +15 -16
  8. package/dist/extensions/Blocks/Recommendation/block.js +9 -130
  9. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
  10. package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
  11. package/dist/extensions/Blocks/Recommendation/control.js +336 -0
  12. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
  13. package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
  15. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
  16. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
  17. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
  18. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
  19. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
  20. package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
  21. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
  22. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
  23. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
  24. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +193 -230
  25. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
  26. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
  27. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
  28. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  29. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
  30. package/dist/extensions/Blocks/controlFactories.js +93 -125
  31. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
  32. package/dist/services/recommendationApi.js +9 -10
  33. package/dist/services/templateLibraryApi.js +13 -16
  34. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  35. package/dist/src/composables/useRecommendation.d.ts +0 -1
  36. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
  37. package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
  38. package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
  39. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
  41. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
  42. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -131
  44. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
  45. package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
  46. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
  47. package/dist/static/styles/components/notification.css.js +1 -0
  48. package/dist/static/styles/components/wide-panel.css.js +15 -0
  49. package/dist/static/styles/customEditorStyle.css.js +2 -25
  50. package/dist/utils/pairProductVariables.js +56 -57
  51. package/dist/utils/templatePreparation.js +14 -15
  52. package/package.json +2 -2
  53. package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -116
  54. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
  55. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
  56. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -65
  57. package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
  58. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
  59. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
  60. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
  61. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
  62. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
  63. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
  64. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
  65. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
  66. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
  67. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -217
  68. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
  69. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -110
  70. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
  71. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
  72. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
  73. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
  74. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
  75. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
  76. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
  77. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
  78. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
  79. package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
  80. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
  81. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  82. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
  83. package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
  84. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
  85. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
  86. package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -122
  87. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
  88. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
  89. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
  90. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
  91. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
  92. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
  93. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
  94. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
  95. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
  96. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
  97. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
  98. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
  99. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
  100. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
  101. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
  102. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
  103. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -68
  104. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
  105. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
  106. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
  107. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
  108. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
  109. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
  110. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
  111. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
  112. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
  113. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
  114. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
  115. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
  116. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
  117. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
  118. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
  119. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
  120. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
  121. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
  122. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
  123. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
  124. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
  125. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
  126. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
  127. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -57
  128. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
  129. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -160
  130. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
  131. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
  132. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
@@ -1,28 +1,18 @@
1
- var u = Object.defineProperty;
2
- var p = (r, i, t) => i in r ? u(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
- var g = (r, i, t) => p(r, typeof i != "symbol" ? i + "" : i, t);
4
- import { Block as f, BlockCompositionType as I, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { RecommendationConfigService as s } from "./services/configService.js";
6
- import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
7
- import { getDefaultTemplate as _ } from "./templates/grid/template.js";
8
- const k = "recommendation-block", c = "ins-recommendation-v3-block-v2", m = "recommendation-id";
9
- class b extends f {
1
+ import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { getDefaultTemplate as o } from "./templates/blockTemplate.js";
3
+ const n = "recommendation-block";
4
+ class m extends e {
10
5
  constructor() {
11
6
  super();
12
- /**
13
- * Stores the ID generated in getTemplate() so onCreated() can reuse it.
14
- * This avoids generating a new (different) ID in onCreated().
15
- */
16
- g(this, "_pendingBlockId", null);
17
7
  }
18
8
  getId() {
19
- return k;
9
+ return n;
20
10
  }
21
11
  getIcon() {
22
12
  return "recommendation-icon";
23
13
  }
24
14
  getBlockCompositionType() {
25
- return I.CONTAINER;
15
+ return t.CONTAINER;
26
16
  }
27
17
  getName() {
28
18
  return this.api.translate("Recommendation Block");
@@ -30,122 +20,11 @@ class b extends f {
30
20
  getDescription() {
31
21
  return this.api.translate("Recommendation Block Title Description");
32
22
  }
33
- /**
34
- * Returns the template HTML for a new recommendation block.
35
- * Generates a unique recommendation ID and embeds the instance class
36
- * (ins-recommendation-v3-block-{id}) directly in the template HTML.
37
- * This is necessary because Stripo's Angular rendering manages the class
38
- * attribute and overwrites dynamically added classes via setAttribute.
39
- */
40
23
  getTemplate() {
41
- const t = this._generateNextId();
42
- return this._pendingBlockId = t, _(t);
43
- }
44
- /**
45
- * Called when a new block is dropped into the template
46
- *
47
- * Uses the ID from getTemplate() (which already embedded the instance class)
48
- * and assigns the recommendation-id attribute + initializes configuration.
49
- * @param node - The newly created block node
50
- */
51
- onCreated(t) {
52
- const e = this._pendingBlockId ?? this._generateNextId();
53
- this._pendingBlockId = null, this._assignRecommendationId(t, e), s.initializeConfig(this.api, t, { recommendationId: e }), d().setCurrentBlock(e);
54
- }
55
- /**
56
- * Called when the document changes or template is loaded
57
- *
58
- * Handles migration from legacy templates that don't have node config
59
- * and assigns recommendation-id to legacy blocks that lack one.
60
- * @param node - The block node that may need migration
61
- */
62
- onDocumentChanged(t) {
63
- if (!(!t || !("getNodeConfig" in t))) {
64
- if (!this._getRecommendationId(t)) {
65
- const e = this._generateNextId();
66
- this._assignRecommendationId(t, e), s.hasConfig(t) && s.updateConfig(
67
- this.api,
68
- t,
69
- { recommendationId: e },
70
- "Assign recommendation ID to legacy block"
71
- );
72
- }
73
- s.needsMigration(t) && this._migrateFromLegacy(t);
74
- }
75
- }
76
- /**
77
- * Called when a block is deleted from the template
78
- *
79
- * Cleans up the per-block state from the Pinia store.
80
- * @param node - The block node being deleted
81
- */
82
- onDelete(t) {
83
- const e = this._getRecommendationId(t);
84
- e && d().removeBlockState(e);
85
- }
86
- /**
87
- * Generates the next unique recommendation ID by scanning all existing blocks
88
- * in the document and finding the maximum existing ID + 1.
89
- */
90
- _generateNextId() {
91
- let t = 0;
92
- try {
93
- const e = this.api.getDocumentRoot();
94
- e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((o) => {
95
- if ("getAttribute" in o) {
96
- const a = o.getAttribute(m), l = a ? parseInt(a) : 0;
97
- l > t && (t = l);
98
- }
99
- });
100
- } catch {
101
- }
102
- return t + 1;
103
- }
104
- /**
105
- * Assigns a recommendation-id attribute to the block element.
106
- * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
107
- * HTML by getTemplate(), since Stripo's Angular rendering overwrites dynamically
108
- * added classes via setAttribute.
109
- */
110
- _assignRecommendationId(t, e) {
111
- const n = this._getBlockElement(t);
112
- if (!n)
113
- return;
114
- const o = this.api.getDocumentModifier();
115
- o.modifyHtml(n).setAttribute(m, e.toString()), o.apply(new h(`Assign recommendation ID ${e}`));
116
- }
117
- /**
118
- * Gets the recommendation-id from a block node
119
- */
120
- _getRecommendationId(t) {
121
- const e = this._getBlockElement(t);
122
- if (!e || !("getAttribute" in e))
123
- return null;
124
- const n = e.getAttribute(m);
125
- if (!n)
126
- return null;
127
- const o = parseInt(n);
128
- return Number.isNaN(o) ? null : o;
129
- }
130
- /**
131
- * Gets the block element (the element with BLOCK_CLASS)
132
- */
133
- _getBlockElement(t) {
134
- if ("getAttribute" in t) {
135
- const e = t.getAttribute("class");
136
- if (e && e.includes(c))
137
- return t;
138
- }
139
- return "querySelector" in t ? t.querySelector(`.${c}`) : null;
140
- }
141
- /**
142
- * Migrate configuration from legacy format
143
- */
144
- _migrateFromLegacy(t) {
145
- s.migrateFromDataAttributes(this.api, t);
24
+ return o();
146
25
  }
147
26
  }
148
27
  export {
149
- k as BLOCK_ID,
150
- b as RecommendationBlock
28
+ n as BLOCK_ID,
29
+ m as RecommendationBlock
151
30
  };
@@ -0,0 +1,187 @@
1
+ import { ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as _ } from "../common-control.js";
3
+ import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as f, ATTR_PRODUCT_BUTTON as g } from "./constants.js";
4
+ const R = "ui-elements-recommendation-card-composition", l = ".recommendation-attribute-row", A = "tr.recommendation-product-row", c = "data-card-composition", a = "data-attribute-type", d = "data-visibility", s = [
5
+ { key: m, label: "Product Image", visible: !0 },
6
+ { key: y, label: "Product Name", visible: !0 },
7
+ { key: T, label: "Product Price", visible: !0 },
8
+ { key: h, label: "Product Original Price", visible: !0 },
9
+ { key: C, label: "Omnibus Price", visible: !1 },
10
+ { key: f, label: "Omnibus Discount", visible: !1 },
11
+ { key: g, label: "Product Button", visible: !0 }
12
+ ];
13
+ class N extends _ {
14
+ getId() {
15
+ return R;
16
+ }
17
+ getTemplate() {
18
+ const t = s.map((i) => ({
19
+ key: i.key,
20
+ label: i.label,
21
+ content: this._createItemContent(i.label, i.key)
22
+ }));
23
+ return `
24
+ <div class="container">
25
+ ${this._GuLabel({ text: "Card Element Order & Visibility" })}
26
+ ${this._GuOrderable("cardComposition", t)}
27
+ </div>
28
+ `;
29
+ }
30
+ onRender() {
31
+ this._initializeComposition(), this._registerValueChangeListeners();
32
+ }
33
+ onTemplateNodeUpdated(t) {
34
+ super.onTemplateNodeUpdated(t), this._initializeComposition();
35
+ }
36
+ /**
37
+ * Creates the HTML content for an orderable item with label and toggle
38
+ */
39
+ _createItemContent(t, i) {
40
+ return `
41
+ <div style="display: flex; align-items: center; justify-content: space-between;
42
+ padding: 8px; gap: 8px;">
43
+ <span style="flex: 1;">${t}</span>
44
+ ${this._GuToggle(`visibility_${i}`)}
45
+ </div>
46
+ `;
47
+ }
48
+ /**
49
+ * Registers event listeners for composition and visibility changes
50
+ */
51
+ _registerValueChangeListeners() {
52
+ this.api.onValueChanged("cardComposition", (t) => {
53
+ this._applyCompositionToBlock(t);
54
+ }), s.forEach((t) => {
55
+ this.api.onValueChanged(`visibility_${t.key}`, (i) => {
56
+ this._applyVisibilityToBlock(t.key, i);
57
+ });
58
+ });
59
+ }
60
+ /**
61
+ * Initializes composition order and visibility state from the current node
62
+ */
63
+ _initializeComposition() {
64
+ const t = this._readCompositionFromNode(), i = this._readVisibilityFromRows(), e = {
65
+ cardComposition: t,
66
+ ...this._buildVisibilityValues(i)
67
+ };
68
+ this.api.updateValues(e);
69
+ }
70
+ /**
71
+ * Reads composition order from node's data-card-composition attribute
72
+ * Falls back to default order if attribute is not present
73
+ */
74
+ _readCompositionFromNode() {
75
+ if (!this.currentNode || !("getAttribute" in this.currentNode))
76
+ return s.map((i) => i.key);
77
+ const t = this.currentNode.getAttribute(c);
78
+ return t ? t.split(",").filter(Boolean) : s.map((i) => i.key);
79
+ }
80
+ /**
81
+ * Builds visibility values object from the visibility map
82
+ */
83
+ _buildVisibilityValues(t) {
84
+ return s.reduce((i, e) => (i[`visibility_${e.key}`] = t[e.key] ?? !0, i), {});
85
+ }
86
+ /**
87
+ * Read visibility state from individual row elements' data-visibility attributes
88
+ * This ensures toggles reflect the actual DOM state
89
+ */
90
+ _readVisibilityFromRows() {
91
+ if (!this.currentNode)
92
+ return this._getDefaultVisibilities();
93
+ const t = Array.from(this.currentNode.querySelectorAll(l));
94
+ console.debug("_readVisibilityFromRows - found attribute rows:", t.length);
95
+ const i = this._extractVisibilityFromRows(t);
96
+ return this._mergeWithDefaults(i);
97
+ }
98
+ /**
99
+ * Returns default visibility values for all items
100
+ */
101
+ _getDefaultVisibilities() {
102
+ return s.reduce((t, i) => (t[i.key] = i.visible, t), {});
103
+ }
104
+ /**
105
+ * Extracts visibility values from DOM nodes
106
+ */
107
+ _extractVisibilityFromRows(t) {
108
+ const i = {};
109
+ return t.forEach((e) => {
110
+ if (!("getAttribute" in e))
111
+ return;
112
+ const o = e.getAttribute(a), r = e.getAttribute(d);
113
+ o && r !== null && (i[o] = this._parseVisibilityValue(r), console.debug(
114
+ `_readVisibilityFromRows - ${o}: ${i[o]} (raw: ${r})`
115
+ ));
116
+ }), i;
117
+ }
118
+ /**
119
+ * Parses visibility value from string to boolean
120
+ * Accepts "1", "true" as true, everything else as false
121
+ */
122
+ _parseVisibilityValue(t) {
123
+ return t === "1" || t === "true";
124
+ }
125
+ /**
126
+ * Merges extracted visibilities with default values for missing keys
127
+ */
128
+ _mergeWithDefaults(t) {
129
+ return s.forEach((i) => {
130
+ i.key in t || (t[i.key] = i.visible, console.debug(`_readVisibilityFromRows - ${i.key}: using default ${i.visible}`));
131
+ }), t;
132
+ }
133
+ /**
134
+ * Apply the reordered composition to the block's HTML structure
135
+ * Updates the data-card-composition attribute and reorders product attributes
136
+ */
137
+ _applyCompositionToBlock(t) {
138
+ if (console.debug("_applyCompositionToBlock - composition:", t), !this.currentNode) {
139
+ console.debug("_applyCompositionToBlock - no current node");
140
+ return;
141
+ }
142
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(c, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t);
143
+ }
144
+ /**
145
+ * Reorders attribute rows within each product row based on composition order
146
+ */
147
+ _reorderProductAttributes(t) {
148
+ if (!this.currentNode)
149
+ return;
150
+ const i = this.currentNode.querySelectorAll(A);
151
+ if (!(i != null && i.length))
152
+ return;
153
+ const e = this.api.getDocumentModifier();
154
+ i.forEach((o) => {
155
+ const r = this._buildCompositionHtml(o, t);
156
+ e.modifyHtml(o).setInnerHtml(r);
157
+ }), e.apply(new n("Reorder product attributes"));
158
+ }
159
+ /**
160
+ * Builds HTML string with attributes ordered according to composition
161
+ */
162
+ _buildCompositionHtml(t, i) {
163
+ return i.reduce((e, o) => {
164
+ const r = t.querySelector(`${l}[${a}="${o}"]`);
165
+ return r && "getOuterHTML" in r ? e + r.getOuterHTML() : e;
166
+ }, "");
167
+ }
168
+ /**
169
+ * Apply visibility changes to the block's HTML structure
170
+ * Updates display style and data-visibility attribute for all matching rows
171
+ */
172
+ _applyVisibilityToBlock(t, i) {
173
+ if (console.debug("_applyVisibilityToBlock", t, i), !this.currentNode)
174
+ return;
175
+ const e = this.currentNode.querySelectorAll(`${l}[${a}="${t}"]`);
176
+ if (!(e != null && e.length))
177
+ return;
178
+ const o = i ? "table-row" : "none", r = i ? "1" : "0", p = `Set ${t} visibility to ${i ? "visible" : "hidden"}`, u = this.api.getDocumentModifier();
179
+ e.forEach((b) => {
180
+ u.modifyHtml(b).setStyle("display", o).setAttribute(d, r);
181
+ }), u.apply(new n(p));
182
+ }
183
+ }
184
+ export {
185
+ R as COMPOSITION_CONTROL_BLOCK_ID,
186
+ N as RecommendationCardCompositionControl
187
+ };
@@ -0,0 +1,13 @@
1
+ const _ = "productImage", b = "productName", n = "productPrice", i = "productOldPrice", O = "productOmnibusPrice", T = "productOmnibusDiscount", t = "productButton";
2
+ var o = /* @__PURE__ */ ((c) => (c.BUTTON = "recommendation-block-button", c.NAME = "recommendation-block-name", c.PRICE = "recommendation-block-price", c.OLD_PRICE = "recommendation-block-old-price", c.OMNIBUS_PRICE = "recommendation-block-omnibus-price", c.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", c.IMAGE = "recommendation-block-image", c))(o || {}), r = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c))(r || {});
3
+ export {
4
+ t as ATTR_PRODUCT_BUTTON,
5
+ _ as ATTR_PRODUCT_IMAGE,
6
+ b as ATTR_PRODUCT_NAME,
7
+ i as ATTR_PRODUCT_OLD_PRICE,
8
+ T as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
9
+ O as ATTR_PRODUCT_OMNIBUS_PRICE,
10
+ n as ATTR_PRODUCT_PRICE,
11
+ o as RecommendationBlockId,
12
+ r as RecommendationControlId
13
+ };