@useinsider/guido 3.17.0-beta.ec8eabb → 3.17.0-beta.f552101

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 (103) hide show
  1. package/README.md +6 -5
  2. package/dist/@types/config/schemas.js +7 -6
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +100 -95
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
  11. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  12. package/dist/components/organisms/header/EditorActions.vue2.js +36 -44
  13. package/dist/composables/useActionsApi.js +67 -82
  14. package/dist/composables/useAutoSave.js +26 -31
  15. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  16. package/dist/composables/useGuidoStateBridge.js +30 -31
  17. package/dist/composables/useRecommendation.js +41 -34
  18. package/dist/composables/useSave.js +36 -40
  19. package/dist/composables/useStripo.js +14 -14
  20. package/dist/config/i18n/en/labels.json.js +1 -1
  21. package/dist/config/migrator/index.js +9 -8
  22. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  23. package/dist/config/migrator/recommendation/extractors.js +29 -24
  24. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  25. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  26. package/dist/config/migrator/recommendationMigrator.js +31 -25
  27. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  28. package/dist/enums/academy.js +2 -1
  29. package/dist/enums/date.js +5 -3
  30. package/dist/enums/extensions/recommendationBlock.js +3 -1
  31. package/dist/extensions/Blocks/Items/block.js +98 -49
  32. package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
  33. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  34. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  35. package/dist/extensions/Blocks/Items/template.js +153 -152
  36. package/dist/extensions/Blocks/Recommendation/block.js +35 -29
  37. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  38. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  39. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
  40. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  41. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
  42. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
  43. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
  44. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  45. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  46. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  47. package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
  48. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  49. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  51. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  52. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  53. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  54. package/dist/extensions/Blocks/common-control.js +22 -19
  55. package/dist/guido.css +1 -1
  56. package/dist/services/recommendationApi.js +69 -30
  57. package/dist/src/@types/config/schemas.d.ts +2 -0
  58. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  59. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  60. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  61. package/dist/src/composables/useConfig.d.ts +2 -0
  62. package/dist/src/composables/useRecommendation.d.ts +1 -0
  63. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  64. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  65. package/dist/src/enums/academy.d.ts +1 -0
  66. package/dist/src/enums/date.d.ts +1 -0
  67. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  68. package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
  69. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
  70. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  71. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  72. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
  73. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  74. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
  78. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
  79. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  81. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  82. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
  83. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  84. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
  85. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  86. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  87. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  88. package/dist/src/services/recommendationApi.d.ts +4 -1
  89. package/dist/src/stores/config.d.ts +18 -0
  90. package/dist/src/stores/save-as-template.d.ts +4 -3
  91. package/dist/src/utils/genericUtil.d.ts +5 -0
  92. package/dist/static/assets/icons/line-change.svg.js +5 -0
  93. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  94. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  95. package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
  96. package/dist/static/styles/customEditorStyle.css.js +3 -1
  97. package/dist/utils/dateUtil.js +23 -10
  98. package/dist/utils/genericUtil.js +28 -27
  99. package/dist/utils/pairProductVariables.js +60 -59
  100. package/dist/utils/templatePreparation.js +35 -34
  101. package/package.json +3 -2
  102. package/dist/composables/useEditorLock.js +0 -18
  103. package/dist/src/composables/useEditorLock.d.ts +0 -11
@@ -0,0 +1,63 @@
1
+ import { defineComponent as f, computed as i } from "vue";
2
+ import { useTranslations as _ } from "../../../../composables/useTranslations.js";
3
+ import { asText as c } from "../../../../utils/genericUtil.js";
4
+ const j = /* @__PURE__ */ f({
5
+ __name: "StrategyInfoBoxContent",
6
+ props: {
7
+ strategy: null
8
+ },
9
+ setup(p) {
10
+ const a = p, n = _(), s = i(() => n("recommendation-strategy.none")), u = i(() => {
11
+ const e = c(a.strategy.algorithm) === "MIXED" ? n("discovery-strategy.mixed-algorithm") : n("discovery-strategy.single-algorithm"), t = c(a.strategy.algorithm_used).split(",").map((r) => r.trim()).filter(Boolean).map((r) => n(`recommendation-algorithm-names.${r.replaceAll("_", "-").toLowerCase()}`));
12
+ return t.length ? `${e} · ${t.join(", ")}` : e;
13
+ }), d = i(() => [
14
+ [a.strategy.exclude_view, "discovery-strategy.exclude-recently-view-items"],
15
+ [a.strategy.exclude_purchase, "discovery-strategy.exclude-recently-purchased-items"],
16
+ [a.strategy.exclude_cart, "discovery-strategy.exclude-recently-added-cart-items"]
17
+ ].filter(([e]) => Number(e) === 1).map(([, e]) => n(e)).join(", ") || s.value), l = (e) => {
18
+ const t = c(e).trim();
19
+ if (!t)
20
+ return "";
21
+ let r;
22
+ try {
23
+ r = JSON.parse(t);
24
+ } catch {
25
+ return t;
26
+ }
27
+ if (Array.isArray(r))
28
+ return r.length ? String(r.length) : "";
29
+ if (r && typeof r == "object") {
30
+ const o = Object.keys(r).length;
31
+ return o ? String(o) : "";
32
+ }
33
+ return t;
34
+ }, m = i(() => l(a.strategy.manual_merchandising) || l(a.strategy.manual_merchandising_products) || s.value), g = (e) => {
35
+ if (Array.isArray(e))
36
+ return e.length;
37
+ const { conditionList: t } = e ?? {};
38
+ return Array.isArray(t) ? t.length : 1;
39
+ }, y = i(() => {
40
+ const e = a.strategy.filters;
41
+ if (!e)
42
+ return s.value;
43
+ try {
44
+ const t = typeof e == "string" ? JSON.parse(e) : e;
45
+ if (!t || typeof t != "object")
46
+ return s.value;
47
+ const r = Object.values(t).reduce((o, v) => o + g(v), 0);
48
+ return r ? String(r) : s.value;
49
+ } catch {
50
+ return s.value;
51
+ }
52
+ }), h = i(() => [
53
+ { title: n("gpt-app-builder.algorithms-and-method"), value: u.value },
54
+ { title: n("gpt-app-builder.exclusions"), value: d.value },
55
+ { title: n("discovery-strategy.filters"), value: y.value },
56
+ { title: n("action-builder.manual-merchandising"), value: m.value }
57
+ ]);
58
+ return { __sfc: !0, props: a, trans: n, none: s, algorithmsAndMethod: u, exclusions: d, asMerchandising: l, manualMerchandising: m, conditionsIn: g, filters: y, details: h };
59
+ }
60
+ });
61
+ export {
62
+ j as default
63
+ };
@@ -15,7 +15,7 @@ var u = function() {
15
15
  p,
16
16
  !1,
17
17
  null,
18
- "fa75f9c3"
18
+ "6e711fd7"
19
19
  );
20
20
  const v = c.exports;
21
21
  export {
@@ -1,57 +1,49 @@
1
- import { defineComponent as F, ref as a, computed as x } 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__ */ F({
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({
19
18
  __name: "EditorActions",
20
- setup(W, { expose: w }) {
21
- const { config: n, isFeatureEnabled: l } = k(), { exportHtml: m } = B(), { save: u } = R(), { openVersionHistory: c, closeVersionHistory: p } = P(), { getCompiledEmail: f } = b(), { compileHtml: d } = L(), { validateLiquidSyntax: v } = j(), { handleError: y } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), r = I(), s = a(!1), i = a(!1), H = a(), V = D(), _ = () => {
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 = () => {
22
21
  if (e.isVersionHistoryOpen) {
23
22
  p();
24
23
  return;
25
24
  }
26
25
  c();
27
- }, C = async () => {
28
- s.value = !0, await m(), s.value = !1;
29
- }, A = () => {
26
+ }, w = async () => {
27
+ i.value = !0, await m(), i.value = !1;
28
+ }, _ = () => {
30
29
  e.isSaveAsTemplateDrawerOpen = !0;
31
- }, M = x(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), O = x(
30
+ }, C = h(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), A = h(
32
31
  () => {
33
32
  var t, o;
34
- return ((o = (t = n.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
33
+ return ((o = (t = a.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
35
34
  }
36
- ), h = async (t) => {
37
- i.value = !0, t || (e.loadingStatus = !0);
38
- let o;
39
- try {
40
- o = await u(t);
41
- } catch (T) {
42
- y(T, "Failed to save template");
43
- } finally {
44
- i.value = !1, !t && !o && (e.loadingStatus = !1);
45
- }
46
- return o;
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;
47
39
  }, E = (t) => {
48
40
  var o;
49
- if (!t && S.value) {
50
- (o = H.value) == null || o.open();
41
+ if (!t && g.value) {
42
+ (o = S.value) == null || o.open();
51
43
  return;
52
44
  }
53
- return h(t);
54
- }, q = async () => {
45
+ return V(t);
46
+ }, M = async () => {
55
47
  if (l("liquidSyntax")) {
56
48
  e.loadingStatus = !0;
57
49
  try {
@@ -62,13 +54,13 @@ const ft = /* @__PURE__ */ F({
62
54
  e.loadingStatus = !1;
63
55
  }
64
56
  }
65
- V();
57
+ H();
66
58
  };
67
- return w({
59
+ return x({
68
60
  handleSave: E
69
- }), { __sfc: !0, config: n, isFeatureEnabled: l, exportHtml: m, save: u, openVersionHistory: c, closeVersionHistory: p, getCompiledEmail: f, compileHtml: d, validateLiquidSyntax: v, handleError: y, editorStore: e, templateStore: g, hasMigrations: S, trans: r, isExporting: s, isSaving: i, migrationModalRef: H, testEmailClick: V, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: h, handleSave: E, handleTestEmail: q, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
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 };
70
62
  }
71
63
  });
72
64
  export {
73
- ft as default
65
+ ut as default
74
66
  };
@@ -1,68 +1,52 @@
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
- );
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
+ });
49
37
  return {
50
38
  getCompiledEmail: l,
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
- ),
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
+ }),
66
50
  activateCustomViewStyles: (t = !0) => {
67
51
  window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
68
52
  },
@@ -81,7 +65,7 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
81
65
  displayConditions: a
82
66
  };
83
67
  } catch (e) {
84
- return n(e, "Error loading preview"), {
68
+ return r(e, "Error loading preview"), {
85
69
  html: "",
86
70
  ampHtml: "",
87
71
  ampErrors: [],
@@ -97,33 +81,34 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
97
81
  }
98
82
  try {
99
83
  window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
100
- i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
84
+ i ? (r(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
101
85
  });
102
86
  } catch (i) {
103
- n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
87
+ r(i, "Failed to call updateTimerInClonedTemplate"), t(null);
104
88
  }
105
89
  }),
106
90
  updateHtmlAndCss: (t, e) => {
107
91
  const { actionsApi: a } = window.StripoEditorApi;
108
- return s("updateHtmlAndCss", D, (i) => {
109
- a.updateHtmlAndCss(t, e, () => i());
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
+ });
110
99
  });
111
100
  },
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
- )
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
+ })
125
110
  };
126
111
  };
127
112
  export {
128
- I as useActionsApi
113
+ D as useActionsApi
129
114
  };
@@ -1,22 +1,21 @@
1
- import { useConfig as E } from "./useConfig.js";
2
- import { useEditorLock as p } from "./useEditorLock.js";
1
+ import { useConfig as m } from "./useConfig.js";
3
2
  import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
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();
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();
8
7
  let i = null, c = 0;
9
- const u = y(
8
+ const u = f(
10
9
  () => S("autosave") && t.isOn
11
- ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
- hasChanges: o.hasChanges,
13
- isInSaveableState: o.isInSaveableState
14
- }), r = async (e) => {
10
+ ), g = () => a.hasChanges && a.isInSaveableState, h = () => ({
11
+ hasChanges: a.hasChanges,
12
+ isInSaveableState: a.isInSaveableState
13
+ }), l = async (e) => {
15
14
  if (!u.value) {
16
15
  console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
17
16
  return;
18
17
  }
19
- if (!m()) {
18
+ if (!g()) {
20
19
  console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
21
20
  return;
22
21
  }
@@ -24,19 +23,15 @@ const w = 18e4, v = 6e4, R = (b) => {
24
23
  console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
25
24
  return;
26
25
  }
27
- if (g()) {
28
- console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
- return;
30
- }
31
26
  console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
32
27
  try {
33
28
  if (await b() === void 0) {
34
29
  console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
35
30
  return;
36
31
  }
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;
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;
40
35
  }
41
36
  }, n = () => {
42
37
  const { visibilityState: e } = document;
@@ -45,32 +40,32 @@ const w = 18e4, v = 6e4, R = (b) => {
45
40
  isActive: u.value
46
41
  }), e !== "hidden")
47
42
  return;
48
- const a = Date.now() - c;
49
- if (a < v) {
43
+ const o = Date.now() - c;
44
+ if (o < r) {
50
45
  console.debug("guido:autosave:visibility-debounced", {
51
- sinceLastMs: a,
52
- debounceMs: v
46
+ sinceLastMs: o,
47
+ debounceMs: r
53
48
  });
54
49
  return;
55
50
  }
56
- c = Date.now(), r("visibility");
51
+ c = Date.now(), l("visibility");
57
52
  }, d = () => {
58
53
  i && (clearInterval(i), i = null);
59
- }, l = () => {
54
+ }, v = () => {
60
55
  document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
61
56
  };
62
- I(
57
+ p(
63
58
  u,
64
59
  (e) => {
65
60
  console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
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);
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);
68
63
  },
69
64
  { immediate: !0 }
70
- ), L(() => {
71
- d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
65
+ ), y(() => {
66
+ d(), v(), t.status = s.IDLE, t.lastSavedAt = null;
72
67
  });
73
68
  };
74
69
  export {
75
- R as useAutoSave
70
+ T as useAutoSave
76
71
  };
@@ -1,53 +1,67 @@
1
- import S from "../static/styles/base.css.js";
2
- import m from "../static/styles/components/alert-message.css.js";
3
- import e from "../static/styles/components/amp-block.css.js";
4
- import i from "../static/styles/components/base-input.css.js";
5
- import p from "../static/styles/components/button-group.css.js";
6
- import n from "../static/styles/components/button.css.js";
7
- import s from "../static/styles/components/combobox.css.js";
8
- import C from "../static/styles/components/counter.css.js";
9
- import f from "../static/styles/components/dropdown-menu.css.js";
10
- import a from "../static/styles/components/loader.css.js";
11
- import u from "../static/styles/components/narrow-panel.css.js";
12
- import c from "../static/styles/components/popup.css.js";
13
- import d from "../static/styles/components/switcher.css.js";
14
- import l from "../static/styles/components/tabs.css.js";
15
- import h from "../static/styles/components/tools.css.js";
16
- import w from "../static/styles/components/version-history.css.js";
17
- import y from "../static/styles/components/wide-panel.css.js";
18
- import B from "../static/styles/variables.css.js";
19
- const b = [
20
- B,
21
- // Must be on top
22
- S,
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";
13
+ import h from "../static/styles/components/loader.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";
22
+ import x from "../static/styles/variables.css.js";
23
+ function r(t, o) {
24
+ return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
25
+ }
26
+ const A = `:host {
27
+ ${r("line-change", S)}
28
+ ${r("line-delete", i)}
29
+ ${r("line-plus", n)}
30
+ }`, R = [
31
+ x,
23
32
  // Must be on top
24
- m,
25
- e,
26
- i,
33
+ A,
27
34
  p,
28
- n,
35
+ // Must be on top
29
36
  s,
30
37
  C,
31
- f,
32
38
  a,
33
- u,
39
+ f,
34
40
  c,
35
- d,
41
+ u,
36
42
  l,
43
+ d,
37
44
  h,
38
- w,
39
- y
45
+ g,
46
+ I,
47
+ y,
48
+ b,
49
+ B,
50
+ $,
51
+ P,
52
+ w
53
+ // Last: overrides button.css / wide-panel.css defaults
40
54
  ].join(`
41
55
 
42
- `), v = () => ({ importCss: () => {
56
+ `), Y = () => ({ importCss: () => {
43
57
  const o = new CSSStyleSheet();
44
- o.replaceSync(b);
45
- const r = document.querySelector("ui-editor");
46
- if (!r)
58
+ o.replaceSync(R);
59
+ const e = document.querySelector("ui-editor");
60
+ if (!e)
47
61
  return;
48
- const t = r.shadowRoot;
49
- t && (t.adoptedStyleSheets = [o]);
62
+ const m = e.shadowRoot;
63
+ m && (m.adoptedStyleSheets = [o]);
50
64
  } });
51
65
  export {
52
- v as useCustomInterfaceAppearance
66
+ Y as useCustomInterfaceAppearance
53
67
  };