@useinsider/guido 3.21.2-beta.1cc8327 → 3.21.2-beta.4b0fed7

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.
@@ -1,8 +1,7 @@
1
- import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
2
- import { stripFullStoryScripts as h } from "../utils/fullStoryScripts.js";
3
- import { getEditorApi as r } from "../utils/stripoEditorApi.js";
1
+ import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
2
+ import { getEditorApi as s } from "../utils/stripoEditorApi.js";
4
3
  import { useToaster as D } from "./useToaster.js";
5
- const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
4
+ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
6
5
  const f = setTimeout(
7
6
  () => p(new Error(`${n} did not report completion within ${l}ms`)),
8
7
  l
@@ -14,8 +13,8 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
14
13
  } catch (t) {
15
14
  d(t);
16
15
  }
17
- }), _ = () => {
18
- const { handleError: n } = D(), l = (t = {}) => m(
16
+ }), P = () => {
17
+ const { handleError: n } = D(), l = (t = {}) => r(
19
18
  "compileEmail",
20
19
  T,
21
20
  (e, i) => {
@@ -39,38 +38,38 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
39
38
  resetDataSavedFlag: !1,
40
39
  disableLineHeightsReplace: !0
41
40
  }, ...t }, u = {
42
- callback: (s, g, w, S, y) => {
43
- s ? i(s) : e({
41
+ callback: (m, g, w, S, v) => {
42
+ m ? i(m) : e({
44
43
  html: g,
45
44
  ampHtml: w,
46
- ampErrors: v(S ?? []),
47
- displayConditions: y
45
+ ampErrors: y(S ?? []),
46
+ displayConditions: v
48
47
  });
49
48
  },
50
49
  ...o
51
50
  };
52
- r().actionsApi.compileEmail(u);
51
+ s().actionsApi.compileEmail(u);
53
52
  }
54
53
  );
55
54
  return {
56
55
  getCompiledEmail: l,
57
- getTemplateData: () => m(
56
+ getTemplateData: () => r(
58
57
  "getTemplateData",
59
58
  T,
60
59
  (t) => {
61
- const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: s }) => t({
62
- html: h(i),
60
+ const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
61
+ html: i,
63
62
  css: a,
64
63
  width: o,
65
64
  height: E,
66
65
  utmParams: u,
67
- syncModulesIds: s
66
+ syncModulesIds: m
68
67
  });
69
- r().actionsApi.getTemplateData(e);
68
+ s().actionsApi.getTemplateData(e);
70
69
  }
71
70
  ),
72
71
  activateCustomViewStyles: (t = !0) => {
73
- r().actionsApi.activateCustomViewStyles(t);
72
+ s().actionsApi.activateCustomViewStyles(t);
74
73
  },
75
74
  getPreviewData: async (t) => {
76
75
  try {
@@ -110,16 +109,16 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
110
109
  }
111
110
  }),
112
111
  updateHtmlAndCss: (t, e) => {
113
- const { actionsApi: i } = r();
114
- return m("updateHtmlAndCss", H, (a) => {
112
+ const { actionsApi: i } = s();
113
+ return r("updateHtmlAndCss", h, (a) => {
115
114
  i.updateHtmlAndCss(t, e, () => a());
116
115
  });
117
116
  },
118
- editorSave: () => m(
117
+ editorSave: () => r(
119
118
  "save",
120
119
  T,
121
120
  (t) => {
122
- r().actionsApi.save((e) => {
121
+ s().actionsApi.save((e) => {
123
122
  if (e) {
124
123
  n(e, "Failed to save template"), t(!1);
125
124
  return;
@@ -131,5 +130,5 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
131
130
  };
132
131
  };
133
132
  export {
134
- _ as useActionsApi
133
+ P as useActionsApi
135
134
  };
@@ -1,15 +1,14 @@
1
- import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
2
- const l = () => ({ injectFullStory: () => {
3
- var c;
4
- const n = window;
5
- if (typeof n._fs_org != "string" || !n._fs_org)
1
+ const c = "https://email-static.useinsider.com/guido/guido-fs.js", u = () => ({ injectFullStory: () => {
2
+ var n;
3
+ const s = window;
4
+ if (typeof s._fs_org != "string" || !s._fs_org)
6
5
  return;
7
- const e = document.querySelector("ui-editor"), o = (c = e == null ? void 0 : e.shadowRoot) == null ? void 0 : c.querySelector("iframe"), r = o == null ? void 0 : o.contentDocument;
8
- if (!r || r.querySelector('script[data-fullstory-bridge="true"]'))
6
+ const r = document.querySelector("ui-editor"), o = (n = r == null ? void 0 : r.shadowRoot) == null ? void 0 : n.querySelector("iframe"), e = o == null ? void 0 : o.contentDocument;
7
+ if (!e || e.querySelector('script[data-fullstory-bridge="true"]'))
9
8
  return;
10
- const t = r.createElement("script");
11
- t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
9
+ const t = e.createElement("script");
10
+ t.src = c, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", e.head.appendChild(t);
12
11
  } });
13
12
  export {
14
- l as useFullStoryBridge
13
+ u as useFullStoryBridge
15
14
  };
@@ -1,4 +1,4 @@
1
- import { useConfig as g } from "../../../composables/useConfig.js";
1
+ import { useConfig as C } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as O } from "../../../composables/useRecommendation.js";
3
3
  import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as B } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
4
  import { useRecommendationExtensionStore as N } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
@@ -13,7 +13,7 @@ function A(t) {
13
13
  [r] = r.children;
14
14
  return r;
15
15
  }
16
- function y(t, r, e, o, c, i) {
16
+ function _(t, r, e, o, c, i) {
17
17
  switch (r) {
18
18
  case "productImage": {
19
19
  const n = t.querySelector("img");
@@ -78,7 +78,7 @@ function y(t, r, e, o, c, i) {
78
78
  }
79
79
  }
80
80
  const P = "name";
81
- function b(t, r, e, o) {
81
+ function y(t, r, e, o) {
82
82
  const c = `${o}${r}_${e}_${P}`;
83
83
  return {
84
84
  open: t.createComment(`{% if ${c} and ${c} != "" %}`),
@@ -86,19 +86,19 @@ function b(t, r, e, o) {
86
86
  };
87
87
  }
88
88
  function R(t, r, e) {
89
- return b(t, r, 0, e);
89
+ return y(t, r, 0, e);
90
90
  }
91
91
  function w(t, r, e, o) {
92
92
  if (!t.innerHTML.includes("{{"))
93
93
  return;
94
- const { open: c, close: i } = b(t.ownerDocument, r, e, o);
94
+ const { open: c, close: i } = y(t.ownerDocument, r, e, o);
95
95
  t.insertBefore(c, t.firstChild), t.appendChild(i);
96
96
  }
97
97
  function D(t, r, e, o) {
98
98
  var n, s;
99
99
  if (!t.innerHTML.includes("{{"))
100
100
  return;
101
- const { open: c, close: i } = b(t.ownerDocument, r, e, o);
101
+ const { open: c, close: i } = y(t.ownerDocument, r, e, o);
102
102
  (n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
103
103
  }
104
104
  function v(t, r, e, o) {
@@ -106,8 +106,8 @@ function v(t, r, e, o) {
106
106
  i.querySelectorAll("[data-attribute-type]").forEach((d) => {
107
107
  const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
108
108
  a.length > 0 ? a.forEach((l) => {
109
- y(l, u, r, n, e, o);
110
- }) : y(d, u, r, n, e, o);
109
+ _(l, u, r, n, e, o);
110
+ }) : _(d, u, r, n, e, o);
111
111
  }), D(i, r, n, o);
112
112
  });
113
113
  }
@@ -119,9 +119,9 @@ function H(t, r, e, o) {
119
119
  c.forEach((d, u) => {
120
120
  d.querySelectorAll("[data-attribute-type]").forEach((l) => {
121
121
  const p = l.getAttribute("data-attribute-type") || "";
122
- l.querySelectorAll(".attribute-cell").forEach((f, h) => {
122
+ l.querySelectorAll(".attribute-cell").forEach((m, h) => {
123
123
  const S = u * s + h;
124
- y(f, p, r, S, e, o), w(f, r, S, o);
124
+ _(m, p, r, S, e, o), w(m, r, S, o);
125
125
  });
126
126
  });
127
127
  });
@@ -132,10 +132,10 @@ function W(t, r, e, o) {
132
132
  });
133
133
  }
134
134
  function F(t, r, e) {
135
- const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment") || "after";
136
- o === "list" ? v(t, r, c, e) : W(t, r, c, e);
135
+ const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
136
+ o === "list" ? v(t, r, i, e) : W(t, r, i, e);
137
137
  }
138
- function _(t, r, e) {
138
+ function b(t, r, e) {
139
139
  const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
140
140
  return c ? parseInt(c[1]) : e;
141
141
  }
@@ -143,7 +143,7 @@ function $(t) {
143
143
  const r = t.trim();
144
144
  return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
145
145
  }
146
- function C(t) {
146
+ function g(t) {
147
147
  const r = t.getAttribute("width");
148
148
  if (r && $(r))
149
149
  return r.trim();
@@ -153,28 +153,28 @@ function C(t) {
153
153
  function x(t, r) {
154
154
  let e = t.parentElement;
155
155
  for (; e && e !== r; ) {
156
- if (e.tagName === "TD" && C(e))
156
+ if (e.tagName === "TD" && g(e))
157
157
  return e;
158
158
  e = e.parentElement;
159
159
  }
160
160
  return null;
161
161
  }
162
162
  function G(t) {
163
- const r = t.getAttribute("style") || "", e = _(r, "width", 600), o = _(r, "padding", 0) * 2, c = Math.max(0, e - o);
163
+ const r = t.getAttribute("style") || "", e = b(r, "width", 600), o = b(r, "padding", 0) * 2, c = Math.max(0, e - o);
164
164
  c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
165
165
  if (i.hasAttribute("width"))
166
166
  return;
167
167
  const n = x(i, t);
168
168
  if (!n)
169
169
  return;
170
- const s = C(n), d = _(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
170
+ const s = g(n), d = b(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
171
171
  if (p) {
172
172
  i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
173
173
  return;
174
174
  }
175
175
  if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
176
- const m = l && !l.trim().endsWith(";") ? "; " : "";
177
- i.setAttribute("style", `${l}${m}width: ${a}px`);
176
+ const f = l && !l.trim().endsWith(";") ? "; " : "";
177
+ i.setAttribute("style", `${l}${f}width: ${a}px`);
178
178
  }
179
179
  });
180
180
  }
@@ -200,15 +200,15 @@ function Q(t) {
200
200
  return t;
201
201
  const { buildCampaignUrl: c } = O(), i = N();
202
202
  i.recommendationCampaignUrls = {};
203
- const { isFeatureEnabled: n } = g(), s = n("liquidSyntax") ? "reco_" : "";
203
+ const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
204
204
  return o.forEach((u) => {
205
- var l, p, m, f;
205
+ var l, p, f, m;
206
206
  const a = u.getAttribute("recommendation-id");
207
207
  if (a) {
208
208
  if ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(a), U(u, e), !T(u)) {
209
209
  F(u, a, s);
210
210
  const { open: h, close: S } = R(e, a, s);
211
- (m = u.parentNode) == null || m.insertBefore(h, u), (f = u.parentNode) == null || f.insertBefore(S, u.nextSibling);
211
+ (f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
212
212
  }
213
213
  G(u);
214
214
  }
@@ -1,17 +1,16 @@
1
1
  import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
- import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
- import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
6
- import { migrateRadioButton as g } from "./radioButtonMigrator.js";
7
- import { migrateRecommendation as p } from "./recommendationMigrator.js";
3
+ import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
4
+ import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
5
+ import { migrateRadioButton as c } from "./radioButtonMigrator.js";
6
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
8
7
  import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
9
- import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
10
- import { migrateSocialIcons as s } from "./socialIconMigrator.js";
11
- import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
12
- const h = async (o, t = {}, r) => {
13
- let m = o;
14
- return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
8
+ import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
9
+ import { migrateSocialIcons as d } from "./socialIconMigrator.js";
10
+ import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
11
+ const h = async (r, t = {}, o) => {
12
+ let m = r;
13
+ return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
15
14
  };
16
15
  export {
17
16
  h as migrate
@@ -1,101 +1,108 @@
1
- import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { ATTR_RECOMMENDATION_TITLE as l, ATTR_CUSTOM_PREFIX as k, ATTR_PRODUCT_BUTTON as A, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as h, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as O } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
- import { mapTextTheme as b, mapButtonTheme as y, mapImageTheme as N } from "./themeMapper.js";
4
- const C = "__title__", T = "product_attribute.";
5
- function P(r) {
6
- const t = r.variable ?? "";
7
- switch (t) {
1
+ import { DEFAULT_COMPOSITION as k, DEFAULT_VISIBILITY as f } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { ATTR_RECOMMENDATION_TITLE as R, ATTR_CUSTOM_PREFIX as x, ATTR_PRODUCT_BUTTON as E, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as O, ATTR_PRODUCT_OLD_PRICE as a, ATTR_PRODUCT_PRICE as d, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_IMAGE as b } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { mapTextTheme as C, mapButtonTheme as N, mapImageTheme as P } from "./themeMapper.js";
4
+ const U = "__title__", _ = "product_attribute.";
5
+ function D(n) {
6
+ const s = n.variable ?? "";
7
+ switch (s) {
8
8
  case "p_recommendation_title":
9
- return { key: C, kind: "title" };
9
+ return { key: U, kind: "title" };
10
10
  case "p_image":
11
- return { key: O, kind: "image" };
11
+ return { key: b, kind: "image" };
12
12
  case "p_name":
13
- return { key: E, kind: "text" };
13
+ return { key: y, kind: "text" };
14
14
  case "p_price":
15
- return { key: h, kind: "text" };
15
+ return { key: d, kind: "text" };
16
16
  case "p_original_price":
17
- return { key: f, kind: "text" };
17
+ return { key: a, kind: "text" };
18
18
  case "p_omnibus_price":
19
- return { key: x, kind: "text" };
19
+ return { key: O, kind: "text" };
20
20
  case "p_omnibus_discount":
21
- return { key: R, kind: "text" };
21
+ return { key: h, kind: "text" };
22
22
  case "p_button":
23
- return { key: A, kind: "button" };
23
+ return { key: E, kind: "button" };
24
24
  default:
25
- if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
- const o = r.value ?? "", s = o.startsWith(T) ? o.slice(T.length) : o;
27
- if (!s)
25
+ if (n.variableType === "p_attribute" || s.startsWith("p_attribute_")) {
26
+ const t = n.value ?? "", o = t.startsWith(_) ? t.slice(_.length) : t;
27
+ if (!o)
28
28
  return null;
29
- const e = o || `${T}${s}`;
29
+ const u = t || `${_}${o}`;
30
30
  return {
31
- key: `${k}${e}`,
31
+ key: `${x}${u}`,
32
32
  kind: "custom",
33
- customAttrName: s,
34
- customAttrValue: e
33
+ customAttrName: o,
34
+ customAttrValue: u
35
35
  };
36
36
  }
37
37
  return null;
38
38
  }
39
39
  }
40
- function _(r) {
41
- const t = p.indexOf(r);
42
- return t === -1 ? Number.POSITIVE_INFINITY : t;
40
+ function I(n) {
41
+ const s = k.indexOf(n);
42
+ return s === -1 ? Number.POSITIVE_INFINITY : s;
43
+ }
44
+ const l = [d, a];
45
+ function S(n, s, t) {
46
+ return n === s || !l.includes(n) || !l.includes(s) ? 0 : n === (t ? a : d) ? -1 : 1;
43
47
  }
44
- function V(r) {
48
+ function F(n, { oldPriceFirst: s = !1 } = {}) {
45
49
  const t = {
46
50
  composition: [],
47
- visibility: { ...I },
51
+ visibility: { ...f },
48
52
  customAttributes: [],
49
53
  customAttrValues: {},
50
54
  perElementStyles: {},
51
55
  anyTextTrimming: !1
52
56
  };
53
- if (!r || r.length === 0)
54
- return t.composition = [...p], t;
57
+ if (!n || n.length === 0)
58
+ return t.composition = [...k], t;
55
59
  const o = [];
56
- r.forEach((e, i) => {
57
- const n = P(e);
58
- if (n) {
59
- if (n.kind === "title") {
60
- t.titleVariable = e, t.visibility[l] = e.hidden !== !0;
60
+ n.forEach((e, i) => {
61
+ const r = D(e);
62
+ if (r) {
63
+ if (r.kind === "title") {
64
+ t.titleVariable = e, t.visibility[R] = e.hidden !== !0;
61
65
  return;
62
66
  }
63
67
  o.push({
64
- key: n.key,
65
- kind: n.kind,
68
+ key: r.key,
69
+ kind: r.kind,
66
70
  hidden: e.hidden === !0,
67
71
  positionIdx: typeof e.positionIdx == "number" ? e.positionIdx : Number.MAX_SAFE_INTEGER,
68
72
  legacy: e,
69
- customAttrName: n.customAttrName,
70
- customAttrValue: n.customAttrValue,
73
+ customAttrName: r.customAttrName,
74
+ customAttrValue: r.customAttrValue,
71
75
  originalIndex: i
72
76
  });
73
77
  }
74
78
  }), o.sort((e, i) => {
75
79
  if (e.positionIdx !== i.positionIdx)
76
80
  return e.positionIdx - i.positionIdx;
77
- const n = _(e.key), u = _(i.key);
78
- return n !== u ? n - u : e.originalIndex - i.originalIndex;
81
+ const r = S(e.key, i.key, s);
82
+ if (r !== 0)
83
+ return r;
84
+ const m = I(e.key), c = I(i.key);
85
+ return m !== c ? m - c : e.originalIndex - i.originalIndex;
79
86
  });
80
- const s = {};
87
+ const u = {};
81
88
  return o.forEach((e) => {
82
- const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
83
- switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
89
+ const { key: i, kind: r, hidden: m, legacy: c, customAttrName: A, customAttrValue: T } = e;
90
+ switch (t.composition.push(i), t.visibility[i] = !m, r === "custom" && A && T && (t.customAttributes.includes(T) || t.customAttributes.push(T), t.customAttrValues[i] = T), r) {
84
91
  case "image":
85
- s[i] = N(c.theme);
92
+ u[i] = P(c.theme);
86
93
  break;
87
94
  case "button":
88
- s[i] = y(c.theme);
95
+ u[i] = N(c.theme);
89
96
  break;
90
97
  case "text":
91
98
  case "custom": {
92
- const a = b(c.theme);
93
- s[i] = a, a.textTrimming && (t.anyTextTrimming = !0);
99
+ const p = C(c.theme);
100
+ u[i] = p, p.textTrimming && (t.anyTextTrimming = !0);
94
101
  break;
95
102
  }
96
103
  }
97
- }), t.perElementStyles = s, t;
104
+ }), t.perElementStyles = u, t;
98
105
  }
99
106
  export {
100
- V as mapComposition
107
+ F as mapComposition
101
108
  };
@@ -1,54 +1,93 @@
1
- import { CURRENCY_ATTR as n, CSS_CLASS_SKIP_COMPILE as c } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- const a = "You May Also Like!";
3
- function A(t) {
4
- var i;
1
+ import { CURRENCY_ATTR as c, CSS_CLASS_SKIP_COMPILE as a } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ const m = "You May Also Like!";
3
+ function S(t) {
4
+ var o;
5
5
  const e = t.querySelector(".ext-recommendation-title");
6
6
  if (!e)
7
- return a;
8
- const r = (i = e.textContent) == null ? void 0 : i.trim();
9
- return r && r.length > 0 ? r : a;
7
+ return m;
8
+ const r = (o = e.textContent) == null ? void 0 : o.trim();
9
+ return r && r.length > 0 ? r : m;
10
10
  }
11
- function m(t) {
11
+ function T(t) {
12
12
  const e = t.querySelector(".ext-recommendation-title");
13
13
  return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
14
14
  }
15
- function d(t) {
15
+ function f(t) {
16
+ var r;
17
+ const e = t.querySelector(".ext-recommendation-title");
18
+ return !!e && !((r = e == null ? void 0 : e.textContent) != null && r.trim());
19
+ }
20
+ function g(t) {
21
+ const e = t.querySelector(".ext-product-price"), r = t.querySelector(".ext-product-original-price");
22
+ return !e || !r ? !1 : e.compareDocumentPosition(r) === Node.DOCUMENT_POSITION_PRECEDING;
23
+ }
24
+ const d = /* @__PURE__ */ new Map([
25
+ ["p_name", ".ext-product-name p"],
26
+ ["p_price", ".ext-product-price p"],
27
+ ["p_original_price", ".ext-product-original-price p"]
28
+ ]);
29
+ function p(t) {
30
+ const e = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
31
+ return (e == null ? void 0 : e[1].trim()) || void 0;
32
+ }
33
+ const A = "ins-trim-text";
34
+ function x(t, e) {
35
+ return t == null ? void 0 : t.map((r) => {
36
+ var s, l;
37
+ const o = d.get(r.variable ?? "");
38
+ if (!o)
39
+ return r;
40
+ const n = e.querySelector(o), u = (l = (s = r.theme) == null ? void 0 : s.textColor) != null && l.color ? void 0 : p(n), i = r.variable === "p_name" && (n == null ? void 0 : n.classList.contains(A));
41
+ return !u && !i ? r : {
42
+ ...r,
43
+ theme: {
44
+ ...r.theme,
45
+ ...u ? { textColor: { color: u } } : {},
46
+ ...i ? { textTrimming: !0 } : {}
47
+ }
48
+ };
49
+ });
50
+ }
51
+ function E(t) {
16
52
  const e = [
17
53
  t,
18
54
  ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
19
55
  ];
20
56
  let r = "";
21
- return e.some((i) => {
22
- const o = i.getAttribute("bgcolor");
23
- if (o && o.trim())
24
- return r = o.trim(), !0;
25
- const u = (i.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
26
- return u && u[1] ? (r = u[1].trim(), !0) : !1;
57
+ return e.some((o) => {
58
+ const n = o.getAttribute("bgcolor");
59
+ if (n && n.trim())
60
+ return r = n.trim(), !0;
61
+ const i = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
62
+ return i && i[1] ? (r = i[1].trim(), !0) : !1;
27
63
  }), r;
28
64
  }
29
- function C(t) {
30
- const e = t.getAttribute(n.CURRENCY);
65
+ function _(t) {
66
+ const e = t.getAttribute(c.CURRENCY);
31
67
  if (!e)
32
68
  return;
33
- const r = t.getAttribute(n.SYMBOL);
69
+ const r = t.getAttribute(c.SYMBOL);
34
70
  return {
35
71
  value: e,
36
72
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
37
73
  // the currency code as the symbol.
38
74
  ...r ? { symbol: r } : {},
39
- alignment: t.getAttribute(n.ALIGNMENT) ?? "",
40
- decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
41
- decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
42
- thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
75
+ alignment: t.getAttribute(c.ALIGNMENT) ?? "",
76
+ decimalCount: t.getAttribute(c.DECIMAL_COUNT) ?? "",
77
+ decimalSeparator: t.getAttribute(c.DECIMAL_SEPARATOR) ?? "",
78
+ thousandSeparator: t.getAttribute(c.THOUSAND_SEPARATOR) ?? ""
43
79
  };
44
80
  }
45
- function g(t) {
46
- return t.classList.contains(c);
81
+ function y(t) {
82
+ return t.classList.contains(a);
47
83
  }
48
84
  export {
49
- d as extractCardBgColor,
50
- C as extractCurrencyFromBlock,
51
- A as extractTitleText,
52
- m as hasVisibleTitle,
53
- g as isPartnerManagedBlock
85
+ E as extractCardBgColor,
86
+ _ as extractCurrencyFromBlock,
87
+ S as extractTitleText,
88
+ f as hasEmptyTitle,
89
+ T as hasVisibleTitle,
90
+ g as isOldPriceFirst,
91
+ y as isPartnerManagedBlock,
92
+ x as withRenderedTextTheme
54
93
  };