@useinsider/guido 3.6.0-beta.4f2bf14 → 3.6.0-beta.596b70e

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 (39) hide show
  1. package/dist/composables/useRecommendation.js +34 -33
  2. package/dist/composables/useStripoEventHandler.js +11 -13
  3. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +50 -48
  4. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -32
  5. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
  6. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +310 -338
  7. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  8. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  9. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
  10. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +117 -146
  11. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +49 -30
  12. package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -8
  13. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +110 -83
  14. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -21
  15. package/dist/extensions/Blocks/Recommendation/templates/utils.js +90 -54
  16. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +139 -0
  17. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
  18. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  19. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
  20. package/dist/extensions/Blocks/controlFactories.js +159 -133
  21. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  22. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  23. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  24. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  25. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  26. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.test.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  28. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +127 -11
  29. package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
  30. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +44 -0
  31. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
  33. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  34. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
  36. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  37. package/package.json +1 -1
  38. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
  39. /package/dist/src/{composables/useStripoEventHandler.test.d.ts → extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts} +0 -0
@@ -0,0 +1,139 @@
1
+ import { RecommendationBlockId as i } from "../constants/blockIds.js";
2
+ import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_PRICE as C, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as O, ATTR_PRODUCT_OMNIBUS_DISCOUNT as k, ATTR_PRODUCT_BUTTON as A, ATTR_PRODUCT_IMAGE as E } from "../constants/selectors.js";
3
+ import { extractWrapperTags as g } from "./preserveTextStyles.js";
4
+ import { hasGetStyle as f, hasGetAttribute as P, hasGetComputedStyle as h } from "./tagName.js";
5
+ const c = [
6
+ "font-size",
7
+ "font-family",
8
+ "font-weight",
9
+ "font-style",
10
+ "color",
11
+ "text-align",
12
+ "line-height",
13
+ "text-decoration"
14
+ ], B = [
15
+ "background",
16
+ "background-color",
17
+ "border-width",
18
+ "border-color",
19
+ "border-style",
20
+ "border-radius"
21
+ ], N = [
22
+ ...c,
23
+ "background",
24
+ "background-color",
25
+ "padding",
26
+ "width",
27
+ "mso-border-alt",
28
+ "mso-padding-alt"
29
+ ], U = [
30
+ "display",
31
+ "width",
32
+ "height",
33
+ "max-width",
34
+ "border-radius",
35
+ "margin"
36
+ ], l = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), q = [
37
+ { attrKey: _, blockId: i.NAME, kind: "text" },
38
+ { attrKey: C, blockId: i.PRICE, kind: "text" },
39
+ { attrKey: I, blockId: i.OLD_PRICE, kind: "text" },
40
+ { attrKey: O, blockId: i.OMNIBUS_PRICE, kind: "text" },
41
+ { attrKey: k, blockId: i.OMNIBUS_DISCOUNT, kind: "text" },
42
+ { attrKey: A, blockId: i.BUTTON, kind: "button" },
43
+ { attrKey: E, blockId: i.IMAGE, kind: "image" }
44
+ ];
45
+ function y(t) {
46
+ return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
47
+ }
48
+ function a(t, r, e) {
49
+ !r || !f(r) || e.forEach((o) => {
50
+ const n = r.getStyle(o);
51
+ n && n !== "inherit" && n !== "initial" && (t[o] = n);
52
+ });
53
+ }
54
+ function b(t) {
55
+ return Object.entries(t).map(([r, e]) => `${r}: ${e};`).join(" ");
56
+ }
57
+ function p(t) {
58
+ if (!t || !f(t))
59
+ return;
60
+ const r = t.getStyle("background-color") || t.getStyle("background");
61
+ return r && !l.has(r) ? r : void 0;
62
+ }
63
+ function d(t, r) {
64
+ const e = {};
65
+ return a(e, t, r), b(e);
66
+ }
67
+ function M(t) {
68
+ const r = t.querySelector("p"), e = {};
69
+ a(e, t, c), a(e, r, c), a(e, t.querySelector("strong"), c), a(e, t.querySelector("em"), c), a(e, t.querySelector("s"), c);
70
+ const o = b(e), { openTags: n, closeTags: u } = g(y(r));
71
+ return !o && !n ? null : { pStyle: o || void 0, openTags: n, closeTags: u };
72
+ }
73
+ function x(t) {
74
+ const r = t.querySelector(".es-button-border"), e = t.querySelector("a.es-button") ?? t.querySelector("a"), o = d(r, B), n = d(e, N), u = r && "getAttribute" in r ? r.getAttribute("class") ?? "" : "", s = /\bes-fw\b/.test(u), { openTags: T, closeTags: R } = g(y(e));
75
+ return !o && !n && !s && !T ? null : {
76
+ buttonBorderStyle: o || void 0,
77
+ buttonAnchorStyle: n || void 0,
78
+ buttonFitToContainer: s || void 0,
79
+ openTags: T,
80
+ closeTags: R
81
+ };
82
+ }
83
+ function D(t) {
84
+ const r = d(t.querySelector("img"), U);
85
+ return r ? { imgStyle: r } : null;
86
+ }
87
+ function v(t, r) {
88
+ return r === "button" ? x(t) : r === "image" ? D(t) : M(t);
89
+ }
90
+ function m(t, r) {
91
+ if (!t || !("querySelector" in t))
92
+ return;
93
+ const e = t.querySelector(S) ?? t;
94
+ q.forEach(({ attrKey: o, blockId: n, kind: u }) => {
95
+ const s = e.querySelector(`[esd-extension-block-id="${n}"]`);
96
+ s && r(s, o, u);
97
+ });
98
+ }
99
+ function F(t) {
100
+ const r = {};
101
+ return m(t, (e, o, n) => {
102
+ if (!("querySelector" in e))
103
+ return;
104
+ const u = v(e, n);
105
+ u && (r[o] = u);
106
+ }), r;
107
+ }
108
+ function $(t) {
109
+ if (!t || !("querySelector" in t))
110
+ return;
111
+ const r = t.querySelector(S) ?? t, e = r.querySelector(".product-card-segment") ?? r.querySelector(".product-card-wrapper");
112
+ return p(e);
113
+ }
114
+ function K(t) {
115
+ if (!t)
116
+ return;
117
+ const r = P(t) ? t.getAttribute("bgcolor") : null;
118
+ if (r && !l.has(r))
119
+ return r;
120
+ const e = p(t);
121
+ if (e)
122
+ return e;
123
+ const o = h(t) ? t.getComputedStyle("background-color") : void 0;
124
+ return o && !l.has(o) ? o : void 0;
125
+ }
126
+ function j(t) {
127
+ const r = {};
128
+ return m(t, (e, o, n) => {
129
+ if (n !== "text")
130
+ return;
131
+ const u = K(e);
132
+ u && (r[o] = u);
133
+ }), r;
134
+ }
135
+ export {
136
+ F as captureAttributeStyleTemplates,
137
+ $ as captureCardBackgroundColor,
138
+ j as captureCellBackgroundColors
139
+ };
@@ -0,0 +1,21 @@
1
+ const i = [
2
+ "ozonebg",
3
+ "ozonehr",
4
+ "ozonero",
5
+ "ozoneinfo",
6
+ "babybg",
7
+ "ozongr",
8
+ "iboodat",
9
+ "iboodbe",
10
+ "iboodde",
11
+ "iboodfr",
12
+ "iboodnl",
13
+ "iboodpl"
14
+ ], r = ["interencheres", "interencherespreprod"], d = ["lodenfrey", "lodenfreyuat"], c = "manualMerchandising";
15
+ function s(e, n) {
16
+ const o = {};
17
+ return i.includes(e) && (o.excludePurchaseDay = "30", o.userId = "{user_id}"), r.includes(e) && (o.hp = "1"), d.includes(e) && n === c && (o.includeOutOfStockItems = "true"), o;
18
+ }
19
+ export {
20
+ s as getPartnerRecommendationParams
21
+ };
@@ -1,27 +1,32 @@
1
- import { escapeHtml as m } from "../../../../utils/htmlEscape.js";
2
- function T(t) {
3
- return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
1
+ import { escapeHtml as g } from "../../../../utils/htmlEscape.js";
2
+ function u(n) {
3
+ return "getInnerHTML" in n && typeof n.getInnerHTML == "function" ? n.getInnerHTML().trim() : "innerHTML" in n ? n.innerHTML : "";
4
4
  }
5
- function H(t, f) {
6
- const n = m(f);
7
- if (!t)
8
- return n;
9
- const r = T(t);
10
- if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
11
- return n;
12
- const e = [], s = [];
13
- let o = r.trim();
5
+ function T(n) {
6
+ const s = [], t = [];
7
+ let r = n.trim();
14
8
  for (; ; ) {
15
- const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
16
- if (!u)
9
+ const e = r.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
10
+ if (!e)
17
11
  break;
18
- const [, i, a = "", c] = u, g = new RegExp(`</${i}>$`, "i");
19
- if (!g.test(c))
12
+ const [, i, a = "", o] = e, c = new RegExp(`</${i}>$`, "i");
13
+ if (!c.test(o))
20
14
  break;
21
- e.push(`<${i}${a}>`), s.unshift(`</${i}>`), o = c.replace(g, "").trim();
15
+ s.push(`<${i}${a}>`), t.unshift(`</${i}>`), r = o.replace(c, "").trim();
22
16
  }
23
- return e.length > 0 ? e.join("") + n + s.join("") : n;
17
+ return { openTags: s.join(""), closeTags: t.join("") };
18
+ }
19
+ function p(n, s) {
20
+ const t = g(s);
21
+ if (!n)
22
+ return t;
23
+ const r = u(n);
24
+ if (!r || r.trim() === "")
25
+ return t;
26
+ const { openTags: e, closeTags: i } = T(r);
27
+ return e ? e + t + i : t;
24
28
  }
25
29
  export {
26
- H as preserveTextStyles
30
+ T as extractWrapperTags,
31
+ p as preserveTextStyles
27
32
  };
@@ -1,26 +1,29 @@
1
- function a(t) {
1
+ function n(t) {
2
2
  return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
3
3
  }
4
- function n(t) {
4
+ function r(t) {
5
5
  return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
6
6
  }
7
- function r(t) {
7
+ function u(t) {
8
8
  return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
9
9
  }
10
- function u(t) {
11
- return typeof t == "object" && t !== null && "parent" in t && typeof t.parent == "function";
10
+ function p(t) {
11
+ return typeof t == "object" && t !== null && "getComputedStyle" in t && typeof t.getComputedStyle == "function";
12
12
  }
13
13
  function g(t) {
14
- return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
14
+ return typeof t == "object" && t !== null && "getAttribute" in t && typeof t.getAttribute == "function";
15
+ }
16
+ function a(t) {
17
+ return typeof t == "object" && t !== null && "parent" in t && typeof t.parent == "function";
15
18
  }
16
- function p(t, e) {
17
- return !t || !r(t) ? null : t.getStyle(e);
19
+ function y(t, e) {
20
+ return !t || !u(t) ? null : t.getStyle(e);
18
21
  }
19
- function N(t) {
20
- return !t || !u(t) ? null : t.parent() ?? null;
22
+ function o(t) {
23
+ return !t || !a(t) ? null : t.parent() ?? null;
21
24
  }
22
25
  function l(t, e = "UNKNOWN") {
23
- return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
26
+ return t ? n(t) ? t.tagName.toUpperCase() : r(t) ? t.getTagName().toUpperCase() : e : e;
24
27
  }
25
28
  const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
26
29
  function i(t) {
@@ -36,11 +39,12 @@ function s(t) {
36
39
  export {
37
40
  s as getTableDisplayValue,
38
41
  l as getTagName,
39
- r as hasGetStyle,
40
- u as hasParent,
42
+ g as hasGetAttribute,
43
+ p as hasGetComputedStyle,
44
+ u as hasGetStyle,
45
+ a as hasParent,
41
46
  c as isTableCellNode,
42
47
  i as isTableCellTag,
43
- g as isTdNode,
44
- N as safeGetParent,
45
- p as safeGetStyle
48
+ o as safeGetParent,
49
+ y as safeGetStyle
46
50
  };