@useinsider/guido 3.9.1-beta.5af6229 → 3.9.1-beta.6e7cd3e

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,52 +1,74 @@
1
- var h = Object.defineProperty;
2
- var x = (l, e, t) => e in l ? h(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var S = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
4
- import { MERGE_TAGS as k, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
5
- import { DATA_ATTRIBUTES as A } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { useUnsubscribeStore as T } from "../../stores/unsubscribe.js";
7
- class C {
1
+ var x = Object.defineProperty;
2
+ var B = (c, e, r) => e in c ? x(c, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : c[e] = r;
3
+ var A = (c, e, r) => B(c, typeof e != "symbol" ? e + "" : e, r);
4
+ import { MERGE_TAGS as f, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
5
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as h, DATA_ATTRIBUTES as k } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
7
+ class $ {
8
8
  constructor() {
9
- S(this, "parser");
9
+ A(this, "parser");
10
10
  this.parser = new DOMParser();
11
11
  }
12
12
  async migrate(e) {
13
13
  try {
14
- const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.unsubscribe-block");
15
- if (!i.length)
16
- return e;
17
- const o = T();
18
- return await o.fetchTemplates(), i.forEach((r) => {
19
- const c = r.getAttribute("id"), g = this.extractPaddingClass(r), u = r.getAttribute("bgcolor") || "", n = this.extractUnsubscribeContent(r), s = this.getCollectionTypeFromMergeTag(n.linkHref), b = o.getSelectedUnsubscribePagesByCollection(s);
20
- console.debug("[UnsubscribeMigrator]", {
21
- mergeTag: n.linkHref,
22
- collectionType: s,
23
- pageIds: b,
24
- paddingClass: g,
25
- bgColor: u
26
- });
27
- const f = this.buildUnsubscribeBlock(
28
- n,
29
- s,
30
- b,
31
- g,
32
- u
33
- ), a = this.parser.parseFromString(
34
- `<table id="tempDoc"><tbody><tr>${f}</tr></tbody></table>`,
35
- "text/html"
36
- ).querySelector(".unsubscribe-block-v2");
37
- a && r.parentNode && (a.setAttribute("id", c || ""), r.parentNode.replaceChild(a, r));
38
- }), t.documentElement.outerHTML;
39
- } catch (t) {
40
- return console.error("UnsubscribeMigrator failed:", t), e;
14
+ const r = this.parser.parseFromString(e, "text/html"), t = r.querySelectorAll("td.unsubscribe-block");
15
+ if (t.length) {
16
+ const s = C();
17
+ await s.fetchTemplates(), this.migrateLegacyBlocks(t, s);
18
+ }
19
+ const n = this.repairUnsubscribeLinks(r);
20
+ return !t.length && !n ? e : r.documentElement.outerHTML;
21
+ } catch (r) {
22
+ return console.error("UnsubscribeMigrator failed:", r), e;
41
23
  }
42
24
  }
25
+ migrateLegacyBlocks(e, r) {
26
+ e.forEach((t) => {
27
+ const n = t.getAttribute("id"), s = this.extractPaddingClass(t), l = t.getAttribute("bgcolor") || "", a = this.extractUnsubscribeContent(t), o = this.getCollectionTypeFromMergeTag(a.linkHref), b = r.getSelectedUnsubscribePagesByCollection(o);
28
+ console.debug("[UnsubscribeMigrator]", {
29
+ mergeTag: a.linkHref,
30
+ collectionType: o,
31
+ pageIds: b,
32
+ paddingClass: s,
33
+ bgColor: l
34
+ });
35
+ const u = this.buildUnsubscribeBlock(
36
+ a,
37
+ o,
38
+ b,
39
+ s,
40
+ l
41
+ ), i = this.parser.parseFromString(
42
+ `<table id="tempDoc"><tbody><tr>${u}</tr></tbody></table>`,
43
+ "text/html"
44
+ ).querySelector(h);
45
+ i && t.parentNode && (i.setAttribute("id", n || ""), t.parentNode.replaceChild(i, t));
46
+ });
47
+ }
48
+ // Re-derives the typed merge tag from data-unsubscribe-page-type for any v2
49
+ // block whose anchor href is missing or the legacy default. Returns true when
50
+ // at least one href was rewritten. Typed tags and custom URLs are left intact.
51
+ repairUnsubscribeLinks(e) {
52
+ const r = e.querySelectorAll(`${h}[${k.PAGE_TYPE}]`);
53
+ let t = !1;
54
+ return r.forEach((n) => {
55
+ const s = n.querySelector('a[data-unsubscribe-link="true"], a.unsubscribe-link');
56
+ if (!s)
57
+ return;
58
+ const l = s.getAttribute("href") || "";
59
+ if (l && l !== f.default)
60
+ return;
61
+ const a = Number(n.getAttribute(k.PAGE_TYPE)), o = f[a];
62
+ o && (s.setAttribute("href", o), t = !0);
63
+ }), t;
64
+ }
43
65
  extractPaddingClass(e) {
44
- const i = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
45
- return i ? i[0] : "";
66
+ const t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
67
+ return t ? t[0] : "";
46
68
  }
47
69
  extractUnsubscribeContent(e) {
48
- var m;
49
- const t = e.querySelector("p");
70
+ var d;
71
+ const r = e.querySelector("a.unsubscribe-link") || e.querySelector('a[href*="unsubscribe"]'), t = (r == null ? void 0 : r.closest("p")) || e.querySelector("p");
50
72
  if (!t)
51
73
  return {
52
74
  textBefore: "You can ",
@@ -59,7 +81,7 @@ class C {
59
81
  align: "center",
60
82
  paragraphStyle: ""
61
83
  };
62
- const i = e.getAttribute("align") || t.getAttribute("align") || "center", o = t.getAttribute("style") || "", r = t.querySelector("a.unsubscribe-link") || t.querySelector('a[href*="unsubscribe"]');
84
+ const n = e.getAttribute("align") || t.getAttribute("align") || "center", s = t.getAttribute("style") || "";
63
85
  if (!r)
64
86
  return {
65
87
  textBefore: "You can ",
@@ -69,55 +91,55 @@ class C {
69
91
  textAfter: " from our emails, if you need to.",
70
92
  isBold: !1,
71
93
  isItalic: !1,
72
- align: i,
73
- paragraphStyle: o
94
+ align: n,
95
+ paragraphStyle: s
74
96
  };
75
- const c = ((m = r.textContent) == null ? void 0 : m.trim()) || "unsubscribe", g = r.getAttribute("href") || "{{ins-unsubscribe-link}}", u = r.getAttribute("style") || "", n = t.textContent || "", s = n.indexOf(c), b = s >= 0 ? n.substring(0, s).trim() : "You can ", f = s >= 0 ? n.substring(s + c.length).trim() : " from our emails, if you need to.", d = !!t.querySelector("b, strong"), a = !!t.querySelector("i, em");
97
+ const l = ((d = r.textContent) == null ? void 0 : d.trim()) || "unsubscribe", a = r.getAttribute("href") || "{{ins-unsubscribe-link}}", o = r.getAttribute("style") || "", b = t.textContent || "", u = b.indexOf(l), g = u >= 0 ? b.substring(0, u).trim() : "You can ", i = u >= 0 ? b.substring(u + l.length).trim() : " from our emails, if you need to.", m = !!t.querySelector("b, strong"), y = !!t.querySelector("i, em");
76
98
  return {
77
- textBefore: b,
78
- linkText: c,
79
- linkHref: this.normalizeUnsubscribeHref(g),
80
- linkStyle: u,
81
- textAfter: f,
82
- isBold: d,
83
- isItalic: a,
84
- align: i,
85
- paragraphStyle: o
99
+ textBefore: g,
100
+ linkText: l,
101
+ linkHref: this.normalizeUnsubscribeHref(a),
102
+ linkStyle: o,
103
+ textAfter: i,
104
+ isBold: m,
105
+ isItalic: y,
106
+ align: n,
107
+ paragraphStyle: s
86
108
  };
87
109
  }
88
- buildUnsubscribeBlock(e, t, i, o, r) {
89
- const c = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${c}>${e.linkText}</a>`, n = [];
90
- e.textBefore && n.push(e.textBefore), n.push(u), e.textAfter && n.push(e.textAfter);
91
- let s = n.join(" ");
92
- e.isBold && e.isItalic ? s = `<strong path="1,0"><em path="1,0,0">${s}</em></strong>` : e.isBold ? s = `<strong path="1,0">${s}</strong>` : e.isItalic && (s = `<em path="1,0">${s}</em>`);
93
- const b = e.align ? ` align="${e.align}"` : "", f = r ? ` bgcolor="${r}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", a = i.length > 0 ? ` ${A.PAGE_LIST}="${i.join(",")}"` : "", m = ` ${A.PAGE_TYPE}="${t}"`, y = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
110
+ buildUnsubscribeBlock(e, r, t, n, s) {
111
+ const l = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${Object.values(f).includes(e.linkHref) ? f[r] : e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${l}>${e.linkText}</a>`, g = [];
112
+ e.textBefore && g.push(e.textBefore), g.push(u), e.textAfter && g.push(e.textAfter);
113
+ let i = g.join(" ");
114
+ e.isBold && e.isItalic ? i = `<strong path="1,0"><em path="1,0,0">${i}</em></strong>` : e.isBold ? i = `<strong path="1,0">${i}</strong>` : e.isItalic && (i = `<em path="1,0">${i}</em>`);
115
+ const m = e.align ? ` align="${e.align}"` : "", y = s ? ` bgcolor="${s}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", T = t.length > 0 ? ` ${k.PAGE_LIST}="${t.join(",")}"` : "", E = ` ${k.PAGE_TYPE}="${r}"`, S = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
94
116
  return `
95
117
  <td
96
118
  data-migration="true"
97
119
  esd-extension-block-id="unsubscribe-block"
98
- class="${o ? `${y} ${o}` : y}"
99
- ${b}${f}${m}${a}
120
+ class="${n ? `${S} ${n}` : S}"
121
+ ${m}${y}${E}${T}
100
122
  >
101
123
  <p path="1"${d}>
102
- ${s}
124
+ ${i}
103
125
  </p>
104
126
  </td>
105
127
  `;
106
128
  }
107
129
  getCollectionTypeFromMergeTag(e) {
108
- return e === k[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === k[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
130
+ return e === f[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === f[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
109
131
  }
110
132
  normalizeUnsubscribeHref(e) {
111
- if (Object.values(k).includes(e))
133
+ if (Object.values(f).includes(e))
112
134
  return e;
113
- const i = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
114
- return i ? i[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
135
+ const t = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
136
+ return t ? t[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
115
137
  `[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
116
138
  ), "{{ins-unsubscribe-link}}") : e;
117
139
  }
118
140
  }
119
- async function M(l) {
120
- return new C().migrate(l);
141
+ async function M(c) {
142
+ return new $().migrate(c);
121
143
  }
122
144
  export {
123
145
  M as migrateUnsubscribe
@@ -1,20 +1,20 @@
1
- import { BlockId as u } from "../../../enums/block.js";
1
+ import { BlockId as g } from "../../../enums/block.js";
2
2
  import { useOnboardingStore as p } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as I, BlockCompositionType as y, ModificationDescription as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as c, DefaultConfigValues as a } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as h } from "./template.js";
7
- import { getItemsBlockContainer as l, getItemsBlockConfig as m, getDefaultItemsBlockConfig as b } from "./utils/nodeConfigUtils.js";
8
- const d = u.Items;
9
- class E extends I {
3
+ import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
4
+ import { Block as I, BlockCompositionType as C, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { SETTINGS_ENUMS as l, DefaultConfigValues as m } from "./enums/settingsEnums.js";
6
+ import { getDefaultTemplate as b } from "./template.js";
7
+ import { getItemsBlockContainer as d, getItemsBlockConfig as u, deriveItemNumber as h, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
+ const f = g.Items;
9
+ class P extends I {
10
10
  getId() {
11
- return d;
11
+ return f;
12
12
  }
13
13
  getIcon() {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return y.CONTAINER;
17
+ return C.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,20 +23,20 @@ class E extends I {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getSettingsPanelTitleHtml() {
26
- return C(
27
- d,
26
+ return y(
27
+ f,
28
28
  this.api.translate("Items"),
29
29
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
30
30
  );
31
31
  }
32
32
  getTemplate() {
33
- return h({
34
- orientation: c.ORIENTATION.VERTICAL,
35
- itemsType: c.ITEMS_TYPE.CART_ITEMS,
33
+ return b({
34
+ orientation: l.ORIENTATION.VERTICAL,
35
+ itemsType: l.ITEMS_TYPE.CART_ITEMS,
36
36
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: a.productPriceCurrencySymbolControlValue,
38
- currencyLocation: a.productPriceCurrencyLocationControlValue,
39
- formattedPrice: a.productPriceFormattedControlValue === "1"
37
+ currencySymbol: m.productPriceCurrencySymbolControlValue,
38
+ currencyLocation: m.productPriceCurrencyLocationControlValue,
39
+ formattedPrice: m.productPriceFormattedControlValue === "1"
40
40
  });
41
41
  }
42
42
  allowInnerBlocksDND() {
@@ -45,18 +45,23 @@ class E extends I {
45
45
  canBeSavedAsModule() {
46
46
  return !0;
47
47
  }
48
- onCreated(i) {
49
- const n = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
50
- r.querySelector('[product-attr="imageSrc"] img') || n.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
- const t = l(i);
52
- if (!t)
48
+ onCreated(o) {
49
+ const t = this.api.getDocumentModifier(), i = this.api.getDocumentRootCssNode();
50
+ i.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(i).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
+ const e = d(o);
52
+ if (!e)
53
53
  return;
54
- const e = t.getNodeConfig(), g = e && Object.keys(e).length > 0, o = m(i);
55
- if (o != null && o.initialized)
56
- g ? o.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...o, blockInstanceId: String(Date.now()) }).apply(new s("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new s("Migrate legacy config to nodeConfig"));
54
+ const r = e.getNodeConfig(), s = r && Object.keys(r).length > 0, n = u(o);
55
+ if (n != null && n.initialized)
56
+ if (s)
57
+ n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...n, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
58
+ else {
59
+ const a = this.api.getDocumentModifier();
60
+ a.modifyHtml(e).setNodeConfig(n), this._stampProductTdDomAttributes(e, n, a), a.apply(new c("Migrate legacy config to nodeConfig"));
61
+ }
57
62
  else {
58
- const f = b();
59
- this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(f).apply(new s("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
63
+ const a = N();
64
+ this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(a).apply(new c("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
60
65
  }
61
66
  }
62
67
  /**
@@ -65,18 +70,33 @@ class E extends I {
65
70
  * into nodeConfig, so without this a reused module would reset to defaults.
66
71
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
67
72
  */
68
- onDocumentChanged(i) {
69
- const n = l(i);
70
- if (!n)
73
+ onDocumentChanged(o) {
74
+ const t = d(o);
75
+ if (!t)
76
+ return;
77
+ const i = t.getNodeConfig();
78
+ if (i && Object.keys(i).length > 0)
71
79
  return;
72
- const r = n.getNodeConfig();
73
- if (r && Object.keys(r).length > 0)
80
+ const r = u(o);
81
+ if (!(r != null && r.initialized))
74
82
  return;
75
- const e = m(i);
76
- e != null && e.initialized && this.api.getDocumentModifier().modifyHtml(n).setNodeConfig(e).apply(new s("Recover Items block config from saved module"));
83
+ const s = this.api.getDocumentModifier();
84
+ s.modifyHtml(t).setNodeConfig(r), this._stampProductTdDomAttributes(t, r, s), s.apply(new c("Recover Items block config from saved module"));
85
+ }
86
+ /**
87
+ * Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
88
+ * `.ins-product-td` container from the recovered config. Required for saved modules:
89
+ * `migrate()` (which backfills these) only runs at template load — never when a module
90
+ * is dropped into a live editor — so this is the one place the namespace + index get
91
+ * restored before export. The name `<a>` carries no data-type/data-number of its own and
92
+ * relies on this td-level fallback in pairProductVariables.
93
+ */
94
+ _stampProductTdDomAttributes(o, t, i) {
95
+ const e = h(t.itemsSelectValue, t.type);
96
+ i.modifyHtml(o).setAttribute("data-type", t.type), i.modifyHtml(o).setAttribute("data-number", e);
77
97
  }
78
98
  }
79
99
  export {
80
- d as BLOCK_ID,
81
- E as ItemsBlock
100
+ f as BLOCK_ID,
101
+ P as ItemsBlock
82
102
  };
@@ -1,14 +1,13 @@
1
- import { ModificationDescription as s, UIElementType as a, UEAttr as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as d } from "../../../common-control.js";
1
+ import { ModificationDescription as d, UIElementType as a, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as T } from "../../../common-control.js";
3
3
  import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
4
- import { SETTINGS_ENUMS as h } from "../../enums/settingsEnums.js";
5
- import { getItemsBlockConfig as r, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
6
- const I = l.NAME_TRIMMING, n = {
4
+ import { getItemsBlockConfig as o, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
5
+ const g = l.NAME_TRIMMING, i = {
7
6
  TRIMMING: "trimming"
8
7
  };
9
- class S extends d {
8
+ class y extends T {
10
9
  getId() {
11
- return I;
10
+ return g;
12
11
  }
13
12
  getTemplate() {
14
13
  return `
@@ -18,41 +17,41 @@ class S extends d {
18
17
  `;
19
18
  }
20
19
  onRender() {
21
- const e = r(this.currentNode);
22
- this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
20
+ const e = o(this.currentNode);
21
+ this.api.updateValues({ [i.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(i.TRIMMING, (t) => {
23
22
  this._onTrimmingChange(t);
24
23
  });
25
24
  }
26
25
  onTemplateNodeUpdated(e) {
27
26
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = r(this.currentNode);
29
- this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
27
+ const t = o(this.currentNode);
28
+ this.api.updateValues({ [i.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
30
29
  });
31
30
  }
32
31
  _onTrimmingChange(e) {
33
- c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [n.TRIMMING]: e }), this._applyTrimmingStyles(e);
32
+ c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [i.TRIMMING]: e }), this._applyTrimmingStyles(e);
34
33
  }
35
34
  _applyTrimmingStyles(e) {
36
35
  var m;
37
36
  const t = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
38
37
  if (!t)
39
38
  return;
40
- const i = r(this.currentNode), p = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, o = (i == null ? void 0 : i.orientation) === h.ORIENTATION.VERTICAL;
41
- p ? this.api.getDocumentModifier().modifyHtml(t).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", o ? "130px" : "520px").apply(new s("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(t).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", o ? "130px" : "520px").apply(new s("Text Trimming Disabled"));
39
+ const n = o(this.currentNode), s = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, r = this.api.getDocumentModifier().modifyHtml(t);
40
+ s ? r.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : r.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), r.setStyle("max-width", "100%").apply(new d(`Text Trimming ${s ? "Enabled" : "Disabled"}`));
42
41
  }
43
42
  _getTextTrimming() {
44
43
  return `
45
44
  <div class="display-flex align-items-center justify-content-between">
46
45
  <${a.LABEL}
47
- ${T.LABEL.text}="${this.api.translate("Text Trimming")}"
46
+ ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
48
47
  >
49
48
  </${a.LABEL}>
50
- ${this._GuToggle(n.TRIMMING)}
49
+ ${this._GuToggle(i.TRIMMING)}
51
50
  </div>
52
51
  `;
53
52
  }
54
53
  }
55
54
  export {
56
- I as CONTROL_BLOCK_ID,
57
- S as NameTrimmingControl
55
+ g as CONTROL_BLOCK_ID,
56
+ y as NameTrimmingControl
58
57
  };
@@ -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
  ));