@useinsider/guido 3.21.2 → 3.22.0-beta.0523ffa
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 +36 -4
- package/dist/@types/config/schemas.js +41 -39
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +118 -108
- package/dist/composables/useActionsApi.js +22 -21
- package/dist/composables/useEditorOpenMetrics.js +167 -0
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/useStripo.js +94 -82
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -10
- package/dist/package.json.js +6 -4
- package/dist/public/prefetchRuntime.js +4 -0
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
- package/dist/src/composables/useStripo.d.ts +2 -1
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/prefetchRuntime.d.ts +1 -0
- package/dist/src/stores/config.d.ts +20 -0
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/src/utils/runtimePrefetch.d.ts +4 -0
- package/dist/src/utils/stripoRuntime.d.ts +3 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/static/stripo-runtime-manifest.json.js +9 -0
- package/dist/utils/fullStoryScripts.js +8 -0
- package/dist/utils/pairProductVariables.js +98 -90
- package/dist/utils/runtimePrefetch.js +26 -0
- package/dist/utils/stripoRuntime.js +13 -0
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +6 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
1
|
+
import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { stripFullStoryScripts as h } from "../utils/fullStoryScripts.js";
|
|
3
|
+
import { getEditorApi as r } from "../utils/stripoEditorApi.js";
|
|
3
4
|
import { useToaster as D } from "./useToaster.js";
|
|
4
|
-
const
|
|
5
|
+
const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
5
6
|
const f = setTimeout(
|
|
6
7
|
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
7
8
|
l
|
|
@@ -13,8 +14,8 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
13
14
|
} catch (t) {
|
|
14
15
|
d(t);
|
|
15
16
|
}
|
|
16
|
-
}),
|
|
17
|
-
const { handleError: n } = D(), l = (t = {}) =>
|
|
17
|
+
}), _ = () => {
|
|
18
|
+
const { handleError: n } = D(), l = (t = {}) => m(
|
|
18
19
|
"compileEmail",
|
|
19
20
|
T,
|
|
20
21
|
(e, i) => {
|
|
@@ -38,38 +39,38 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
38
39
|
resetDataSavedFlag: !1,
|
|
39
40
|
disableLineHeightsReplace: !0
|
|
40
41
|
}, ...t }, u = {
|
|
41
|
-
callback: (
|
|
42
|
-
|
|
42
|
+
callback: (s, g, w, S, y) => {
|
|
43
|
+
s ? i(s) : e({
|
|
43
44
|
html: g,
|
|
44
45
|
ampHtml: w,
|
|
45
|
-
ampErrors:
|
|
46
|
-
displayConditions:
|
|
46
|
+
ampErrors: v(S ?? []),
|
|
47
|
+
displayConditions: y
|
|
47
48
|
});
|
|
48
49
|
},
|
|
49
50
|
...o
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
r().actionsApi.compileEmail(u);
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
return {
|
|
55
56
|
getCompiledEmail: l,
|
|
56
|
-
getTemplateData: () =>
|
|
57
|
+
getTemplateData: () => m(
|
|
57
58
|
"getTemplateData",
|
|
58
59
|
T,
|
|
59
60
|
(t) => {
|
|
60
|
-
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds:
|
|
61
|
-
html: i,
|
|
61
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: s }) => t({
|
|
62
|
+
html: h(i),
|
|
62
63
|
css: a,
|
|
63
64
|
width: o,
|
|
64
65
|
height: E,
|
|
65
66
|
utmParams: u,
|
|
66
|
-
syncModulesIds:
|
|
67
|
+
syncModulesIds: s
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
r().actionsApi.getTemplateData(e);
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
72
|
activateCustomViewStyles: (t = !0) => {
|
|
72
|
-
|
|
73
|
+
r().actionsApi.activateCustomViewStyles(t);
|
|
73
74
|
},
|
|
74
75
|
getPreviewData: async (t) => {
|
|
75
76
|
try {
|
|
@@ -109,16 +110,16 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
109
110
|
}
|
|
110
111
|
}),
|
|
111
112
|
updateHtmlAndCss: (t, e) => {
|
|
112
|
-
const { actionsApi: i } =
|
|
113
|
-
return
|
|
113
|
+
const { actionsApi: i } = r();
|
|
114
|
+
return m("updateHtmlAndCss", H, (a) => {
|
|
114
115
|
i.updateHtmlAndCss(t, e, () => a());
|
|
115
116
|
});
|
|
116
117
|
},
|
|
117
|
-
editorSave: () =>
|
|
118
|
+
editorSave: () => m(
|
|
118
119
|
"save",
|
|
119
120
|
T,
|
|
120
121
|
(t) => {
|
|
121
|
-
|
|
122
|
+
r().actionsApi.save((e) => {
|
|
122
123
|
if (e) {
|
|
123
124
|
n(e, "Failed to save template"), t(!1);
|
|
124
125
|
return;
|
|
@@ -130,5 +131,5 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
130
131
|
};
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
_ as useActionsApi
|
|
134
135
|
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { SYNC_MODULE_CLASS as w } from "./useSyncModuleExtractor.js";
|
|
2
|
+
import { readRuntimePrefetchState as S } from "../utils/runtimePrefetch.js";
|
|
3
|
+
import { getStripoVersion as R } from "../utils/stripoRuntime.js";
|
|
4
|
+
import M from "../package.json.js";
|
|
5
|
+
const A = [
|
|
6
|
+
"setup",
|
|
7
|
+
"host_ready",
|
|
8
|
+
"migration_start",
|
|
9
|
+
"migration_end",
|
|
10
|
+
"default_template_start",
|
|
11
|
+
"default_template_end",
|
|
12
|
+
"timer_clone_start",
|
|
13
|
+
"timer_clone_end",
|
|
14
|
+
"plugin_start",
|
|
15
|
+
"script_ready",
|
|
16
|
+
"fonts_sync_ready",
|
|
17
|
+
"blocks_config_ready",
|
|
18
|
+
"init_editor",
|
|
19
|
+
"token_start",
|
|
20
|
+
"token_end",
|
|
21
|
+
"ready"
|
|
22
|
+
], m = "guido:open:", h = "total", p = [
|
|
23
|
+
["host_wait", "setup", "host_ready"],
|
|
24
|
+
["migration", "migration_start", "migration_end"],
|
|
25
|
+
["default_template", "default_template_start", "default_template_end"],
|
|
26
|
+
["timer_clone", "timer_clone_start", "timer_clone_end"],
|
|
27
|
+
["script", "plugin_start", "script_ready"],
|
|
28
|
+
["fonts_sync", "script_ready", "fonts_sync_ready"],
|
|
29
|
+
["blocks_config", "fonts_sync_ready", "blocks_config_ready"],
|
|
30
|
+
["editor_config", "blocks_config_ready", "init_editor"],
|
|
31
|
+
["stripo_load", "init_editor", "ready"],
|
|
32
|
+
["token", "token_start", "token_end"]
|
|
33
|
+
], b = (e) => new RegExp(`(?:^|[\\s"'])(?:${e})(?=[\\s"'])`, "g"), N = /<img\b/gi, $ = b(w), L = /\srecommendation-id=/g, C = b("items-block-v2|esd-(?:cart|browsed|purchased)-items-block"), I = "esd-timer-id", f = {
|
|
34
|
+
html_bytes: null,
|
|
35
|
+
css_bytes: null,
|
|
36
|
+
image_count: null,
|
|
37
|
+
synced_module_count: null,
|
|
38
|
+
recommendation_block_count: null,
|
|
39
|
+
items_block_count: null,
|
|
40
|
+
has_timers: null,
|
|
41
|
+
force_recreate: null
|
|
42
|
+
};
|
|
43
|
+
let l = null;
|
|
44
|
+
const i = (e) => {
|
|
45
|
+
try {
|
|
46
|
+
e();
|
|
47
|
+
} catch (t) {
|
|
48
|
+
console.debug("guido:open: metrics step failed", t);
|
|
49
|
+
}
|
|
50
|
+
}, k = () => window.DD_RUM, g = (e, t) => e === void 0 || t === void 0 ? null : Math.round(t - e), _ = (e, t) => {
|
|
51
|
+
var r;
|
|
52
|
+
return ((r = e.match(t)) == null ? void 0 : r.length) ?? 0;
|
|
53
|
+
}, y = (e) => new TextEncoder().encode(e).length, O = (e) => {
|
|
54
|
+
if (!e)
|
|
55
|
+
return f;
|
|
56
|
+
try {
|
|
57
|
+
const { html: t, css: r, forceRecreate: o } = e;
|
|
58
|
+
return {
|
|
59
|
+
html_bytes: y(t),
|
|
60
|
+
css_bytes: y(r),
|
|
61
|
+
image_count: _(t, N),
|
|
62
|
+
synced_module_count: _(t, $),
|
|
63
|
+
recommendation_block_count: _(t, L),
|
|
64
|
+
items_block_count: _(t, C),
|
|
65
|
+
has_timers: t.includes(I),
|
|
66
|
+
force_recreate: o
|
|
67
|
+
};
|
|
68
|
+
} catch (t) {
|
|
69
|
+
return console.debug("guido:open: template weight failed", t), f;
|
|
70
|
+
}
|
|
71
|
+
}, E = () => {
|
|
72
|
+
i(() => {
|
|
73
|
+
A.forEach((e) => performance.clearMarks(`${m}${e}`)), [...p.map(([e]) => e), h].forEach((e) => performance.clearMeasures(`${m}${e}`));
|
|
74
|
+
});
|
|
75
|
+
}, c = (e, t) => {
|
|
76
|
+
if (e.finished || e.marks[t] !== void 0)
|
|
77
|
+
return;
|
|
78
|
+
const r = performance.now();
|
|
79
|
+
e.marks[t] = r, e === l && i(() => performance.mark(`${m}${t}`, { startTime: r }));
|
|
80
|
+
}, s = (e) => {
|
|
81
|
+
e.finished = !0, document.removeEventListener("visibilitychange", e.onVisibilityChange), window.removeEventListener("pagehide", e.onPageHide);
|
|
82
|
+
}, B = (e, t) => {
|
|
83
|
+
const { marks: r } = e, o = p.map(([n, a, d]) => [n, r[a], r[d]]);
|
|
84
|
+
o.push([h, r.setup, t]), o.forEach(([n, a, d]) => {
|
|
85
|
+
a !== void 0 && d !== void 0 && i(() => performance.measure(`${m}${n}`, { start: a, end: d }));
|
|
86
|
+
});
|
|
87
|
+
}, D = (e, t, r) => {
|
|
88
|
+
const { marks: o, context: n } = e, a = Object.fromEntries(
|
|
89
|
+
p.map(([d, v, P]) => [`${d}_ms`, g(o[v], o[P])])
|
|
90
|
+
);
|
|
91
|
+
return {
|
|
92
|
+
outcome: t,
|
|
93
|
+
open_ms: g(o.setup, r),
|
|
94
|
+
...a,
|
|
95
|
+
script_preloaded: e.scriptPreloaded,
|
|
96
|
+
runtime_prefetch: e.runtimePrefetch,
|
|
97
|
+
...O(e.template),
|
|
98
|
+
partner_name: (n == null ? void 0 : n.partnerName) ?? null,
|
|
99
|
+
product_type: (n == null ? void 0 : n.productType) ?? null,
|
|
100
|
+
template_id: (n == null ? void 0 : n.templateId) ?? null,
|
|
101
|
+
variation_id: (n == null ? void 0 : n.variationId) ?? null,
|
|
102
|
+
guido_version: M.version,
|
|
103
|
+
stripo_version: R(),
|
|
104
|
+
was_backgrounded: e.wasBackgrounded
|
|
105
|
+
};
|
|
106
|
+
}, u = (e, t) => {
|
|
107
|
+
i(() => {
|
|
108
|
+
const r = e.marks.ready ?? performance.now(), o = D(e, t, r);
|
|
109
|
+
e.template = null, e === l && B(e, r), console.debug("guido:open", o), i(() => {
|
|
110
|
+
var n, a;
|
|
111
|
+
return (a = (n = k()) == null ? void 0 : n.addAction) == null ? void 0 : a.call(n, "guido_editor_open", o);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}, T = (e) => {
|
|
115
|
+
e.finished || (s(e), u(e, "abandoned"));
|
|
116
|
+
}, H = () => {
|
|
117
|
+
const e = {
|
|
118
|
+
marks: {},
|
|
119
|
+
context: null,
|
|
120
|
+
template: null,
|
|
121
|
+
scriptPreloaded: null,
|
|
122
|
+
runtimePrefetch: null,
|
|
123
|
+
wasBackgrounded: document.visibilityState === "hidden",
|
|
124
|
+
finished: !1,
|
|
125
|
+
onVisibilityChange: () => {
|
|
126
|
+
document.visibilityState === "hidden" && (e.wasBackgrounded = !0);
|
|
127
|
+
},
|
|
128
|
+
onPageHide: () => T(e)
|
|
129
|
+
};
|
|
130
|
+
return e;
|
|
131
|
+
}, Y = (e) => ({
|
|
132
|
+
mark: (t) => c(e, t),
|
|
133
|
+
timed: async (t, r) => {
|
|
134
|
+
c(e, `${t}_start`);
|
|
135
|
+
const o = await r();
|
|
136
|
+
return c(e, `${t}_end`), o;
|
|
137
|
+
},
|
|
138
|
+
setContext: (t) => {
|
|
139
|
+
e.context = t;
|
|
140
|
+
},
|
|
141
|
+
setTemplate: (t) => {
|
|
142
|
+
e.template = t;
|
|
143
|
+
},
|
|
144
|
+
setScriptPreloaded: (t) => {
|
|
145
|
+
e.scriptPreloaded = t;
|
|
146
|
+
},
|
|
147
|
+
markReady: () => {
|
|
148
|
+
e.finished || (c(e, "ready"), s(e), i(() => {
|
|
149
|
+
var t, r;
|
|
150
|
+
return (r = (t = k()) == null ? void 0 : t.addTiming) == null ? void 0 : r.call(t, "guido_editor_ready");
|
|
151
|
+
}), setTimeout(() => u(e, "ready"), 0));
|
|
152
|
+
},
|
|
153
|
+
markFailed: () => {
|
|
154
|
+
e.finished || (s(e), u(e, "error"));
|
|
155
|
+
},
|
|
156
|
+
dispose: () => {
|
|
157
|
+
T(e), e === l && (E(), l = null);
|
|
158
|
+
}
|
|
159
|
+
}), K = () => {
|
|
160
|
+
const e = H();
|
|
161
|
+
return E(), l = e, i(() => {
|
|
162
|
+
e.runtimePrefetch = S();
|
|
163
|
+
}), document.addEventListener("visibilitychange", e.onVisibilityChange), window.addEventListener("pagehide", e.onPageHide), c(e, "setup"), Y(e);
|
|
164
|
+
};
|
|
165
|
+
export {
|
|
166
|
+
K as startEditorOpenMetrics
|
|
167
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
|
|
2
|
+
const l = () => ({ injectFullStory: () => {
|
|
3
|
+
var c;
|
|
4
|
+
const n = window;
|
|
5
|
+
if (typeof n._fs_org != "string" || !n._fs_org)
|
|
5
6
|
return;
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
7
|
+
const e = document.querySelector("ui-editor"), o = (c = e == null ? void 0 : e.shadowRoot) == null ? void 0 : c.querySelector("iframe"), r = o == null ? void 0 : o.contentDocument;
|
|
8
|
+
if (!r || r.querySelector('script[data-fullstory-bridge="true"]'))
|
|
8
9
|
return;
|
|
9
|
-
const t =
|
|
10
|
-
t.src =
|
|
10
|
+
const t = r.createElement("script");
|
|
11
|
+
t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
|
|
11
12
|
} });
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
l as useFullStoryBridge
|
|
14
15
|
};
|
|
@@ -1,84 +1,91 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
8
|
-
import { ToasterTypeOptions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { useActionsApi as q } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as O } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as D } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as F, useSaveComplete as j } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as z } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as I } from "./useSyncModuleExtractor.js";
|
|
8
|
+
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
|
+
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
10
|
+
import { useConfigStore as N } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as Q } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as X } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Y, getHtmlReferencedUnsubscribePages as Z } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as _ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as $ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as tt } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as et } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as ot } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as it } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
|
+
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
|
+
const Pt = () => {
|
|
23
|
+
const n = F(), w = j(), { validateHtml: y } = $(), { validateLiquidSyntax: E } = it(), { validateCouponBlockTags: b } = et(), { validateUnsubscribeBlockUniqueness: g, validateUnsubscribeBlockHasTemplate: H } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = ot(), { callbacks: r, isFeatureEnabled: v } = O(), { extractSyncModuleData: V } = I(), { setSyncModuleUnsubscriptionPages: x } = K(), { editorSave: C, getTemplateData: u } = q(), { showToaster: k } = tt(), { getBlockedDomains: h, resolveToast: B } = _(), { prepareTemplateDetails: p } = Y(), { collectSaveValidationErrors: T } = z(), { isEnabled: P } = G(), L = X(), U = Q(), S = N(), { runExclusive: m } = D(), d = async (t, e, i) => {
|
|
24
|
+
if (!v("allowlistEnabled"))
|
|
24
25
|
return !1;
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
26
|
+
const o = await h(t, e);
|
|
27
|
+
if (!o.length)
|
|
27
28
|
return !1;
|
|
28
|
-
if (!
|
|
29
|
-
const s = await
|
|
30
|
-
s != null && s.message &&
|
|
31
|
-
type:
|
|
29
|
+
if (!i) {
|
|
30
|
+
const s = await B(o);
|
|
31
|
+
s != null && s.message && k({
|
|
32
|
+
type: J.Warning,
|
|
32
33
|
message: s.message,
|
|
33
34
|
actionButton: s.actionButton
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return !0;
|
|
37
|
-
},
|
|
38
|
-
if (!await
|
|
38
|
+
}, A = async (t) => !b(t.compiledHtml) || !g(t.compiledHtml) || !H(t.compiledHtml) ? !1 : v("liquidSyntax") ? E(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), f = async (t, e) => {
|
|
39
|
+
if (!await C())
|
|
39
40
|
return;
|
|
40
|
-
const { unsubscribePayload:
|
|
41
|
-
if (await
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
const { unsubscribePayload: o, stripoModules: s } = V(t.rawHtml);
|
|
42
|
+
if (await x(o), t.modules = s, !e.suppress) {
|
|
43
|
+
const a = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
44
|
+
w({ ...t, ...a, silent: e.silent });
|
|
44
45
|
}
|
|
45
46
|
return t;
|
|
46
|
-
},
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
}, M = async (t, e) => {
|
|
48
|
+
var s;
|
|
49
|
+
n();
|
|
50
|
+
const i = await u();
|
|
51
|
+
if (!c(i.html, e))
|
|
52
|
+
return;
|
|
53
|
+
const o = await p(i);
|
|
54
|
+
if (l(o.rawHtml, e)) {
|
|
55
|
+
if (P.value && !e) {
|
|
56
|
+
const a = await T(
|
|
53
57
|
o.compiledHtml,
|
|
54
58
|
o.dynamicContentList
|
|
55
59
|
);
|
|
56
|
-
if (
|
|
57
|
-
|
|
60
|
+
if (a.length) {
|
|
61
|
+
L.open(a, "save");
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
|
-
} else if (!await
|
|
64
|
+
} else if (!await A(o))
|
|
61
65
|
return;
|
|
62
|
-
if (!((
|
|
63
|
-
return
|
|
66
|
+
if (!((s = r.value) != null && s.externalValidation && !await r.value.externalValidation(o)) && !await d(o.compiledHtml, o.css, e))
|
|
67
|
+
return f(o, { silent: e, suppress: t });
|
|
64
68
|
}
|
|
65
|
-
},
|
|
66
|
-
var
|
|
67
|
-
if (!
|
|
69
|
+
}, W = async () => {
|
|
70
|
+
var i;
|
|
71
|
+
if (!S.allowSaveWithErrors)
|
|
72
|
+
return;
|
|
73
|
+
n();
|
|
74
|
+
const t = await u();
|
|
75
|
+
if (!c(t.html, !1))
|
|
68
76
|
return;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (!f.allowSaveWithErrors)
|
|
77
|
+
const e = await p(t);
|
|
78
|
+
if (l(e.rawHtml, !1) && !((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(e)) && !await d(e.compiledHtml, e.css, !1))
|
|
79
|
+
return f(e, { silent: !1, blankCompiled: !0 });
|
|
80
|
+
}, R = async () => {
|
|
81
|
+
if (!S.allowSaveWithErrors)
|
|
75
82
|
return;
|
|
76
|
-
|
|
77
|
-
const { html: t, css: e } = await
|
|
78
|
-
if (!
|
|
83
|
+
n();
|
|
84
|
+
const { html: t, css: e } = await u();
|
|
85
|
+
if (!c(t, !0) || !l(t, !0) || await d(t, e, !0))
|
|
79
86
|
return;
|
|
80
|
-
const
|
|
81
|
-
dynamicContentList:
|
|
87
|
+
const i = Z(t), o = {
|
|
88
|
+
dynamicContentList: U.getSelectedDynamicContentList,
|
|
82
89
|
compiledHtml: "",
|
|
83
90
|
rawHtml: t,
|
|
84
91
|
css: e,
|
|
@@ -88,16 +95,16 @@ const Bt = () => {
|
|
|
88
95
|
// No campaignUrls: hosts overwrite their stored map with any object, and raw HTML can't rebuild it.
|
|
89
96
|
recommendation: { configs: {} },
|
|
90
97
|
unsubscribe: {
|
|
91
|
-
status:
|
|
92
|
-
config:
|
|
98
|
+
status: i.length > 0,
|
|
99
|
+
config: i
|
|
93
100
|
}
|
|
94
101
|
};
|
|
95
|
-
return
|
|
102
|
+
return f(o, { silent: !0 });
|
|
96
103
|
};
|
|
97
|
-
return { save: (t = !1, e = !1) =>
|
|
98
|
-
() =>
|
|
99
|
-
), saveWithErrors: () =>
|
|
104
|
+
return { save: (t = !1, e = !1) => m(
|
|
105
|
+
() => M(t, e)
|
|
106
|
+
), saveWithErrors: () => m(W), saveRawOnly: () => m(R) };
|
|
100
107
|
};
|
|
101
108
|
export {
|
|
102
|
-
|
|
109
|
+
Pt as useSave
|
|
103
110
|
};
|