@useinsider/guido 1.0.2-beta.3996a64 → 1.0.2-beta.3ff43aa
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 +31 -1
- package/dist/@types/generic.d.ts +4 -0
- package/dist/components/Guido.vue.d.ts +3 -1
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +73 -62
- package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +3 -2
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +14 -15
- package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
- package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -9
- package/dist/components/organisms/header/RightSlot.vue.d.ts +3 -1
- package/dist/components/organisms/header/RightSlot.vue.js +5 -3
- package/dist/components/organisms/header/RightSlot.vue2.js +26 -27
- package/dist/components/organisms/header/ViewOptions.vue.js +5 -5
- package/dist/components/organisms/header/ViewOptions.vue2.js +5 -5
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +5 -5
- package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +11 -11
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +8 -8
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +25 -20
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +40 -28
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +6 -6
- package/dist/composables/useCustomInterfaceAppearance.js +22 -18
- package/dist/composables/useHtmlCompiler.js +17 -9
- package/dist/composables/useHtmlValidator.d.ts +3 -0
- package/dist/composables/useHtmlValidator.js +120 -0
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/composables/useRecommendation.d.ts +19 -0
- package/dist/composables/useRecommendation.js +27 -0
- package/dist/composables/useSave.d.ts +4 -0
- package/dist/composables/useSave.js +15 -0
- package/dist/composables/useStripo.js +27 -25
- package/dist/composables/useToaster.js +17 -17
- package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
- package/dist/config/compiler/outlookCompilerRules.js +36 -0
- package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
- package/dist/config/compiler/recommendationCompilerRules.js +83 -0
- package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
- package/dist/config/compiler/socialCompilerRules.js +21 -0
- package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
- package/dist/enums/defaults.d.ts +5 -1
- package/dist/enums/defaults.js +14 -10
- package/dist/enums/html-validator.d.ts +6 -0
- package/dist/enums/html-validator.js +7 -0
- package/dist/enums/recommendation.d.ts +54 -0
- package/dist/enums/recommendation.js +56 -0
- package/dist/enums/unsubscribe.d.ts +15 -0
- package/dist/enums/unsubscribe.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/validator.d.ts +2 -0
- package/dist/static/styles/components/alert-message.css.js +32 -2
- package/dist/static/styles/components/button.css.js +32 -2
- package/dist/static/styles/components/notification.css.js +55 -0
- package/dist/static/styles/components/popup.css.js +68 -0
- package/dist/static/styles/components/wide-panel.css.js +5 -1
- package/dist/static/styles/customEditorStyle.css.js +6 -0
- package/dist/static/styles/variables.css.js +10 -0
- package/dist/stores/dynamic-content.d.ts +12 -0
- package/dist/stores/dynamic-content.js +7 -6
- package/dist/stores/onboarding.d.ts +72 -8
- package/dist/stores/preview.js +1 -3
- package/dist/stores/recommendation.d.ts +10 -0
- package/dist/stores/recommendation.js +9 -0
- package/dist/stores/unsubscribe.d.ts +8 -0
- package/dist/stores/unsubscribe.js +9 -0
- package/dist/utils/genericUtil.js +9 -6
- package/dist/utils/templatePreparation.js +21 -14
- package/package.json +1 -1
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { useEditorStore as
|
|
2
|
-
import { useOnboardingStore as m } from "../stores/onboarding.js";
|
|
1
|
+
import { useEditorStore as n } from "../stores/editor.js";
|
|
3
2
|
import { usePreviewStore as l } from "../stores/preview.js";
|
|
4
|
-
import { useActionsApi as
|
|
5
|
-
import { useCodeEditorApi as
|
|
3
|
+
import { useActionsApi as m } from "./useActionsApi.js";
|
|
4
|
+
import { useCodeEditorApi as p } from "./useCodeEditorApi.js";
|
|
6
5
|
const E = () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
const o = n(), e = l(), { closeCodeEditor: a } = p(), { getPreviewData: s } = m(), r = () => {
|
|
7
|
+
o.isPreviewModeOpen = !1, e.$reset();
|
|
9
8
|
};
|
|
10
9
|
return {
|
|
11
|
-
closePreviewMode:
|
|
10
|
+
closePreviewMode: r,
|
|
12
11
|
openPreviewMode: () => {
|
|
13
|
-
|
|
12
|
+
o.isCodeEditorOpen && a(), o.isPreviewModeOpen = !0;
|
|
14
13
|
},
|
|
15
14
|
loadPreviewData: async () => {
|
|
16
|
-
if (!(
|
|
17
|
-
|
|
15
|
+
if (!(o.loadingStatus || e.isLoaded)) {
|
|
16
|
+
o.loadingStatus = !0;
|
|
18
17
|
try {
|
|
19
|
-
const { html:
|
|
20
|
-
|
|
21
|
-
} catch (
|
|
22
|
-
console.error("Failed to load preview data:",
|
|
18
|
+
const { html: t, ampHtml: i, ampErrors: d } = await s();
|
|
19
|
+
e.templateHtml = t || "", e.ampHtml = i || "", e.ampErrors = d || [], e.setEmailFormat(i ? "AMP" : "html"), e.isLoaded = !0;
|
|
20
|
+
} catch (t) {
|
|
21
|
+
console.error("Failed to load preview data:", t), r();
|
|
23
22
|
} finally {
|
|
24
|
-
|
|
23
|
+
o.loadingStatus = !1;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type CardWidthParams = {
|
|
2
|
+
mobileLeftPadding: number;
|
|
3
|
+
mobileRightPadding: number;
|
|
4
|
+
cardsInRow: number;
|
|
5
|
+
unresponsive: boolean;
|
|
6
|
+
};
|
|
7
|
+
interface CampaignData extends CardWidthParams {
|
|
8
|
+
textTrimming: boolean;
|
|
9
|
+
orientation: string;
|
|
10
|
+
priceBeforeTextValue: string;
|
|
11
|
+
priceAfterTextValue: string;
|
|
12
|
+
discountBeforeTextValue: string;
|
|
13
|
+
discountAfterTextValue: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const useRecommendation: () => {
|
|
16
|
+
calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
|
|
17
|
+
getRecommendationCampaignData: (id: string) => CampaignData;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MinDeviceViewport as r, DefaultPadding as c } from "../enums/recommendation.js";
|
|
2
|
+
const m = () => ({
|
|
3
|
+
calculateCardWidth: ({
|
|
4
|
+
mobileLeftPadding: e,
|
|
5
|
+
mobileRightPadding: a,
|
|
6
|
+
cardsInRow: n,
|
|
7
|
+
unresponsive: i
|
|
8
|
+
}) => {
|
|
9
|
+
const t = i ? n : 1, o = e + a + (t - 1) * c;
|
|
10
|
+
return (r - o) / t;
|
|
11
|
+
},
|
|
12
|
+
getRecommendationCampaignData: (e) => (console.debug(e), {
|
|
13
|
+
textTrimming: !1,
|
|
14
|
+
orientation: "vertical",
|
|
15
|
+
mobileLeftPadding: 0,
|
|
16
|
+
mobileRightPadding: 0,
|
|
17
|
+
cardsInRow: 2,
|
|
18
|
+
unresponsive: !1,
|
|
19
|
+
priceBeforeTextValue: "",
|
|
20
|
+
priceAfterTextValue: "",
|
|
21
|
+
discountBeforeTextValue: "",
|
|
22
|
+
discountAfterTextValue: ""
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
m as useRecommendation
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
const f = () => {
|
|
5
|
+
const e = i(), a = l(), { validateHtml: s } = n();
|
|
6
|
+
return { save: async (o = !1) => {
|
|
7
|
+
e();
|
|
8
|
+
const { prepareTemplateDetails: r } = m(), t = await r();
|
|
9
|
+
if (await s(t.compiledHtml, [], !0))
|
|
10
|
+
return o || a(t), t;
|
|
11
|
+
} };
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
f as useSave
|
|
15
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useCustomInterfaceAppearance as
|
|
3
|
-
import { useStripoEventHandler as
|
|
4
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
|
|
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
6
|
import h from "../extensions/DynamicContent/extension.js";
|
|
7
7
|
import { useStripoApi as w } from "../services/stripoApi.js";
|
|
8
8
|
import b from "../static/styles/customEditorStyle.css.js";
|
|
9
9
|
import { useEditorStore as V } from "../stores/editor.js";
|
|
10
10
|
import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
|
|
11
|
-
const
|
|
12
|
-
const { handleError: d } =
|
|
13
|
-
const
|
|
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;
|
|
14
14
|
window.UIEditor.initEditor(
|
|
15
15
|
document.querySelector("#guido-editor"),
|
|
16
16
|
{
|
|
17
|
-
metadata:
|
|
18
|
-
html:
|
|
19
|
-
css:
|
|
17
|
+
metadata: s,
|
|
18
|
+
html: o,
|
|
19
|
+
css: a,
|
|
20
20
|
forceRecreate: g,
|
|
21
21
|
locale: "en",
|
|
22
22
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -41,7 +41,7 @@ const x = (a) => {
|
|
|
41
41
|
},
|
|
42
42
|
mergeTags: [
|
|
43
43
|
{
|
|
44
|
-
entries: _(
|
|
44
|
+
entries: _(s.preselectedDynamicContentList)
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
async onTokenRefreshRequest(t) {
|
|
@@ -54,41 +54,43 @@ const x = (a) => {
|
|
|
54
54
|
},
|
|
55
55
|
onTemplateLoaded() {
|
|
56
56
|
try {
|
|
57
|
-
const { importCss: t } =
|
|
58
|
-
t(), n(),
|
|
57
|
+
const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
|
|
58
|
+
t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
59
|
+
e.hasChanges = !1;
|
|
60
|
+
}, 1e3);
|
|
59
61
|
} catch (t) {
|
|
60
62
|
d(t, "Failed to load custom interface appearance");
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
onCodeEditorVisibilityChanged(t) {
|
|
64
|
-
|
|
66
|
+
e.isCodeEditorOpen = t;
|
|
65
67
|
},
|
|
66
68
|
onEditorVisualModeChanged(t) {
|
|
67
|
-
|
|
69
|
+
e.editorVisualMode = t.toLowerCase();
|
|
68
70
|
},
|
|
69
71
|
onVersionHistoryVisibilityChanged(t) {
|
|
70
|
-
|
|
72
|
+
e.isVersionHistoryOpen = t;
|
|
71
73
|
},
|
|
72
74
|
onDataChanged() {
|
|
73
|
-
|
|
75
|
+
e.hasChanges = !0;
|
|
74
76
|
},
|
|
75
77
|
onEvent: l,
|
|
76
78
|
ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
|
|
77
79
|
extensions: [h]
|
|
78
80
|
}
|
|
79
81
|
);
|
|
80
|
-
}, m = (r) => new Promise((i,
|
|
82
|
+
}, m = (r) => new Promise((i, e) => {
|
|
81
83
|
if (document.getElementById("UiEditorScript")) {
|
|
82
84
|
r(), i();
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
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 = () => {
|
|
87
89
|
r(), i();
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}, document.body.appendChild(
|
|
90
|
+
}, o.onerror = () => {
|
|
91
|
+
const a = new Error("Failed to load Stripo UIEditor script");
|
|
92
|
+
e(a);
|
|
93
|
+
}, document.body.appendChild(o);
|
|
92
94
|
});
|
|
93
95
|
return { initPlugin: async (r) => {
|
|
94
96
|
await m(async () => {
|
|
@@ -98,5 +100,5 @@ const x = (a) => {
|
|
|
98
100
|
} };
|
|
99
101
|
};
|
|
100
102
|
export {
|
|
101
|
-
|
|
103
|
+
R as useStripo
|
|
102
104
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { useToasterStore as
|
|
3
|
-
import { watch as c
|
|
4
|
-
const
|
|
5
|
-
const t =
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
|
+
import { useToasterStore as u } from "../stores/toaster.js";
|
|
3
|
+
import { watch as c } from "vue";
|
|
4
|
+
const d = () => {
|
|
5
|
+
const t = u();
|
|
6
|
+
let o = null;
|
|
7
|
+
const s = () => {
|
|
8
|
+
o && (clearTimeout(o), o = null);
|
|
9
9
|
};
|
|
10
10
|
function r(e = { message: "" }) {
|
|
11
|
-
|
|
11
|
+
s(), t.hideToaster(), t.showToaster(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function i() {
|
|
14
|
+
s(), t.hideToaster();
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function a(e, n) {
|
|
17
17
|
const m = e instanceof Error ? e.message : String(e);
|
|
18
|
-
r({ type:
|
|
18
|
+
r({ type: T.Alert, message: `${n}: ${m}` });
|
|
19
19
|
}
|
|
20
20
|
return c(
|
|
21
21
|
() => t.shouldAutoHide,
|
|
22
22
|
(e) => {
|
|
23
|
-
|
|
24
|
-
t.hideToaster(),
|
|
23
|
+
s(), e && (o = setTimeout(() => {
|
|
24
|
+
t.hideToaster(), s();
|
|
25
25
|
}, 6e3));
|
|
26
26
|
}
|
|
27
|
-
),
|
|
27
|
+
), { showToaster: r, hideToaster: i, handleError: a };
|
|
28
28
|
};
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
d as useToaster
|
|
31
31
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const c = `
|
|
2
|
+
<!--[if gte mso 9]>
|
|
3
|
+
<xml>
|
|
4
|
+
<o:OfficeDocumentSettings>
|
|
5
|
+
<o:AllowPNG></o:AllowPNG>
|
|
6
|
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
|
7
|
+
</o:OfficeDocumentSettings>
|
|
8
|
+
</xml>
|
|
9
|
+
<![endif]-->`, s = {
|
|
10
|
+
xmlns: "http://www.w3.org/1999/xhtml",
|
|
11
|
+
"xmlns:o": "urn:schemas-microsoft-com:office:office"
|
|
12
|
+
}, r = [
|
|
13
|
+
{
|
|
14
|
+
id: "append-office-xml",
|
|
15
|
+
description: "Appending office XML into the head if it does not exist.",
|
|
16
|
+
type: "custom",
|
|
17
|
+
processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${c}</head>`),
|
|
18
|
+
priority: 70
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "set-html-attributes",
|
|
22
|
+
description: "Appending office XML into the head if it does not exist.",
|
|
23
|
+
type: "custom",
|
|
24
|
+
processor: (e) => {
|
|
25
|
+
let t = e;
|
|
26
|
+
return Object.entries(s).forEach(([o, i]) => {
|
|
27
|
+
const n = new RegExp(`${o}="[^"]*"`);
|
|
28
|
+
t.search(n) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
|
|
29
|
+
}), t;
|
|
30
|
+
},
|
|
31
|
+
priority: 71
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
export {
|
|
35
|
+
r as outlookCompilerRules
|
|
36
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useRecommendation as u } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as P, REGEX as i, CSS as e, CONDITIONS as E, ATTRIBUTES as r, HTML as h } from "../../enums/recommendation.js";
|
|
3
|
+
const H = [
|
|
4
|
+
{
|
|
5
|
+
id: "replace-images-with-variable-names",
|
|
6
|
+
description: "Replacing dummy images with variable names in recommendation module",
|
|
7
|
+
type: "custom",
|
|
8
|
+
processor: (a) => {
|
|
9
|
+
let t = a;
|
|
10
|
+
return Object.entries(P).forEach(([, n]) => {
|
|
11
|
+
Object.entries(n).forEach(([s, o]) => {
|
|
12
|
+
t = t.replaceAll(o, `{{${s}}}`);
|
|
13
|
+
});
|
|
14
|
+
}), t;
|
|
15
|
+
},
|
|
16
|
+
priority: 50
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "replace-recommendation-button-span-css",
|
|
20
|
+
description: "Replacing recommendation button span css",
|
|
21
|
+
type: "replace",
|
|
22
|
+
search: ".ext-product-button span,",
|
|
23
|
+
replacement: ".ext-product-button,",
|
|
24
|
+
replaceAll: !0,
|
|
25
|
+
priority: 51
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "add-recommendation-unresponsive-css",
|
|
29
|
+
description: "Adding recommendation unresponsive css",
|
|
30
|
+
type: "custom",
|
|
31
|
+
processor: (a) => {
|
|
32
|
+
const { getRecommendationCampaignData: t } = u();
|
|
33
|
+
let n = a;
|
|
34
|
+
const s = n.match(i.ID);
|
|
35
|
+
if (s) {
|
|
36
|
+
const o = [];
|
|
37
|
+
if (s.forEach((c) => {
|
|
38
|
+
const m = c.slice(35, c.length - 1).trim();
|
|
39
|
+
t(m);
|
|
40
|
+
}), o.length) {
|
|
41
|
+
const c = `width:${Math.min(...o)}px!important;`;
|
|
42
|
+
n = n.replace(e.REGULAR_NAME_HEIGHT, `${e.TRIMMED_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.REGULAR_NAME_CONTAINER_HEIGHT, e.TRIMMED_NAME_CONTAINER_CSS).replace(e.RESPONSIVE_NAME_SIZE, `${e.RESPONSIVE_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.RESPONSIVE_NAME_CONTAINER_HEIGHT, e.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return n;
|
|
46
|
+
},
|
|
47
|
+
priority: 52
|
|
48
|
+
},
|
|
49
|
+
// TODO: prepareRecommendations
|
|
50
|
+
// TODO: addRecommendationCustomFields
|
|
51
|
+
{
|
|
52
|
+
id: "add-discount-conditions",
|
|
53
|
+
description: "Adding discount conditions to the recommendation block",
|
|
54
|
+
type: "custom",
|
|
55
|
+
processor: (a) => {
|
|
56
|
+
let t = a;
|
|
57
|
+
const n = t.match(i.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: s } = u();
|
|
58
|
+
return n !== null && n.forEach((o) => {
|
|
59
|
+
const c = o.match(i.CUSTOM_FIELD);
|
|
60
|
+
if (!c)
|
|
61
|
+
return;
|
|
62
|
+
const [m] = c, p = m.match(i.CUSTOM_FIELD_INDEXES_PART), A = m.match(i.CUSTOM_FIELD_NAME_PART), _ = o.match(i.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
63
|
+
if (!p || !A || !_)
|
|
64
|
+
return;
|
|
65
|
+
const [l] = p, [T] = A, [d] = _, N = T.substring(1, T.length - 2), R = d.match(i.COMPOSITION) !== null;
|
|
66
|
+
let O = m;
|
|
67
|
+
if (R) {
|
|
68
|
+
const M = l.substring(2, l.length - 3);
|
|
69
|
+
s(M);
|
|
70
|
+
}
|
|
71
|
+
const I = l.substring(2);
|
|
72
|
+
let S = "";
|
|
73
|
+
N in E.IF && (S = E.IF[N].replaceAll(`{${r.DISCOUNT}}`, `${I}${r.DISCOUNT}`).replaceAll(`{${r.OMNIBUS_DISCOUNT}}`, `${I}${r.OMNIBUS_DISCOUNT}`).replaceAll(`{${r.OMNIBUS_PRICE}}`, `${I}${r.OMNIBUS_PRICE}`));
|
|
74
|
+
const $ = `${d}${O}${h.PARAGRAPH_END_TAG}`, C = `${S}${R ? $ : o}${E.ELSE}${d}${h.PARAGRAPH_END_TAG}${E.END_IF}`;
|
|
75
|
+
t = t.replace(o, C);
|
|
76
|
+
}), t;
|
|
77
|
+
},
|
|
78
|
+
priority: 53
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
export {
|
|
82
|
+
H as recommendationCompilerRules
|
|
83
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const a = [
|
|
2
|
+
{
|
|
3
|
+
id: "fix-custom-social-block",
|
|
4
|
+
description: "Fixing custom social block.",
|
|
5
|
+
type: "custom",
|
|
6
|
+
processor: (e) => {
|
|
7
|
+
let c = e;
|
|
8
|
+
const s = c.match(/<table[^>]*?class="[^>]*?es-social[^>]*?"[\S\s]*?<\/table>/gm);
|
|
9
|
+
return s && s.forEach((o) => {
|
|
10
|
+
if (o.match(/<img[^>]*?height="[0-9]+?"/gm)) {
|
|
11
|
+
const i = o.replace(/<img[^>]*?height="[0-9]+?"/gm, (t) => t.replace("height", "width"));
|
|
12
|
+
c = c.replace(o, i);
|
|
13
|
+
}
|
|
14
|
+
}), c;
|
|
15
|
+
},
|
|
16
|
+
priority: 80
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
export {
|
|
20
|
+
a as socialCompilerRules
|
|
21
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { usePartner as m } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as c, LINK_TYPES as p, URLS as E } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
|
|
4
|
+
const S = [
|
|
5
|
+
{
|
|
6
|
+
id: "add-unsubscribe-link-values",
|
|
7
|
+
description: "Adding unsubscribe link values",
|
|
8
|
+
type: "custom",
|
|
9
|
+
processor: (n) => {
|
|
10
|
+
var a, u;
|
|
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
|
+
return r && (e = e.replace(
|
|
15
|
+
c.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
16
|
+
E.UNSUBSCRIBE_URL + o
|
|
17
|
+
)), s && (e = e.replace(
|
|
18
|
+
c.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
19
|
+
E.PREFERENCES_URL + o
|
|
20
|
+
)), e.replace(c.UNSUBSCRIBE_LINK_REGEX, "");
|
|
21
|
+
},
|
|
22
|
+
priority: 60
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "remove-data-ogsb-button-styles",
|
|
26
|
+
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
27
|
+
type: "regex",
|
|
28
|
+
pattern: c.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
29
|
+
replacement: "",
|
|
30
|
+
flags: "g",
|
|
31
|
+
priority: 61
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "format-comment-braces",
|
|
35
|
+
description: "Adding spaces around comment braces for proper formatting",
|
|
36
|
+
type: "custom",
|
|
37
|
+
processor: (n) => n.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
38
|
+
priority: 62
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "add-universal-link-flags",
|
|
42
|
+
description: "Adding universal link flags",
|
|
43
|
+
type: "custom",
|
|
44
|
+
processor: (n) => {
|
|
45
|
+
let i = n;
|
|
46
|
+
const t = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
47
|
+
return t && t.forEach((e) => {
|
|
48
|
+
if (e.includes("insEmail=1"))
|
|
49
|
+
return;
|
|
50
|
+
if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
51
|
+
const o = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
52
|
+
const s = r.slice(6, r.length - 1).trim();
|
|
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
|
+
});
|
|
55
|
+
i = i.replace(e, o);
|
|
56
|
+
}
|
|
57
|
+
}), i;
|
|
58
|
+
},
|
|
59
|
+
priority: 63
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
export {
|
|
63
|
+
S as unsubscribeCompilerRules
|
|
64
|
+
};
|
package/dist/enums/defaults.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { GuidoConfig } from '@@/Types/generic';
|
|
2
2
|
export declare const DefaultGuidoConfig: GuidoConfig;
|
|
3
|
+
export declare const TemplateTypes: {
|
|
4
|
+
promotional: number;
|
|
5
|
+
transactional: number;
|
|
6
|
+
};
|
|
3
7
|
export declare const DefaultProductType = "email";
|
|
4
8
|
export declare const DefaultUsername = "Guido User";
|
|
5
|
-
export declare const DefaultMessageType
|
|
9
|
+
export declare const DefaultMessageType: number;
|
|
6
10
|
export declare const EditorType: number;
|
|
7
11
|
export declare const ProductIds: Record<string, number>;
|
|
8
12
|
export declare const TEST_PARTNER_LIST: string[];
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = {
|
|
2
2
|
translationsPath: "window.trans.en",
|
|
3
3
|
emailHeader: {
|
|
4
4
|
senderName: "",
|
|
@@ -10,10 +10,13 @@ const t = {
|
|
|
10
10
|
versionHistory: !0
|
|
11
11
|
},
|
|
12
12
|
useHeader: !0
|
|
13
|
-
},
|
|
13
|
+
}, t = {
|
|
14
|
+
promotional: 1,
|
|
15
|
+
transactional: 2
|
|
16
|
+
}, e = "email", o = "Guido User", n = t.promotional, i = 2, s = {
|
|
14
17
|
email: 60,
|
|
15
18
|
architect: 49
|
|
16
|
-
},
|
|
19
|
+
}, u = [
|
|
17
20
|
"alfredtesting",
|
|
18
21
|
"electio",
|
|
19
22
|
"eurekatest",
|
|
@@ -46,11 +49,12 @@ const t = {
|
|
|
46
49
|
"stripoeditorlivetest"
|
|
47
50
|
];
|
|
48
51
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
a as DefaultGuidoConfig,
|
|
53
|
+
n as DefaultMessageType,
|
|
54
|
+
e as DefaultProductType,
|
|
55
|
+
o as DefaultUsername,
|
|
56
|
+
i as EditorType,
|
|
57
|
+
s as ProductIds,
|
|
58
|
+
u as TEST_PARTNER_LIST,
|
|
59
|
+
t as TemplateTypes
|
|
56
60
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CanNotMakeAnyChangesForRunningKey = "newsletter.already-in-progress";
|
|
2
|
+
export declare const CanNotMakeAnyChangesKey = "newsletter.can-not-make-any-changes";
|
|
3
|
+
export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not-be-saved";
|
|
4
|
+
export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
|
|
5
|
+
export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
|
|
6
|
+
export declare const REMOVE_CONDITIONS_REGEX: RegExp;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const e = "newsletter.already-in-progress", n = "newsletter.campaign-could-not-be-saved", o = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, a = /{%( )*now( )(".*")( )*%}/gm;
|
|
2
|
+
export {
|
|
3
|
+
n as CampaignCouldNotBeSavedKey,
|
|
4
|
+
e as CanNotMakeAnyChangesForRunningKey,
|
|
5
|
+
a as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
|
|
6
|
+
o as DISPLAY_CONDITIONS_REGEX
|
|
7
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const DefaultPadding = 20;
|
|
2
|
+
export declare const MinDeviceViewport = 320;
|
|
3
|
+
export declare const VerticalOrientation = "vertical";
|
|
4
|
+
export declare const DUMMY_IMAGE_MAPPINGS: {
|
|
5
|
+
CART_ABANDONMENT: {
|
|
6
|
+
ins_apr_img_1: string;
|
|
7
|
+
ins_apr_img_2: string;
|
|
8
|
+
ins_apr_img_3: string;
|
|
9
|
+
ins_apr_img_4: string;
|
|
10
|
+
};
|
|
11
|
+
BROWSE_ABANDONMENT: {
|
|
12
|
+
browsed_item_img_1: string;
|
|
13
|
+
browsed_item_img_2: string;
|
|
14
|
+
browsed_item_img_3: string;
|
|
15
|
+
browsed_item_img_4: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const ATTRIBUTES: {
|
|
19
|
+
DISCOUNT: string;
|
|
20
|
+
OMNIBUS_DISCOUNT: string;
|
|
21
|
+
OMNIBUS_PRICE: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const CONDITIONS: {
|
|
24
|
+
IF: {
|
|
25
|
+
discount: string;
|
|
26
|
+
omnibus_discount: string;
|
|
27
|
+
omnibus_price: string;
|
|
28
|
+
};
|
|
29
|
+
ELSE: string;
|
|
30
|
+
END_IF: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const REGEX: {
|
|
33
|
+
ID: RegExp;
|
|
34
|
+
ATTRIBUTE_PARAGRAPH: RegExp;
|
|
35
|
+
ATTRIBUTE_PARAGRAPH_START_TAG: RegExp;
|
|
36
|
+
COMPOSITION: RegExp;
|
|
37
|
+
CUSTOM_FIELD: RegExp;
|
|
38
|
+
CUSTOM_FIELD_INDEXES_PART: RegExp;
|
|
39
|
+
CUSTOM_FIELD_NAME_PART: RegExp;
|
|
40
|
+
};
|
|
41
|
+
export declare const HTML: {
|
|
42
|
+
PARAGRAPH_END_TAG: string;
|
|
43
|
+
};
|
|
44
|
+
export declare const CSS: {
|
|
45
|
+
REGULAR_NAME_HEIGHT: string;
|
|
46
|
+
TRIMMED_NAME_HEIGHT: string;
|
|
47
|
+
ELLIPSIS: string;
|
|
48
|
+
REGULAR_NAME_CONTAINER_HEIGHT: string;
|
|
49
|
+
TRIMMED_NAME_CONTAINER_CSS: string;
|
|
50
|
+
RESPONSIVE_NAME_SIZE: string;
|
|
51
|
+
RESPONSIVE_NAME_HEIGHT: string;
|
|
52
|
+
RESPONSIVE_NAME_CONTAINER_HEIGHT: string;
|
|
53
|
+
TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS: string;
|
|
54
|
+
};
|