@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.
- package/dist/composables/useCortexBlueprintBridge.js +34 -30
- package/dist/composables/useEmailTemplateApplier.js +11 -9
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/config/migrator/unsubscribeMigrator.js +89 -67
- package/dist/extensions/Blocks/Items/block.js +57 -37
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +53 -45
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +5 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +8 -3
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +12 -0
- package/dist/utils/pairProductVariables.js +64 -65
- package/package.json +2 -2
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { MERGE_TAGS as
|
|
5
|
-
import { DATA_ATTRIBUTES as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
class
|
|
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
|
-
|
|
9
|
+
A(this, "parser");
|
|
10
10
|
this.parser = new DOMParser();
|
|
11
11
|
}
|
|
12
12
|
async migrate(e) {
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
45
|
-
return
|
|
66
|
+
const t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
|
|
67
|
+
return t ? t[0] : "";
|
|
46
68
|
}
|
|
47
69
|
extractUnsubscribeContent(e) {
|
|
48
|
-
var
|
|
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
|
|
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:
|
|
73
|
-
paragraphStyle:
|
|
94
|
+
align: n,
|
|
95
|
+
paragraphStyle: s
|
|
74
96
|
};
|
|
75
|
-
const
|
|
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:
|
|
78
|
-
linkText:
|
|
79
|
-
linkHref: this.normalizeUnsubscribeHref(
|
|
80
|
-
linkStyle:
|
|
81
|
-
textAfter:
|
|
82
|
-
isBold:
|
|
83
|
-
isItalic:
|
|
84
|
-
align:
|
|
85
|
-
paragraphStyle:
|
|
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,
|
|
89
|
-
const
|
|
90
|
-
e.textBefore &&
|
|
91
|
-
let
|
|
92
|
-
e.isBold && e.isItalic ?
|
|
93
|
-
const
|
|
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="${
|
|
99
|
-
${
|
|
120
|
+
class="${n ? `${S} ${n}` : S}"
|
|
121
|
+
${m}${y}${E}${T}
|
|
100
122
|
>
|
|
101
123
|
<p path="1"${d}>
|
|
102
|
-
${
|
|
124
|
+
${i}
|
|
103
125
|
</p>
|
|
104
126
|
</td>
|
|
105
127
|
`;
|
|
106
128
|
}
|
|
107
129
|
getCollectionTypeFromMergeTag(e) {
|
|
108
|
-
return e ===
|
|
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(
|
|
133
|
+
if (Object.values(f).includes(e))
|
|
112
134
|
return e;
|
|
113
|
-
const
|
|
114
|
-
return
|
|
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(
|
|
120
|
-
return new
|
|
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
|
|
1
|
+
import { BlockId as g } from "../../../enums/block.js";
|
|
2
2
|
import { useOnboardingStore as p } from "../../../stores/onboarding.js";
|
|
3
|
-
import { getMigrationBannerHtml as
|
|
4
|
-
import { Block as I, BlockCompositionType as
|
|
5
|
-
import { SETTINGS_ENUMS as
|
|
6
|
-
import { getDefaultTemplate as
|
|
7
|
-
import { getItemsBlockContainer as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
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
|
|
11
|
+
return f;
|
|
12
12
|
}
|
|
13
13
|
getIcon() {
|
|
14
14
|
return "items-icon";
|
|
15
15
|
}
|
|
16
16
|
getBlockCompositionType() {
|
|
17
|
-
return
|
|
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
|
|
27
|
-
|
|
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
|
|
34
|
-
orientation:
|
|
35
|
-
itemsType:
|
|
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:
|
|
38
|
-
currencyLocation:
|
|
39
|
-
formattedPrice:
|
|
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(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
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
|
|
55
|
-
if (
|
|
56
|
-
|
|
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
|
|
59
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
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(
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
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 =
|
|
73
|
-
if (r &&
|
|
80
|
+
const r = u(o);
|
|
81
|
+
if (!(r != null && r.initialized))
|
|
74
82
|
return;
|
|
75
|
-
const
|
|
76
|
-
|
|
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
|
-
|
|
81
|
-
|
|
100
|
+
f as BLOCK_ID,
|
|
101
|
+
P as ItemsBlock
|
|
82
102
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
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 {
|
|
5
|
-
|
|
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
|
|
8
|
+
class y extends T {
|
|
10
9
|
getId() {
|
|
11
|
-
return
|
|
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 =
|
|
22
|
-
this.api.updateValues({ [
|
|
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 =
|
|
29
|
-
this.api.updateValues({ [
|
|
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({ [
|
|
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
|
|
41
|
-
|
|
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
|
-
${
|
|
46
|
+
${p.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
48
47
|
>
|
|
49
48
|
</${a.LABEL}>
|
|
50
|
-
${this._GuToggle(
|
|
49
|
+
${this._GuToggle(i.TRIMMING)}
|
|
51
50
|
</div>
|
|
52
51
|
`;
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
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
|
));
|