@useinsider/guido 1.0.2-beta.ad1dcd9 → 1.0.2-beta.b11c72f
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/@types/generic.d.ts +0 -8
- package/dist/_virtual/AddCustomFont.js +4 -0
- package/dist/_virtual/AiAssistantValueType.js +4 -0
- package/dist/_virtual/BackgroundColorBuiltInControl.js +4 -0
- package/dist/_virtual/BackgroundImageBuiltInControl.js +4 -0
- package/dist/_virtual/Block.js +4 -0
- package/dist/_virtual/BlockAttributes.js +4 -0
- package/dist/_virtual/BlockCompositionType.js +4 -0
- package/dist/_virtual/BlockPaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/BlockRenderer.js +4 -0
- package/dist/_virtual/BlockType.js +4 -0
- package/dist/_virtual/BlocksPanel.js +4 -0
- package/dist/_virtual/BuiltInControl.js +4 -0
- package/dist/_virtual/BuiltInControlTypes.js +4 -0
- package/dist/_virtual/ButtonBorderBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonFontColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonTextBuiltInControl.js +4 -0
- package/dist/_virtual/ContextAction.js +4 -0
- package/dist/_virtual/ContextActionType.js +4 -0
- package/dist/_virtual/Control.js +4 -0
- package/dist/_virtual/EditorStatePropertyType.js +4 -0
- package/dist/_virtual/Extension.js +4 -0
- package/dist/_virtual/ExtensionBuilder.js +4 -0
- package/dist/_virtual/FontFamilyBuiltInControl.js +4 -0
- package/dist/_virtual/LinkColorBuiltInControl.js +4 -0
- package/dist/_virtual/ModificationDescription.js +4 -0
- package/dist/_virtual/PanelPosition.js +4 -0
- package/dist/_virtual/PreviewDeviceMode.js +4 -0
- package/dist/_virtual/SettingsPanelRegistry.js +4 -0
- package/dist/_virtual/SettingsPanelTab.js +4 -0
- package/dist/_virtual/SettingsTab.js +4 -0
- package/dist/_virtual/StructureBorderBuiltInControl.js +4 -0
- package/dist/_virtual/StructurePaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/TextColorBuiltInControl.js +4 -0
- package/dist/_virtual/TextLineSpacingBuiltInControl.js +4 -0
- package/dist/_virtual/TextSizeBuiltInControl.js +4 -0
- package/dist/_virtual/TextStyleBuiltInControl.js +4 -0
- package/dist/_virtual/UIElement.js +4 -0
- package/dist/_virtual/UIElementTagRegistry.js +4 -0
- package/dist/_virtual/UIElementType.js +4 -0
- package/dist/_virtual/UIElementsAttributes.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/components/Guido.vue.d.ts +2 -2
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +63 -68
- package/dist/components/wrappers/WpDrawer.vue.d.ts +4 -6
- package/dist/components/wrappers/WpDrawer.vue.js +4 -6
- package/dist/composables/useHtmlValidator.d.ts +1 -2
- package/dist/composables/useHtmlValidator.js +95 -114
- package/dist/composables/useSave.js +6 -6
- package/dist/composables/useStripo.js +29 -35
- package/dist/config/compiler/unsubscribeCompilerRules.js +19 -19
- package/dist/enums/defaults.js +3 -6
- package/dist/enums/unsubscribe.d.ts +0 -19
- package/dist/enums/unsubscribe.js +6 -39
- package/dist/extensions/DynamicContent/dynamic-content.js +27 -41
- package/dist/extensions/DynamicContent/extension.js +6 -18
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +48 -72
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +49 -74
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +38 -120
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +8 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +34 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +101 -116
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +11 -5
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +43 -23
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +17 -21
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +15 -8
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +29 -30
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +266 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +23 -19
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +19 -37
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +15 -2
- package/dist/stores/unsubscribe.d.ts +5 -183
- package/dist/stores/unsubscribe.js +6 -125
- package/package.json +2 -2
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +0 -2
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +0 -18
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +0 -16
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +0 -2
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +0 -24
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +0 -64
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +0 -2
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +0 -18
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +0 -108
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +0 -2
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +0 -18
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +0 -12
- package/dist/config/migrator/checkboxMigrator.d.ts +0 -1
- package/dist/config/migrator/checkboxMigrator.js +0 -83
- package/dist/config/migrator/index.d.ts +0 -1
- package/dist/config/migrator/index.js +0 -9
- package/dist/config/migrator/unsubscribeMigrator.d.ts +0 -1
- package/dist/config/migrator/unsubscribeMigrator.js +0 -112
- package/dist/extensions/Blocks/Checkbox/block.d.ts +0 -10
- package/dist/extensions/Blocks/Checkbox/block.js +0 -39
- package/dist/extensions/Blocks/Checkbox/control.d.ts +0 -22
- package/dist/extensions/Blocks/Checkbox/control.js +0 -104
- package/dist/extensions/Blocks/Checkbox/extension.d.ts +0 -2
- package/dist/extensions/Blocks/Checkbox/extension.js +0 -20
- package/dist/extensions/Blocks/Checkbox/settingsPanel.d.ts +0 -4
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +0 -38
- package/dist/extensions/Blocks/Checkbox/template.d.ts +0 -6
- package/dist/extensions/Blocks/Checkbox/template.js +0 -75
- package/dist/extensions/Blocks/Unsubscribe/block.d.ts +0 -30
- package/dist/extensions/Blocks/Unsubscribe/block.js +0 -141
- package/dist/extensions/Blocks/Unsubscribe/control.d.ts +0 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +0 -180
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +0 -11
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +0 -54
- package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +0 -2
- package/dist/extensions/Blocks/Unsubscribe/extension.js +0 -21
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +0 -4
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +0 -32
- package/dist/extensions/Blocks/Unsubscribe/template.d.ts +0 -3
- package/dist/extensions/Blocks/Unsubscribe/template.js +0 -28
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +0 -9
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +0 -11
- package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +0 -7
- package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +0 -6
- package/dist/extensions/Blocks/_Boilerplate/block.d.ts +0 -10
- package/dist/extensions/Blocks/_Boilerplate/control.d.ts +0 -17
- package/dist/extensions/Blocks/_Boilerplate/extension.d.ts +0 -2
- package/dist/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +0 -4
- package/dist/extensions/Blocks/_Boilerplate/template.d.ts +0 -6
- package/dist/mock/api/unsubscribe.d.ts +0 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +0 -12
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +0 -12
- package/dist/services/unsubscribeApi.d.ts +0 -4
- package/dist/services/unsubscribeApi.js +0 -16
|
@@ -1,139 +1,120 @@
|
|
|
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 V } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as O, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as B, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as R } from "../enums/html-validator.js";
|
|
4
|
+
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
+
import { useRecommendationStore as D } from "../stores/recommendation.js";
|
|
6
|
+
import { base64EncodeWithSpecialChars as P } from "../utils/base64.js";
|
|
7
|
+
import { useHttp as X } from "./useHttp.js";
|
|
8
|
+
import { useToaster as j } from "./useToaster.js";
|
|
9
|
+
import { useTranslations as z } from "./useTranslations.js";
|
|
10
|
+
const tt = () => {
|
|
11
11
|
var d;
|
|
12
|
-
const { showToaster:
|
|
13
|
-
const
|
|
12
|
+
const { showToaster: a } = j(), { post: y } = X(), { config: C } = V(), i = z(), m = D(), f = ((d = C.partner) == null ? void 0 : d.messageType) === H.transactional, h = async (t) => {
|
|
13
|
+
const e = 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: P(t) }
|
|
16
|
+
), { status: n, message: c } = e.data;
|
|
17
|
+
return n || a({
|
|
18
|
+
type: r.Alert,
|
|
19
|
+
message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
|
|
20
|
+
}), i(_), c === i(R) && a({
|
|
21
|
+
type: r.Alert,
|
|
22
|
+
message: i("newsletter.already-in-progress")
|
|
23
23
|
}), n;
|
|
24
|
-
}, v = (
|
|
25
|
-
const
|
|
24
|
+
}, v = (t) => !["if", "endif", "else", "elif", "now"].includes(t.toLowerCase()), w = (t) => ["if", "endif"].includes(t.toLowerCase()), S = (t, s) => {
|
|
25
|
+
const e = t.match(/({%(.*?)%})/g);
|
|
26
26
|
let n = !0;
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const [
|
|
31
|
-
v(
|
|
32
|
-
type:
|
|
33
|
-
message:
|
|
27
|
+
return e !== null && !f && e.forEach((c) => {
|
|
28
|
+
const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
29
|
+
if (o && o.length > 0) {
|
|
30
|
+
const [l] = o;
|
|
31
|
+
v(l) && !s.includes(l) && (a({
|
|
32
|
+
type: r.Warning,
|
|
33
|
+
message: i("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
|
+
}, E = async (t, s, e) => {
|
|
38
|
+
const n = e ? await h(t) : !0;
|
|
39
|
+
return S(t, s) && n;
|
|
40
|
+
}, T = (t) => t.length > 0 ? !0 : (a({
|
|
41
|
+
type: r.Warning,
|
|
42
|
+
message: i("newsletter.html-content-is-empty")
|
|
43
|
+
}), !1), I = (t) => {
|
|
44
|
+
const s = (t.match(/{/gm) || []).length, e = (t.match(/}/gm) || []).length;
|
|
45
|
+
return s > e && a({
|
|
46
|
+
type: r.Warning,
|
|
47
|
+
message: i("custom-fields.missing-closing-braces")
|
|
48
|
+
}), s < e && a({
|
|
49
|
+
type: r.Warning,
|
|
50
|
+
message: i("custom-fields.missing-opening-braces")
|
|
51
|
+
}), s === e;
|
|
52
|
+
}, A = (t) => {
|
|
53
|
+
const s = t.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
54
|
+
return s || a({
|
|
55
|
+
type: r.Warning,
|
|
56
|
+
message: i("custom-fields.invalid-custom-fields")
|
|
57
57
|
}), s;
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const n =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</ul>
|
|
70
|
-
`;
|
|
71
|
-
return c({
|
|
72
|
-
type: l.Alert,
|
|
73
|
-
message: o("custom-fields.invalid-custom-fields") + i
|
|
74
|
-
}), !1;
|
|
75
|
-
}
|
|
58
|
+
}, W = (t, s) => {
|
|
59
|
+
const e = t.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
60
|
+
if (e && !f) {
|
|
61
|
+
const n = s.map((o) => o.toLowerCase()), c = e.some((o) => {
|
|
62
|
+
const l = o.replace("{{", "").replace("}}", "").trim().toLowerCase();
|
|
63
|
+
return !n.includes(l) || l === "";
|
|
64
|
+
});
|
|
65
|
+
return c && a({
|
|
66
|
+
type: r.Warning,
|
|
67
|
+
message: i("custom-fields.invalid-custom-fields")
|
|
68
|
+
}), !c;
|
|
76
69
|
}
|
|
77
70
|
return !0;
|
|
78
|
-
},
|
|
79
|
-
const s =
|
|
71
|
+
}, x = (t) => {
|
|
72
|
+
const s = t.match(/{%(.*?)%}/g), e = [];
|
|
80
73
|
let n = !0;
|
|
81
|
-
if (s && s.forEach((
|
|
82
|
-
const
|
|
83
|
-
(!
|
|
84
|
-
type:
|
|
85
|
-
message:
|
|
86
|
-
}), n = !1),
|
|
87
|
-
|
|
88
|
-
type:
|
|
89
|
-
message:
|
|
74
|
+
if (s && s.forEach((c) => {
|
|
75
|
+
const o = c.match(O), l = c.match(B), L = (o == null ? void 0 : o.join("")) || "";
|
|
76
|
+
(!o || c !== L) && !l && (a({
|
|
77
|
+
type: r.Alert,
|
|
78
|
+
message: i("newsletter.display-conditions-invalid-syntax")
|
|
79
|
+
}), n = !1), o && o.forEach((u) => {
|
|
80
|
+
u.trim() === "=" && (a({
|
|
81
|
+
type: r.Alert,
|
|
82
|
+
message: i("custom-conditions.wrong-equality-operators")
|
|
90
83
|
}), n = !1);
|
|
91
|
-
const g =
|
|
84
|
+
const g = u.match(/^[a-zA-Z]*$/g);
|
|
92
85
|
g && g.forEach((p) => {
|
|
93
|
-
w(p) &&
|
|
86
|
+
w(p) && e.push(p);
|
|
94
87
|
});
|
|
95
88
|
});
|
|
96
|
-
}),
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
type:
|
|
100
|
-
message:
|
|
89
|
+
}), e.length) {
|
|
90
|
+
const c = e.filter((l) => l === "if"), o = e.filter((l) => l === "endif");
|
|
91
|
+
c.length !== o.length && (a({
|
|
92
|
+
type: r.Alert,
|
|
93
|
+
message: i("custom-conditions.missing-if-endif-tag")
|
|
101
94
|
}), n = !1);
|
|
102
95
|
}
|
|
103
96
|
return n;
|
|
104
|
-
},
|
|
105
|
-
const s = (
|
|
106
|
-
return n ||
|
|
107
|
-
type:
|
|
108
|
-
message:
|
|
97
|
+
}, b = (t) => {
|
|
98
|
+
const s = (t.match(/{% /gm) || []).length, e = (t.match(/ %}/gm) || []).length, n = s === e;
|
|
99
|
+
return n || a({
|
|
100
|
+
type: r.Warning,
|
|
101
|
+
message: i("custom-conditions.no-space-after-braces")
|
|
109
102
|
}), n;
|
|
110
|
-
},
|
|
111
|
-
type:
|
|
112
|
-
message:
|
|
113
|
-
}), !1) : !0,
|
|
114
|
-
type:
|
|
115
|
-
message:
|
|
116
|
-
}), !1) : !0,
|
|
103
|
+
}, N = (t) => (t.match(/({%(.*?)%})/g) || []).filter((e) => e.includes("if")).map((e) => (e.match(/{{.*}}/gm) || []).length).reduce((e, n) => e + n, 0) > 0 ? (a({
|
|
104
|
+
type: r.Warning,
|
|
105
|
+
message: i("custom-conditions.no-braces-inside-if-tag")
|
|
106
|
+
}), !1) : !0, k = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((e) => e.value === "")) !== void 0 ? (a({
|
|
107
|
+
type: r.Alert,
|
|
108
|
+
message: i("newsletter.fill-all-necessary-fields")
|
|
109
|
+
}), !1) : !0, F = (t) => {
|
|
117
110
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
118
|
-
return
|
|
119
|
-
type:
|
|
120
|
-
message:
|
|
111
|
+
return t.match(s) === null ? !0 : (a({
|
|
112
|
+
type: r.Alert,
|
|
113
|
+
message: i("newsletter.invalid-image-type")
|
|
121
114
|
}), !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;
|
|
131
115
|
};
|
|
132
|
-
return { validateHtml: async (
|
|
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
|
-
} };
|
|
116
|
+
return { validateHtml: async (t, s, e = !1) => await E(t, s, e) && T(t) && I(t) && A(t) && W(t, s) && x(t) && b(t) && N(t) && k() && F(t) };
|
|
136
117
|
};
|
|
137
118
|
export {
|
|
138
|
-
|
|
119
|
+
tt as useHtmlValidator
|
|
139
120
|
};
|
|
@@ -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 l } from "./useGuidoActions.js";
|
|
2
|
+
import { useTemplatePreparation as m } from "../utils/templatePreparation.js";
|
|
3
|
+
import { useHtmlValidator as n } from "./useHtmlValidator.js";
|
|
4
4
|
const f = () => {
|
|
5
|
-
const e = i(), a =
|
|
5
|
+
const e = i(), a = l(), { validateHtml: s } = n();
|
|
6
6
|
return { save: async (o = !1) => {
|
|
7
7
|
e();
|
|
8
|
-
const { prepareTemplateDetails: r } =
|
|
9
|
-
if (await s(t.compiledHtml,
|
|
8
|
+
const { prepareTemplateDetails: r } = m(), t = await r();
|
|
9
|
+
if (await s(t.compiledHtml, [], !0))
|
|
10
10
|
return o || a(t), t;
|
|
11
11
|
} };
|
|
12
12
|
};
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
2
|
import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
|
|
3
|
-
import { useStripoEventHandler as
|
|
4
|
-
import { useToaster as
|
|
3
|
+
import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
|
|
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 w from "../
|
|
8
|
-
import b from "../
|
|
9
|
-
import { useStripoApi as _ } from "../services/stripoApi.js";
|
|
10
|
-
import k from "../static/styles/customEditorStyle.css.js";
|
|
6
|
+
import h from "../extensions/DynamicContent/extension.js";
|
|
7
|
+
import { useStripoApi as w } from "../services/stripoApi.js";
|
|
8
|
+
import b from "../static/styles/customEditorStyle.css.js";
|
|
11
9
|
import { useEditorStore as V } from "../stores/editor.js";
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
const
|
|
14
|
-
const { handleError: d } =
|
|
15
|
-
const
|
|
10
|
+
import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
|
|
11
|
+
const R = (s) => {
|
|
12
|
+
const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = w(), { handleEvent: l } = C(), p = (r, i = []) => {
|
|
13
|
+
const e = V(), { html: o, css: a, forceRecreate: g } = r;
|
|
16
14
|
window.UIEditor.initEditor(
|
|
17
15
|
document.querySelector("#guido-editor"),
|
|
18
16
|
{
|
|
19
17
|
metadata: s,
|
|
20
|
-
html:
|
|
18
|
+
html: o,
|
|
21
19
|
css: a,
|
|
22
20
|
forceRecreate: g,
|
|
23
21
|
locale: "en",
|
|
@@ -29,7 +27,7 @@ const q = (s) => {
|
|
|
29
27
|
customAppearanceMergetags: !0,
|
|
30
28
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
31
29
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
32
|
-
customViewStyles:
|
|
30
|
+
customViewStyles: b,
|
|
33
31
|
conditionsEnabled: !0,
|
|
34
32
|
customConditionsEnabled: !0,
|
|
35
33
|
conditionCategories: y,
|
|
@@ -43,7 +41,7 @@ const q = (s) => {
|
|
|
43
41
|
},
|
|
44
42
|
mergeTags: [
|
|
45
43
|
{
|
|
46
|
-
entries:
|
|
44
|
+
entries: _(s.preselectedDynamicContentList)
|
|
47
45
|
}
|
|
48
46
|
],
|
|
49
47
|
async onTokenRefreshRequest(t) {
|
|
@@ -57,54 +55,50 @@ const q = (s) => {
|
|
|
57
55
|
onTemplateLoaded() {
|
|
58
56
|
try {
|
|
59
57
|
const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
|
|
60
|
-
t(), n(), s.onReady(),
|
|
61
|
-
|
|
58
|
+
t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
59
|
+
e.hasChanges = !1;
|
|
62
60
|
}, 1e3);
|
|
63
61
|
} catch (t) {
|
|
64
62
|
d(t, "Failed to load custom interface appearance");
|
|
65
63
|
}
|
|
66
64
|
},
|
|
67
65
|
onCodeEditorVisibilityChanged(t) {
|
|
68
|
-
|
|
66
|
+
e.isCodeEditorOpen = t;
|
|
69
67
|
},
|
|
70
68
|
onEditorVisualModeChanged(t) {
|
|
71
|
-
|
|
69
|
+
e.editorVisualMode = t.toLowerCase();
|
|
72
70
|
},
|
|
73
71
|
onVersionHistoryVisibilityChanged(t) {
|
|
74
|
-
|
|
72
|
+
e.isVersionHistoryOpen = t;
|
|
75
73
|
},
|
|
76
74
|
onDataChanged() {
|
|
77
|
-
|
|
75
|
+
e.hasChanges = !0;
|
|
78
76
|
},
|
|
79
77
|
onEvent: l,
|
|
80
|
-
ignoreClickOutsideSelectors: [
|
|
81
|
-
|
|
82
|
-
".in-on-board-wrapper",
|
|
83
|
-
".in-drawer__container"
|
|
84
|
-
],
|
|
85
|
-
extensions: [b, h, w]
|
|
78
|
+
ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
|
|
79
|
+
extensions: [h]
|
|
86
80
|
}
|
|
87
81
|
);
|
|
88
|
-
},
|
|
82
|
+
}, m = (r) => new Promise((i, e) => {
|
|
89
83
|
if (document.getElementById("UiEditorScript")) {
|
|
90
84
|
r(), i();
|
|
91
85
|
return;
|
|
92
86
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
87
|
+
const o = document.createElement("script");
|
|
88
|
+
o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
|
|
95
89
|
r(), i();
|
|
96
|
-
},
|
|
90
|
+
}, o.onerror = () => {
|
|
97
91
|
const a = new Error("Failed to load Stripo UIEditor script");
|
|
98
|
-
|
|
99
|
-
}, document.body.appendChild(
|
|
92
|
+
e(a);
|
|
93
|
+
}, document.body.appendChild(o);
|
|
100
94
|
});
|
|
101
95
|
return { initPlugin: async (r) => {
|
|
102
|
-
await
|
|
96
|
+
await m(async () => {
|
|
103
97
|
const i = await u();
|
|
104
|
-
|
|
98
|
+
p(r, i);
|
|
105
99
|
});
|
|
106
100
|
} };
|
|
107
101
|
};
|
|
108
102
|
export {
|
|
109
|
-
|
|
103
|
+
R as useStripo
|
|
110
104
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { usePartner as m } from "../../composables/usePartner.js";
|
|
2
|
-
import { LINK_REGEXES as
|
|
2
|
+
import { LINK_REGEXES as c, LINK_TYPES as p, URLS as E } from "../../enums/unsubscribe.js";
|
|
3
3
|
import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
|
|
4
4
|
const S = [
|
|
5
5
|
{
|
|
6
6
|
id: "add-unsubscribe-link-values",
|
|
7
7
|
description: "Adding unsubscribe link values",
|
|
8
8
|
type: "custom",
|
|
9
|
-
processor: (
|
|
9
|
+
processor: (n) => {
|
|
10
10
|
var a, u;
|
|
11
|
-
const { getPartnerName:
|
|
12
|
-
let e =
|
|
13
|
-
const
|
|
11
|
+
const { getPartnerName: i } = m(), t = b();
|
|
12
|
+
let e = n;
|
|
13
|
+
const o = `/${i()}/email/0?user={{iid}}`, r = (a = t.selectedUnsubscribePages) == null ? void 0 : a.find((l) => l.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = t.selectedUnsubscribePages) == null ? void 0 : u.find((l) => l.type === p.PREFERENCES_LINK_TYPE);
|
|
14
14
|
return r && (e = e.replace(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
c.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
16
|
+
E.UNSUBSCRIBE_URL + o
|
|
17
17
|
)), s && (e = e.replace(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)), e.replace(
|
|
18
|
+
c.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
19
|
+
E.PREFERENCES_URL + o
|
|
20
|
+
)), e.replace(c.UNSUBSCRIBE_LINK_REGEX, "");
|
|
21
21
|
},
|
|
22
22
|
priority: 60
|
|
23
23
|
},
|
|
@@ -25,7 +25,7 @@ const S = [
|
|
|
25
25
|
id: "remove-data-ogsb-button-styles",
|
|
26
26
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
27
27
|
type: "regex",
|
|
28
|
-
pattern:
|
|
28
|
+
pattern: c.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
29
29
|
replacement: "",
|
|
30
30
|
flags: "g",
|
|
31
31
|
priority: 61
|
|
@@ -34,27 +34,27 @@ const S = [
|
|
|
34
34
|
id: "format-comment-braces",
|
|
35
35
|
description: "Adding spaces around comment braces for proper formatting",
|
|
36
36
|
type: "custom",
|
|
37
|
-
processor: (
|
|
37
|
+
processor: (n) => n.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
38
38
|
priority: 62
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
id: "add-universal-link-flags",
|
|
42
42
|
description: "Adding universal link flags",
|
|
43
43
|
type: "custom",
|
|
44
|
-
processor: (
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
return
|
|
44
|
+
processor: (n) => {
|
|
45
|
+
let i = n;
|
|
46
|
+
const t = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
47
|
+
return t && t.forEach((e) => {
|
|
48
48
|
if (e.includes("insEmail=1"))
|
|
49
49
|
return;
|
|
50
50
|
if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
51
|
-
const
|
|
51
|
+
const o = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
52
52
|
const s = r.slice(6, r.length - 1).trim();
|
|
53
53
|
return r.includes("?") || r.includes("#") ? s.slice(-1) === "&" ? r.replace(s, `${s}insEmail=1`) : r.replace(s, `${s}&insEmail=1`) : r.replace(s, `${s}?insEmail=1`);
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
i = i.replace(e, o);
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), i;
|
|
58
58
|
},
|
|
59
59
|
priority: 63
|
|
60
60
|
}
|
package/dist/enums/defaults.js
CHANGED
|
@@ -4,9 +4,6 @@ const a = {
|
|
|
4
4
|
senderName: "",
|
|
5
5
|
subject: ""
|
|
6
6
|
},
|
|
7
|
-
extensions: {
|
|
8
|
-
unsubscribe: !0
|
|
9
|
-
},
|
|
10
7
|
features: {
|
|
11
8
|
dynamicContent: !0,
|
|
12
9
|
saveAsTemplate: !0,
|
|
@@ -16,7 +13,7 @@ const a = {
|
|
|
16
13
|
}, t = {
|
|
17
14
|
promotional: 1,
|
|
18
15
|
transactional: 2
|
|
19
|
-
}, e = "email", o = "Guido User", n = t.promotional,
|
|
16
|
+
}, e = "email", o = "Guido User", n = t.promotional, i = 2, s = {
|
|
20
17
|
email: 60,
|
|
21
18
|
architect: 49
|
|
22
19
|
}, u = [
|
|
@@ -56,8 +53,8 @@ export {
|
|
|
56
53
|
n as DefaultMessageType,
|
|
57
54
|
e as DefaultProductType,
|
|
58
55
|
o as DefaultUsername,
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
i as EditorType,
|
|
57
|
+
s as ProductIds,
|
|
61
58
|
u as TEST_PARTNER_LIST,
|
|
62
59
|
t as TemplateTypes
|
|
63
60
|
};
|
|
@@ -13,22 +13,3 @@ export declare const URLS: {
|
|
|
13
13
|
PREFERENCES_URL: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const INSIDER_ID = "iid";
|
|
16
|
-
export declare const ACADEMY_LINK = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center";
|
|
17
|
-
export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
|
|
18
|
-
export declare const PAGE_TYPES: {
|
|
19
|
-
GLOBAL_UNSUBSCRIBE: number;
|
|
20
|
-
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: number;
|
|
21
|
-
SUBSCRIPTION_PREFERENCE_CENTER: number;
|
|
22
|
-
SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
|
|
23
|
-
RESUBSCRIBE: number;
|
|
24
|
-
};
|
|
25
|
-
export declare const TYPE_COLLECTIONS: {
|
|
26
|
-
[x: number]: number[];
|
|
27
|
-
};
|
|
28
|
-
export declare const TYPE_TRANSLATIONS: {
|
|
29
|
-
[x: number]: string;
|
|
30
|
-
};
|
|
31
|
-
export declare const MERGE_TAGS: {
|
|
32
|
-
[x: number]: string;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
@@ -1,50 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
const s = e(), n = {
|
|
1
|
+
const E = {
|
|
3
2
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
4
3
|
PREFERENCES_LINK_TYPE: 3
|
|
5
|
-
},
|
|
4
|
+
}, s = {
|
|
6
5
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
7
6
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
8
7
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
9
8
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
10
|
-
},
|
|
9
|
+
}, _ = {
|
|
11
10
|
UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
|
|
12
11
|
PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
|
|
13
|
-
}, _ = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", I = "/email/unsubscribe-pages", E = {
|
|
14
|
-
GLOBAL_UNSUBSCRIBE: 1,
|
|
15
|
-
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
16
|
-
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
17
|
-
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
18
|
-
RESUBSCRIBE: 5
|
|
19
|
-
}, r = {
|
|
20
|
-
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
21
|
-
E.GLOBAL_UNSUBSCRIBE,
|
|
22
|
-
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
23
|
-
E.RESUBSCRIBE
|
|
24
|
-
],
|
|
25
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]: [
|
|
26
|
-
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
27
|
-
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
28
|
-
]
|
|
29
|
-
}, i = {
|
|
30
|
-
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
31
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
32
|
-
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
33
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
34
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
35
|
-
}, B = {
|
|
36
|
-
default: "{{ins-unsubscribe-link}}",
|
|
37
|
-
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
38
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
39
12
|
};
|
|
40
13
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
B as MERGE_TAGS,
|
|
45
|
-
E as PAGE_TYPES,
|
|
46
|
-
r as TYPE_COLLECTIONS,
|
|
47
|
-
i as TYPE_TRANSLATIONS,
|
|
48
|
-
I as UNSUBSCRIBE_PAGES_LINK,
|
|
49
|
-
N as URLS
|
|
14
|
+
s as LINK_REGEXES,
|
|
15
|
+
E as LINK_TYPES,
|
|
16
|
+
_ as URLS
|
|
50
17
|
};
|