@useinsider/guido 3.20.1-beta.dfc8426 → 3.20.1-beta.f34075e

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 (77) hide show
  1. package/README.md +0 -1
  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 +82 -84
  5. package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
  6. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  7. package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
  8. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  9. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
  10. package/dist/composables/useAutoSave.js +46 -44
  11. package/dist/composables/useBlocksConfig.js +24 -32
  12. package/dist/composables/useSave.js +26 -23
  13. package/dist/composables/useSaveValidation.js +113 -114
  14. package/dist/composables/useSaveValidationRollout.js +17 -6
  15. package/dist/enums/academy.js +0 -1
  16. package/dist/guido.css +1 -1
  17. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  18. package/dist/node_modules/valibot/dist/index.js +261 -297
  19. package/dist/services/settingsApi.js +11 -0
  20. package/dist/src/@types/config/schemas.d.ts +0 -4
  21. package/dist/src/components/Guido.vue.d.ts +1 -1
  22. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  23. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  24. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  25. package/dist/src/composables/useAutoSave.d.ts +4 -1
  26. package/dist/src/composables/useConfig.d.ts +0 -2
  27. package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
  28. package/dist/src/enums/academy.d.ts +0 -1
  29. package/dist/src/services/settingsApi.d.ts +6 -0
  30. package/dist/src/stores/config.d.ts +0 -166
  31. package/dist/src/stores/setup-settings.d.ts +4 -0
  32. package/dist/stores/config.js +0 -7
  33. package/dist/stores/setup-settings.js +10 -0
  34. package/dist/utils/pairProductVariables.js +14 -15
  35. package/package.json +1 -1
  36. package/dist/@types/display-condition.js +0 -25
  37. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  38. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  39. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  40. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  41. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  42. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  43. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  44. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  45. package/dist/composables/useDisplayConditions.js +0 -102
  46. package/dist/enums/display-condition.js +0 -12
  47. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  48. package/dist/extensions/DisplayConditions/constants.js +0 -17
  49. package/dist/extensions/DisplayConditions/control.js +0 -178
  50. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  51. package/dist/extensions/DisplayConditions/extension.js +0 -28
  52. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  53. package/dist/extensions/DisplayConditions/library.js +0 -27
  54. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  55. package/dist/services/displayConditionApi.js +0 -39
  56. package/dist/src/@types/display-condition.d.ts +0 -59
  57. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  58. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  59. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  60. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  61. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  62. package/dist/src/enums/display-condition.d.ts +0 -15
  63. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  64. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  65. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  66. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  67. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  68. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  69. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  70. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  71. package/dist/src/services/displayConditionApi.d.ts +0 -8
  72. package/dist/src/stores/display-condition.d.ts +0 -81
  73. package/dist/src/utils/displayCondition.d.ts +0 -10
  74. package/dist/src/utils/protectTableText.d.ts +0 -2
  75. package/dist/stores/display-condition.js +0 -28
  76. package/dist/utils/displayCondition.js +0 -26
  77. package/dist/utils/protectTableText.js +0 -22
@@ -1,83 +1,85 @@
1
- import { defineComponent as I, computed as c, ref as u } from "vue";
1
+ import { defineComponent as I, computed as u, ref as c } from "vue";
2
2
  import { useActionsApi as P } from "../../../composables/useActionsApi.js";
3
- import { useConfig as W } from "../../../composables/useConfig.js";
4
- import { useExport as j } from "../../../composables/useExport.js";
5
- import { useTestEmailClick as G } from "../../../composables/useGuidoActions.js";
6
- import { useHtmlCompiler as J } from "../../../composables/useHtmlCompiler.js";
7
- import { useSave as K } from "../../../composables/useSave.js";
8
- import { useSaveValidation as N } from "../../../composables/useSaveValidation.js";
9
- import { useSaveValidationRollout as Q } from "../../../composables/useSaveValidationRollout.js";
10
- import { useToaster as U } from "../../../composables/useToaster.js";
3
+ import { useConfig as j } from "../../../composables/useConfig.js";
4
+ import { useExport as G } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as J } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as K } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as N } from "../../../composables/useSave.js";
8
+ import { useSaveValidation as Q } from "../../../composables/useSaveValidation.js";
9
+ import { useSaveValidationRollout as U } from "../../../composables/useSaveValidationRollout.js";
10
+ import { useToaster as W } from "../../../composables/useToaster.js";
11
11
  import { useTranslations as X } from "../../../composables/useTranslations.js";
12
12
  import { useVersionHistoryApi as Y } from "../../../composables/useVersionHistoryApi.js";
13
13
  import { useLiquidValidator as Z } from "../../../composables/validators/useLiquidValidator.js";
14
14
  import { ToasterTypeOptions as $ } from "../../../enums/toaster.js";
15
- import { useConfigStore as tt } from "../../../stores/config.js";
16
- import { useEditorStore as ot } from "../../../stores/editor.js";
15
+ import { useEditorStore as tt } from "../../../stores/editor.js";
17
16
  import { useSaveValidationStore as et } from "../../../stores/save-validation.js";
18
- import { useTemplateStore as rt } from "../../../stores/template.js";
19
- import { getTooltipOptions as it } from "../../../utils/tooltipUtils.js";
20
- import { InButtonV2 as st } from "@useinsider/design-system-vue";
21
- import { storeToRefs as at } from "pinia";
22
- import nt from "./MigrationConfirmModal.vue.js";
23
- const bt = /* @__PURE__ */ I({
17
+ import { useTemplateStore as ot } from "../../../stores/template.js";
18
+ import { getTooltipOptions as rt } from "../../../utils/tooltipUtils.js";
19
+ import { InButtonV2 as it } from "@useinsider/design-system-vue";
20
+ import { storeToRefs as st } from "pinia";
21
+ import at from "./MigrationConfirmModal.vue.js";
22
+ const Ot = /* @__PURE__ */ I({
24
23
  __name: "EditorActions",
25
- setup(lt, { expose: k }) {
26
- const { config: p, isFeatureEnabled: f } = W(), { exportHtml: d } = j(), { save: v } = K(), { validateCurrentTemplate: y } = N(), { isEnabled: i } = Q(), { showToaster: S, handleError: s } = U(), { openVersionHistory: g, closeVersionHistory: h } = Y(), { getCompiledEmail: T } = P(), { compileHtml: w } = J(), { validateLiquidSyntax: E } = Z(), V = tt(), o = ot(), H = et(), x = rt(), { hasMigrations: C } = at(x), r = X(), F = c(() => i.value && V.allowSaveWithErrors ? r("email-editor.save-and-continue") : "Save"), a = u(!1), n = u(!1), _ = u(), l = G(), q = () => {
27
- if (o.isVersionHistoryOpen) {
28
- h();
24
+ setup(nt, { expose: b }) {
25
+ const { config: p, isFeatureEnabled: f } = j(), { exportHtml: d } = G(), { save: v } = N(), { validateCurrentTemplate: y } = Q(), { isEnabled: s } = U(), { showToaster: S, hideToaster: g, handleError: i } = W(), { openVersionHistory: h, closeVersionHistory: T } = Y(), { getCompiledEmail: V } = P(), { compileHtml: E } = K(), { validateLiquidSyntax: H } = Z(), e = tt(), w = et(), x = ot(), { hasMigrations: C } = st(x), r = X(), k = u(() => s.value ? r("email-editor.save-and-continue") : "Save"), a = c(!1), n = c(!1), _ = c(), l = J(), q = () => {
26
+ if (e.isVersionHistoryOpen) {
27
+ T();
29
28
  return;
30
29
  }
31
- g();
30
+ h();
32
31
  }, B = async () => {
33
32
  a.value = !0, await d(), a.value = !1;
34
33
  }, L = () => {
35
- o.isSaveAsTemplateDrawerOpen = !0;
36
- }, R = c(() => o.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = c(
34
+ e.isSaveAsTemplateDrawerOpen = !0;
35
+ }, R = u(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = u(
37
36
  () => {
38
- var t, e;
39
- return ((e = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : e.versionHistory) && !o.isPreviewModeOpen;
37
+ var t, o;
38
+ return ((o = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
40
39
  }
41
40
  ), A = async (t) => {
42
- n.value = !0, t || (o.loadingStatus = !0);
43
- let e;
41
+ n.value = !0, t || (e.loadingStatus = !0);
42
+ let o;
44
43
  try {
45
- e = await v(t);
46
- } catch (b) {
47
- s(b, "Failed to save template");
44
+ o = await v(t);
45
+ } catch (M) {
46
+ i(M, "Failed to save template");
48
47
  } finally {
49
- n.value = !1, !t && !e && (o.loadingStatus = !1);
48
+ n.value = !1, !t && !o && (e.loadingStatus = !1);
50
49
  }
51
- return e;
50
+ return o;
52
51
  }, O = (t) => {
53
- var e;
52
+ var o;
54
53
  if (!t && C.value) {
55
- (e = _.value) == null || e.open();
54
+ (o = _.value) == null || o.open();
56
55
  return;
57
56
  }
58
57
  return A(t);
59
58
  }, m = async () => {
60
- o.loadingStatus = !0;
59
+ e.loadingStatus = !0;
61
60
  try {
62
61
  return await y();
63
62
  } catch (t) {
64
- return console.warn("Test-path validation failed; sending without the drawer.", t), [];
63
+ return i(t, "Failed to prepare test email"), null;
65
64
  } finally {
66
- o.loadingStatus = !1;
65
+ e.loadingStatus = !1;
67
66
  }
68
- }, M = async () => {
67
+ }, F = async () => {
69
68
  const t = await m();
70
- t.length && H.open(t, "test");
69
+ t != null && t.length ? w.open(t, "test") : t && g();
71
70
  }, z = async () => {
72
- if (i.value) {
73
- if ((await m()).length) {
71
+ if (s.value) {
72
+ const t = await m();
73
+ if (!t)
74
+ return;
75
+ if (t.length) {
74
76
  S({
75
77
  type: $.Error,
76
78
  message: r("email-editor.validation-errors-found"),
77
79
  actionButton: {
78
80
  text: r("email-editor.check-errors"),
79
81
  onClick: () => {
80
- M();
82
+ F();
81
83
  }
82
84
  },
83
85
  autoHide: !1
@@ -88,25 +90,25 @@ const bt = /* @__PURE__ */ I({
88
90
  return;
89
91
  }
90
92
  if (f("liquidSyntax")) {
91
- o.loadingStatus = !0;
93
+ e.loadingStatus = !0;
92
94
  try {
93
- const { html: t } = await T({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: e } = w(t);
94
- if (!await E(e))
95
+ const { html: t } = await V({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = E(t);
96
+ if (!await H(o))
95
97
  return;
96
98
  } catch (t) {
97
- s(t, "Failed to prepare test email");
99
+ i(t, "Failed to prepare test email");
98
100
  return;
99
101
  } finally {
100
- o.loadingStatus = !1;
102
+ e.loadingStatus = !1;
101
103
  }
102
104
  }
103
105
  l();
104
106
  };
105
- return k({
107
+ return b({
106
108
  handleSave: O
107
- }), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: i, showToaster: S, handleError: s, openVersionHistory: g, closeVersionHistory: h, getCompiledEmail: T, compileHtml: w, validateLiquidSyntax: E, configStore: V, editorStore: o, saveValidationStore: H, templateStore: x, hasMigrations: C, trans: r, saveLabel: F, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: M, handleTestEmail: z, getTooltipOptions: it, InButtonV2: st, MigrationConfirmModal: nt };
109
+ }), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: s, showToaster: S, hideToaster: g, handleError: i, openVersionHistory: h, closeVersionHistory: T, getCompiledEmail: V, compileHtml: E, validateLiquidSyntax: H, editorStore: e, saveValidationStore: w, templateStore: x, hasMigrations: C, trans: r, saveLabel: k, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: F, handleTestEmail: z, getTooltipOptions: rt, InButtonV2: it, MigrationConfirmModal: at };
108
110
  }
109
111
  });
110
112
  export {
111
- bt as default
113
+ Ot as default
112
114
  };
@@ -12,9 +12,9 @@ var i = function() {
12
12
  l,
13
13
  !1,
14
14
  null,
15
- "c5ff3804"
15
+ "e48cebe9"
16
16
  );
17
- const u = d.exports;
17
+ const f = d.exports;
18
18
  export {
19
- u as default
19
+ f as default
20
20
  };
@@ -1,16 +1,17 @@
1
- import { defineComponent as p, ref as c, computed as a } from "vue";
2
- import f from "../../wrappers/WpDrawer.vue.js";
1
+ import { defineComponent as c, ref as f, computed as s } from "vue";
2
+ import v from "../../wrappers/WpDrawer.vue.js";
3
3
  import { useSave as S } from "../../../composables/useSave.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { useConfigStore as g } from "../../../stores/config.js";
6
- import { useEditorStore as y } from "../../../stores/editor.js";
7
- import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
8
- import { escapeHtml as w } from "../../../utils/htmlEscape.js";
9
- import { InIcons as _ } from "@useinsider/design-system-vue";
10
- const V = /* @__PURE__ */ p({
4
+ import { useToaster as g } from "../../../composables/useToaster.js";
5
+ import { useTranslations as y } from "../../../composables/useTranslations.js";
6
+ import { useConfigStore as h } from "../../../stores/config.js";
7
+ import { useEditorStore as _ } from "../../../stores/editor.js";
8
+ import { useSaveValidationStore as w } from "../../../stores/save-validation.js";
9
+ import { escapeHtml as C } from "../../../utils/htmlEscape.js";
10
+ import { InIcons as E } from "@useinsider/design-system-vue";
11
+ const H = /* @__PURE__ */ c({
11
12
  __name: "ValidationErrorDrawer",
12
- setup(C) {
13
- const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = c(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
13
+ setup(T) {
14
+ const r = y(), e = w(), a = _(), n = h(), { saveWithErrors: i } = S(), { handleError: l } = g(), o = f(!1), m = s(() => {
14
15
  const t = {
15
16
  primaryButton: {
16
17
  styling: "solid",
@@ -18,32 +19,32 @@ const V = /* @__PURE__ */ p({
18
19
  labelText: r("email-editor.update-design")
19
20
  }
20
21
  };
21
- return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
22
+ return n.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
22
23
  styling: "solid",
23
24
  type: "subtle-primary",
24
25
  labelText: r("email-editor.save-and-continue"),
25
26
  loadingStatus: o.value
26
27
  }), t;
27
- }), d = a(() => e.errors.map((t) => {
28
- const m = t.detail ? ` (${w(t.detail)})` : "";
29
- return `${t.message}${m}`;
30
- }));
31
- return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
28
+ }), u = s(() => e.errors.map((t) => {
29
+ const p = t.detail ? ` (${C(t.detail)})` : "";
30
+ return `${t.message}${p}`;
31
+ })), d = s(() => `${r("email-editor.validation-errors")} (${u.value.length})`);
32
+ return { __sfc: !0, trans: r, store: e, editorStore: a, configStore: n, saveWithErrors: i, handleError: l, isSaving: o, footerButtonGroupOptions: m, rows: u, titleText: d, handleClose: () => {
32
33
  e.isDrawerOpen && e.close();
33
34
  }, handleSaveAndContinue: async () => {
34
35
  if (!o.value) {
35
- o.value = !0, n.loadingStatus = !0;
36
+ o.value = !0, a.loadingStatus = !0;
36
37
  try {
37
- await i() ? e.close() : n.loadingStatus = !1;
38
+ await i() ? e.close() : a.loadingStatus = !1;
38
39
  } catch (t) {
39
- console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
40
+ l(t, "Failed to save template"), a.loadingStatus = !1;
40
41
  } finally {
41
42
  o.value = !1;
42
43
  }
43
44
  }
44
- }, WpDrawer: f, InIcons: _ };
45
+ }, WpDrawer: v, InIcons: E };
45
46
  }
46
47
  });
47
48
  export {
48
- V as default
49
+ H as default
49
50
  };
@@ -1,76 +1,78 @@
1
- import { useConfig as E } from "./useConfig.js";
2
- import { useEditorLock as f } from "./useEditorLock.js";
3
- import { useAutosaveStore as p, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
4
- import { useEditorStore as A } from "../stores/editor.js";
5
- import { computed as y, watch as I, onUnmounted as L } from "vue";
6
- const w = 18e4, v = 6e4, R = (b) => {
7
- const { isFeatureEnabled: S } = E(), o = A(), t = p(), { isEditorBusy: g } = f();
8
- let i = null, c = 0;
9
- const u = y(
10
- () => S("autosave") && t.isOn
11
- ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
- hasChanges: o.hasChanges,
13
- isInSaveableState: o.isInSaveableState
14
- }), l = async (e) => {
15
- if (!u.value) {
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 (!m()) {
20
- console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
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 === s.SAVING) {
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 (g()) {
28
+ if (f()) {
28
29
  console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
30
  return;
30
31
  }
31
- e === "visibility" && (c = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
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 b() === void 0) {
34
- console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
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
- o.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
38
- } catch (a) {
39
- console.debug("guido:autosave:error", { trigger: e, error: a }), t.status = s.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
- }, n = () => {
43
+ }, i = () => {
42
44
  const { visibilityState: e } = document;
43
45
  if (console.debug("guido:autosave:visibility-change", {
44
46
  visibilityState: e,
45
- isActive: u.value
47
+ isActive: d.value
46
48
  }), e !== "hidden")
47
49
  return;
48
- const a = Date.now() - c;
49
- if (a < v) {
50
+ const n = Date.now() - l;
51
+ if (n < b) {
50
52
  console.debug("guido:autosave:visibility-debounced", {
51
- sinceLastMs: a,
52
- debounceMs: v
53
+ sinceLastMs: n,
54
+ debounceMs: b
53
55
  });
54
56
  return;
55
57
  }
56
- l("visibility");
57
- }, d = () => {
58
- i && (clearInterval(i), i = null);
59
- }, r = () => {
60
- document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
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
- I(
63
- u,
64
+ V(
65
+ d,
64
66
  (e) => {
65
- console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
66
- console.debug("guido:autosave:interval-tick"), l("interval");
67
- }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), r(), t.status = s.IDLE);
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
- ), L(() => {
71
- d(), r(), t.status = s.IDLE, t.lastSavedAt = null;
72
+ ), k(() => {
73
+ c(), v(), t.status = a.IDLE, t.lastSavedAt = null;
72
74
  });
73
75
  };
74
76
  export {
75
- R as useAutoSave
77
+ _ as useAutoSave
76
78
  };
@@ -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
  };
@@ -1,4 +1,4 @@
1
- import { useActionsApi as W } from "./useActionsApi.js";
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 r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: n } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: l } = O(), c = async (t, e, o) => {
23
- if (!m("allowlistEnabled"))
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 x(t, e);
25
+ const i = await k(t, e);
26
26
  if (!i.length)
27
27
  return !1;
28
28
  if (!o) {
29
- const s = await k(i);
30
- s != null && s.message && V({
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) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), u = async (t, e) => {
38
- if (!await E())
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 R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
43
- f({ ...t, ...R, silent: e.silent });
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
- r();
49
- const o = await d();
48
+ a();
49
+ const o = await m();
50
50
  if (n(o.rawHtml, e)) {
51
- if (B.value && !e) {
52
- const s = await C(
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 = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await c(o.compiledHtml, o.css, e))
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 (!P.allowSaveWithErrors)
67
+ if (!f.allowSaveWithErrors)
68
68
  return;
69
- r();
70
- const t = await d();
71
- if (n(t.rawHtml, !1) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await c(t.compiledHtml, t.css, !1))
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
- r();
75
- const { html: t, css: e } = await H();
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: h.getSelectedDynamicContentList,
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
- recommendation: { campaignUrls: {}, configs: {} },
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