@useinsider/guido 3.18.0-beta.599df29 → 3.18.0-beta.88ff219
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/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +78 -82
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -54
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +41 -54
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
- package/dist/composables/useActionsApi.js +67 -82
- package/dist/composables/useAutoSave.js +26 -31
- package/dist/composables/useGuidoStateBridge.js +31 -37
- package/dist/composables/useSave.js +39 -42
- package/dist/enums/extensions/recommendationBlock.js +36 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +35 -31
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +129 -68
- package/dist/guido.css +1 -1
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +49 -0
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +21 -4
- package/dist/stores/onboarding.js +41 -36
- package/package.json +1 -1
- package/dist/composables/useEditorLock.js +0 -20
- package/dist/src/composables/useEditorLock.d.ts +0 -10
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { defineComponent as b, computed as e, onMounted as O, watch as t } from "vue";
|
|
2
2
|
import u from "./AMPOnboarding.vue.js";
|
|
3
3
|
import v from "./GenericOnboarding.vue.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import S from "./
|
|
7
|
-
import h from "./
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
4
|
+
import y from "./ItemsOnboarding.vue.js";
|
|
5
|
+
import l from "./NewVersionPopup.vue.js";
|
|
6
|
+
import S from "./RecommendationStrategyOnboarding.vue.js";
|
|
7
|
+
import h from "./TextBlockOnboarding.vue.js";
|
|
8
|
+
import w from "./VersionHistoryOnboarding.vue.js";
|
|
9
|
+
import { usePartner as P } from "../../../composables/usePartner.js";
|
|
10
|
+
import { useEditorStore as _ } from "../../../stores/editor.js";
|
|
11
|
+
import { useOnboardingStore as A } from "../../../stores/onboarding.js";
|
|
12
|
+
import { usePreviewStore as H } from "../../../stores/preview.js";
|
|
13
|
+
const N = /* @__PURE__ */ b({
|
|
13
14
|
__name: "OnboardingWrapper",
|
|
14
15
|
emits: ["onboarding-finished"],
|
|
15
|
-
setup(
|
|
16
|
-
const o =
|
|
17
|
-
{ type: "newVersionPopup", component:
|
|
16
|
+
setup(M, { emit: g }) {
|
|
17
|
+
const o = A(), r = _(), s = H(), { isTestPartner: a } = P(), m = e(() => r.isStripoInitialized), p = e(() => a()), d = [
|
|
18
|
+
{ type: "newVersionPopup", component: l },
|
|
18
19
|
{ type: "genericOnboarding", component: v },
|
|
19
|
-
{ type: "textBlockOnboarding", component:
|
|
20
|
-
{ type: "versionHistoryOnboarding", component:
|
|
20
|
+
{ type: "textBlockOnboarding", component: h },
|
|
21
|
+
{ type: "versionHistoryOnboarding", component: w },
|
|
21
22
|
{ type: "ampOnboarding", component: u },
|
|
22
|
-
{ type: "itemsOnboarding", component:
|
|
23
|
-
|
|
23
|
+
{ type: "itemsOnboarding", component: y },
|
|
24
|
+
{ type: "recommendationStrategyOnboarding", component: S }
|
|
25
|
+
], c = (n) => p.value || !m.value ? !1 : n === "newVersionPopup" ? o.shouldShowOnboarding(n) : o.isActive(n), f = e(() => d.filter((n) => c(n.type)));
|
|
24
26
|
return O(async () => {
|
|
25
27
|
await o.fetchUserModalState();
|
|
26
28
|
}), t(
|
|
@@ -38,9 +40,9 @@ const G = /* @__PURE__ */ b({
|
|
|
38
40
|
(n) => {
|
|
39
41
|
!n && o.isActive("ampOnboarding") && o.close("ampOnboarding");
|
|
40
42
|
}
|
|
41
|
-
), { __sfc: !0, emit:
|
|
43
|
+
), { __sfc: !0, emit: g, onboardingStore: o, editorStore: r, previewStore: s, isTestPartner: a, isStripoReady: m, isTestPartnerActive: p, onboardingConfigs: d, shouldShow: c, visibleOnboardings: f };
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
46
|
export {
|
|
45
|
-
|
|
47
|
+
N as default
|
|
46
48
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import d from "./RecommendationStrategyOnboarding.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import g from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var m = function() {
|
|
5
|
+
var e, n, r, a, i;
|
|
6
|
+
var t = this, s = t._self._c, o = t._self._setupProxy;
|
|
7
|
+
return o.isVisible ? s(o.InOnboard, { key: "guido__recommendation-strategy-onboard", staticClass: "w-21-s p-a z-11", class: (e = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : e.classes, attrs: { id: "guido__recommendation-strategy-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "left-position": (n = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : n.left, "pages-config": o.onboardingStore.onboardings.recommendationStrategyOnboarding.config, "pointer-position": (r = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : r.position, "right-position": (a = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : a.right, "top-position": (i = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : i.top }, on: { close: function(p) {
|
|
8
|
+
return o.onboardingStore.close(o.ONBOARDING_TYPE);
|
|
9
|
+
}, nextButtonClick: o.handleNext } }) : t._e();
|
|
10
|
+
}, c = [], _ = /* @__PURE__ */ g(
|
|
11
|
+
d,
|
|
12
|
+
m,
|
|
13
|
+
c,
|
|
14
|
+
!1,
|
|
15
|
+
null,
|
|
16
|
+
"1f4a4044"
|
|
17
|
+
);
|
|
18
|
+
const S = _.exports;
|
|
19
|
+
export {
|
|
20
|
+
S as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineComponent as c, computed as g, watch as b } from "vue";
|
|
2
|
+
import { useRibbonOffset as p } from "../../../composables/useRibbonOffset.js";
|
|
3
|
+
import { useTranslations as u } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { ACADEMY_LINKS as l } from "../../../enums/academy.js";
|
|
5
|
+
import { useOnboardingStore as f } from "../../../stores/onboarding.js";
|
|
6
|
+
import { InOnboard as O } from "@useinsider/design-system-vue";
|
|
7
|
+
const B = /* @__PURE__ */ c({
|
|
8
|
+
__name: "RecommendationStrategyOnboarding",
|
|
9
|
+
setup(_) {
|
|
10
|
+
const e = "recommendationStrategyOnboarding", n = u(), t = f(), { getTopPosition: i } = p(), r = `<a href="${l.EMAIL_RECOMMENDATION_BLOCK}" target="_blank" rel="noopener noreferrer">${n("action-builder.visit-academy")}</a>`, a = () => [
|
|
11
|
+
{
|
|
12
|
+
classes: "guido-recommendation-strategy-onboarding",
|
|
13
|
+
// Sits in the gap left of the settings panel and points at the strategy section, which
|
|
14
|
+
// starts 208px down: the panel header and its tab row are fixed chrome above it.
|
|
15
|
+
right: "426px",
|
|
16
|
+
top: i(208),
|
|
17
|
+
position: "Right Top",
|
|
18
|
+
title: n("email-editor.onboarding-recommendation-strategy-title"),
|
|
19
|
+
description: n("email-editor.onboarding-recommendation-strategy-description", {
|
|
20
|
+
academyLink: r
|
|
21
|
+
}),
|
|
22
|
+
imageSource: "",
|
|
23
|
+
backButtonClick: () => {
|
|
24
|
+
},
|
|
25
|
+
nextButtonType: "text",
|
|
26
|
+
nextButtonText: n("action-builder.ok"),
|
|
27
|
+
nextButtonClick: () => {
|
|
28
|
+
t.close(e);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
], m = g(() => t.onboardings.recommendationStrategyOnboarding.config.length > 0 && t.onboardings.recommendationStrategyOnboarding.isActive), d = () => {
|
|
32
|
+
var o, s;
|
|
33
|
+
(s = (o = t.getRecommendationStrategyCurrentCard) == null ? void 0 : o.nextButtonClick) == null || s.call(o);
|
|
34
|
+
};
|
|
35
|
+
return b(
|
|
36
|
+
() => t.isActive(e),
|
|
37
|
+
(o) => {
|
|
38
|
+
o && t.setConfig(e, a());
|
|
39
|
+
},
|
|
40
|
+
{ immediate: !0 }
|
|
41
|
+
), { __sfc: !0, ONBOARDING_TYPE: e, trans: n, onboardingStore: t, getTopPosition: i, academyLink: r, buildOnboardingCards: a, isVisible: m, handleNext: d, InOnboard: O };
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
B as default
|
|
46
|
+
};
|
|
@@ -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,54 +1,48 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
}
|
|
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))
|
|
23
14
|
try {
|
|
24
|
-
const { html:
|
|
25
|
-
if (
|
|
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)
|
|
26
17
|
return;
|
|
27
|
-
|
|
28
|
-
html:
|
|
29
|
-
css:
|
|
30
|
-
templateId:
|
|
18
|
+
a.$patch({
|
|
19
|
+
html: f ?? "",
|
|
20
|
+
css: h ?? "",
|
|
21
|
+
templateId: S,
|
|
31
22
|
lastUpdatedAt: Date.now()
|
|
32
23
|
});
|
|
33
24
|
} catch {
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
}, u = () => {
|
|
27
|
+
r(), e = setTimeout(() => {
|
|
28
|
+
e = null, s();
|
|
29
|
+
}, w);
|
|
30
|
+
}, d = c(
|
|
37
31
|
() => i.isStripoInitialized,
|
|
38
32
|
(t) => {
|
|
39
|
-
t &&
|
|
33
|
+
t && s();
|
|
40
34
|
},
|
|
41
35
|
{ immediate: !0 }
|
|
42
|
-
),
|
|
36
|
+
), p = c(
|
|
43
37
|
() => i.hasChanges,
|
|
44
|
-
(t,
|
|
45
|
-
i.isStripoInitialized && (t ?
|
|
38
|
+
(t, o) => {
|
|
39
|
+
i.isStripoInitialized && (t ? u() : o && (r(), s()));
|
|
46
40
|
}
|
|
47
41
|
);
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
T(() => {
|
|
43
|
+
n = !0, r(), d(), p();
|
|
50
44
|
});
|
|
51
45
|
};
|
|
52
46
|
export {
|
|
53
|
-
|
|
47
|
+
z as useGuidoStateBridge
|
|
54
48
|
};
|
|
@@ -1,55 +1,52 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
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
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
const { prepareTemplateDetails:
|
|
21
|
-
if (!
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as T } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as E, useSaveComplete as q } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { ToasterTypeOptions as M } from "../enums/toaster.js";
|
|
6
|
+
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
7
|
+
import { useTemplatePreparation as L } from "../utils/templatePreparation.js";
|
|
8
|
+
import { useAllowlist as P } from "./useAllowlist.js";
|
|
9
|
+
import { useHtmlValidator as U } from "./useHtmlValidator.js";
|
|
10
|
+
import { useToaster as A } from "./useToaster.js";
|
|
11
|
+
import { useCouponBlockValidator as h } from "./validators/useCouponBlockValidator.js";
|
|
12
|
+
import { useLiquidValidator as F } from "./validators/useLiquidValidator.js";
|
|
13
|
+
import { useSyncModuleBlockValidator as O } from "./validators/useSyncModuleBlockValidator.js";
|
|
14
|
+
import { useUnsubscribeBlockValidator as W } from "./validators/useUnsubscribeBlockValidator.js";
|
|
15
|
+
const it = () => {
|
|
16
|
+
const l = E(), n = q(), { validateHtml: c } = U(), { validateLiquidSyntax: d } = F(), { validateCouponBlockTags: m } = h(), { validateUnsubscribeBlockUniqueness: u, validateUnsubscribeBlockHasTemplate: p } = W(), { validateSyncModuleBlocks: f } = O(), { callbacks: a, isFeatureEnabled: s } = T(), { extractSyncModuleData: v } = C(), { setSyncModuleUnsubscriptionPages: S } = D(), { editorSave: b } = x(), { showToaster: w } = A(), { getBlockedDomains: V, resolveToast: y } = P();
|
|
17
|
+
return { save: async (H = !1, e = !1) => {
|
|
18
|
+
var r;
|
|
19
|
+
l();
|
|
20
|
+
const { prepareTemplateDetails: k } = L(), t = await k();
|
|
21
|
+
if (!f(t.rawHtml, e) || !m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
|
|
22
22
|
return;
|
|
23
|
-
if (
|
|
24
|
-
if (!await
|
|
23
|
+
if (s("liquidSyntax")) {
|
|
24
|
+
if (!await d(t.compiledHtml))
|
|
25
25
|
return;
|
|
26
|
-
} else if (!await
|
|
26
|
+
} else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
|
|
27
27
|
return;
|
|
28
|
-
if ((
|
|
28
|
+
if ((r = a.value) != null && r.externalValidation && !await a.value.externalValidation(t))
|
|
29
29
|
return;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
38
|
-
actionButton:
|
|
30
|
+
if (s("allowlistEnabled")) {
|
|
31
|
+
const o = await V(t.compiledHtml, t.css);
|
|
32
|
+
if (o.length) {
|
|
33
|
+
if (!e) {
|
|
34
|
+
const i = await y(o);
|
|
35
|
+
i != null && i.message && w({
|
|
36
|
+
type: M.Warning,
|
|
37
|
+
message: i.message,
|
|
38
|
+
actionButton: i.actionButton
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!await
|
|
44
|
+
if (!await b())
|
|
45
45
|
return;
|
|
46
|
-
const { unsubscribePayload:
|
|
47
|
-
return await
|
|
48
|
-
};
|
|
49
|
-
return { save: (a = !1, o = !1) => x(
|
|
50
|
-
() => H(a, o)
|
|
51
|
-
) };
|
|
46
|
+
const { unsubscribePayload: B, stripoModules: g } = v(t.rawHtml);
|
|
47
|
+
return await S(B), t.modules = g, H || n({ ...t, silent: e }), t;
|
|
48
|
+
} };
|
|
52
49
|
};
|
|
53
50
|
export {
|
|
54
|
-
|
|
51
|
+
it as useSave
|
|
55
52
|
};
|