@useinsider/guido 1.0.2-beta.3ff43aa → 1.0.2-beta.4c19517
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 +1 -1
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +49 -48
- package/dist/composables/useHtmlValidator.d.ts +2 -1
- package/dist/composables/useHtmlValidator.js +114 -95
- package/dist/composables/useSave.js +6 -6
- package/dist/composables/useStripo.js +25 -24
- package/dist/config/migrator/checkboxMigrator.d.ts +1 -0
- package/dist/config/migrator/checkboxMigrator.js +83 -0
- package/dist/config/migrator/index.d.ts +1 -0
- package/dist/config/migrator/index.js +5 -0
- package/dist/extensions/Blocks/Checkbox/block.d.ts +10 -0
- package/dist/extensions/Blocks/Checkbox/block.js +39 -0
- package/dist/extensions/Blocks/Checkbox/control.d.ts +22 -0
- package/dist/extensions/Blocks/Checkbox/control.js +104 -0
- package/dist/extensions/Blocks/Checkbox/extension.d.ts +2 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +20 -0
- package/dist/extensions/Blocks/Checkbox/settingsPanel.d.ts +4 -0
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +38 -0
- package/dist/extensions/Blocks/Checkbox/template.d.ts +6 -0
- package/dist/extensions/Blocks/Checkbox/template.js +75 -0
- package/dist/extensions/Blocks/_Boilerplate/block.d.ts +10 -0
- package/dist/extensions/Blocks/_Boilerplate/control.d.ts +17 -0
- package/dist/extensions/Blocks/_Boilerplate/extension.d.ts +2 -0
- package/dist/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +4 -0
- package/dist/extensions/Blocks/_Boilerplate/template.d.ts +6 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +41 -27
- package/dist/extensions/DynamicContent/extension.js +18 -6
- package/dist/guido.css +1 -1
- package/dist/mock/api/unsubscribe.d.ts +2 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +72 -48
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +74 -49
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +120 -38
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +12 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +116 -101
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +12 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +5 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +22 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +21 -17
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +8 -15
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +30 -29
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +19 -23
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +37 -19
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +2 -15
- package/dist/utils/genericUtil.d.ts +5 -0
- package/package.json +2 -2
- package/dist/_virtual/AddCustomFont.js +0 -4
- package/dist/_virtual/AiAssistantValueType.js +0 -4
- package/dist/_virtual/BackgroundColorBuiltInControl.js +0 -4
- package/dist/_virtual/BackgroundImageBuiltInControl.js +0 -4
- package/dist/_virtual/Block.js +0 -4
- package/dist/_virtual/BlockAttributes.js +0 -4
- package/dist/_virtual/BlockCompositionType.js +0 -4
- package/dist/_virtual/BlockPaddingsBuiltInControl.js +0 -4
- package/dist/_virtual/BlockRenderer.js +0 -4
- package/dist/_virtual/BlockType.js +0 -4
- package/dist/_virtual/BlocksPanel.js +0 -4
- package/dist/_virtual/BuiltInControl.js +0 -4
- package/dist/_virtual/BuiltInControlTypes.js +0 -4
- package/dist/_virtual/ButtonBorderBuiltInControl.js +0 -4
- package/dist/_virtual/ButtonColorBuiltInControl.js +0 -4
- package/dist/_virtual/ButtonFontColorBuiltInControl.js +0 -4
- package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +0 -4
- package/dist/_virtual/ButtonTextBuiltInControl.js +0 -4
- package/dist/_virtual/ContextAction.js +0 -4
- package/dist/_virtual/ContextActionType.js +0 -4
- package/dist/_virtual/Control.js +0 -4
- package/dist/_virtual/EditorStatePropertyType.js +0 -4
- package/dist/_virtual/Extension.js +0 -4
- package/dist/_virtual/ExtensionBuilder.js +0 -4
- package/dist/_virtual/FontFamilyBuiltInControl.js +0 -4
- package/dist/_virtual/LinkColorBuiltInControl.js +0 -4
- package/dist/_virtual/ModificationDescription.js +0 -4
- package/dist/_virtual/PanelPosition.js +0 -4
- package/dist/_virtual/PreviewDeviceMode.js +0 -4
- package/dist/_virtual/SettingsPanelRegistry.js +0 -4
- package/dist/_virtual/SettingsPanelTab.js +0 -4
- package/dist/_virtual/SettingsTab.js +0 -4
- package/dist/_virtual/StructureBorderBuiltInControl.js +0 -4
- package/dist/_virtual/StructurePaddingsBuiltInControl.js +0 -4
- package/dist/_virtual/TextColorBuiltInControl.js +0 -4
- package/dist/_virtual/TextLineSpacingBuiltInControl.js +0 -4
- package/dist/_virtual/TextSizeBuiltInControl.js +0 -4
- package/dist/_virtual/TextStyleBuiltInControl.js +0 -4
- package/dist/_virtual/UIElement.js +0 -4
- package/dist/_virtual/UIElementTagRegistry.js +0 -4
- package/dist/_virtual/UIElementType.js +0 -4
- package/dist/_virtual/UIElementsAttributes.js +0 -4
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -4
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +0 -18
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +0 -32
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +0 -18
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +0 -8
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +0 -34
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +0 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +0 -46
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +0 -44
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +0 -22
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +0 -46
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +0 -46
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +0 -45
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +0 -45
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +0 -45
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +0 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +0 -45
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +0 -46
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +0 -44
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +0 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +0 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +0 -45
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +0 -43
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +0 -266
package/README.md
CHANGED
|
@@ -643,6 +643,6 @@ ISC License
|
|
|
643
643
|
## 🎯 TODO:
|
|
644
644
|
- CSS part should be optimized with variables & `sass-loader`.
|
|
645
645
|
- Master Version Generator should be fixed.
|
|
646
|
-
- Playwright
|
|
646
|
+
- Playwright integrationBoilerplate/control.ts
|
|
647
647
|
- Commitlint & Precommit Hooks integration
|
|
648
648
|
- Get Pre-built display conditions from API
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import {
|
|
6
|
-
import q from "
|
|
7
|
-
import J from "./organisms/
|
|
8
|
-
import Q from "./organisms/
|
|
9
|
-
import V from "./organisms/
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import ee from "../
|
|
15
|
-
|
|
1
|
+
import { defineComponent as M, defineAsyncComponent as G, ref as R, computed as d, watch as U, onMounted as x, onUnmounted as F } from "vue";
|
|
2
|
+
import { provideGuidoActions as z } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as B } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as K } from "../composables/useStripo.js";
|
|
5
|
+
import { migrate as P } from "../config/migrator/index.js";
|
|
6
|
+
import { DefaultUsername as O, DefaultMessageType as j, DefaultGuidoConfig as q } from "../enums/defaults.js";
|
|
7
|
+
import J from "./organisms/base/Toaster.vue.js";
|
|
8
|
+
import Q from "./organisms/header/HeaderWrapper.vue.js";
|
|
9
|
+
import V from "./organisms/LoadingWrapper.vue.js";
|
|
10
|
+
import X from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
11
|
+
import { useStripoApi as Y } from "../services/stripoApi.js";
|
|
12
|
+
import { useDynamicContentStore as Z } from "../stores/dynamic-content.js";
|
|
13
|
+
import { useEditorStore as $ } from "../stores/editor.js";
|
|
14
|
+
import { usePreviewStore as ee } from "../stores/preview.js";
|
|
15
|
+
import oe from "../node_modules/lodash-es/merge.js";
|
|
16
|
+
const ve = /* @__PURE__ */ M({
|
|
16
17
|
__name: "Guido",
|
|
17
18
|
props: {
|
|
18
19
|
templateId: null,
|
|
@@ -27,45 +28,45 @@ const fe = /* @__PURE__ */ H({
|
|
|
27
28
|
guidoConfig: null
|
|
28
29
|
},
|
|
29
30
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready"],
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
31
|
+
setup(I, { expose: L, emit: o }) {
|
|
32
|
+
const r = I, _ = G(
|
|
32
33
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
33
|
-
),
|
|
34
|
+
), W = G(
|
|
34
35
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
35
|
-
),
|
|
36
|
+
), m = R(), a = Z(), l = $(), k = ee(), t = d(() => l.hasChanges), i = r.preselectedDynamicContentList || [], { getPartnerName: u, getProductType: p, isTestPartner: A } = B(), N = d(() => !1), g = () => {
|
|
36
37
|
var e;
|
|
37
|
-
return (e =
|
|
38
|
+
return (e = m.value) == null ? void 0 : e.handleSave(!0);
|
|
38
39
|
}, {
|
|
39
|
-
templateId:
|
|
40
|
-
userId:
|
|
41
|
-
guidoConfig:
|
|
42
|
-
html:
|
|
40
|
+
templateId: f,
|
|
41
|
+
userId: y,
|
|
42
|
+
guidoConfig: v,
|
|
43
|
+
html: n = "",
|
|
43
44
|
css: C = "",
|
|
44
|
-
partnerName: s =
|
|
45
|
-
productType:
|
|
46
|
-
messageType: h =
|
|
47
|
-
username: w =
|
|
48
|
-
} =
|
|
49
|
-
window.GuidoConfig =
|
|
45
|
+
partnerName: s = u(),
|
|
46
|
+
productType: c = p(),
|
|
47
|
+
messageType: h = j,
|
|
48
|
+
username: w = O
|
|
49
|
+
} = r;
|
|
50
|
+
window.GuidoConfig = oe(q, v), window.GuidoConfig.partner = {
|
|
50
51
|
partnerName: s,
|
|
51
|
-
productType:
|
|
52
|
+
productType: c,
|
|
52
53
|
messageType: h
|
|
53
54
|
};
|
|
54
|
-
const { initPlugin: S } =
|
|
55
|
-
emailId:
|
|
56
|
-
userId:
|
|
55
|
+
const { initPlugin: S } = K({
|
|
56
|
+
emailId: f,
|
|
57
|
+
userId: y,
|
|
57
58
|
username: w,
|
|
58
59
|
partnerName: s,
|
|
59
|
-
productType:
|
|
60
|
-
preselectedDynamicContentList:
|
|
60
|
+
productType: c,
|
|
61
|
+
preselectedDynamicContentList: i,
|
|
61
62
|
onReady: () => {
|
|
62
63
|
console.debug("guido:ready"), o("ready");
|
|
63
64
|
}
|
|
64
|
-
}), { getDefaultTemplate: D } =
|
|
65
|
+
}), { getDefaultTemplate: D } = Y(), H = d(() => {
|
|
65
66
|
var e;
|
|
66
67
|
return !((e = window.GuidoConfig) != null && e.useHeader);
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
z({
|
|
69
70
|
onBack: () => {
|
|
70
71
|
console.debug("guido:back"), o("back");
|
|
71
72
|
},
|
|
@@ -77,22 +78,22 @@ const fe = /* @__PURE__ */ H({
|
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
const b = (e) => {
|
|
80
|
-
console.debug("dynamic-content:close", e),
|
|
81
|
+
console.debug("dynamic-content:close", e), a.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
81
82
|
}, T = () => {
|
|
82
83
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
83
84
|
};
|
|
84
|
-
return
|
|
85
|
+
return U(() => t.value, () => {
|
|
85
86
|
o("on-change", t.value);
|
|
86
|
-
}),
|
|
87
|
+
}), x(async () => {
|
|
87
88
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
88
89
|
try {
|
|
89
90
|
let e = {
|
|
90
|
-
html:
|
|
91
|
+
html: n && P(n),
|
|
91
92
|
css: C,
|
|
92
93
|
forceRecreate: !0
|
|
93
94
|
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
94
95
|
};
|
|
95
|
-
e.html || (e = await D()), await S(e),
|
|
96
|
+
e.html || (e = await D(), e.html = P(e.html)), await S(e), a.selectedDynamicContentList = i;
|
|
96
97
|
} catch (e) {
|
|
97
98
|
console.error("Failed to initialize Stripo editor:", e);
|
|
98
99
|
}
|
|
@@ -100,22 +101,22 @@ const fe = /* @__PURE__ */ H({
|
|
|
100
101
|
const E = e;
|
|
101
102
|
console.debug("dynamic-content:open", E.detail), o("dynamic-content:open", E.detail);
|
|
102
103
|
});
|
|
103
|
-
}),
|
|
104
|
+
}), F(() => {
|
|
104
105
|
try {
|
|
105
106
|
window.UIEditor.removeEditor();
|
|
106
107
|
} catch {
|
|
107
108
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
108
109
|
}
|
|
109
|
-
}),
|
|
110
|
+
}), L({
|
|
110
111
|
dynamicContent: {
|
|
111
112
|
insert: b,
|
|
112
113
|
close: T
|
|
113
114
|
},
|
|
114
115
|
hasChanges: t,
|
|
115
|
-
saveSilent:
|
|
116
|
-
}), { __sfc: !0, PreviewContainer:
|
|
116
|
+
saveSilent: g
|
|
117
|
+
}), { __sfc: !0, PreviewContainer: _, OnboardingWrapper: W, headerWrapperRef: m, dynamicContentStore: a, props: r, editorStore: l, previewStore: k, hasChanges: t, preselectedDynamicContentList: i, getPartnerName: u, getProductType: p, isTestPartner: A, isDevMode: N, saveSilent: g, templateId: f, userId: y, guidoConfig: v, html: n, css: C, partnerName: s, productType: c, messageType: h, username: w, emit: o, initPlugin: S, getDefaultTemplate: D, noHeader: H, insertDynamicContent: b, closeDynamicContent: T, Toaster: J, HeaderWrapper: Q, LoadingWrapper: V, SaveAsTemplateDrawer: X };
|
|
117
118
|
}
|
|
118
119
|
});
|
|
119
120
|
export {
|
|
120
|
-
|
|
121
|
+
ve as default
|
|
121
122
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DynamicContent } from '@@/Types/generic';
|
|
1
2
|
export declare const useHtmlValidator: () => {
|
|
2
|
-
validateHtml: (html: string, customFields:
|
|
3
|
+
validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
|
|
3
4
|
};
|
|
@@ -1,120 +1,139 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { TemplateTypes as
|
|
3
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import { useRecommendationStore as
|
|
6
|
-
import { base64EncodeWithSpecialChars as
|
|
7
|
-
import { useHttp as
|
|
8
|
-
import { useToaster as
|
|
9
|
-
import { useTranslations as
|
|
10
|
-
const
|
|
1
|
+
import { useConfig as H } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as V } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as B, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as _, CampaignCouldNotBeSavedKey as D, CanNotMakeAnyChangesForRunningKey as P } from "../enums/html-validator.js";
|
|
4
|
+
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
5
|
+
import { useRecommendationStore as R } from "../stores/recommendation.js";
|
|
6
|
+
import { base64EncodeWithSpecialChars as $ } from "../utils/base64.js";
|
|
7
|
+
import { useHttp as j } from "./useHttp.js";
|
|
8
|
+
import { useToaster as G } from "./useToaster.js";
|
|
9
|
+
import { useTranslations as X } from "./useTranslations.js";
|
|
10
|
+
const te = () => {
|
|
11
11
|
var d;
|
|
12
|
-
const { showToaster:
|
|
13
|
-
const
|
|
12
|
+
const { showToaster: c } = G(), { post: y } = j(), { config: h } = H(), o = X(), m = R(), u = ((d = h.partner) == null ? void 0 : d.messageType) === V.transactional, C = async (e) => {
|
|
13
|
+
const t = await y(
|
|
14
14
|
"/newsletter/template-library/check-template-html-body",
|
|
15
|
-
{ html:
|
|
16
|
-
), { status: n, message:
|
|
17
|
-
return n ||
|
|
18
|
-
type:
|
|
19
|
-
message: n === void 0 ?
|
|
20
|
-
}),
|
|
21
|
-
type:
|
|
22
|
-
message:
|
|
15
|
+
{ html: $(e) }
|
|
16
|
+
), { status: n, message: a } = t.data;
|
|
17
|
+
return n || c({
|
|
18
|
+
type: l.Alert,
|
|
19
|
+
message: n === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
20
|
+
}), o(D), a === o(P) && c({
|
|
21
|
+
type: l.Alert,
|
|
22
|
+
message: o("newsletter.already-in-progress")
|
|
23
23
|
}), n;
|
|
24
|
-
}, v = (
|
|
25
|
-
const
|
|
24
|
+
}, v = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), w = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, s) => {
|
|
25
|
+
const t = e.match(/({%(.*?)%})/g);
|
|
26
26
|
let n = !0;
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const [
|
|
31
|
-
v(
|
|
32
|
-
type:
|
|
33
|
-
message:
|
|
27
|
+
return t !== null && !u && t.forEach((a) => {
|
|
28
|
+
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
29
|
+
if (i && i.length > 0) {
|
|
30
|
+
const [r] = i;
|
|
31
|
+
v(r) && !s.includes(r) && (c({
|
|
32
|
+
type: l.Warning,
|
|
33
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
34
34
|
}), n = !1);
|
|
35
35
|
}
|
|
36
36
|
}), n;
|
|
37
|
-
},
|
|
38
|
-
const n =
|
|
39
|
-
return S(
|
|
40
|
-
},
|
|
41
|
-
type:
|
|
42
|
-
message:
|
|
43
|
-
}), !1),
|
|
44
|
-
const s = (
|
|
45
|
-
return s >
|
|
46
|
-
type:
|
|
47
|
-
message:
|
|
48
|
-
}), s <
|
|
49
|
-
type:
|
|
50
|
-
message:
|
|
51
|
-
}), s ===
|
|
52
|
-
},
|
|
53
|
-
const s =
|
|
54
|
-
return s ||
|
|
55
|
-
type:
|
|
56
|
-
message:
|
|
37
|
+
}, b = async (e, s, t) => {
|
|
38
|
+
const n = t ? await C(e) : !0;
|
|
39
|
+
return S(e, s) && n;
|
|
40
|
+
}, E = (e) => e.length > 0 ? !0 : (c({
|
|
41
|
+
type: l.Warning,
|
|
42
|
+
message: o("newsletter.html-content-is-empty")
|
|
43
|
+
}), !1), A = (e) => {
|
|
44
|
+
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
45
|
+
return s > t && c({
|
|
46
|
+
type: l.Warning,
|
|
47
|
+
message: o("custom-fields.missing-closing-braces")
|
|
48
|
+
}), s < t && c({
|
|
49
|
+
type: l.Warning,
|
|
50
|
+
message: o("custom-fields.missing-opening-braces")
|
|
51
|
+
}), s === t;
|
|
52
|
+
}, x = (e) => {
|
|
53
|
+
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
54
|
+
return s || c({
|
|
55
|
+
type: l.Warning,
|
|
56
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
57
57
|
}), s;
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const n = s.map((
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
}, T = (e, s) => {
|
|
59
|
+
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
60
|
+
if (t && !u) {
|
|
61
|
+
const n = new Set(s.map((i) => i.toLowerCase())), a = [];
|
|
62
|
+
if (t.forEach((i) => {
|
|
63
|
+
const r = i.slice(2, -2).trim().toLowerCase();
|
|
64
|
+
(!n.has(r) || r === "") && a.push(r);
|
|
65
|
+
}), a.length > 0) {
|
|
66
|
+
const i = `
|
|
67
|
+
<ul>
|
|
68
|
+
${a.map((r) => `<li>${r}</li>`).join("")}
|
|
69
|
+
</ul>
|
|
70
|
+
`;
|
|
71
|
+
return c({
|
|
72
|
+
type: l.Alert,
|
|
73
|
+
message: o("custom-fields.invalid-custom-fields") + i
|
|
74
|
+
}), !1;
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
return !0;
|
|
71
|
-
},
|
|
72
|
-
const s =
|
|
78
|
+
}, k = (e) => {
|
|
79
|
+
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
73
80
|
let n = !0;
|
|
74
|
-
if (s && s.forEach((
|
|
75
|
-
const
|
|
76
|
-
(!
|
|
77
|
-
type:
|
|
78
|
-
message:
|
|
79
|
-
}), n = !1),
|
|
80
|
-
|
|
81
|
-
type:
|
|
82
|
-
message:
|
|
81
|
+
if (s && s.forEach((a) => {
|
|
82
|
+
const i = a.match(B), r = a.match(_), O = (i == null ? void 0 : i.join("")) || "";
|
|
83
|
+
(!i || a !== O) && !r && (c({
|
|
84
|
+
type: l.Alert,
|
|
85
|
+
message: o("newsletter.display-conditions-invalid-syntax")
|
|
86
|
+
}), n = !1), i && i.forEach((f) => {
|
|
87
|
+
f.trim() === "=" && (c({
|
|
88
|
+
type: l.Alert,
|
|
89
|
+
message: o("custom-conditions.wrong-equality-operators")
|
|
83
90
|
}), n = !1);
|
|
84
|
-
const g =
|
|
91
|
+
const g = f.match(/^[a-zA-Z]*$/g);
|
|
85
92
|
g && g.forEach((p) => {
|
|
86
|
-
w(p) &&
|
|
93
|
+
w(p) && t.push(p);
|
|
87
94
|
});
|
|
88
95
|
});
|
|
89
|
-
}),
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
type:
|
|
93
|
-
message:
|
|
96
|
+
}), t.length) {
|
|
97
|
+
const a = t.filter((r) => r === "if"), i = t.filter((r) => r === "endif");
|
|
98
|
+
a.length !== i.length && (c({
|
|
99
|
+
type: l.Alert,
|
|
100
|
+
message: o("custom-conditions.missing-if-endif-tag")
|
|
94
101
|
}), n = !1);
|
|
95
102
|
}
|
|
96
103
|
return n;
|
|
97
|
-
},
|
|
98
|
-
const s = (
|
|
99
|
-
return n ||
|
|
100
|
-
type:
|
|
101
|
-
message:
|
|
104
|
+
}, F = (e) => {
|
|
105
|
+
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
106
|
+
return n || c({
|
|
107
|
+
type: l.Warning,
|
|
108
|
+
message: o("custom-conditions.no-space-after-braces")
|
|
102
109
|
}), n;
|
|
103
|
-
},
|
|
104
|
-
type:
|
|
105
|
-
message:
|
|
106
|
-
}), !1) : !0,
|
|
107
|
-
type:
|
|
108
|
-
message:
|
|
109
|
-
}), !1) : !0,
|
|
110
|
+
}, I = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
|
|
111
|
+
type: l.Warning,
|
|
112
|
+
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
113
|
+
}), !1) : !0, W = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
|
|
114
|
+
type: l.Alert,
|
|
115
|
+
message: o("newsletter.fill-all-necessary-fields")
|
|
116
|
+
}), !1) : !0, L = (e) => {
|
|
110
117
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
111
|
-
return
|
|
112
|
-
type:
|
|
113
|
-
message:
|
|
118
|
+
return e.match(s) === null ? !0 : (c({
|
|
119
|
+
type: l.Alert,
|
|
120
|
+
message: o("newsletter.invalid-image-type")
|
|
114
121
|
}), !1);
|
|
122
|
+
}, N = (e) => {
|
|
123
|
+
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
124
|
+
return Array.from(n).find((i) => {
|
|
125
|
+
var r;
|
|
126
|
+
return !((r = i.id) != null && r.trim());
|
|
127
|
+
}) ? (c({
|
|
128
|
+
type: l.Alert,
|
|
129
|
+
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
130
|
+
}), !1) : !0;
|
|
115
131
|
};
|
|
116
|
-
return { validateHtml: async (
|
|
132
|
+
return { validateHtml: async (e, s, t = !1) => {
|
|
133
|
+
const n = s.map((i) => i.value);
|
|
134
|
+
return await b(e, n, t) && E(e) && A(e) && x(e) && T(e, n) && k(e) && F(e) && I(e) && W() && L(e) && N(e);
|
|
135
|
+
} };
|
|
117
136
|
};
|
|
118
137
|
export {
|
|
119
|
-
|
|
138
|
+
te as useHtmlValidator
|
|
120
139
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useSaveStart as i, useSaveComplete as
|
|
2
|
-
import { useTemplatePreparation as
|
|
3
|
-
import { useHtmlValidator as
|
|
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
4
|
const f = () => {
|
|
5
|
-
const e = i(), a =
|
|
5
|
+
const e = i(), a = m(), { validateHtml: s } = l();
|
|
6
6
|
return { save: async (o = !1) => {
|
|
7
7
|
e();
|
|
8
|
-
const { prepareTemplateDetails: r } =
|
|
9
|
-
if (await s(t.compiledHtml,
|
|
8
|
+
const { prepareTemplateDetails: r } = n(), t = await r();
|
|
9
|
+
if (await s(t.compiledHtml, t.dynamicContentList, !0))
|
|
10
10
|
return o || a(t), t;
|
|
11
11
|
} };
|
|
12
12
|
};
|
|
@@ -3,19 +3,20 @@ import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearanc
|
|
|
3
3
|
import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
|
|
4
4
|
import { useToaster as E } from "./useToaster.js";
|
|
5
5
|
import { displayConditions as y } from "../enums/displayConditions.js";
|
|
6
|
-
import h from "../extensions/
|
|
7
|
-
import
|
|
8
|
-
import b from "../
|
|
6
|
+
import h from "../extensions/Blocks/Checkbox/extension.js";
|
|
7
|
+
import w from "../extensions/DynamicContent/extension.js";
|
|
8
|
+
import { useStripoApi as b } from "../services/stripoApi.js";
|
|
9
|
+
import k from "../static/styles/customEditorStyle.css.js";
|
|
9
10
|
import { useEditorStore as V } from "../stores/editor.js";
|
|
10
11
|
import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
|
|
11
|
-
const
|
|
12
|
-
const { handleError: d } = E(), { getToken: c, getCustomFonts: u } =
|
|
13
|
-
const
|
|
12
|
+
const H = (s) => {
|
|
13
|
+
const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = b(), { handleEvent: l } = C(), m = (r, i = []) => {
|
|
14
|
+
const o = V(), { html: e, css: a, forceRecreate: g } = r;
|
|
14
15
|
window.UIEditor.initEditor(
|
|
15
16
|
document.querySelector("#guido-editor"),
|
|
16
17
|
{
|
|
17
18
|
metadata: s,
|
|
18
|
-
html:
|
|
19
|
+
html: e,
|
|
19
20
|
css: a,
|
|
20
21
|
forceRecreate: g,
|
|
21
22
|
locale: "en",
|
|
@@ -27,7 +28,7 @@ const R = (s) => {
|
|
|
27
28
|
customAppearanceMergetags: !0,
|
|
28
29
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
29
30
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
30
|
-
customViewStyles:
|
|
31
|
+
customViewStyles: k,
|
|
31
32
|
conditionsEnabled: !0,
|
|
32
33
|
customConditionsEnabled: !0,
|
|
33
34
|
conditionCategories: y,
|
|
@@ -55,50 +56,50 @@ const R = (s) => {
|
|
|
55
56
|
onTemplateLoaded() {
|
|
56
57
|
try {
|
|
57
58
|
const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
|
|
58
|
-
t(), n(), s.onReady(),
|
|
59
|
-
|
|
59
|
+
t(), n(), s.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
60
|
+
o.hasChanges = !1;
|
|
60
61
|
}, 1e3);
|
|
61
62
|
} catch (t) {
|
|
62
63
|
d(t, "Failed to load custom interface appearance");
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
onCodeEditorVisibilityChanged(t) {
|
|
66
|
-
|
|
67
|
+
o.isCodeEditorOpen = t;
|
|
67
68
|
},
|
|
68
69
|
onEditorVisualModeChanged(t) {
|
|
69
|
-
|
|
70
|
+
o.editorVisualMode = t.toLowerCase();
|
|
70
71
|
},
|
|
71
72
|
onVersionHistoryVisibilityChanged(t) {
|
|
72
|
-
|
|
73
|
+
o.isVersionHistoryOpen = t;
|
|
73
74
|
},
|
|
74
75
|
onDataChanged() {
|
|
75
|
-
|
|
76
|
+
o.hasChanges = !0;
|
|
76
77
|
},
|
|
77
78
|
onEvent: l,
|
|
78
79
|
ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
|
|
79
|
-
extensions: [h]
|
|
80
|
+
extensions: [w, h]
|
|
80
81
|
}
|
|
81
82
|
);
|
|
82
|
-
},
|
|
83
|
+
}, p = (r) => new Promise((i, o) => {
|
|
83
84
|
if (document.getElementById("UiEditorScript")) {
|
|
84
85
|
r(), i();
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
88
|
+
const e = document.createElement("script");
|
|
89
|
+
e.id = "UiEditorScript", e.type = "module", e.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", e.onload = () => {
|
|
89
90
|
r(), i();
|
|
90
|
-
},
|
|
91
|
+
}, e.onerror = () => {
|
|
91
92
|
const a = new Error("Failed to load Stripo UIEditor script");
|
|
92
|
-
|
|
93
|
-
}, document.body.appendChild(
|
|
93
|
+
o(a);
|
|
94
|
+
}, document.body.appendChild(e);
|
|
94
95
|
});
|
|
95
96
|
return { initPlugin: async (r) => {
|
|
96
|
-
await
|
|
97
|
+
await p(async () => {
|
|
97
98
|
const i = await u();
|
|
98
|
-
|
|
99
|
+
m(r, i);
|
|
99
100
|
});
|
|
100
101
|
} };
|
|
101
102
|
};
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
H as useStripo
|
|
104
105
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrateCheckbox(html: string): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var y = (s, t, e) => t in s ? x(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var m = (s, t, e) => y(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import b from "../../extensions/Blocks/Checkbox/template.js";
|
|
5
|
+
class f {
|
|
6
|
+
constructor() {
|
|
7
|
+
m(this, "parser");
|
|
8
|
+
this.parser = new DOMParser();
|
|
9
|
+
}
|
|
10
|
+
migrate(t) {
|
|
11
|
+
try {
|
|
12
|
+
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
|
|
13
|
+
return i.length === 0 ? t : (i.forEach((r) => {
|
|
14
|
+
const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
|
|
15
|
+
`<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
|
|
16
|
+
"text/html"
|
|
17
|
+
).querySelector(".checkbox-block-v2");
|
|
18
|
+
o && r.parentNode && (o.setAttribute("id", n || ""), r.parentNode.replaceChild(o, r));
|
|
19
|
+
}), e.documentElement.outerHTML);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return console.error("CheckboxMigrator failed:", e), t;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
extractTextFromElement(t, e) {
|
|
25
|
+
var o, u;
|
|
26
|
+
const i = t.querySelector(`.${e}`);
|
|
27
|
+
if (!i)
|
|
28
|
+
return {
|
|
29
|
+
text: e === "ins-title" ? "Title" : "Description",
|
|
30
|
+
isBold: !1,
|
|
31
|
+
isItalic: !1,
|
|
32
|
+
align: "left",
|
|
33
|
+
styles: ""
|
|
34
|
+
};
|
|
35
|
+
const r = i.querySelector("p");
|
|
36
|
+
if (!r)
|
|
37
|
+
return {
|
|
38
|
+
text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
|
|
39
|
+
isBold: !1,
|
|
40
|
+
isItalic: !1,
|
|
41
|
+
align: i.getAttribute("align") || "left",
|
|
42
|
+
styles: ""
|
|
43
|
+
};
|
|
44
|
+
const n = ((u = r.textContent) == null ? void 0 : u.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g);
|
|
45
|
+
return {
|
|
46
|
+
text: n,
|
|
47
|
+
isBold: a,
|
|
48
|
+
isItalic: p,
|
|
49
|
+
align: c,
|
|
50
|
+
styles: d
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
buildTextBlock(t) {
|
|
54
|
+
let e = t.text;
|
|
55
|
+
t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
|
|
56
|
+
const i = t.align ? ` align="${t.align}"` : "", r = t.styles ? ` style="${t.styles}"` : "";
|
|
57
|
+
return `
|
|
58
|
+
<td class="esd-block-text" ${i}>
|
|
59
|
+
<p path="1" ${r}>
|
|
60
|
+
${e}
|
|
61
|
+
</p>
|
|
62
|
+
</td>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
removeStyleProperties(t, e) {
|
|
66
|
+
return t ? e.reduce((r, n) => {
|
|
67
|
+
const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
68
|
+
return r.replace(l, "");
|
|
69
|
+
}, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
70
|
+
}
|
|
71
|
+
convertInlineToBlock(t) {
|
|
72
|
+
if (!t)
|
|
73
|
+
return "";
|
|
74
|
+
let e = t.replace(/display\s*:\s*inline/gi, "display: block");
|
|
75
|
+
return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function k(s) {
|
|
79
|
+
return new f().migrate(s);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
k as migrateCheckbox
|
|
83
|
+
};
|