@useinsider/guido 1.0.3-beta.bf31272 → 1.0.3-beta.c0e332b
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 +49 -48
- package/dist/composables/useActionsApi.js +42 -25
- package/dist/composables/useStripo.js +34 -34
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/enums/defaults.js +4 -5
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +90 -94
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +2 -3
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -3
- package/dist/extensions/Blocks/Items/extension.js +6 -7
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +5 -17
- package/dist/extensions/Blocks/Items/settingsPanel.js +24 -25
- package/dist/extensions/Blocks/Items/store/items-block.js +4 -8
- package/dist/extensions/Blocks/Items/template.js +59 -65
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +26 -35
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +27 -29
- package/dist/extensions/Blocks/Unsubscribe/block.js +30 -34
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +17 -16
- package/dist/src/composables/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -6
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +4 -3
- package/package.json +1 -3
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +0 -92
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -15
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import Z from "
|
|
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
|
-
|
|
1
|
+
import { defineComponent as z, defineAsyncComponent as L, ref as K, computed as W, watch as j, onMounted as q, onUnmounted as J } from "vue";
|
|
2
|
+
import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as V } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as X } from "../composables/useStripo.js";
|
|
5
|
+
import { useTimerClone as Y } from "../composables/useTimerClone.js";
|
|
6
|
+
import { migrate as _ } from "../config/migrator/index.js";
|
|
7
|
+
import { DefaultUsername as Z, DefaultMessageType as $, DefaultGuidoConfig as ee } from "../enums/defaults.js";
|
|
8
|
+
import oe from "./organisms/base/Toaster.vue.js";
|
|
9
|
+
import te from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
10
|
+
import ne from "./organisms/header/HeaderWrapper.vue.js";
|
|
11
|
+
import re from "./organisms/LoadingWrapper.vue.js";
|
|
12
|
+
import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
13
|
+
import se from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
14
|
+
import { useStripoApi as ae } from "../services/stripoApi.js";
|
|
15
|
+
import { useConfigStore as ce } from "../stores/config.js";
|
|
16
|
+
import { useDynamicContentStore as me } from "../stores/dynamic-content.js";
|
|
17
|
+
import { useEditorStore as de } from "../stores/editor.js";
|
|
18
|
+
import { usePreviewStore as le } from "../stores/preview.js";
|
|
19
|
+
import { useUnsubscribeStore as ue } from "../stores/unsubscribe.js";
|
|
20
|
+
import pe from "../node_modules/lodash-es/merge.js";
|
|
21
|
+
const Ae = /* @__PURE__ */ z({
|
|
21
22
|
__name: "Guido",
|
|
22
23
|
props: {
|
|
23
24
|
templateId: null,
|
|
@@ -32,34 +33,34 @@ const Ue = /* @__PURE__ */ O({
|
|
|
32
33
|
templateConfig: null
|
|
33
34
|
},
|
|
34
35
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
35
|
-
setup(
|
|
36
|
-
const u =
|
|
36
|
+
setup(A, { expose: N, emit: o }) {
|
|
37
|
+
const u = A, F = L(
|
|
37
38
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
38
|
-
),
|
|
39
|
+
), H = L(
|
|
39
40
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
40
|
-
), p =
|
|
41
|
+
), p = K(), i = me(), g = ue(), f = ce(), s = de(), O = le(), n = W(() => s.hasChanges), { getPartnerName: y, getProductType: v, isTestPartner: R } = V(), h = () => {
|
|
41
42
|
var e;
|
|
42
43
|
return (e = p.value) == null ? void 0 : e.handleSave(!0);
|
|
43
44
|
}, {
|
|
44
45
|
templateId: a,
|
|
45
|
-
userId:
|
|
46
|
-
guidoConfig:
|
|
46
|
+
userId: b,
|
|
47
|
+
guidoConfig: C,
|
|
47
48
|
templateConfig: t,
|
|
48
49
|
html: r = "",
|
|
49
50
|
css: S = "",
|
|
50
51
|
partnerName: c = y(),
|
|
51
52
|
productType: m = v(),
|
|
52
|
-
messageType: w =
|
|
53
|
-
username: D =
|
|
53
|
+
messageType: w = $,
|
|
54
|
+
username: D = Z
|
|
54
55
|
} = u, d = (t == null ? void 0 : t.preselectedDynamicContentList) || [];
|
|
55
|
-
s.templateId = a, window.GuidoConfig =
|
|
56
|
+
s.templateId = a, window.GuidoConfig = pe(ee, C), window.GuidoConfig.partner = {
|
|
56
57
|
partnerName: c,
|
|
57
58
|
productType: m,
|
|
58
59
|
messageType: w
|
|
59
60
|
}, f.templateConfig = t;
|
|
60
|
-
const { initPlugin:
|
|
61
|
+
const { initPlugin: T } = X({
|
|
61
62
|
emailId: a,
|
|
62
|
-
userId:
|
|
63
|
+
userId: b,
|
|
63
64
|
username: D,
|
|
64
65
|
partnerName: c,
|
|
65
66
|
productType: m,
|
|
@@ -67,11 +68,11 @@ const Ue = /* @__PURE__ */ O({
|
|
|
67
68
|
onReady: () => {
|
|
68
69
|
console.debug("guido:ready"), o("ready");
|
|
69
70
|
}
|
|
70
|
-
}), { getDefaultTemplate:
|
|
71
|
+
}), { getDefaultTemplate: E } = ae(), { cloneTimersOnSave: k, hasTimerBlocks: P } = Y(), x = W(() => {
|
|
71
72
|
var e;
|
|
72
73
|
return !((e = window.GuidoConfig) != null && e.useHeader);
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
+
Q({
|
|
75
76
|
onBack: () => {
|
|
76
77
|
console.debug("guido:back"), o("back");
|
|
77
78
|
},
|
|
@@ -85,50 +86,50 @@ const Ue = /* @__PURE__ */ O({
|
|
|
85
86
|
console.debug("guido:test-email:click"), o("test-email:click");
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
|
-
const
|
|
89
|
+
const G = (e) => {
|
|
89
90
|
console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
90
|
-
},
|
|
91
|
+
}, I = () => {
|
|
91
92
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
92
93
|
};
|
|
93
|
-
|
|
94
|
+
j(() => n.value, () => {
|
|
94
95
|
o("on-change", n.value);
|
|
95
96
|
});
|
|
96
97
|
const l = (e) => {
|
|
97
|
-
const
|
|
98
|
-
console.debug("dynamic-content:open",
|
|
98
|
+
const U = e, { attribute: B, position: M } = U.detail;
|
|
99
|
+
console.debug("dynamic-content:open", U.detail), o("dynamic-content:open", B, M);
|
|
99
100
|
};
|
|
100
|
-
return
|
|
101
|
+
return q(async () => {
|
|
101
102
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
102
103
|
try {
|
|
103
104
|
g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
|
|
104
105
|
let e = {
|
|
105
|
-
html: r && await
|
|
106
|
+
html: r && await _(r),
|
|
106
107
|
css: S,
|
|
107
108
|
forceRecreate: !0
|
|
108
109
|
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
109
110
|
};
|
|
110
|
-
e.html || (e = await
|
|
111
|
+
e.html || (e = await E(), e.html = await _(e.html)), P(e.html) && (e.html = await k(e.html)), await T(e), i.selectedDynamicContentList = d;
|
|
111
112
|
} catch (e) {
|
|
112
113
|
console.error("Failed to initialize Stripo editor:", e);
|
|
113
114
|
}
|
|
114
115
|
document.addEventListener("dynamic-content:open", l);
|
|
115
|
-
}),
|
|
116
|
+
}), J(() => {
|
|
116
117
|
document.removeEventListener("dynamic-content:open", l);
|
|
117
118
|
try {
|
|
118
119
|
window.UIEditor.removeEditor();
|
|
119
120
|
} catch {
|
|
120
121
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
121
122
|
}
|
|
122
|
-
}),
|
|
123
|
+
}), N({
|
|
123
124
|
dynamicContent: {
|
|
124
|
-
insert:
|
|
125
|
-
close:
|
|
125
|
+
insert: G,
|
|
126
|
+
close: I
|
|
126
127
|
},
|
|
127
128
|
hasChanges: n,
|
|
128
|
-
saveSilent:
|
|
129
|
-
}), { __sfc: !0, PreviewContainer:
|
|
129
|
+
saveSilent: h
|
|
130
|
+
}), { __sfc: !0, PreviewContainer: F, OnboardingWrapper: H, headerWrapperRef: p, dynamicContentStore: i, unsubscribeStore: g, props: u, configStore: f, editorStore: s, previewStore: O, hasChanges: n, getPartnerName: y, getProductType: v, isTestPartner: R, saveSilent: h, templateId: a, userId: b, guidoConfig: C, templateConfig: t, html: r, css: S, partnerName: c, productType: m, messageType: w, username: D, preselectedDynamicContentList: d, emit: o, initPlugin: T, getDefaultTemplate: E, cloneTimersOnSave: k, hasTimerBlocks: P, noHeader: x, insertDynamicContent: G, closeDynamicContent: I, handleDynamicContentOpen: l, Toaster: oe, FilterSelectionDrawer: te, HeaderWrapper: ne, LoadingWrapper: re, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: se };
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
Ae as default
|
|
134
135
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useToaster as
|
|
2
|
-
const
|
|
3
|
-
const { handleError: l } =
|
|
4
|
-
const
|
|
1
|
+
import { useToaster as w } from "./useToaster.js";
|
|
2
|
+
const S = () => {
|
|
3
|
+
const { handleError: l } = w(), s = (t = {}) => new Promise((e, i) => {
|
|
4
|
+
const n = { ...{
|
|
5
5
|
minimize: !0,
|
|
6
6
|
utmEntity: {
|
|
7
7
|
utmSource: "",
|
|
@@ -21,28 +21,28 @@ const A = () => {
|
|
|
21
21
|
resetDataSavedFlag: !1,
|
|
22
22
|
disableLineHeightsReplace: !0
|
|
23
23
|
}, ...t }, m = {
|
|
24
|
-
callback: (
|
|
25
|
-
|
|
26
|
-
html:
|
|
27
|
-
ampHtml:
|
|
28
|
-
ampErrors:
|
|
29
|
-
displayConditions:
|
|
24
|
+
callback: (o, p, d, c, u) => {
|
|
25
|
+
o ? i(o) : e({
|
|
26
|
+
html: p,
|
|
27
|
+
ampHtml: d,
|
|
28
|
+
ampErrors: c,
|
|
29
|
+
displayConditions: u
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
|
-
...
|
|
32
|
+
...n
|
|
33
33
|
};
|
|
34
34
|
window.StripoEditorApi.actionsApi.compileEmail(m);
|
|
35
35
|
});
|
|
36
36
|
return {
|
|
37
|
-
getCompiledEmail:
|
|
37
|
+
getCompiledEmail: s,
|
|
38
38
|
getTemplateData: () => new Promise((t) => {
|
|
39
|
-
const e = ({ html:
|
|
40
|
-
html:
|
|
41
|
-
css:
|
|
42
|
-
width:
|
|
39
|
+
const e = ({ html: i, css: a, width: n, height: r, utmParams: m, syncModulesIds: o }) => t({
|
|
40
|
+
html: i,
|
|
41
|
+
css: a,
|
|
42
|
+
width: n,
|
|
43
43
|
height: r,
|
|
44
44
|
utmParams: m,
|
|
45
|
-
syncModulesIds:
|
|
45
|
+
syncModulesIds: o
|
|
46
46
|
});
|
|
47
47
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
48
48
|
}),
|
|
@@ -53,15 +53,15 @@ const A = () => {
|
|
|
53
53
|
try {
|
|
54
54
|
const {
|
|
55
55
|
html: e,
|
|
56
|
-
displayConditions:
|
|
57
|
-
ampHtml:
|
|
58
|
-
ampErrors:
|
|
59
|
-
} = await
|
|
56
|
+
displayConditions: i,
|
|
57
|
+
ampHtml: a = "",
|
|
58
|
+
ampErrors: n = []
|
|
59
|
+
} = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
60
60
|
return {
|
|
61
61
|
html: e,
|
|
62
|
-
ampHtml:
|
|
63
|
-
ampErrors:
|
|
64
|
-
displayConditions:
|
|
62
|
+
ampHtml: a,
|
|
63
|
+
ampErrors: n,
|
|
64
|
+
displayConditions: i
|
|
65
65
|
};
|
|
66
66
|
} catch (e) {
|
|
67
67
|
return l(e, "Error loading preview"), {
|
|
@@ -71,9 +71,26 @@ const A = () => {
|
|
|
71
71
|
displayConditions: []
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
},
|
|
75
|
+
updateTimerInClonedTemplate: () => new Promise((t) => {
|
|
76
|
+
var e, i;
|
|
77
|
+
if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
|
|
78
|
+
t(null);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, n) => {
|
|
83
|
+
a ? (l(a, "Failed to update timer in cloned template"), t(null)) : t(n || null);
|
|
84
|
+
});
|
|
85
|
+
} catch (a) {
|
|
86
|
+
l(a, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
updateHtmlAndCss: (t, e) => {
|
|
90
|
+
window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
|
|
74
91
|
}
|
|
75
92
|
};
|
|
76
93
|
};
|
|
77
94
|
export {
|
|
78
|
-
|
|
95
|
+
S as useActionsApi
|
|
79
96
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
1
|
+
import { useActionsApi as b } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as k } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as T } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
|
|
6
6
|
import { useToaster as B } from "./useToaster.js";
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { dynamicContentToMergeTags as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
const { config:
|
|
7
|
+
import { displayConditions as A } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as F } from "../services/stripoApi.js";
|
|
9
|
+
import v from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as I } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as M } from "../utils/genericUtil.js";
|
|
12
|
+
import U from "../package.json.js";
|
|
13
|
+
const N = (c) => {
|
|
14
|
+
const { config: l } = T(), { handleError: u } = B(), { getToken: f, getCustomFonts: y } = F(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = k(), E = async (i, r = []) => {
|
|
15
15
|
var m, g;
|
|
16
|
-
const
|
|
16
|
+
const e = I(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await C();
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
@@ -30,10 +30,10 @@ const J = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled: ((m =
|
|
35
|
-
customConditionsEnabled: ((g =
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: v,
|
|
34
|
+
conditionsEnabled: ((m = l.features) == null ? void 0 : m.displayConditions) ?? !0,
|
|
35
|
+
customConditionsEnabled: ((g = l.features) == null ? void 0 : g.displayConditions) ?? !0,
|
|
36
|
+
conditionCategories: A,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
38
|
messageSettingsEnabled: !0,
|
|
39
39
|
displayGmailAnnotations: !0,
|
|
@@ -41,7 +41,7 @@ const J = (c) => {
|
|
|
41
41
|
displayTitle: !1,
|
|
42
42
|
displayUTM: !1,
|
|
43
43
|
selectElementAfterDrop: !0,
|
|
44
|
-
...
|
|
44
|
+
...t ? { baseBlocks: t } : {},
|
|
45
45
|
editorFonts: {
|
|
46
46
|
showDefaultStandardFonts: !0,
|
|
47
47
|
showDefaultNotStandardFonts: !0,
|
|
@@ -49,7 +49,7 @@ const J = (c) => {
|
|
|
49
49
|
},
|
|
50
50
|
mergeTags: [
|
|
51
51
|
{
|
|
52
|
-
entries:
|
|
52
|
+
entries: M(c.preselectedDynamicContentList)
|
|
53
53
|
}
|
|
54
54
|
],
|
|
55
55
|
async onTokenRefreshRequest(o) {
|
|
@@ -57,30 +57,30 @@ const J = (c) => {
|
|
|
57
57
|
const s = await f();
|
|
58
58
|
o(s);
|
|
59
59
|
} catch (s) {
|
|
60
|
-
|
|
60
|
+
u(s, "Failed to refresh token");
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
onTemplateLoaded() {
|
|
64
64
|
try {
|
|
65
|
-
const { importCss: o } = V(), { activateCustomViewStyles: s } =
|
|
66
|
-
o(), s(), c.onReady(),
|
|
67
|
-
|
|
65
|
+
const { importCss: o } = V(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: w } = b();
|
|
66
|
+
o(), s(), w(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
67
|
+
e.hasChanges = !1;
|
|
68
68
|
}, 1e3);
|
|
69
69
|
} catch (o) {
|
|
70
|
-
|
|
70
|
+
u(o, "Failed to load custom interface appearance");
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
onCodeEditorVisibilityChanged(o) {
|
|
74
|
-
|
|
74
|
+
e.isCodeEditorOpen = o;
|
|
75
75
|
},
|
|
76
76
|
onEditorVisualModeChanged(o) {
|
|
77
|
-
|
|
77
|
+
e.editorVisualMode = o.toLowerCase();
|
|
78
78
|
},
|
|
79
79
|
onVersionHistoryVisibilityChanged(o) {
|
|
80
|
-
|
|
80
|
+
e.isVersionHistoryOpen = o;
|
|
81
81
|
},
|
|
82
82
|
onDataChanged() {
|
|
83
|
-
|
|
83
|
+
e.hasChanges = !0;
|
|
84
84
|
},
|
|
85
85
|
onEvent: S,
|
|
86
86
|
ignoreClickOutsideSelectors: [
|
|
@@ -91,18 +91,18 @@ const J = (c) => {
|
|
|
91
91
|
extensions: d
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
}, h = (i) => new Promise((r,
|
|
94
|
+
}, h = (i) => new Promise((r, e) => {
|
|
95
95
|
var d;
|
|
96
96
|
if (document.getElementById("UiEditorScript")) {
|
|
97
97
|
i(), r();
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
const n =
|
|
101
|
-
|
|
100
|
+
const n = U.guido, a = `https://email-static.useinsider.com/guido/${(d = n == null ? void 0 : n.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
101
|
+
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
102
102
|
i(), r();
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
}, document.body.appendChild(
|
|
103
|
+
}, t.onerror = () => {
|
|
104
|
+
e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
105
|
+
}, document.body.appendChild(t);
|
|
106
106
|
});
|
|
107
107
|
return { initPlugin: async (i) => {
|
|
108
108
|
await h(async () => {
|
|
@@ -112,5 +112,5 @@ const J = (c) => {
|
|
|
112
112
|
} };
|
|
113
113
|
};
|
|
114
114
|
export {
|
|
115
|
-
|
|
115
|
+
N as useStripo
|
|
116
116
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useHttp as w } from "./useHttp.js";
|
|
3
|
+
import { useToaster as H } from "./useToaster.js";
|
|
4
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
5
|
+
const O = () => {
|
|
6
|
+
const { handleError: c } = H(), { getToken: u } = y(), { post: d } = w(), { updateHtmlAndCss: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
|
|
7
|
+
try {
|
|
8
|
+
return (await d(
|
|
9
|
+
"https://plugins.stripo.email/api/v1/timers/clone",
|
|
10
|
+
{ html: t },
|
|
11
|
+
{
|
|
12
|
+
headers: {
|
|
13
|
+
"ES-PLUGIN-AUTH": `Bearer ${e}`,
|
|
14
|
+
"Content-Type": "application/json"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
)).data.html;
|
|
18
|
+
} catch (r) {
|
|
19
|
+
return c(r, "Failed to clone timer IDs"), null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
hasTimerBlocks: s,
|
|
24
|
+
cloneTimersInHtml: i,
|
|
25
|
+
cloneTimersOnSave: async (t) => {
|
|
26
|
+
if (!s(t))
|
|
27
|
+
return t;
|
|
28
|
+
const e = await u();
|
|
29
|
+
return e && await i(t, e) || t;
|
|
30
|
+
},
|
|
31
|
+
updateTimersOnLoad: async (t) => {
|
|
32
|
+
var e, r, o, m;
|
|
33
|
+
try {
|
|
34
|
+
const n = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
|
|
35
|
+
if (!n || !s(n))
|
|
36
|
+
return;
|
|
37
|
+
const p = await t();
|
|
38
|
+
if (!p)
|
|
39
|
+
return;
|
|
40
|
+
const a = await i(n, p);
|
|
41
|
+
if (!a || a === n)
|
|
42
|
+
return;
|
|
43
|
+
const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
|
|
44
|
+
l(a, T);
|
|
45
|
+
} catch (n) {
|
|
46
|
+
c(n, "Failed to update timer blocks");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
O as useTimerClone
|
|
53
|
+
};
|
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 = {
|
|
27
27
|
email: 60,
|
|
28
28
|
architect: 49,
|
|
29
29
|
unsubscribePages: 97
|
|
30
|
-
},
|
|
30
|
+
}, u = [
|
|
31
31
|
"alfredtesting",
|
|
32
32
|
"electio",
|
|
33
33
|
"eurekatest",
|
|
@@ -65,8 +65,7 @@ export {
|
|
|
65
65
|
a as DefaultProductType,
|
|
66
66
|
o as DefaultUsername,
|
|
67
67
|
n as EditorType,
|
|
68
|
-
i as
|
|
69
|
-
u as
|
|
70
|
-
r as TEST_PARTNER_LIST,
|
|
68
|
+
i as ProductIds,
|
|
69
|
+
u as TEST_PARTNER_LIST,
|
|
71
70
|
t as TemplateTypes
|
|
72
71
|
};
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
3
|
+
var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as n, UIElementType as a, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
-
import { ItemsBlockControlId as
|
|
6
|
+
import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
|
|
7
7
|
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
8
|
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
-
import { syncNameTrimmingFromAttributes as
|
|
10
|
-
import { updateConfigBlockAttributes as
|
|
11
|
-
const
|
|
9
|
+
import { syncNameTrimmingFromAttributes as y } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
|
|
11
|
+
const f = l.NAME_TRIMMING, r = {
|
|
12
12
|
TRIMMING: "trimming"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class R extends c {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
|
|
17
|
+
s(this, "store", N());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return f;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
24
|
-
<div class="${
|
|
24
|
+
<div class="${l.NAME_TRIMMING}">
|
|
25
25
|
${this._getTextTrimming()}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
onRender() {
|
|
30
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
|
|
31
31
|
this._onTrimmingChange(e);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
onTemplateNodeUpdated(e) {
|
|
35
35
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
36
|
-
() =>
|
|
36
|
+
() => y(this.currentNode),
|
|
37
37
|
() => {
|
|
38
|
-
this.api.updateValues({ [
|
|
38
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
|
|
39
39
|
}
|
|
40
|
-
);
|
|
40
|
+
), this.store.nameTrimming && this._applyTrimmingStyles();
|
|
41
41
|
}
|
|
42
42
|
_onTrimmingChange(e) {
|
|
43
|
-
this.store.setNameTrimming(e),
|
|
43
|
+
this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
44
44
|
}
|
|
45
45
|
_applyTrimmingStyles(e) {
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
46
|
+
var m;
|
|
47
|
+
const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
|
|
48
|
+
if (!o)
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
51
|
+
p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "550px").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
|
|
52
52
|
}
|
|
53
53
|
_getTextTrimming() {
|
|
54
54
|
return `
|
|
55
55
|
<div class="container">
|
|
56
56
|
<div class="display-flex align-items-center justify-content-between">
|
|
57
|
-
<${
|
|
57
|
+
<${a.LABEL}
|
|
58
58
|
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
59
|
>
|
|
60
|
-
</${
|
|
61
|
-
${this._GuToggle(
|
|
60
|
+
</${a.LABEL}>
|
|
61
|
+
${this._GuToggle(r.TRIMMING)}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
f as CONTROL_BLOCK_ID,
|
|
69
|
+
R as NameTrimmingControl
|
|
70
70
|
};
|