@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.
- package/README.md +6 -5
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +100 -95
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +36 -44
- package/dist/composables/useActionsApi.js +67 -82
- package/dist/composables/useAutoSave.js +26 -31
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useGuidoStateBridge.js +30 -31
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useSave.js +36 -40
- package/dist/composables/useStripo.js +14 -14
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +31 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Recommendation/block.js +35 -29
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/pairProductVariables.js +60 -59
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +3 -2
- package/dist/composables/useEditorLock.js +0 -18
- 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
|
+
};
|
|
@@ -1,57 +1,49 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useActionsApi as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useExport as
|
|
5
|
-
import { useTestEmailClick as
|
|
6
|
-
import { useHtmlCompiler as
|
|
7
|
-
import { useSave as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
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(
|
|
21
|
-
const { config:
|
|
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
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
26
|
+
}, w = async () => {
|
|
27
|
+
i.value = !0, await m(), i.value = !1;
|
|
28
|
+
}, _ = () => {
|
|
30
29
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
},
|
|
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 =
|
|
33
|
+
return ((o = (t = a.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
34
|
}
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 &&
|
|
50
|
-
(o =
|
|
41
|
+
if (!t && g.value) {
|
|
42
|
+
(o = S.value) == null || o.open();
|
|
51
43
|
return;
|
|
52
44
|
}
|
|
53
|
-
return
|
|
54
|
-
},
|
|
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
|
-
|
|
57
|
+
H();
|
|
66
58
|
};
|
|
67
|
-
return
|
|
59
|
+
return x({
|
|
68
60
|
handleSave: E
|
|
69
|
-
}), { __sfc: !0, config:
|
|
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
|
-
|
|
65
|
+
ut as default
|
|
74
66
|
};
|
|
@@ -1,68 +1,52 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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: () =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
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 ? (
|
|
84
|
+
i ? (r(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
101
85
|
});
|
|
102
86
|
} catch (i) {
|
|
103
|
-
|
|
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
|
|
109
|
-
|
|
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: () =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
113
|
+
D as useActionsApi
|
|
129
114
|
};
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { useConfig as
|
|
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
|
|
5
|
-
import { computed as
|
|
6
|
-
const
|
|
7
|
-
const { isFeatureEnabled: S } =
|
|
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 =
|
|
8
|
+
const u = f(
|
|
10
9
|
() => S("autosave") && t.isOn
|
|
11
|
-
),
|
|
12
|
-
hasChanges:
|
|
13
|
-
isInSaveableState:
|
|
14
|
-
}),
|
|
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 (!
|
|
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
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
console.debug("guido:autosave:error", { trigger: e, 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
|
|
49
|
-
if (
|
|
43
|
+
const o = Date.now() - c;
|
|
44
|
+
if (o < r) {
|
|
50
45
|
console.debug("guido:autosave:visibility-debounced", {
|
|
51
|
-
sinceLastMs:
|
|
52
|
-
debounceMs:
|
|
46
|
+
sinceLastMs: o,
|
|
47
|
+
debounceMs: r
|
|
53
48
|
});
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
|
-
c = Date.now(),
|
|
51
|
+
c = Date.now(), l("visibility");
|
|
57
52
|
}, d = () => {
|
|
58
53
|
i && (clearInterval(i), i = null);
|
|
59
|
-
},
|
|
54
|
+
}, v = () => {
|
|
60
55
|
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
61
56
|
};
|
|
62
|
-
|
|
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"),
|
|
67
|
-
},
|
|
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
|
-
),
|
|
71
|
-
d(),
|
|
65
|
+
), y(() => {
|
|
66
|
+
d(), v(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
72
67
|
});
|
|
73
68
|
};
|
|
74
69
|
export {
|
|
75
|
-
|
|
70
|
+
T as useAutoSave
|
|
76
71
|
};
|
|
@@ -1,53 +1,67 @@
|
|
|
1
|
-
import S from "../static/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/components/
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
e,
|
|
26
|
-
i,
|
|
33
|
+
A,
|
|
27
34
|
p,
|
|
28
|
-
|
|
35
|
+
// Must be on top
|
|
29
36
|
s,
|
|
30
37
|
C,
|
|
31
|
-
f,
|
|
32
38
|
a,
|
|
33
|
-
|
|
39
|
+
f,
|
|
34
40
|
c,
|
|
35
|
-
|
|
41
|
+
u,
|
|
36
42
|
l,
|
|
43
|
+
d,
|
|
37
44
|
h,
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
`),
|
|
56
|
+
`), Y = () => ({ importCss: () => {
|
|
43
57
|
const o = new CSSStyleSheet();
|
|
44
|
-
o.replaceSync(
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
58
|
+
o.replaceSync(R);
|
|
59
|
+
const e = document.querySelector("ui-editor");
|
|
60
|
+
if (!e)
|
|
47
61
|
return;
|
|
48
|
-
const
|
|
49
|
-
|
|
62
|
+
const m = e.shadowRoot;
|
|
63
|
+
m && (m.adoptedStyleSheets = [o]);
|
|
50
64
|
} });
|
|
51
65
|
export {
|
|
52
|
-
|
|
66
|
+
Y as useCustomInterfaceAppearance
|
|
53
67
|
};
|