@useinsider/guido 2.0.0-beta.5da4dde → 2.0.0-beta.689d09e

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 (175) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +55 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +15 -17
  5. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  6. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  8. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  9. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  10. package/dist/composables/useConfig.js +29 -27
  11. package/dist/composables/useSave.js +13 -11
  12. package/dist/composables/useStripo.js +40 -40
  13. package/dist/config/migrator/index.js +9 -8
  14. package/dist/config/migrator/itemsBlockMigrator.js +342 -0
  15. package/dist/extensions/Blocks/Items/block.js +39 -40
  16. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  17. package/dist/extensions/Blocks/Items/controls/cardComposition.js +66 -46
  18. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  19. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  20. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  21. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  22. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +44 -38
  23. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  24. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  25. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  26. package/dist/extensions/Blocks/Items/controls/settingsControl.js +152 -143
  27. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  28. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  29. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -3
  30. package/dist/extensions/Blocks/Items/extension.js +7 -6
  31. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
  32. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
  33. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  34. package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
  35. package/dist/extensions/Blocks/Items/template.js +366 -129
  36. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +184 -0
  37. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +69 -153
  38. package/dist/extensions/Blocks/Recommendation/constants.js +1 -9
  39. package/dist/extensions/Blocks/Recommendation/control.js +59 -74
  40. package/dist/extensions/Blocks/Recommendation/controls/button/align.js +13 -0
  41. package/dist/extensions/Blocks/Recommendation/controls/button/border.js +13 -0
  42. package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +13 -0
  43. package/dist/extensions/Blocks/Recommendation/controls/button/color.js +13 -0
  44. package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +13 -0
  45. package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +13 -0
  46. package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +13 -0
  47. package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +13 -0
  48. package/dist/extensions/Blocks/Recommendation/controls/button/text.js +13 -0
  49. package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +13 -0
  50. package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +13 -0
  51. package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +13 -0
  52. package/dist/extensions/Blocks/Recommendation/controls/image/size.js +13 -0
  53. package/dist/extensions/Blocks/Recommendation/controls/name/align.js +13 -0
  54. package/dist/extensions/Blocks/Recommendation/controls/name/background.js +13 -0
  55. package/dist/extensions/Blocks/Recommendation/controls/name/color.js +13 -0
  56. package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +13 -0
  57. package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +13 -0
  58. package/dist/extensions/Blocks/Recommendation/controls/name/size.js +13 -0
  59. package/dist/extensions/Blocks/Recommendation/controls/name/style.js +13 -0
  60. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +13 -0
  61. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +13 -0
  62. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +13 -0
  63. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +13 -0
  64. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +13 -0
  65. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +13 -0
  66. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +13 -0
  67. package/dist/extensions/Blocks/Recommendation/controls/price/align.js +13 -0
  68. package/dist/extensions/Blocks/Recommendation/controls/price/background.js +13 -0
  69. package/dist/extensions/Blocks/Recommendation/controls/price/color.js +13 -0
  70. package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +13 -0
  71. package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +13 -0
  72. package/dist/extensions/Blocks/Recommendation/controls/price/size.js +13 -0
  73. package/dist/extensions/Blocks/Recommendation/controls/price/style.js +13 -0
  74. package/dist/extensions/Blocks/Recommendation/extension.js +42 -16
  75. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +72 -117
  76. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +64 -85
  77. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +17 -54
  78. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +45 -74
  79. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  80. package/dist/extensions/Blocks/common-control.js +29 -30
  81. package/dist/extensions/Blocks/controlFactories.js +55 -45
  82. package/dist/guido.css +1 -1
  83. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +369 -285
  84. package/dist/package.json.js +1 -1
  85. package/dist/services/stripoApi.js +6 -10
  86. package/dist/src/@types/config/index.d.ts +2 -2
  87. package/dist/src/@types/config/schemas.d.ts +30 -0
  88. package/dist/src/@types/config/types.d.ts +7 -1
  89. package/dist/src/composables/useConfig.d.ts +8 -0
  90. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  91. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  92. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  93. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  94. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  95. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  96. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  97. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  98. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  99. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
  100. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  101. package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
  102. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +73 -0
  103. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +3 -50
  104. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -32
  105. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -5
  106. package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +5 -0
  107. package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +5 -0
  108. package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +5 -0
  109. package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +5 -0
  110. package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +5 -0
  111. package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +5 -0
  112. package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +5 -0
  113. package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +5 -0
  114. package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +5 -0
  115. package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +5 -0
  116. package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +5 -0
  117. package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +5 -0
  118. package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +5 -0
  119. package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +5 -0
  120. package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +5 -0
  121. package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +5 -0
  122. package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +5 -0
  123. package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +5 -0
  124. package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +5 -0
  125. package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +5 -0
  126. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +5 -0
  127. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +5 -0
  128. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +5 -0
  129. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +5 -0
  130. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +5 -0
  131. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +5 -0
  132. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +5 -0
  133. package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +5 -0
  134. package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +5 -0
  135. package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +5 -0
  136. package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +5 -0
  137. package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +5 -0
  138. package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +5 -0
  139. package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +5 -0
  140. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +3 -3
  141. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +7 -15
  142. package/dist/src/extensions/Blocks/common-control.d.ts +9 -10
  143. package/dist/src/stores/config.d.ts +164 -1
  144. package/dist/static/styles/components/button.css.js +1 -1
  145. package/dist/static/styles/components/wide-panel.css.js +4 -0
  146. package/dist/static/styles/customEditorStyle.css.js +0 -13
  147. package/dist/stores/config.js +7 -0
  148. package/dist/utils/pairProductVariables.js +61 -58
  149. package/package.json +3 -3
  150. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  151. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  152. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  153. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  154. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  155. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  156. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  157. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
  158. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
  159. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
  160. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
  161. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  162. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
  163. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  164. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  165. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  166. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  167. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  168. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -592
  169. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  170. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  171. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  172. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  173. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  174. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
  175. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
@@ -1,71 +0,0 @@
1
- import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as m } from "../../common-control.js";
3
- import { RecommendationControlId as l, RecommendationBlockId as d } from "../constants.js";
4
- import { preserveTextStyles as T } from "../utils/preserveTextStyles.js";
5
- const f = ".ins-recommendation-product-container", s = "data-text-after", c = "", p = ".omnibus-text-after";
6
- class C extends m {
7
- getId() {
8
- return l.OMNIBUS_PRICE_TEXT_AFTER;
9
- }
10
- getTemplate() {
11
- return `
12
- <div class="omnibus-price-text-after-control-container">
13
- ${this._GuTwoColumns([
14
- this._GuLabel({ text: "Text After" }),
15
- this._GuTextInput({
16
- name: "omnibusPriceTextAfter",
17
- placeholder: "e.g., (incl. VAT)",
18
- className: "es-180w"
19
- })
20
- ])}
21
- </div>
22
- `;
23
- }
24
- onRender() {
25
- this._setFormValues(), this._listenToFormUpdates();
26
- }
27
- onTemplateNodeUpdated(t) {
28
- super.onTemplateNodeUpdated(t), this._setFormValues();
29
- }
30
- _setFormValues() {
31
- const t = this._getCurrentText();
32
- this.api.updateValues({
33
- omnibusPriceTextAfter: t
34
- });
35
- }
36
- _getCurrentText() {
37
- if (!this.currentNode || !("getAttribute" in this.currentNode))
38
- return c;
39
- const t = this.currentNode.getAttribute(s);
40
- return t === null ? c : t;
41
- }
42
- _onTextChange(t) {
43
- if (!this.currentNode || !("closest" in this.currentNode))
44
- return;
45
- const e = this.currentNode.closest(f);
46
- if (!e || !("querySelectorAll" in e))
47
- return;
48
- const n = Array.from(
49
- e.querySelectorAll(`[esd-extension-block-id="${d.OMNIBUS_PRICE}"]`)
50
- );
51
- if (!n.length)
52
- return;
53
- const r = this.api.getDocumentModifier();
54
- n.forEach((i) => {
55
- r.modifyHtml(i).setAttribute(s, t);
56
- const o = i.querySelector(p);
57
- if (o) {
58
- const u = T(o, t);
59
- r.modifyHtml(o).setInnerHtml(u);
60
- }
61
- }), r.apply(new a("Update omnibus price text after"));
62
- }
63
- _listenToFormUpdates() {
64
- this.api.onValueChanged("omnibusPriceTextAfter", (t) => {
65
- this._onTextChange(t);
66
- });
67
- }
68
- }
69
- export {
70
- C as OmnibusPriceTextAfterControl
71
- };
@@ -1,71 +0,0 @@
1
- import { ModificationDescription as m } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as a } from "../../common-control.js";
3
- import { RecommendationControlId as l, RecommendationBlockId as d } from "../constants.js";
4
- import { preserveTextStyles as T } from "../utils/preserveTextStyles.js";
5
- const p = ".ins-recommendation-product-container", s = "data-text-before", c = "Lowest 30-day price: ", f = ".omnibus-text-before";
6
- class C extends a {
7
- getId() {
8
- return l.OMNIBUS_PRICE_TEXT_BEFORE;
9
- }
10
- getTemplate() {
11
- return `
12
- <div class="omnibus-price-text-before-control-container">
13
- ${this._GuTwoColumns([
14
- this._GuLabel({ text: "Text Before" }),
15
- this._GuTextInput({
16
- name: "omnibusPriceTextBefore",
17
- placeholder: "e.g., Lowest 30-day price: ",
18
- className: "es-180w"
19
- })
20
- ])}
21
- </div>
22
- `;
23
- }
24
- onRender() {
25
- this._setFormValues(), this._listenToFormUpdates();
26
- }
27
- onTemplateNodeUpdated(e) {
28
- super.onTemplateNodeUpdated(e), this._setFormValues();
29
- }
30
- _setFormValues() {
31
- const e = this._getCurrentText();
32
- this.api.updateValues({
33
- omnibusPriceTextBefore: e
34
- });
35
- }
36
- _getCurrentText() {
37
- if (!this.currentNode || !("getAttribute" in this.currentNode))
38
- return c;
39
- const e = this.currentNode.getAttribute(s);
40
- return e === null ? c : e;
41
- }
42
- _onTextChange(e) {
43
- if (!this.currentNode || !("closest" in this.currentNode))
44
- return;
45
- const t = this.currentNode.closest(p);
46
- if (!t || !("querySelectorAll" in t))
47
- return;
48
- const n = Array.from(
49
- t.querySelectorAll(`[esd-extension-block-id="${d.OMNIBUS_PRICE}"]`)
50
- );
51
- if (!n.length)
52
- return;
53
- const o = this.api.getDocumentModifier();
54
- n.forEach((i) => {
55
- o.modifyHtml(i).setAttribute(s, e);
56
- const r = i.querySelector(f);
57
- if (r) {
58
- const u = T(r, e);
59
- o.modifyHtml(r).setInnerHtml(u);
60
- }
61
- }), o.apply(new m("Update omnibus price text before"));
62
- }
63
- _listenToFormUpdates() {
64
- this.api.onValueChanged("omnibusPriceTextBefore", (e) => {
65
- this._onTextChange(e);
66
- });
67
- }
68
- }
69
- export {
70
- C as OmnibusPriceTextBeforeControl
71
- };
@@ -1,188 +0,0 @@
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,25 +0,0 @@
1
- function a(n) {
2
- return "getInnerHTML" in n && typeof n.getInnerHTML == "function" ? n.getInnerHTML() : "innerHTML" in n ? n.innerHTML : "";
3
- }
4
- function H(n, t) {
5
- if (!n)
6
- return t;
7
- const r = a(n);
8
- if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
9
- return t;
10
- const i = [], s = [];
11
- let o = r.trim();
12
- for (; ; ) {
13
- const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
14
- if (!u)
15
- break;
16
- const [, e, f = "", g] = u, c = new RegExp(`</${e}>$`, "i");
17
- if (!c.test(g))
18
- break;
19
- i.push(`<${e}${f}>`), s.unshift(`</${e}>`), o = g.replace(c, "").trim();
20
- }
21
- return i.length > 0 ? i.join("") + t + s.join("") : t;
22
- }
23
- export {
24
- H as preserveTextStyles
25
- };
@@ -1,23 +0,0 @@
1
- import { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Gets the esd-config-block element from the current node.
4
- * Searches within the closest .items-block-v2 container.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @returns The config block element or null if not found
7
- */
8
- export declare function getConfigBlock(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
9
- /**
10
- * Converts an attribute value to a boolean.
11
- * Handles string values '1', 'true', and null/undefined cases.
12
- * @param value - The attribute value (string or null)
13
- * @param defaultValue - Default value to return if value is null/undefined (default: false)
14
- * @returns The boolean value
15
- */
16
- export declare function attributeToBoolean(value: string | null, defaultValue?: boolean): boolean;
17
- /**
18
- * Gets a string attribute value with a default fallback.
19
- * @param value - The attribute value (string or null)
20
- * @param defaultValue - Default value to return if value is null/undefined (default: '')
21
- * @returns The string value or default
22
- */
23
- export declare function attributeToString(value: string | null, defaultValue?: string): string;
@@ -1,32 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { configAttributes } from '../enums/productEnums';
3
- type StoreSetter<T> = (value: T) => void;
4
- interface SyncConfig<T> {
5
- attributeName: keyof typeof configAttributes;
6
- storeSetter: StoreSetter<T>;
7
- converter: (value: string | null) => T;
8
- }
9
- /**
10
- * Generic utility to sync an attribute value from esd-config-block to the store.
11
- * This makes attribute values mutable by syncing them from the DOM.
12
- * @param currentNode - The current node from the control (usually this.currentNode)
13
- * @param config - Configuration object with attribute name, store setter, and value converter
14
- */
15
- export declare function syncAttributeFromConfigBlock<T>(currentNode: ImmutableHtmlNode | undefined, config: SyncConfig<T>): void;
16
- /**
17
- * Helper to create a sync config for boolean attributes.
18
- * @param attributeName - The attribute name from configAttributes
19
- * @param storeSetter - The store setter function
20
- * @param defaultValue - Default value if attribute is not set (default: false)
21
- * @returns Sync configuration object
22
- */
23
- export declare function createBooleanSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<boolean>, defaultValue?: boolean): SyncConfig<boolean>;
24
- /**
25
- * Helper to create a sync config for string attributes.
26
- * @param attributeName - The attribute name from configAttributes
27
- * @param storeSetter - The store setter function
28
- * @param defaultValue - Default value if attribute is not set (default: '')
29
- * @returns Sync configuration object
30
- */
31
- export declare function createStringSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<string>, defaultValue?: string): SyncConfig<string>;
32
- export {};
@@ -1,50 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Reads name trimming value from esd-config-block attribute and updates the store.
4
- * This makes the trimming value mutable by syncing it from the DOM.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- */
7
- export declare function syncNameTrimmingFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
8
- /**
9
- * Reads hide discount value from esd-config-block attribute and updates the store.
10
- * This makes the hide discount value mutable by syncing it from the DOM.
11
- * @param currentNode - The current node from the control (usually this.currentNode)
12
- */
13
- export declare function syncHideDiscountFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
14
- /**
15
- * Reads formatted price value from esd-config-block attribute and updates the store.
16
- * This makes the formatted price value mutable by syncing it from the DOM.
17
- * Defaults to true if not set, since formatted is the default.
18
- * @param currentNode - The current node from the control (usually this.currentNode)
19
- */
20
- export declare function syncFormattedPriceFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
21
- /**
22
- * Reads currency symbol value from esd-config-block attribute and updates the store.
23
- * This makes the currency symbol value mutable by syncing it from the DOM.
24
- * @param currentNode - The current node from the control (usually this.currentNode)
25
- */
26
- export declare function syncCurrencySymbolFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
27
- /**
28
- * Reads currency location value from esd-config-block attribute and updates the store.
29
- * This makes the currency location value mutable by syncing it from the DOM.
30
- * @param currentNode - The current node from the control (usually this.currentNode)
31
- */
32
- export declare function syncCurrencyLocationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
33
- /**
34
- * Reads button link value from esd-config-block attribute and updates the store.
35
- * This makes the button link value mutable by syncing it from the DOM.
36
- * @param currentNode - The current node from the control (usually this.currentNode)
37
- */
38
- export declare function syncButtonLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
39
- /**
40
- * Reads image link value from esd-config-block attribute and updates the store.
41
- * This makes the image link value mutable by syncing it from the DOM.
42
- * @param currentNode - The current node from the control (usually this.currentNode)
43
- */
44
- export declare function syncImageLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
45
- /**
46
- * Reads price orientation value from esd-config-block attribute and updates the store.
47
- * This makes the price orientation value mutable by syncing it from the DOM.
48
- * @param currentNode - The current node from the control (usually this.currentNode)
49
- */
50
- export declare function syncPriceOrientationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
@@ -1,8 +0,0 @@
1
- import { ImmutableHtmlNode, ControlApi } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Updates attributes on the esd-config-block element based on current store state.
4
- * This utility can be called from controls whenever they change values that affect attributes.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @param api - The API object from the control (usually this.api)
7
- */
8
- export declare function updateConfigBlockAttributes(currentNode: ImmutableHtmlNode | undefined, api: ControlApi): void;
@@ -1,25 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { CommonControl } from '../../common-control';
3
- export declare const CARD_BACKGROUND_COLOR_CONTROL_ID = "recommendation-card-background-color-control";
4
- /**
5
- * Control for managing recommendation card background color
6
- * This control is displayed in the Styles tab
7
- */
8
- export declare class CardBackgroundColorControl extends CommonControl {
9
- getId(): string;
10
- getTemplate(): string;
11
- onRender(): void;
12
- onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
13
- _setFormValues(): void;
14
- /**
15
- * Reads the current background color from the first product card wrapper
16
- * @returns The background color value or 'transparent' if not found
17
- */
18
- _getCurrentCardBackgroundColor(): string;
19
- /**
20
- * Handles card background color changes
21
- * Applies the color to all product card wrapper elements
22
- */
23
- _onCardBackgroundColorChange(color: string): void;
24
- _listenToFormUpdates(): void;
25
- }