@useinsider/guido 3.20.1-beta.d2cba14 → 3.20.1-beta.ed186ad
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/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +69 -69
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
- package/dist/composables/useAutoSave.js +46 -44
- package/dist/composables/useSave.js +26 -23
- package/dist/composables/useSaveValidation.js +55 -53
- package/dist/composables/useSaveValidationRollout.js +17 -6
- package/dist/composables/useStripo.js +3 -4
- package/dist/extensions/Blocks/Items/block.js +42 -43
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
- package/dist/package.json.js +1 -1
- package/dist/services/settingsApi.js +11 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/static/styles/components/button.css.js +0 -5
- package/dist/stores/setup-settings.js +10 -0
- package/package.json +3 -3
|
@@ -1,76 +1,78 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useEditorLock as
|
|
3
|
-
import { useAutosaveStore as
|
|
4
|
-
import { useEditorStore as
|
|
5
|
-
import { computed as
|
|
6
|
-
const
|
|
7
|
-
const { isFeatureEnabled:
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
() =>
|
|
11
|
-
),
|
|
12
|
-
hasChanges:
|
|
13
|
-
isInSaveableState:
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { useConfig as p } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as y } from "./useEditorLock.js";
|
|
3
|
+
import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
|
|
4
|
+
import { useEditorStore as L } from "../stores/editor.js";
|
|
5
|
+
import { computed as w, watch as V, onUnmounted as k } from "vue";
|
|
6
|
+
const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
7
|
+
const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
|
|
8
|
+
let o = null, l = 0, u = -1;
|
|
9
|
+
const d = w(
|
|
10
|
+
() => m("autosave") && t.isOn
|
|
11
|
+
), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
|
|
12
|
+
hasChanges: s.hasChanges,
|
|
13
|
+
isInSaveableState: s.isInSaveableState,
|
|
14
|
+
isUnchangedSinceLastSave: s.changeSeq === u
|
|
15
|
+
}), r = async (e) => {
|
|
16
|
+
if (!d.value) {
|
|
16
17
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
if (!
|
|
20
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates:
|
|
20
|
+
if (!A()) {
|
|
21
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: E() });
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
if (t.status ===
|
|
24
|
+
if (t.status === a.SAVING) {
|
|
24
25
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
if (
|
|
28
|
+
if (f()) {
|
|
28
29
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
|
-
e === "visibility" && (
|
|
32
|
+
e === "visibility" && (l = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING;
|
|
33
|
+
const n = s.changeSeq;
|
|
32
34
|
try {
|
|
33
|
-
if (await
|
|
34
|
-
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status =
|
|
35
|
+
if (await g() === void 0) {
|
|
36
|
+
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
39
|
+
u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
40
|
+
} catch (S) {
|
|
41
|
+
console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
|
|
40
42
|
}
|
|
41
|
-
},
|
|
43
|
+
}, i = () => {
|
|
42
44
|
const { visibilityState: e } = document;
|
|
43
45
|
if (console.debug("guido:autosave:visibility-change", {
|
|
44
46
|
visibilityState: e,
|
|
45
|
-
isActive:
|
|
47
|
+
isActive: d.value
|
|
46
48
|
}), e !== "hidden")
|
|
47
49
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
+
const n = Date.now() - l;
|
|
51
|
+
if (n < b) {
|
|
50
52
|
console.debug("guido:autosave:visibility-debounced", {
|
|
51
|
-
sinceLastMs:
|
|
52
|
-
debounceMs:
|
|
53
|
+
sinceLastMs: n,
|
|
54
|
+
debounceMs: b
|
|
53
55
|
});
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
document.removeEventListener("visibilitychange",
|
|
58
|
+
r("visibility");
|
|
59
|
+
}, c = () => {
|
|
60
|
+
o && (clearInterval(o), o = null);
|
|
61
|
+
}, v = () => {
|
|
62
|
+
document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
|
|
61
63
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
V(
|
|
65
|
+
d,
|
|
64
66
|
(e) => {
|
|
65
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (
|
|
66
|
-
console.debug("guido:autosave:interval-tick"),
|
|
67
|
-
},
|
|
67
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
|
|
68
|
+
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
69
|
+
}, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
|
|
68
70
|
},
|
|
69
71
|
{ immediate: !0 }
|
|
70
|
-
),
|
|
71
|
-
|
|
72
|
+
), k(() => {
|
|
73
|
+
c(), v(), t.status = a.IDLE, t.lastSavedAt = null;
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
export {
|
|
75
|
-
|
|
77
|
+
_ as useAutoSave
|
|
76
78
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as R } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as q } from "./useConfig.js";
|
|
3
3
|
import { useEditorLock as O } from "./useEditorLock.js";
|
|
4
4
|
import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
|
|
@@ -19,37 +19,37 @@ import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
|
|
|
19
19
|
import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
|
|
20
20
|
import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
|
|
21
21
|
const Bt = () => {
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
22
|
+
const a = D(), p = F(), { validateHtml: v } = _(), { validateLiquidSyntax: S } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: w, validateUnsubscribeBlockHasTemplate: E } = st(), { validateSyncModuleBlocks: n } = ot(), { callbacks: r, isFeatureEnabled: d } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: H, getTemplateData: V } = R(), { showToaster: x } = $(), { getBlockedDomains: k, resolveToast: C } = Z(), { prepareTemplateDetails: m } = X(), { collectSaveValidationErrors: B } = j(), { isEnabled: h } = z(), T = Q(), P = N(), f = K(), { runExclusive: l } = O(), c = async (t, e, o) => {
|
|
23
|
+
if (!d("allowlistEnabled"))
|
|
24
24
|
return !1;
|
|
25
|
-
const i = await
|
|
25
|
+
const i = await k(t, e);
|
|
26
26
|
if (!i.length)
|
|
27
27
|
return !1;
|
|
28
28
|
if (!o) {
|
|
29
|
-
const s = await
|
|
30
|
-
s != null && s.message &&
|
|
29
|
+
const s = await C(i);
|
|
30
|
+
s != null && s.message && x({
|
|
31
31
|
type: I.Warning,
|
|
32
32
|
message: s.message,
|
|
33
33
|
actionButton: s.actionButton
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
return !0;
|
|
37
|
-
}, L = async (t) => !y(t.compiledHtml) || !
|
|
38
|
-
if (!await
|
|
37
|
+
}, L = async (t) => !y(t.compiledHtml) || !w(t.compiledHtml) || !E(t.compiledHtml) ? !1 : d("liquidSyntax") ? S(t.compiledHtml) : v(t.compiledHtml, t.dynamicContentList, !0), u = async (t, e) => {
|
|
38
|
+
if (!await H())
|
|
39
39
|
return;
|
|
40
40
|
const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
|
|
41
41
|
if (await g(i), t.modules = s, !e.suppress) {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const W = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
43
|
+
p({ ...t, ...W, silent: e.silent });
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
46
|
}, U = async (t, e) => {
|
|
47
47
|
var i;
|
|
48
|
-
|
|
49
|
-
const o = await
|
|
48
|
+
a();
|
|
49
|
+
const o = await m();
|
|
50
50
|
if (n(o.rawHtml, e)) {
|
|
51
|
-
if (
|
|
52
|
-
const s = await
|
|
51
|
+
if (h.value && !e) {
|
|
52
|
+
const s = await B(
|
|
53
53
|
o.compiledHtml,
|
|
54
54
|
o.dynamicContentList
|
|
55
55
|
);
|
|
@@ -59,31 +59,34 @@ const Bt = () => {
|
|
|
59
59
|
}
|
|
60
60
|
} else if (!await L(o))
|
|
61
61
|
return;
|
|
62
|
-
if (!((i =
|
|
62
|
+
if (!((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(o)) && !await c(o.compiledHtml, o.css, e))
|
|
63
63
|
return u(o, { silent: e, suppress: t });
|
|
64
64
|
}
|
|
65
65
|
}, A = async () => {
|
|
66
66
|
var e;
|
|
67
|
-
if (!
|
|
67
|
+
if (!f.allowSaveWithErrors)
|
|
68
68
|
return;
|
|
69
|
-
|
|
70
|
-
const t = await
|
|
71
|
-
if (n(t.rawHtml, !1) && !((e =
|
|
69
|
+
a();
|
|
70
|
+
const t = await m();
|
|
71
|
+
if (n(t.rawHtml, !1) && !((e = r.value) != null && e.externalValidation && !await r.value.externalValidation(t)) && !await c(t.compiledHtml, t.css, !1))
|
|
72
72
|
return u(t, { silent: !1, blankCompiled: !0 });
|
|
73
73
|
}, M = async () => {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
if (!f.allowSaveWithErrors)
|
|
75
|
+
return;
|
|
76
|
+
a();
|
|
77
|
+
const { html: t, css: e } = await V();
|
|
76
78
|
if (!n(t, !0) || await c(t, e, !0))
|
|
77
79
|
return;
|
|
78
80
|
const o = Y(t), i = {
|
|
79
|
-
dynamicContentList:
|
|
81
|
+
dynamicContentList: P.getSelectedDynamicContentList,
|
|
80
82
|
compiledHtml: "",
|
|
81
83
|
rawHtml: t,
|
|
82
84
|
css: e,
|
|
83
85
|
ampHtml: "",
|
|
84
86
|
ampErrors: [],
|
|
85
87
|
modules: [],
|
|
86
|
-
|
|
88
|
+
// No campaignUrls: hosts overwrite their stored map with any object, and raw HTML can't rebuild it.
|
|
89
|
+
recommendation: { configs: {} },
|
|
87
90
|
unsubscribe: {
|
|
88
91
|
status: o.length > 0,
|
|
89
92
|
config: o
|
|
@@ -21,7 +21,7 @@ import { useHttp as re } from "./useHttp.js";
|
|
|
21
21
|
import { useTranslations as se } from "./useTranslations.js";
|
|
22
22
|
import { findInvalidCouponBlocks as ae, COUPON_TAG_MODIFIED_KEY as ce } from "./validators/useCouponBlockValidator.js";
|
|
23
23
|
import { findDuplicateUnsubPageTypes as le, countUnsubBlocksWithoutPage as me, EMPTY_BLOCK_KEY as ue } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
-
const de = "newsletter.html-content-is-empty", pe = "custom-fields.missing-closing-braces", ge = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", fe = "newsletter.display-conditions-invalid-syntax", ye = "custom-conditions.wrong-equality-operators", Ee = "custom-conditions.missing-if-endif-tag", Ie = "custom-conditions.no-space-after-braces", Se = "custom-conditions.no-braces-inside-if-tag", _e = "newsletter.fill-all-necessary-fields", Ce = "newsletter.invalid-image-type", he = "unsubscribe-templates.select-checkbox-groups", ke = "unsubscribe-templates.select-radio-button-groups", Te = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body",
|
|
24
|
+
const de = "newsletter.html-content-is-empty", pe = "custom-fields.missing-closing-braces", ge = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", fe = "newsletter.display-conditions-invalid-syntax", ye = "custom-conditions.wrong-equality-operators", Ee = "custom-conditions.missing-if-endif-tag", Ie = "custom-conditions.no-space-after-braces", Se = "custom-conditions.no-braces-inside-if-tag", _e = "newsletter.fill-all-necessary-fields", Ce = "newsletter.invalid-image-type", he = "unsubscribe-templates.select-checkbox-groups", ke = "unsubscribe-templates.select-radio-button-groups", Te = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body", Re = /src="[^"]*\.(svg|pst)"/gm, O = /({%(.*?)%})/g, Oe = ["if", "endif", "else", "elif", "now"], Le = (t) => !Oe.includes(t.toLowerCase()), Ne = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
25
|
function be(t) {
|
|
26
26
|
return ae(t).map((i) => ({
|
|
27
27
|
rule: o.CouponTagModified,
|
|
@@ -45,22 +45,22 @@ function ve(t) {
|
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
function De(t, i) {
|
|
48
|
-
const n = t.match(
|
|
48
|
+
const n = t.match(O);
|
|
49
49
|
if (!n)
|
|
50
50
|
return [];
|
|
51
|
-
const
|
|
51
|
+
const l = [];
|
|
52
52
|
return n.forEach((u) => {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
const [d] =
|
|
56
|
-
Le(d) && !i.includes(d) &&
|
|
53
|
+
const c = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
54
|
+
if (c && c.length > 0) {
|
|
55
|
+
const [d] = c;
|
|
56
|
+
Le(d) && !i.includes(d) && l.push({
|
|
57
57
|
rule: o.CustomFieldScript,
|
|
58
58
|
type: r.Warning,
|
|
59
59
|
key: I,
|
|
60
60
|
detail: d
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
63
|
+
}), l;
|
|
64
64
|
}
|
|
65
65
|
function Ke(t) {
|
|
66
66
|
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: de }];
|
|
@@ -85,26 +85,26 @@ function Be(t) {
|
|
|
85
85
|
detail: i
|
|
86
86
|
}));
|
|
87
87
|
}
|
|
88
|
-
function Ye(t, i, n,
|
|
88
|
+
function Ye(t, i, n, l) {
|
|
89
89
|
const u = ie(t);
|
|
90
|
-
return oe(t, i, u, n,
|
|
90
|
+
return oe(t, i, u, n, l).map((c) => ({
|
|
91
91
|
rule: o.InvalidCustomField,
|
|
92
92
|
type: r.Error,
|
|
93
93
|
key: I,
|
|
94
|
-
detail:
|
|
94
|
+
detail: c
|
|
95
95
|
}));
|
|
96
96
|
}
|
|
97
97
|
function xe(t) {
|
|
98
|
-
const i = t.match(/{%(.*?)%}/g), n = [],
|
|
98
|
+
const i = t.match(/{%(.*?)%}/g), n = [], l = [];
|
|
99
99
|
if (i && i.forEach((u) => {
|
|
100
|
-
const
|
|
101
|
-
(!
|
|
100
|
+
const c = u.match(Y), d = u.match(x), E = (c == null ? void 0 : c.join("")) || "";
|
|
101
|
+
(!c || u !== E) && !d && l.push({
|
|
102
102
|
rule: o.ConditionsSyntax,
|
|
103
103
|
type: r.Error,
|
|
104
104
|
key: fe,
|
|
105
105
|
detail: u
|
|
106
|
-
}),
|
|
107
|
-
g.trim() === "=" &&
|
|
106
|
+
}), c && c.forEach((g) => {
|
|
107
|
+
g.trim() === "=" && l.push({
|
|
108
108
|
rule: o.WrongEqualityOperator,
|
|
109
109
|
type: r.Error,
|
|
110
110
|
key: ye
|
|
@@ -113,14 +113,14 @@ function xe(t) {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
}), n.length) {
|
|
116
|
-
const u = n.filter((d) => d === "if").length,
|
|
117
|
-
u !==
|
|
116
|
+
const u = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
|
|
117
|
+
u !== c && l.push({
|
|
118
118
|
rule: o.MissingIfEndif,
|
|
119
119
|
type: r.Error,
|
|
120
120
|
key: Ee
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
return
|
|
123
|
+
return l;
|
|
124
124
|
}
|
|
125
125
|
function Me(t) {
|
|
126
126
|
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
@@ -131,29 +131,29 @@ function Me(t) {
|
|
|
131
131
|
}];
|
|
132
132
|
}
|
|
133
133
|
function Ue(t) {
|
|
134
|
-
return (t.match(
|
|
134
|
+
return (t.match(O) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, l) => n + l, 0) === 0 ? [] : [{
|
|
135
135
|
rule: o.BracesInsideIfTag,
|
|
136
136
|
type: r.Warning,
|
|
137
137
|
key: Se
|
|
138
138
|
}];
|
|
139
139
|
}
|
|
140
140
|
function Pe(t) {
|
|
141
|
-
return (t.match(
|
|
141
|
+
return (t.match(Re) ?? []).map((i) => ({
|
|
142
142
|
rule: o.InvalidImageType,
|
|
143
143
|
type: r.Error,
|
|
144
144
|
key: Ce,
|
|
145
145
|
detail: i
|
|
146
146
|
}));
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function R(t, i, n, l) {
|
|
149
149
|
const u = new DOMParser().parseFromString(t, "text/html");
|
|
150
|
-
return Array.from(u.querySelectorAll(i)).filter((
|
|
150
|
+
return Array.from(u.querySelectorAll(i)).filter((c) => {
|
|
151
151
|
var d;
|
|
152
|
-
return !((d =
|
|
153
|
-
}).map(() => ({ rule: n, type: r.Error, key:
|
|
152
|
+
return !((d = c.id) != null && d.trim());
|
|
153
|
+
}).map(() => ({ rule: n, type: r.Error, key: l }));
|
|
154
154
|
}
|
|
155
155
|
const dt = () => {
|
|
156
|
-
const { config: t, isFeatureEnabled: i } = J(), n = se(), { post:
|
|
156
|
+
const { config: t, isFeatureEnabled: i } = J(), n = se(), { post: l } = re(), { getCompiledEmail: u, getTemplateData: c } = Z(), { compileHtml: d } = ee(), { hydrateRecommendationStore: E } = Q(), g = j(), f = z(), y = W(), L = X(), N = (e) => ({
|
|
157
157
|
rule: e.rule,
|
|
158
158
|
type: e.type,
|
|
159
159
|
detail: e.detail,
|
|
@@ -169,25 +169,25 @@ const dt = () => {
|
|
|
169
169
|
return te(y.filterList);
|
|
170
170
|
}, A = async (e) => {
|
|
171
171
|
try {
|
|
172
|
-
const
|
|
173
|
-
return
|
|
172
|
+
const s = await l(Fe, { html: T(e) }), { status: a, message: m } = s.data, p = [];
|
|
173
|
+
return a || p.push({
|
|
174
174
|
rule: o.InvalidLinks,
|
|
175
175
|
type: r.Error,
|
|
176
176
|
// status===undefined means a bare message instead of a boolean; surface it,
|
|
177
177
|
// but fall back to the canned key when it's missing so a malformed body
|
|
178
178
|
// never renders a literal 'undefined' row (SD-147430).
|
|
179
|
-
...
|
|
179
|
+
...a === void 0 && m ? { message: m } : { key: Te }
|
|
180
180
|
}), m === n(k) && p.push({
|
|
181
181
|
rule: o.LinkCheckInProgress,
|
|
182
182
|
type: r.Error,
|
|
183
183
|
key: k
|
|
184
184
|
}), p;
|
|
185
|
-
} catch (
|
|
186
|
-
return console.warn("Link-check collector failed; skipping the link rule.",
|
|
185
|
+
} catch (s) {
|
|
186
|
+
return console.warn("Link-check collector failed; skipping the link rule.", s), [];
|
|
187
187
|
}
|
|
188
188
|
}, v = async (e) => {
|
|
189
189
|
try {
|
|
190
|
-
const
|
|
190
|
+
const s = await l("/newsletter/contents/validate-syntax", [{
|
|
191
191
|
identifier: "default",
|
|
192
192
|
syntax: "liquid",
|
|
193
193
|
contents: {
|
|
@@ -197,21 +197,23 @@ const dt = () => {
|
|
|
197
197
|
ampHtml: null
|
|
198
198
|
}
|
|
199
199
|
}]);
|
|
200
|
-
if (!Array.isArray(
|
|
201
|
-
const m =
|
|
200
|
+
if (!Array.isArray(s.data)) {
|
|
201
|
+
const m = s.data;
|
|
202
202
|
return [{
|
|
203
203
|
rule: o.LiquidSyntax,
|
|
204
204
|
type: r.Warning,
|
|
205
205
|
message: m.message ?? n(F)
|
|
206
206
|
}];
|
|
207
207
|
}
|
|
208
|
-
const [
|
|
209
|
-
return Object.values((
|
|
208
|
+
const [a] = s.data;
|
|
209
|
+
return Object.values((a == null ? void 0 : a.errors) ?? {}).map((m) => ({
|
|
210
210
|
rule: o.LiquidSyntax,
|
|
211
211
|
type: r.Warning,
|
|
212
212
|
message: m.replace(/^line \d+:\s*/, "")
|
|
213
213
|
}));
|
|
214
|
-
} catch {
|
|
214
|
+
} catch (s) {
|
|
215
|
+
if (s != null && s.authReported)
|
|
216
|
+
throw s;
|
|
215
217
|
return [{
|
|
216
218
|
rule: o.LiquidSyntax,
|
|
217
219
|
type: r.Error,
|
|
@@ -219,62 +221,62 @@ const dt = () => {
|
|
|
219
221
|
}];
|
|
220
222
|
}
|
|
221
223
|
}, D = () => {
|
|
222
|
-
const e = Object.values(y.blockStates).map((
|
|
223
|
-
const m =
|
|
224
|
+
const e = Object.values(y.blockStates).map((a) => G(a.recommendationConfigs, y)).filter((a) => a.length > 0).map((a) => {
|
|
225
|
+
const m = a.every((p) => p === q);
|
|
224
226
|
return {
|
|
225
227
|
rule: o.RecommendationRequiredFields,
|
|
226
228
|
type: m ? r.Warning : r.Error,
|
|
227
229
|
key: m ? H : V
|
|
228
230
|
};
|
|
229
|
-
}),
|
|
231
|
+
}), s = (f.recommendationConfigs ?? []).filter((a) => a.filters.some((m) => m.value === "")).map(() => ({
|
|
230
232
|
rule: o.RecommendationFilters,
|
|
231
233
|
type: r.Error,
|
|
232
234
|
key: _e
|
|
233
235
|
}));
|
|
234
|
-
return [...e, ...
|
|
235
|
-
}, K = async (e,
|
|
236
|
+
return [...e, ...s];
|
|
237
|
+
}, K = async (e, s) => {
|
|
236
238
|
var C, h;
|
|
237
|
-
const
|
|
238
|
-
...
|
|
239
|
+
const a = [
|
|
240
|
+
...s.map((w) => w.value),
|
|
239
241
|
...U,
|
|
240
242
|
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
241
243
|
], m = B(e), p = await b(m), { isTransactional: _ } = L;
|
|
242
244
|
return [
|
|
243
245
|
...await A(e),
|
|
244
|
-
..._ ? [] : De(e,
|
|
246
|
+
..._ ? [] : De(e, a),
|
|
245
247
|
...Ke(e),
|
|
246
248
|
...we(e),
|
|
247
249
|
...Be(e),
|
|
248
|
-
..._ ? [] : Ye(e,
|
|
250
|
+
..._ ? [] : Ye(e, a, m, p),
|
|
249
251
|
...xe(e),
|
|
250
252
|
...Me(e),
|
|
251
253
|
...Ue(e),
|
|
252
254
|
...D(),
|
|
253
255
|
...Pe(e),
|
|
254
|
-
...
|
|
256
|
+
...R(
|
|
255
257
|
e,
|
|
256
258
|
M,
|
|
257
259
|
o.CheckboxUnsubGroup,
|
|
258
260
|
he
|
|
259
261
|
),
|
|
260
|
-
...
|
|
262
|
+
...R(
|
|
261
263
|
e,
|
|
262
264
|
P,
|
|
263
265
|
o.RadioButtonUnsubGroup,
|
|
264
266
|
ke
|
|
265
267
|
)
|
|
266
268
|
];
|
|
267
|
-
}, S = async (e,
|
|
269
|
+
}, S = async (e, s) => [
|
|
268
270
|
...be(e),
|
|
269
271
|
...Ae(e),
|
|
270
272
|
...ve(e),
|
|
271
|
-
...i("liquidSyntax") ? await v(e) : await K(e,
|
|
273
|
+
...i("liquidSyntax") ? await v(e) : await K(e, s)
|
|
272
274
|
].map(N);
|
|
273
275
|
return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
|
|
274
|
-
const { html: e } = await
|
|
276
|
+
const { html: e } = await c();
|
|
275
277
|
await E(e);
|
|
276
|
-
const { html:
|
|
277
|
-
return S(
|
|
278
|
+
const { html: s } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: a } = d(s);
|
|
279
|
+
return S(a, g.getSelectedDynamicContentList);
|
|
278
280
|
} };
|
|
279
281
|
};
|
|
280
282
|
export {
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useSettingsApi as l } from "../services/settingsApi.js";
|
|
2
|
+
import { useSetupSettingsStore as s } from "../stores/setup-settings.js";
|
|
3
|
+
import { computed as a } from "vue";
|
|
4
|
+
let o = null;
|
|
5
|
+
const m = () => {
|
|
6
|
+
const t = s();
|
|
7
|
+
return { isEnabled: a(() => t.isEmailAutoSaveEnabled), loadRollout: () => t.isLoaded ? Promise.resolve() : (o ?? (o = l().getSetupSettings().then(({ isEmailAutoSaveEnabled: e }) => {
|
|
8
|
+
t.$patch({
|
|
9
|
+
isEmailAutoSaveEnabled: !!Number(e ?? 0),
|
|
10
|
+
isLoaded: !0
|
|
11
|
+
});
|
|
12
|
+
}).catch((e) => {
|
|
13
|
+
console.warn("Failed to load setup settings; soft-save stays off.", e);
|
|
14
|
+
}).finally(() => {
|
|
15
|
+
o = null;
|
|
16
|
+
})), o) };
|
|
6
17
|
};
|
|
7
18
|
export {
|
|
8
|
-
|
|
19
|
+
m as useSaveValidationRollout
|
|
9
20
|
};
|
|
@@ -31,13 +31,13 @@ const he = () => {
|
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), D = async (r, s, o, a = [], i = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e = k(), { html: d, css:
|
|
34
|
+
const e = k(), { html: d, css: R } = r, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
35
35
|
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
40
|
+
css: R,
|
|
41
41
|
forceRecreate: I,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -60,7 +60,6 @@ const he = () => {
|
|
|
60
60
|
keepModuleStylesEnabled: !0,
|
|
61
61
|
displayTitle: !1,
|
|
62
62
|
displayUTM: !1,
|
|
63
|
-
copyPasteEnabled: !1,
|
|
64
63
|
selectElementAfterDrop: !0,
|
|
65
64
|
sameFontSizeForOutlook: !0,
|
|
66
65
|
allowedScriptSourceDomains: q,
|
|
@@ -121,7 +120,7 @@ const he = () => {
|
|
|
121
120
|
".in-modal-v2-wrapper",
|
|
122
121
|
".in-toasts-wrapper"
|
|
123
122
|
],
|
|
124
|
-
extensions:
|
|
123
|
+
extensions: P,
|
|
125
124
|
localePatch: J
|
|
126
125
|
}
|
|
127
126
|
);
|