@useinsider/guido 3.19.0-beta.892c3ca → 3.19.0-beta.93d5923
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 +0 -1
- package/dist/@types/config/schemas.js +118 -107
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +77 -69
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +55 -90
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +11 -11
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +0 -2
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useSave.js +45 -90
- package/dist/composables/useStripo.js +24 -20
- package/dist/composables/useToaster.js +17 -15
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/config/compiler/itemsCompilerRules.js +13 -6
- package/dist/config/compiler/utils/itemsCompilerUtils.js +34 -17
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
- package/dist/enums/extensions/recommendationBlock.js +30 -29
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +219 -204
- package/dist/extensions/Blocks/Recommendation/block.js +15 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -4
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- 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 +2 -2
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +0 -21
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +5 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/stores/config.d.ts +20 -32
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +67 -84
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/templatePreparation.js +36 -39
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -49
- package/dist/composables/useSaveValidation.js +0 -282
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
- /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → base/AuthErrorModal.vue.d.ts} +0 -0
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import { RRS_CONFIG_VERSION as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { mapLegacyStrategy as
|
|
1
|
+
import { useActionsApi as R } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as k } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as N } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { RRS_CONFIG_VERSION as U, DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as I } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
+
import { mapLegacyStrategy as x } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
7
|
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { isPlainObject as
|
|
13
|
-
import { assignTrackingIds as
|
|
14
|
-
function
|
|
8
|
+
import { parsePageList as L } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as O } from "../stores/editor.js";
|
|
11
|
+
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
|
+
import { isPlainObject as v } from "./genericUtil.js";
|
|
13
|
+
import { assignTrackingIds as B } from "./linkTrackingIds.js";
|
|
14
|
+
function G(l) {
|
|
15
15
|
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
16
|
-
return i.forEach((
|
|
17
|
-
const r =
|
|
18
|
-
r && t.push(...
|
|
16
|
+
return i.forEach((s) => {
|
|
17
|
+
const r = s.getAttribute(A.PAGE_LIST);
|
|
18
|
+
r && t.push(...L(r));
|
|
19
19
|
}), [...new Set(t)];
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function M(l) {
|
|
22
22
|
const a = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
23
23
|
if (a.length === 0)
|
|
24
24
|
return;
|
|
25
|
-
const i =
|
|
25
|
+
const i = I();
|
|
26
26
|
a.forEach((t) => {
|
|
27
|
-
var d, g, f,
|
|
28
|
-
const
|
|
27
|
+
var d, g, f, c, y, S;
|
|
28
|
+
const s = t.getAttribute("recommendation-id"), r = s ? Number(s) : NaN;
|
|
29
29
|
if (!Number.isFinite(r))
|
|
30
30
|
return;
|
|
31
31
|
const p = t.getAttribute("esd-ext-config");
|
|
@@ -37,13 +37,13 @@ async function I(l) {
|
|
|
37
37
|
} catch {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
40
|
+
if (!v(e))
|
|
41
41
|
return;
|
|
42
|
-
const C = !!e.strategyId || (e.configVersion ?? 0) >=
|
|
42
|
+
const C = !!e.strategyId || (e.configVersion ?? 0) >= U, o = {
|
|
43
43
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
44
44
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
45
45
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
46
|
-
strategy:
|
|
46
|
+
strategy: x(e.strategy) || (C ? "" : n.strategy),
|
|
47
47
|
strategyId: e.strategyId ?? n.strategyId,
|
|
48
48
|
language: e.language ?? n.language,
|
|
49
49
|
size: e.size ?? n.size,
|
|
@@ -55,7 +55,7 @@ async function I(l) {
|
|
|
55
55
|
currencyCode: ((d = e.currency) == null ? void 0 : d.code) ?? m.code,
|
|
56
56
|
currencySymbol: ((g = e.currency) == null ? void 0 : g.symbol) ?? m.symbol,
|
|
57
57
|
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? m.alignment,
|
|
58
|
-
currencyDecimalCount: ((
|
|
58
|
+
currencyDecimalCount: ((c = e.currency) == null ? void 0 : c.decimalCount) ?? m.decimalCount,
|
|
59
59
|
currencyDecimalSeparator: ((y = e.currency) == null ? void 0 : y.decimalSeparator) ?? m.decimalSeparator,
|
|
60
60
|
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? m.thousandSeparator
|
|
61
61
|
};
|
|
@@ -71,39 +71,39 @@ async function I(l) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
const re = () => {
|
|
74
|
-
const l =
|
|
74
|
+
const l = z(), u = O(), a = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = R(), { compileHtml: r, compileAmpHtml: p } = N(), { isFeatureEnabled: e } = k();
|
|
75
75
|
return {
|
|
76
76
|
prepareTemplateDetails: async () => {
|
|
77
77
|
let { html: o, css: d, syncModulesIds: g = [] } = await t();
|
|
78
78
|
if (e("linkTrackingIds"))
|
|
79
79
|
try {
|
|
80
|
-
const { html: b, changed:
|
|
81
|
-
u.trackIdSessionFloor = H,
|
|
80
|
+
const { html: b, changed: F, nextSeq: H } = B(o, u.trackIdSessionFloor);
|
|
81
|
+
u.trackIdSessionFloor = H, F && (o = b, await s(b, d));
|
|
82
82
|
} catch (b) {
|
|
83
83
|
console.error("Tracking-id step failed, saving anyway:", b);
|
|
84
84
|
}
|
|
85
|
-
const { html: f, ampHtml:
|
|
85
|
+
const { html: f, ampHtml: c = "", ampErrors: y = [] } = await i({
|
|
86
86
|
minimize: !0,
|
|
87
87
|
resetDataSavedFlag: !1
|
|
88
88
|
});
|
|
89
|
-
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await
|
|
90
|
-
const { compiledHtml: S, stats: h, appliedRules:
|
|
89
|
+
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(o);
|
|
90
|
+
const { compiledHtml: S, stats: h, appliedRules: w } = r(f), D = c && p(c).compiledHtml, E = l.getSelectedDynamicContentList, P = I(), T = G(o);
|
|
91
91
|
return console.debug("HTML Compilation Stats:", {
|
|
92
92
|
originalSize: h.originalSize,
|
|
93
93
|
compiledSize: h.compiledSize,
|
|
94
94
|
reduction: `${h.reductionPercentage.toFixed(2)}%`,
|
|
95
|
-
appliedRules:
|
|
95
|
+
appliedRules: w,
|
|
96
96
|
executionTime: `${h.executionTime.toFixed(2)}ms`
|
|
97
97
|
}), {
|
|
98
|
-
dynamicContentList:
|
|
98
|
+
dynamicContentList: E,
|
|
99
99
|
compiledHtml: S,
|
|
100
100
|
rawHtml: o,
|
|
101
101
|
css: d,
|
|
102
|
-
ampHtml:
|
|
102
|
+
ampHtml: D,
|
|
103
103
|
ampErrors: y,
|
|
104
104
|
modules: g.map(Number),
|
|
105
105
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
106
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
107
107
|
configs: {}
|
|
108
108
|
},
|
|
109
109
|
unsubscribe: {
|
|
@@ -111,13 +111,10 @@ const re = () => {
|
|
|
111
111
|
config: T
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
}
|
|
115
|
-
// Exposed so the back/test validate-only path can seed the reco store the
|
|
116
|
-
// same way a full save does (required-field findings depend on it).
|
|
117
|
-
hydrateRecommendationStore: I
|
|
114
|
+
}
|
|
118
115
|
};
|
|
119
116
|
};
|
|
120
117
|
export {
|
|
121
|
-
|
|
118
|
+
G as getHtmlReferencedUnsubscribePages,
|
|
122
119
|
re as useTemplatePreparation
|
|
123
120
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.19.0-beta.
|
|
3
|
+
"version": "3.19.0-beta.93d5923",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import a from "./ValidationErrorDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var i = function() {
|
|
5
|
-
var o = this, r = o._self._c, t = o._self._setupProxy;
|
|
6
|
-
return r(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [r("div", { staticClass: "d-f f-d-c validation-error-list" }, o._l(t.rows, function(e, n) {
|
|
7
|
-
return r("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [r(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), r("span", { staticClass: "validation-error-row__text", domProps: { innerHTML: o._s(e) } })], 1);
|
|
8
|
-
}), 0)]);
|
|
9
|
-
}, l = [], d = /* @__PURE__ */ s(
|
|
10
|
-
a,
|
|
11
|
-
i,
|
|
12
|
-
l,
|
|
13
|
-
!1,
|
|
14
|
-
null,
|
|
15
|
-
"c5ff3804"
|
|
16
|
-
);
|
|
17
|
-
const u = d.exports;
|
|
18
|
-
export {
|
|
19
|
-
u as default
|
|
20
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineComponent as p, ref as c, computed as a } from "vue";
|
|
2
|
-
import f from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useSave as S } from "../../../composables/useSave.js";
|
|
4
|
-
import { useTranslations as v } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { useConfigStore as g } from "../../../stores/config.js";
|
|
6
|
-
import { useEditorStore as y } from "../../../stores/editor.js";
|
|
7
|
-
import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
|
|
8
|
-
import { escapeHtml as w } from "../../../utils/htmlEscape.js";
|
|
9
|
-
import { InIcons as _ } from "@useinsider/design-system-vue";
|
|
10
|
-
const V = /* @__PURE__ */ p({
|
|
11
|
-
__name: "ValidationErrorDrawer",
|
|
12
|
-
setup(C) {
|
|
13
|
-
const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = c(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
|
|
14
|
-
const t = {
|
|
15
|
-
primaryButton: {
|
|
16
|
-
styling: "solid",
|
|
17
|
-
type: "primary",
|
|
18
|
-
labelText: r("email-editor.update-design")
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
|
|
22
|
-
styling: "solid",
|
|
23
|
-
type: "subtle-primary",
|
|
24
|
-
labelText: r("email-editor.save-and-continue"),
|
|
25
|
-
loadingStatus: o.value
|
|
26
|
-
}), t;
|
|
27
|
-
}), d = a(() => e.errors.map((t) => {
|
|
28
|
-
const m = t.detail ? ` (${w(t.detail)})` : "";
|
|
29
|
-
return `${t.message}${m}`;
|
|
30
|
-
}));
|
|
31
|
-
return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
|
|
32
|
-
e.isDrawerOpen && e.close();
|
|
33
|
-
}, handleSaveAndContinue: async () => {
|
|
34
|
-
if (!o.value) {
|
|
35
|
-
o.value = !0, n.loadingStatus = !0;
|
|
36
|
-
try {
|
|
37
|
-
await i() ? e.close() : n.loadingStatus = !1;
|
|
38
|
-
} catch (t) {
|
|
39
|
-
console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
|
|
40
|
-
} finally {
|
|
41
|
-
o.value = !1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, WpDrawer: f, InIcons: _ };
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
export {
|
|
48
|
-
V as default
|
|
49
|
-
};
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { getIgnoredRecommendationBlockIds as B } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
-
import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as Y, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
|
|
3
|
-
import { SaveValidationRule as o } from "../enums/save-validation.js";
|
|
4
|
-
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as M } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
|
-
import { itemsBlockDynamicVariables as U } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
-
import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
-
import { useRecommendationExtensionStore as W } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
-
import { getInvalidFields as G, STRATEGY_FIELD_KEY as q, RecommendationAssignStrategyKey as H, RecommendationRequiredFieldsKey as V } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
10
|
-
import { useConfigStore as X } from "../stores/config.js";
|
|
11
|
-
import { useDynamicContentStore as j } from "../stores/dynamic-content.js";
|
|
12
|
-
import { useRecommendationStore as z } from "../stores/recommendation.js";
|
|
13
|
-
import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
|
|
14
|
-
import { escapeHtml as $ } from "../utils/htmlEscape.js";
|
|
15
|
-
import { useTemplatePreparation as Q } from "../utils/templatePreparation.js";
|
|
16
|
-
import { useActionsApi as Z } from "./useActionsApi.js";
|
|
17
|
-
import { useConfig as J } from "./useConfig.js";
|
|
18
|
-
import { useHtmlCompiler as ee } from "./useHtmlCompiler.js";
|
|
19
|
-
import { buildPartnerAttributeNameSet as te, getInvalidDynamicContentTags as ne, getRecommendationBlockIds as ie, findInvalidCustomFields as oe } from "./useHtmlValidator.js";
|
|
20
|
-
import { useHttp as re } from "./useHttp.js";
|
|
21
|
-
import { useTranslations as se } from "./useTranslations.js";
|
|
22
|
-
import { findInvalidCouponBlocks as ae, COUPON_TAG_MODIFIED_KEY as ce } from "./validators/useCouponBlockValidator.js";
|
|
23
|
-
import { findDuplicateUnsubPageTypes as le, countUnsubBlocksWithoutPage as me, EMPTY_BLOCK_KEY as ue } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
-
const de = "newsletter.html-content-is-empty", pe = "custom-fields.missing-closing-braces", ge = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", fe = "newsletter.display-conditions-invalid-syntax", ye = "custom-conditions.wrong-equality-operators", Ee = "custom-conditions.missing-if-endif-tag", Ie = "custom-conditions.no-space-after-braces", Se = "custom-conditions.no-braces-inside-if-tag", _e = "newsletter.fill-all-necessary-fields", Ce = "newsletter.invalid-image-type", he = "unsubscribe-templates.select-checkbox-groups", ke = "unsubscribe-templates.select-radio-button-groups", Te = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body", Oe = /src="[^"]*\.(svg|pst)"/gm, R = /({%(.*?)%})/g, Re = ["if", "endif", "else", "elif", "now"], Le = (t) => !Re.includes(t.toLowerCase()), Ne = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
|
-
function be(t) {
|
|
26
|
-
return ae(t).map((i) => ({
|
|
27
|
-
rule: o.CouponTagModified,
|
|
28
|
-
type: r.Warning,
|
|
29
|
-
key: ce,
|
|
30
|
-
detail: i
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
function Ae(t) {
|
|
34
|
-
return le(t).map((i) => ({
|
|
35
|
-
rule: o.DuplicateUnsubBlock,
|
|
36
|
-
type: r.Error,
|
|
37
|
-
key: i.messageKey
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
function ve(t) {
|
|
41
|
-
return Array.from({ length: me(t) }, () => ({
|
|
42
|
-
rule: o.UnsubBlockMissingTemplate,
|
|
43
|
-
type: r.Warning,
|
|
44
|
-
key: ue
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
function De(t, i) {
|
|
48
|
-
const n = t.match(R);
|
|
49
|
-
if (!n)
|
|
50
|
-
return [];
|
|
51
|
-
const c = [];
|
|
52
|
-
return n.forEach((u) => {
|
|
53
|
-
const a = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
54
|
-
if (a && a.length > 0) {
|
|
55
|
-
const [d] = a;
|
|
56
|
-
Le(d) && !i.includes(d) && c.push({
|
|
57
|
-
rule: o.CustomFieldScript,
|
|
58
|
-
type: r.Warning,
|
|
59
|
-
key: I,
|
|
60
|
-
detail: d
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}), c;
|
|
64
|
-
}
|
|
65
|
-
function Ke(t) {
|
|
66
|
-
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: de }];
|
|
67
|
-
}
|
|
68
|
-
function we(t) {
|
|
69
|
-
const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
|
|
70
|
-
return i > n ? [{
|
|
71
|
-
rule: o.MismatchedBraces,
|
|
72
|
-
type: r.Warning,
|
|
73
|
-
key: pe
|
|
74
|
-
}] : i < n ? [{
|
|
75
|
-
rule: o.MismatchedBraces,
|
|
76
|
-
type: r.Warning,
|
|
77
|
-
key: ge
|
|
78
|
-
}] : [];
|
|
79
|
-
}
|
|
80
|
-
function Be(t) {
|
|
81
|
-
return ne(t).map((i) => ({
|
|
82
|
-
rule: o.InvalidDynamicTag,
|
|
83
|
-
type: r.Warning,
|
|
84
|
-
key: I,
|
|
85
|
-
detail: i
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
88
|
-
function Ye(t, i, n, c) {
|
|
89
|
-
const u = ie(t);
|
|
90
|
-
return oe(t, i, u, n, c).map((a) => ({
|
|
91
|
-
rule: o.InvalidCustomField,
|
|
92
|
-
type: r.Error,
|
|
93
|
-
key: I,
|
|
94
|
-
detail: a
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
function xe(t) {
|
|
98
|
-
const i = t.match(/{%(.*?)%}/g), n = [], c = [];
|
|
99
|
-
if (i && i.forEach((u) => {
|
|
100
|
-
const a = u.match(Y), d = u.match(x), E = (a == null ? void 0 : a.join("")) || "";
|
|
101
|
-
(!a || u !== E) && !d && c.push({
|
|
102
|
-
rule: o.ConditionsSyntax,
|
|
103
|
-
type: r.Error,
|
|
104
|
-
key: fe,
|
|
105
|
-
detail: u
|
|
106
|
-
}), a && a.forEach((g) => {
|
|
107
|
-
g.trim() === "=" && c.push({
|
|
108
|
-
rule: o.WrongEqualityOperator,
|
|
109
|
-
type: r.Error,
|
|
110
|
-
key: ye
|
|
111
|
-
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
112
|
-
Ne(f) && n.push(f);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}), n.length) {
|
|
116
|
-
const u = n.filter((d) => d === "if").length, a = n.filter((d) => d === "endif").length;
|
|
117
|
-
u !== a && c.push({
|
|
118
|
-
rule: o.MissingIfEndif,
|
|
119
|
-
type: r.Error,
|
|
120
|
-
key: Ee
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return c;
|
|
124
|
-
}
|
|
125
|
-
function Me(t) {
|
|
126
|
-
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
127
|
-
return i === n ? [] : [{
|
|
128
|
-
rule: o.ConditionTagSpacing,
|
|
129
|
-
type: r.Warning,
|
|
130
|
-
key: Ie
|
|
131
|
-
}];
|
|
132
|
-
}
|
|
133
|
-
function Ue(t) {
|
|
134
|
-
return (t.match(R) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, c) => n + c, 0) === 0 ? [] : [{
|
|
135
|
-
rule: o.BracesInsideIfTag,
|
|
136
|
-
type: r.Warning,
|
|
137
|
-
key: Se
|
|
138
|
-
}];
|
|
139
|
-
}
|
|
140
|
-
function Pe(t) {
|
|
141
|
-
return (t.match(Oe) ?? []).map((i) => ({
|
|
142
|
-
rule: o.InvalidImageType,
|
|
143
|
-
type: r.Error,
|
|
144
|
-
key: Ce,
|
|
145
|
-
detail: i
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
function O(t, i, n, c) {
|
|
149
|
-
const u = new DOMParser().parseFromString(t, "text/html");
|
|
150
|
-
return Array.from(u.querySelectorAll(i)).filter((a) => {
|
|
151
|
-
var d;
|
|
152
|
-
return !((d = a.id) != null && d.trim());
|
|
153
|
-
}).map(() => ({ rule: n, type: r.Error, key: c }));
|
|
154
|
-
}
|
|
155
|
-
const dt = () => {
|
|
156
|
-
const { config: t, isFeatureEnabled: i } = J(), n = se(), { post: c } = re(), { getCompiledEmail: u, getTemplateData: a } = Z(), { compileHtml: d } = ee(), { hydrateRecommendationStore: E } = Q(), g = j(), f = z(), y = W(), L = X(), N = (e) => ({
|
|
157
|
-
rule: e.rule,
|
|
158
|
-
type: e.type,
|
|
159
|
-
detail: e.detail,
|
|
160
|
-
message: "key" in e ? n(e.key) : $(e.message)
|
|
161
|
-
}), b = async (e) => {
|
|
162
|
-
if (e.size === 0)
|
|
163
|
-
return /* @__PURE__ */ new Set();
|
|
164
|
-
try {
|
|
165
|
-
await y.fetchRecommendationFilters();
|
|
166
|
-
} catch {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return te(y.filterList);
|
|
170
|
-
}, A = async (e) => {
|
|
171
|
-
try {
|
|
172
|
-
const l = await c(Fe, { html: T(e) }), { status: s, message: m } = l.data, p = [];
|
|
173
|
-
return s || p.push({
|
|
174
|
-
rule: o.InvalidLinks,
|
|
175
|
-
type: r.Error,
|
|
176
|
-
// status===undefined means a bare message instead of a boolean; surface it,
|
|
177
|
-
// but fall back to the canned key when it's missing so a malformed body
|
|
178
|
-
// never renders a literal 'undefined' row (SD-147430).
|
|
179
|
-
...s === void 0 && m ? { message: m } : { key: Te }
|
|
180
|
-
}), m === n(k) && p.push({
|
|
181
|
-
rule: o.LinkCheckInProgress,
|
|
182
|
-
type: r.Error,
|
|
183
|
-
key: k
|
|
184
|
-
}), p;
|
|
185
|
-
} catch (l) {
|
|
186
|
-
return console.warn("Link-check collector failed; skipping the link rule.", l), [];
|
|
187
|
-
}
|
|
188
|
-
}, v = async (e) => {
|
|
189
|
-
try {
|
|
190
|
-
const l = await c("/newsletter/contents/validate-syntax", [{
|
|
191
|
-
identifier: "default",
|
|
192
|
-
syntax: "liquid",
|
|
193
|
-
contents: {
|
|
194
|
-
subject: null,
|
|
195
|
-
preheader: null,
|
|
196
|
-
html: T(e),
|
|
197
|
-
ampHtml: null
|
|
198
|
-
}
|
|
199
|
-
}]);
|
|
200
|
-
if (!Array.isArray(l.data)) {
|
|
201
|
-
const m = l.data;
|
|
202
|
-
return [{
|
|
203
|
-
rule: o.LiquidSyntax,
|
|
204
|
-
type: r.Warning,
|
|
205
|
-
message: m.message ?? n(F)
|
|
206
|
-
}];
|
|
207
|
-
}
|
|
208
|
-
const [s] = l.data;
|
|
209
|
-
return Object.values((s == null ? void 0 : s.errors) ?? {}).map((m) => ({
|
|
210
|
-
rule: o.LiquidSyntax,
|
|
211
|
-
type: r.Warning,
|
|
212
|
-
message: m.replace(/^line \d+:\s*/, "")
|
|
213
|
-
}));
|
|
214
|
-
} catch {
|
|
215
|
-
return [{
|
|
216
|
-
rule: o.LiquidSyntax,
|
|
217
|
-
type: r.Error,
|
|
218
|
-
message: n(F)
|
|
219
|
-
}];
|
|
220
|
-
}
|
|
221
|
-
}, D = () => {
|
|
222
|
-
const e = Object.values(y.blockStates).map((s) => G(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
|
|
223
|
-
const m = s.every((p) => p === q);
|
|
224
|
-
return {
|
|
225
|
-
rule: o.RecommendationRequiredFields,
|
|
226
|
-
type: m ? r.Warning : r.Error,
|
|
227
|
-
key: m ? H : V
|
|
228
|
-
};
|
|
229
|
-
}), l = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((m) => m.value === "")).map(() => ({
|
|
230
|
-
rule: o.RecommendationFilters,
|
|
231
|
-
type: r.Error,
|
|
232
|
-
key: _e
|
|
233
|
-
}));
|
|
234
|
-
return [...e, ...l];
|
|
235
|
-
}, K = async (e, l) => {
|
|
236
|
-
var C, h;
|
|
237
|
-
const s = [
|
|
238
|
-
...l.map((w) => w.value),
|
|
239
|
-
...U,
|
|
240
|
-
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
241
|
-
], m = B(e), p = await b(m), { isTransactional: _ } = L;
|
|
242
|
-
return [
|
|
243
|
-
...await A(e),
|
|
244
|
-
..._ ? [] : De(e, s),
|
|
245
|
-
...Ke(e),
|
|
246
|
-
...we(e),
|
|
247
|
-
...Be(e),
|
|
248
|
-
..._ ? [] : Ye(e, s, m, p),
|
|
249
|
-
...xe(e),
|
|
250
|
-
...Me(e),
|
|
251
|
-
...Ue(e),
|
|
252
|
-
...D(),
|
|
253
|
-
...Pe(e),
|
|
254
|
-
...O(
|
|
255
|
-
e,
|
|
256
|
-
M,
|
|
257
|
-
o.CheckboxUnsubGroup,
|
|
258
|
-
he
|
|
259
|
-
),
|
|
260
|
-
...O(
|
|
261
|
-
e,
|
|
262
|
-
P,
|
|
263
|
-
o.RadioButtonUnsubGroup,
|
|
264
|
-
ke
|
|
265
|
-
)
|
|
266
|
-
];
|
|
267
|
-
}, S = async (e, l) => [
|
|
268
|
-
...be(e),
|
|
269
|
-
...Ae(e),
|
|
270
|
-
...ve(e),
|
|
271
|
-
...i("liquidSyntax") ? await v(e) : await K(e, l)
|
|
272
|
-
].map(N);
|
|
273
|
-
return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
|
|
274
|
-
const { html: e } = await a();
|
|
275
|
-
await E(e);
|
|
276
|
-
const { html: l } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: s } = d(l);
|
|
277
|
-
return S(s, g.getSelectedDynamicContentList);
|
|
278
|
-
} };
|
|
279
|
-
};
|
|
280
|
-
export {
|
|
281
|
-
dt as useSaveValidation
|
|
282
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useConfigStore as t } from "../stores/config.js";
|
|
2
|
-
import { computed as o } from "vue";
|
|
3
|
-
const n = ["newsletteruatcamp", "newsletterqacamp"], c = () => {
|
|
4
|
-
const e = t();
|
|
5
|
-
return { isEnabled: o(() => n.includes(e.partnerName)) };
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
c as useSaveValidationRollout
|
|
9
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
|
|
2
|
-
export {
|
|
3
|
-
n as SaveValidationRule
|
|
4
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SaveValidationRule } from '@@/Enums/save-validation';
|
|
2
|
-
import type { ToasterTypeOptions } from '@@/Enums/toaster';
|
|
3
|
-
/** Which action triggered the validation run. Drives telemetry only in v1. */
|
|
4
|
-
export type SaveValidationIntent = 'save' | 'back' | 'test';
|
|
5
|
-
/**
|
|
6
|
-
* A single validation failure instance, one per drawer row. Names avoid the
|
|
7
|
-
* public `ValidationError` (config validation) collision — NOT exported from
|
|
8
|
-
* library.ts.
|
|
9
|
-
*/
|
|
10
|
-
export interface SaveValidationError {
|
|
11
|
-
/** Stable discriminator for tests and de-duplication. */
|
|
12
|
-
rule: SaveValidationRule;
|
|
13
|
-
/** Final HTML-safe display string — trans() output, or an escaped server message. */
|
|
14
|
-
message: string;
|
|
15
|
-
/** Raw user content (field name / tag / src) — not i18n. */
|
|
16
|
-
detail?: string;
|
|
17
|
-
/** Mirrors the legacy toaster severity. Kept for the discriminator/tests; the drawer renders a uniform icon and never reads it. */
|
|
18
|
-
type: ToasterTypeOptions;
|
|
19
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DynamicContent } from '@@/Types/generic';
|
|
2
|
-
import type { SaveValidationError } from '@@/Types/save-validation';
|
|
3
|
-
export declare const useSaveValidation: () => {
|
|
4
|
-
collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]) => Promise<SaveValidationError[]>;
|
|
5
|
-
validateCurrentTemplate: () => Promise<SaveValidationError[]>;
|
|
6
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stable discriminators for each save-validation rule site — one per rule that
|
|
3
|
-
* can produce a drawer row, kept in sync with the collector + legacy validator chains.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum SaveValidationRule {
|
|
6
|
-
CouponTagModified = "coupon-tag-modified",
|
|
7
|
-
DuplicateUnsubBlock = "duplicate-unsub-block",
|
|
8
|
-
UnsubBlockMissingTemplate = "unsub-block-missing-template",
|
|
9
|
-
LiquidSyntax = "liquid-syntax",
|
|
10
|
-
InvalidLinks = "invalid-links",
|
|
11
|
-
LinkCheckInProgress = "link-check-in-progress",
|
|
12
|
-
CustomFieldScript = "custom-field-script",
|
|
13
|
-
EmptyHtml = "empty-html",
|
|
14
|
-
MismatchedBraces = "mismatched-braces",
|
|
15
|
-
InvalidDynamicTag = "invalid-dynamic-tag",
|
|
16
|
-
InvalidCustomField = "invalid-custom-field",
|
|
17
|
-
ConditionsSyntax = "conditions-syntax",
|
|
18
|
-
WrongEqualityOperator = "wrong-equality-operator",
|
|
19
|
-
MissingIfEndif = "missing-if-endif",
|
|
20
|
-
ConditionTagSpacing = "condition-tag-spacing",
|
|
21
|
-
BracesInsideIfTag = "braces-inside-if-tag",
|
|
22
|
-
RecommendationRequiredFields = "recommendation-required-fields",
|
|
23
|
-
RecommendationFilters = "recommendation-filters",
|
|
24
|
-
InvalidImageType = "invalid-image-type",
|
|
25
|
-
CheckboxUnsubGroup = "checkbox-unsub-group",
|
|
26
|
-
RadioButtonUnsubGroup = "radio-button-unsub-group"
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { SaveValidationError, SaveValidationIntent } from '@@/Types/save-validation';
|
|
2
|
-
interface SaveValidationState {
|
|
3
|
-
errors: SaveValidationError[];
|
|
4
|
-
isDrawerOpen: boolean;
|
|
5
|
-
intent: SaveValidationIntent | null;
|
|
6
|
-
}
|
|
7
|
-
export declare const useSaveValidationStore: import("pinia").StoreDefinition<"guidoSaveValidation", SaveValidationState, {
|
|
8
|
-
errorCount: (state: {
|
|
9
|
-
errors: {
|
|
10
|
-
rule: import("../enums/save-validation").SaveValidationRule;
|
|
11
|
-
message: string;
|
|
12
|
-
detail?: string | undefined;
|
|
13
|
-
type: import("../enums/toaster").ToasterTypeOptions;
|
|
14
|
-
}[];
|
|
15
|
-
isDrawerOpen: boolean;
|
|
16
|
-
intent: SaveValidationIntent | null;
|
|
17
|
-
} & import("pinia").PiniaCustomStateProperties<SaveValidationState>) => number;
|
|
18
|
-
}, {
|
|
19
|
-
open(errors: SaveValidationError[], intent: SaveValidationIntent): void;
|
|
20
|
-
close(): void;
|
|
21
|
-
}>;
|
|
22
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineStore as n } from "pinia";
|
|
2
|
-
function i(e) {
|
|
3
|
-
const t = /* @__PURE__ */ new Set();
|
|
4
|
-
return e.filter((r) => {
|
|
5
|
-
const s = JSON.stringify([r.rule, r.message, r.detail ?? ""]);
|
|
6
|
-
return t.has(s) ? !1 : (t.add(s), !0);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
const o = n("guidoSaveValidation", {
|
|
10
|
-
state: () => ({
|
|
11
|
-
errors: [],
|
|
12
|
-
isDrawerOpen: !1,
|
|
13
|
-
intent: null
|
|
14
|
-
}),
|
|
15
|
-
getters: {
|
|
16
|
-
errorCount: (e) => e.errors.length
|
|
17
|
-
},
|
|
18
|
-
actions: {
|
|
19
|
-
open(e, t) {
|
|
20
|
-
this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
|
|
21
|
-
},
|
|
22
|
-
// Errors are retained so rows don't blank during the ~300ms close animation.
|
|
23
|
-
close() {
|
|
24
|
-
this.isDrawerOpen = !1;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export {
|
|
29
|
-
o as useSaveValidationStore
|
|
30
|
-
};
|
|
File without changes
|