@useinsider/guido 3.2.0-beta.6d12eec → 3.2.0-beta.738ec8a

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 (40) hide show
  1. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +9 -11
  2. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +70 -35
  3. package/dist/composables/useActionsApi.js +4 -4
  4. package/dist/composables/useFullStoryBridge.js +9 -29
  5. package/dist/composables/useSave.js +1 -1
  6. package/dist/composables/useStripo.js +23 -22
  7. package/dist/config/compiler/recommendationCompilerRules.js +72 -67
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +33 -30
  9. package/dist/config/migrator/recommendationMigrator.js +1 -1
  10. package/dist/enums/extensions/recommendationBlock.js +28 -27
  11. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  12. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  13. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  14. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  15. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  16. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  17. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  18. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  19. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  20. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  21. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  22. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
  23. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +31 -15
  24. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  25. package/dist/guido.css +1 -1
  26. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
  27. package/dist/package.json.js +1 -1
  28. package/dist/src/composables/useActionsApi.d.ts +1 -1
  29. package/dist/src/composables/useFullStoryBridge.d.ts +6 -6
  30. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
  31. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  33. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  34. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  35. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  36. package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
  37. package/dist/static/styles/components/button.css.js +16 -9
  38. package/dist/static/styles/components/loader.css.js +4 -0
  39. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  40. package/package.json +3 -3
@@ -1,10 +1,11 @@
1
1
  import { useConfig as S } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
3
+ import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
3
4
  function y(e, u, r, o, s = "") {
4
5
  const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
5
6
  return o === "before" ? `${t} ${n}` : `${n} ${t}`;
6
7
  }
7
- function p(e, u, r, o, s, n) {
8
+ function m(e, u, r, o, s, n) {
8
9
  switch (u) {
9
10
  case "productImage": {
10
11
  const t = e.querySelector("img");
@@ -69,67 +70,69 @@ function p(e, u, r, o, s, n) {
69
70
  default: {
70
71
  const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
71
72
  if (t) {
72
- const c = t.getAttribute("product-attr"), i = t.querySelector("p");
73
- if (i) {
74
- const a = i.querySelector("strong") || i;
75
- a.textContent = `{{${n}${r}_${o}_${c}}}`;
73
+ const c = t.getAttribute("product-attr"), a = t.querySelector("p");
74
+ if (a) {
75
+ const i = a.querySelector("strong") || a;
76
+ i.textContent = `{{${n}${r}_${o}_${c}}}`;
76
77
  }
77
78
  }
78
79
  break;
79
80
  }
80
81
  }
81
82
  }
82
- function d(e, u, r, o) {
83
+ function q(e, u, r, o) {
83
84
  e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
84
- n.querySelectorAll("[data-attribute-type]").forEach((i) => {
85
- const a = i.getAttribute("data-attribute-type") || "", b = i.querySelectorAll(".attribute-cell");
86
- b.length > 0 ? b.forEach((l) => {
87
- p(l, a, u, t, r, o);
88
- }) : p(i, a, u, t, r, o);
85
+ n.querySelectorAll("[data-attribute-type]").forEach((a) => {
86
+ const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
87
+ l.length > 0 ? l.forEach((p) => {
88
+ m(p, i, u, t, r, o);
89
+ }) : m(a, i, u, t, r, o);
89
90
  });
90
91
  });
91
92
  }
92
- function q(e, u, r, o) {
93
+ function g(e, u, r, o) {
93
94
  const s = e.querySelectorAll(".recommendation-product-row");
94
95
  if (!s.length)
95
96
  return;
96
97
  const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
97
- s.forEach((i, a) => {
98
- i.querySelectorAll("[data-attribute-type]").forEach((l) => {
99
- const m = l.getAttribute("data-attribute-type") || "";
100
- l.querySelectorAll(".attribute-cell").forEach(($, f) => {
101
- const A = a * c + f;
102
- p($, m, u, A, r, o);
98
+ s.forEach((a, i) => {
99
+ a.querySelectorAll("[data-attribute-type]").forEach((p) => {
100
+ const b = p.getAttribute("data-attribute-type") || "";
101
+ p.querySelectorAll(".attribute-cell").forEach((f, $) => {
102
+ const A = i * c + $;
103
+ m(f, b, u, A, r, o);
103
104
  });
104
105
  });
105
106
  });
106
107
  }
107
- function g(e, u, r, o) {
108
+ function h(e, u, r, o) {
108
109
  e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
109
- q(n, u, r, o);
110
+ g(n, u, r, o);
110
111
  });
111
112
  }
112
- function h(e, u, r) {
113
+ function C(e, u, r) {
113
114
  const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
114
- o === "list" ? d(e, u, s, r) : g(e, u, s, r);
115
+ o === "list" ? q(e, u, s, r) : h(e, u, s, r);
115
116
  }
116
- function C(e, u) {
117
+ function E(e, u) {
117
118
  const r = e.match(/<!DOCTYPE[^>]*>/i);
118
119
  return (r ? `${r[0]}
119
120
  ` : "") + u.documentElement.outerHTML;
120
121
  }
121
- function P(e) {
122
+ function T(e) {
122
123
  const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
123
124
  if (!o.length)
124
125
  return e;
125
- const { buildCampaignUrl: s } = _(), { isFeatureEnabled: n } = S(), t = n("liquidSyntax") ? "reco_" : "";
126
+ const { buildCampaignUrl: s } = _(), n = d();
127
+ n.recommendationCampaignUrls = {};
128
+ const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
126
129
  return o.forEach((i) => {
127
- var b, l;
128
- const a = i.getAttribute("recommendation-id");
129
- a && ((b = i.parentNode) == null || b.insertBefore(r.createComment("REC_START"), i), (l = i.parentNode) == null || l.insertBefore(r.createComment("REC_END"), i.nextSibling), s(a), h(i, a, t));
130
- }), C(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
130
+ var p, b;
131
+ const l = i.getAttribute("recommendation-id");
132
+ l && ((p = i.parentNode) == null || p.insertBefore(r.createComment("REC_START"), i), (b = i.parentNode) == null || b.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
133
+ }), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
131
134
  }
132
135
  export {
133
136
  y as formatPriceVariable,
134
- P as prepareRecommendationBlocks
137
+ T as prepareRecommendationBlocks
135
138
  };
@@ -13,7 +13,7 @@ class B {
13
13
  migrate(e) {
14
14
  try {
15
15
  const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
16
- 'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
16
+ 'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
17
17
  );
18
18
  return w().$patch((i) => {
19
19
  i.migrations = { ...i.migrations, [S]: s.length };
@@ -1,8 +1,8 @@
1
- const s = {
1
+ const i = {
2
2
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
3
- }, i = {
3
+ }, u = {
4
4
  CLIENT_ID: "clientId"
5
- }, u = [
5
+ }, l = [
6
6
  { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
7
7
  { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
8
8
  { id: 13, key: "userBased", name: "User Based", path: "user-based" },
@@ -13,71 +13,72 @@ const s = {
13
13
  { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
14
14
  { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
15
15
  { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
16
- ], l = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], c = [
16
+ ], c = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], d = [
17
17
  { text: "before the amount", value: "0" },
18
18
  { text: "after the amount", value: "1" }
19
- ], d = [
19
+ ], p = [
20
20
  { text: "dot(.)", value: "." },
21
21
  { text: "comma(,)", value: "," }
22
- ], p = [
22
+ ], m = [
23
23
  { text: "0", value: "0" },
24
24
  { text: "1", value: "1" },
25
25
  { text: "2", value: "2" },
26
26
  { text: "3", value: "3" },
27
27
  { text: "4", value: "4" },
28
28
  { text: "5", value: "5" }
29
- ], e = [
29
+ ], a = "||", e = [
30
30
  { text: "is exactly", value: "=" },
31
31
  { text: "contains", value: "~" },
32
32
  { text: "does not contain", value: "!~" },
33
- { text: "any of", value: "||" }
34
- ], a = [
33
+ { text: "any of", value: a }
34
+ ], o = [
35
35
  { text: "is exactly", value: "=" },
36
36
  { text: "is not exactly", value: "!==" },
37
37
  { text: "contains", value: "~" },
38
38
  { text: "does not contain", value: "!~" },
39
- { text: "any of", value: "||" }
39
+ { text: "any of", value: a }
40
40
  ], r = [
41
41
  { text: "is equal to", value: "=" },
42
42
  { text: "is greater than", value: ">" },
43
43
  { text: "is less than", value: "<" }
44
- ], o = [
44
+ ], n = [
45
45
  { text: "is equal to", value: "=" },
46
46
  { text: "after", value: ">" },
47
47
  { text: "before", value: "<" }
48
- ], n = [
48
+ ], s = [
49
49
  { text: "true", value: "==" },
50
50
  { text: "false", value: "!=" }
51
- ], m = (t) => {
51
+ ], v = (t) => {
52
52
  if (!t)
53
53
  return e;
54
54
  switch (t) {
55
55
  case "Boolean":
56
- return n;
56
+ return s;
57
57
  case "Date":
58
- return o;
58
+ return n;
59
59
  case "Number":
60
60
  return r;
61
61
  case "String":
62
62
  return e;
63
63
  case "Strings":
64
- return a;
64
+ return o;
65
65
  default:
66
66
  return e;
67
67
  }
68
68
  };
69
69
  export {
70
- l as PriceAttributes,
71
- i as QUERY_PARAMS,
72
- u as RecommendationFeedSourceMaps,
73
- s as URLS,
74
- p as currencyDecimalCounts,
75
- c as currencyLocationMaps,
76
- d as currencyOperators,
77
- m as getOperatorOptions,
78
- a as operatorOptionsForArrayOfStrings,
79
- n as operatorOptionsForBooleans,
80
- o as operatorOptionsForDates,
70
+ a as OP_ANY_OF,
71
+ c as PriceAttributes,
72
+ u as QUERY_PARAMS,
73
+ l as RecommendationFeedSourceMaps,
74
+ i as URLS,
75
+ m as currencyDecimalCounts,
76
+ d as currencyLocationMaps,
77
+ p as currencyOperators,
78
+ v as getOperatorOptions,
79
+ o as operatorOptionsForArrayOfStrings,
80
+ s as operatorOptionsForBooleans,
81
+ n as operatorOptionsForDates,
81
82
  r as operatorOptionsForNumbers,
82
83
  e as operatorOptionsForStrings
83
84
  };
@@ -1,75 +1,75 @@
1
- import { ModificationDescription as m, UIElementType as _, UEAttr as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as h } from "../../../common-control.js";
3
- import { ItemsBlockControlId as L, ItemsBlockId as R } from "../../enums/controlEnums.js";
4
- import { productPairs as T } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as N } from "../../utils/nodeConfigUtils.js";
6
- const D = L.PRICE_SINGLE_PRICE, l = {
1
+ import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as A } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
4
+ import { productPairs as R } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const u = T.PRICE_SINGLE_PRICE, l = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class y extends h {
9
+ class k extends A {
10
10
  getId() {
11
- return D;
11
+ return u;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${L.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${T.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
21
  const e = I(this.currentNode);
22
- this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (t) => {
23
- this._onSinglePriceChange(t);
22
+ this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
23
+ this._onSinglePriceChange(i);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = I(this.currentNode);
29
- this.api.updateValues({ [l.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
28
+ const i = I(this.currentNode);
29
+ this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
30
30
  });
31
31
  }
32
32
  _onSinglePriceChange(e) {
33
- if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
33
+ if (console.debug("Single price changed to: ", e), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), o = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = T.PAIRS_FOR_EXTENSION.price[o], c = T.PAIRS_FOR_EXTENSION.originalPrice[o], [P, p] = e ? [
36
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
35
+ const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
36
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
37
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], s = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, d = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [g, C] = e ? [s, d] : [d, s], n = this.currentNode.closest(".items-block"), S = (n == null ? void 0 : n.querySelectorAll(
42
- `[esd-extension-block-id="${R.PRICE}"]`
43
- )) || [], E = this.api.getDocumentModifier();
44
- S.forEach((a) => {
45
- this._updatePriceBlock(E, a, P, p, e);
46
- }), ((n == null ? void 0 : n.querySelectorAll(
47
- `[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
39
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
40
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
41
+ ], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
42
+ N(this.currentNode, this.api, { priceSinglePrice: e }, s);
43
+ const o = this.currentNode.closest(".items-block");
44
+ ((o == null ? void 0 : o.querySelectorAll(
45
+ `[esd-extension-block-id="${p.PRICE}"]`
48
46
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(E, a, g, C, e);
50
- }), E.apply(new m(
47
+ this._updatePriceBlock(s, a, E, g, e);
48
+ }), ((o == null ? void 0 : o.querySelectorAll(
49
+ `[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
50
+ )) || []).forEach((a) => {
51
+ this._updatePriceBlock(s, a, L, C, e);
52
+ }), s.apply(new S(
51
53
  `Updated price to ${e ? "single" : "total"} price`
52
54
  ));
53
55
  }
54
- _updatePriceBlock(e, t, o, r, i) {
55
- const c = t.getInnerHTML().trim().replace(o, N(r));
56
- e.modifyHtml(t).setInnerHtml(c), t.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
57
- e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
58
- });
56
+ _updatePriceBlock(e, i, c, r, t) {
57
+ const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
58
+ e.modifyHtml(i).setInnerHtml(E);
59
59
  }
60
60
  _getSinglePrice() {
61
61
  return `
62
62
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
64
- ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
+ <${d.LABEL}
64
+ ${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
65
65
  >
66
- </${_.LABEL}>
66
+ </${d.LABEL}>
67
67
  ${this._GuToggle(l.SINGLE_PRICE)}
68
68
  </div>
69
69
  `;
70
70
  }
71
71
  }
72
72
  export {
73
- D as CONTROL_BLOCK_ID,
74
- y as PriceSinglePriceControl
73
+ u as CONTROL_BLOCK_ID,
74
+ k as PriceSinglePriceControl
75
75
  };
@@ -1,6 +1,6 @@
1
1
  import _ from "../../../../node_modules/lodash-es/flatMap.js";
2
- import a from "../../../../node_modules/lodash-es/range.js";
3
- const T = '<td align="center" class="ins-product-td items-block items-block-v2">', E = { PAIRS_FOR_EXTENSION: {
2
+ import E from "../../../../node_modules/lodash-es/range.js";
3
+ const T = '<td align="center" class="ins-product-td items-block items-block-v2">', a = { PAIRS_FOR_EXTENSION: {
4
4
  imageSrc: {
5
5
  CART_ITEMS: {
6
6
  ATTR: "ins_apr_img",
@@ -212,10 +212,10 @@ const T = '<td align="center" class="ins-product-td items-block items-block-v2">
212
212
  }
213
213
  } };
214
214
  function m(e, s = 8) {
215
- return a(1, s + 1).map((i) => `${e}_${i}`);
215
+ return E(1, s + 1).map((i) => `${e}_${i}`);
216
216
  }
217
- function t() {
218
- const { PAIRS_FOR_EXTENSION: e } = E, s = [];
217
+ function r() {
218
+ const { PAIRS_FOR_EXTENSION: e } = a, s = [];
219
219
  return s.push(
220
220
  e.imageSrc.CART_ITEMS.ATTR,
221
221
  e.imageSrc.BROWSED_ITEMS.ATTR,
@@ -234,22 +234,34 @@ function t() {
234
234
  ), s.push(
235
235
  e.price.CART_ITEMS.PRICE,
236
236
  e.price.CART_ITEMS.PRICE_FORMATTED,
237
+ e.price.CART_ITEMS.SINGLE_PRICE,
238
+ e.price.CART_ITEMS.SINGLE_PRICE_FORMATTED,
237
239
  e.price.CART_ITEMS.CURRENCY,
238
240
  e.price.BROWSED_ITEMS.PRICE,
239
241
  e.price.BROWSED_ITEMS.PRICE_FORMATTED,
242
+ e.price.BROWSED_ITEMS.SINGLE_PRICE,
243
+ e.price.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
240
244
  e.price.BROWSED_ITEMS.CURRENCY,
241
245
  e.price.PURCHASED_ITEMS.PRICE,
242
246
  e.price.PURCHASED_ITEMS.PRICE_FORMATTED,
247
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE,
248
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
243
249
  e.price.PURCHASED_ITEMS.CURRENCY
244
250
  ), s.push(
245
251
  e.originalPrice.CART_ITEMS.PRICE,
246
252
  e.originalPrice.CART_ITEMS.PRICE_FORMATTED,
253
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE,
254
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE_FORMATTED,
247
255
  e.originalPrice.CART_ITEMS.CURRENCY,
248
256
  e.originalPrice.BROWSED_ITEMS.PRICE,
249
257
  e.originalPrice.BROWSED_ITEMS.PRICE_FORMATTED,
258
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE,
259
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
250
260
  e.originalPrice.BROWSED_ITEMS.CURRENCY,
251
261
  e.originalPrice.PURCHASED_ITEMS.PRICE,
252
262
  e.originalPrice.PURCHASED_ITEMS.PRICE_FORMATTED,
263
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE,
264
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
253
265
  e.originalPrice.PURCHASED_ITEMS.CURRENCY
254
266
  ), s.push(
255
267
  e.button.CART_ITEMS.HREF,
@@ -262,11 +274,11 @@ function t() {
262
274
  ), s;
263
275
  }
264
276
  const o = _(
265
- t(),
277
+ r(),
266
278
  (e) => m(e)
267
279
  );
268
280
  export {
269
281
  o as itemsBlockDynamicVariables,
270
- E as productPairs,
282
+ a as productPairs,
271
283
  T as templateFirstLine
272
284
  };
@@ -1,4 +1,4 @@
1
- var o = /* @__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.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
1
+ var o = /* @__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.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
2
2
  export {
3
3
  o as RecommendationControlId
4
4
  };
@@ -1,21 +1,22 @@
1
- import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as i, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as c, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as l } from "../../constants/blockIds.js";
3
3
  import { RecommendationControlId as e } from "../../constants/controlIds.js";
4
- import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
4
+ import { BLOCK_ROOT_SELECTOR as A, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
5
+ import { CustomAttributeTextTrimControl as I } from "./textTrim.js";
5
6
  function o(t) {
6
- const n = t.closest(I);
7
- if (!n)
7
+ const r = t.closest(A);
8
+ if (!r)
8
9
  return [];
9
- const r = t.asElement().getAttribute(s);
10
- if (r) {
11
- const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
12
- return n.querySelectorAll(T);
10
+ const n = t.asElement().getAttribute(s);
11
+ if (n) {
12
+ const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${n}"]`;
13
+ return r.querySelectorAll(T);
13
14
  }
14
- return n.querySelectorAll(
15
+ return r.querySelectorAll(
15
16
  `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
16
17
  );
17
18
  }
18
- const A = class extends a {
19
+ const m = class extends a {
19
20
  getId() {
20
21
  return e.CUSTOM_ATTR_ALIGN;
21
22
  }
@@ -36,7 +37,7 @@ const A = class extends a {
36
37
  getTargetNodes(t) {
37
38
  return o(t);
38
39
  }
39
- }, m = class extends i {
40
+ }, x = class extends c {
40
41
  getId() {
41
42
  return e.CUSTOM_ATTR_STYLE;
42
43
  }
@@ -50,29 +51,31 @@ const A = class extends a {
50
51
  getTargetNodes(t) {
51
52
  return o(t);
52
53
  }
53
- }, R = class extends c {
54
+ }, R = class extends i {
54
55
  getId() {
55
56
  return e.CUSTOM_ATTR_BACKGROUND;
56
57
  }
57
58
  getTargetNodes(t) {
58
59
  return o(t);
59
60
  }
60
- }, x = class extends d {
61
+ }, B = class extends d {
61
62
  getId() {
62
63
  return e.CUSTOM_ATTR_PADDINGS;
63
64
  }
64
65
  getTargetNodes(t) {
65
66
  return o(t);
66
67
  }
67
- }, k = {
68
- align: A,
68
+ }, p = {
69
+ align: m,
69
70
  color: _,
70
71
  size: S,
71
- style: m,
72
+ style: x,
72
73
  fontFamily: O,
73
74
  background: R,
74
- paddings: x
75
+ paddings: B,
76
+ textTrim: I
75
77
  };
76
78
  export {
77
- k as CustomAttributeControls
79
+ p as CustomAttributeControls,
80
+ I as CustomAttributeTextTrimControl
78
81
  };
@@ -0,0 +1,99 @@
1
+ import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as m } from "../../../common-control.js";
3
+ import { RecommendationBlockId as n } from "../../constants/blockIds.js";
4
+ import { RecommendationControlId as l } from "../../constants/controlIds.js";
5
+ import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
6
+ import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
7
+ const i = {
8
+ TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
9
+ };
10
+ class g extends m {
11
+ getId() {
12
+ return l.CUSTOM_ATTR_TEXT_TRIM;
13
+ }
14
+ getTemplate() {
15
+ return `
16
+ <hr style="margin: 0; border: none; border-top: 1px solid #e0e0e0;" />
17
+ <div class="custom-attr-text-trim-control-container">
18
+ ${this._GuTwoColumns([
19
+ this._GuLabel({ text: this.api.translate("Trim Long Text") }),
20
+ this._GuToggle(i.TEXT_TRIM_ENABLED)
21
+ ])}
22
+ </div>
23
+ `;
24
+ }
25
+ onRender() {
26
+ this._setFormValues(), this._listenToFormUpdates();
27
+ }
28
+ onTemplateNodeUpdated(t) {
29
+ super.onTemplateNodeUpdated(t), this._setFormValues();
30
+ }
31
+ // ========================================================================
32
+ // State Reading
33
+ // ========================================================================
34
+ _setFormValues() {
35
+ this.api.updateValues({
36
+ [i.TEXT_TRIM_ENABLED]: this._getCurrentTrimState()
37
+ });
38
+ }
39
+ _getCurrentTrimState() {
40
+ if (!this.currentNode || !("hasClass" in this.currentNode))
41
+ return !1;
42
+ if (this.currentNode.hasClass(o))
43
+ return !0;
44
+ const t = this._getTargetElements();
45
+ return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(o) : !1;
46
+ }
47
+ // ========================================================================
48
+ // Target Element Discovery (per-attribute scoping)
49
+ // ========================================================================
50
+ /**
51
+ * Finds all custom attribute elements of the same type as the current node.
52
+ *
53
+ * Similar to getCustomAttrTargetNodes in customAttribute/index.ts, but adapted
54
+ * for CommonControl lifecycle where currentNode is a class property (not a
55
+ * parameter from Stripo's getTargetNodes override).
56
+ */
57
+ _getTargetElements() {
58
+ if (!this.currentNode || !("closest" in this.currentNode))
59
+ return [];
60
+ const t = this.currentNode.closest(u);
61
+ if (!t)
62
+ return [];
63
+ const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
64
+ if (e) {
65
+ const s = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
66
+ return Array.from(t.querySelectorAll(s));
67
+ }
68
+ return Array.from(
69
+ t.querySelectorAll(
70
+ `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"]`
71
+ )
72
+ );
73
+ }
74
+ // ========================================================================
75
+ // Toggle Handler
76
+ // ========================================================================
77
+ _onTextTrimChange(t) {
78
+ const e = this._getTargetElements();
79
+ if (!e.length)
80
+ return;
81
+ t && c(this.api);
82
+ const r = this.api.getDocumentModifier();
83
+ e.forEach((s) => {
84
+ t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
85
+ }), r.apply(
86
+ new T(
87
+ t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
88
+ )
89
+ );
90
+ }
91
+ _listenToFormUpdates() {
92
+ this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (t) => {
93
+ this._onTextTrimChange(t);
94
+ });
95
+ }
96
+ }
97
+ export {
98
+ g as CustomAttributeTextTrimControl
99
+ };