@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.d2a272e

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.
Files changed (78) hide show
  1. package/README.md +35 -5
  2. package/dist/@types/config/schemas.js +39 -41
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +107 -99
  5. package/dist/composables/useBlocksConfig.js +24 -32
  6. package/dist/composables/useEditorOpenMetrics.js +167 -0
  7. package/dist/composables/useSave.js +75 -68
  8. package/dist/composables/useStripo.js +93 -82
  9. package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
  10. package/dist/enums/academy.js +0 -1
  11. package/dist/guido.css +1 -1
  12. package/dist/library.js +12 -10
  13. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  14. package/dist/node_modules/valibot/dist/index.js +261 -297
  15. package/dist/package.json.js +6 -4
  16. package/dist/public/prefetchRuntime.js +4 -0
  17. package/dist/services/templateLibraryApi.js +36 -31
  18. package/dist/src/@types/config/schemas.d.ts +0 -4
  19. package/dist/src/composables/useConfig.d.ts +0 -2
  20. package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
  21. package/dist/src/composables/useStripo.d.ts +2 -1
  22. package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
  23. package/dist/src/enums/academy.d.ts +0 -1
  24. package/dist/src/library.d.ts +1 -0
  25. package/dist/src/public/prefetchRuntime.d.ts +1 -0
  26. package/dist/src/stores/config.d.ts +0 -166
  27. package/dist/src/utils/runtimePrefetch.d.ts +4 -0
  28. package/dist/src/utils/stripoRuntime.d.ts +3 -0
  29. package/dist/src/utils/templatePreparation.d.ts +2 -1
  30. package/dist/static/stripo-runtime-manifest.json.js +9 -0
  31. package/dist/stores/config.js +6 -13
  32. package/dist/utils/pairProductVariables.js +98 -91
  33. package/dist/utils/runtimePrefetch.js +26 -0
  34. package/dist/utils/stripoRuntime.js +13 -0
  35. package/dist/utils/templatePreparation.js +30 -30
  36. package/package.json +6 -1
  37. package/dist/@types/display-condition.js +0 -25
  38. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  39. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  40. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  41. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  42. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  43. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  44. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  45. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  46. package/dist/composables/useDisplayConditions.js +0 -102
  47. package/dist/enums/display-condition.js +0 -12
  48. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  49. package/dist/extensions/DisplayConditions/constants.js +0 -17
  50. package/dist/extensions/DisplayConditions/control.js +0 -178
  51. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  52. package/dist/extensions/DisplayConditions/extension.js +0 -28
  53. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  54. package/dist/extensions/DisplayConditions/library.js +0 -27
  55. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  56. package/dist/services/displayConditionApi.js +0 -39
  57. package/dist/src/@types/display-condition.d.ts +0 -59
  58. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  59. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  60. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  61. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  62. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  63. package/dist/src/enums/display-condition.d.ts +0 -15
  64. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  65. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  66. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  67. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  68. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  69. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  70. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  71. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  72. package/dist/src/services/displayConditionApi.d.ts +0 -8
  73. package/dist/src/stores/display-condition.d.ts +0 -81
  74. package/dist/src/utils/displayCondition.d.ts +0 -10
  75. package/dist/src/utils/protectTableText.d.ts +0 -2
  76. package/dist/stores/display-condition.js +0 -28
  77. package/dist/utils/displayCondition.js +0 -26
  78. package/dist/utils/protectTableText.js +0 -22
@@ -1,6 +1,6 @@
1
- import l from "../extensions/ModulesTabIcons/extension.js";
2
- import { useConfigStore as c } from "../stores/config.js";
3
- const s = {
1
+ import r from "../extensions/ModulesTabIcons/extension.js";
2
+ import { useConfigStore as l } from "../stores/config.js";
3
+ const a = {
4
4
  "amp-accordion": "ampAccordionEnabled",
5
5
  "amp-carousel": "ampCarouselEnabled",
6
6
  "amp-form-controls": "ampFormControlsEnabled",
@@ -14,7 +14,7 @@ const s = {
14
14
  "text-block": "textEnabled",
15
15
  "timer-block": "timerEnabled",
16
16
  "video-block": "videoEnabled"
17
- }, i = {
17
+ }, s = {
18
18
  "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
19
19
  "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
20
20
  "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
@@ -22,48 +22,40 @@ const s = {
22
22
  "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
23
23
  "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
24
24
  "items-block": () => import("../extensions/Blocks/Items/extension.js")
25
- }, b = (o) => {
26
- if (!o || !o.length)
25
+ }, i = (n) => {
26
+ if (!n || !n.length)
27
27
  return {};
28
28
  const t = {};
29
- return o.forEach((n) => {
30
- const e = s[n];
29
+ return n.forEach((o) => {
30
+ const e = a[o];
31
31
  e && (t[e] = !1);
32
32
  }), t;
33
- }, m = async (o) => {
34
- if (!o)
35
- return [l];
36
- const t = await import("../extensions/DisplayConditions/extension.js");
37
- return [l, t.default];
38
- }, d = async (o, t = !1) => {
39
- const n = await m(t);
40
- if (!o || !o.length)
41
- return n;
42
- const e = await Promise.all(
43
- o.map(async (r) => {
44
- const a = i[r];
45
- return a ? (await a()).default : null;
33
+ }, b = () => [r], m = async (n) => {
34
+ const t = b();
35
+ if (!n || !n.length)
36
+ return t;
37
+ const o = await Promise.all(
38
+ n.map(async (e) => {
39
+ const c = s[e];
40
+ return c ? (await c()).default : null;
46
41
  })
47
42
  );
48
43
  return [
49
- ...n,
50
- ...e.filter((r) => r !== null)
44
+ ...t,
45
+ ...o.filter((e) => e !== null)
51
46
  ];
52
- }, k = () => {
53
- const o = c();
47
+ }, E = () => {
48
+ const n = l();
54
49
  return {
55
50
  getStripoBlocksConfig: async () => {
56
- const n = o.blocks;
51
+ const o = n.blocks;
57
52
  return {
58
- baseBlocks: b(n == null ? void 0 : n.excludeDefaults),
59
- extensions: await d(
60
- n == null ? void 0 : n.includeCustoms,
61
- o.externalDisplayConditions
62
- )
53
+ baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
54
+ extensions: await m(o == null ? void 0 : o.includeCustoms)
63
55
  };
64
56
  }
65
57
  };
66
58
  };
67
59
  export {
68
- k as useBlocksConfig
60
+ E as useBlocksConfig
69
61
  };
@@ -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,84 +1,91 @@
1
- import { useActionsApi as R } from "./useActionsApi.js";
2
- import { useConfig as q } from "./useConfig.js";
3
- import { useEditorLock as O } from "./useEditorLock.js";
4
- import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
5
- import { useSaveValidation as j } from "./useSaveValidation.js";
6
- import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
7
- import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
8
- import { ToasterTypeOptions as I } from "../enums/toaster.js";
9
- import { useStripoApi as J } from "../services/stripoApi.js";
10
- import { useConfigStore as K } from "../stores/config.js";
11
- import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as Q } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
14
- import { useAllowlist as Z } from "./useAllowlist.js";
15
- import { useHtmlValidator as _ } from "./useHtmlValidator.js";
16
- import { useToaster as $ } from "./useToaster.js";
17
- import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
18
- import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
19
- import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
20
- import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
21
- const Bt = () => {
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"))
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 i = await k(t, e);
26
- if (!i.length)
26
+ const o = await h(t, e);
27
+ if (!o.length)
27
28
  return !1;
28
- if (!o) {
29
- const s = await C(i);
30
- s != null && s.message && x({
31
- type: I.Warning,
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
- }, 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())
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: i, stripoModules: s } = b(t.rawHtml);
41
- if (await g(i), t.modules = s, !e.suppress) {
42
- const W = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
43
- p({ ...t, ...W, silent: e.silent });
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
- }, U = async (t, e) => {
47
- var i;
48
- a();
49
- const o = await m();
50
- if (n(o.rawHtml, e)) {
51
- if (h.value && !e) {
52
- const s = await B(
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 (s.length) {
57
- T.open(s, "save");
60
+ if (a.length) {
61
+ L.open(a, "save");
58
62
  return;
59
63
  }
60
- } else if (!await L(o))
64
+ } else if (!await A(o))
61
65
  return;
62
- if (!((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(o)) && !await c(o.compiledHtml, o.css, e))
63
- return u(o, { silent: e, suppress: t });
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
- }, A = async () => {
66
- var e;
67
- if (!f.allowSaveWithErrors)
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
- 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
- return u(t, { silent: !1, blankCompiled: !0 });
73
- }, M = async () => {
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
- a();
77
- const { html: t, css: e } = await V();
78
- if (!n(t, !0) || await c(t, e, !0))
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 o = Y(t), i = {
81
- dynamicContentList: P.getSelectedDynamicContentList,
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: o.length > 0,
92
- config: o
98
+ status: i.length > 0,
99
+ config: i
93
100
  }
94
101
  };
95
- return u(i, { silent: !0 });
102
+ return f(o, { silent: !0 });
96
103
  };
97
- return { save: (t = !1, e = !1) => l(
98
- () => U(t, e)
99
- ), saveWithErrors: () => l(A), saveRawOnly: () => l(M) };
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
- Bt as useSave
109
+ Pt as useSave
103
110
  };