@useinsider/guido 3.18.0-beta.41e529d → 3.18.0-beta.599df29

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 (39) hide show
  1. package/dist/@types/config/schemas.js +1 -3
  2. package/dist/components/Guido.vue.js +2 -2
  3. package/dist/components/Guido.vue2.js +87 -85
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
  6. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  7. package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
  8. package/dist/composables/useActionsApi.js +82 -67
  9. package/dist/composables/useAutoSave.js +31 -26
  10. package/dist/composables/useCustomInterfaceAppearance.js +42 -46
  11. package/dist/composables/useEditorLock.js +20 -0
  12. package/dist/composables/useGuidoStateBridge.js +37 -31
  13. package/dist/composables/useSave.js +42 -39
  14. package/dist/enums/extensions/recommendationBlock.js +1 -2
  15. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
  16. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +31 -66
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +49 -90
  18. package/dist/guido.css +1 -1
  19. package/dist/services/recommendationApi.js +52 -61
  20. package/dist/src/@types/config/schemas.d.ts +0 -4
  21. package/dist/src/composables/useConfig.d.ts +0 -2
  22. package/dist/src/composables/useEditorLock.d.ts +10 -0
  23. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
  24. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -1
  25. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -54
  26. package/dist/src/services/recommendationApi.d.ts +1 -2
  27. package/dist/src/stores/config.d.ts +0 -160
  28. package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
  29. package/dist/stores/config.js +59 -66
  30. package/package.json +1 -1
  31. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
  32. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
  33. package/dist/composables/useLegacyStrategyConversion.js +0 -52
  34. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -58
  35. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
  36. package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
  37. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -39
  38. package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
  39. package/dist/static/assets/icons/line-info.svg.js +0 -5
@@ -1,66 +1,79 @@
1
- import { defineComponent as O, ref as n, computed as h } from "vue";
2
- import { useActionsApi as q } from "../../../composables/useActionsApi.js";
3
- import { useConfig as b } from "../../../composables/useConfig.js";
4
- import { useExport as k } from "../../../composables/useExport.js";
5
- import { useTestEmailClick as B } from "../../../composables/useGuidoActions.js";
6
- import { useHtmlCompiler as D } from "../../../composables/useHtmlCompiler.js";
7
- import { useSave as F } from "../../../composables/useSave.js";
8
- import { useTranslations as L } from "../../../composables/useTranslations.js";
9
- import { useVersionHistoryApi as R } from "../../../composables/useVersionHistoryApi.js";
10
- import { useLiquidValidator as z } from "../../../composables/validators/useLiquidValidator.js";
11
- import { useEditorStore as I } from "../../../stores/editor.js";
12
- import { useTemplateStore as P } from "../../../stores/template.js";
13
- import { getTooltipOptions as j } from "../../../utils/tooltipUtils.js";
14
- import { InButtonV2 as G } from "@useinsider/design-system-vue";
15
- import { storeToRefs as J } from "pinia";
16
- import K from "./MigrationConfirmModal.vue.js";
17
- const ut = /* @__PURE__ */ O({
1
+ import { defineComponent as q, ref as l, computed as w } from "vue";
2
+ import { useActionsApi as b } from "../../../composables/useActionsApi.js";
3
+ import { useConfig as k } from "../../../composables/useConfig.js";
4
+ import { useExport as B } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as D } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as L } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as R } from "../../../composables/useSave.js";
8
+ import { useToaster as z } from "../../../composables/useToaster.js";
9
+ import { useTranslations as I } from "../../../composables/useTranslations.js";
10
+ import { useVersionHistoryApi as P } from "../../../composables/useVersionHistoryApi.js";
11
+ import { useLiquidValidator as j } from "../../../composables/validators/useLiquidValidator.js";
12
+ import { useEditorStore as G } from "../../../stores/editor.js";
13
+ import { useTemplateStore as J } from "../../../stores/template.js";
14
+ import { getTooltipOptions as K } from "../../../utils/tooltipUtils.js";
15
+ import { InButtonV2 as N } from "@useinsider/design-system-vue";
16
+ import { storeToRefs as Q } from "pinia";
17
+ import U from "./MigrationConfirmModal.vue.js";
18
+ const ft = /* @__PURE__ */ q({
18
19
  __name: "EditorActions",
19
- setup(N, { expose: x }) {
20
- const { config: a, isFeatureEnabled: l } = b(), { exportHtml: m } = k(), { save: u } = F(), { openVersionHistory: c, closeVersionHistory: p } = R(), { getCompiledEmail: f } = q(), { compileHtml: d } = D(), { validateLiquidSyntax: v } = z(), e = I(), y = P(), { hasMigrations: g } = J(y), s = L(), i = n(!1), r = n(!1), S = n(), H = B(), T = () => {
20
+ setup(W, { expose: x }) {
21
+ const { config: m, isFeatureEnabled: c } = k(), { exportHtml: p } = B(), { save: u } = R(), { openVersionHistory: f, closeVersionHistory: d } = P(), { getCompiledEmail: v } = b(), { compileHtml: y } = L(), { validateLiquidSyntax: g } = j(), { handleError: r } = z(), e = G(), h = J(), { hasMigrations: H } = Q(h), s = I(), i = l(!1), a = l(!1), S = l(), V = D(), _ = () => {
21
22
  if (e.isVersionHistoryOpen) {
22
- p();
23
+ d();
23
24
  return;
24
25
  }
25
- c();
26
- }, w = async () => {
27
- i.value = !0, await m(), i.value = !1;
28
- }, _ = () => {
26
+ f();
27
+ }, C = async () => {
28
+ i.value = !0, await p(), i.value = !1;
29
+ }, A = () => {
29
30
  e.isSaveAsTemplateDrawerOpen = !0;
30
- }, C = h(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), A = h(
31
+ }, M = w(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = w(
31
32
  () => {
32
33
  var t, o;
33
- return ((o = (t = a.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
34
+ return ((o = (t = m.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
34
35
  }
35
- ), V = async (t) => {
36
- r.value = !0, t || (e.loadingStatus = !0);
37
- const o = await u(t);
38
- return r.value = !1, !t && !o && (e.loadingStatus = !1), o;
39
- }, E = (t) => {
36
+ ), E = async (t) => {
37
+ a.value = !0, t || (e.loadingStatus = !0);
38
+ let o;
39
+ try {
40
+ o = await u(t);
41
+ } catch (n) {
42
+ if (t)
43
+ throw n;
44
+ r(n, "Failed to save template");
45
+ } finally {
46
+ a.value = !1, !t && !o && (e.loadingStatus = !1);
47
+ }
48
+ return o;
49
+ }, T = (t) => {
40
50
  var o;
41
- if (!t && g.value) {
51
+ if (!t && H.value) {
42
52
  (o = S.value) == null || o.open();
43
53
  return;
44
54
  }
45
- return V(t);
46
- }, M = async () => {
47
- if (l("liquidSyntax")) {
55
+ return E(t);
56
+ }, F = async () => {
57
+ if (c("liquidSyntax")) {
48
58
  e.loadingStatus = !0;
49
59
  try {
50
- const { html: t } = await f({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = d(t);
51
- if (!await v(o))
60
+ const { html: t } = await v({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = y(t);
61
+ if (!await g(o))
52
62
  return;
63
+ } catch (t) {
64
+ r(t, "Failed to prepare test email");
65
+ return;
53
66
  } finally {
54
67
  e.loadingStatus = !1;
55
68
  }
56
69
  }
57
- H();
70
+ V();
58
71
  };
59
72
  return x({
60
- handleSave: E
61
- }), { __sfc: !0, config: a, isFeatureEnabled: l, exportHtml: m, save: u, openVersionHistory: c, closeVersionHistory: p, getCompiledEmail: f, compileHtml: d, validateLiquidSyntax: v, editorStore: e, templateStore: y, hasMigrations: g, trans: s, isExporting: i, isSaving: r, migrationModalRef: S, testEmailClick: H, handleVersionHistory: T, handleExport: w, handleSaveAs: _, versionHistoryTooltipText: C, isVersionHistoryButtonVisible: A, executeSave: V, handleSave: E, handleTestEmail: M, getTooltipOptions: j, InButtonV2: G, MigrationConfirmModal: K };
73
+ handleSave: T
74
+ }), { __sfc: !0, config: m, isFeatureEnabled: c, exportHtml: p, save: u, openVersionHistory: f, closeVersionHistory: d, getCompiledEmail: v, compileHtml: y, validateLiquidSyntax: g, handleError: r, editorStore: e, templateStore: h, hasMigrations: H, trans: s, isExporting: i, isSaving: a, migrationModalRef: S, testEmailClick: V, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: E, handleSave: T, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
62
75
  }
63
76
  });
64
77
  export {
65
- ut as default
78
+ ft as default
66
79
  };
@@ -1,52 +1,68 @@
1
- import { filterAmpErrors as T } from "../utils/ampErrorFilter.js";
2
- import { useToaster as A } from "./useToaster.js";
3
- const p = 1e4, D = () => {
4
- const { handleError: r } = A(), l = (t = {}) => new Promise((e, a) => {
5
- const o = { ...{
6
- minimize: !0,
7
- utmEntity: {
8
- utmSource: "",
9
- utmMedium: "",
10
- utmCampaign: "",
11
- utmContent: "",
12
- utmTerm: "",
13
- customUtms: [
14
- {
15
- name1: "val1",
16
- name2: "val2"
17
- }
18
- ]
19
- },
20
- mergeTags: ["Tag1", "Tag2"],
21
- forceAmp: !1,
22
- resetDataSavedFlag: !1,
23
- disableLineHeightsReplace: !0
24
- }, ...t }, n = {
25
- callback: (m, d, c, u, w) => {
26
- m ? a(m) : e({
27
- html: d,
28
- ampHtml: c,
29
- ampErrors: T(u ?? []),
30
- displayConditions: w
31
- });
32
- },
33
- ...o
34
- };
35
- window.StripoEditorApi.actionsApi.compileEmail(n);
36
- });
1
+ import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
2
+ import { useToaster as y } from "./useToaster.js";
3
+ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
4
+ const w = setTimeout(
5
+ () => m(new Error(`${n} did not report completion within ${l}ms`)),
6
+ l
7
+ ), p = (A) => (t) => {
8
+ clearTimeout(w), A(t);
9
+ };
10
+ u(p(T), p(m));
11
+ }), I = () => {
12
+ const { handleError: n } = y(), l = (t = {}) => s(
13
+ "compileEmail",
14
+ d,
15
+ (e, a) => {
16
+ const o = { ...{
17
+ minimize: !0,
18
+ utmEntity: {
19
+ utmSource: "",
20
+ utmMedium: "",
21
+ utmCampaign: "",
22
+ utmContent: "",
23
+ utmTerm: "",
24
+ customUtms: [
25
+ {
26
+ name1: "val1",
27
+ name2: "val2"
28
+ }
29
+ ]
30
+ },
31
+ mergeTags: ["Tag1", "Tag2"],
32
+ forceAmp: !1,
33
+ resetDataSavedFlag: !1,
34
+ disableLineHeightsReplace: !0
35
+ }, ...t }, c = {
36
+ callback: (r, C, f, S, g) => {
37
+ r ? a(r) : e({
38
+ html: C,
39
+ ampHtml: f,
40
+ ampErrors: v(S ?? []),
41
+ displayConditions: g
42
+ });
43
+ },
44
+ ...o
45
+ };
46
+ window.StripoEditorApi.actionsApi.compileEmail(c);
47
+ }
48
+ );
37
49
  return {
38
50
  getCompiledEmail: l,
39
- getTemplateData: () => new Promise((t) => {
40
- const e = ({ html: a, css: i, width: o, height: s, utmParams: n, syncModulesIds: m }) => t({
41
- html: a,
42
- css: i,
43
- width: o,
44
- height: s,
45
- utmParams: n,
46
- syncModulesIds: m
47
- });
48
- window.StripoEditorApi.actionsApi.getTemplateData(e);
49
- }),
51
+ getTemplateData: () => s(
52
+ "getTemplateData",
53
+ d,
54
+ (t) => {
55
+ const e = ({ html: a, css: i, width: o, height: E, utmParams: c, syncModulesIds: r }) => t({
56
+ html: a,
57
+ css: i,
58
+ width: o,
59
+ height: E,
60
+ utmParams: c,
61
+ syncModulesIds: r
62
+ });
63
+ window.StripoEditorApi.actionsApi.getTemplateData(e);
64
+ }
65
+ ),
50
66
  activateCustomViewStyles: (t = !0) => {
51
67
  window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
52
68
  },
@@ -65,7 +81,7 @@ const p = 1e4, D = () => {
65
81
  displayConditions: a
66
82
  };
67
83
  } catch (e) {
68
- return r(e, "Error loading preview"), {
84
+ return n(e, "Error loading preview"), {
69
85
  html: "",
70
86
  ampHtml: "",
71
87
  ampErrors: [],
@@ -81,34 +97,33 @@ const p = 1e4, D = () => {
81
97
  }
82
98
  try {
83
99
  window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
84
- i ? (r(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
100
+ i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
85
101
  });
86
102
  } catch (i) {
87
- r(i, "Failed to call updateTimerInClonedTemplate"), t(null);
103
+ n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
88
104
  }
89
105
  }),
90
106
  updateHtmlAndCss: (t, e) => {
91
107
  const { actionsApi: a } = window.StripoEditorApi;
92
- return new Promise((i, o) => {
93
- const s = new Error(
94
- `updateHtmlAndCss did not report completion within ${p}ms`
95
- ), n = setTimeout(() => o(s), p);
96
- a.updateHtmlAndCss(t, e, () => {
97
- clearTimeout(n), i();
98
- });
108
+ return s("updateHtmlAndCss", D, (i) => {
109
+ a.updateHtmlAndCss(t, e, () => i());
99
110
  });
100
111
  },
101
- editorSave: () => new Promise((t) => {
102
- window.StripoEditorApi.actionsApi.save((e) => {
103
- if (e) {
104
- r(e, "Failed to save template"), t(!1);
105
- return;
106
- }
107
- t(!0);
108
- });
109
- })
112
+ editorSave: () => s(
113
+ "save",
114
+ d,
115
+ (t) => {
116
+ window.StripoEditorApi.actionsApi.save((e) => {
117
+ if (e) {
118
+ n(e, "Failed to save template"), t(!1);
119
+ return;
120
+ }
121
+ t(!0);
122
+ });
123
+ }
124
+ )
110
125
  };
111
126
  };
112
127
  export {
113
- D as useActionsApi
128
+ I as useActionsApi
114
129
  };
@@ -1,21 +1,22 @@
1
- import { useConfig as m } from "./useConfig.js";
1
+ import { useConfig as E } from "./useConfig.js";
2
+ import { useEditorLock as p } from "./useEditorLock.js";
2
3
  import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
3
- import { useEditorStore as E } from "../stores/editor.js";
4
- import { computed as f, watch as p, onUnmounted as y } from "vue";
5
- const I = 18e4, r = 6e4, T = (b) => {
6
- const { isFeatureEnabled: S } = m(), a = E(), t = A();
4
+ import { useEditorStore as f } 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 = f(), t = A(), { isEditorBusy: g } = p();
7
8
  let i = null, c = 0;
8
- const u = f(
9
+ const u = y(
9
10
  () => S("autosave") && t.isOn
10
- ), g = () => a.hasChanges && a.isInSaveableState, h = () => ({
11
- hasChanges: a.hasChanges,
12
- isInSaveableState: a.isInSaveableState
13
- }), l = async (e) => {
11
+ ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
+ hasChanges: o.hasChanges,
13
+ isInSaveableState: o.isInSaveableState
14
+ }), r = async (e) => {
14
15
  if (!u.value) {
15
16
  console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
16
17
  return;
17
18
  }
18
- if (!g()) {
19
+ if (!m()) {
19
20
  console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
20
21
  return;
21
22
  }
@@ -23,15 +24,19 @@ const I = 18e4, r = 6e4, T = (b) => {
23
24
  console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
24
25
  return;
25
26
  }
27
+ if (g()) {
28
+ console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
+ return;
30
+ }
26
31
  console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
27
32
  try {
28
33
  if (await b() === void 0) {
29
34
  console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
30
35
  return;
31
36
  }
32
- a.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
33
- } catch (o) {
34
- console.debug("guido:autosave:error", { trigger: e, error: o }), t.status = s.ERROR;
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;
35
40
  }
36
41
  }, n = () => {
37
42
  const { visibilityState: e } = document;
@@ -40,32 +45,32 @@ const I = 18e4, r = 6e4, T = (b) => {
40
45
  isActive: u.value
41
46
  }), e !== "hidden")
42
47
  return;
43
- const o = Date.now() - c;
44
- if (o < r) {
48
+ const a = Date.now() - c;
49
+ if (a < v) {
45
50
  console.debug("guido:autosave:visibility-debounced", {
46
- sinceLastMs: o,
47
- debounceMs: r
51
+ sinceLastMs: a,
52
+ debounceMs: v
48
53
  });
49
54
  return;
50
55
  }
51
- c = Date.now(), l("visibility");
56
+ c = Date.now(), r("visibility");
52
57
  }, d = () => {
53
58
  i && (clearInterval(i), i = null);
54
- }, v = () => {
59
+ }, l = () => {
55
60
  document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
56
61
  };
57
- p(
62
+ I(
58
63
  u,
59
64
  (e) => {
60
65
  console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
61
- console.debug("guido:autosave:interval-tick"), l("interval");
62
- }, I), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), v(), t.status = s.IDLE);
66
+ console.debug("guido:autosave:interval-tick"), r("interval");
67
+ }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
63
68
  },
64
69
  { immediate: !0 }
65
- ), y(() => {
66
- d(), v(), t.status = s.IDLE, t.lastSavedAt = null;
70
+ ), L(() => {
71
+ d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
67
72
  });
68
73
  };
69
74
  export {
70
- T as useAutoSave
75
+ R as useAutoSave
71
76
  };
@@ -1,71 +1,67 @@
1
- import i from "../static/assets/icons/filled-arrow-rising.svg.js";
2
- import n from "../static/assets/icons/line-change.svg.js";
3
- import S from "../static/assets/icons/line-delete.svg.js";
4
- import p from "../static/assets/icons/line-info.svg.js";
5
- import s from "../static/assets/icons/line-plus.svg.js";
6
- import f from "../static/styles/base.css.js";
7
- import C from "../static/styles/components/alert-message.css.js";
8
- import a from "../static/styles/components/amp-block.css.js";
9
- import c from "../static/styles/components/base-input.css.js";
10
- import l from "../static/styles/components/button-group.css.js";
11
- import u from "../static/styles/components/button.css.js";
12
- import d from "../static/styles/components/combobox.css.js";
13
- import I from "../static/styles/components/counter.css.js";
14
- import g from "../static/styles/components/dropdown-menu.css.js";
1
+ import S from "../static/assets/icons/line-change.svg.js";
2
+ import i from "../static/assets/icons/line-delete.svg.js";
3
+ import n from "../static/assets/icons/line-plus.svg.js";
4
+ import p from "../static/styles/base.css.js";
5
+ import s from "../static/styles/components/alert-message.css.js";
6
+ import C from "../static/styles/components/amp-block.css.js";
7
+ import a from "../static/styles/components/base-input.css.js";
8
+ import f from "../static/styles/components/button-group.css.js";
9
+ import c from "../static/styles/components/button.css.js";
10
+ import u from "../static/styles/components/combobox.css.js";
11
+ import l from "../static/styles/components/counter.css.js";
12
+ import d from "../static/styles/components/dropdown-menu.css.js";
15
13
  import h from "../static/styles/components/loader.css.js";
16
- import w from "../static/styles/components/narrow-panel.css.js";
17
- import $ from "../static/styles/components/popup.css.js";
18
- import y from "../static/styles/components/recommendation-strategy.css.js";
19
- import b from "../static/styles/components/switcher.css.js";
20
- import B from "../static/styles/components/tabs.css.js";
21
- import A from "../static/styles/components/tools.css.js";
22
- import P from "../static/styles/components/version-history.css.js";
23
- import R from "../static/styles/components/wide-panel.css.js";
14
+ import g from "../static/styles/components/narrow-panel.css.js";
15
+ import I from "../static/styles/components/popup.css.js";
16
+ import w from "../static/styles/components/recommendation-strategy.css.js";
17
+ import y from "../static/styles/components/switcher.css.js";
18
+ import b from "../static/styles/components/tabs.css.js";
19
+ import B from "../static/styles/components/tools.css.js";
20
+ import $ from "../static/styles/components/version-history.css.js";
21
+ import P from "../static/styles/components/wide-panel.css.js";
24
22
  import x from "../static/styles/variables.css.js";
25
- function o(t, r) {
26
- return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
23
+ function r(t, o) {
24
+ return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
27
25
  }
28
- const V = `:host {
29
- ${o("line-change", n)}
30
- ${o("line-delete", S)}
31
- ${o("filled-arrow-rising", i)}
32
- ${o("line-info", p)}
33
- ${o("line-plus", s)}
34
- }`, D = [
26
+ const A = `:host {
27
+ ${r("line-change", S)}
28
+ ${r("line-delete", i)}
29
+ ${r("line-plus", n)}
30
+ }`, R = [
35
31
  x,
36
32
  // Must be on top
37
- V,
38
- f,
33
+ A,
34
+ p,
39
35
  // Must be on top
36
+ s,
40
37
  C,
41
38
  a,
39
+ f,
42
40
  c,
43
- l,
44
41
  u,
42
+ l,
45
43
  d,
46
- I,
47
- g,
48
44
  h,
49
- w,
50
- $,
45
+ g,
46
+ I,
47
+ y,
51
48
  b,
52
49
  B,
53
- A,
50
+ $,
54
51
  P,
55
- R,
56
- y
52
+ w
57
53
  // Last: overrides button.css / wide-panel.css defaults
58
54
  ].join(`
59
55
 
60
- `), ro = () => ({ importCss: () => {
61
- const r = new CSSStyleSheet();
62
- r.replaceSync(D);
56
+ `), Y = () => ({ importCss: () => {
57
+ const o = new CSSStyleSheet();
58
+ o.replaceSync(R);
63
59
  const e = document.querySelector("ui-editor");
64
60
  if (!e)
65
61
  return;
66
62
  const m = e.shadowRoot;
67
- m && (m.adoptedStyleSheets = [r]);
63
+ m && (m.adoptedStyleSheets = [o]);
68
64
  } });
69
65
  export {
70
- ro as useCustomInterfaceAppearance
66
+ Y as useCustomInterfaceAppearance
71
67
  };
@@ -0,0 +1,20 @@
1
+ let o = Promise.resolve(), n = 0, e = 0;
2
+ const s = () => n > 0, c = () => (e += 1, e), u = (t) => t > 0 && t === e, i = (t) => {
3
+ const r = o.then(async () => {
4
+ n += 1;
5
+ try {
6
+ return await t();
7
+ } finally {
8
+ n -= 1;
9
+ }
10
+ });
11
+ return o = r.catch(() => {
12
+ }), r;
13
+ }, a = () => ({ runExclusive: i, isEditorBusy: s, beginMount: c, isCurrentMount: u });
14
+ export {
15
+ c as beginMount,
16
+ u as isCurrentMount,
17
+ s as isEditorBusy,
18
+ i as runExclusive,
19
+ a as useEditorLock
20
+ };
@@ -1,48 +1,54 @@
1
- import { useActionsApi as g } from "./useActionsApi.js";
2
- import { useConfigStore as I } from "../stores/config.js";
3
- import { useEditorStore as b } from "../stores/editor.js";
4
- import { useGuidoEmailEditorStore as E } from "../stores/guido-email-editor.js";
5
- import { watch as c, onUnmounted as T } from "vue";
6
- const w = 500, z = () => {
7
- const i = b(), a = E(), l = I(), { getTemplateData: m } = g();
8
- let e = null, n = !1;
9
- const r = () => {
10
- e && (clearTimeout(e), e = null);
11
- }, s = async () => {
12
- var t, o;
13
- if (!(n || !i.isStripoInitialized))
1
+ import { useActionsApi as b } from "./useActionsApi.js";
2
+ import { useEditorLock as v } from "./useEditorLock.js";
3
+ import { useConfigStore as T } from "../stores/config.js";
4
+ import { useEditorStore as w } from "../stores/editor.js";
5
+ import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
6
+ import { watch as a, onUnmounted as B } from "vue";
7
+ const C = 500, L = () => {
8
+ const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
9
+ let o = null, s = !1;
10
+ const n = () => {
11
+ o && (clearTimeout(o), o = null);
12
+ }, c = (t) => {
13
+ n(), o = setTimeout(() => {
14
+ o = null, t();
15
+ }, C);
16
+ }, e = async () => {
17
+ var t, r;
18
+ if (!(s || !i.isStripoInitialized)) {
19
+ if (p()) {
20
+ c(() => void e());
21
+ return;
22
+ }
14
23
  try {
15
- const { html: f, css: h } = await m(), S = ((o = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : o.templateId) ?? "";
16
- if (n)
24
+ const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
25
+ if (s)
17
26
  return;
18
- a.$patch({
19
- html: f ?? "",
20
- css: h ?? "",
21
- templateId: S,
27
+ u.$patch({
28
+ html: E ?? "",
29
+ css: g ?? "",
30
+ templateId: I,
22
31
  lastUpdatedAt: Date.now()
23
32
  });
24
33
  } catch {
25
34
  }
26
- }, u = () => {
27
- r(), e = setTimeout(() => {
28
- e = null, s();
29
- }, w);
30
- }, d = c(
35
+ }
36
+ }, f = () => c(() => void e()), h = a(
31
37
  () => i.isStripoInitialized,
32
38
  (t) => {
33
- t && s();
39
+ t && e();
34
40
  },
35
41
  { immediate: !0 }
36
- ), p = c(
42
+ ), S = a(
37
43
  () => i.hasChanges,
38
- (t, o) => {
39
- i.isStripoInitialized && (t ? u() : o && (r(), s()));
44
+ (t, r) => {
45
+ i.isStripoInitialized && (t ? f() : r && (n(), e()));
40
46
  }
41
47
  );
42
- T(() => {
43
- n = !0, r(), d(), p();
48
+ B(() => {
49
+ s = !0, n(), h(), S();
44
50
  });
45
51
  };
46
52
  export {
47
- z as useGuidoStateBridge
53
+ L as useGuidoStateBridge
48
54
  };