@useinsider/guido 3.14.0 → 3.15.0-beta.0b5dc39
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/useEmailTemplateApplier.js +46 -32
- package/dist/composables/useHtmlValidator.js +105 -100
- package/dist/composables/useStripo.js +30 -29
- package/dist/config/compiler/itemsCompilerRules.js +25 -4
- package/dist/config/compiler/utils/itemsCompilerUtils.js +28 -0
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +47 -45
- package/dist/config/migrator/productNameLinkMigrator.js +27 -0
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Items/block.js +30 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +16 -16
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +26 -22
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +36 -35
- package/dist/extensions/Blocks/Items/template.js +228 -263
- package/dist/extensions/Blocks/Items/utils/nameNode.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- 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/compiler/utils/itemsCompilerUtils.d.ts +12 -0
- package/dist/src/config/migrator/productNameLinkMigrator.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/utils/nameNode.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/stores/dynamic-content.d.ts +8 -0
- package/dist/src/utils/registerUsedDynamicContent.d.ts +8 -0
- package/dist/src/utils/unwrapProductNameLink.d.ts +15 -0
- package/dist/stores/dynamic-content.js +12 -2
- package/dist/utils/pairProductVariables.js +75 -72
- package/dist/utils/registerUsedDynamicContent.js +23 -0
- package/dist/utils/unwrapProductNameLink.js +37 -0
- package/package.json +1 -1
|
@@ -1,43 +1,57 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useActionsApi as d } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "./useConfig.js";
|
|
3
|
+
import { useToaster as h } from "./useToaster.js";
|
|
4
|
+
import { useTranslations as E } from "./useTranslations.js";
|
|
5
|
+
import { ToasterTypeOptions as f } from "../enums/toaster.js";
|
|
6
|
+
import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
|
|
7
|
+
import { flattenDynamicContentList as S } from "../utils/genericUtil.js";
|
|
8
|
+
import { extractUsedDynamicContent as O } from "../utils/registerUsedDynamicContent.js";
|
|
9
|
+
import { ref as U } from "vue";
|
|
10
|
+
const w = 250, o = U({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
|
|
11
|
+
const { updateHtmlAndCss: c } = d(), { showToaster: m } = h(), y = E(), { template: T } = D(), v = A(), g = (e, t) => {
|
|
12
|
+
const a = y(e);
|
|
13
|
+
return a === e ? t : a;
|
|
14
|
+
}, C = (e) => {
|
|
15
|
+
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
|
+
}, l = (e, t, a) => {
|
|
17
|
+
var n;
|
|
18
|
+
o.value = { ...o.value, [e]: "applying" };
|
|
11
19
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
c(t, a), o.value = { ...o.value, [e]: "applied" };
|
|
21
|
+
try {
|
|
22
|
+
const r = S((n = T.value) == null ? void 0 : n.dynamicContentList), p = O(t, r);
|
|
23
|
+
p.length > 0 && v.registerDynamicContent(p);
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
u.get(e) !== t && (u.set(e, t), m({
|
|
27
|
+
type: f.Success,
|
|
28
|
+
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
29
|
+
}));
|
|
30
|
+
} catch (r) {
|
|
31
|
+
o.value = { ...o.value, [e]: "failed" }, m({
|
|
32
|
+
type: f.Error,
|
|
33
|
+
message: r instanceof Error ? r.message : "Failed to apply template"
|
|
20
34
|
});
|
|
21
35
|
}
|
|
22
|
-
},
|
|
23
|
-
const t =
|
|
24
|
-
t && (clearTimeout(t), delete
|
|
36
|
+
}, i = (e) => {
|
|
37
|
+
const t = s[e];
|
|
38
|
+
t && (clearTimeout(t), delete s[e]);
|
|
25
39
|
};
|
|
26
|
-
return { applyStatus:
|
|
27
|
-
t.html && (
|
|
40
|
+
return { applyStatus: o, markPending: C, applyTemplate: (e, t) => {
|
|
41
|
+
t.html && (i(e), l(e, t.html, t.css ?? ""));
|
|
28
42
|
}, applyTemplateDebounced: (e, t) => {
|
|
29
43
|
if (!t.html)
|
|
30
44
|
return;
|
|
31
|
-
|
|
32
|
-
const { html:
|
|
33
|
-
|
|
34
|
-
delete
|
|
35
|
-
},
|
|
45
|
+
i(e);
|
|
46
|
+
const { html: a } = t, n = t.css ?? "";
|
|
47
|
+
s[e] = setTimeout(() => {
|
|
48
|
+
delete s[e], l(e, a, n);
|
|
49
|
+
}, w);
|
|
36
50
|
} };
|
|
37
|
-
},
|
|
38
|
-
Object.values(
|
|
51
|
+
}, G = () => {
|
|
52
|
+
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((c) => delete s[c]), o.value = {};
|
|
39
53
|
};
|
|
40
54
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
G as resetEmailTemplateApplier,
|
|
56
|
+
z as useEmailTemplateApplier
|
|
43
57
|
};
|
|
@@ -1,64 +1,69 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { getIgnoredRecommendationBlockIds as
|
|
3
|
-
import { TemplateTypes as
|
|
4
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
1
|
+
import { useConfig as V } from "./useConfig.js";
|
|
2
|
+
import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
|
+
import { TemplateTypes as W } from "../enums/defaults.js";
|
|
4
|
+
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DATA_ATTRIBUTE_REGEX as $, DYNAMIC_CONTENT_TAG_REGEX as Y, ALLOWED_DYNAMIC_SYSTEM_TOKENS as U, VALID_DYNAMIC_VARIABLE_REGEX as j } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
|
-
import { itemsBlockDynamicVariables as
|
|
7
|
-
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import {
|
|
10
|
-
import { RecommendationRequiredFieldsKey as
|
|
11
|
-
import { useRecommendationStore as
|
|
12
|
-
import { base64EncodeWithSpecialChars as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
+
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as K } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as z } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { filterToProductAttrValue as Z } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
10
|
+
import { RecommendationRequiredFieldsKey as J } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
11
|
+
import { useRecommendationStore as Q } from "../stores/recommendation.js";
|
|
12
|
+
import { base64EncodeWithSpecialChars as ee } from "../utils/base64.js";
|
|
13
|
+
import { computed as te } from "vue";
|
|
14
|
+
import { useHttp as ne } from "./useHttp.js";
|
|
15
|
+
import { useToaster as se } from "./useToaster.js";
|
|
16
|
+
import { useTranslations as re } from "./useTranslations.js";
|
|
17
|
+
const oe = /recommendation-id="(\d+)"/g;
|
|
18
|
+
function ie(s) {
|
|
19
|
+
return [...s.matchAll(oe)].map((m) => m[1]);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
return m.some((f) =>
|
|
21
|
+
function ae(s, m) {
|
|
22
|
+
return m.some((f) => s.startsWith(`${f}_`));
|
|
22
23
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
const m =
|
|
24
|
+
const ce = /^(\d+)_\d+_(.+)$/;
|
|
25
|
+
function le(s) {
|
|
26
|
+
const m = s.match(ce);
|
|
26
27
|
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
const m = new Set(
|
|
30
|
-
return Object.values(
|
|
31
|
-
m.add(
|
|
29
|
+
function me(s) {
|
|
30
|
+
const m = new Set(K);
|
|
31
|
+
return Object.values(s).forEach((f) => {
|
|
32
|
+
m.add(Z(f).toLowerCase());
|
|
32
33
|
}), m;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
const u =
|
|
35
|
+
function ue(s, m, f, o, d) {
|
|
36
|
+
const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
36
37
|
if (!u)
|
|
37
38
|
return [];
|
|
38
|
-
const
|
|
39
|
+
const g = new Set(m.map((h) => h.toLowerCase())), E = [];
|
|
39
40
|
return u.forEach((h) => {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
41
|
+
const p = h.slice(2, -2).trim().toLowerCase();
|
|
42
|
+
if (p !== "" && g.has(p))
|
|
42
43
|
return;
|
|
43
|
-
const y =
|
|
44
|
+
const y = le(p);
|
|
44
45
|
if (y && o.has(y.recoId)) {
|
|
45
46
|
if (!d || d.has(y.attribute))
|
|
46
47
|
return;
|
|
47
|
-
E.push(
|
|
48
|
+
E.push(p);
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
ae(p, f) || p.includes(".") || E.push(p);
|
|
51
52
|
}), E;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
return (
|
|
55
|
-
const d = o.slice(2, -2), u = d.indexOf("|"),
|
|
56
|
-
return
|
|
54
|
+
function de(s) {
|
|
55
|
+
return (s.replace($, "$1").match(Y) ?? []).filter((o) => {
|
|
56
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
|
|
57
|
+
return U.includes(g) ? !1 : j.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
const xe = () => {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
const { showToaster: s } = se(), { post: m } = ne(), { config: f } = V(), o = re(), d = Q(), u = z(), g = te(
|
|
62
|
+
() => {
|
|
63
|
+
var e, t;
|
|
64
|
+
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
65
|
+
}
|
|
66
|
+
), E = async (e) => {
|
|
62
67
|
if (e.size === 0)
|
|
63
68
|
return /* @__PURE__ */ new Set();
|
|
64
69
|
try {
|
|
@@ -66,60 +71,60 @@ const xe = () => {
|
|
|
66
71
|
} catch {
|
|
67
72
|
return null;
|
|
68
73
|
}
|
|
69
|
-
return
|
|
74
|
+
return me(u.filterList);
|
|
70
75
|
}, h = async (e) => {
|
|
71
76
|
const n = await m(
|
|
72
77
|
"/newsletter/template-library/check-template-html-body",
|
|
73
|
-
{ html:
|
|
78
|
+
{ html: ee(e) }
|
|
74
79
|
), { status: r, message: a } = n.data;
|
|
75
|
-
return r ||
|
|
80
|
+
return r || s({
|
|
76
81
|
type: c.Error,
|
|
77
82
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
78
|
-
}), o(
|
|
83
|
+
}), o(P), a === o(X) && s({
|
|
79
84
|
type: c.Error,
|
|
80
85
|
message: o("newsletter.already-in-progress")
|
|
81
86
|
}), r;
|
|
82
|
-
},
|
|
87
|
+
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
|
|
83
88
|
const n = e.match(/({%(.*?)%})/g);
|
|
84
89
|
let r = !0;
|
|
85
|
-
return n !== null && !
|
|
90
|
+
return n !== null && !g.value && n.forEach((a) => {
|
|
86
91
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
92
|
if (i && i.length > 0) {
|
|
88
93
|
const [l] = i;
|
|
89
|
-
|
|
94
|
+
p(l) && !t.includes(l) && (s({
|
|
90
95
|
type: c.Warning,
|
|
91
96
|
message: o("custom-fields.invalid-custom-fields")
|
|
92
97
|
}), r = !1);
|
|
93
98
|
}
|
|
94
99
|
}), r;
|
|
95
|
-
},
|
|
100
|
+
}, A = async (e, t, n) => {
|
|
96
101
|
const r = n ? await h(e) : !0;
|
|
97
|
-
return
|
|
98
|
-
},
|
|
102
|
+
return S(e, t) && r;
|
|
103
|
+
}, T = (e) => e.length > 0 ? !0 : (s({
|
|
99
104
|
type: c.Warning,
|
|
100
105
|
message: o("newsletter.html-content-is-empty")
|
|
101
|
-
}), !1),
|
|
102
|
-
const
|
|
103
|
-
return
|
|
106
|
+
}), !1), w = (e) => {
|
|
107
|
+
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
108
|
+
return t > n && s({
|
|
104
109
|
type: c.Warning,
|
|
105
110
|
message: o("custom-fields.missing-closing-braces")
|
|
106
|
-
}),
|
|
111
|
+
}), t < n && s({
|
|
107
112
|
type: c.Warning,
|
|
108
113
|
message: o("custom-fields.missing-opening-braces")
|
|
109
|
-
}),
|
|
110
|
-
},
|
|
111
|
-
const
|
|
112
|
-
return
|
|
114
|
+
}), t === n;
|
|
115
|
+
}, R = (e) => {
|
|
116
|
+
const t = de(e).length === 0;
|
|
117
|
+
return t || s({
|
|
113
118
|
type: c.Warning,
|
|
114
119
|
message: o("custom-fields.invalid-custom-fields")
|
|
115
|
-
}),
|
|
116
|
-
},
|
|
117
|
-
if (
|
|
120
|
+
}), t;
|
|
121
|
+
}, _ = (e, t, n, r) => {
|
|
122
|
+
if (g.value)
|
|
118
123
|
return !0;
|
|
119
|
-
const a =
|
|
124
|
+
const a = ue(
|
|
120
125
|
e,
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
t,
|
|
127
|
+
ie(e),
|
|
123
128
|
n,
|
|
124
129
|
r
|
|
125
130
|
);
|
|
@@ -129,91 +134,91 @@ const xe = () => {
|
|
|
129
134
|
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
130
135
|
</ul>
|
|
131
136
|
`;
|
|
132
|
-
return
|
|
137
|
+
return s({
|
|
133
138
|
type: c.Error,
|
|
134
139
|
message: o("custom-fields.invalid-custom-fields") + i
|
|
135
140
|
}), !1;
|
|
136
141
|
}
|
|
137
142
|
return !0;
|
|
138
|
-
},
|
|
139
|
-
const
|
|
143
|
+
}, N = (e) => {
|
|
144
|
+
const t = e.match(/{%(.*?)%}/g), n = [];
|
|
140
145
|
let r = !0;
|
|
141
|
-
if (
|
|
142
|
-
const i = a.match(
|
|
143
|
-
(!i || a !==
|
|
146
|
+
if (t && t.forEach((a) => {
|
|
147
|
+
const i = a.match(G), l = a.match(H), C = (i == null ? void 0 : i.join("")) || "";
|
|
148
|
+
(!i || a !== C) && !l && (s({
|
|
144
149
|
type: c.Error,
|
|
145
150
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
|
-
}), r = !1), i && i.forEach((
|
|
147
|
-
|
|
151
|
+
}), r = !1), i && i.forEach((v) => {
|
|
152
|
+
v.trim() === "=" && (s({
|
|
148
153
|
type: c.Error,
|
|
149
154
|
message: o("custom-conditions.wrong-equality-operators")
|
|
150
155
|
}), r = !1);
|
|
151
|
-
const I =
|
|
152
|
-
I && I.forEach((
|
|
153
|
-
y(
|
|
156
|
+
const I = v.match(/^[a-zA-Z]*$/g);
|
|
157
|
+
I && I.forEach((b) => {
|
|
158
|
+
y(b) && n.push(b);
|
|
154
159
|
});
|
|
155
160
|
});
|
|
156
161
|
}), n.length) {
|
|
157
162
|
const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
|
|
158
|
-
a.length !== i.length && (
|
|
163
|
+
a.length !== i.length && (s({
|
|
159
164
|
type: c.Error,
|
|
160
165
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
166
|
}), r = !1);
|
|
162
167
|
}
|
|
163
168
|
return r;
|
|
164
|
-
},
|
|
165
|
-
const
|
|
166
|
-
return r ||
|
|
169
|
+
}, x = (e) => {
|
|
170
|
+
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
|
|
171
|
+
return r || s({
|
|
167
172
|
type: c.Warning,
|
|
168
173
|
message: o("custom-conditions.no-space-after-braces")
|
|
169
174
|
}), r;
|
|
170
|
-
},
|
|
175
|
+
}, O = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
171
176
|
type: c.Warning,
|
|
172
177
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
|
-
}), !1) : !0,
|
|
178
|
+
}), !1) : !0, k = () => u.hasInvalidBlock() ? (s({
|
|
174
179
|
type: c.Error,
|
|
175
|
-
message: o(
|
|
176
|
-
}), !1) : !0,
|
|
180
|
+
message: o(J)
|
|
181
|
+
}), !1) : !0, B = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
177
182
|
type: c.Error,
|
|
178
183
|
message: o("newsletter.fill-all-necessary-fields")
|
|
179
|
-
}), !1) : !0,
|
|
180
|
-
const
|
|
181
|
-
return e.match(
|
|
184
|
+
}), !1) : !0, D = (e) => {
|
|
185
|
+
const t = /src="[^"]*\.(svg|pst)"/gm;
|
|
186
|
+
return e.match(t) === null ? !0 : (s({
|
|
182
187
|
type: c.Error,
|
|
183
188
|
message: o("newsletter.invalid-image-type")
|
|
184
189
|
}), !1);
|
|
185
|
-
},
|
|
190
|
+
}, F = (e) => {
|
|
186
191
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
187
192
|
return Array.from(r).find((i) => {
|
|
188
193
|
var l;
|
|
189
194
|
return !((l = i.id) != null && l.trim());
|
|
190
|
-
}) ? (
|
|
195
|
+
}) ? (s({
|
|
191
196
|
type: c.Error,
|
|
192
197
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
198
|
}), !1) : !0;
|
|
194
|
-
},
|
|
199
|
+
}, L = (e) => {
|
|
195
200
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
196
201
|
return Array.from(r).find((i) => {
|
|
197
202
|
var l;
|
|
198
203
|
return !((l = i.id) != null && l.trim());
|
|
199
|
-
}) ? (
|
|
204
|
+
}) ? (s({
|
|
200
205
|
type: c.Error,
|
|
201
206
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
207
|
}), !1) : !0;
|
|
203
208
|
};
|
|
204
|
-
return { validateHtml: async (e,
|
|
205
|
-
var
|
|
209
|
+
return { validateHtml: async (e, t, n = !1) => {
|
|
210
|
+
var C, v;
|
|
206
211
|
const r = [
|
|
207
|
-
...
|
|
208
|
-
...
|
|
209
|
-
...((
|
|
210
|
-
], a =
|
|
211
|
-
return await
|
|
212
|
+
...t.map((I) => I.value),
|
|
213
|
+
...q,
|
|
214
|
+
...((v = (C = f.value) == null ? void 0 : C.template) == null ? void 0 : v.customFieldAttributes) ?? []
|
|
215
|
+
], a = M(e), i = await E(a);
|
|
216
|
+
return await A(e, r, n) && T(e) && w(e) && R(e) && _(e, r, a, i) && N(e) && x(e) && O(e) && k() && B() && D(e) && F(e) && L(e);
|
|
212
217
|
} };
|
|
213
218
|
};
|
|
214
219
|
export {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
me as buildPartnerAttributeNameSet,
|
|
221
|
+
ue as findInvalidCustomFields,
|
|
222
|
+
le as parseRecommendationVariable,
|
|
218
223
|
xe as useHtmlValidator
|
|
219
224
|
};
|
|
@@ -16,22 +16,22 @@ import { useEditorStore as b } from "../stores/editor.js";
|
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken:
|
|
19
|
+
const Ce = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: B } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var l;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, document.body.appendChild(
|
|
26
|
+
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`, e = document.createElement("script");
|
|
27
|
+
e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
|
|
28
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
|
+
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const
|
|
34
|
+
const e = b(), { html: l, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
|
|
35
35
|
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
@@ -57,6 +57,7 @@ const Ct = () => {
|
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
59
59
|
displayHiddenPreheader: !1,
|
|
60
|
+
keepModuleStylesEnabled: !0,
|
|
60
61
|
displayTitle: !1,
|
|
61
62
|
displayUTM: !1,
|
|
62
63
|
selectElementAfterDrop: !0,
|
|
@@ -77,38 +78,38 @@ const Ct = () => {
|
|
|
77
78
|
)
|
|
78
79
|
}
|
|
79
80
|
],
|
|
80
|
-
async onTokenRefreshRequest(
|
|
81
|
+
async onTokenRefreshRequest(t) {
|
|
81
82
|
try {
|
|
82
|
-
const d = await
|
|
83
|
-
|
|
83
|
+
const d = await M();
|
|
84
|
+
t(d);
|
|
84
85
|
} catch (d) {
|
|
85
86
|
p(d, "Failed to refresh token");
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
onTemplateLoaded() {
|
|
89
90
|
try {
|
|
90
|
-
const { importCss:
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
92
|
+
t(), d(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
|
+
e.hasChanges = !1;
|
|
93
94
|
}, 1e3);
|
|
94
|
-
} catch (
|
|
95
|
-
p(
|
|
95
|
+
} catch (t) {
|
|
96
|
+
p(t, "Failed to load custom interface appearance");
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
onCodeEditorVisibilityChanged(
|
|
99
|
-
|
|
99
|
+
onCodeEditorVisibilityChanged(t) {
|
|
100
|
+
e.isCodeEditorOpen = t;
|
|
100
101
|
},
|
|
101
|
-
onEditorVisualModeChanged(
|
|
102
|
-
|
|
102
|
+
onEditorVisualModeChanged(t) {
|
|
103
|
+
e.editorVisualMode = t.toLowerCase();
|
|
103
104
|
},
|
|
104
|
-
onVersionHistoryVisibilityChanged(
|
|
105
|
-
|
|
105
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
106
|
+
e.isVersionHistoryOpen = t;
|
|
106
107
|
},
|
|
107
108
|
onDataChanged() {
|
|
108
|
-
|
|
109
|
+
e.hasChanges = !0;
|
|
109
110
|
},
|
|
110
|
-
onEvent:
|
|
111
|
-
onModuleAdd:
|
|
111
|
+
onEvent: B,
|
|
112
|
+
onModuleAdd: F,
|
|
112
113
|
notifications: V(),
|
|
113
114
|
ignoreClickOutsideSelectors: [
|
|
114
115
|
"#guido-dynamic-content-modal",
|
|
@@ -124,11 +125,11 @@ const Ct = () => {
|
|
|
124
125
|
const a = b();
|
|
125
126
|
try {
|
|
126
127
|
await f();
|
|
127
|
-
const [r,
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const [r, e] = await Promise.all([
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
130
131
|
]);
|
|
131
|
-
a.syncModulesEnabled =
|
|
132
|
+
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
132
133
|
} catch {
|
|
133
134
|
a.loadingStatus = !1, k({
|
|
134
135
|
type: X.Error,
|
|
@@ -145,5 +146,5 @@ const Ct = () => {
|
|
|
145
146
|
} };
|
|
146
147
|
};
|
|
147
148
|
export {
|
|
148
|
-
|
|
149
|
+
Ce as useStripo
|
|
149
150
|
};
|
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
import { pairProductVariables as
|
|
2
|
-
|
|
1
|
+
import { pairProductVariables as o } from "../../utils/pairProductVariables.js";
|
|
2
|
+
import { wrapHiddenPriceTdsForOutlook as r, MSO_ITEMS_HIDE_START as e, MSO_ITEMS_HIDE_END as t } from "./utils/itemsCompilerUtils.js";
|
|
3
|
+
const a = [
|
|
3
4
|
{
|
|
4
5
|
id: "pair-product-variables",
|
|
5
6
|
description: "Replace product default values with template variables",
|
|
6
7
|
type: "custom",
|
|
7
|
-
processor:
|
|
8
|
+
processor: o,
|
|
8
9
|
priority: 60
|
|
9
10
|
// After recommendation rules (priority 50-53)
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "wrap-hidden-price-mso-conditional",
|
|
14
|
+
// SD-147597: Outlook ignores display:none on <td>, so the horizontal layout's
|
|
15
|
+
// hidden price fallback renders too — duplicate price. Mark the hidden td(s)
|
|
16
|
+
// with safe placeholder comments and collapse them inline for web-engine Outlook.
|
|
17
|
+
description: "Mark hidden Items price tds for Outlook conditional hiding",
|
|
18
|
+
type: "custom",
|
|
19
|
+
processor: r,
|
|
20
|
+
priority: 65
|
|
21
|
+
// After pair-product-variables (60), before outlook rules (70+)
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "swap-items-mso-markers",
|
|
25
|
+
// Injecting the delicate `<!-- -->` ghost token LAST (after reco minify P99
|
|
26
|
+
// and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
|
|
27
|
+
description: "Swap Items MSO markers into [if !mso] conditional comments",
|
|
28
|
+
type: "custom",
|
|
29
|
+
processor: (i) => i.replaceAll(`<!--${e}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${t}-->`, "<!--<![endif]-->"),
|
|
30
|
+
priority: 101
|
|
10
31
|
}
|
|
11
32
|
];
|
|
12
33
|
export {
|
|
13
|
-
|
|
34
|
+
a as itemsCompilerRules
|
|
14
35
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const p = "MSO_ITEMS_HIDE_START", E = "MSO_ITEMS_HIDE_END", u = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", _ = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price";
|
|
2
|
+
function T(t) {
|
|
3
|
+
if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
|
|
4
|
+
return t;
|
|
5
|
+
const i = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(i, "text/html");
|
|
6
|
+
let n = !1;
|
|
7
|
+
if (r.querySelectorAll(_).forEach((e) => {
|
|
8
|
+
var s, a;
|
|
9
|
+
const o = e.getAttribute("style") || "";
|
|
10
|
+
if (!/display\s*:\s*none/i.test(o))
|
|
11
|
+
return;
|
|
12
|
+
const c = e.previousSibling;
|
|
13
|
+
if (((c == null ? void 0 : c.nodeType) !== Node.COMMENT_NODE || c.data !== p) && ((s = e.parentNode) == null || s.insertBefore(r.createComment(p), e), (a = e.parentNode) == null || a.insertBefore(r.createComment(E), e.nextSibling)), !/mso-hide/i.test(o)) {
|
|
14
|
+
const d = o.trim().endsWith(";") ? " " : "; ";
|
|
15
|
+
e.setAttribute("style", `${o}${d}${u}`);
|
|
16
|
+
}
|
|
17
|
+
n = !0;
|
|
18
|
+
}), !n)
|
|
19
|
+
return t;
|
|
20
|
+
const l = i.match(/<!DOCTYPE[^>]*>/i);
|
|
21
|
+
return ((l ? `${l[0]}
|
|
22
|
+
` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
E as MSO_ITEMS_HIDE_END,
|
|
26
|
+
p as MSO_ITEMS_HIDE_START,
|
|
27
|
+
T as wrapHiddenPriceTdsForOutlook
|
|
28
|
+
};
|
|
@@ -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
|
};
|