@useinsider/guido 2.0.0-beta.1c331b8 → 2.0.0-beta.1f72712

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 (52) hide show
  1. package/dist/extensions/Blocks/Recommendation/block.js +40 -6
  2. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +64 -0
  3. package/dist/extensions/Blocks/Recommendation/constants/layout.js +9 -4
  4. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +17 -9
  5. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +48 -54
  6. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +42 -36
  7. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +51 -27
  8. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +146 -73
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +49 -35
  10. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +23 -13
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +41 -41
  12. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +27 -16
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +79 -67
  14. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +3 -3
  16. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +85 -79
  17. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +8 -4
  18. package/dist/extensions/Blocks/Recommendation/services/configService.js +239 -0
  19. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -28
  20. package/dist/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.js +49 -25
  21. package/dist/extensions/Blocks/Recommendation/templates/horizontal/template.js +18 -19
  22. package/dist/extensions/Blocks/Recommendation/templates/utils.js +44 -101
  23. package/dist/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.js +60 -35
  24. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  25. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  26. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  27. package/dist/extensions/Blocks/common-control.js +1 -1
  28. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +214 -157
  29. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +34 -0
  31. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  32. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -2
  33. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +10 -0
  34. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  35. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +3 -1
  36. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +13 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +30 -1
  38. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +19 -0
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +9 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +4 -2
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +8 -0
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +19 -0
  43. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +13 -2
  44. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  45. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  46. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
  47. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  48. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +154 -0
  49. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  50. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  51. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  52. package/package.json +1 -1
@@ -1,29 +1,30 @@
1
1
  var u = Object.defineProperty;
2
2
  var d = (i, o, t) => o in i ? u(i, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[o] = t;
3
- var s = (i, o, t) => d(i, typeof o != "symbol" ? o + "" : o, t);
4
- import { UEAttr as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ var n = (i, o, t) => d(i, typeof o != "symbol" ? o + "" : o, t);
5
4
  import { CommonControl as c } from "../../../common-control.js";
6
- import { MAX_PRODUCT_COUNT as _, MAX_PRODUCTS_PER_ROW as R } from "../../constants/layout.js";
7
- import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
8
- import { getCurrentLayout as C, regenerateProductRows as h, reapplySpacing as l } from "./utils.js";
9
- import { useDebounceFn as p } from "../../../../../node_modules/@vueuse/shared/index.js";
10
- const O = "recommendation-product-layout-control", e = {
5
+ import { MAX_PRODUCT_COUNT as _, MAX_PRODUCTS_PER_ROW as h } from "../../constants/layout.js";
6
+ import { RecommendationConfigService as r } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
8
+ import { getCurrentLayout as m, regenerateProductRows as p, reapplySpacing as C } from "./utils.js";
9
+ import { useDebounceFn as g } from "../../../../../node_modules/@vueuse/shared/index.js";
10
+ const l = "recommendation-product-layout-control", e = {
11
11
  PRODUCT_COUNT: "size",
12
12
  PRODUCT_IN_ROW: "cardsInRow",
13
13
  PRODUCT_IN_ROW_LABEL: "cardsInRowLabel"
14
14
  };
15
- class D extends c {
15
+ class b extends c {
16
16
  constructor() {
17
17
  super(...arguments);
18
- s(this, "store", m());
19
- s(this, "storeUnsubscription", () => {
18
+ // Store is used for backward compatibility with product fetching and regeneration
19
+ n(this, "store", R());
20
+ n(this, "storeUnsubscription", () => {
20
21
  });
21
- s(this, "_debouncedRegenerateProductRows", p(() => {
22
+ n(this, "_debouncedRegenerateProductRows", g(() => {
22
23
  this._regenerateProductRows();
23
24
  }, 500));
24
25
  }
25
26
  getId() {
26
- return O;
27
+ return l;
27
28
  }
28
29
  getTemplate() {
29
30
  return `
@@ -32,68 +33,66 @@ class D extends c {
32
33
  this._GuLabel({ text: "Number of Products" }),
33
34
  this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: _ }),
34
35
  this._GuLabel({ text: "Products in One Row", name: e.PRODUCT_IN_ROW_LABEL }),
35
- this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: R })
36
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: h })
36
37
  ])}
37
38
  </div>
38
39
  `;
39
40
  }
40
41
  onRender() {
41
- this._initializeCounterValues(), this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates();
42
+ this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates();
42
43
  }
43
44
  onTemplateNodeUpdated(t) {
44
- super.onTemplateNodeUpdated(t), this._updateProductsInRowVisibility();
45
+ super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
45
46
  }
46
47
  onDestroy() {
47
48
  this.storeUnsubscription();
48
49
  }
49
50
  _setFormValues() {
50
- const { recommendationConfigs: t } = this.store;
51
+ const t = r.getConfig(this.currentNode);
51
52
  this.api.updateValues({
52
53
  [e.PRODUCT_COUNT]: t.size,
53
54
  [e.PRODUCT_IN_ROW]: t.cardsInRow
54
55
  });
55
56
  }
56
- _initializeCounterValues() {
57
- const { recommendationConfigs: t } = this.store;
58
- this.api.setUIEAttribute(
59
- e.PRODUCT_COUNT,
60
- a.SELECTPICKER.items,
61
- Number(t.size)
62
- ), this.api.setUIEAttribute(
63
- e.PRODUCT_IN_ROW,
64
- a.SELECTPICKER.items,
65
- t.cardsInRow
66
- );
67
- }
68
57
  /**
69
58
  * Updates "Products in One Row" visibility based on layout orientation
70
59
  * This control is hidden for horizontal layout (products always take full width)
71
- * Reads from store first (reliable during state transitions), falls back to DOM
60
+ * Reads from node config first, falls back to DOM
72
61
  */
73
62
  _updateProductsInRowVisibility() {
74
- const r = (this.store.recommendationConfigs.orientation || C(this.currentNode)) === "vertical";
75
- this.api.setVisibility(e.PRODUCT_IN_ROW, r), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, r);
63
+ const a = (r.getConfig(this.currentNode).layout || m(this.currentNode)) === "vertical";
64
+ this.api.setVisibility(e.PRODUCT_IN_ROW, a), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, a);
76
65
  }
77
66
  _onProductCountChange(t) {
78
- this.store.$patch({
67
+ this.currentNode && (r.updateConfig(
68
+ this.api,
69
+ this.currentNode,
70
+ { size: t },
71
+ `Changed product count to ${t}`
72
+ ), this.store.$patch({
79
73
  recommendationConfigs: {
80
74
  size: t
81
75
  }
82
- }), this._debouncedRegenerateProductRows();
76
+ }), this._debouncedRegenerateProductRows());
83
77
  }
84
78
  _onProductsInRowChange(t) {
85
- this.store.$patch({
79
+ this.currentNode && (r.updateConfig(
80
+ this.api,
81
+ this.currentNode,
82
+ { cardsInRow: t },
83
+ `Changed products per row to ${t}`
84
+ ), this.store.$patch({
86
85
  recommendationConfigs: {
87
86
  cardsInRow: t
88
87
  }
89
- }), this._debouncedRegenerateProductRows();
88
+ }), this._debouncedRegenerateProductRows());
90
89
  }
91
90
  _regenerateProductRows() {
92
- h({
91
+ p({
93
92
  currentNode: this.currentNode,
94
93
  documentModifier: this.api.getDocumentModifier(),
95
94
  afterRegenerate: () => {
96
- l({
95
+ C({
97
96
  currentNode: this.currentNode,
98
97
  documentModifier: this.api.getDocumentModifier()
99
98
  });
@@ -109,16 +108,17 @@ class D extends c {
109
108
  }
110
109
  /**
111
110
  * Subscribe to store changes to update visibility when layout changes
111
+ * This is still needed because layout changes come from LayoutControl
112
112
  */
113
113
  _listenStateUpdates() {
114
114
  let t = this.store.recommendationConfigs.orientation;
115
115
  this.storeUnsubscription = this.store.$subscribe(() => {
116
- const n = this.store.recommendationConfigs.orientation;
117
- n !== t && (t = n, this._updateProductsInRowVisibility());
116
+ const s = this.store.recommendationConfigs.orientation;
117
+ s !== t && (t = s, this._updateProductsInRowVisibility());
118
118
  });
119
119
  }
120
120
  }
121
121
  export {
122
- O as PRODUCT_LAYOUT_CONTROL_ID,
123
- D as ProductLayoutControl
122
+ l as PRODUCT_LAYOUT_CONTROL_ID,
123
+ b as ProductLayoutControl
124
124
  };
@@ -1,19 +1,21 @@
1
- var n = Object.defineProperty;
2
- var r = (o, t, e) => t in o ? n(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var i = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as u } from "../../../common-control.js";
6
- import { useRecommendationExtensionStore as a } from "../../store/recommendation.js";
7
- const h = "recommendation-shuffle-control", s = {
1
+ var r = Object.defineProperty;
2
+ var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as f } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as l } from "../../../common-control.js";
6
+ import { RecommendationConfigService as i } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
+ const a = "recommendation-shuffle-control", s = {
8
9
  SHUFFLE_PRODUCTS: "shuffleProducts"
9
10
  };
10
- class C extends u {
11
+ class C extends l {
11
12
  constructor() {
12
13
  super(...arguments);
13
- i(this, "store", a());
14
+ // Store is used for backward compatibility with product fetching
15
+ n(this, "store", d());
14
16
  }
15
17
  getId() {
16
- return h;
18
+ return a;
17
19
  }
18
20
  getTemplate() {
19
21
  return `
@@ -28,25 +30,34 @@ class C extends u {
28
30
  onRender() {
29
31
  this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
30
32
  }
33
+ onTemplateNodeUpdated(e) {
34
+ super.onTemplateNodeUpdated(e), this._setFormValues();
35
+ }
31
36
  _setFormValues() {
32
- const { recommendationConfigs: e } = this.store;
37
+ const e = i.getConfig(this.currentNode);
33
38
  this.api.updateValues({
34
39
  [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
35
40
  });
36
41
  }
37
42
  _initializeToggle() {
43
+ const e = i.getConfig(this.currentNode);
38
44
  this.api.setUIEAttribute(
39
45
  s.SHUFFLE_PRODUCTS,
40
- l.SELECTPICKER.items,
41
- this.store.recommendationConfigs.shuffleProducts
46
+ f.SELECTPICKER.items,
47
+ e.shuffleProducts
42
48
  );
43
49
  }
44
50
  _onShuffleChange(e) {
45
- this.store.$patch({
51
+ this.currentNode && (i.updateConfig(
52
+ this.api,
53
+ this.currentNode,
54
+ { shuffleProducts: e },
55
+ `${e ? "Enabled" : "Disabled"} product shuffle`
56
+ ), this.store.$patch({
46
57
  recommendationConfigs: {
47
58
  shuffleProducts: e
48
59
  }
49
- });
60
+ }));
50
61
  }
51
62
  _listenToFormUpdates() {
52
63
  this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
@@ -55,6 +66,6 @@ class C extends u {
55
66
  }
56
67
  }
57
68
  export {
58
- h as SHUFFLE_CONTROL_ID,
69
+ a as SHUFFLE_CONTROL_ID,
59
70
  C as ShuffleControl
60
71
  };
@@ -1,112 +1,124 @@
1
- import { ModificationDescription as s } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CONTAINER_SELECTOR as y } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as S } from "../../store/recommendation.js";
4
- import { prepareProductRows as A } from "../../templates/index.js";
5
- import { DEFAULT_CARD_COMPOSITION as d, getDefaultProducts as b } from "../../templates/utils.js";
6
- const f = "ins-recommendation-v3-block-v2";
7
- function p(e) {
1
+ import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CURRENCY_ATTR as s, CONTAINER_SELECTOR as S } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
4
+ import { prepareProductRows as b } from "../../templates/index.js";
5
+ import { hasGetStyle as f, isTdNode as E } from "../../utils/tagName.js";
6
+ import { DEFAULT_CARD_COMPOSITION as m, getDefaultProducts as h } from "../../templates/utils.js";
7
+ const g = "ins-recommendation-v3-block-v2";
8
+ function d(e) {
8
9
  if (!e)
9
10
  return null;
10
11
  if ("getAttribute" in e) {
11
12
  const t = e.getAttribute("class");
12
- if (t && t.includes(f))
13
+ if (t && t.includes(g))
13
14
  return e;
14
15
  }
15
- return "querySelector" in e ? e.querySelector(`.${f}`) : null;
16
+ return "querySelector" in e ? e.querySelector(`.${g}`) : null;
16
17
  }
17
- function m(e) {
18
- const t = p(e);
18
+ function y(e) {
19
+ const t = d(e);
19
20
  return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
20
21
  }
21
- function C(e) {
22
- const t = p(e);
22
+ function R(e) {
23
+ const t = d(e);
23
24
  if (!t || !("getAttribute" in t))
24
- return d;
25
- const r = t.getAttribute("data-card-composition");
26
- return r ? r.split(",").filter(Boolean) : d;
25
+ return m;
26
+ const o = t.getAttribute("data-card-composition");
27
+ return o ? o.split(",").filter(Boolean) : m;
27
28
  }
28
- function R(e) {
29
- const { currentNode: t, documentModifier: r, afterRegenerate: o } = e;
29
+ function P(e) {
30
+ const { currentNode: t, documentModifier: o, afterRegenerate: r } = e;
30
31
  if (!t || !("querySelector" in t))
31
32
  return;
32
- const a = t.querySelector(y);
33
+ const a = t.querySelector(S);
33
34
  if (!a)
34
35
  return;
35
- const c = S(), i = c.recommendationProducts.length > 0 ? c.recommendationProducts : b(), { cardsInRow: l } = c.recommendationConfigs, n = C(t), u = m(t), g = A(i, u, {
36
+ const c = C(), n = c.recommendationProducts.length > 0 ? c.recommendationProducts : h(), { cardsInRow: l } = c.recommendationConfigs, i = R(t), u = y(t), A = b(n, u, {
36
37
  productsPerRow: l,
37
- composition: n
38
+ composition: i
38
39
  });
39
- r.modifyHtml(a).setInnerHtml(g).apply(new s("Updated product")), o == null || o();
40
+ o.modifyHtml(a).setInnerHtml(A).apply(new p("Updated product")), r == null || r();
40
41
  }
41
- function h(e, t, r, o) {
42
- const c = `0 ${Math.floor(r / 2)}px`;
43
- let i = !1;
44
- return o === "vertical" ? Array.from(
42
+ function w(e, t, o, r) {
43
+ const c = `0 ${Math.floor(o / 2)}px`;
44
+ let n = !1;
45
+ return r === "vertical" ? Array.from(
45
46
  e.querySelectorAll(".attribute-cell")
46
- ).forEach((n) => {
47
- t.modifyHtml(n).setStyle("padding", c), i = !0;
47
+ ).forEach((i) => {
48
+ t.modifyHtml(i).setStyle("padding", c), n = !0;
48
49
  }) : Array.from(
49
50
  e.querySelectorAll(".product-card-wrapper")
50
- ).forEach((n) => {
51
- "parentNode" in n && n.parentNode && typeof n.parentNode == "object" && "tagName" in n.parentNode && n.parentNode.tagName === "TD" && (t.modifyHtml(n.parentNode).setStyle("padding", c), i = !0);
52
- }), i;
51
+ ).forEach((i) => {
52
+ const u = "parentNode" in i ? i.parentNode : null;
53
+ u && E(u) && (t.modifyHtml(u).setStyle("padding", c), n = !0);
54
+ }), n;
53
55
  }
54
- function E(e, t, r) {
55
- const o = `${r}px`, a = Array.from(e.querySelectorAll(".spacer"));
56
+ function M(e, t, o) {
57
+ const r = `${o}px`, a = Array.from(e.querySelectorAll(".spacer"));
56
58
  let c = !1;
57
- return a.forEach((i) => {
58
- t.modifyHtml(i).setStyle("height", o), c = !0;
59
+ return a.forEach((n) => {
60
+ t.modifyHtml(n).setStyle("height", r), c = !0;
59
61
  }), c;
60
62
  }
61
- function P(e) {
62
- const { currentNode: t, documentModifier: r } = e;
63
+ function H(e) {
64
+ const { currentNode: t, documentModifier: o } = e;
63
65
  if (!t)
64
66
  return;
65
- const o = p(t);
66
- if (!o || !("getAttribute" in o))
67
+ const r = d(t);
68
+ if (!r || !("getAttribute" in r))
67
69
  return;
68
- const a = o.getAttribute("data-column-spacing"), c = o.getAttribute("data-row-spacing"), i = m(t);
70
+ const a = r.getAttribute("data-column-spacing"), c = r.getAttribute("data-row-spacing"), n = y(t);
69
71
  let l = !1;
70
72
  if (a) {
71
- const n = parseInt(a);
72
- Number.isNaN(n) || (l = h(
73
+ const i = parseInt(a);
74
+ Number.isNaN(i) || (l = w(
73
75
  t,
74
- r,
75
- n,
76
- i
76
+ o,
77
+ i,
78
+ n
77
79
  ));
78
80
  }
79
81
  if (c) {
80
- const n = parseInt(c);
81
- if (!Number.isNaN(n)) {
82
- const u = E(t, r, n);
82
+ const i = parseInt(c);
83
+ if (!Number.isNaN(i)) {
84
+ const u = M(t, o, i);
83
85
  l = l || u;
84
86
  }
85
87
  }
86
- l && r.apply(new s("Reapply spacing after regeneration"));
88
+ l && o.apply(new p("Reapply spacing after regeneration"));
87
89
  }
88
- function H(e) {
90
+ function L(e) {
89
91
  if (!e)
90
92
  return null;
91
- const t = e.querySelector(".product-card-segment"), r = e.querySelector(".product-card-wrapper");
92
- let o = null;
93
- return t && "getStyle" in t && (o = t.getStyle("background-color")), (!o || o === "transparent") && r && "getStyle" in r && (o = r.getStyle("background-color")), o;
93
+ const t = e.querySelector(".product-card-segment"), o = e.querySelector(".product-card-wrapper");
94
+ let r = null;
95
+ return t && f(t) && (r = t.getStyle("background-color") ?? null), (!r || r === "transparent") && o && f(o) && (r = o.getStyle("background-color") ?? null), r;
96
+ }
97
+ function _(e) {
98
+ const { currentNode: t, documentModifier: o, bgColor: r, layout: a } = e;
99
+ if (!r || r === "transparent" || !t)
100
+ return;
101
+ const c = a === "vertical" ? ".product-card-segment" : ".product-card-wrapper", n = Array.from(t.querySelectorAll(c));
102
+ n.length !== 0 && (n.forEach((l) => {
103
+ o.modifyHtml(l).setStyle("background-color", r);
104
+ }), o.apply(new p("Apply card background color")));
94
105
  }
95
- function I(e) {
96
- const { currentNode: t, documentModifier: r, bgColor: o, layout: a } = e;
97
- if (!o || o === "transparent" || !t)
106
+ function D(e) {
107
+ const { currentNode: t, documentModifier: o, currency: r } = e, a = d(t);
108
+ if (!a)
98
109
  return;
99
- const c = a === "vertical" ? ".product-card-segment" : ".product-card-wrapper", i = Array.from(t.querySelectorAll(c));
100
- i.length !== 0 && (i.forEach((l) => {
101
- r.modifyHtml(l).setStyle("background-color", o);
102
- }), r.apply(new s("Apply card background color")));
110
+ const c = r.alignment === "before" ? "0" : "1", n = (l, i) => {
111
+ o.modifyHtml(a).setAttribute(l, i);
112
+ };
113
+ n(s.CURRENCY, r.code), n(s.SYMBOL, r.symbol), n(s.ALIGNMENT, c), n(s.THOUSAND_SEPARATOR, r.thousandSeparator), n(s.DECIMAL_SEPARATOR, r.decimalSeparator), n(s.DECIMAL_COUNT, r.decimalCount.toString()), o.apply(new p("Update currency attributes"));
103
114
  }
104
115
  export {
105
- I as applyCardBackgroundColor,
106
- p as getBlockElement,
107
- C as getCardComposition,
108
- H as getCurrentCardBackgroundColor,
109
- m as getCurrentLayout,
110
- P as reapplySpacing,
111
- R as regenerateProductRows
116
+ _ as applyCardBackgroundColor,
117
+ d as getBlockElement,
118
+ R as getCardComposition,
119
+ L as getCurrentCardBackgroundColor,
120
+ y as getCurrentLayout,
121
+ H as reapplySpacing,
122
+ P as regenerateProductRows,
123
+ D as setCurrencyAttributes
112
124
  };
@@ -64,7 +64,7 @@ class b extends a {
64
64
  }
65
65
  _listenToFormUpdates() {
66
66
  this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
67
- this._onTextChange(t);
67
+ typeof t == "string" && this._onTextChange(t);
68
68
  });
69
69
  }
70
70
  }
@@ -5,7 +5,7 @@ import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
5
  import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
6
6
  import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
7
7
  const i = "data-text-before", u = "", p = ".omnibus-text-before";
8
- class B extends l {
8
+ class g extends l {
9
9
  getId() {
10
10
  return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
11
11
  }
@@ -64,10 +64,10 @@ class B extends l {
64
64
  }
65
65
  _listenToFormUpdates() {
66
66
  this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
67
- this._onTextChange(e);
67
+ typeof e == "string" && this._onTextChange(e);
68
68
  });
69
69
  }
70
70
  }
71
71
  export {
72
- B as OmnibusDiscountTextBeforeControl
72
+ g as OmnibusDiscountTextBeforeControl
73
73
  };