@useinsider/guido 3.10.0-beta.f7505c1 → 3.10.0-beta.f8b4dbb

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,16 +1,16 @@
1
- var E = Object.defineProperty;
2
- var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as l } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
6
- import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-checkbox", u = "select", { get: C } = l();
8
- class I extends p {
1
+ var p = Object.defineProperty;
2
+ var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as h } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as T, PIXEL_TRACKING_SEND_GRID_ID as C, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as I } from "../../../enums/unsubscribe.js";
6
+ import { Control as m, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-checkbox", E = "select", { get: _ } = h();
8
+ class G extends m {
9
9
  constructor() {
10
10
  super(...arguments);
11
- o(this, "currentNode");
12
- o(this, "selectedUnsubGroup");
13
- o(this, "unsubList", []);
11
+ a(this, "currentNode");
12
+ a(this, "selectedUnsubGroup");
13
+ a(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
@@ -19,12 +19,12 @@ class I extends p {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === h ? e : Number(e);
22
+ const s = I.includes(e) ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
27
+ [E]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
30
  _getLabel(e, s = `${Math.random()}`) {
@@ -46,17 +46,19 @@ class I extends p {
46
46
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
+ const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
49
50
  return `
50
51
  <div class="checkbox-controls-container">
51
- <div class="checkbox-select-container container two-columns stretch">
52
+ <div class="checkbox-select-container container one-column stretch">
52
53
  <${r.LABEL}
53
- ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
+ ${t.LABEL.text}="${e}"
54
55
  ${t.LABEL.name}="${Math.random()}">
55
56
  </${r.LABEL}>
56
57
 
57
58
  <${r.SELECTPICKER}
58
- ${t.SELECTPICKER.name}="${u}"
59
- ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
59
+ ${t.SELECTPICKER.name}="${E}"
60
+ ${t.SELECTPICKER.searchable}="true"
61
+ ${t.SELECTPICKER.placeholder}="${s}">
60
62
  ${this._getSelect()}
61
63
  </${r.SELECTPICKER}>
62
64
  </div>
@@ -64,30 +66,42 @@ class I extends p {
64
66
  `;
65
67
  }
66
68
  _onSelectChange(e) {
67
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new m(`Updated text to ${e}`));
69
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
68
70
  }
69
71
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (e) => this._onSelectChange(e));
72
+ this.api.onValueChanged(E, (e) => this._onSelectChange(e));
71
73
  }
72
74
  onTemplateNodeUpdated(e) {
73
75
  this.currentNode = e, this._setFormValues();
74
76
  }
75
77
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
78
  async onRender() {
77
- const e = await C(
79
+ const e = await _(
78
80
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [L(), ...e.data], c = s.map((a) => ({
80
- [t.SELECT_ITEM.text]: a.name,
81
- [t.SELECT_ITEM.value]: a.sendGridId
82
- }));
83
- this.unsubList = s, this.api.setUIEAttribute(
84
- u,
81
+ ), s = {
82
+ name: this.api.translate("Pixel Tracking Opt-in"),
83
+ sendGridId: C
84
+ }, c = [T(), ...e.data], u = (o) => ({
85
+ [t.SELECT_ITEM.text]: o.name,
86
+ [t.SELECT_ITEM.value]: o.sendGridId
87
+ }), l = (o) => ({
88
+ [t.SELECT_ITEM.text]: o,
89
+ [t.SELECT_ITEM.value]: `header:${o}`,
90
+ [t.SELECT_ITEM.disabled]: !0
91
+ }), d = [
92
+ l(this.api.translate("OPT-IN SELECTION")),
93
+ u(s),
94
+ l(this.api.translate("UNSUBSCRIBE GROUPS")),
95
+ ...c.map(u)
96
+ ];
97
+ this.unsubList = [s, ...c], this.api.setUIEAttribute(
98
+ E,
85
99
  t.SELECTPICKER.items,
86
- c
100
+ d
87
101
  ), this._setFormValues(), this._listenToFormUpdates();
88
102
  }
89
103
  }
90
104
  export {
91
105
  b as CHECKBOX_CONTROL_BLOCK_ID,
92
- I as CheckboxControl
106
+ G as CheckboxControl
93
107
  };
@@ -53,7 +53,7 @@ class P extends E {
53
53
  if (!m)
54
54
  return;
55
55
  const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
- i.modifyHtml(m).setInnerHtml(b);
56
+ i.modifyHtml(m).setInnerHtml(b).setAttribute("data-currency_symbol", n);
57
57
  }), i.apply(new B(
58
58
  `Updated currency symbol to ${n || "removed"}`
59
59
  ));
@@ -1,7 +1,7 @@
1
- import { Block as t, BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { getDefaultTemplate as e } from "./template.js";
1
+ import { Block as t, BlockCompositionType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "radio-button-block";
4
- class l extends t {
4
+ class i extends t {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -12,16 +12,18 @@ class l extends t {
12
12
  return "radio-button-icon";
13
13
  }
14
14
  getBlockCompositionType() {
15
- return o.CONTAINER;
15
+ return e.CONTAINER;
16
16
  }
17
17
  getName() {
18
18
  return this.api.translate("Radio Button Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate("Radio Button Block Description");
21
+ return this.api.translate(
22
+ "Radio button lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
+ );
22
24
  }
23
25
  getTemplate() {
24
- return e();
26
+ return o();
25
27
  }
26
28
  allowInnerBlocksDND() {
27
29
  return !1;
@@ -29,5 +31,5 @@ class l extends t {
29
31
  }
30
32
  export {
31
33
  r as BLOCK_ID,
32
- l as RadioButtonCustomBlock
34
+ i as RadioButtonCustomBlock
33
35
  };
@@ -1,93 +1,107 @@
1
- var E = Object.defineProperty;
2
- var d = (r, n, t) => n in r ? E(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
- var o = (r, n, t) => d(r, typeof n != "symbol" ? n + "" : n, t);
4
- import { useHttp as l } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as p } from "../../../enums/unsubscribe.js";
6
- import { Control as h, UIElementType as i, UEAttr as e, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-radio-button", u = "select", { get: $ } = l();
8
- class I extends h {
1
+ var p = Object.defineProperty;
2
+ var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as T } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as h, PIXEL_TRACKING_SEND_GRID_ID as I, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as m } from "../../../enums/unsubscribe.js";
6
+ import { Control as C, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-radio-button", E = "select", { get: _ } = T();
8
+ class G extends C {
9
9
  constructor() {
10
10
  super(...arguments);
11
- o(this, "currentNode");
12
- o(this, "selectedUnsubGroup");
13
- o(this, "unsubList", []);
11
+ a(this, "currentNode");
12
+ a(this, "selectedUnsubGroup");
13
+ a(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
17
17
  }
18
18
  _setFormValues() {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
- const t = this.currentNode.getAttribute("id");
21
- if (t) {
22
- const s = t === p ? t : Number(t);
20
+ const e = this.currentNode.getAttribute("id");
21
+ if (e) {
22
+ const s = m.includes(e) ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
27
+ [E]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
- _getLabel(t, s = `${Math.random()}`) {
30
+ _getLabel(e, s = `${Math.random()}`) {
31
31
  return `
32
- <${i.LABEL}
33
- ${e.LABEL.text}="${t}"
34
- ${e.LABEL.name}="${s}">
35
- </${i.LABEL}>
32
+ <${r.LABEL}
33
+ ${t.LABEL.text}="${e}"
34
+ ${t.LABEL.name}="${s}">
35
+ </${r.LABEL}>
36
36
  `;
37
37
  }
38
- _getSelectItem(t, s) {
38
+ _getSelectItem(e, s) {
39
39
  return `
40
- <${i.SELECT_ITEM}
41
- ${e.SELECT_ITEM.text}="${t}"
42
- ${e.SELECT_ITEM.value}="${s}">
43
- </${i.SELECT_ITEM}>`;
40
+ <${r.SELECT_ITEM}
41
+ ${t.SELECT_ITEM.text}="${e}"
42
+ ${t.SELECT_ITEM.value}="${s}">
43
+ </${r.SELECT_ITEM}>`;
44
44
  }
45
45
  _getSelect() {
46
- return this.unsubList.map((t) => this._getSelectItem(t.name, t.sendGridId)).join("");
46
+ return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
+ const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
49
50
  return `
50
51
  <div class="checkbox-controls-container">
51
- <div class="checkbox-select-container container two-columns stretch">
52
- <${i.LABEL}
53
- ${e.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
- ${e.LABEL.name}="${Math.random()}">
55
- </${i.LABEL}>
52
+ <div class="checkbox-select-container container one-column stretch">
53
+ <${r.LABEL}
54
+ ${t.LABEL.text}="${e}"
55
+ ${t.LABEL.name}="${Math.random()}">
56
+ </${r.LABEL}>
56
57
 
57
- <${i.SELECTPICKER}
58
- ${e.SELECTPICKER.name}="${u}"
59
- ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
58
+ <${r.SELECTPICKER}
59
+ ${t.SELECTPICKER.name}="${E}"
60
+ ${t.SELECTPICKER.searchable}="true"
61
+ ${t.SELECTPICKER.placeholder}="${s}">
60
62
  ${this._getSelect()}
61
- </${i.SELECTPICKER}>
63
+ </${r.SELECTPICKER}>
62
64
  </div>
63
65
  </div>
64
66
  `;
65
67
  }
66
- _onSelectChange(t) {
67
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new m(`Updated text to ${t}`));
68
+ _onSelectChange(e) {
69
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
68
70
  }
69
71
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (t) => this._onSelectChange(t));
72
+ this.api.onValueChanged(E, (e) => this._onSelectChange(e));
71
73
  }
72
- onTemplateNodeUpdated(t) {
73
- this.currentNode = t, this._setFormValues();
74
+ onTemplateNodeUpdated(e) {
75
+ this.currentNode = e, this._setFormValues();
74
76
  }
75
77
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
78
  async onRender() {
77
- const t = await $(
79
+ const e = await _(
78
80
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [L(), ...t.data], c = s.map((a) => ({
80
- [e.SELECT_ITEM.text]: a.name,
81
- [e.SELECT_ITEM.value]: a.sendGridId
82
- }));
83
- this.unsubList = s, this.api.setUIEAttribute(
84
- u,
85
- e.SELECTPICKER.items,
86
- c
81
+ ), s = {
82
+ name: this.api.translate("Pixel Tracking Opt-in"),
83
+ sendGridId: I
84
+ }, u = [h(), ...e.data], c = (o) => ({
85
+ [t.SELECT_ITEM.text]: o.name,
86
+ [t.SELECT_ITEM.value]: o.sendGridId
87
+ }), d = (o) => ({
88
+ [t.SELECT_ITEM.text]: o,
89
+ [t.SELECT_ITEM.value]: `header:${o}`,
90
+ [t.SELECT_ITEM.disabled]: !0
91
+ }), l = [
92
+ d(this.api.translate("OPT-IN SELECTION")),
93
+ c(s),
94
+ d(this.api.translate("UNSUBSCRIBE GROUPS")),
95
+ ...u.map(c)
96
+ ];
97
+ this.unsubList = [s, ...u], this.api.setUIEAttribute(
98
+ E,
99
+ t.SELECTPICKER.items,
100
+ l
87
101
  ), this._setFormValues(), this._listenToFormUpdates();
88
102
  }
89
103
  }
90
104
  export {
91
105
  b as CONTROL_BLOCK_ID,
92
- I as RadioButtonControl
106
+ G as RadioButtonControl
93
107
  };
@@ -1,9 +1,9 @@
1
1
  import { RecommendationBlockId as c } from "../constants/blockIds.js";
2
- import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as E, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as x, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
2
+ import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
3
3
  import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
4
- import { toCustomCompositionKey as U } from "../templates/utils.js";
5
- import { extractWrapperTags as C } from "./preserveTextStyles.js";
6
- import { hasQuerySelectorAll as A, hasGetAttribute as l, hasGetStyle as R, hasGetComputedStyle as q } from "./tagName.js";
4
+ import { toCustomCompositionKey as v } from "../templates/utils.js";
5
+ import { extractWrapperTags as R } from "./preserveTextStyles.js";
6
+ import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as U } from "./tagName.js";
7
7
  const s = [
8
8
  "font-size",
9
9
  "font-family",
@@ -39,94 +39,94 @@ const s = [
39
39
  "border-radius",
40
40
  "margin"
41
41
  ], b = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
42
- { attrKey: k, blockId: c.NAME, kind: "text" },
43
- { attrKey: E, blockId: c.PRICE, kind: "text" },
44
- { attrKey: h, blockId: c.OLD_PRICE, kind: "text" },
45
- { attrKey: y, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
- { attrKey: m, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
42
+ { attrKey: E, blockId: c.NAME, kind: "text" },
43
+ { attrKey: p, blockId: c.PRICE, kind: "text" },
44
+ { attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
45
+ { attrKey: C, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
+ { attrKey: A, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
47
47
  { attrKey: P, blockId: c.BUTTON, kind: "button" },
48
- { attrKey: x, blockId: c.IMAGE, kind: "image" }
48
+ { attrKey: q, blockId: c.IMAGE, kind: "image" }
49
49
  ];
50
- function _(t) {
50
+ function O(t) {
51
51
  return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
52
52
  }
53
53
  function L(t) {
54
54
  return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
55
55
  }
56
56
  function a(t, e, r) {
57
- !e || !R(e) || r.forEach((n) => {
58
- const i = e.getStyle(n);
59
- i && i !== "inherit" && i !== "initial" && (t[n] = i);
57
+ !e || !I(e) || r.forEach((n) => {
58
+ const o = e.getStyle(n);
59
+ o && o !== "inherit" && o !== "initial" && (t[n] = o);
60
60
  });
61
61
  }
62
- function I(t) {
62
+ function h(t) {
63
63
  return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
64
64
  }
65
- function O(t) {
66
- if (!t || !R(t))
65
+ function k(t) {
66
+ if (!t || !I(t))
67
67
  return;
68
68
  const e = t.getStyle("background-color") || t.getStyle("background");
69
69
  return e && !b.has(e) ? e : void 0;
70
70
  }
71
71
  function g(t, e) {
72
72
  const r = {};
73
- return a(r, t, e), I(r);
73
+ return a(r, t, e), h(r);
74
74
  }
75
75
  function w(t) {
76
76
  const e = t.querySelector("p"), r = {};
77
77
  a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
78
- const n = I(r), { openTags: i, closeTags: o } = C(_(e));
79
- return !n && !i ? null : { pStyle: n || void 0, openTags: i, closeTags: o };
78
+ const n = h(r), { openTags: o, closeTags: i } = R(O(e));
79
+ return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
80
80
  }
81
- function K(t) {
82
- const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), i = g(r, M), o = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(o), { openTags: T, closeTags: d } = C(_(r)), p = L(r);
83
- return !n && !i && !u && !T && !p ? null : {
81
+ function $(t) {
82
+ const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), o = g(r, M), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = R(O(r)), m = L(r);
83
+ return !n && !o && !u && !T && !m ? null : {
84
84
  buttonBorderStyle: n || void 0,
85
- buttonAnchorStyle: i || void 0,
85
+ buttonAnchorStyle: o || void 0,
86
86
  buttonFitToContainer: u || void 0,
87
- buttonText: p || void 0,
87
+ buttonText: m || void 0,
88
88
  openTags: T,
89
89
  closeTags: d
90
90
  };
91
91
  }
92
- function H(t) {
92
+ function K(t) {
93
93
  const e = g(t.querySelector("img"), D);
94
94
  return e ? { imgStyle: e } : null;
95
95
  }
96
- function $(t, e) {
97
- return e === "button" ? K(t) : e === "image" ? H(t) : w(t);
96
+ function H(t, e) {
97
+ return e === "button" ? $(t) : e === "image" ? K(t) : w(t);
98
98
  }
99
99
  function f(t, e) {
100
100
  if (!t || !("querySelector" in t))
101
101
  return;
102
102
  const r = t.querySelector(S) ?? t;
103
- if (G.forEach(({ attrKey: o, blockId: u, kind: T }) => {
103
+ if (G.forEach(({ attrKey: i, blockId: u, kind: T }) => {
104
104
  const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
105
- d && e(d, o, T);
106
- }), !A(r))
105
+ d && e(d, i, T);
106
+ }), !_(r))
107
107
  return;
108
108
  const n = /* @__PURE__ */ new Set();
109
109
  r.querySelectorAll(
110
110
  `[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
111
- ).forEach((o) => {
112
- const u = l(o) ? o.getAttribute(v) : null;
113
- !u || n.has(u) || (n.add(u), e(o, U(u), "text"));
111
+ ).forEach((i) => {
112
+ const u = l(i) ? i.getAttribute(x) : null;
113
+ !u || n.has(u) || (n.add(u), e(i, v(u), "text"));
114
114
  });
115
115
  }
116
116
  function F(t) {
117
117
  const e = {};
118
- return f(t, (r, n, i) => {
118
+ return f(t, (r, n, o) => {
119
119
  if (!("querySelector" in r))
120
120
  return;
121
- const o = $(r, i);
122
- o && (e[n] = o);
121
+ const i = H(r, o);
122
+ i && (e[n] = i);
123
123
  }), e;
124
124
  }
125
125
  function j(t) {
126
126
  if (!t || !("querySelector" in t))
127
127
  return;
128
128
  const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
129
- return O(r);
129
+ return k(r);
130
130
  }
131
131
  function X(t) {
132
132
  if (!t)
@@ -134,28 +134,28 @@ function X(t) {
134
134
  const e = l(t) ? t.getAttribute("bgcolor") : null;
135
135
  if (e && !b.has(e))
136
136
  return e;
137
- const r = O(t);
137
+ const r = k(t);
138
138
  if (r)
139
139
  return r;
140
- const n = q(t) ? t.getComputedStyle("background-color") : void 0;
140
+ const n = U(t) ? t.getComputedStyle("background-color") : void 0;
141
141
  return n && !b.has(n) ? n : void 0;
142
142
  }
143
143
  function z(t) {
144
144
  const e = {};
145
- return f(t, (r, n, i) => {
146
- if (i !== "text")
145
+ return f(t, (r, n, o) => {
146
+ if (o !== "text")
147
147
  return;
148
- const o = X(r);
149
- o && (e[n] = o);
148
+ const i = X(r);
149
+ i && (e[n] = i);
150
150
  }), e;
151
151
  }
152
152
  function Q(t) {
153
153
  const e = {};
154
- return f(t, (r, n, i) => {
155
- if (i === "image")
154
+ return f(t, (r, n, o) => {
155
+ if (o === "image")
156
156
  return;
157
- const o = l(r) ? r.getAttribute("align") : null;
158
- o && (e[n] = o);
157
+ const i = l(r) ? r.getAttribute("align") : null;
158
+ i && (e[n] = i);
159
159
  }), e;
160
160
  }
161
161
  const V = /^es-[pm]\d+[trbl]?$/;
@@ -167,44 +167,50 @@ function W(t) {
167
167
  return r.length ? r.join(" ") : void 0;
168
168
  }
169
169
  function Y(t) {
170
- const e = {};
171
- return f(t, (r, n, i) => {
172
- if (i === "image")
170
+ if (!t || !("querySelector" in t))
171
+ return !1;
172
+ const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
173
+ return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
174
+ }
175
+ function J(t) {
176
+ const e = {}, r = Y(t);
177
+ return f(t, (n, o, i) => {
178
+ if (i === "image" || r && (o === p || o === y))
173
179
  return;
174
- const o = W(r);
175
- o && (e[n] = o);
180
+ const u = W(n);
181
+ u && (e[o] = u);
176
182
  }), e;
177
183
  }
178
- function J(t) {
184
+ function Z(t) {
179
185
  const e = {};
180
186
  return f(t, (r, n) => {
181
- if (n !== y && n !== m || !l(r))
187
+ if (n !== C && n !== A || !l(r))
182
188
  return;
183
- const i = r.getAttribute("data-text-before"), o = r.getAttribute("data-text-after");
184
- (i != null || o != null) && (e[n] = { before: i ?? void 0, after: o ?? void 0 });
189
+ const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
190
+ (o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
185
191
  }), e;
186
192
  }
187
- function Z(t) {
193
+ function tt(t) {
188
194
  const e = {};
189
195
  if (!t || !("querySelector" in t))
190
196
  return e;
191
197
  const r = t.querySelector(S) ?? t;
192
- return A(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
198
+ return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
193
199
  if (!l(n))
194
200
  return;
195
- const i = n.getAttribute("data-attribute-type"), o = n.getAttribute("data-visibility");
196
- i && o != null && (e[i] = o !== "0");
201
+ const o = n.getAttribute("data-attribute-type"), i = n.getAttribute("data-visibility");
202
+ o && i != null && (e[o] = i !== "0");
197
203
  }), e;
198
204
  }
199
- function ut(t) {
205
+ function ct(t) {
200
206
  return {
201
207
  styleTemplates: F(t),
202
208
  cardBackgroundColor: j(t),
203
209
  cellBackgroundColors: z(t),
204
210
  cellAlignments: Q(t),
205
- cellClasses: Y(t),
206
- omnibusTexts: J(t),
207
- visibility: Z(t)
211
+ cellClasses: J(t),
212
+ omnibusTexts: Z(t),
213
+ visibility: tt(t)
208
214
  };
209
215
  }
210
216
  export {
@@ -212,8 +218,8 @@ export {
212
218
  j as captureCardBackgroundColor,
213
219
  Q as captureCellAlignments,
214
220
  z as captureCellBackgroundColors,
215
- Y as captureCellClasses,
216
- J as captureOmnibusTexts,
217
- ut as captureStyles,
218
- Z as captureVisibility
221
+ J as captureCellClasses,
222
+ Z as captureOmnibusTexts,
223
+ ct as captureStyles,
224
+ tt as captureVisibility
219
225
  };
@@ -1,4 +1,4 @@
1
- const u = [
1
+ const l = [
2
2
  {
3
3
  key: "locale",
4
4
  getValue: (e) => e.language,
@@ -7,27 +7,28 @@ const u = [
7
7
  {
8
8
  key: "currency",
9
9
  getValue: (e) => e.currencySettings.value,
10
- getAvailableOptions: (e) => e.currencyList.map((n) => n.text)
10
+ getAvailableOptions: (e) => e.currencyList.map((n) => n.text),
11
+ canBeEmpty: !0
11
12
  }
12
- ], s = "newsletter.recommendation-fill-required-fields";
13
- function l(e, n, o = u) {
14
- return o.filter((t) => {
15
- var a;
13
+ ], o = "newsletter.recommendation-fill-required-fields";
14
+ function c(e, n, i = l) {
15
+ return i.filter((t) => {
16
+ var u;
16
17
  if (t.condition && !t.condition(e))
17
18
  return !1;
18
- const i = t.getValue(e);
19
- if (!i)
20
- return !0;
21
- const r = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
22
- return r !== void 0 && !r.includes(i);
19
+ const r = (u = t.getAvailableOptions) == null ? void 0 : u.call(t, n);
20
+ if (t.canBeEmpty && (r == null ? void 0 : r.length) === 0)
21
+ return !1;
22
+ const a = t.getValue(e);
23
+ return a ? r !== void 0 && !r.includes(a) : !0;
23
24
  }).map((t) => t.key);
24
25
  }
25
- function c(e, n) {
26
- return l(e, n).length === 0;
26
+ function s(e, n) {
27
+ return c(e, n).length === 0;
27
28
  }
28
29
  export {
29
- u as REQUIRED_RECOMMENDATION_FIELDS,
30
- s as RecommendationRequiredFieldsKey,
31
- l as getInvalidFields,
32
- c as isConfigValid
30
+ l as REQUIRED_RECOMMENDATION_FIELDS,
31
+ o as RecommendationRequiredFieldsKey,
32
+ c as getInvalidFields,
33
+ s as isConfigValid
33
34
  };