@useinsider/guido 3.14.0-beta.1abaa5e → 3.14.0-beta.1e474dd
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/useAllowlist.js +30 -48
- package/dist/composables/useHtmlCompiler.js +16 -19
- package/dist/composables/useHtmlValidator.js +50 -50
- package/dist/config/compiler/htmlCompilerRules.js +7 -34
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +346 -314
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -43
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +22 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +52 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,68 +1,50 @@
|
|
|
1
1
|
import { useAllowlistApi as A } from "../services/allowlistApi.js";
|
|
2
|
-
import { base64EncodeWithSpecialChars as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { useUserRole as
|
|
5
|
-
const
|
|
6
|
-
"insider-email",
|
|
7
|
-
"web-image.useinsider.com",
|
|
8
|
-
"image.useinsider.com",
|
|
9
|
-
"panel-assets.useinsider.com",
|
|
10
|
-
"stripo-editor-image"
|
|
11
|
-
], N = ({ hostname: r, pathname: l }) => {
|
|
12
|
-
const n = r.toLowerCase();
|
|
13
|
-
if (n === w) {
|
|
14
|
-
const i = l.split("/")[1].toLowerCase();
|
|
15
|
-
return d.includes(i);
|
|
16
|
-
}
|
|
17
|
-
return d.some((i) => n === `${i}.${w}`);
|
|
18
|
-
}, m = {
|
|
2
|
+
import { base64EncodeWithSpecialChars as p } from "../utils/base64.js";
|
|
3
|
+
import { useTranslations as h } from "./useTranslations.js";
|
|
4
|
+
import { useUserRole as D } from "./useUserRole.js";
|
|
5
|
+
const f = /(?:https?:\/\/|www\.)[^\s"'<>()]+/gi, E = /"\/\//gi, i = {
|
|
19
6
|
MANAGE: "journey-builder.domain-allowlist-warning",
|
|
20
7
|
NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
|
|
21
8
|
ADD_BUTTON: "settings.allow-list-warning-add-button"
|
|
22
|
-
},
|
|
23
|
-
const { checkDomain:
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
const
|
|
9
|
+
}, w = /* @__PURE__ */ new Set(), O = (n) => `/settings?openAddModal=true&type=domain&values=${p(n)}#security`, M = () => {
|
|
10
|
+
const { checkDomain: n } = A(), { getIsManageUser: l } = D(), a = h(), d = (t, s) => {
|
|
11
|
+
const c = `${t || ""} ${s || ""}`.replace(E, "https://").match(f) || [], e = /* @__PURE__ */ new Set();
|
|
12
|
+
return c.forEach((r) => {
|
|
13
|
+
const g = /^https?:\/\//i.test(r) ? r : `https://${r}`;
|
|
27
14
|
try {
|
|
28
|
-
const u = new URL(
|
|
29
|
-
|
|
30
|
-
return;
|
|
31
|
-
u.hostname && s.add(u.hostname.replace(/^www\./i, "").toLowerCase());
|
|
15
|
+
const { hostname: u } = new URL(g);
|
|
16
|
+
u && e.add(u.replace(/^www\./i, "").toLowerCase());
|
|
32
17
|
} catch {
|
|
33
18
|
}
|
|
34
|
-
}), [...
|
|
35
|
-
},
|
|
36
|
-
if (
|
|
19
|
+
}), [...e];
|
|
20
|
+
}, m = async (t) => {
|
|
21
|
+
if (w.has(t))
|
|
37
22
|
return !0;
|
|
38
23
|
try {
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
} catch (
|
|
42
|
-
return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t,
|
|
24
|
+
const s = await n(t);
|
|
25
|
+
return s && w.add(t), s;
|
|
26
|
+
} catch (s) {
|
|
27
|
+
return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t, s), !0;
|
|
43
28
|
}
|
|
44
29
|
};
|
|
45
|
-
return { getBlockedDomains: async (t,
|
|
30
|
+
return { getBlockedDomains: async (t, s) => {
|
|
46
31
|
try {
|
|
47
|
-
const o =
|
|
32
|
+
const o = d(t, s);
|
|
48
33
|
return o.length ? (await Promise.all(
|
|
49
|
-
o.map(async (
|
|
50
|
-
)).filter((
|
|
34
|
+
o.map(async (e) => ({ domain: e, allowlisted: await m(e) }))
|
|
35
|
+
)).filter((e) => !e.allowlisted).map((e) => e.domain) : [];
|
|
51
36
|
} catch (o) {
|
|
52
37
|
return console.error("[GUIDO_ALLOWLIST] getBlockedDomains failed", o), [];
|
|
53
38
|
}
|
|
54
|
-
}, resolveToast: async (t) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
} : { message: a(n(m.NON_MANAGE)) };
|
|
63
|
-
} };
|
|
39
|
+
}, resolveToast: async (t) => await l() ? {
|
|
40
|
+
message: a(i.MANAGE),
|
|
41
|
+
actionButton: {
|
|
42
|
+
text: a(i.ADD_BUTTON),
|
|
43
|
+
onClick: () => window.open(O(t.join(",")), "_blank")
|
|
44
|
+
}
|
|
45
|
+
} : { message: a(i.NON_MANAGE) } };
|
|
64
46
|
};
|
|
65
47
|
export {
|
|
66
48
|
O as buildAllowlistSettingsUrl,
|
|
67
|
-
|
|
49
|
+
M as useAllowlist
|
|
68
50
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
1
|
+
import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
|
|
5
5
|
import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
-
import { socialCompilerRules as
|
|
7
|
-
import { unsubscribeCompilerRules as
|
|
6
|
+
import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
8
|
import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
|
|
9
|
-
import { useConfig as
|
|
10
|
-
const
|
|
9
|
+
import { useConfig as k } from "./useConfig.js";
|
|
10
|
+
const y = /* @__PURE__ */ new Set([
|
|
11
11
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
12
12
|
"fix-url-encoding-start",
|
|
13
13
|
"fix-url-encoding-end",
|
|
@@ -18,9 +18,6 @@ const h = /* @__PURE__ */ new Set([
|
|
|
18
18
|
// Image domain corrections — plain string replacement.
|
|
19
19
|
"replace-old-image-domain",
|
|
20
20
|
"replace-old-v2-image-domain",
|
|
21
|
-
"replace-s3-path-style-web-image-domain",
|
|
22
|
-
"replace-s3-path-style-image-domain",
|
|
23
|
-
"replace-s3-path-style-panel-assets-domain",
|
|
24
21
|
// Unsubscribe domain — the actual fix: injects the real unsubscribe href in
|
|
25
22
|
// place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
|
|
26
23
|
// unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
|
|
@@ -35,21 +32,21 @@ const h = /* @__PURE__ */ new Set([
|
|
|
35
32
|
"remove-contenteditable"
|
|
36
33
|
]), M = () => {
|
|
37
34
|
var i, m, r;
|
|
38
|
-
const { compiler: o, isFeatureEnabled:
|
|
39
|
-
...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] :
|
|
35
|
+
const { compiler: o, isFeatureEnabled: n, partner: a } = k(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
|
|
36
|
+
...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : R,
|
|
40
37
|
...v,
|
|
38
|
+
...x,
|
|
39
|
+
...g,
|
|
40
|
+
...b,
|
|
41
41
|
...H,
|
|
42
|
-
...
|
|
43
|
-
...C,
|
|
44
|
-
...y,
|
|
45
|
-
...a("liquidSyntax") ? b : [],
|
|
42
|
+
...n("liquidSyntax") ? C : [],
|
|
46
43
|
...p.map((e, f) => ({
|
|
47
44
|
...e,
|
|
48
45
|
priority: e.priority + 1e3 + f
|
|
49
46
|
// Ensure additional rules run after default rules
|
|
50
47
|
}))
|
|
51
|
-
],
|
|
52
|
-
return { compileHtml: (e) =>
|
|
48
|
+
], u = s(l), c = l.filter((e) => y.has(e.id)), d = s(c), t = (r = a.value) == null ? void 0 : r.fallbackFont;
|
|
49
|
+
return { compileHtml: (e) => u.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
|
|
53
50
|
};
|
|
54
51
|
export {
|
|
55
52
|
M as useHtmlCompiler
|
|
@@ -6,7 +6,7 @@ import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
|
6
6
|
import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
7
|
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
8
8
|
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
-
import {
|
|
9
|
+
import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
10
10
|
import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
11
11
|
import { useRecommendationStore as te } from "../stores/recommendation.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
|
|
@@ -14,25 +14,25 @@ import { useHttp as se } from "./useHttp.js";
|
|
|
14
14
|
import { useToaster as re } from "./useToaster.js";
|
|
15
15
|
import { useTranslations as oe } from "./useTranslations.js";
|
|
16
16
|
const ie = /recommendation-id="(\d+)"/g;
|
|
17
|
-
function ae(
|
|
18
|
-
return [...
|
|
17
|
+
function ae(n) {
|
|
18
|
+
return [...n.matchAll(ie)].map((m) => m[1]);
|
|
19
19
|
}
|
|
20
|
-
function ce(
|
|
21
|
-
return m.some((f) =>
|
|
20
|
+
function ce(n, m) {
|
|
21
|
+
return m.some((f) => n.startsWith(`${f}_`));
|
|
22
22
|
}
|
|
23
23
|
const le = /^(\d+)_\d+_(.+)$/;
|
|
24
|
-
function me(
|
|
25
|
-
const m =
|
|
24
|
+
function me(n) {
|
|
25
|
+
const m = n.match(le);
|
|
26
26
|
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
27
27
|
}
|
|
28
|
-
function ue(
|
|
28
|
+
function ue(n) {
|
|
29
29
|
const m = new Set(Z);
|
|
30
|
-
return Object.values(
|
|
31
|
-
m.add(Q(f
|
|
30
|
+
return Object.values(n).forEach((f) => {
|
|
31
|
+
m.add(Q(f).toLowerCase());
|
|
32
32
|
}), m;
|
|
33
33
|
}
|
|
34
|
-
function de(
|
|
35
|
-
const u =
|
|
34
|
+
function de(n, m, f, o, d) {
|
|
35
|
+
const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
36
36
|
if (!u)
|
|
37
37
|
return [];
|
|
38
38
|
const p = new Set(m.map((h) => h.toLowerCase())), E = [];
|
|
@@ -50,15 +50,15 @@ function de(t, m, f, o, d) {
|
|
|
50
50
|
ce(g, f) || g.includes(".") || E.push(g);
|
|
51
51
|
}), E;
|
|
52
52
|
}
|
|
53
|
-
function fe(
|
|
54
|
-
return (
|
|
53
|
+
function fe(n) {
|
|
54
|
+
return (n.replace(U, "$1").match(j) ?? []).filter((o) => {
|
|
55
55
|
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
56
56
|
return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
const xe = () => {
|
|
60
60
|
var b, S;
|
|
61
|
-
const { showToaster:
|
|
61
|
+
const { showToaster: n } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
|
|
62
62
|
if (e.size === 0)
|
|
63
63
|
return /* @__PURE__ */ new Set();
|
|
64
64
|
try {
|
|
@@ -68,59 +68,59 @@ const xe = () => {
|
|
|
68
68
|
}
|
|
69
69
|
return ue(u.filterList);
|
|
70
70
|
}, h = async (e) => {
|
|
71
|
-
const
|
|
71
|
+
const t = await m(
|
|
72
72
|
"/newsletter/template-library/check-template-html-body",
|
|
73
73
|
{ html: ne(e) }
|
|
74
|
-
), { status: r, message: a } =
|
|
75
|
-
return r ||
|
|
74
|
+
), { status: r, message: a } = t.data;
|
|
75
|
+
return r || n({
|
|
76
76
|
type: c.Error,
|
|
77
77
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
78
|
-
}), o($), a === o(Y) &&
|
|
78
|
+
}), o($), a === o(Y) && n({
|
|
79
79
|
type: c.Error,
|
|
80
80
|
message: o("newsletter.already-in-progress")
|
|
81
81
|
}), r;
|
|
82
82
|
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
|
|
83
|
-
const
|
|
83
|
+
const t = e.match(/({%(.*?)%})/g);
|
|
84
84
|
let r = !0;
|
|
85
|
-
return
|
|
85
|
+
return t !== null && !p && t.forEach((a) => {
|
|
86
86
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
87
|
if (i && i.length > 0) {
|
|
88
88
|
const [l] = i;
|
|
89
|
-
g(l) && !s.includes(l) && (
|
|
89
|
+
g(l) && !s.includes(l) && (n({
|
|
90
90
|
type: c.Warning,
|
|
91
91
|
message: o("custom-fields.invalid-custom-fields")
|
|
92
92
|
}), r = !1);
|
|
93
93
|
}
|
|
94
94
|
}), r;
|
|
95
|
-
}, w = async (e, s,
|
|
96
|
-
const r =
|
|
95
|
+
}, w = async (e, s, t) => {
|
|
96
|
+
const r = t ? await h(e) : !0;
|
|
97
97
|
return T(e, s) && r;
|
|
98
|
-
}, R = (e) => e.length > 0 ? !0 : (
|
|
98
|
+
}, R = (e) => e.length > 0 ? !0 : (n({
|
|
99
99
|
type: c.Warning,
|
|
100
100
|
message: o("newsletter.html-content-is-empty")
|
|
101
101
|
}), !1), _ = (e) => {
|
|
102
|
-
const s = (e.match(/{/gm) || []).length,
|
|
103
|
-
return s >
|
|
102
|
+
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
103
|
+
return s > t && n({
|
|
104
104
|
type: c.Warning,
|
|
105
105
|
message: o("custom-fields.missing-closing-braces")
|
|
106
|
-
}), s <
|
|
106
|
+
}), s < t && n({
|
|
107
107
|
type: c.Warning,
|
|
108
108
|
message: o("custom-fields.missing-opening-braces")
|
|
109
|
-
}), s ===
|
|
109
|
+
}), s === t;
|
|
110
110
|
}, N = (e) => {
|
|
111
111
|
const s = fe(e).length === 0;
|
|
112
|
-
return s ||
|
|
112
|
+
return s || n({
|
|
113
113
|
type: c.Warning,
|
|
114
114
|
message: o("custom-fields.invalid-custom-fields")
|
|
115
115
|
}), s;
|
|
116
|
-
}, x = (e, s,
|
|
116
|
+
}, x = (e, s, t, r) => {
|
|
117
117
|
if (p)
|
|
118
118
|
return !0;
|
|
119
119
|
const a = de(
|
|
120
120
|
e,
|
|
121
121
|
s,
|
|
122
122
|
ae(e),
|
|
123
|
-
|
|
123
|
+
t,
|
|
124
124
|
r
|
|
125
125
|
);
|
|
126
126
|
if (a.length > 0) {
|
|
@@ -129,56 +129,56 @@ const xe = () => {
|
|
|
129
129
|
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
130
130
|
</ul>
|
|
131
131
|
`;
|
|
132
|
-
return
|
|
132
|
+
return n({
|
|
133
133
|
type: c.Error,
|
|
134
134
|
message: o("custom-fields.invalid-custom-fields") + i
|
|
135
135
|
}), !1;
|
|
136
136
|
}
|
|
137
137
|
return !0;
|
|
138
138
|
}, O = (e) => {
|
|
139
|
-
const s = e.match(/{%(.*?)%}/g),
|
|
139
|
+
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
140
140
|
let r = !0;
|
|
141
141
|
if (s && s.forEach((a) => {
|
|
142
142
|
const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
|
|
143
|
-
(!i || a !== v) && !l && (
|
|
143
|
+
(!i || a !== v) && !l && (n({
|
|
144
144
|
type: c.Error,
|
|
145
145
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
146
|
}), r = !1), i && i.forEach((C) => {
|
|
147
|
-
C.trim() === "=" && (
|
|
147
|
+
C.trim() === "=" && (n({
|
|
148
148
|
type: c.Error,
|
|
149
149
|
message: o("custom-conditions.wrong-equality-operators")
|
|
150
150
|
}), r = !1);
|
|
151
151
|
const I = C.match(/^[a-zA-Z]*$/g);
|
|
152
152
|
I && I.forEach((A) => {
|
|
153
|
-
y(A) &&
|
|
153
|
+
y(A) && t.push(A);
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
|
-
}),
|
|
157
|
-
const a =
|
|
158
|
-
a.length !== i.length && (
|
|
156
|
+
}), t.length) {
|
|
157
|
+
const a = t.filter((l) => l === "if"), i = t.filter((l) => l === "endif");
|
|
158
|
+
a.length !== i.length && (n({
|
|
159
159
|
type: c.Error,
|
|
160
160
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
161
|
}), r = !1);
|
|
162
162
|
}
|
|
163
163
|
return r;
|
|
164
164
|
}, k = (e) => {
|
|
165
|
-
const s = (e.match(/{% /gm) || []).length,
|
|
166
|
-
return r ||
|
|
165
|
+
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, r = s === t;
|
|
166
|
+
return r || n({
|
|
167
167
|
type: c.Warning,
|
|
168
168
|
message: o("custom-conditions.no-space-after-braces")
|
|
169
169
|
}), r;
|
|
170
|
-
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((
|
|
170
|
+
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, r) => t + r, 0) > 0 ? (n({
|
|
171
171
|
type: c.Warning,
|
|
172
172
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
|
-
}), !1) : !0, D = () => u.hasInvalidBlock() ? (
|
|
173
|
+
}), !1) : !0, D = () => u.hasInvalidBlock() ? (n({
|
|
174
174
|
type: c.Error,
|
|
175
175
|
message: o(ee)
|
|
176
|
-
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((
|
|
176
|
+
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (n({
|
|
177
177
|
type: c.Error,
|
|
178
178
|
message: o("newsletter.fill-all-necessary-fields")
|
|
179
179
|
}), !1) : !0, L = (e) => {
|
|
180
180
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
181
|
-
return e.match(s) === null ? !0 : (
|
|
181
|
+
return e.match(s) === null ? !0 : (n({
|
|
182
182
|
type: c.Error,
|
|
183
183
|
message: o("newsletter.invalid-image-type")
|
|
184
184
|
}), !1);
|
|
@@ -187,7 +187,7 @@ const xe = () => {
|
|
|
187
187
|
return Array.from(r).find((i) => {
|
|
188
188
|
var l;
|
|
189
189
|
return !((l = i.id) != null && l.trim());
|
|
190
|
-
}) ? (
|
|
190
|
+
}) ? (n({
|
|
191
191
|
type: c.Error,
|
|
192
192
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
193
|
}), !1) : !0;
|
|
@@ -196,19 +196,19 @@ const xe = () => {
|
|
|
196
196
|
return Array.from(r).find((i) => {
|
|
197
197
|
var l;
|
|
198
198
|
return !((l = i.id) != null && l.trim());
|
|
199
|
-
}) ? (
|
|
199
|
+
}) ? (n({
|
|
200
200
|
type: c.Error,
|
|
201
201
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
202
|
}), !1) : !0;
|
|
203
203
|
};
|
|
204
|
-
return { validateHtml: async (e, s,
|
|
204
|
+
return { validateHtml: async (e, s, t = !1) => {
|
|
205
205
|
var v, C;
|
|
206
206
|
const r = [
|
|
207
207
|
...s.map((I) => I.value),
|
|
208
208
|
...z,
|
|
209
209
|
...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
|
|
210
210
|
], a = G(e), i = await E(a);
|
|
211
|
-
return await w(e, r,
|
|
211
|
+
return await w(e, r, t) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
|
|
212
212
|
} };
|
|
213
213
|
};
|
|
214
214
|
export {
|
|
@@ -122,10 +122,10 @@ const d = [
|
|
|
122
122
|
], i = /<head>([\S\s]*)<\/head>/, o = new RegExp(i);
|
|
123
123
|
if (!e.match(o))
|
|
124
124
|
return e;
|
|
125
|
-
let
|
|
126
|
-
return t.forEach((
|
|
127
|
-
|
|
128
|
-
}),
|
|
125
|
+
let r = e;
|
|
126
|
+
return t.forEach((s) => {
|
|
127
|
+
r = r.replace("</head>", `${s}</head>`);
|
|
128
|
+
}), r;
|
|
129
129
|
},
|
|
130
130
|
priority: 30
|
|
131
131
|
},
|
|
@@ -147,33 +147,6 @@ const d = [
|
|
|
147
147
|
replaceAll: !0,
|
|
148
148
|
priority: 41
|
|
149
149
|
},
|
|
150
|
-
{
|
|
151
|
-
id: "replace-s3-path-style-web-image-domain",
|
|
152
|
-
description: "Rewriting path-style S3 asset URLs to the web-image.useinsider.com domain",
|
|
153
|
-
type: "replace",
|
|
154
|
-
search: "s3-eu-west-1.amazonaws.com/web-image.useinsider.com",
|
|
155
|
-
replacement: "web-image.useinsider.com",
|
|
156
|
-
replaceAll: !0,
|
|
157
|
-
priority: 42
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: "replace-s3-path-style-image-domain",
|
|
161
|
-
description: "Rewriting path-style S3 asset URLs to the image.useinsider.com domain",
|
|
162
|
-
type: "replace",
|
|
163
|
-
search: "s3-eu-west-1.amazonaws.com/image.useinsider.com",
|
|
164
|
-
replacement: "image.useinsider.com",
|
|
165
|
-
replaceAll: !0,
|
|
166
|
-
priority: 43
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
id: "replace-s3-path-style-panel-assets-domain",
|
|
170
|
-
description: "Rewriting path-style S3 asset URLs to the panel-assets.useinsider.com domain",
|
|
171
|
-
type: "replace",
|
|
172
|
-
search: "s3-eu-west-1.amazonaws.com/panel-assets.useinsider.com",
|
|
173
|
-
replacement: "panel-assets.useinsider.com",
|
|
174
|
-
replaceAll: !0,
|
|
175
|
-
priority: 46
|
|
176
|
-
},
|
|
177
150
|
{
|
|
178
151
|
id: "convert-rgb-to-hex",
|
|
179
152
|
// SD-142395: rgb()/6-digit hex are verbose; hex/3-digit shorthand is byte-identical
|
|
@@ -183,9 +156,9 @@ const d = [
|
|
|
183
156
|
type: "custom",
|
|
184
157
|
processor: (e) => {
|
|
185
158
|
const t = (i) => i.toString(16).padStart(2, "0");
|
|
186
|
-
return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o,
|
|
187
|
-
const [
|
|
188
|
-
return
|
|
159
|
+
return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
|
|
160
|
+
const [s, a, c] = [Number(o), Number(n), Number(r)];
|
|
161
|
+
return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
|
|
189
162
|
}).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
|
|
190
163
|
},
|
|
191
164
|
priority: 44
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "Items", o = {
|
|
1
|
+
const e = "Items", o = "Default", t = "Custom", s = {
|
|
2
2
|
"Global Styles & Layout": "Global Styles and Layout",
|
|
3
3
|
"Structures & Modules": "Structures and Modules",
|
|
4
4
|
"Recommendation Block": "Recommendation",
|
|
@@ -7,9 +7,13 @@ const e = "Items", o = {
|
|
|
7
7
|
"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.": "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.",
|
|
8
8
|
"Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
|
|
9
9
|
"OPT-IN SELECTION": "OPT-IN SELECTION",
|
|
10
|
-
"UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
|
|
10
|
+
"UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
|
|
11
|
+
Default: o,
|
|
12
|
+
Custom: t
|
|
11
13
|
};
|
|
12
14
|
export {
|
|
15
|
+
t as Custom,
|
|
16
|
+
o as Default,
|
|
13
17
|
e as Items,
|
|
14
|
-
|
|
18
|
+
s as default
|
|
15
19
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_COMPOSITION as
|
|
1
|
+
import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
2
2
|
import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
3
|
import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
|
|
4
4
|
const C = "__title__", a = "product_attribute.";
|
|
@@ -23,19 +23,22 @@ function N(r) {
|
|
|
23
23
|
return { key: k, kind: "button" };
|
|
24
24
|
default:
|
|
25
25
|
if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
|
|
27
|
+
if (!s)
|
|
28
|
+
return null;
|
|
29
|
+
const e = o || `${a}${s}`;
|
|
30
|
+
return {
|
|
31
|
+
key: `${l}${e}`,
|
|
29
32
|
kind: "custom",
|
|
30
|
-
customAttrName:
|
|
31
|
-
customAttrValue:
|
|
32
|
-
}
|
|
33
|
+
customAttrName: s,
|
|
34
|
+
customAttrValue: e
|
|
35
|
+
};
|
|
33
36
|
}
|
|
34
37
|
return null;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
function
|
|
38
|
-
const t =
|
|
40
|
+
function _(r) {
|
|
41
|
+
const t = p.indexOf(r);
|
|
39
42
|
return t === -1 ? Number.POSITIVE_INFINITY : t;
|
|
40
43
|
}
|
|
41
44
|
function S(r) {
|
|
@@ -48,8 +51,8 @@ function S(r) {
|
|
|
48
51
|
anyTextTrimming: !1
|
|
49
52
|
};
|
|
50
53
|
if (!r || r.length === 0)
|
|
51
|
-
return t.composition = [...
|
|
52
|
-
const
|
|
54
|
+
return t.composition = [...p], t;
|
|
55
|
+
const o = [];
|
|
53
56
|
r.forEach((e, i) => {
|
|
54
57
|
const n = N(e);
|
|
55
58
|
if (n) {
|
|
@@ -57,7 +60,7 @@ function S(r) {
|
|
|
57
60
|
t.titleVariable = e;
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
o.push({
|
|
61
64
|
key: n.key,
|
|
62
65
|
kind: n.kind,
|
|
63
66
|
hidden: e.hidden === !0,
|
|
@@ -68,30 +71,30 @@ function S(r) {
|
|
|
68
71
|
originalIndex: i
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
|
-
}),
|
|
74
|
+
}), o.sort((e, i) => {
|
|
72
75
|
if (e.positionIdx !== i.positionIdx)
|
|
73
76
|
return e.positionIdx - i.positionIdx;
|
|
74
|
-
const n =
|
|
77
|
+
const n = _(e.key), u = _(i.key);
|
|
75
78
|
return n !== u ? n - u : e.originalIndex - i.originalIndex;
|
|
76
79
|
});
|
|
77
|
-
const
|
|
78
|
-
return
|
|
79
|
-
const { key: i, kind: n, hidden: u, legacy:
|
|
80
|
-
switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" &&
|
|
80
|
+
const s = {};
|
|
81
|
+
return o.forEach((e) => {
|
|
82
|
+
const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
|
|
83
|
+
switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
|
|
81
84
|
case "image":
|
|
82
|
-
|
|
85
|
+
s[i] = b(c.theme);
|
|
83
86
|
break;
|
|
84
87
|
case "button":
|
|
85
|
-
|
|
88
|
+
s[i] = O(c.theme);
|
|
86
89
|
break;
|
|
87
90
|
case "text":
|
|
88
91
|
case "custom": {
|
|
89
|
-
const
|
|
90
|
-
|
|
92
|
+
const T = E(c.theme);
|
|
93
|
+
s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
|
|
91
94
|
break;
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
|
-
}), t.perElementStyles =
|
|
97
|
+
}), t.perElementStyles = s, t;
|
|
95
98
|
}
|
|
96
99
|
export {
|
|
97
100
|
S as mapComposition
|