@useinsider/guido 1.0.3-beta.1d75236 → 1.0.3-beta.1ddf15d
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 +3 -0
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +48 -49
- package/dist/composables/useActionsApi.js +23 -32
- package/dist/composables/useSave.js +11 -16
- package/dist/composables/useStripo.js +46 -48
- package/dist/enums/defaults.js +5 -4
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +11 -10
- package/dist/src/composables/useActionsApi.d.ts +0 -1
- package/dist/src/enums/defaults.d.ts +1 -0
- package/package.json +1 -1
- package/dist/composables/useTimerClone.js +0 -75
- package/dist/src/composables/useTimerClone.d.ts +0 -6
package/README.md
CHANGED
|
@@ -600,6 +600,9 @@ Create a `.env` file with the following variables: (You can get env variables fr
|
|
|
600
600
|
VITE_STRIPO_PLUGIN_ID=your_plugin_id
|
|
601
601
|
VITE_STRIPO_SECRET_KEY=your_secret_key
|
|
602
602
|
VITE_STRIPO_ROLE=your_role
|
|
603
|
+
|
|
604
|
+
# Playwright Test Configuration (Optional - for local debugging only)
|
|
605
|
+
HEADED=false # Set to 'true' to run tests with visible browser
|
|
603
606
|
```
|
|
604
607
|
|
|
605
608
|
### Project Structure
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
const Ae = /* @__PURE__ */ z({
|
|
1
|
+
import { defineComponent as O, defineAsyncComponent as I, ref as z, computed as U, watch as B, onMounted as K, onUnmounted as j } from "vue";
|
|
2
|
+
import { provideGuidoActions as q } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as J } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as Q } from "../composables/useStripo.js";
|
|
5
|
+
import { migrate as L } from "../config/migrator/index.js";
|
|
6
|
+
import { DefaultUsername as V, DefaultMessageType as X, DefaultGuidoConfig as Y } from "../enums/defaults.js";
|
|
7
|
+
import Z from "./organisms/base/Toaster.vue.js";
|
|
8
|
+
import $ from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
9
|
+
import ee from "./organisms/header/HeaderWrapper.vue.js";
|
|
10
|
+
import oe from "./organisms/LoadingWrapper.vue.js";
|
|
11
|
+
import te from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
12
|
+
import ne from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
13
|
+
import { useStripoApi as re } from "../services/stripoApi.js";
|
|
14
|
+
import { useConfigStore as ie } from "../stores/config.js";
|
|
15
|
+
import { useDynamicContentStore as se } from "../stores/dynamic-content.js";
|
|
16
|
+
import { useEditorStore as ae } from "../stores/editor.js";
|
|
17
|
+
import { usePreviewStore as ce } from "../stores/preview.js";
|
|
18
|
+
import { useUnsubscribeStore as me } from "../stores/unsubscribe.js";
|
|
19
|
+
import de from "../node_modules/lodash-es/merge.js";
|
|
20
|
+
const Ue = /* @__PURE__ */ O({
|
|
22
21
|
__name: "Guido",
|
|
23
22
|
props: {
|
|
24
23
|
templateId: null,
|
|
@@ -33,34 +32,34 @@ const Ae = /* @__PURE__ */ z({
|
|
|
33
32
|
templateConfig: null
|
|
34
33
|
},
|
|
35
34
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
36
|
-
setup(
|
|
37
|
-
const u =
|
|
35
|
+
setup(W, { expose: _, emit: o }) {
|
|
36
|
+
const u = W, A = I(
|
|
38
37
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
39
|
-
),
|
|
38
|
+
), N = I(
|
|
40
39
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
41
|
-
), p =
|
|
40
|
+
), p = z(), i = se(), g = me(), f = ie(), s = ae(), F = ce(), n = U(() => s.hasChanges), { getPartnerName: y, getProductType: v, isTestPartner: H } = J(), b = () => {
|
|
42
41
|
var e;
|
|
43
42
|
return (e = p.value) == null ? void 0 : e.handleSave(!0);
|
|
44
43
|
}, {
|
|
45
44
|
templateId: a,
|
|
46
|
-
userId:
|
|
47
|
-
guidoConfig:
|
|
45
|
+
userId: C,
|
|
46
|
+
guidoConfig: h,
|
|
48
47
|
templateConfig: t,
|
|
49
48
|
html: r = "",
|
|
50
49
|
css: S = "",
|
|
51
50
|
partnerName: c = y(),
|
|
52
51
|
productType: m = v(),
|
|
53
|
-
messageType: w =
|
|
54
|
-
username: D =
|
|
52
|
+
messageType: w = X,
|
|
53
|
+
username: D = V
|
|
55
54
|
} = u, d = (t == null ? void 0 : t.preselectedDynamicContentList) || [];
|
|
56
|
-
s.templateId = a, window.GuidoConfig =
|
|
55
|
+
s.templateId = a, window.GuidoConfig = de(Y, h), window.GuidoConfig.partner = {
|
|
57
56
|
partnerName: c,
|
|
58
57
|
productType: m,
|
|
59
58
|
messageType: w
|
|
60
59
|
}, f.templateConfig = t;
|
|
61
|
-
const { initPlugin:
|
|
60
|
+
const { initPlugin: E } = Q({
|
|
62
61
|
emailId: a,
|
|
63
|
-
userId:
|
|
62
|
+
userId: C,
|
|
64
63
|
username: D,
|
|
65
64
|
partnerName: c,
|
|
66
65
|
productType: m,
|
|
@@ -68,11 +67,11 @@ const Ae = /* @__PURE__ */ z({
|
|
|
68
67
|
onReady: () => {
|
|
69
68
|
console.debug("guido:ready"), o("ready");
|
|
70
69
|
}
|
|
71
|
-
}), { getDefaultTemplate:
|
|
70
|
+
}), { getDefaultTemplate: T } = re(), R = U(() => {
|
|
72
71
|
var e;
|
|
73
72
|
return !((e = window.GuidoConfig) != null && e.useHeader);
|
|
74
73
|
});
|
|
75
|
-
|
|
74
|
+
q({
|
|
76
75
|
onBack: () => {
|
|
77
76
|
console.debug("guido:back"), o("back");
|
|
78
77
|
},
|
|
@@ -86,50 +85,50 @@ const Ae = /* @__PURE__ */ z({
|
|
|
86
85
|
console.debug("guido:test-email:click"), o("test-email:click");
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
|
-
const
|
|
88
|
+
const P = (e) => {
|
|
90
89
|
console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
91
|
-
},
|
|
90
|
+
}, k = () => {
|
|
92
91
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
B(() => n.value, () => {
|
|
95
94
|
o("on-change", n.value);
|
|
96
95
|
});
|
|
97
96
|
const l = (e) => {
|
|
98
|
-
const
|
|
99
|
-
console.debug("dynamic-content:open",
|
|
97
|
+
const G = e, { attribute: x, position: M } = G.detail;
|
|
98
|
+
console.debug("dynamic-content:open", G.detail), o("dynamic-content:open", x, M);
|
|
100
99
|
};
|
|
101
|
-
return
|
|
100
|
+
return K(async () => {
|
|
102
101
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
103
102
|
try {
|
|
104
103
|
g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
|
|
105
104
|
let e = {
|
|
106
|
-
html: r && await
|
|
105
|
+
html: r && await L(r),
|
|
107
106
|
css: S,
|
|
108
107
|
forceRecreate: !0
|
|
109
108
|
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
110
109
|
};
|
|
111
|
-
e.html || (e = await
|
|
110
|
+
e.html || (e = await T(), e.html = await L(e.html)), await E(e), i.selectedDynamicContentList = d;
|
|
112
111
|
} catch (e) {
|
|
113
112
|
console.error("Failed to initialize Stripo editor:", e);
|
|
114
113
|
}
|
|
115
114
|
document.addEventListener("dynamic-content:open", l);
|
|
116
|
-
}),
|
|
115
|
+
}), j(() => {
|
|
117
116
|
document.removeEventListener("dynamic-content:open", l);
|
|
118
117
|
try {
|
|
119
118
|
window.UIEditor.removeEditor();
|
|
120
119
|
} catch {
|
|
121
120
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
122
121
|
}
|
|
123
|
-
}),
|
|
122
|
+
}), _({
|
|
124
123
|
dynamicContent: {
|
|
125
|
-
insert:
|
|
126
|
-
close:
|
|
124
|
+
insert: P,
|
|
125
|
+
close: k
|
|
127
126
|
},
|
|
128
127
|
hasChanges: n,
|
|
129
|
-
saveSilent:
|
|
130
|
-
}), { __sfc: !0, PreviewContainer:
|
|
128
|
+
saveSilent: b
|
|
129
|
+
}), { __sfc: !0, PreviewContainer: A, OnboardingWrapper: N, headerWrapperRef: p, dynamicContentStore: i, unsubscribeStore: g, props: u, configStore: f, editorStore: s, previewStore: F, hasChanges: n, getPartnerName: y, getProductType: v, isTestPartner: H, saveSilent: b, templateId: a, userId: C, guidoConfig: h, templateConfig: t, html: r, css: S, partnerName: c, productType: m, messageType: w, username: D, preselectedDynamicContentList: d, emit: o, initPlugin: E, getDefaultTemplate: T, noHeader: R, insertDynamicContent: P, closeDynamicContent: k, handleDynamicContentOpen: l, Toaster: Z, FilterSelectionDrawer: $, HeaderWrapper: ee, LoadingWrapper: oe, SaveAsTemplateDrawer: te, UnsubscribeWrapper: ne };
|
|
131
130
|
}
|
|
132
131
|
});
|
|
133
132
|
export {
|
|
134
|
-
|
|
133
|
+
Ue as default
|
|
135
134
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useToaster as
|
|
1
|
+
import { useToaster as g } from "./useToaster.js";
|
|
2
2
|
const A = () => {
|
|
3
|
-
const { handleError: l } =
|
|
3
|
+
const { handleError: l } = g(), n = (t = {}) => new Promise((e, a) => {
|
|
4
4
|
const i = { ...{
|
|
5
5
|
minimize: !0,
|
|
6
6
|
utmEntity: {
|
|
@@ -20,13 +20,13 @@ const A = () => {
|
|
|
20
20
|
forceAmp: !1,
|
|
21
21
|
resetDataSavedFlag: !1,
|
|
22
22
|
disableLineHeightsReplace: !0
|
|
23
|
-
}, ...
|
|
24
|
-
callback: (
|
|
25
|
-
|
|
26
|
-
html:
|
|
27
|
-
ampHtml:
|
|
28
|
-
ampErrors:
|
|
29
|
-
displayConditions:
|
|
23
|
+
}, ...t }, m = {
|
|
24
|
+
callback: (s, c, p, u, d) => {
|
|
25
|
+
s ? a(s) : e({
|
|
26
|
+
html: c,
|
|
27
|
+
ampHtml: p,
|
|
28
|
+
ampErrors: u,
|
|
29
|
+
displayConditions: d
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
32
|
...i
|
|
@@ -34,53 +34,44 @@ const A = () => {
|
|
|
34
34
|
window.StripoEditorApi.actionsApi.compileEmail(m);
|
|
35
35
|
});
|
|
36
36
|
return {
|
|
37
|
-
getCompiledEmail:
|
|
38
|
-
getTemplateData: () => new Promise((
|
|
39
|
-
const
|
|
37
|
+
getCompiledEmail: n,
|
|
38
|
+
getTemplateData: () => new Promise((t) => {
|
|
39
|
+
const e = ({ html: a, css: o, width: i, height: r, utmParams: m, syncModulesIds: s }) => t({
|
|
40
40
|
html: a,
|
|
41
41
|
css: o,
|
|
42
42
|
width: i,
|
|
43
43
|
height: r,
|
|
44
44
|
utmParams: m,
|
|
45
|
-
syncModulesIds:
|
|
45
|
+
syncModulesIds: s
|
|
46
46
|
});
|
|
47
|
-
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
47
|
+
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
48
48
|
}),
|
|
49
|
-
activateCustomViewStyles: (
|
|
50
|
-
window.StripoEditorApi.actionsApi.activateCustomViewStyles(
|
|
49
|
+
activateCustomViewStyles: (t = !0) => {
|
|
50
|
+
window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
|
|
51
51
|
},
|
|
52
|
-
getPreviewData: async (
|
|
52
|
+
getPreviewData: async (t) => {
|
|
53
53
|
try {
|
|
54
54
|
const {
|
|
55
|
-
html:
|
|
55
|
+
html: e,
|
|
56
56
|
displayConditions: a,
|
|
57
57
|
ampHtml: o = "",
|
|
58
58
|
ampErrors: i = []
|
|
59
|
-
} = await
|
|
59
|
+
} = await n({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
60
60
|
return {
|
|
61
|
-
html:
|
|
61
|
+
html: e,
|
|
62
62
|
ampHtml: o,
|
|
63
63
|
ampErrors: i,
|
|
64
64
|
displayConditions: a
|
|
65
65
|
};
|
|
66
|
-
} catch (
|
|
67
|
-
return l(
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return l(e, "Error loading preview"), {
|
|
68
68
|
html: "",
|
|
69
69
|
ampHtml: "",
|
|
70
70
|
ampErrors: [],
|
|
71
71
|
displayConditions: []
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
}
|
|
75
|
-
updateTimerInClonedTemplate: () => new Promise((e) => {
|
|
76
|
-
try {
|
|
77
|
-
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((t, a) => {
|
|
78
|
-
t ? (l(t, "Failed to update timer in cloned template"), e(null)) : e(a || null);
|
|
79
|
-
});
|
|
80
|
-
} catch (t) {
|
|
81
|
-
l(t, "Failed to call updateTimerInClonedTemplate"), e(null);
|
|
82
|
-
}
|
|
83
|
-
})
|
|
74
|
+
}
|
|
84
75
|
};
|
|
85
76
|
};
|
|
86
77
|
export {
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { useSaveStart as
|
|
2
|
-
import { useTemplatePreparation as
|
|
3
|
-
import { useHtmlValidator as
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
t();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return;
|
|
12
|
-
const m = e.rawHtml.match(/esd-timer-id="(\d+)"/g);
|
|
13
|
-
e.rawHtml = await i(e.rawHtml);
|
|
14
|
-
const n = e.rawHtml.match(/esd-timer-id="(\d+)"/g);
|
|
15
|
-
return console.debug("[SAVE] Timer IDs - Original:", m, "New:", n), s || a(e), e;
|
|
1
|
+
import { useSaveStart as i, useSaveComplete as m } from "./useGuidoActions.js";
|
|
2
|
+
import { useTemplatePreparation as n } from "../utils/templatePreparation.js";
|
|
3
|
+
import { useHtmlValidator as l } from "./useHtmlValidator.js";
|
|
4
|
+
const f = () => {
|
|
5
|
+
const e = i(), a = m(), { validateHtml: s } = l();
|
|
6
|
+
return { save: async (o = !1) => {
|
|
7
|
+
e();
|
|
8
|
+
const { prepareTemplateDetails: r } = n(), t = await r();
|
|
9
|
+
if (await s(t.compiledHtml, t.dynamicContentList, !0))
|
|
10
|
+
return o || a(t), t;
|
|
16
11
|
} };
|
|
17
12
|
};
|
|
18
13
|
export {
|
|
19
|
-
|
|
14
|
+
f as useSave
|
|
20
15
|
};
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const e = P(), { html: s, css: f, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E();
|
|
1
|
+
import { useActionsApi as w } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as b } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as k } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as B } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as T } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as A } from "../services/stripoApi.js";
|
|
9
|
+
import F from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as M } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
|
|
12
|
+
import v from "../package.json.js";
|
|
13
|
+
const J = (c) => {
|
|
14
|
+
const { config: u } = k(), { handleError: l } = B(), { getToken: f, getCustomFonts: y } = A(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = b(), E = async (i, r = []) => {
|
|
15
|
+
var m, g;
|
|
16
|
+
const t = M(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: d } = await C();
|
|
18
17
|
window.UIEditor.initEditor(
|
|
19
18
|
document.querySelector("#guido-editor"),
|
|
20
19
|
{
|
|
21
20
|
metadata: c,
|
|
22
|
-
html:
|
|
23
|
-
css:
|
|
21
|
+
html: n,
|
|
22
|
+
css: p,
|
|
24
23
|
forceRecreate: a,
|
|
25
24
|
locale: "en",
|
|
26
25
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -31,10 +30,10 @@ const Y = (c) => {
|
|
|
31
30
|
customAppearanceMergetags: !0,
|
|
32
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
-
conditionsEnabled: ((
|
|
36
|
-
customConditionsEnabled: ((
|
|
37
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: F,
|
|
34
|
+
conditionsEnabled: ((m = u.features) == null ? void 0 : m.displayConditions) ?? !0,
|
|
35
|
+
customConditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
|
|
36
|
+
conditionCategories: T,
|
|
38
37
|
enableXSSSecurity: !0,
|
|
39
38
|
messageSettingsEnabled: !0,
|
|
40
39
|
displayGmailAnnotations: !0,
|
|
@@ -42,7 +41,7 @@ const Y = (c) => {
|
|
|
42
41
|
displayTitle: !1,
|
|
43
42
|
displayUTM: !1,
|
|
44
43
|
selectElementAfterDrop: !0,
|
|
45
|
-
...
|
|
44
|
+
...e ? { baseBlocks: e } : {},
|
|
46
45
|
editorFonts: {
|
|
47
46
|
showDefaultStandardFonts: !0,
|
|
48
47
|
showDefaultNotStandardFonts: !0,
|
|
@@ -50,39 +49,38 @@ const Y = (c) => {
|
|
|
50
49
|
},
|
|
51
50
|
mergeTags: [
|
|
52
51
|
{
|
|
53
|
-
entries:
|
|
52
|
+
entries: U(c.preselectedDynamicContentList)
|
|
54
53
|
}
|
|
55
54
|
],
|
|
56
55
|
async onTokenRefreshRequest(o) {
|
|
57
56
|
try {
|
|
58
|
-
const
|
|
59
|
-
o(
|
|
60
|
-
} catch (
|
|
61
|
-
|
|
57
|
+
const s = await f();
|
|
58
|
+
o(s);
|
|
59
|
+
} catch (s) {
|
|
60
|
+
l(s, "Failed to refresh token");
|
|
62
61
|
}
|
|
63
62
|
},
|
|
64
63
|
onTemplateLoaded() {
|
|
65
|
-
var o, n;
|
|
66
64
|
try {
|
|
67
|
-
const { importCss:
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const { importCss: o } = V(), { activateCustomViewStyles: s } = w();
|
|
66
|
+
o(), s(), c.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
67
|
+
t.hasChanges = !1;
|
|
70
68
|
}, 1e3);
|
|
71
|
-
} catch (
|
|
72
|
-
|
|
69
|
+
} catch (o) {
|
|
70
|
+
l(o, "Failed to load custom interface appearance");
|
|
73
71
|
}
|
|
74
72
|
},
|
|
75
73
|
onCodeEditorVisibilityChanged(o) {
|
|
76
|
-
|
|
74
|
+
t.isCodeEditorOpen = o;
|
|
77
75
|
},
|
|
78
76
|
onEditorVisualModeChanged(o) {
|
|
79
|
-
|
|
77
|
+
t.editorVisualMode = o.toLowerCase();
|
|
80
78
|
},
|
|
81
79
|
onVersionHistoryVisibilityChanged(o) {
|
|
82
|
-
|
|
80
|
+
t.isVersionHistoryOpen = o;
|
|
83
81
|
},
|
|
84
82
|
onDataChanged() {
|
|
85
|
-
|
|
83
|
+
t.hasChanges = !0;
|
|
86
84
|
},
|
|
87
85
|
onEvent: S,
|
|
88
86
|
ignoreClickOutsideSelectors: [
|
|
@@ -93,26 +91,26 @@ const Y = (c) => {
|
|
|
93
91
|
extensions: d
|
|
94
92
|
}
|
|
95
93
|
);
|
|
96
|
-
}, h = (i) => new Promise((r,
|
|
94
|
+
}, h = (i) => new Promise((r, t) => {
|
|
97
95
|
var d;
|
|
98
96
|
if (document.getElementById("UiEditorScript")) {
|
|
99
97
|
i(), r();
|
|
100
98
|
return;
|
|
101
99
|
}
|
|
102
|
-
const
|
|
103
|
-
|
|
100
|
+
const n = v.guido, a = `https://email-static.useinsider.com/guido/${(d = n == null ? void 0 : n.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
|
|
101
|
+
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
104
102
|
i(), r();
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
}, document.body.appendChild(
|
|
103
|
+
}, e.onerror = () => {
|
|
104
|
+
t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
105
|
+
}, document.body.appendChild(e);
|
|
108
106
|
});
|
|
109
107
|
return { initPlugin: async (i) => {
|
|
110
108
|
await h(async () => {
|
|
111
|
-
const r = await
|
|
112
|
-
await
|
|
109
|
+
const r = await y();
|
|
110
|
+
await E(i, r);
|
|
113
111
|
});
|
|
114
112
|
} };
|
|
115
113
|
};
|
|
116
114
|
export {
|
|
117
|
-
|
|
115
|
+
J as useStripo
|
|
118
116
|
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -23,11 +23,11 @@ const e = {
|
|
|
23
23
|
}, t = {
|
|
24
24
|
promotional: 1,
|
|
25
25
|
transactional: 2
|
|
26
|
-
}, a = "email", o = "Guido User", s = t.promotional, n = 2, i = {
|
|
26
|
+
}, a = "email", o = "Guido User", s = t.promotional, n = 2, i = 13, u = {
|
|
27
27
|
email: 60,
|
|
28
28
|
architect: 49,
|
|
29
29
|
unsubscribePages: 97
|
|
30
|
-
},
|
|
30
|
+
}, r = [
|
|
31
31
|
"alfredtesting",
|
|
32
32
|
"electio",
|
|
33
33
|
"eurekatest",
|
|
@@ -65,7 +65,8 @@ export {
|
|
|
65
65
|
a as DefaultProductType,
|
|
66
66
|
o as DefaultUsername,
|
|
67
67
|
n as EditorType,
|
|
68
|
-
i as
|
|
69
|
-
u as
|
|
68
|
+
i as MAX_DEFAULT_TEMPLATE_ID,
|
|
69
|
+
u as ProductIds,
|
|
70
|
+
r as TEST_PARTNER_LIST,
|
|
70
71
|
t as TemplateTypes
|
|
71
72
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-dced5582]{height:100%;top:75px}.guido-editor__wrapper[data-v-
|
|
1
|
+
.gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-dced5582]{height:100%;top:75px}.guido-editor__wrapper[data-v-23c413c9],.guido-editor__container[data-v-23c413c9]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-23c413c9]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useHttp as u } from "../composables/useHttp.js";
|
|
2
|
+
import { useToaster as l } from "../composables/useToaster.js";
|
|
3
|
+
import { MAX_DEFAULT_TEMPLATE_ID as m } from "../enums/defaults.js";
|
|
4
|
+
const y = () => {
|
|
5
|
+
const { get: r } = u(), { handleError: a } = l();
|
|
5
6
|
return {
|
|
6
7
|
getToken: async () => {
|
|
7
8
|
try {
|
|
8
9
|
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
|
|
9
10
|
return e.body.token;
|
|
10
11
|
} catch (t) {
|
|
11
|
-
return
|
|
12
|
+
return a(t, "Failed to fetch token"), "";
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
getCustomFonts: async () => {
|
|
@@ -19,7 +20,7 @@ const m = () => {
|
|
|
19
20
|
active: !0
|
|
20
21
|
}));
|
|
21
22
|
} catch (t) {
|
|
22
|
-
return
|
|
23
|
+
return a(t, "Failed to fetch custom fonts"), [];
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
getDefaultTemplate: async () => {
|
|
@@ -29,21 +30,21 @@ const m = () => {
|
|
|
29
30
|
forceRecreate: !0
|
|
30
31
|
};
|
|
31
32
|
try {
|
|
32
|
-
const { data:
|
|
33
|
+
const s = new URLSearchParams(window.location.search).get("default-template"), o = s ? parseInt(s) : 0, n = o >= 1 && o <= m ? o : 0, { data: c } = await r(`/stripo/default-template/${n}`);
|
|
33
34
|
try {
|
|
34
35
|
return {
|
|
35
|
-
...JSON.parse(
|
|
36
|
+
...JSON.parse(c),
|
|
36
37
|
forceRecreate: !0
|
|
37
38
|
};
|
|
38
39
|
} catch {
|
|
39
40
|
return t;
|
|
40
41
|
}
|
|
41
42
|
} catch (e) {
|
|
42
|
-
return
|
|
43
|
+
return a(e, "Failed to fetch default template"), t;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
y as useStripoApi
|
|
49
50
|
};
|
|
@@ -5,5 +5,4 @@ export declare const useActionsApi: () => {
|
|
|
5
5
|
getTemplateData: () => Promise<TemplateData>;
|
|
6
6
|
activateCustomViewStyles: (isActive?: boolean) => void;
|
|
7
7
|
getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
|
|
8
|
-
updateTimerInClonedTemplate: () => Promise<string | null>;
|
|
9
8
|
};
|
|
@@ -8,5 +8,6 @@ export declare const DefaultProductType = "email";
|
|
|
8
8
|
export declare const DefaultUsername = "Guido User";
|
|
9
9
|
export declare const DefaultMessageType: number;
|
|
10
10
|
export declare const EditorType: number;
|
|
11
|
+
export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
|
|
11
12
|
export declare const ProductIds: Record<string, number>;
|
|
12
13
|
export declare const TEST_PARTNER_LIST: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.3-beta.
|
|
3
|
+
"version": "1.0.3-beta.1ddf15d",
|
|
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",
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useToaster as C } from "./useToaster.js";
|
|
2
|
-
import { useStripoApi as L } from "../services/stripoApi.js";
|
|
3
|
-
const w = () => {
|
|
4
|
-
const { handleError: c } = C(), { getToken: T } = L(), d = (t) => /esd-timer-id="(\d+)"/.test(t), a = async (t, o) => {
|
|
5
|
-
try {
|
|
6
|
-
console.debug("[TIMER CLONE] Calling Stripo API to clone timers...");
|
|
7
|
-
const e = await fetch("https://plugins.stripo.email/api/v1/timers/clone", {
|
|
8
|
-
method: "POST",
|
|
9
|
-
headers: {
|
|
10
|
-
"ES-PLUGIN-AUTH": `Bearer ${o}`,
|
|
11
|
-
"Content-Type": "application/json"
|
|
12
|
-
},
|
|
13
|
-
body: JSON.stringify({ html: t })
|
|
14
|
-
});
|
|
15
|
-
if (console.debug("[TIMER CLONE] API response status:", e.status), !e.ok) {
|
|
16
|
-
const r = await e.text();
|
|
17
|
-
throw console.debug("[TIMER CLONE] API error:", r), new Error(`Stripo API error: ${e.status} ${e.statusText}`);
|
|
18
|
-
}
|
|
19
|
-
const n = await e.json();
|
|
20
|
-
return console.debug("[TIMER CLONE] Timers cloned successfully. Map:", n.timersMap), console.debug("[TIMER CLONE] Old HTML length:", t.length), console.debug("[TIMER CLONE] New HTML length:", n.html.length), n.html;
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return console.debug("[TIMER CLONE] Error:", e), c(e, "Failed to clone timer IDs"), null;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
hasTimerBlocks: d,
|
|
27
|
-
cloneTimersInHtml: a,
|
|
28
|
-
cloneTimersOnSave: async (t) => {
|
|
29
|
-
if (!d(t))
|
|
30
|
-
return t;
|
|
31
|
-
console.debug("[TIMER CLONE] Cloning timers on save...");
|
|
32
|
-
const o = await T();
|
|
33
|
-
return o ? await a(t, o) || t : (console.debug("[TIMER CLONE] No auth token available, skipping"), t);
|
|
34
|
-
},
|
|
35
|
-
updateTimersOnLoad: async (t) => {
|
|
36
|
-
var o, e, n, r, l, u;
|
|
37
|
-
try {
|
|
38
|
-
console.debug("[TIMER CLONE] Starting timer update on template load...");
|
|
39
|
-
const s = (e = (o = window.UIEditor) == null ? void 0 : o.getHtml) == null ? void 0 : e.call(o);
|
|
40
|
-
if (!s) {
|
|
41
|
-
console.debug("[TIMER CLONE] No HTML found, skipping timer update");
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const E = d(s);
|
|
45
|
-
if (console.debug("[TIMER CLONE] Has timer blocks?", E), !E)
|
|
46
|
-
return;
|
|
47
|
-
const g = s.match(/esd-timer-id="(\d+)"/g);
|
|
48
|
-
console.debug("[TIMER CLONE] Current timer IDs:", g), console.debug("[TIMER CLONE] Getting auth token...");
|
|
49
|
-
const p = await t();
|
|
50
|
-
if (!p) {
|
|
51
|
-
console.debug("[TIMER CLONE] No auth token available, skipping timer update");
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const i = await a(s, p);
|
|
55
|
-
if (!i) {
|
|
56
|
-
console.debug("[TIMER CLONE] API returned no updated HTML");
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (i === s) {
|
|
60
|
-
console.debug("[TIMER CLONE] HTML unchanged, no update needed");
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const m = i.match(/esd-timer-id="(\d+)"/g);
|
|
64
|
-
console.debug("[TIMER CLONE] New timer IDs:", m);
|
|
65
|
-
const I = ((r = (n = window.UIEditor) == null ? void 0 : n.getCss) == null ? void 0 : r.call(n)) || "";
|
|
66
|
-
console.debug("[TIMER CLONE] Updating editor with new HTML..."), (u = (l = window.StripoEditorApi) == null ? void 0 : l.actionsApi) != null && u.updateHtmlAndCss ? (window.StripoEditorApi.actionsApi.updateHtmlAndCss(i, I), console.debug("[TIMER CLONE] ✅ Editor updated successfully!")) : console.debug("[TIMER CLONE] updateHtmlAndCss method not available");
|
|
67
|
-
} catch (s) {
|
|
68
|
-
console.debug("[TIMER CLONE] Error updating timers:", s), c(s, "Failed to update timer blocks");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
w as useTimerClone
|
|
75
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const useTimerClone: () => {
|
|
2
|
-
hasTimerBlocks: (html: string) => boolean;
|
|
3
|
-
cloneTimersInHtml: (html: string, authToken: string) => Promise<string | null>;
|
|
4
|
-
cloneTimersOnSave: (html: string) => Promise<string>;
|
|
5
|
-
updateTimersOnLoad: (getTokenFn: () => Promise<string>) => Promise<void>;
|
|
6
|
-
};
|