@useinsider/guido 3.19.0-beta.3e599a9 → 3.19.0-beta.4b9be3a
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 +67 -61
- package/dist/composables/useActionsApi.js +24 -20
- package/dist/composables/useCortexBlueprintBridge.js +120 -54
- package/dist/composables/useEmailTemplateApplier.js +96 -51
- package/dist/guido.css +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +4 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +26 -5
- package/dist/src/stores/guido-email-editor.d.ts +32 -10
- package/dist/stores/guido-email-editor.js +3 -1
- package/package.json +2 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as ne, defineAsyncComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { useEditorLock as
|
|
1
|
+
import { defineComponent as ne, defineAsyncComponent as u, ref as P, computed as p, watch as x, onMounted as re, onUnmounted as se } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as ie } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { useEditorLock as ae } from "../composables/useEditorLock.js";
|
|
4
4
|
import { provideGuidoActions as ce } from "../composables/useGuidoActions.js";
|
|
5
5
|
import { useGuidoStateBridge as de } from "../composables/useGuidoStateBridge.js";
|
|
6
6
|
import { usePartner as me } from "../composables/usePartner.js";
|
|
7
7
|
import { useStripo as le } from "../composables/useStripo.js";
|
|
8
8
|
import { useTimerClone as ue } from "../composables/useTimerClone.js";
|
|
9
|
-
import { migrate as
|
|
10
|
-
import { ModuleFolderDefaults as
|
|
9
|
+
import { migrate as W } from "../config/migrator/index.js";
|
|
10
|
+
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
11
11
|
import { RIBBON_SELECTOR as pe } from "../enums/onboarding.js";
|
|
12
|
-
import { useRecommendationExtensionStore as
|
|
12
|
+
import { useRecommendationExtensionStore as z } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
13
13
|
import fe from "./organisms/AutoSaveController.vue.js";
|
|
14
14
|
import ye from "./organisms/base/Toaster.vue.js";
|
|
15
15
|
import ge from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
16
16
|
import ve from "./organisms/header/HeaderWrapper.vue.js";
|
|
17
17
|
import Se from "./organisms/LoadingWrapper.vue.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import he from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
19
|
+
import be from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
20
20
|
import { useStripoApi as Ee } from "../services/stripoApi.js";
|
|
21
21
|
import { useConfigStore as we } from "../stores/config.js";
|
|
22
22
|
import { useDynamicContentStore as Ce } from "../stores/dynamic-content.js";
|
|
23
|
-
import { useEditorStore as
|
|
23
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
24
24
|
import { usePreviewStore as De } from "../stores/preview.js";
|
|
25
25
|
import { useTemplateStore as ke } from "../stores/template.js";
|
|
26
|
-
import { useUnsubscribeStore as
|
|
27
|
-
import { readTrackFloor as
|
|
26
|
+
import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
|
|
27
|
+
import { readTrackFloor as H } from "../utils/linkTrackingIds.js";
|
|
28
28
|
const et = /* @__PURE__ */ ne({
|
|
29
29
|
__name: "Guido",
|
|
30
30
|
props: {
|
|
@@ -32,41 +32,41 @@ const et = /* @__PURE__ */ ne({
|
|
|
32
32
|
ready: { type: Boolean, default: !0 }
|
|
33
33
|
},
|
|
34
34
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
35
|
-
setup(
|
|
36
|
-
const
|
|
35
|
+
setup($, { expose: q, emit: r }) {
|
|
36
|
+
const i = $, K = u(
|
|
37
37
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
38
|
-
), V =
|
|
38
|
+
), V = u(
|
|
39
39
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
40
|
-
), j =
|
|
40
|
+
), j = u(
|
|
41
41
|
() => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
|
|
42
|
-
), J =
|
|
42
|
+
), J = u(
|
|
43
43
|
() => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
|
|
44
|
-
),
|
|
45
|
-
|
|
46
|
-
const c =
|
|
44
|
+
), w = P(), f = P(), y = Ce(), C = Fe(), o = we();
|
|
45
|
+
i.ready && o.init(i.config);
|
|
46
|
+
const c = E(), Q = De(), m = p(() => c.hasChanges), { isTestPartner: X } = me(), D = () => {
|
|
47
47
|
var t;
|
|
48
|
-
return (t =
|
|
49
|
-
},
|
|
48
|
+
return (t = w.value) == null ? void 0 : t.handleSave(!0);
|
|
49
|
+
}, k = (t) => {
|
|
50
50
|
c.loadingStatus = t;
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
const
|
|
52
|
+
ie(), de();
|
|
53
|
+
const g = () => {
|
|
54
54
|
var t, e;
|
|
55
55
|
return {
|
|
56
56
|
emailId: o.templateId,
|
|
57
57
|
userId: o.userId,
|
|
58
58
|
username: o.username,
|
|
59
59
|
partnerName: o.partnerName,
|
|
60
|
-
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) ||
|
|
61
|
-
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) ||
|
|
60
|
+
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
|
|
61
|
+
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
|
|
62
62
|
};
|
|
63
|
-
}, { initPlugin:
|
|
64
|
-
let
|
|
65
|
-
const { getDefaultTemplate:
|
|
63
|
+
}, { initPlugin: F, preloadRuntime: T } = le(), { runExclusive: I, beginMount: M, isCurrentMount: v } = ae();
|
|
64
|
+
let l = 0;
|
|
65
|
+
const { getDefaultTemplate: R } = Ee(), { cloneTimersOnSave: L, hasTimerBlocks: B } = ue(), Y = p(() => {
|
|
66
66
|
var t;
|
|
67
67
|
return !((t = o.ui) != null && t.showHeader);
|
|
68
|
-
}), Z =
|
|
69
|
-
() => !!
|
|
68
|
+
}), Z = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ee = p(
|
|
69
|
+
() => !!z().recommendationConfigs.strategyId
|
|
70
70
|
);
|
|
71
71
|
ce({
|
|
72
72
|
onBack: () => {
|
|
@@ -76,70 +76,76 @@ const et = /* @__PURE__ */ ne({
|
|
|
76
76
|
console.debug("guido:save:start"), r("save:start");
|
|
77
77
|
},
|
|
78
78
|
onSaveComplete: (t) => {
|
|
79
|
-
const e = { ...t, metadata:
|
|
79
|
+
const e = { ...t, metadata: g() };
|
|
80
80
|
console.debug("guido:save:complete", e), r("save:complete", e);
|
|
81
81
|
},
|
|
82
82
|
onTestEmailClick: () => {
|
|
83
83
|
console.debug("guido:test-email:click"), r("test-email:click");
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
const
|
|
87
|
-
console.debug("dynamic-content:close", t),
|
|
88
|
-
},
|
|
86
|
+
const A = (t) => {
|
|
87
|
+
console.debug("dynamic-content:close", t), y.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
88
|
+
}, U = () => {
|
|
89
89
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
x(() => m.value, () => {
|
|
92
92
|
r("on-change", m.value);
|
|
93
93
|
});
|
|
94
|
-
const
|
|
94
|
+
const S = (t) => {
|
|
95
95
|
const e = t, { attribute: s, position: d } = e.detail;
|
|
96
96
|
console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
|
|
97
97
|
};
|
|
98
|
-
let
|
|
99
|
-
const
|
|
98
|
+
let a = null;
|
|
99
|
+
const h = () => {
|
|
100
100
|
var e;
|
|
101
101
|
const t = document.querySelector(pe);
|
|
102
|
-
(e =
|
|
102
|
+
(e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
103
103
|
}, b = async () => {
|
|
104
104
|
var t;
|
|
105
105
|
try {
|
|
106
|
-
o.initialized || o.init(
|
|
107
|
-
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "",
|
|
108
|
-
|
|
109
|
-
const
|
|
106
|
+
o.initialized || o.init(i.config), c.templateId = o.templateId;
|
|
107
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", _ = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
108
|
+
C.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
109
|
+
const N = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, O = o.isFeatureEnabled("linkTrackingIds");
|
|
110
110
|
let n = {
|
|
111
|
-
html: s && await
|
|
111
|
+
html: s && await W(s, N),
|
|
112
112
|
css: d
|
|
113
113
|
};
|
|
114
|
-
n.html || (n = await
|
|
115
|
-
const te =
|
|
116
|
-
|
|
114
|
+
n.html || (n = await R(), n.html = await W(n.html, N));
|
|
115
|
+
const te = O ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
116
|
+
B(n.html) && (n.html = await L(n.html)), O && (c.trackIdSessionFloor = Math.max(te, H(n.html)));
|
|
117
117
|
const oe = {
|
|
118
|
-
preselectedDynamicContentList:
|
|
118
|
+
preselectedDynamicContentList: _,
|
|
119
119
|
onReady: () => {
|
|
120
120
|
console.debug("guido:ready"), r("ready");
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
l = M(), await F(n, g(), oe), y.selectedDynamicContentList = _;
|
|
124
124
|
} catch (e) {
|
|
125
125
|
console.error("Failed to initialize Stripo editor:", e);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
return re(async () => {
|
|
129
129
|
var e;
|
|
130
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
131
|
-
const t = (e =
|
|
132
|
-
if (t && (
|
|
130
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), E().$reset(), ke().$reset(), h();
|
|
131
|
+
const t = (e = f.value) == null ? void 0 : e.parentElement;
|
|
132
|
+
if (t && (a = new ResizeObserver(h), a.observe(t)), T(), i.ready)
|
|
133
133
|
await b();
|
|
134
134
|
else {
|
|
135
|
-
const s =
|
|
135
|
+
const s = x(() => i.ready, (d) => {
|
|
136
136
|
d && (s(), b());
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
document.addEventListener("dynamic-content:open",
|
|
139
|
+
document.addEventListener("dynamic-content:open", S);
|
|
140
140
|
}), se(() => {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", S), v(l))
|
|
142
|
+
try {
|
|
143
|
+
E().isStripoInitialized = !1;
|
|
144
|
+
} catch (t) {
|
|
145
|
+
console.debug("Failed to close the editor readiness gate on unmount", t);
|
|
146
|
+
}
|
|
147
|
+
I(async () => {
|
|
148
|
+
if (v(l))
|
|
143
149
|
try {
|
|
144
150
|
window.UIEditor.removeEditor();
|
|
145
151
|
} catch {
|
|
@@ -148,13 +154,13 @@ const et = /* @__PURE__ */ ne({
|
|
|
148
154
|
}), o.reset();
|
|
149
155
|
}), q({
|
|
150
156
|
dynamicContent: {
|
|
151
|
-
insert:
|
|
152
|
-
close:
|
|
157
|
+
insert: A,
|
|
158
|
+
close: U
|
|
153
159
|
},
|
|
154
160
|
hasChanges: m,
|
|
155
|
-
saveSilent:
|
|
156
|
-
setLoading:
|
|
157
|
-
}), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, headerWrapperRef:
|
|
161
|
+
saveSilent: D,
|
|
162
|
+
setLoading: k
|
|
163
|
+
}), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, headerWrapperRef: w, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: i, configStore: o, editorStore: c, previewStore: Q, hasChanges: m, isTestPartner: X, saveSilent: D, setLoading: k, emit: r, buildMetadata: g, initPlugin: F, preloadRuntime: T, runExclusive: I, beginMount: M, isCurrentMount: v, mountGeneration: l, getDefaultTemplate: R, cloneTimersOnSave: L, hasTimerBlocks: B, noHeader: Y, isRrsEnabled: Z, hasAssignedStrategy: ee, insertDynamicContent: A, closeDynamicContent: U, handleDynamicContentOpen: S, ribbonObserver: a, updateRibbonOffset: h, startEditor: b, AutoSaveController: fe, Toaster: ye, FilterSelectionDrawer: ge, HeaderWrapper: ve, LoadingWrapper: Se, SaveAsTemplateDrawer: he, UnsubscribeWrapper: be };
|
|
158
164
|
}
|
|
159
165
|
});
|
|
160
166
|
export {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
|
|
2
2
|
import { useToaster as y } from "./useToaster.js";
|
|
3
|
-
const D = 1e4,
|
|
4
|
-
const
|
|
5
|
-
() =>
|
|
3
|
+
const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
|
|
4
|
+
const c = setTimeout(
|
|
5
|
+
() => s(new Error(`${n} did not report completion within ${l}ms`)),
|
|
6
6
|
l
|
|
7
|
-
),
|
|
8
|
-
clearTimeout(
|
|
7
|
+
), d = (r) => (t) => {
|
|
8
|
+
clearTimeout(c), r(t);
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
w(d(A), d(s));
|
|
12
|
+
} catch (r) {
|
|
13
|
+
clearTimeout(c), s(r instanceof Error ? r : new Error(String(r)));
|
|
14
|
+
}
|
|
11
15
|
}), I = () => {
|
|
12
|
-
const { handleError: n } = y(), l = (t = {}) =>
|
|
16
|
+
const { handleError: n } = y(), l = (t = {}) => p(
|
|
13
17
|
"compileEmail",
|
|
14
|
-
|
|
18
|
+
T,
|
|
15
19
|
(e, a) => {
|
|
16
20
|
const o = { ...{
|
|
17
21
|
minimize: !0,
|
|
@@ -32,9 +36,9 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
32
36
|
forceAmp: !1,
|
|
33
37
|
resetDataSavedFlag: !1,
|
|
34
38
|
disableLineHeightsReplace: !0
|
|
35
|
-
}, ...t },
|
|
36
|
-
callback: (
|
|
37
|
-
|
|
39
|
+
}, ...t }, u = {
|
|
40
|
+
callback: (m, C, f, S, g) => {
|
|
41
|
+
m ? a(m) : e({
|
|
38
42
|
html: C,
|
|
39
43
|
ampHtml: f,
|
|
40
44
|
ampErrors: v(S ?? []),
|
|
@@ -43,22 +47,22 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
43
47
|
},
|
|
44
48
|
...o
|
|
45
49
|
};
|
|
46
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
50
|
+
window.StripoEditorApi.actionsApi.compileEmail(u);
|
|
47
51
|
}
|
|
48
52
|
);
|
|
49
53
|
return {
|
|
50
54
|
getCompiledEmail: l,
|
|
51
|
-
getTemplateData: () =>
|
|
55
|
+
getTemplateData: () => p(
|
|
52
56
|
"getTemplateData",
|
|
53
|
-
|
|
57
|
+
T,
|
|
54
58
|
(t) => {
|
|
55
|
-
const e = ({ html: a, css: i, width: o, height: E, utmParams:
|
|
59
|
+
const e = ({ html: a, css: i, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
56
60
|
html: a,
|
|
57
61
|
css: i,
|
|
58
62
|
width: o,
|
|
59
63
|
height: E,
|
|
60
|
-
utmParams:
|
|
61
|
-
syncModulesIds:
|
|
64
|
+
utmParams: u,
|
|
65
|
+
syncModulesIds: m
|
|
62
66
|
});
|
|
63
67
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
64
68
|
}
|
|
@@ -105,13 +109,13 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
105
109
|
}),
|
|
106
110
|
updateHtmlAndCss: (t, e) => {
|
|
107
111
|
const { actionsApi: a } = window.StripoEditorApi;
|
|
108
|
-
return
|
|
112
|
+
return p("updateHtmlAndCss", D, (i) => {
|
|
109
113
|
a.updateHtmlAndCss(t, e, () => i());
|
|
110
114
|
});
|
|
111
115
|
},
|
|
112
|
-
editorSave: () =>
|
|
116
|
+
editorSave: () => p(
|
|
113
117
|
"save",
|
|
114
|
-
|
|
118
|
+
T,
|
|
115
119
|
(t) => {
|
|
116
120
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
117
121
|
if (e) {
|
|
@@ -1,70 +1,136 @@
|
|
|
1
|
-
import { useEmailTemplateApplier as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { useEmailTemplateApplier as z, resetEmailTemplateApplier as J } from "./useEmailTemplateApplier.js";
|
|
2
|
+
import { useToaster as Q } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as V } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as Z } from "../enums/toaster.js";
|
|
5
|
+
import { useGuidoEmailEditorStore as W } from "../stores/guido-email-editor.js";
|
|
6
|
+
import { getActivePinia as k } from "pinia";
|
|
7
|
+
import { onUnmounted as tt, watch as et } from "vue";
|
|
8
|
+
const rt = "email_template", nt = "chat", it = "guido:debug:ai", ot = 2, lt = 500, ct = (E, u) => `${E}:${u ?? 1}`;
|
|
9
|
+
let y = null;
|
|
10
|
+
const at = () => {
|
|
8
11
|
if (typeof window > "u")
|
|
9
12
|
return !1;
|
|
10
13
|
try {
|
|
11
|
-
return window.localStorage.getItem(
|
|
14
|
+
return window.localStorage.getItem(it) === "1";
|
|
12
15
|
} catch {
|
|
13
16
|
return !1;
|
|
14
17
|
}
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
+
}, Et = () => {
|
|
19
|
+
const E = k();
|
|
20
|
+
if (!E)
|
|
18
21
|
return;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const u = W(), M = Symbol("cortexBlueprintBridge");
|
|
23
|
+
y = M, u.$patch((t) => {
|
|
24
|
+
t.bridgeActive = !0;
|
|
25
|
+
});
|
|
26
|
+
const { markPending: F, applyTemplate: H, applyTemplateDebounced: O } = z(), { showToaster: C } = Q(), G = V(), b = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
27
|
+
let s = null;
|
|
28
|
+
const d = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), D = at();
|
|
29
|
+
let w = null, m = null, A;
|
|
30
|
+
const K = (t, r) => {
|
|
31
|
+
D && console.debug(`[guido:cortex] msg=${t ?? "?"} type=${(r == null ? void 0 : r.type) ?? "?"}`, r);
|
|
32
|
+
}, U = () => new Set((A == null ? void 0 : A.appliedBlueprintKeys) ?? []), Y = (t) => t instanceof Error ? t.message : String(t), B = (t, r, n, e) => {
|
|
33
|
+
if (y !== M)
|
|
34
|
+
return;
|
|
35
|
+
const i = u.applyAcks[t], c = Math.max(Date.now(), ((i == null ? void 0 : i.ackAt) ?? 0) + 1), a = { status: r, requestedAt: n, ackAt: c };
|
|
36
|
+
e !== void 0 && (a.error = Y(e)), u.$patch((o) => {
|
|
37
|
+
o.applyAcks = { ...o.applyAcks, [t]: a };
|
|
38
|
+
});
|
|
39
|
+
}, I = (t) => (d.get(t) ?? 0) > 0, P = (t) => (s == null ? void 0 : s.key) === t, v = async (t, r, n) => {
|
|
40
|
+
var a, o, h;
|
|
41
|
+
const e = ((a = r.blueprintData) == null ? void 0 : a.html) ?? "", i = ((o = r.blueprintData) == null ? void 0 : o.css) ?? "", c = r.applyRequestedAt ?? 0;
|
|
42
|
+
d.set(t, (d.get(t) ?? 0) + 1);
|
|
43
|
+
try {
|
|
44
|
+
const l = n === "debounced" ? await O(t, { html: e, css: i }) : await H(t, { html: e, css: i });
|
|
45
|
+
if (l.status === "superseded")
|
|
46
|
+
return;
|
|
47
|
+
if (l.status === "applied") {
|
|
48
|
+
b.set(t, e), p.delete(t), B(t, "applied", c);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const S = p.get(t), j = (S == null ? void 0 : S.html) === e ? S.count + 1 : 1;
|
|
52
|
+
p.set(t, { html: e, count: j }), B(t, "failed", c, l.error);
|
|
53
|
+
} finally {
|
|
54
|
+
d.set(t, (d.get(t) ?? 1) - 1);
|
|
55
|
+
const l = T.get(t);
|
|
56
|
+
l && !I(t) && (T.delete(t), P(t) && (((h = l.blueprintData) == null ? void 0 : h.html) ?? "") !== e && v(t, l, n));
|
|
57
|
+
}
|
|
58
|
+
}, N = (t) => {
|
|
59
|
+
var h;
|
|
60
|
+
if (t.blueprintType !== rt)
|
|
29
61
|
return;
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
62
|
+
const { blueprintId: r } = t, n = (h = t.blueprintData) == null ? void 0 : h.html;
|
|
63
|
+
if (!r || !n)
|
|
32
64
|
return;
|
|
33
|
-
|
|
34
|
-
|
|
65
|
+
const e = ct(r, t.version);
|
|
66
|
+
if (!t.applyRequested) {
|
|
67
|
+
F(e);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const i = t.applyRequestedAt ?? 0, c = _.get(e);
|
|
71
|
+
if (c === void 0 || i > c) {
|
|
72
|
+
const l = c === void 0;
|
|
73
|
+
if (_.set(e, i), p.delete(e), (!s || i >= s.requestedAt) && (s = { key: e, requestedAt: i }), l && U().has(e)) {
|
|
74
|
+
b.set(e, n);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
v(e, t, "immediate");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const a = b.get(e);
|
|
81
|
+
if (a === n || !P(e))
|
|
35
82
|
return;
|
|
83
|
+
const o = p.get(e);
|
|
84
|
+
if (!((o == null ? void 0 : o.html) === n && o.count >= ot)) {
|
|
85
|
+
if (a === void 0) {
|
|
86
|
+
if (I(e)) {
|
|
87
|
+
T.set(e, t);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
v(e, t, "immediate");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
f.get(e) !== n && (f.set(e, n), v(e, t, "debounced").finally(() => {
|
|
94
|
+
f.get(e) === n && f.delete(e);
|
|
95
|
+
}));
|
|
36
96
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Array.isArray(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case "error":
|
|
56
|
-
s(e);
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
97
|
+
}, R = (t) => t === void 0 || g.has(t) ? !1 : (g.add(t), C({
|
|
98
|
+
type: Z.Error,
|
|
99
|
+
message: G("newsletter.ai-template-failed")
|
|
100
|
+
}), !0), X = (t) => {
|
|
101
|
+
Array.isArray(t) && t.forEach((r) => {
|
|
102
|
+
const n = r == null ? void 0 : r.id;
|
|
103
|
+
(r == null ? void 0 : r.isError) === !0 && R(n) && D && console.debug(`[guido:cortex] message-level error id=${n}`, r);
|
|
104
|
+
const e = r == null ? void 0 : r.segments;
|
|
105
|
+
Array.isArray(e) && e.forEach((i) => {
|
|
106
|
+
if (i)
|
|
107
|
+
switch (K(n, i), i.type) {
|
|
108
|
+
case "blueprint":
|
|
109
|
+
N(i);
|
|
110
|
+
break;
|
|
111
|
+
case "error":
|
|
112
|
+
R(n);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
60
115
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
116
|
+
});
|
|
117
|
+
}, $ = () => {
|
|
118
|
+
w !== null && (clearInterval(w), w = null);
|
|
119
|
+
}, q = () => {
|
|
120
|
+
var t;
|
|
121
|
+
return (t = E._s) == null ? void 0 : t.get(nt);
|
|
122
|
+
}, L = (t) => {
|
|
123
|
+
A = t, m = et(() => t.messages, X, { deep: !0, immediate: !0 });
|
|
124
|
+
}, x = q();
|
|
125
|
+
x ? L(x) : w = setInterval(() => {
|
|
126
|
+
const t = q();
|
|
127
|
+
t && ($(), L(t));
|
|
128
|
+
}, lt), tt(() => {
|
|
129
|
+
$(), m == null || m(), A = void 0, b.clear(), f.clear(), _.clear(), p.clear(), s = null, d.clear(), T.clear(), g.clear(), y === M && (y = null, u.$patch((t) => {
|
|
130
|
+
t.bridgeActive = !1, t.applyAcks = {};
|
|
131
|
+
}), J());
|
|
66
132
|
});
|
|
67
133
|
};
|
|
68
134
|
export {
|
|
69
|
-
|
|
135
|
+
Et as useCortexBlueprintBridge
|
|
70
136
|
};
|
|
@@ -1,59 +1,104 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as z } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as I } from "./useEditorLock.js";
|
|
4
|
+
import { useToaster as N } from "./useToaster.js";
|
|
5
|
+
import { useTranslations as q } from "./useTranslations.js";
|
|
6
|
+
import { ToasterTypeOptions as D } from "../enums/toaster.js";
|
|
7
|
+
import { useDynamicContentStore as K } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useEditorStore as R } from "../stores/editor.js";
|
|
9
|
+
import { flattenDynamicContentList as F } from "../utils/genericUtil.js";
|
|
10
|
+
import { extractUsedDynamicContent as G } from "../utils/registerUsedDynamicContent.js";
|
|
11
|
+
import { ref as $, watch as j } from "vue";
|
|
12
|
+
const J = 250, h = 12e4, p = { status: "superseded" }, S = { status: "failed", error: new Error("Blueprint has no html to apply") }, a = $({}), v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), ce = () => {
|
|
13
|
+
const { updateHtmlAndCss: i } = x(), { runExclusive: A } = I(), { showToaster: f } = N(), E = q(), { template: M } = z(), U = K(), T = R(), w = (e, t) => {
|
|
14
|
+
m.get(e) !== t && (m.set(e, t), f({
|
|
15
|
+
type: D.Error,
|
|
16
|
+
message: E("newsletter.ai-template-failed-apply")
|
|
17
|
+
}));
|
|
18
|
+
}, O = () => {
|
|
19
|
+
var e, t;
|
|
20
|
+
return T.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
|
|
21
|
+
}, b = (e) => {
|
|
22
|
+
a.value[e] === void 0 && (a.value = { ...a.value, [e]: "pending" });
|
|
23
|
+
}, l = (e, t) => {
|
|
24
|
+
a.value = { ...a.value, [e]: t };
|
|
25
|
+
}, P = (e) => {
|
|
26
|
+
var t;
|
|
19
27
|
try {
|
|
20
|
-
r(t
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
28
|
+
const r = F((t = M.value) == null ? void 0 : t.dynamicContentList), n = G(e, r);
|
|
29
|
+
n.length > 0 && U.registerDynamicContent(n);
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}, _ = (e, t) => {
|
|
33
|
+
m.delete(e), v.get(e) !== t && (v.set(e, t), f({
|
|
34
|
+
type: D.Success,
|
|
35
|
+
message: E("newsletter.ai-template-applied")
|
|
36
|
+
}));
|
|
37
|
+
}, g = async (e, t, r) => {
|
|
38
|
+
const n = (u.get(e) ?? 0) + 1;
|
|
39
|
+
u.set(e, n), l(e, "applying");
|
|
40
|
+
try {
|
|
41
|
+
await A(() => i(t, r));
|
|
42
|
+
} catch (o) {
|
|
43
|
+
return u.get(e) !== n ? p : (console.error("[guido:apply] editor did not acknowledge the template apply", o), l(e, "failed"), w(e, t), { status: "failed", error: o });
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
return u.get(e) !== n ? p : (l(e, "applied"), P(t), _(e, t), { status: "applied" });
|
|
46
|
+
}, H = (e) => {
|
|
47
|
+
const t = s.get(e);
|
|
48
|
+
t && (clearTimeout(t.timer), s.delete(e), t.settle(p));
|
|
49
|
+
}, y = (e) => {
|
|
50
|
+
const t = c.get(e);
|
|
51
|
+
t && (clearTimeout(t.timer), c.delete(e), t.settle(p));
|
|
52
|
+
}, B = () => {
|
|
53
|
+
[...c.keys()].forEach(y);
|
|
54
|
+
}, L = (e, t, r) => new Promise((n) => {
|
|
55
|
+
H(e);
|
|
56
|
+
const o = setTimeout(() => {
|
|
57
|
+
s.delete(e), l(e, "failed"), w(e, t), n({
|
|
58
|
+
status: "failed",
|
|
59
|
+
error: new Error(`Editor did not become ready within ${h}ms`)
|
|
60
|
+
});
|
|
61
|
+
}, h);
|
|
62
|
+
s.set(e, { html: t, css: r, timer: o, settle: n }), l(e, "applying");
|
|
63
|
+
}), C = (e, t, r) => O() ? g(e, t, r) : L(e, t, r), Q = async () => {
|
|
64
|
+
if (s.size === 0)
|
|
65
|
+
return;
|
|
66
|
+
const e = [...s.entries()];
|
|
67
|
+
s.clear(), e.forEach(([, o]) => clearTimeout(o.timer));
|
|
68
|
+
const t = e.pop();
|
|
69
|
+
if (e.forEach(([o, d]) => {
|
|
70
|
+
l(o, "failed"), d.settle({ status: "failed", error: new Error("Displaced by a newer apply") });
|
|
71
|
+
}), !t)
|
|
72
|
+
return;
|
|
73
|
+
const [r, n] = t;
|
|
74
|
+
n.settle(await g(r, n.html, n.css));
|
|
41
75
|
};
|
|
42
|
-
return
|
|
43
|
-
|
|
76
|
+
return j(() => T.isStripoInitialized, (e) => {
|
|
77
|
+
e && Q();
|
|
78
|
+
}, { immediate: !0 }), { applyStatus: a, markPending: b, applyTemplate: (e, t) => {
|
|
79
|
+
const { html: r } = t;
|
|
80
|
+
return r ? (B(), C(e, r, t.css ?? "")) : Promise.resolve(S);
|
|
44
81
|
}, applyTemplateDebounced: (e, t) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
82
|
+
const { html: r } = t;
|
|
83
|
+
if (!r)
|
|
84
|
+
return Promise.resolve(S);
|
|
85
|
+
const n = t.css ?? "";
|
|
86
|
+
return new Promise((o) => {
|
|
87
|
+
y(e);
|
|
88
|
+
const d = setTimeout(() => {
|
|
89
|
+
c.delete(e), C(e, r, n).then(o);
|
|
90
|
+
}, J);
|
|
91
|
+
c.set(e, { timer: d, settle: o });
|
|
92
|
+
});
|
|
52
93
|
} };
|
|
53
|
-
},
|
|
54
|
-
|
|
94
|
+
}, le = () => {
|
|
95
|
+
c.forEach((i) => {
|
|
96
|
+
clearTimeout(i.timer), i.settle(p);
|
|
97
|
+
}), c.clear(), s.forEach((i) => {
|
|
98
|
+
clearTimeout(i.timer), i.settle(p);
|
|
99
|
+
}), s.clear(), u.clear(), m.clear(), a.value = {};
|
|
55
100
|
};
|
|
56
101
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
102
|
+
le as resetEmailTemplateApplier,
|
|
103
|
+
ce as useEmailTemplateApplier
|
|
59
104
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-1ca6baf0]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-
|
|
1
|
+
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-1ca6baf0]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-7674b645]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-7674b645]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-7674b645]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
* - `error` segments (and message-level `isError` / `isCancelled`) trigger
|
|
18
18
|
* a localized toaster.
|
|
19
19
|
*
|
|
20
|
+
* Every apply settles into a terminal `applyAcks` entry on the public store, so
|
|
21
|
+
* cortex can move its Apply button on the truth of the editor write rather than
|
|
22
|
+
* on the click.
|
|
23
|
+
*
|
|
20
24
|
* In dev (`import.meta.env.DEV`) every observed segment + message-level flag
|
|
21
25
|
* change is also `console.debug`-logged with the prefix `[guido:cortex]` so a
|
|
22
26
|
* developer can watch the agent stream in real time. In production this is
|
|
23
27
|
* gated behind `localStorage.guido:debug:ai === '1'`.
|
|
24
|
-
*
|
|
25
|
-
* If cortex-fe isn't loaded the chat store is undefined and the bridge is a
|
|
26
|
-
* no-op (intentional — Guido must still work standalone).
|
|
27
28
|
*/
|
|
28
29
|
export declare const useCortexBlueprintBridge: () => void;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
|
|
2
|
+
/**
|
|
3
|
+
* Terminal outcome of an apply. Every promise this composable hands out settles
|
|
4
|
+
* with exactly one of these — callers (the cortex bridge) ack on it, so a
|
|
5
|
+
* never-settling promise would strand cortex's Apply button forever.
|
|
6
|
+
*
|
|
7
|
+
* Every map here is keyed by the caller's apply key (`blueprintId:version`), so
|
|
8
|
+
* `superseded` always means a newer payload for the SAME key replaced this one:
|
|
9
|
+
* not a success, not a failure, and never acked — that newer payload owns the ack.
|
|
10
|
+
*/
|
|
11
|
+
export type ApplyOutcome = {
|
|
12
|
+
status: 'applied';
|
|
13
|
+
} | {
|
|
14
|
+
status: 'failed';
|
|
15
|
+
error: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
status: 'superseded';
|
|
18
|
+
};
|
|
2
19
|
/**
|
|
3
20
|
* Applies email_template blueprints from the chat agent to the Stripo editor.
|
|
4
21
|
*
|
|
@@ -9,18 +26,22 @@ type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
|
|
|
9
26
|
* - manual Apply click (first apply): immediate.
|
|
10
27
|
* - blueprint_update after the user has applied once: debounced 250 ms trailing
|
|
11
28
|
* so rapid mid-stream updates don't thrash updateHtmlAndCss.
|
|
29
|
+
*
|
|
30
|
+
* A click that lands before Stripo finished initializing is queued rather than
|
|
31
|
+
* dropped, and flushed when `isStripoInitialized` flips — the user does not
|
|
32
|
+
* have to click again.
|
|
12
33
|
*/
|
|
13
34
|
export declare const useEmailTemplateApplier: () => {
|
|
14
35
|
applyStatus: import("vue").Ref<Record<string, ApplyStatus>>;
|
|
15
|
-
markPending: (
|
|
16
|
-
applyTemplate: (
|
|
36
|
+
markPending: (key: string) => void;
|
|
37
|
+
applyTemplate: (key: string, data: {
|
|
17
38
|
html?: string;
|
|
18
39
|
css?: string;
|
|
19
|
-
}) =>
|
|
20
|
-
applyTemplateDebounced: (
|
|
40
|
+
}) => Promise<ApplyOutcome>;
|
|
41
|
+
applyTemplateDebounced: (key: string, data: {
|
|
21
42
|
html?: string;
|
|
22
43
|
css?: string;
|
|
23
|
-
}) =>
|
|
44
|
+
}) => Promise<ApplyOutcome>;
|
|
24
45
|
};
|
|
25
46
|
export declare const resetEmailTemplateApplier: () => void;
|
|
26
47
|
export {};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/** Terminal outcome of an editor write, keyed by `${blueprintId}:${version}`. */
|
|
2
|
+
export interface ApplyAck {
|
|
3
|
+
status: 'applied' | 'failed';
|
|
4
|
+
/** The `applyRequestedAt` of the click this ack answers — lets cortex drop stale acks. */
|
|
5
|
+
requestedAt: number;
|
|
6
|
+
/** Strictly increasing per key, so two acks in the same millisecond still order. */
|
|
7
|
+
ackAt: number;
|
|
8
|
+
/** Stringified — cortex JSON-clones store-derived payloads, an Error would not survive. */
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
1
11
|
/** The published editor snapshot — the shape a consumer reads off the shared store. */
|
|
2
12
|
export interface GuidoEmailEditorState {
|
|
3
13
|
/** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
|
|
@@ -8,6 +18,10 @@ export interface GuidoEmailEditorState {
|
|
|
8
18
|
lastUpdatedAt: number;
|
|
9
19
|
/** Template id from the editor config, so a consumer can scope per-template. */
|
|
10
20
|
templateId: string;
|
|
21
|
+
/** True while a mounted Guido bridge is consuming the chat store. Gates cortex's Apply button. */
|
|
22
|
+
bridgeActive: boolean;
|
|
23
|
+
/** `${blueprintId}:${version}` → terminal outcome of the editor write, written only after it settles. */
|
|
24
|
+
applyAcks: Record<string, ApplyAck>;
|
|
11
25
|
}
|
|
12
26
|
/**
|
|
13
27
|
* Outbound contract Guido publishes to the host's shared Pinia singleton so a
|
|
@@ -18,17 +32,23 @@ export interface GuidoEmailEditorState {
|
|
|
18
32
|
* Published as `@useinsider/guido/editor-state` and from the root barrel, so a
|
|
19
33
|
* consumer imports this store instead of re-declaring one under the same id.
|
|
20
34
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
35
|
+
* This store is **state-only, by contract**. It declares no actions and no
|
|
36
|
+
* non-trivial getters, so `pinia.state.value['guidoEmailEditor']` is a complete
|
|
37
|
+
* view of it. cortex-fe reads it through that public path; adding an action or
|
|
38
|
+
* a getter that cortex needs would silently break that read. Keep it
|
|
39
|
+
* state-only. (`hasSnapshot` stays — cortex does not read it.)
|
|
40
|
+
*
|
|
41
|
+
* `useGuidoStateBridge` (the snapshot) and `useCortexBlueprintBridge` (the
|
|
42
|
+
* apply handshake) are the only intended writers, but that is Guido's own
|
|
43
|
+
* convention rather than something the store enforces: publishing the
|
|
44
|
+
* definition hands a consumer `$patch` as well, exactly as the runtime
|
|
45
|
+
* `pinia._s` probe always did.
|
|
25
46
|
*
|
|
26
|
-
* Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* Guido is willing to share.
|
|
47
|
+
* Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it at runtime rather
|
|
48
|
+
* than importing it, so the id stays part of the contract. The internal Guido
|
|
49
|
+
* editor store keeps id `guidoEditor` — these are intentionally separate. The
|
|
50
|
+
* internal store carries UI state a consumer should not see; this public store
|
|
51
|
+
* carries the contract Guido is willing to share.
|
|
32
52
|
*/
|
|
33
53
|
export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
|
|
34
54
|
/** True once the bridge has published at least one snapshot. */
|
|
@@ -37,5 +57,7 @@ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"
|
|
|
37
57
|
css: string;
|
|
38
58
|
lastUpdatedAt: number;
|
|
39
59
|
templateId: string;
|
|
60
|
+
bridgeActive: boolean;
|
|
61
|
+
applyAcks: Record<string, ApplyAck>;
|
|
40
62
|
} & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
|
|
41
63
|
}, {}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.19.0-beta.
|
|
3
|
+
"version": "3.19.0-beta.4b9be3a",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@stripoinc/ui-editor-extensions": "3.10.0",
|
|
55
55
|
"@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
|
|
56
|
-
"@useinsider/design-system-vue": "
|
|
56
|
+
"@useinsider/design-system-vue": "1.5.0",
|
|
57
57
|
"@vueuse/core": "11.3.0",
|
|
58
58
|
"lodash-es": "4.17.21",
|
|
59
59
|
"pinia": "2.3.1",
|