@useinsider/guido 3.27.1 → 3.28.0-beta.95524de
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/README.md +10 -5
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +86 -83
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js +24 -0
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue2.js +59 -0
- package/dist/composables/useAmbiguousDynamicContent.js +72 -0
- package/dist/composables/useHtmlCompiler.js +21 -17
- package/dist/composables/useHtmlValidator.js +71 -71
- package/dist/composables/useModuleRepair.js +63 -32
- package/dist/composables/useSaveValidation.js +80 -80
- package/dist/composables/useStripo.js +44 -43
- package/dist/config/compiler/htmlCompilerRules.js +16 -6
- package/dist/config/compiler/pongoCompilerRules.js +13 -0
- package/dist/config/migrator/itemsBlockMigrator.js +220 -178
- package/dist/enums/dynamic-content.js +4 -0
- package/dist/enums/html-validator.js +8 -7
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/generic.d.ts +7 -0
- package/dist/src/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.d.ts +2 -0
- package/dist/src/composables/useAmbiguousDynamicContent.d.ts +7 -0
- package/dist/src/composables/useModuleRepair.d.ts +6 -0
- package/dist/src/config/compiler/pongoCompilerRules.d.ts +2 -0
- package/dist/src/enums/dynamic-content.d.ts +3 -0
- package/dist/src/enums/html-validator.d.ts +1 -0
- package/dist/src/stores/module-dynamic-content.d.ts +30 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +20 -18
- package/dist/src/utils/dynamicContentPendingMarker.d.ts +2 -0
- package/dist/src/utils/genericUtil.d.ts +4 -8
- package/dist/stores/module-dynamic-content.js +20 -0
- package/dist/utils/dynamicContentConverter.js +41 -27
- package/dist/utils/dynamicContentPendingMarker.js +6 -0
- package/dist/utils/genericUtil.js +39 -39
- package/package.json +1 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { getIgnoredRecommendationBlockIds as Y } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
-
import { CanNotMakeAnyChangesForRunningKey as k,
|
|
2
|
+
import { CanNotMakeAnyChangesForRunningKey as k, CONDITION_TAG_REGEX as U, DISPLAY_CONDITIONS_REGEX as M, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
|
|
3
3
|
import { SaveValidationRule as o } from "../enums/save-validation.js";
|
|
4
4
|
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
6
|
import { itemsBlockDynamicVariables as W } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getInvalidFields as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useRecommendationStore as
|
|
7
|
+
import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { getInvalidFields as H, STRATEGY_FIELD_KEY as V, RecommendationAssignStrategyKey as X, RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
10
|
+
import { useConfigStore as z } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as $ } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useRecommendationStore as Q } from "../stores/recommendation.js";
|
|
13
13
|
import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
|
|
14
|
-
import { escapeHtml as
|
|
15
|
-
import { useTemplatePreparation as
|
|
16
|
-
import { useActionsApi as
|
|
17
|
-
import { useConfig as
|
|
18
|
-
import { useHtmlCompiler as
|
|
19
|
-
import { buildPartnerAttributeNameSet as
|
|
20
|
-
import { useHttp as
|
|
21
|
-
import { useTranslations as
|
|
22
|
-
import { findInvalidCouponBlocks as
|
|
23
|
-
import { hasInsiderUnsubscribeCode as
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
return
|
|
14
|
+
import { escapeHtml as Z } from "../utils/htmlEscape.js";
|
|
15
|
+
import { useTemplatePreparation as J } from "../utils/templatePreparation.js";
|
|
16
|
+
import { useActionsApi as ee } from "./useActionsApi.js";
|
|
17
|
+
import { useConfig as te } from "./useConfig.js";
|
|
18
|
+
import { useHtmlCompiler as ne } from "./useHtmlCompiler.js";
|
|
19
|
+
import { buildPartnerAttributeNameSet as ie, getInvalidDynamicContentTags as oe, getRecommendationBlockIds as re, findInvalidCustomFields as se } from "./useHtmlValidator.js";
|
|
20
|
+
import { useHttp as ae } from "./useHttp.js";
|
|
21
|
+
import { useTranslations as ce } from "./useTranslations.js";
|
|
22
|
+
import { findInvalidCouponBlocks as le, COUPON_TAG_MODIFIED_KEY as ue } from "./validators/useCouponBlockValidator.js";
|
|
23
|
+
import { hasInsiderUnsubscribeCode as me, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as de, findDuplicateUnsubPageTypes as pe, countUnsubBlocksWithoutPage as ge, EMPTY_BLOCK_KEY as fe } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
+
const ye = "newsletter.html-content-is-empty", Ee = "custom-fields.missing-closing-braces", Ie = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Se = "newsletter.display-conditions-invalid-syntax", _e = "custom-conditions.wrong-equality-operators", Ce = "custom-conditions.missing-if-endif-tag", he = "custom-conditions.no-space-after-braces", ke = "custom-conditions.no-braces-inside-if-tag", Te = "newsletter.fill-all-necessary-fields", Fe = "newsletter.invalid-image-type", be = "unsubscribe-templates.select-checkbox-groups", Re = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Ne = "/newsletter/template-library/check-template-html-body", Oe = /src="[^"]*\.(svg|pst)"/gm, N = /({%(.*?)%})/g, Le = ["if", "endif", "else", "elif", "now"], Ae = (t) => !Le.includes(t.toLowerCase()), De = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
|
+
function ve(t) {
|
|
26
|
+
return le(t).map((i) => ({
|
|
27
27
|
rule: o.CouponTagModified,
|
|
28
28
|
type: r.Warning,
|
|
29
|
-
key:
|
|
29
|
+
key: ue,
|
|
30
30
|
detail: i
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function Ke(t) {
|
|
34
|
+
return pe(t).map((i) => ({
|
|
35
35
|
rule: o.DuplicateUnsubBlock,
|
|
36
36
|
type: r.Error,
|
|
37
37
|
key: i.messageKey
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return Array.from({ length:
|
|
40
|
+
function Be(t) {
|
|
41
|
+
return Array.from({ length: ge(t) }, () => ({
|
|
42
42
|
rule: o.UnsubBlockMissingTemplate,
|
|
43
43
|
type: r.Warning,
|
|
44
|
-
key:
|
|
44
|
+
key: fe
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function we(t) {
|
|
48
|
+
return me(t) ? [{
|
|
49
49
|
rule: o.ExternallyManagedUnsubscribe,
|
|
50
50
|
type: r.Warning,
|
|
51
|
-
key:
|
|
51
|
+
key: de
|
|
52
52
|
}] : [];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const n = t.match(
|
|
54
|
+
function Ye(t, i) {
|
|
55
|
+
const n = t.match(N);
|
|
56
56
|
if (!n)
|
|
57
57
|
return [];
|
|
58
58
|
const u = [];
|
|
@@ -60,7 +60,7 @@ function we(t, i) {
|
|
|
60
60
|
const c = m.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
61
61
|
if (c && c.length > 0) {
|
|
62
62
|
const [d] = c;
|
|
63
|
-
|
|
63
|
+
Ae(d) && !i.includes(d) && u.push({
|
|
64
64
|
rule: o.CustomFieldScript,
|
|
65
65
|
type: r.Warning,
|
|
66
66
|
key: S,
|
|
@@ -69,32 +69,32 @@ function we(t, i) {
|
|
|
69
69
|
}
|
|
70
70
|
}), u;
|
|
71
71
|
}
|
|
72
|
-
function Ye(t) {
|
|
73
|
-
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: fe }];
|
|
74
|
-
}
|
|
75
72
|
function Ue(t) {
|
|
73
|
+
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: ye }];
|
|
74
|
+
}
|
|
75
|
+
function Me(t) {
|
|
76
76
|
const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
|
|
77
77
|
return i > n ? [{
|
|
78
78
|
rule: o.MismatchedBraces,
|
|
79
79
|
type: r.Warning,
|
|
80
|
-
key:
|
|
80
|
+
key: Ee
|
|
81
81
|
}] : i < n ? [{
|
|
82
82
|
rule: o.MismatchedBraces,
|
|
83
83
|
type: r.Warning,
|
|
84
|
-
key:
|
|
84
|
+
key: Ie
|
|
85
85
|
}] : [];
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
87
|
+
function xe(t) {
|
|
88
|
+
return oe(t).map((i) => ({
|
|
89
89
|
rule: o.InvalidDynamicTag,
|
|
90
90
|
type: r.Warning,
|
|
91
91
|
key: S,
|
|
92
92
|
detail: i
|
|
93
93
|
}));
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const m =
|
|
97
|
-
return
|
|
95
|
+
function Ge(t, i, n, u) {
|
|
96
|
+
const m = re(t);
|
|
97
|
+
return se(t, i, m, n, u).map((c) => ({
|
|
98
98
|
rule: o.InvalidCustomField,
|
|
99
99
|
type: r.Error,
|
|
100
100
|
key: S,
|
|
@@ -102,21 +102,21 @@ function xe(t, i, n, u) {
|
|
|
102
102
|
}));
|
|
103
103
|
}
|
|
104
104
|
function We(t) {
|
|
105
|
-
const i = t.match(
|
|
105
|
+
const i = t.match(U), n = [], u = [];
|
|
106
106
|
if (i && i.forEach((m) => {
|
|
107
|
-
const c = m.match(
|
|
107
|
+
const c = m.match(M), d = m.match(x), I = (c == null ? void 0 : c.join("")) || "";
|
|
108
108
|
(!c || m !== I) && !d && u.push({
|
|
109
109
|
rule: o.ConditionsSyntax,
|
|
110
110
|
type: r.Error,
|
|
111
|
-
key:
|
|
111
|
+
key: Se,
|
|
112
112
|
detail: m
|
|
113
113
|
}), c && c.forEach((g) => {
|
|
114
114
|
g.trim() === "=" && u.push({
|
|
115
115
|
rule: o.WrongEqualityOperator,
|
|
116
116
|
type: r.Error,
|
|
117
|
-
key:
|
|
117
|
+
key: _e
|
|
118
118
|
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
119
|
-
|
|
119
|
+
De(f) && n.push(f);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
}), n.length) {
|
|
@@ -124,31 +124,31 @@ function We(t) {
|
|
|
124
124
|
m !== c && u.push({
|
|
125
125
|
rule: o.MissingIfEndif,
|
|
126
126
|
type: r.Error,
|
|
127
|
-
key:
|
|
127
|
+
key: Ce
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
return u;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Pe(t) {
|
|
133
133
|
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
134
134
|
return i === n ? [] : [{
|
|
135
135
|
rule: o.ConditionTagSpacing,
|
|
136
136
|
type: r.Warning,
|
|
137
|
-
key:
|
|
137
|
+
key: he
|
|
138
138
|
}];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
return (t.match(
|
|
140
|
+
function qe(t) {
|
|
141
|
+
return (t.match(N) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
|
|
142
142
|
rule: o.BracesInsideIfTag,
|
|
143
143
|
type: r.Warning,
|
|
144
|
-
key:
|
|
144
|
+
key: ke
|
|
145
145
|
}];
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return (t.match(
|
|
147
|
+
function He(t) {
|
|
148
|
+
return (t.match(Oe) ?? []).map((i) => ({
|
|
149
149
|
rule: o.InvalidImageType,
|
|
150
150
|
type: r.Error,
|
|
151
|
-
key:
|
|
151
|
+
key: Fe,
|
|
152
152
|
detail: i
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
@@ -159,12 +159,12 @@ function R(t, i, n, u) {
|
|
|
159
159
|
return !((d = c.id) != null && d.trim());
|
|
160
160
|
}).map(() => ({ rule: n, type: r.Error, key: u }));
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
const { config: t, isFeatureEnabled: i } =
|
|
162
|
+
const yt = () => {
|
|
163
|
+
const { config: t, isFeatureEnabled: i } = te(), n = ce(), { post: u } = ae(), { getCompiledEmail: m, getTemplateData: c } = ee(), { compileHtml: d } = ne(), { hydrateRecommendationStore: I } = J(), g = $(), f = Q(), y = q(), O = z(), L = (e) => ({
|
|
164
164
|
rule: e.rule,
|
|
165
165
|
type: e.type,
|
|
166
166
|
detail: e.detail,
|
|
167
|
-
message: "key" in e ? n(e.key) :
|
|
167
|
+
message: "key" in e ? n(e.key) : Z(e.message)
|
|
168
168
|
}), A = async (e) => {
|
|
169
169
|
if (e.size === 0)
|
|
170
170
|
return /* @__PURE__ */ new Set();
|
|
@@ -173,10 +173,10 @@ const ft = () => {
|
|
|
173
173
|
} catch {
|
|
174
174
|
return null;
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return ie(y.filterList);
|
|
177
177
|
}, D = async (e) => {
|
|
178
178
|
try {
|
|
179
|
-
const a = await u(
|
|
179
|
+
const a = await u(Ne, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
|
|
180
180
|
return s || p.push({
|
|
181
181
|
rule: o.InvalidLinks,
|
|
182
182
|
type: r.Error,
|
|
@@ -225,17 +225,17 @@ const ft = () => {
|
|
|
225
225
|
}];
|
|
226
226
|
}
|
|
227
227
|
}, K = () => {
|
|
228
|
-
const e = Object.values(y.blockStates).map((s) =>
|
|
229
|
-
const l = s.every((p) => p ===
|
|
228
|
+
const e = Object.values(y.blockStates).map((s) => H(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
|
|
229
|
+
const l = s.every((p) => p === V);
|
|
230
230
|
return {
|
|
231
231
|
rule: o.RecommendationRequiredFields,
|
|
232
232
|
type: l ? r.Warning : r.Error,
|
|
233
|
-
key: l ?
|
|
233
|
+
key: l ? X : j
|
|
234
234
|
};
|
|
235
235
|
}), a = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((l) => l.value === "")).map(() => ({
|
|
236
236
|
rule: o.RecommendationFilters,
|
|
237
237
|
type: r.Error,
|
|
238
|
-
key:
|
|
238
|
+
key: Te
|
|
239
239
|
}));
|
|
240
240
|
return [...e, ...a];
|
|
241
241
|
}, B = async (e, a) => {
|
|
@@ -244,39 +244,39 @@ const ft = () => {
|
|
|
244
244
|
...a.map((w) => w.value),
|
|
245
245
|
...W,
|
|
246
246
|
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
247
|
-
], l = Y(e), p = await A(l), { isTransactional: E } =
|
|
247
|
+
], l = Y(e), p = await A(l), { isTransactional: E } = O;
|
|
248
248
|
return [
|
|
249
249
|
...await D(e),
|
|
250
|
-
...E ? [] :
|
|
251
|
-
...Ye(e),
|
|
250
|
+
...E ? [] : Ye(e, s),
|
|
252
251
|
...Ue(e),
|
|
253
252
|
...Me(e),
|
|
254
|
-
...
|
|
253
|
+
...xe(e),
|
|
254
|
+
...E ? [] : Ge(e, s, l, p),
|
|
255
255
|
...We(e),
|
|
256
|
-
...Ge(e),
|
|
257
256
|
...Pe(e),
|
|
258
|
-
...K(),
|
|
259
257
|
...qe(e),
|
|
258
|
+
...K(),
|
|
259
|
+
...He(e),
|
|
260
260
|
...R(
|
|
261
261
|
e,
|
|
262
|
-
|
|
262
|
+
G,
|
|
263
263
|
o.CheckboxUnsubGroup,
|
|
264
|
-
|
|
264
|
+
be
|
|
265
265
|
),
|
|
266
266
|
...R(
|
|
267
267
|
e,
|
|
268
|
-
|
|
268
|
+
P,
|
|
269
269
|
o.RadioButtonUnsubGroup,
|
|
270
|
-
|
|
270
|
+
Re
|
|
271
271
|
)
|
|
272
272
|
];
|
|
273
273
|
}, _ = async (e, a, s) => [
|
|
274
|
-
...De(e),
|
|
275
|
-
...i("blockUnsubscribeLinks") ? Be(s) : [],
|
|
276
274
|
...ve(e),
|
|
275
|
+
...i("blockUnsubscribeLinks") ? we(s) : [],
|
|
277
276
|
...Ke(e),
|
|
277
|
+
...Be(e),
|
|
278
278
|
...i("liquidSyntax") ? await v(e) : await B(e, a)
|
|
279
|
-
].map(
|
|
279
|
+
].map(L);
|
|
280
280
|
return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
|
|
281
281
|
const { html: e } = await c();
|
|
282
282
|
await I(e);
|
|
@@ -285,5 +285,5 @@ const ft = () => {
|
|
|
285
285
|
} };
|
|
286
286
|
};
|
|
287
287
|
export {
|
|
288
|
-
|
|
288
|
+
yt as useSaveValidation
|
|
289
289
|
};
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useActionsApi as j } from "./useActionsApi.js";
|
|
2
|
+
import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
|
|
3
|
+
import { useBlocksConfig as $ } from "./useBlocksConfig.js";
|
|
4
|
+
import { useConfig as G } from "./useConfig.js";
|
|
4
5
|
import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useModuleRepair as
|
|
7
|
-
import { useStripoEventHandler as
|
|
8
|
-
import { useStripoNotifications as
|
|
9
|
-
import { useToaster as
|
|
10
|
-
import { localePatch as
|
|
6
|
+
import { useFullStoryBridge as X } from "./useFullStoryBridge.js";
|
|
7
|
+
import { useModuleRepair as J } from "./useModuleRepair.js";
|
|
8
|
+
import { useStripoEventHandler as K } from "./useStripoEventHandler.js";
|
|
9
|
+
import { useStripoNotifications as Q } from "./useStripoNotifications.js";
|
|
10
|
+
import { useToaster as W } from "./useToaster.js";
|
|
11
|
+
import { localePatch as Y } from "../config/i18n/index.js";
|
|
11
12
|
import { en as B } from "../config/i18n/en/index.js";
|
|
12
|
-
import { ToasterTypeOptions as
|
|
13
|
-
import { useStripoApi as
|
|
14
|
-
import
|
|
13
|
+
import { ToasterTypeOptions as Z } from "../enums/toaster.js";
|
|
14
|
+
import { useStripoApi as ee } from "../services/stripoApi.js";
|
|
15
|
+
import te from "../static/styles/customEditorStyle.css.js";
|
|
15
16
|
import { useEditorStore as T } from "../stores/editor.js";
|
|
16
|
-
import { buildMergeTagEntries as
|
|
17
|
-
import { getStripoRuntimeBaseUrl as
|
|
17
|
+
import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
|
|
18
|
+
import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
|
|
18
19
|
let d = null, F = !1;
|
|
19
|
-
const
|
|
20
|
-
const { features: u, template: m, isFeatureEnabled: p } =
|
|
20
|
+
const ve = (t) => {
|
|
21
|
+
const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, s) => {
|
|
21
22
|
if (document.getElementById("UiEditorScript")) {
|
|
22
23
|
n();
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
const i =
|
|
26
|
+
const i = ie();
|
|
26
27
|
if (!i) {
|
|
27
|
-
|
|
28
|
+
s(
|
|
28
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
29
30
|
);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
-
e.id = "UiEditorScript", e.type = "module", e.src =
|
|
33
|
+
const a = `${i}UIEditor.js`, e = document.createElement("script");
|
|
34
|
+
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
34
35
|
F = !0, n();
|
|
35
36
|
}, e.onerror = () => {
|
|
36
|
-
e.remove(),
|
|
37
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
37
38
|
}, document.body.appendChild(e);
|
|
38
39
|
}), d.catch(() => {
|
|
39
40
|
d = null;
|
|
40
|
-
}), d),
|
|
41
|
+
}), d), x = async (n, s, i, a = [], e = !1, c = !1) => {
|
|
41
42
|
var w, k, b, _;
|
|
42
|
-
const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions:
|
|
43
|
+
const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
|
|
43
44
|
t.mark("blocks_config_ready");
|
|
44
|
-
const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0,
|
|
45
|
+
const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
45
46
|
t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
|
|
46
47
|
document.querySelector("#guido-editor"),
|
|
47
48
|
{
|
|
48
|
-
metadata:
|
|
49
|
+
metadata: s,
|
|
49
50
|
html: S,
|
|
50
51
|
css: y,
|
|
51
52
|
forceRecreate: C,
|
|
@@ -58,11 +59,11 @@ const ke = (t) => {
|
|
|
58
59
|
customAppearanceMergetags: !p("liquidSyntax"),
|
|
59
60
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
60
61
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
61
|
-
customViewStyles:
|
|
62
|
+
customViewStyles: te,
|
|
62
63
|
conditionsEnabled: h,
|
|
63
64
|
customConditionsEnabled: h,
|
|
64
65
|
enableXSSSecurity: !0,
|
|
65
|
-
modulesDisabled:
|
|
66
|
+
modulesDisabled: H,
|
|
66
67
|
syncModulesEnabled: e,
|
|
67
68
|
messageSettingsEnabled: !0,
|
|
68
69
|
displayGmailAnnotations: !0,
|
|
@@ -73,18 +74,18 @@ const ke = (t) => {
|
|
|
73
74
|
copyPasteEnabled: !1,
|
|
74
75
|
selectElementAfterDrop: !0,
|
|
75
76
|
sameFontSizeForOutlook: !0,
|
|
76
|
-
allowedScriptSourceDomains:
|
|
77
|
+
allowedScriptSourceDomains: M,
|
|
77
78
|
...E ? { baseBlocks: E } : {},
|
|
78
79
|
editorFonts: {
|
|
79
80
|
showDefaultStandardFonts: !0,
|
|
80
81
|
showDefaultNotStandardFonts: !0,
|
|
81
|
-
customFonts:
|
|
82
|
+
customFonts: a
|
|
82
83
|
},
|
|
83
84
|
mergeTags: [
|
|
84
85
|
{
|
|
85
|
-
entries:
|
|
86
|
+
entries: oe(
|
|
86
87
|
i.preselectedDynamicContentList,
|
|
87
|
-
|
|
88
|
+
re((_ = m.value) == null ? void 0 : _.dynamicContentList),
|
|
88
89
|
p("liquidSyntax")
|
|
89
90
|
)
|
|
90
91
|
}
|
|
@@ -100,8 +101,8 @@ const ke = (t) => {
|
|
|
100
101
|
},
|
|
101
102
|
onTemplateLoaded() {
|
|
102
103
|
try {
|
|
103
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } =
|
|
104
|
-
v().importCss(), r(),
|
|
104
|
+
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
|
|
105
|
+
v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
105
106
|
o.hasChanges = !1;
|
|
106
107
|
}, 1e3), t.markReady();
|
|
107
108
|
} catch (r) {
|
|
@@ -120,9 +121,9 @@ const ke = (t) => {
|
|
|
120
121
|
onDataChanged() {
|
|
121
122
|
o.hasChanges = !0, o.changeSeq += 1;
|
|
122
123
|
},
|
|
123
|
-
onEvent:
|
|
124
|
-
onModuleAdd:
|
|
125
|
-
notifications:
|
|
124
|
+
onEvent: U,
|
|
125
|
+
onModuleAdd: V,
|
|
126
|
+
notifications: q(),
|
|
126
127
|
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
127
128
|
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
128
129
|
ignoreClickOutsideSelectors: [
|
|
@@ -132,23 +133,23 @@ const ke = (t) => {
|
|
|
132
133
|
".in-modal-v2-wrapper",
|
|
133
134
|
".in-toasts-wrapper"
|
|
134
135
|
],
|
|
135
|
-
extensions:
|
|
136
|
-
localePatch:
|
|
136
|
+
extensions: O,
|
|
137
|
+
localePatch: Y
|
|
137
138
|
}
|
|
138
139
|
);
|
|
139
140
|
};
|
|
140
|
-
return { initPlugin: async (n,
|
|
141
|
+
return { initPlugin: async (n, s, i, a = !1) => {
|
|
141
142
|
const e = T();
|
|
142
143
|
try {
|
|
143
144
|
t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
|
|
144
145
|
const [c, o] = await Promise.all([
|
|
145
146
|
R(),
|
|
146
|
-
|
|
147
|
+
D()
|
|
147
148
|
]);
|
|
148
|
-
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await
|
|
149
|
+
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, s, i, c, o, a);
|
|
149
150
|
} catch {
|
|
150
151
|
e.loadingStatus = !1, A({
|
|
151
|
-
type:
|
|
152
|
+
type: Z.Error,
|
|
152
153
|
message: B["An error has occurred. Please report the error code to support."],
|
|
153
154
|
actionButton: {
|
|
154
155
|
text: B["Reload page"],
|
|
@@ -162,5 +163,5 @@ const ke = (t) => {
|
|
|
162
163
|
} };
|
|
163
164
|
};
|
|
164
165
|
export {
|
|
165
|
-
|
|
166
|
+
ve as useStripo
|
|
166
167
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { PENDING_MARKER_PATTERN as c } from "../../utils/dynamicContentPendingMarker.js";
|
|
2
|
+
import { stripFontTags as l } from "../../utils/stripFontTags.js";
|
|
3
|
+
import { trimHrefWhitespace as d } from "../../utils/trimHrefWhitespace.js";
|
|
4
|
+
const y = [
|
|
4
5
|
{
|
|
5
6
|
id: "fix-url-encoding-start",
|
|
6
7
|
description: "Replace {%22 with %7B%22 to fix URL encoding",
|
|
@@ -59,14 +60,14 @@ const f = [
|
|
|
59
60
|
id: "strip-font-tags",
|
|
60
61
|
description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
|
|
61
62
|
type: "custom",
|
|
62
|
-
processor: (e) =>
|
|
63
|
+
processor: (e) => l(e),
|
|
63
64
|
priority: 15
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
id: "trim-href-whitespace",
|
|
67
68
|
description: "Trim leading/trailing whitespace and from every href value",
|
|
68
69
|
type: "custom",
|
|
69
|
-
processor: (e) =>
|
|
70
|
+
processor: (e) => d(e),
|
|
70
71
|
priority: 16
|
|
71
72
|
},
|
|
72
73
|
{
|
|
@@ -183,6 +184,15 @@ const f = [
|
|
|
183
184
|
flags: "g",
|
|
184
185
|
priority: 45
|
|
185
186
|
},
|
|
187
|
+
{
|
|
188
|
+
id: "remove-dc-pending-marker",
|
|
189
|
+
description: "Strip the editor-only pending dynamic-content choice marker from compiled output",
|
|
190
|
+
type: "regex",
|
|
191
|
+
pattern: c,
|
|
192
|
+
replacement: "",
|
|
193
|
+
flags: "g",
|
|
194
|
+
priority: 46
|
|
195
|
+
},
|
|
186
196
|
{
|
|
187
197
|
id: "remove-script-tags",
|
|
188
198
|
// SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <script> from
|
|
@@ -208,5 +218,5 @@ const f = [
|
|
|
208
218
|
}
|
|
209
219
|
];
|
|
210
220
|
export {
|
|
211
|
-
|
|
221
|
+
y as defaultHtmlCompilerRules
|
|
212
222
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CONDITION_TAG_REGEX as s } from "../../enums/html-validator.js";
|
|
2
|
+
const r = /[^\S\r\n\u2028\u2029]*[\r\n\u2028\u2029]+\s*/g, i = [
|
|
3
|
+
{
|
|
4
|
+
id: "pongo-single-line-tags",
|
|
5
|
+
description: "Collapse line breaks inside {% %} tags to a space",
|
|
6
|
+
type: "custom",
|
|
7
|
+
processor: (e) => e.replace(s, (o) => o.replace(r, " ")),
|
|
8
|
+
priority: 50
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
export {
|
|
12
|
+
i as pongoCompilerRules
|
|
13
|
+
};
|