@useinsider/guido 3.30.0-beta.1360af2 → 3.30.0-beta.16d665a
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/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -11
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/composables/useExport.js +7 -8
- package/dist/composables/useHtmlValidator.js +100 -102
- package/dist/composables/useToaster.js +10 -11
- package/dist/composables/useVersionHistoryApi.js +21 -22
- package/dist/composables/validators/useLiquidValidator.js +24 -26
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +141 -148
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +53 -53
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +39 -40
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +26 -27
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +32 -33
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +78 -79
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +41 -50
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +0 -2
- package/dist/src/stores/preview.d.ts +0 -3
- package/dist/stores/preview.js +15 -21
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
- package/dist/src/utils/ampPreviewSanitizer.d.ts +0 -5
- package/dist/utils/ampPreviewSanitizer.js +0 -46
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./DesktopPreview.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var s = this, e = s._self._c,
|
|
6
|
-
return e("div", { staticClass: "desktop-preview-wrapper" }, [e("p", { staticClass: "f-s-1 f-w-600 l-h-1 t-t-u t-c-53 mb-6 l-s-5" }, [s._v(" " + s._s(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var a = function() {
|
|
5
|
+
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "desktop-preview-wrapper" }, [e("p", { staticClass: "f-s-1 f-w-600 l-h-1 t-t-u t-c-53 mb-6 l-s-5" }, [s._v(" " + s._s(t.trans("email-editor.desktop-preview")) + " ")]), e("div", { ref: "containerRef", staticClass: "desktop-preview d-f f-d-c o-h s-1" }, [e(t.DesktopBrowserHeader), e("div", { staticClass: "desktop-preview__content d-f f-g-1 o-h b-c-5 min-h-0" }, [e("div", { staticClass: "f-g-1 h-1 o-h b-c-4 min-w-0" }, [t.isContainerReady ? e("iframe", { staticClass: "desktop-preview__iframe d-b w-1 h-1 b-c-4 bor-s-n", attrs: { sandbox: `
|
|
7
|
+
allow-same-origin
|
|
8
|
+
allow-popups
|
|
9
|
+
allow-forms
|
|
10
|
+
allow-scripts
|
|
11
|
+
allow-popups-to-escape-sandbox`, srcdoc: t.previewStore.previewHtml }, on: { load: t.onIframeLoad } }) : s._e()])])], 1)]);
|
|
12
|
+
}, i = [], n = /* @__PURE__ */ r(
|
|
13
|
+
o,
|
|
10
14
|
a,
|
|
15
|
+
i,
|
|
11
16
|
!1,
|
|
12
17
|
null,
|
|
13
|
-
"
|
|
18
|
+
"cf946232"
|
|
14
19
|
);
|
|
15
|
-
const
|
|
20
|
+
const f = n.exports;
|
|
16
21
|
export {
|
|
17
|
-
|
|
22
|
+
f as default
|
|
18
23
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "./ContentView.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var t = this, s = t._self._c,
|
|
3
|
+
import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var o = function() {
|
|
5
|
+
var t = this, s = t._self._c, a = t._self._setupProxy;
|
|
6
6
|
return s("div", { staticClass: "w-1 h-1 b-c-4 d-f f-d-c" }, [s("div", { staticClass: "d-f j-c-s-b a-i-c p-2 h-6-s" }, [s("div", { staticClass: "d-f a-i-c cur-p", on: { click: function(l) {
|
|
7
7
|
return t.$emit("back-to-inbox");
|
|
8
|
-
} } }, [s(
|
|
9
|
-
}, i = [],
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
} } }, [s(a.InIcons, { staticClass: "f-s-3 i-c-7", attrs: { name: "line-chevron-left" } }), s("span", { staticClass: "ml-2 f-s-1 f-w-400 l-h-1 t-c-7" }, [t._v(t._s(a.trans("newsletter.inbox")))])], 1), s("div", { staticClass: "d-f a-i-c" }, [s(a.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-down" } }), s(a.InIcons, { staticClass: "ml-1 i-c-52", attrs: { name: "line-chevron-up" } })], 1)]), s("div", { staticClass: "iframe-wrapper f-g-1 o-h" }, [s("iframe", { ref: "iframeRef", staticClass: "iframe-scaled d-b b-c-4 bor-s-n", attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts allow-popups-to-escape-sandbox", srcdoc: a.previewStore.previewHtml }, on: { load: a.onLoad } })])]);
|
|
9
|
+
}, i = [], r = /* @__PURE__ */ n(
|
|
10
|
+
e,
|
|
11
|
+
o,
|
|
12
12
|
i,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"f255b2bb"
|
|
16
16
|
);
|
|
17
|
-
const
|
|
17
|
+
const d = r.exports;
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
d as default
|
|
20
20
|
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, defineAsyncComponent as T, ref as w, computed as o, watch as N } from "vue";
|
|
2
2
|
import "@useinsider/design-system-organisms/style";
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import { DOTTED_DATE_LOCALE as
|
|
6
|
-
import { URLS as
|
|
7
|
-
import { ToasterTypeOptions as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { commitStrategyChange as
|
|
10
|
-
import
|
|
11
|
-
import { formatShortDate as
|
|
12
|
-
import { asText as
|
|
13
|
-
import { escapeHtml as
|
|
14
|
-
import { InSkeleton as
|
|
15
|
-
const it = /* @__PURE__ */
|
|
3
|
+
import { useToaster as R } from "../../../../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as P } from "../../../../composables/useTranslations.js";
|
|
5
|
+
import { DOTTED_DATE_LOCALE as U } from "../../../../enums/date.js";
|
|
6
|
+
import { URLS as G } from "../../../../enums/extensions/recommendationBlock.js";
|
|
7
|
+
import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as M } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { commitStrategyChange as E } from "../../../../extensions/Blocks/Recommendation/utils/strategyCommit.js";
|
|
10
|
+
import $ from "./StrategyInfoBoxContent.vue.js";
|
|
11
|
+
import { formatShortDate as z } from "../../../../utils/dateUtil.js";
|
|
12
|
+
import { asText as D } from "../../../../utils/genericUtil.js";
|
|
13
|
+
import { escapeHtml as H } from "../../../../utils/htmlEscape.js";
|
|
14
|
+
import { InSkeleton as O } from "@useinsider/design-system-vue";
|
|
15
|
+
const it = /* @__PURE__ */ b({
|
|
16
16
|
__name: "AssignStrategyDrawer",
|
|
17
17
|
setup(F) {
|
|
18
|
-
const
|
|
19
|
-
render: (s) => s(
|
|
20
|
-
}),
|
|
21
|
-
loader: async () => (await
|
|
22
|
-
loadingComponent:
|
|
18
|
+
const g = () => import("@useinsider/design-system-organisms"), p = (t, r) => ({
|
|
19
|
+
render: (s) => s(O, { props: { sizing: { width: t, height: r } } })
|
|
20
|
+
}), I = T({
|
|
21
|
+
loader: async () => (await g()).OrgStrategyDetailModal,
|
|
22
|
+
loadingComponent: p(480, 240),
|
|
23
23
|
delay: 0
|
|
24
|
-
}),
|
|
25
|
-
loader: async () => (await
|
|
26
|
-
}), i = "guido-edit-strategy-",
|
|
27
|
-
|
|
24
|
+
}), h = T({
|
|
25
|
+
loader: async () => (await g()).OrgStrategyDropdown
|
|
26
|
+
}), i = "guido-edit-strategy-", x = { width: 480, height: 42 }, a = P(), e = M(), { showToaster: c } = R(), n = w(null), d = "legacy", l = w(!1), A = o(() => e.strategiesLoading || e.legacyConversionLoading), C = o(() => e.assignStrategyDrawerStatus ? a("email-editor.assign-strategy-description", { url: G.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
|
|
27
|
+
N(() => e.assignStrategyDrawerStatus, (t) => {
|
|
28
28
|
if (!t)
|
|
29
29
|
return;
|
|
30
30
|
const { strategyId: r } = e.recommendationConfigs;
|
|
31
|
-
n.value = r || (e.isLegacyStrategyBlock ?
|
|
31
|
+
n.value = r || (e.isLegacyStrategyBlock ? d : null), l.value = !1, e.invalidateStrategies(), e.fetchStrategies().catch(() => {
|
|
32
32
|
c({
|
|
33
|
-
type:
|
|
33
|
+
type: u.Error,
|
|
34
34
|
message: a("discovery-strategy.error-description")
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
|
-
const
|
|
39
|
-
const r =
|
|
38
|
+
const f = (t) => {
|
|
39
|
+
const r = D(t.updated_at || t.created_at);
|
|
40
40
|
if (!r)
|
|
41
41
|
return "";
|
|
42
|
-
const s =
|
|
42
|
+
const s = z(r, U);
|
|
43
43
|
return a("recommendation-strategy.last-updated-on", { value: s });
|
|
44
|
-
},
|
|
44
|
+
}, S = o(() => ({
|
|
45
45
|
text: a("ds-steps.legacy-strategy"),
|
|
46
|
-
value:
|
|
46
|
+
value: d,
|
|
47
47
|
hidden: !0
|
|
48
|
-
})),
|
|
48
|
+
})), m = o(() => e.strategies.map((t) => ({
|
|
49
49
|
text: t.name,
|
|
50
50
|
value: t.strategy_id,
|
|
51
51
|
infoBoxProps: {
|
|
@@ -54,10 +54,10 @@ const it = /* @__PURE__ */ N({
|
|
|
54
54
|
variant: "information",
|
|
55
55
|
size: "small",
|
|
56
56
|
class: "assign-strategy-info-box",
|
|
57
|
-
titleText:
|
|
57
|
+
titleText: H(D(t.name)),
|
|
58
58
|
descriptionStatus: !0,
|
|
59
|
-
descriptionText:
|
|
60
|
-
slot:
|
|
59
|
+
descriptionText: f(t),
|
|
60
|
+
slot: $,
|
|
61
61
|
slotProps: { strategy: t },
|
|
62
62
|
// The info box drops the option's value/text, so the id is the only channel
|
|
63
63
|
// that can carry the strategy back to the click handler.
|
|
@@ -70,17 +70,17 @@ const it = /* @__PURE__ */ N({
|
|
|
70
70
|
icon: "line-open-website"
|
|
71
71
|
}]
|
|
72
72
|
}
|
|
73
|
-
}))),
|
|
74
|
-
var
|
|
75
|
-
const r = (
|
|
73
|
+
}))), L = o(() => e.isLegacyStrategyBlock ? [S.value, ...m.value] : m.value), B = (t) => {
|
|
74
|
+
var _;
|
|
75
|
+
const r = (_ = t == null ? void 0 : t.id) != null && _.startsWith(i) ? t.id.slice(i.length) : "";
|
|
76
76
|
if (!r)
|
|
77
77
|
return;
|
|
78
|
-
const s = e.currentRecommendationId,
|
|
79
|
-
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null),
|
|
80
|
-
},
|
|
78
|
+
const s = e.currentRecommendationId, y = e.recommendationConfigs.strategyId === r;
|
|
79
|
+
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null), y && (e.removeStrategy(), s !== null && E(s, "Removed recommendation strategy")));
|
|
80
|
+
}, v = o(() => {
|
|
81
81
|
const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
|
|
82
82
|
return t ? { ...t, fallback_config: null } : null;
|
|
83
|
-
}),
|
|
83
|
+
}), k = o(() => ({
|
|
84
84
|
primaryButton: {
|
|
85
85
|
styling: "solid",
|
|
86
86
|
type: "primary",
|
|
@@ -92,10 +92,10 @@ const it = /* @__PURE__ */ N({
|
|
|
92
92
|
labelText: a("products.cancel")
|
|
93
93
|
}
|
|
94
94
|
}));
|
|
95
|
-
return { __sfc: !0, loadOrganisms:
|
|
95
|
+
return { __sfc: !0, loadOrganisms: g, skeleton: p, OrgStrategyDetailModal: I, OrgStrategyDropdown: h, EDIT_BUTTON_ID_PREFIX: i, SELECT_SKELETON_SIZING: x, trans: a, store: e, showToaster: c, selectedStrategyId: n, LEGACY_OPTION_VALUE: d, showSelectionError: l, strategiesLoading: A, drawerDescription: C, lastUpdatedText: f, legacyStrategyOption: S, remoteStrategyOptions: m, strategyOptions: L, onInfoBoxButtonClick: B, selectedStrategy: v, footerButtonGroupOptions: k, closeDrawer: () => {
|
|
96
96
|
e.closeAssignStrategyDrawer();
|
|
97
97
|
}, assignStrategy: async () => {
|
|
98
|
-
const t =
|
|
98
|
+
const t = v.value;
|
|
99
99
|
if (!t) {
|
|
100
100
|
l.value = !0;
|
|
101
101
|
return;
|
|
@@ -103,24 +103,24 @@ const it = /* @__PURE__ */ N({
|
|
|
103
103
|
let r = "";
|
|
104
104
|
try {
|
|
105
105
|
r = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
|
|
106
|
-
} catch (
|
|
107
|
-
console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed",
|
|
106
|
+
} catch (y) {
|
|
107
|
+
console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", y);
|
|
108
108
|
}
|
|
109
109
|
if (!r) {
|
|
110
110
|
c({
|
|
111
|
-
type:
|
|
112
|
-
message: a("email-editor.strategy-assign-failed", { strategyName:
|
|
111
|
+
type: u.Error,
|
|
112
|
+
message: a("email-editor.strategy-assign-failed", { strategyName: t.name })
|
|
113
113
|
});
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
const s = e.currentRecommendationId;
|
|
117
117
|
e.assignStrategy(t), c({
|
|
118
|
-
type:
|
|
119
|
-
message: a("email-editor.strategy-assigned-success", { strategyName:
|
|
120
|
-
}), e.closeAssignStrategyDrawer(), s !== null && await
|
|
118
|
+
type: u.Success,
|
|
119
|
+
message: a("email-editor.strategy-assigned-success", { strategyName: t.name })
|
|
120
|
+
}), e.closeAssignStrategyDrawer(), s !== null && await E(s, "Assigned recommendation strategy");
|
|
121
121
|
}, onSelect: (t) => {
|
|
122
122
|
n.value = t.value, l.value = !1;
|
|
123
|
-
}, InSkeleton:
|
|
123
|
+
}, InSkeleton: O };
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
export {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ToasterTypeOptions as a } from "../enums/toaster.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const x = () => {
|
|
2
|
+
import { useActionsApi as m } from "./useActionsApi.js";
|
|
3
|
+
import { useHtmlCompiler as p } from "./useHtmlCompiler.js";
|
|
4
|
+
import { useToaster as d } from "./useToaster.js";
|
|
5
|
+
const H = () => {
|
|
7
6
|
const c = (s, o, n) => {
|
|
8
7
|
const i = new Blob([s], { type: n }), t = URL.createObjectURL(i), e = document.createElement("a");
|
|
9
8
|
e.href = t, e.download = o, document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(t);
|
|
@@ -12,7 +11,7 @@ const x = () => {
|
|
|
12
11
|
return `${s}_${n}-${i}-${t}_${e}-${r}.html`;
|
|
13
12
|
};
|
|
14
13
|
return { exportHtml: async (s = !0) => {
|
|
15
|
-
const { getCompiledEmail: o } =
|
|
14
|
+
const { getCompiledEmail: o } = m(), { showToaster: n } = d(), { compileHtml: i } = p();
|
|
16
15
|
try {
|
|
17
16
|
const { html: t } = await o();
|
|
18
17
|
if (t) {
|
|
@@ -37,11 +36,11 @@ const x = () => {
|
|
|
37
36
|
const e = t instanceof Error ? t.message : String(t);
|
|
38
37
|
n({
|
|
39
38
|
type: a.Error,
|
|
40
|
-
message: `Error compiling email: ${
|
|
39
|
+
message: `Error compiling email: ${e}`
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
} };
|
|
44
43
|
};
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
H as useExport
|
|
47
46
|
};
|
|
@@ -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 { CONDITION_TAG_REGEX as G, DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as K, CampaignCouldNotBeSavedKey as
|
|
4
|
+
import { CONDITION_TAG_REGEX as G, DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as K, CampaignCouldNotBeSavedKey as X, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as U, VALID_DYNAMIC_VARIABLE_REGEX as j } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
6
|
import { BLOCK_ROOT_SELECTOR as q } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
7
|
import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
@@ -10,59 +10,57 @@ import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as J } from "../extensions/B
|
|
|
10
10
|
import { useRecommendationExtensionStore as Q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
11
|
import { filterToProductAttrValue as ee } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
12
12
|
import { STRATEGY_FIELD_KEY as te, RecommendationAssignStrategyKey as ne, RecommendationRequiredFieldsKey as se } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
-
import { useRecommendationStore as
|
|
14
|
-
import { base64EncodeWithSpecialChars as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function ge(s) {
|
|
23
|
-
return [...s.matchAll(fe)].map((l) => l[1]);
|
|
13
|
+
import { useRecommendationStore as re } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as oe } from "../utils/base64.js";
|
|
15
|
+
import { computed as ie } from "vue";
|
|
16
|
+
import { useHttp as ae } from "./useHttp.js";
|
|
17
|
+
import { useToaster as ce } from "./useToaster.js";
|
|
18
|
+
import { useTranslations as le } from "./useTranslations.js";
|
|
19
|
+
const me = /recommendation-id="(\d+)"/g;
|
|
20
|
+
function ue(s) {
|
|
21
|
+
return [...s.matchAll(me)].map((m) => m[1]);
|
|
24
22
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
23
|
+
function de(s, m) {
|
|
24
|
+
return m.some((f) => s.startsWith(`${f}_`));
|
|
27
25
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
return
|
|
26
|
+
const fe = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function ge(s) {
|
|
28
|
+
const m = s.match(fe);
|
|
29
|
+
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
32
30
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
31
|
+
function pe(s) {
|
|
32
|
+
const m = new Set(J);
|
|
35
33
|
return Object.values(s).forEach((f) => {
|
|
36
|
-
|
|
37
|
-
}),
|
|
34
|
+
m.add(ee(f).toLowerCase());
|
|
35
|
+
}), m;
|
|
38
36
|
}
|
|
39
|
-
function
|
|
37
|
+
function Ee(s, m, f, o, d) {
|
|
40
38
|
const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
41
39
|
if (!u)
|
|
42
40
|
return [];
|
|
43
|
-
const p = new Set(
|
|
41
|
+
const p = new Set(m.map((C) => C.toLowerCase())), E = [];
|
|
44
42
|
return u.forEach((C) => {
|
|
45
43
|
const g = C.slice(2, -2).trim().toLowerCase();
|
|
46
44
|
if (g !== "" && p.has(g))
|
|
47
45
|
return;
|
|
48
|
-
const y =
|
|
49
|
-
if (y &&
|
|
46
|
+
const y = ge(g);
|
|
47
|
+
if (y && o.has(y.recoId)) {
|
|
50
48
|
if (!d || d.has(y.attribute))
|
|
51
49
|
return;
|
|
52
50
|
E.push(g);
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
|
-
|
|
53
|
+
de(g, f) || g.includes(".") || E.push(g);
|
|
56
54
|
}), E;
|
|
57
55
|
}
|
|
58
|
-
function
|
|
59
|
-
return (s.replace(Y, "$1").match($) ?? []).filter((
|
|
60
|
-
const d =
|
|
61
|
-
return
|
|
56
|
+
function Ce(s) {
|
|
57
|
+
return (s.replace(Y, "$1").match($) ?? []).filter((o) => {
|
|
58
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
59
|
+
return U.includes(p) ? !1 : j.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
const
|
|
65
|
-
const { showToaster: s } =
|
|
62
|
+
const Ve = () => {
|
|
63
|
+
const { showToaster: s } = ce(), { post: m } = ae(), { config: f } = V(), o = le(), d = re(), u = Q(), p = ie(
|
|
66
64
|
() => {
|
|
67
65
|
var e, t;
|
|
68
66
|
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
@@ -75,161 +73,161 @@ const Ke = () => {
|
|
|
75
73
|
} catch {
|
|
76
74
|
return null;
|
|
77
75
|
}
|
|
78
|
-
return
|
|
76
|
+
return pe(u.filterList);
|
|
79
77
|
}, C = async (e) => {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
{ html:
|
|
83
|
-
), { status:
|
|
84
|
-
return
|
|
78
|
+
const n = await m(
|
|
79
|
+
"/newsletter/template-library/check-template-html-body",
|
|
80
|
+
{ html: oe(e) }
|
|
81
|
+
), { status: r, message: a } = n.data;
|
|
82
|
+
return r || s({
|
|
85
83
|
type: c.Error,
|
|
86
|
-
message:
|
|
87
|
-
}),
|
|
84
|
+
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
85
|
+
}), o(X), a === o(P) && s({
|
|
88
86
|
type: c.Error,
|
|
89
|
-
message:
|
|
90
|
-
}),
|
|
87
|
+
message: o("newsletter.already-in-progress")
|
|
88
|
+
}), r;
|
|
91
89
|
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
|
|
92
90
|
const n = e.match(/({%(.*?)%})/g);
|
|
93
|
-
let
|
|
91
|
+
let r = !0;
|
|
94
92
|
return n !== null && !p.value && n.forEach((a) => {
|
|
95
93
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
96
94
|
if (i && i.length > 0) {
|
|
97
|
-
const [
|
|
98
|
-
g(
|
|
95
|
+
const [l] = i;
|
|
96
|
+
g(l) && !t.includes(l) && (s({
|
|
99
97
|
type: c.Warning,
|
|
100
|
-
message:
|
|
101
|
-
}),
|
|
98
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
99
|
+
}), r = !1);
|
|
102
100
|
}
|
|
103
|
-
}),
|
|
101
|
+
}), r;
|
|
104
102
|
}, R = async (e, t, n) => {
|
|
105
|
-
const
|
|
106
|
-
return S(e, t) &&
|
|
103
|
+
const r = n ? await C(e) : !0;
|
|
104
|
+
return S(e, t) && r;
|
|
107
105
|
}, _ = (e) => e.length > 0 ? !0 : (s({
|
|
108
106
|
type: c.Warning,
|
|
109
|
-
message:
|
|
107
|
+
message: o("newsletter.html-content-is-empty")
|
|
110
108
|
}), !1), A = (e) => {
|
|
111
109
|
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
112
110
|
return t > n && s({
|
|
113
111
|
type: c.Warning,
|
|
114
|
-
message:
|
|
112
|
+
message: o("custom-fields.missing-closing-braces")
|
|
115
113
|
}), t < n && s({
|
|
116
114
|
type: c.Warning,
|
|
117
|
-
message:
|
|
115
|
+
message: o("custom-fields.missing-opening-braces")
|
|
118
116
|
}), t === n;
|
|
119
117
|
}, O = (e) => {
|
|
120
|
-
const t =
|
|
118
|
+
const t = Ce(e).length === 0;
|
|
121
119
|
return t || s({
|
|
122
120
|
type: c.Warning,
|
|
123
|
-
message:
|
|
121
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
124
122
|
}), t;
|
|
125
|
-
}, b = (e, t, n,
|
|
123
|
+
}, b = (e, t, n, r) => {
|
|
126
124
|
if (p.value)
|
|
127
125
|
return !0;
|
|
128
|
-
const a =
|
|
126
|
+
const a = Ee(
|
|
129
127
|
e,
|
|
130
128
|
t,
|
|
131
|
-
|
|
129
|
+
ue(e),
|
|
132
130
|
n,
|
|
133
|
-
|
|
131
|
+
r
|
|
134
132
|
);
|
|
135
133
|
if (a.length > 0) {
|
|
136
134
|
const i = `
|
|
137
135
|
<ul>
|
|
138
|
-
${a.map((
|
|
136
|
+
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
139
137
|
</ul>
|
|
140
138
|
`;
|
|
141
139
|
return s({
|
|
142
140
|
type: c.Error,
|
|
143
|
-
message:
|
|
141
|
+
message: o("custom-fields.invalid-custom-fields") + i
|
|
144
142
|
}), !1;
|
|
145
143
|
}
|
|
146
144
|
return !0;
|
|
147
145
|
}, w = (e) => {
|
|
148
146
|
const t = e.match(G), n = [];
|
|
149
|
-
let
|
|
147
|
+
let r = !0;
|
|
150
148
|
if (t && t.forEach((a) => {
|
|
151
|
-
const i = a.match(H),
|
|
152
|
-
(!i || a !== v) && !
|
|
149
|
+
const i = a.match(H), l = a.match(K), v = (i == null ? void 0 : i.join("")) || "";
|
|
150
|
+
(!i || a !== v) && !l && (s({
|
|
153
151
|
type: c.Error,
|
|
154
|
-
message:
|
|
155
|
-
}),
|
|
152
|
+
message: o("newsletter.display-conditions-invalid-syntax")
|
|
153
|
+
}), r = !1), i && i.forEach((h) => {
|
|
156
154
|
h.trim() === "=" && (s({
|
|
157
155
|
type: c.Error,
|
|
158
|
-
message:
|
|
159
|
-
}),
|
|
156
|
+
message: o("custom-conditions.wrong-equality-operators")
|
|
157
|
+
}), r = !1);
|
|
160
158
|
const T = h.match(/^[a-zA-Z]*$/g);
|
|
161
159
|
T && T.forEach((I) => {
|
|
162
160
|
y(I) && n.push(I);
|
|
163
161
|
});
|
|
164
162
|
});
|
|
165
163
|
}), n.length) {
|
|
166
|
-
const a = n.filter((
|
|
164
|
+
const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
|
|
167
165
|
a.length !== i.length && (s({
|
|
168
166
|
type: c.Error,
|
|
169
|
-
message:
|
|
170
|
-
}),
|
|
167
|
+
message: o("custom-conditions.missing-if-endif-tag")
|
|
168
|
+
}), r = !1);
|
|
171
169
|
}
|
|
172
|
-
return
|
|
170
|
+
return r;
|
|
173
171
|
}, N = (e) => {
|
|
174
|
-
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length,
|
|
175
|
-
return
|
|
172
|
+
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
|
|
173
|
+
return r || s({
|
|
176
174
|
type: c.Warning,
|
|
177
|
-
message:
|
|
178
|
-
}),
|
|
179
|
-
}, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n,
|
|
175
|
+
message: o("custom-conditions.no-space-after-braces")
|
|
176
|
+
}), r;
|
|
177
|
+
}, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
180
178
|
type: c.Warning,
|
|
181
|
-
message:
|
|
179
|
+
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
182
180
|
}), !1) : !0, B = () => {
|
|
183
181
|
if (!u.hasInvalidBlock())
|
|
184
182
|
return !0;
|
|
185
183
|
const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === te);
|
|
186
184
|
return s({
|
|
187
185
|
type: t ? c.Warning : c.Error,
|
|
188
|
-
message:
|
|
186
|
+
message: o(t ? ne : se)
|
|
189
187
|
}), !1;
|
|
190
|
-
},
|
|
188
|
+
}, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
191
189
|
type: c.Error,
|
|
192
|
-
message:
|
|
193
|
-
}), !1) : !0,
|
|
190
|
+
message: o("newsletter.fill-all-necessary-fields")
|
|
191
|
+
}), !1) : !0, x = (e) => {
|
|
194
192
|
const t = /src="[^"]*\.(svg|pst)"/gm;
|
|
195
193
|
return e.match(t) === null ? !0 : (s({
|
|
196
194
|
type: c.Error,
|
|
197
|
-
message:
|
|
195
|
+
message: o("newsletter.invalid-image-type")
|
|
198
196
|
}), !1);
|
|
199
197
|
}, D = (e) => {
|
|
200
|
-
const
|
|
201
|
-
return Array.from(
|
|
202
|
-
var
|
|
203
|
-
return !((
|
|
198
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(q);
|
|
199
|
+
return Array.from(r).find((i) => {
|
|
200
|
+
var l;
|
|
201
|
+
return !((l = i.id) != null && l.trim());
|
|
204
202
|
}) ? (s({
|
|
205
203
|
type: c.Error,
|
|
206
|
-
message:
|
|
204
|
+
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
207
205
|
}), !1) : !0;
|
|
208
206
|
}, k = (e) => {
|
|
209
|
-
const
|
|
210
|
-
return Array.from(
|
|
211
|
-
var
|
|
212
|
-
return !((
|
|
207
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Z);
|
|
208
|
+
return Array.from(r).find((i) => {
|
|
209
|
+
var l;
|
|
210
|
+
return !((l = i.id) != null && l.trim());
|
|
213
211
|
}) ? (s({
|
|
214
212
|
type: c.Error,
|
|
215
|
-
message:
|
|
213
|
+
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
216
214
|
}), !1) : !0;
|
|
217
215
|
};
|
|
218
216
|
return { validateHtml: async (e, t, n = !1) => {
|
|
219
217
|
var v, h;
|
|
220
|
-
const
|
|
218
|
+
const r = [
|
|
221
219
|
...t.map((T) => T.value),
|
|
222
220
|
...z,
|
|
223
221
|
...((h = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
224
222
|
], a = M(e), i = await E(a);
|
|
225
|
-
return await R(e,
|
|
223
|
+
return await R(e, r, n) && _(e) && A(e) && O(e) && b(e, r, a, i) && w(e) && N(e) && L(e) && B() && F() && x(e) && D(e) && k(e);
|
|
226
224
|
} };
|
|
227
225
|
};
|
|
228
226
|
export {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
pe as buildPartnerAttributeNameSet,
|
|
228
|
+
Ee as findInvalidCustomFields,
|
|
229
|
+
Ce as getInvalidDynamicContentTags,
|
|
230
|
+
ue as getRecommendationBlockIds,
|
|
231
|
+
ge as parseRecommendationVariable,
|
|
232
|
+
Ve as useHtmlValidator
|
|
235
233
|
};
|