@useinsider/guido 1.4.4 → 2.0.0-beta.087a24f
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 +295 -664
- package/dist/@types/config/defaults.js +44 -0
- package/dist/@types/config/schemas.js +231 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -86
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
- package/dist/composables/useActionsApi.js +42 -25
- package/dist/composables/useBlocksConfig.js +23 -20
- package/dist/composables/useConfig.js +51 -5
- package/dist/composables/useHtmlCompiler.js +20 -19
- package/dist/composables/useHtmlValidator.js +41 -41
- package/dist/composables/usePartner.js +19 -9
- package/dist/composables/useStripo.js +55 -56
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/enums/defaults.js +4 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +296 -123
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/stripoApi.js +13 -14
- package/dist/services/templateLibraryApi.js +18 -18
- package/dist/src/@types/config/defaults.d.ts +68 -0
- package/dist/src/@types/config/index.d.ts +14 -0
- package/dist/src/@types/config/schemas.d.ts +509 -0
- package/dist/src/@types/config/types.d.ts +142 -0
- package/dist/src/@types/config/validator.d.ts +119 -0
- package/dist/src/@types/generic.d.ts +4 -45
- package/dist/src/components/Guido.vue.d.ts +13 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +186 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +5 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
- package/dist/src/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1564 -102
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +141 -9
- package/package.json +3 -3
- package/dist/node_modules/lodash-es/_apply.js +0 -16
- package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
- package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
- package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/lodash-es/_copyArray.js +0 -9
- package/dist/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
- package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
- package/dist/node_modules/lodash-es/_overRest.js +0 -15
- package/dist/node_modules/lodash-es/_safeGet.js +0 -7
- package/dist/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/lodash-es/_shortOut.js +0 -16
- package/dist/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
- package/dist/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/package.json.js +0 -7
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { TemplateTypes as
|
|
3
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
1
|
+
import { useConfig as D } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as R, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as G } from "../enums/html-validator.js";
|
|
4
4
|
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
5
|
-
import { itemsBlockDynamicVariables as
|
|
6
|
-
import { useRecommendationStore as
|
|
7
|
-
import { base64EncodeWithSpecialChars as
|
|
8
|
-
import { useHttp as
|
|
9
|
-
import { useToaster as
|
|
10
|
-
import { useTranslations as
|
|
11
|
-
const
|
|
12
|
-
var d;
|
|
13
|
-
const { showToaster: c } =
|
|
14
|
-
const t = await
|
|
5
|
+
import { itemsBlockDynamicVariables as $ } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
6
|
+
import { useRecommendationStore as j } from "../stores/recommendation.js";
|
|
7
|
+
import { base64EncodeWithSpecialChars as q } from "../utils/base64.js";
|
|
8
|
+
import { useHttp as M } from "./useHttp.js";
|
|
9
|
+
import { useToaster as X } from "./useToaster.js";
|
|
10
|
+
import { useTranslations as z } from "./useTranslations.js";
|
|
11
|
+
const oe = () => {
|
|
12
|
+
var d, f;
|
|
13
|
+
const { showToaster: c } = X(), { post: h } = M(), { config: v } = D(), a = z(), m = j(), u = ((f = (d = v.value) == null ? void 0 : d.partner) == null ? void 0 : f.messageType) === H.transactional, C = async (e) => {
|
|
14
|
+
const t = await h(
|
|
15
15
|
"/newsletter/template-library/check-template-html-body",
|
|
16
|
-
{ html:
|
|
16
|
+
{ html: q(e) }
|
|
17
17
|
), { status: n, message: r } = t.data;
|
|
18
18
|
return n || c({
|
|
19
19
|
type: l.Alert,
|
|
20
20
|
message: n === void 0 ? r : a("newsletter.invalid-url-link-for-toaster")
|
|
21
|
-
}), a(
|
|
21
|
+
}), a(_), r === a(G) && c({
|
|
22
22
|
type: l.Alert,
|
|
23
23
|
message: a("newsletter.already-in-progress")
|
|
24
24
|
}), n;
|
|
25
|
-
},
|
|
25
|
+
}, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), b = (e, s) => {
|
|
26
26
|
const t = e.match(/({%(.*?)%})/g);
|
|
27
27
|
let n = !0;
|
|
28
28
|
return t !== null && !u && t.forEach((r) => {
|
|
29
29
|
const i = r.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
30
30
|
if (i && i.length > 0) {
|
|
31
31
|
const [o] = i;
|
|
32
|
-
|
|
32
|
+
w(o) && !s.includes(o) && (c({
|
|
33
33
|
type: l.Warning,
|
|
34
34
|
message: a("custom-fields.invalid-custom-fields")
|
|
35
35
|
}), n = !1);
|
|
36
36
|
}
|
|
37
37
|
}), n;
|
|
38
|
-
},
|
|
39
|
-
const n = t ? await
|
|
40
|
-
return
|
|
41
|
-
},
|
|
38
|
+
}, E = async (e, s, t) => {
|
|
39
|
+
const n = t ? await C(e) : !0;
|
|
40
|
+
return b(e, s) && n;
|
|
41
|
+
}, A = (e) => e.length > 0 ? !0 : (c({
|
|
42
42
|
type: l.Warning,
|
|
43
43
|
message: a("newsletter.html-content-is-empty")
|
|
44
|
-
}), !1),
|
|
44
|
+
}), !1), x = (e) => {
|
|
45
45
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
46
46
|
return s > t && c({
|
|
47
47
|
type: l.Warning,
|
|
@@ -50,13 +50,13 @@ const ie = () => {
|
|
|
50
50
|
type: l.Warning,
|
|
51
51
|
message: a("custom-fields.missing-opening-braces")
|
|
52
52
|
}), s === t;
|
|
53
|
-
},
|
|
53
|
+
}, k = (e) => {
|
|
54
54
|
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
55
55
|
return s || c({
|
|
56
56
|
type: l.Warning,
|
|
57
57
|
message: a("custom-fields.invalid-custom-fields")
|
|
58
58
|
}), s;
|
|
59
|
-
},
|
|
59
|
+
}, T = (e, s) => {
|
|
60
60
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
61
61
|
if (t && !u) {
|
|
62
62
|
const n = new Set(s.map((i) => i.toLowerCase())), r = [];
|
|
@@ -76,22 +76,22 @@ const ie = () => {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return !0;
|
|
79
|
-
},
|
|
79
|
+
}, F = (e) => {
|
|
80
80
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
81
81
|
let n = !0;
|
|
82
82
|
if (s && s.forEach((r) => {
|
|
83
|
-
const i = r.match(
|
|
84
|
-
(!i || r !==
|
|
83
|
+
const i = r.match(P), o = r.match(R), V = (i == null ? void 0 : i.join("")) || "";
|
|
84
|
+
(!i || r !== V) && !o && (c({
|
|
85
85
|
type: l.Alert,
|
|
86
86
|
message: a("newsletter.display-conditions-invalid-syntax")
|
|
87
|
-
}), n = !1), i && i.forEach((
|
|
88
|
-
|
|
87
|
+
}), n = !1), i && i.forEach((g) => {
|
|
88
|
+
g.trim() === "=" && (c({
|
|
89
89
|
type: l.Alert,
|
|
90
90
|
message: a("custom-conditions.wrong-equality-operators")
|
|
91
91
|
}), n = !1);
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const p = g.match(/^[a-zA-Z]*$/g);
|
|
93
|
+
p && p.forEach((y) => {
|
|
94
|
+
S(y) && t.push(y);
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
}), t.length) {
|
|
@@ -102,25 +102,25 @@ const ie = () => {
|
|
|
102
102
|
}), n = !1);
|
|
103
103
|
}
|
|
104
104
|
return n;
|
|
105
|
-
},
|
|
105
|
+
}, I = (e) => {
|
|
106
106
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
107
107
|
return n || c({
|
|
108
108
|
type: l.Warning,
|
|
109
109
|
message: a("custom-conditions.no-space-after-braces")
|
|
110
110
|
}), n;
|
|
111
|
-
},
|
|
111
|
+
}, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
|
|
112
112
|
type: l.Warning,
|
|
113
113
|
message: a("custom-conditions.no-braces-inside-if-tag")
|
|
114
|
-
}), !1) : !0,
|
|
114
|
+
}), !1) : !0, L = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
|
|
115
115
|
type: l.Alert,
|
|
116
116
|
message: a("newsletter.fill-all-necessary-fields")
|
|
117
|
-
}), !1) : !0,
|
|
117
|
+
}), !1) : !0, N = (e) => {
|
|
118
118
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
119
119
|
return e.match(s) === null ? !0 : (c({
|
|
120
120
|
type: l.Alert,
|
|
121
121
|
message: a("newsletter.invalid-image-type")
|
|
122
122
|
}), !1);
|
|
123
|
-
},
|
|
123
|
+
}, O = (e) => {
|
|
124
124
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
125
125
|
return Array.from(n).find((i) => {
|
|
126
126
|
var o;
|
|
@@ -129,7 +129,7 @@ const ie = () => {
|
|
|
129
129
|
type: l.Alert,
|
|
130
130
|
message: a("unsubscribe-templates.select-checkbox-groups")
|
|
131
131
|
}), !1) : !0;
|
|
132
|
-
},
|
|
132
|
+
}, B = (e) => {
|
|
133
133
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
134
134
|
return Array.from(n).find((i) => {
|
|
135
135
|
var o;
|
|
@@ -140,10 +140,10 @@ const ie = () => {
|
|
|
140
140
|
}), !1) : !0;
|
|
141
141
|
};
|
|
142
142
|
return { validateHtml: async (e, s, t = !1) => {
|
|
143
|
-
const n = [...s.map((i) => i.value),
|
|
144
|
-
return await
|
|
143
|
+
const n = [...s.map((i) => i.value), ...$];
|
|
144
|
+
return await E(e, n, t) && A(e) && x(e) && k(e) && T(e, n) && F(e) && I(e) && W(e) && L() && N(e) && O(e) && B(e);
|
|
145
145
|
} };
|
|
146
146
|
};
|
|
147
147
|
export {
|
|
148
|
-
|
|
148
|
+
oe as useHtmlValidator
|
|
149
149
|
};
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useConfigStore as i } from "../stores/config.js";
|
|
2
|
+
import { ProductType as t } from "../@types/config/schemas.js";
|
|
3
|
+
import { isTestPartner as o } from "../@types/config/defaults.js";
|
|
4
|
+
const T = () => {
|
|
5
|
+
const e = i(), n = () => e.initialized && e.partnerName ? e.partnerName : window.location.hostname.split(".")[0] || "";
|
|
4
6
|
return {
|
|
5
|
-
getPartnerName:
|
|
7
|
+
getPartnerName: n,
|
|
6
8
|
getProductType: () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
if (e.initialized)
|
|
10
|
+
return e.productType;
|
|
11
|
+
const r = window.location.pathname.split("/").filter(Boolean)[0] || "email";
|
|
12
|
+
return {
|
|
13
|
+
email: t.EMAIL,
|
|
14
|
+
architect: t.ARCHITECT,
|
|
15
|
+
unsubscribePages: t.UNSUBSCRIBE_PAGES
|
|
16
|
+
}[r] || t.EMAIL;
|
|
9
17
|
},
|
|
18
|
+
getMessageType: () => e.initialized ? e.messageType : 1,
|
|
19
|
+
getUsername: () => e.initialized ? e.username : "Guido User",
|
|
10
20
|
isTestPartner: () => {
|
|
11
|
-
const
|
|
12
|
-
return r
|
|
21
|
+
const r = n();
|
|
22
|
+
return o(r);
|
|
13
23
|
}
|
|
14
24
|
};
|
|
15
25
|
};
|
|
16
26
|
export {
|
|
17
|
-
|
|
27
|
+
T as usePartner
|
|
18
28
|
};
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
1
|
+
import { useActionsApi as _ } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as k } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as B } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
5
|
+
import { useStripoEventHandler as A } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as v } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as F } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
9
|
+
import I from "../static/styles/customEditorStyle.css.js";
|
|
10
10
|
import { useEditorStore as M } from "../stores/editor.js";
|
|
11
11
|
import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const t = M(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: d } = await C();
|
|
12
|
+
const $ = (a) => {
|
|
13
|
+
const { features: d } = B(), { handleError: c } = v(), { getToken: g, getCustomFonts: f } = D(), { handleEvent: y } = A(), { getStripoBlocksConfig: C } = k(), S = async (i, n = []) => {
|
|
14
|
+
var p, m;
|
|
15
|
+
const o = M(), { html: s, css: t, forceRecreate: h } = i, { baseBlocks: l, extensions: w } = await C(), u = ((p = d.value) == null ? void 0 : p.displayConditions) ?? !0, b = ((m = d.value) == null ? void 0 : m.modulesDisabled) ?? !1;
|
|
17
16
|
window.UIEditor.initEditor(
|
|
18
17
|
document.querySelector("#guido-editor"),
|
|
19
18
|
{
|
|
20
|
-
metadata:
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
19
|
+
metadata: a,
|
|
20
|
+
html: s,
|
|
21
|
+
css: t,
|
|
22
|
+
forceRecreate: h,
|
|
24
23
|
locale: "en",
|
|
25
24
|
undoButtonSelector: "#guido__undo-button",
|
|
26
25
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,87 +29,87 @@ const J = (c) => {
|
|
|
30
29
|
customAppearanceMergetags: !0,
|
|
31
30
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
31
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
32
|
+
customViewStyles: I,
|
|
33
|
+
conditionsEnabled: u,
|
|
34
|
+
customConditionsEnabled: u,
|
|
35
|
+
conditionCategories: F,
|
|
37
36
|
enableXSSSecurity: !0,
|
|
37
|
+
modulesDisabled: b,
|
|
38
38
|
messageSettingsEnabled: !0,
|
|
39
39
|
displayGmailAnnotations: !0,
|
|
40
40
|
displayHiddenPreheader: !1,
|
|
41
41
|
displayTitle: !1,
|
|
42
42
|
displayUTM: !1,
|
|
43
43
|
selectElementAfterDrop: !0,
|
|
44
|
-
...
|
|
44
|
+
...l ? { baseBlocks: l } : {},
|
|
45
45
|
editorFonts: {
|
|
46
46
|
showDefaultStandardFonts: !0,
|
|
47
47
|
showDefaultNotStandardFonts: !0,
|
|
48
|
-
customFonts:
|
|
48
|
+
customFonts: n
|
|
49
49
|
},
|
|
50
50
|
mergeTags: [
|
|
51
51
|
{
|
|
52
|
-
entries: U(
|
|
52
|
+
entries: U(a.preselectedDynamicContentList)
|
|
53
53
|
}
|
|
54
54
|
],
|
|
55
|
-
async onTokenRefreshRequest(
|
|
55
|
+
async onTokenRefreshRequest(e) {
|
|
56
56
|
try {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
57
|
+
const r = await g();
|
|
58
|
+
e(r);
|
|
59
|
+
} catch (r) {
|
|
60
|
+
c(r, "Failed to refresh token");
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
onTemplateLoaded() {
|
|
64
64
|
try {
|
|
65
|
-
const { importCss:
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
const { importCss: e } = V(), { activateCustomViewStyles: r, updateTimerInClonedTemplate: T } = _();
|
|
66
|
+
e(), r(), T(), a.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
67
|
+
o.hasChanges = !1;
|
|
68
68
|
}, 1e3);
|
|
69
|
-
} catch (
|
|
70
|
-
|
|
69
|
+
} catch (e) {
|
|
70
|
+
c(e, "Failed to load custom interface appearance");
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
onCodeEditorVisibilityChanged(
|
|
74
|
-
|
|
73
|
+
onCodeEditorVisibilityChanged(e) {
|
|
74
|
+
o.isCodeEditorOpen = e;
|
|
75
75
|
},
|
|
76
|
-
onEditorVisualModeChanged(
|
|
77
|
-
|
|
76
|
+
onEditorVisualModeChanged(e) {
|
|
77
|
+
o.editorVisualMode = e.toLowerCase();
|
|
78
78
|
},
|
|
79
|
-
onVersionHistoryVisibilityChanged(
|
|
80
|
-
|
|
79
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
80
|
+
o.isVersionHistoryOpen = e;
|
|
81
81
|
},
|
|
82
82
|
onDataChanged() {
|
|
83
|
-
|
|
83
|
+
o.hasChanges = !0;
|
|
84
84
|
},
|
|
85
|
-
onEvent:
|
|
85
|
+
onEvent: y,
|
|
86
86
|
ignoreClickOutsideSelectors: [
|
|
87
87
|
"#guido-dynamic-content-modal",
|
|
88
88
|
".in-on-board-wrapper",
|
|
89
89
|
".in-drawer__container"
|
|
90
90
|
],
|
|
91
|
-
extensions:
|
|
91
|
+
extensions: w
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
},
|
|
95
|
-
var d;
|
|
94
|
+
}, E = (i) => new Promise((n, o) => {
|
|
96
95
|
if (document.getElementById("UiEditorScript")) {
|
|
97
|
-
i(),
|
|
96
|
+
i(), n();
|
|
98
97
|
return;
|
|
99
98
|
}
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
i(),
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
}, document.body.appendChild(
|
|
99
|
+
const s = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t = document.createElement("script");
|
|
100
|
+
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
101
|
+
i(), n();
|
|
102
|
+
}, t.onerror = () => {
|
|
103
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
104
|
+
}, document.body.appendChild(t);
|
|
106
105
|
});
|
|
107
106
|
return { initPlugin: async (i) => {
|
|
108
|
-
await
|
|
109
|
-
const
|
|
110
|
-
await
|
|
107
|
+
await E(async () => {
|
|
108
|
+
const n = await f();
|
|
109
|
+
await S(i, n);
|
|
111
110
|
});
|
|
112
111
|
} };
|
|
113
112
|
};
|
|
114
113
|
export {
|
|
115
|
-
|
|
114
|
+
$ as useStripo
|
|
116
115
|
};
|
|
@@ -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
|
+
};
|
|
@@ -2,10 +2,11 @@ import memoize from "../node_modules/lodash-es/memoize.js";
|
|
|
2
2
|
import { ref } from "vue";
|
|
3
3
|
import { useConfig } from "./useConfig.js";
|
|
4
4
|
const useTranslations = () => {
|
|
5
|
-
|
|
5
|
+
var o, e;
|
|
6
|
+
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
|
|
6
7
|
const r = translations.value[n];
|
|
7
8
|
return r ? t ? Object.entries(t).reduce(
|
|
8
|
-
(
|
|
9
|
+
(s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
|
|
9
10
|
r
|
|
10
11
|
) : r : (console.warn(`Translation key not found: ${n}`), n);
|
|
11
12
|
};
|
|
@@ -10,7 +10,7 @@ const D = [
|
|
|
10
10
|
description: "Adding unsubscribe link values",
|
|
11
11
|
type: "custom",
|
|
12
12
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.
|
|
13
|
+
const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.variationId;
|
|
14
14
|
if (!a)
|
|
15
15
|
return t;
|
|
16
16
|
let e = t;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
1
|
+
import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { migrateItemsBlock as i } from "./itemsBlockMigrator.js";
|
|
4
|
+
import { migrateRadioButton as e } from "./radioButtonMigrator.js";
|
|
5
|
+
import { migrateRecommendation as a } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateUnsubscribe as g } from "./unsubscribeMigrator.js";
|
|
7
|
+
const u = async (r) => {
|
|
8
|
+
let m = r;
|
|
9
|
+
return m = t(m), m = e(m), m = await g(m), m = o(m), m = a(m), m = i(m), m;
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
u as migrate
|
|
12
13
|
};
|