@useinsider/guido 3.19.0-beta.4b9be3a → 3.19.0-beta.4e3e6c4
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 +21 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +84 -87
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -0
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +44 -43
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +54 -120
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +51 -96
- package/dist/composables/useHtmlValidator.js +87 -82
- package/dist/composables/useHttp.js +61 -54
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +18 -22
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/enums/extensions/recommendationBlock.js +49 -33
- package/dist/extensions/Blocks/Recommendation/block.js +61 -42
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +100 -94
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +130 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +273 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -4
- package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -26
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/guido-email-editor.d.ts +10 -32
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +104 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/config.js +74 -60
- package/dist/stores/guido-email-editor.js +1 -3
- package/dist/stores/onboarding.js +46 -36
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +2 -1
|
@@ -1,67 +1,81 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import P from "../static/styles/components/
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import p from "../static/assets/icons/filled-arrow-rising.svg.js";
|
|
2
|
+
import s from "../static/assets/icons/line-change.svg.js";
|
|
3
|
+
import a from "../static/assets/icons/line-delete.svg.js";
|
|
4
|
+
import f from "../static/assets/icons/line-info.svg.js";
|
|
5
|
+
import c from "../static/assets/icons/line-plus.svg.js";
|
|
6
|
+
import l from "../static/styles/base.css.js";
|
|
7
|
+
import C from "../static/styles/components/alert-message.css.js";
|
|
8
|
+
import d from "../static/styles/components/amp-block.css.js";
|
|
9
|
+
import u from "../static/styles/components/base-input.css.js";
|
|
10
|
+
import h from "../static/styles/components/button-group.css.js";
|
|
11
|
+
import I from "../static/styles/components/button.css.js";
|
|
12
|
+
import g from "../static/styles/components/combobox.css.js";
|
|
13
|
+
import w from "../static/styles/components/counter.css.js";
|
|
14
|
+
import y from "../static/styles/components/dropdown-menu.css.js";
|
|
15
|
+
import A from "../static/styles/components/loader.css.js";
|
|
16
|
+
import $ from "../static/styles/components/narrow-panel.css.js";
|
|
17
|
+
import b from "../static/styles/components/popup.css.js";
|
|
18
|
+
import B from "../static/styles/components/recommendation-strategy.css.js";
|
|
19
|
+
import D from "../static/styles/components/skeleton.css.js";
|
|
20
|
+
import R from "../static/styles/components/switcher.css.js";
|
|
21
|
+
import P from "../static/styles/components/tabs.css.js";
|
|
22
|
+
import T from "../static/styles/components/tools.css.js";
|
|
23
|
+
import x from "../static/styles/components/version-history.css.js";
|
|
24
|
+
import M from "../static/styles/components/wide-panel.css.js";
|
|
25
|
+
import O from "../static/styles/variables.css.js";
|
|
26
|
+
function o(i, r) {
|
|
27
|
+
return `--guido-icon-${i}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
|
|
25
28
|
}
|
|
26
|
-
const
|
|
27
|
-
${
|
|
28
|
-
${
|
|
29
|
-
${
|
|
30
|
-
}
|
|
31
|
-
|
|
29
|
+
const V = `:host {
|
|
30
|
+
${o("line-change", s)}
|
|
31
|
+
${o("line-delete", a)}
|
|
32
|
+
${o("filled-arrow-rising", p)}
|
|
33
|
+
${o("line-info", f)}
|
|
34
|
+
${o("line-plus", c)}
|
|
35
|
+
}`, W = [
|
|
36
|
+
O,
|
|
32
37
|
// Must be on top
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
V,
|
|
39
|
+
l,
|
|
35
40
|
// Must be on top
|
|
36
|
-
s,
|
|
37
41
|
C,
|
|
38
|
-
a,
|
|
39
|
-
f,
|
|
40
|
-
c,
|
|
41
|
-
u,
|
|
42
|
-
l,
|
|
43
42
|
d,
|
|
43
|
+
u,
|
|
44
44
|
h,
|
|
45
|
-
g,
|
|
46
45
|
I,
|
|
46
|
+
g,
|
|
47
|
+
w,
|
|
47
48
|
y,
|
|
48
|
-
|
|
49
|
-
B,
|
|
49
|
+
A,
|
|
50
50
|
$,
|
|
51
|
+
b,
|
|
52
|
+
D,
|
|
53
|
+
R,
|
|
51
54
|
P,
|
|
52
|
-
|
|
55
|
+
T,
|
|
56
|
+
x,
|
|
57
|
+
M,
|
|
58
|
+
B
|
|
53
59
|
// Last: overrides button.css / wide-panel.css defaults
|
|
54
60
|
].join(`
|
|
55
61
|
|
|
56
|
-
`),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
`), _ = 3e4;
|
|
63
|
+
let e = null;
|
|
64
|
+
function k() {
|
|
65
|
+
return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
|
|
66
|
+
}
|
|
67
|
+
const po = () => ({ importCss: () => {
|
|
68
|
+
const r = k(), S = Date.now() + _, n = () => {
|
|
69
|
+
var m;
|
|
70
|
+
const t = (m = document.querySelector("ui-editor")) == null ? void 0 : m.shadowRoot;
|
|
71
|
+
if (t) {
|
|
72
|
+
t.adoptedStyleSheets.includes(r) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, r]);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
Date.now() < S && requestAnimationFrame(n);
|
|
76
|
+
};
|
|
77
|
+
n();
|
|
64
78
|
} });
|
|
65
79
|
export {
|
|
66
|
-
|
|
80
|
+
po as useCustomInterfaceAppearance
|
|
67
81
|
};
|
|
@@ -1,104 +1,59 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var e, t;
|
|
20
|
-
return T.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
|
|
21
|
-
}, b = (e) => {
|
|
22
|
-
a.value[e] === void 0 && (a.value = { ...a.value, [e]: "pending" });
|
|
23
|
-
}, l = (e, t) => {
|
|
24
|
-
a.value = { ...a.value, [e]: t };
|
|
25
|
-
}, P = (e) => {
|
|
26
|
-
var t;
|
|
1
|
+
import { useActionsApi as C } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as h } from "./useConfig.js";
|
|
3
|
+
import { useToaster as D } from "./useToaster.js";
|
|
4
|
+
import { useTranslations as E } from "./useTranslations.js";
|
|
5
|
+
import { ToasterTypeOptions as f } from "../enums/toaster.js";
|
|
6
|
+
import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
|
|
7
|
+
import { flattenDynamicContentList as w } from "../utils/genericUtil.js";
|
|
8
|
+
import { extractUsedDynamicContent as S } from "../utils/registerUsedDynamicContent.js";
|
|
9
|
+
import { ref as O } from "vue";
|
|
10
|
+
const U = 250, o = O({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
|
|
11
|
+
const { updateHtmlAndCss: r } = C(), { showToaster: m } = D(), y = E(), { template: T } = h(), d = A(), g = (e, t) => {
|
|
12
|
+
const a = y(e);
|
|
13
|
+
return a === e ? t : a;
|
|
14
|
+
}, v = (e) => {
|
|
15
|
+
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
|
+
}, l = (e, t, a) => {
|
|
17
|
+
var c;
|
|
18
|
+
o.value = { ...o.value, [e]: "applying" };
|
|
27
19
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
return u.get(e) !== n ? p : (l(e, "applied"), P(t), _(e, t), { status: "applied" });
|
|
46
|
-
}, H = (e) => {
|
|
47
|
-
const t = s.get(e);
|
|
48
|
-
t && (clearTimeout(t.timer), s.delete(e), t.settle(p));
|
|
49
|
-
}, y = (e) => {
|
|
50
|
-
const t = c.get(e);
|
|
51
|
-
t && (clearTimeout(t.timer), c.delete(e), t.settle(p));
|
|
52
|
-
}, B = () => {
|
|
53
|
-
[...c.keys()].forEach(y);
|
|
54
|
-
}, L = (e, t, r) => new Promise((n) => {
|
|
55
|
-
H(e);
|
|
56
|
-
const o = setTimeout(() => {
|
|
57
|
-
s.delete(e), l(e, "failed"), w(e, t), n({
|
|
58
|
-
status: "failed",
|
|
59
|
-
error: new Error(`Editor did not become ready within ${h}ms`)
|
|
20
|
+
r(t, a).catch((n) => {
|
|
21
|
+
console.warn("Editor did not acknowledge the template apply.", n);
|
|
22
|
+
}), o.value = { ...o.value, [e]: "applied" };
|
|
23
|
+
try {
|
|
24
|
+
const n = w((c = T.value) == null ? void 0 : c.dynamicContentList), i = S(t, n);
|
|
25
|
+
i.length > 0 && d.registerDynamicContent(i);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
u.get(e) !== t && (u.set(e, t), m({
|
|
29
|
+
type: f.Success,
|
|
30
|
+
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
31
|
+
}));
|
|
32
|
+
} catch (n) {
|
|
33
|
+
o.value = { ...o.value, [e]: "failed" }, m({
|
|
34
|
+
type: f.Error,
|
|
35
|
+
message: n instanceof Error ? n.message : "Failed to apply template"
|
|
60
36
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
const e = [...s.entries()];
|
|
67
|
-
s.clear(), e.forEach(([, o]) => clearTimeout(o.timer));
|
|
68
|
-
const t = e.pop();
|
|
69
|
-
if (e.forEach(([o, d]) => {
|
|
70
|
-
l(o, "failed"), d.settle({ status: "failed", error: new Error("Displaced by a newer apply") });
|
|
71
|
-
}), !t)
|
|
72
|
-
return;
|
|
73
|
-
const [r, n] = t;
|
|
74
|
-
n.settle(await g(r, n.html, n.css));
|
|
37
|
+
}
|
|
38
|
+
}, p = (e) => {
|
|
39
|
+
const t = s[e];
|
|
40
|
+
t && (clearTimeout(t), delete s[e]);
|
|
75
41
|
};
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
}, { immediate: !0 }), { applyStatus: a, markPending: b, applyTemplate: (e, t) => {
|
|
79
|
-
const { html: r } = t;
|
|
80
|
-
return r ? (B(), C(e, r, t.css ?? "")) : Promise.resolve(S);
|
|
42
|
+
return { applyStatus: o, markPending: v, applyTemplate: (e, t) => {
|
|
43
|
+
t.html && (p(e), l(e, t.html, t.css ?? ""));
|
|
81
44
|
}, applyTemplateDebounced: (e, t) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
c.delete(e), C(e, r, n).then(o);
|
|
90
|
-
}, J);
|
|
91
|
-
c.set(e, { timer: d, settle: o });
|
|
92
|
-
});
|
|
45
|
+
if (!t.html)
|
|
46
|
+
return;
|
|
47
|
+
p(e);
|
|
48
|
+
const { html: a } = t, c = t.css ?? "";
|
|
49
|
+
s[e] = setTimeout(() => {
|
|
50
|
+
delete s[e], l(e, a, c);
|
|
51
|
+
}, U);
|
|
93
52
|
} };
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
clearTimeout(i.timer), i.settle(p);
|
|
97
|
-
}), c.clear(), s.forEach((i) => {
|
|
98
|
-
clearTimeout(i.timer), i.settle(p);
|
|
99
|
-
}), s.clear(), u.clear(), m.clear(), a.value = {};
|
|
53
|
+
}, G = () => {
|
|
54
|
+
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((r) => delete s[r]), o.value = {};
|
|
100
55
|
};
|
|
101
56
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
57
|
+
G as resetEmailTemplateApplier,
|
|
58
|
+
z as useEmailTemplateApplier
|
|
104
59
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useConfig as V } from "./useConfig.js";
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as W } from "../enums/defaults.js";
|
|
4
|
-
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as
|
|
4
|
+
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as K, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as X, DYNAMIC_CONTENT_TAG_REGEX as Y, ALLOWED_DYNAMIC_SYSTEM_TOKENS as $, VALID_DYNAMIC_VARIABLE_REGEX as U } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
6
|
import { BLOCK_ROOT_SELECTOR as j } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
7
|
import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
@@ -9,58 +9,58 @@ import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/RadioButton/const
|
|
|
9
9
|
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
10
10
|
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
11
|
import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
12
|
-
import {
|
|
13
|
-
import { useRecommendationStore as
|
|
14
|
-
import { base64EncodeWithSpecialChars as
|
|
15
|
-
import { computed as
|
|
16
|
-
import { useHttp as
|
|
17
|
-
import { useToaster as
|
|
18
|
-
import { useTranslations as
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
return [...s.matchAll(
|
|
12
|
+
import { STRATEGY_FIELD_KEY as ee, RecommendationAssignStrategyKey as te, RecommendationRequiredFieldsKey as ne } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
+
import { useRecommendationStore as se } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
|
|
15
|
+
import { computed as oe } from "vue";
|
|
16
|
+
import { useHttp as ie } from "./useHttp.js";
|
|
17
|
+
import { useToaster as ae } from "./useToaster.js";
|
|
18
|
+
import { useTranslations as ce } from "./useTranslations.js";
|
|
19
|
+
const le = /recommendation-id="(\d+)"/g;
|
|
20
|
+
function me(s) {
|
|
21
|
+
return [...s.matchAll(le)].map((m) => m[1]);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function ue(s, m) {
|
|
24
|
+
return m.some((f) => s.startsWith(`${f}_`));
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
return
|
|
26
|
+
const de = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function fe(s) {
|
|
28
|
+
const m = s.match(de);
|
|
29
|
+
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
31
|
+
function ge(s) {
|
|
32
|
+
const m = new Set(Z);
|
|
33
33
|
return Object.values(s).forEach((f) => {
|
|
34
|
-
|
|
35
|
-
}),
|
|
34
|
+
m.add(Q(f).toLowerCase());
|
|
35
|
+
}), m;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function pe(s, m, f, o, d) {
|
|
38
38
|
const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
39
39
|
if (!u)
|
|
40
40
|
return [];
|
|
41
|
-
const
|
|
42
|
-
return u.forEach((
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
41
|
+
const p = new Set(m.map((y) => y.toLowerCase())), E = [];
|
|
42
|
+
return u.forEach((y) => {
|
|
43
|
+
const g = y.slice(2, -2).trim().toLowerCase();
|
|
44
|
+
if (g !== "" && p.has(g))
|
|
45
45
|
return;
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
if (!d || d.has(
|
|
46
|
+
const C = fe(g);
|
|
47
|
+
if (C && o.has(C.recoId)) {
|
|
48
|
+
if (!d || d.has(C.attribute))
|
|
49
49
|
return;
|
|
50
|
-
E.push(
|
|
50
|
+
E.push(g);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
ue(g, f) || g.includes(".") || E.push(g);
|
|
54
54
|
}), E;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return (s.replace(
|
|
58
|
-
const d = o.slice(2, -2), u = d.indexOf("|"),
|
|
59
|
-
return
|
|
56
|
+
function Ee(s) {
|
|
57
|
+
return (s.replace(X, "$1").match(Y) ?? []).filter((o) => {
|
|
58
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
59
|
+
return $.includes(p) ? !1 : U.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
const { showToaster: s } =
|
|
62
|
+
const ke = () => {
|
|
63
|
+
const { showToaster: s } = ae(), { post: m } = ie(), { config: f } = V(), o = ce(), d = se(), u = J(), p = oe(
|
|
64
64
|
() => {
|
|
65
65
|
var e, t;
|
|
66
66
|
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
@@ -73,39 +73,39 @@ const De = () => {
|
|
|
73
73
|
} catch {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
return
|
|
77
|
-
},
|
|
78
|
-
const n = await
|
|
76
|
+
return ge(u.filterList);
|
|
77
|
+
}, y = async (e) => {
|
|
78
|
+
const n = await m(
|
|
79
79
|
"/newsletter/template-library/check-template-html-body",
|
|
80
|
-
{ html:
|
|
80
|
+
{ html: re(e) }
|
|
81
81
|
), { status: r, message: a } = n.data;
|
|
82
82
|
return r || s({
|
|
83
83
|
type: c.Error,
|
|
84
84
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
85
|
-
}), o(
|
|
85
|
+
}), o(K), a === o(P) && s({
|
|
86
86
|
type: c.Error,
|
|
87
87
|
message: o("newsletter.already-in-progress")
|
|
88
88
|
}), r;
|
|
89
|
-
},
|
|
89
|
+
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), C = (e) => ["if", "endif"].includes(e.toLowerCase()), I = (e, t) => {
|
|
90
90
|
const n = e.match(/({%(.*?)%})/g);
|
|
91
91
|
let r = !0;
|
|
92
|
-
return n !== null && !
|
|
92
|
+
return n !== null && !p.value && n.forEach((a) => {
|
|
93
93
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
94
94
|
if (i && i.length > 0) {
|
|
95
|
-
const [
|
|
96
|
-
|
|
95
|
+
const [l] = i;
|
|
96
|
+
g(l) && !t.includes(l) && (s({
|
|
97
97
|
type: c.Warning,
|
|
98
98
|
message: o("custom-fields.invalid-custom-fields")
|
|
99
99
|
}), r = !1);
|
|
100
100
|
}
|
|
101
101
|
}), r;
|
|
102
102
|
}, R = async (e, t, n) => {
|
|
103
|
-
const r = n ? await
|
|
104
|
-
return
|
|
105
|
-
},
|
|
103
|
+
const r = n ? await y(e) : !0;
|
|
104
|
+
return I(e, t) && r;
|
|
105
|
+
}, A = (e) => e.length > 0 ? !0 : (s({
|
|
106
106
|
type: c.Warning,
|
|
107
107
|
message: o("newsletter.html-content-is-empty")
|
|
108
|
-
}), !1),
|
|
108
|
+
}), !1), _ = (e) => {
|
|
109
109
|
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
110
110
|
return t > n && s({
|
|
111
111
|
type: c.Warning,
|
|
@@ -114,26 +114,26 @@ const De = () => {
|
|
|
114
114
|
type: c.Warning,
|
|
115
115
|
message: o("custom-fields.missing-opening-braces")
|
|
116
116
|
}), t === n;
|
|
117
|
-
},
|
|
118
|
-
const t =
|
|
117
|
+
}, b = (e) => {
|
|
118
|
+
const t = Ee(e).length === 0;
|
|
119
119
|
return t || s({
|
|
120
120
|
type: c.Warning,
|
|
121
121
|
message: o("custom-fields.invalid-custom-fields")
|
|
122
122
|
}), t;
|
|
123
123
|
}, O = (e, t, n, r) => {
|
|
124
|
-
if (
|
|
124
|
+
if (p.value)
|
|
125
125
|
return !0;
|
|
126
|
-
const a =
|
|
126
|
+
const a = pe(
|
|
127
127
|
e,
|
|
128
128
|
t,
|
|
129
|
-
|
|
129
|
+
me(e),
|
|
130
130
|
n,
|
|
131
131
|
r
|
|
132
132
|
);
|
|
133
133
|
if (a.length > 0) {
|
|
134
134
|
const i = `
|
|
135
135
|
<ul>
|
|
136
|
-
${a.map((
|
|
136
|
+
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
137
137
|
</ul>
|
|
138
138
|
`;
|
|
139
139
|
return s({
|
|
@@ -146,22 +146,22 @@ const De = () => {
|
|
|
146
146
|
const t = e.match(/{%(.*?)%}/g), n = [];
|
|
147
147
|
let r = !0;
|
|
148
148
|
if (t && t.forEach((a) => {
|
|
149
|
-
const i = a.match(G),
|
|
150
|
-
(!i || a !== v) && !
|
|
149
|
+
const i = a.match(G), l = a.match(H), v = (i == null ? void 0 : i.join("")) || "";
|
|
150
|
+
(!i || a !== v) && !l && (s({
|
|
151
151
|
type: c.Error,
|
|
152
152
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
153
|
-
}), r = !1), i && i.forEach((
|
|
154
|
-
|
|
153
|
+
}), r = !1), i && i.forEach((h) => {
|
|
154
|
+
h.trim() === "=" && (s({
|
|
155
155
|
type: c.Error,
|
|
156
156
|
message: o("custom-conditions.wrong-equality-operators")
|
|
157
157
|
}), r = !1);
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const S = h.match(/^[a-zA-Z]*$/g);
|
|
159
|
+
S && S.forEach((T) => {
|
|
160
|
+
C(T) && n.push(T);
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
163
|
}), n.length) {
|
|
164
|
-
const a = n.filter((
|
|
164
|
+
const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
|
|
165
165
|
a.length !== i.length && (s({
|
|
166
166
|
type: c.Error,
|
|
167
167
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
@@ -177,23 +177,28 @@ const De = () => {
|
|
|
177
177
|
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
178
178
|
type: c.Warning,
|
|
179
179
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
180
|
-
}), !1) : !0, B = () =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
}), !1) : !0, B = () => {
|
|
181
|
+
if (!u.hasInvalidBlock())
|
|
182
|
+
return !0;
|
|
183
|
+
const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === ee);
|
|
184
|
+
return s({
|
|
185
|
+
type: t ? c.Warning : c.Error,
|
|
186
|
+
message: o(t ? te : ne)
|
|
187
|
+
}), !1;
|
|
188
|
+
}, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
184
189
|
type: c.Error,
|
|
185
190
|
message: o("newsletter.fill-all-necessary-fields")
|
|
186
|
-
}), !1) : !0,
|
|
191
|
+
}), !1) : !0, x = (e) => {
|
|
187
192
|
const t = /src="[^"]*\.(svg|pst)"/gm;
|
|
188
193
|
return e.match(t) === null ? !0 : (s({
|
|
189
194
|
type: c.Error,
|
|
190
195
|
message: o("newsletter.invalid-image-type")
|
|
191
196
|
}), !1);
|
|
192
|
-
},
|
|
197
|
+
}, D = (e) => {
|
|
193
198
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(j);
|
|
194
199
|
return Array.from(r).find((i) => {
|
|
195
|
-
var
|
|
196
|
-
return !((
|
|
200
|
+
var l;
|
|
201
|
+
return !((l = i.id) != null && l.trim());
|
|
197
202
|
}) ? (s({
|
|
198
203
|
type: c.Error,
|
|
199
204
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
@@ -201,26 +206,26 @@ const De = () => {
|
|
|
201
206
|
}, k = (e) => {
|
|
202
207
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
|
|
203
208
|
return Array.from(r).find((i) => {
|
|
204
|
-
var
|
|
205
|
-
return !((
|
|
209
|
+
var l;
|
|
210
|
+
return !((l = i.id) != null && l.trim());
|
|
206
211
|
}) ? (s({
|
|
207
212
|
type: c.Error,
|
|
208
213
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
209
214
|
}), !1) : !0;
|
|
210
215
|
};
|
|
211
216
|
return { validateHtml: async (e, t, n = !1) => {
|
|
212
|
-
var v,
|
|
217
|
+
var v, h;
|
|
213
218
|
const r = [
|
|
214
|
-
...t.map((
|
|
219
|
+
...t.map((S) => S.value),
|
|
215
220
|
...q,
|
|
216
|
-
...((
|
|
221
|
+
...((h = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
217
222
|
], a = M(e), i = await E(a);
|
|
218
|
-
return await R(e, r, n) &&
|
|
223
|
+
return await R(e, r, n) && A(e) && _(e) && b(e) && O(e, r, a, i) && w(e) && L(e) && N(e) && B() && F() && x(e) && D(e) && k(e);
|
|
219
224
|
} };
|
|
220
225
|
};
|
|
221
226
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
ge as buildPartnerAttributeNameSet,
|
|
228
|
+
pe as findInvalidCustomFields,
|
|
229
|
+
fe as parseRecommendationVariable,
|
|
230
|
+
ke as useHtmlValidator
|
|
226
231
|
};
|