@useinsider/guido 3.2.0-beta.35a8cdd → 3.2.0-beta.40feab8
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/useSave.js +21 -18
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +33 -30
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/package.json +1 -1
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useActionsApi as V } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as x } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as y, useSaveComplete as w } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as q } from "./useHtmlValidator.js";
|
|
8
|
+
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
+
const h = () => {
|
|
11
|
+
const o = y(), s = w(), { validateHtml: r } = q(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { callbacks: a, isFeatureEnabled: d } = x(), { extractSyncModuleData: u } = C(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = V();
|
|
12
|
+
return { save: async (p = !1) => {
|
|
12
13
|
var i;
|
|
13
14
|
o();
|
|
14
|
-
const { prepareTemplateDetails:
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
const { prepareTemplateDetails: f } = b(), t = await f();
|
|
16
|
+
if (!n(t.compiledHtml))
|
|
17
|
+
return;
|
|
18
|
+
if (d("liquidSyntax")) {
|
|
19
|
+
if (!await l(t.compiledHtml))
|
|
17
20
|
return;
|
|
18
21
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
19
22
|
return;
|
|
20
23
|
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
21
24
|
return;
|
|
22
|
-
await
|
|
23
|
-
const { unsubscribePayload:
|
|
24
|
-
return await
|
|
25
|
+
await m();
|
|
26
|
+
const { unsubscribePayload: v, stripoModules: S } = u(t.rawHtml);
|
|
27
|
+
return await c(v), t.modules = S, p || s(t), t;
|
|
25
28
|
} };
|
|
26
29
|
};
|
|
27
30
|
export {
|
|
28
|
-
|
|
31
|
+
h as useSave
|
|
29
32
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
|
+
import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
3
|
+
import { useToaster as m } from "../useToaster.js";
|
|
4
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
5
|
+
const u = /* @__PURE__ */ new Set([
|
|
6
|
+
i,
|
|
7
|
+
l
|
|
8
|
+
]), A = () => {
|
|
9
|
+
const { showToaster: t } = m(), r = p();
|
|
10
|
+
return { validateCouponBlockTags: (e) => {
|
|
11
|
+
const n = new DOMParser().parseFromString(e, "text/html");
|
|
12
|
+
return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
|
|
13
|
+
var o;
|
|
14
|
+
const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
|
|
15
|
+
return !u.has(a);
|
|
16
|
+
}) ? (t({
|
|
17
|
+
type: c.Warning,
|
|
18
|
+
message: r("newsletter.coupon-tag-modified")
|
|
19
|
+
}), !1) : !0;
|
|
20
|
+
} };
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
A as useCouponBlockValidator
|
|
24
|
+
};
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as p, LINK_TYPES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
|
|
1
|
+
import { usePartner as U } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as R, LINK_TYPES as _, INSIDER_ID as m, URLS as y } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as N } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as C } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as L } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as P } from "../../stores/unsubscribe.js";
|
|
7
|
+
import { ProductType as B } from "../../@types/config/schemas.js";
|
|
8
|
+
import "../../@types/config/defaults.js";
|
|
9
|
+
const F = [
|
|
8
10
|
{
|
|
9
11
|
id: "add-unsubscribe-link-values",
|
|
10
12
|
description: "Adding unsubscribe link values",
|
|
11
13
|
type: "custom",
|
|
12
|
-
processor: (
|
|
13
|
-
const { getPartnerName: i } =
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
processor: (s) => {
|
|
15
|
+
const { getPartnerName: i } = U(), n = C(), t = L(), E = P(), c = n.variationId;
|
|
16
|
+
if (!c)
|
|
17
|
+
return s;
|
|
18
|
+
const r = R[n.productType] ?? R[B.EMAIL];
|
|
19
|
+
let e = s;
|
|
20
|
+
const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
21
|
+
let a = !1, l = !1;
|
|
22
|
+
return f.forEach((g) => {
|
|
23
|
+
var S;
|
|
24
|
+
const u = g.getAttribute("data-unsubscribe-page-list");
|
|
22
25
|
if (!u)
|
|
23
26
|
return;
|
|
24
|
-
const
|
|
25
|
-
(
|
|
27
|
+
const I = N(u), b = ((S = E.templates) == null ? void 0 : S.filter(
|
|
28
|
+
(o) => I.includes(o.id)
|
|
26
29
|
)) ?? [];
|
|
27
|
-
|
|
28
|
-
}), (
|
|
30
|
+
a = a || b.some((o) => o.type === _.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === _.PREFERENCES_LINK_TYPE);
|
|
31
|
+
}), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
|
|
29
32
|
text: m,
|
|
30
33
|
value: m,
|
|
31
34
|
fallback: ""
|
|
32
|
-
})),
|
|
35
|
+
})), a && (e = e.replace(
|
|
33
36
|
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
34
|
-
|
|
37
|
+
y.UNSUBSCRIBE_URL + d
|
|
35
38
|
)), l && (e = e.replace(
|
|
36
39
|
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
37
|
-
|
|
38
|
-
)),
|
|
40
|
+
y.PREFERENCES_URL + d
|
|
41
|
+
)), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
39
42
|
},
|
|
40
43
|
priority: 60
|
|
41
44
|
},
|
|
@@ -52,25 +55,25 @@ const G = [
|
|
|
52
55
|
id: "format-comment-braces",
|
|
53
56
|
description: "Adding spaces around comment braces for proper formatting",
|
|
54
57
|
type: "custom",
|
|
55
|
-
processor: (
|
|
58
|
+
processor: (s) => s.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
56
59
|
priority: 62
|
|
57
60
|
},
|
|
58
61
|
{
|
|
59
62
|
id: "add-universal-link-flags",
|
|
60
63
|
description: "Adding universal link flags",
|
|
61
64
|
type: "custom",
|
|
62
|
-
processor: (
|
|
63
|
-
let i =
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
65
|
+
processor: (s) => {
|
|
66
|
+
let i = s;
|
|
67
|
+
const n = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
68
|
+
return n && n.forEach((t) => {
|
|
69
|
+
if (t.includes("insEmail=1"))
|
|
67
70
|
return;
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
return
|
|
71
|
+
if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
72
|
+
const c = t.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
73
|
+
const e = r.slice(6, r.length - 1).trim();
|
|
74
|
+
return r.includes("?") || r.includes("#") ? e.slice(-1) === "&" ? r.replace(e, `${e}insEmail=1`) : r.replace(e, `${e}&insEmail=1`) : r.replace(e, `${e}?insEmail=1`);
|
|
72
75
|
});
|
|
73
|
-
i = i.replace(
|
|
76
|
+
i = i.replace(t, c);
|
|
74
77
|
}
|
|
75
78
|
}), i;
|
|
76
79
|
},
|
|
@@ -78,5 +81,5 @@ const G = [
|
|
|
78
81
|
}
|
|
79
82
|
];
|
|
80
83
|
export {
|
|
81
|
-
|
|
84
|
+
F as unsubscribeCompilerRules
|
|
82
85
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
3
4
|
function y(e, u, r, o, s = "") {
|
|
4
5
|
const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
|
|
5
6
|
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function m(e, u, r, o, s, n) {
|
|
8
9
|
switch (u) {
|
|
9
10
|
case "productImage": {
|
|
10
11
|
const t = e.querySelector("img");
|
|
@@ -69,67 +70,69 @@ function p(e, u, r, o, s, n) {
|
|
|
69
70
|
default: {
|
|
70
71
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
71
72
|
if (t) {
|
|
72
|
-
const c = t.getAttribute("product-attr"),
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
73
|
+
const c = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
74
|
+
if (a) {
|
|
75
|
+
const i = a.querySelector("strong") || a;
|
|
76
|
+
i.textContent = `{{${n}${r}_${o}_${c}}}`;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
break;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function q(e, u, r, o) {
|
|
83
84
|
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
84
|
-
n.querySelectorAll("[data-attribute-type]").forEach((
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
p
|
|
88
|
-
}) :
|
|
85
|
+
n.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
86
|
+
const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
|
|
87
|
+
l.length > 0 ? l.forEach((p) => {
|
|
88
|
+
m(p, i, u, t, r, o);
|
|
89
|
+
}) : m(a, i, u, t, r, o);
|
|
89
90
|
});
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function g(e, u, r, o) {
|
|
93
94
|
const s = e.querySelectorAll(".recommendation-product-row");
|
|
94
95
|
if (!s.length)
|
|
95
96
|
return;
|
|
96
97
|
const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
97
|
-
s.forEach((
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const A =
|
|
102
|
-
|
|
98
|
+
s.forEach((a, i) => {
|
|
99
|
+
a.querySelectorAll("[data-attribute-type]").forEach((p) => {
|
|
100
|
+
const b = p.getAttribute("data-attribute-type") || "";
|
|
101
|
+
p.querySelectorAll(".attribute-cell").forEach((f, $) => {
|
|
102
|
+
const A = i * c + $;
|
|
103
|
+
m(f, b, u, A, r, o);
|
|
103
104
|
});
|
|
104
105
|
});
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function h(e, u, r, o) {
|
|
108
109
|
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
109
|
-
|
|
110
|
+
g(n, u, r, o);
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function C(e, u, r) {
|
|
113
114
|
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
114
|
-
o === "list" ?
|
|
115
|
+
o === "list" ? q(e, u, s, r) : h(e, u, s, r);
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function E(e, u) {
|
|
117
118
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
118
119
|
return (r ? `${r[0]}
|
|
119
120
|
` : "") + u.documentElement.outerHTML;
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
+
function T(e) {
|
|
122
123
|
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
123
124
|
if (!o.length)
|
|
124
125
|
return e;
|
|
125
|
-
const { buildCampaignUrl: s } = _(),
|
|
126
|
+
const { buildCampaignUrl: s } = _(), n = d();
|
|
127
|
+
n.recommendationCampaignUrls = {};
|
|
128
|
+
const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
|
|
126
129
|
return o.forEach((i) => {
|
|
127
|
-
var
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
}),
|
|
130
|
+
var p, b;
|
|
131
|
+
const l = i.getAttribute("recommendation-id");
|
|
132
|
+
l && ((p = i.parentNode) == null || p.insertBefore(r.createComment("REC_START"), i), (b = i.parentNode) == null || b.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
|
|
133
|
+
}), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
131
134
|
}
|
|
132
135
|
export {
|
|
133
136
|
y as formatPriceVariable,
|
|
134
|
-
|
|
137
|
+
T as prepareRecommendationBlocks
|
|
135
138
|
};
|
|
@@ -13,7 +13,7 @@ class B {
|
|
|
13
13
|
migrate(e) {
|
|
14
14
|
try {
|
|
15
15
|
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
|
|
16
|
-
'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
|
|
16
|
+
'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
|
|
17
17
|
);
|
|
18
18
|
return w().$patch((i) => {
|
|
19
19
|
i.migrations = { ...i.migrations, [S]: s.length };
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { useTranslations as R } from "../composables/useTranslations.js";
|
|
2
|
+
import { ProductType as s } from "../@types/config/schemas.js";
|
|
3
|
+
import "../@types/config/defaults.js";
|
|
4
|
+
import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
|
|
5
|
+
const B = {
|
|
4
6
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
7
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
8
|
+
}, i = {
|
|
7
9
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
10
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
11
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
12
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
}, n =
|
|
13
|
+
}, n = S(), C = {
|
|
12
14
|
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
15
|
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
-
},
|
|
16
|
+
}, U = {
|
|
17
|
+
[s.EMAIL]: "email",
|
|
18
|
+
[s.ARCHITECT]: "journey",
|
|
19
|
+
[s.UNSUBSCRIBE_PAGES]: "email"
|
|
20
|
+
}, t = "iid", o = {
|
|
15
21
|
name: "Global Unsubscribe",
|
|
16
22
|
sendGridId: "G"
|
|
17
|
-
},
|
|
23
|
+
}, c = "/email/unsubscribe-pages", E = {
|
|
18
24
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
19
25
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
20
26
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
27
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
28
|
RESUBSCRIBE: 5
|
|
23
|
-
},
|
|
29
|
+
}, u = {
|
|
24
30
|
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
31
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
26
|
-
},
|
|
32
|
+
}, T = {
|
|
27
33
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
28
34
|
E.GLOBAL_UNSUBSCRIBE,
|
|
29
35
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -33,30 +39,31 @@ const _ = {
|
|
|
33
39
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
34
40
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
35
41
|
]
|
|
36
|
-
},
|
|
37
|
-
const
|
|
42
|
+
}, b = () => {
|
|
43
|
+
const e = R();
|
|
38
44
|
return {
|
|
39
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
40
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
41
|
-
[E.RESUBSCRIBE]:
|
|
42
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
43
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
45
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
46
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
47
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
48
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
49
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
44
50
|
};
|
|
45
|
-
},
|
|
51
|
+
}, P = {
|
|
46
52
|
default: "{{ins-unsubscribe-link}}",
|
|
47
53
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
48
54
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
49
55
|
};
|
|
50
56
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
o as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
58
|
+
t as INSIDER_ID,
|
|
59
|
+
i as LINK_REGEXES,
|
|
60
|
+
B as LINK_TYPES,
|
|
61
|
+
P as MERGE_TAGS,
|
|
56
62
|
E as PAGE_TYPES,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
U as PRODUCT_TYPE_URL_SEGMENTS,
|
|
64
|
+
T as TYPE_COLLECTIONS,
|
|
65
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
66
|
+
u as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
67
|
+
C as URLS,
|
|
68
|
+
b as getTypeTranslations
|
|
62
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
|
|
1
|
+
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
|
|
2
2
|
export {
|
|
3
3
|
o as RecommendationControlId
|
|
4
4
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as
|
|
1
|
+
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as i, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as c, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
3
3
|
import { RecommendationControlId as e } from "../../constants/controlIds.js";
|
|
4
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as A, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
|
|
5
|
+
import { CustomAttributeTextTrimControl as I } from "./textTrim.js";
|
|
5
6
|
function o(t) {
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
7
|
+
const r = t.closest(A);
|
|
8
|
+
if (!r)
|
|
8
9
|
return [];
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${
|
|
12
|
-
return
|
|
10
|
+
const n = t.asElement().getAttribute(s);
|
|
11
|
+
if (n) {
|
|
12
|
+
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${n}"]`;
|
|
13
|
+
return r.querySelectorAll(T);
|
|
13
14
|
}
|
|
14
|
-
return
|
|
15
|
+
return r.querySelectorAll(
|
|
15
16
|
`[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
|
|
16
17
|
);
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
+
const m = class extends a {
|
|
19
20
|
getId() {
|
|
20
21
|
return e.CUSTOM_ATTR_ALIGN;
|
|
21
22
|
}
|
|
@@ -36,7 +37,7 @@ const A = class extends a {
|
|
|
36
37
|
getTargetNodes(t) {
|
|
37
38
|
return o(t);
|
|
38
39
|
}
|
|
39
|
-
},
|
|
40
|
+
}, x = class extends c {
|
|
40
41
|
getId() {
|
|
41
42
|
return e.CUSTOM_ATTR_STYLE;
|
|
42
43
|
}
|
|
@@ -50,29 +51,31 @@ const A = class extends a {
|
|
|
50
51
|
getTargetNodes(t) {
|
|
51
52
|
return o(t);
|
|
52
53
|
}
|
|
53
|
-
}, R = class extends
|
|
54
|
+
}, R = class extends i {
|
|
54
55
|
getId() {
|
|
55
56
|
return e.CUSTOM_ATTR_BACKGROUND;
|
|
56
57
|
}
|
|
57
58
|
getTargetNodes(t) {
|
|
58
59
|
return o(t);
|
|
59
60
|
}
|
|
60
|
-
},
|
|
61
|
+
}, B = class extends d {
|
|
61
62
|
getId() {
|
|
62
63
|
return e.CUSTOM_ATTR_PADDINGS;
|
|
63
64
|
}
|
|
64
65
|
getTargetNodes(t) {
|
|
65
66
|
return o(t);
|
|
66
67
|
}
|
|
67
|
-
},
|
|
68
|
-
align:
|
|
68
|
+
}, p = {
|
|
69
|
+
align: m,
|
|
69
70
|
color: _,
|
|
70
71
|
size: S,
|
|
71
|
-
style:
|
|
72
|
+
style: x,
|
|
72
73
|
fontFamily: O,
|
|
73
74
|
background: R,
|
|
74
|
-
paddings:
|
|
75
|
+
paddings: B,
|
|
76
|
+
textTrim: I
|
|
75
77
|
};
|
|
76
78
|
export {
|
|
77
|
-
|
|
79
|
+
p as CustomAttributeControls,
|
|
80
|
+
I as CustomAttributeTextTrimControl
|
|
78
81
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
3
|
+
import { RecommendationBlockId as n } from "../../constants/blockIds.js";
|
|
4
|
+
import { RecommendationControlId as l } from "../../constants/controlIds.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
|
|
6
|
+
import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
|
|
7
|
+
const i = {
|
|
8
|
+
TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
|
|
9
|
+
};
|
|
10
|
+
class g extends m {
|
|
11
|
+
getId() {
|
|
12
|
+
return l.CUSTOM_ATTR_TEXT_TRIM;
|
|
13
|
+
}
|
|
14
|
+
getTemplate() {
|
|
15
|
+
return `
|
|
16
|
+
<hr style="margin: 0; border: none; border-top: 1px solid #e0e0e0;" />
|
|
17
|
+
<div class="custom-attr-text-trim-control-container">
|
|
18
|
+
${this._GuTwoColumns([
|
|
19
|
+
this._GuLabel({ text: this.api.translate("Trim Long Text") }),
|
|
20
|
+
this._GuToggle(i.TEXT_TRIM_ENABLED)
|
|
21
|
+
])}
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
onRender() {
|
|
26
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
27
|
+
}
|
|
28
|
+
onTemplateNodeUpdated(t) {
|
|
29
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
30
|
+
}
|
|
31
|
+
// ========================================================================
|
|
32
|
+
// State Reading
|
|
33
|
+
// ========================================================================
|
|
34
|
+
_setFormValues() {
|
|
35
|
+
this.api.updateValues({
|
|
36
|
+
[i.TEXT_TRIM_ENABLED]: this._getCurrentTrimState()
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
_getCurrentTrimState() {
|
|
40
|
+
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
41
|
+
return !1;
|
|
42
|
+
if (this.currentNode.hasClass(o))
|
|
43
|
+
return !0;
|
|
44
|
+
const t = this._getTargetElements();
|
|
45
|
+
return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(o) : !1;
|
|
46
|
+
}
|
|
47
|
+
// ========================================================================
|
|
48
|
+
// Target Element Discovery (per-attribute scoping)
|
|
49
|
+
// ========================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Finds all custom attribute elements of the same type as the current node.
|
|
52
|
+
*
|
|
53
|
+
* Similar to getCustomAttrTargetNodes in customAttribute/index.ts, but adapted
|
|
54
|
+
* for CommonControl lifecycle where currentNode is a class property (not a
|
|
55
|
+
* parameter from Stripo's getTargetNodes override).
|
|
56
|
+
*/
|
|
57
|
+
_getTargetElements() {
|
|
58
|
+
if (!this.currentNode || !("closest" in this.currentNode))
|
|
59
|
+
return [];
|
|
60
|
+
const t = this.currentNode.closest(u);
|
|
61
|
+
if (!t)
|
|
62
|
+
return [];
|
|
63
|
+
const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
|
|
64
|
+
if (e) {
|
|
65
|
+
const s = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
|
|
66
|
+
return Array.from(t.querySelectorAll(s));
|
|
67
|
+
}
|
|
68
|
+
return Array.from(
|
|
69
|
+
t.querySelectorAll(
|
|
70
|
+
`[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"]`
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
// ========================================================================
|
|
75
|
+
// Toggle Handler
|
|
76
|
+
// ========================================================================
|
|
77
|
+
_onTextTrimChange(t) {
|
|
78
|
+
const e = this._getTargetElements();
|
|
79
|
+
if (!e.length)
|
|
80
|
+
return;
|
|
81
|
+
t && c(this.api);
|
|
82
|
+
const r = this.api.getDocumentModifier();
|
|
83
|
+
e.forEach((s) => {
|
|
84
|
+
t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
|
|
85
|
+
}), r.apply(
|
|
86
|
+
new T(
|
|
87
|
+
t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
_listenToFormUpdates() {
|
|
92
|
+
this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (t) => {
|
|
93
|
+
this._onTextTrimChange(t);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
g as CustomAttributeTextTrimControl
|
|
99
|
+
};
|