@useinsider/guido 3.19.0 → 3.20.0-beta.05ce01c
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 +22 -3
- package/dist/@types/config/schemas.js +76 -53
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +105 -89
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -8
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -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 +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +83 -48
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- 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/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +50 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- 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/useActionsApi.js +52 -47
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +44 -42
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +89 -82
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +65 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useSave.js +93 -45
- package/dist/composables/useSaveValidation.js +284 -0
- package/dist/composables/useSaveValidationRollout.js +20 -0
- package/dist/composables/useStripo.js +43 -39
- 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/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- 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 +51 -34
- package/dist/enums/save-validation.js +4 -0
- 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 +65 -45
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -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/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- 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/services/settingsApi.js +11 -0
- package/dist/src/@types/config/schemas.d.ts +36 -0
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- 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/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- 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/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useConfig.d.ts +8 -0
- 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 +21 -0
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +4 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -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 +7 -1
- package/dist/src/enums/save-validation.d.ts +27 -0
- 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/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/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -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/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/config.d.ts +374 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +812 -10
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -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 +113 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +55 -24
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +50 -36
- package/dist/stores/save-validation.js +30 -0
- package/dist/stores/setup-settings.js +10 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +54 -51
- package/package.json +2 -1
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
|
-
import { useToasterStore as
|
|
3
|
-
import {
|
|
4
|
-
const p = () => {
|
|
5
|
-
const o =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
t && (clearTimeout(t), t = null);
|
|
2
|
+
import { useToasterStore as u } from "../stores/toaster.js";
|
|
3
|
+
import { nextTick as c } from "vue";
|
|
4
|
+
const s = /* @__PURE__ */ new WeakMap(), p = () => {
|
|
5
|
+
const t = u(), o = () => {
|
|
6
|
+
const e = s.get(t);
|
|
7
|
+
e && (clearTimeout(e), s.delete(t));
|
|
9
8
|
};
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
function i(e = { message: "" }) {
|
|
10
|
+
o(), t.hideToaster(), c(() => {
|
|
11
|
+
t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
|
|
12
|
+
t.hideToaster(), o();
|
|
13
|
+
}, 6e3));
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
16
|
+
function n() {
|
|
17
|
+
o(), t.hideToaster();
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function a(e, r) {
|
|
20
|
+
if (e != null && e.authReported)
|
|
21
|
+
return;
|
|
19
22
|
const m = e instanceof Error ? e.message : String(e);
|
|
20
|
-
|
|
23
|
+
i({ type: T.Error, message: `${r}: ${m}` });
|
|
21
24
|
}
|
|
22
|
-
return
|
|
23
|
-
() => o.shouldAutoHide,
|
|
24
|
-
(e) => {
|
|
25
|
-
s(), e && (t = setTimeout(() => {
|
|
26
|
-
o.hideToaster(), s();
|
|
27
|
-
}, 6e3));
|
|
28
|
-
}
|
|
29
|
-
), { showToaster: r, hideToaster: i, handleError: n };
|
|
25
|
+
return { showToaster: i, hideToaster: n, handleError: a };
|
|
30
26
|
};
|
|
31
27
|
export {
|
|
32
28
|
p as useToaster
|
|
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
|
|
|
6
6
|
const useTranslations = () => {
|
|
7
7
|
var o, e;
|
|
8
8
|
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
-
|
|
9
|
+
var s;
|
|
10
|
+
const r = (s = translations.value) == null ? void 0 : s[t];
|
|
10
11
|
return r ? n ? Object.entries(n).reduce(
|
|
11
|
-
(
|
|
12
|
+
(i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
|
|
12
13
|
r
|
|
13
14
|
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
14
15
|
};
|
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useVersionHistoryStore as m } from "../stores/version-history.js";
|
|
3
|
+
import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
|
|
4
|
+
import { useToaster as V } from "./useToaster.js";
|
|
5
|
+
const d = () => {
|
|
6
|
+
const n = m(), { showToaster: i } = V(), o = (e) => {
|
|
7
|
+
var s;
|
|
8
|
+
const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
|
|
9
|
+
if (!r) {
|
|
10
|
+
i({ type: t.Error, message: y });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
e(r);
|
|
14
|
+
}, p = (e) => {
|
|
15
|
+
n.$reset(), n.updateState(e);
|
|
16
|
+
}, a = () => {
|
|
17
|
+
n.$reset();
|
|
9
18
|
};
|
|
10
19
|
return {
|
|
11
20
|
openVersionHistory: () => {
|
|
12
|
-
|
|
21
|
+
o((e) => e.openVersionHistory(p, a));
|
|
13
22
|
},
|
|
14
23
|
closeVersionHistory: () => {
|
|
15
|
-
|
|
24
|
+
o((e) => e.closeVersionHistory());
|
|
16
25
|
},
|
|
17
26
|
switchToDesktopPreview: () => {
|
|
18
|
-
|
|
27
|
+
o((e) => e.switchToDesktopPreview());
|
|
19
28
|
},
|
|
20
29
|
switchToMobilePreview: () => {
|
|
21
|
-
|
|
30
|
+
o((e) => e.switchToMobilePreview());
|
|
22
31
|
},
|
|
23
32
|
previewVersion: (e) => {
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
o((r) => r.previewVersion(e, (s) => {
|
|
34
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
35
|
+
i({
|
|
27
36
|
type: t.Error,
|
|
28
|
-
message: `Error compiling email: ${
|
|
37
|
+
message: `Error compiling email: ${c}`
|
|
29
38
|
});
|
|
30
|
-
});
|
|
39
|
+
}));
|
|
31
40
|
},
|
|
32
41
|
restoreVersion: (e) => {
|
|
33
|
-
|
|
42
|
+
o((r) => r.restoreVersion(
|
|
34
43
|
e,
|
|
35
44
|
() => {
|
|
36
|
-
|
|
45
|
+
i({
|
|
37
46
|
type: t.Success,
|
|
38
47
|
message: "Your version has been restored successfully."
|
|
39
48
|
});
|
|
40
49
|
},
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
|
|
50
|
+
(s) => {
|
|
51
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
52
|
+
i({
|
|
44
53
|
type: t.Error,
|
|
45
|
-
message: `Error compiling email: ${
|
|
54
|
+
message: `Error compiling email: ${c}`
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
|
-
);
|
|
57
|
+
));
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
};
|
|
52
61
|
export {
|
|
53
|
-
|
|
62
|
+
d as useVersionHistoryApi
|
|
54
63
|
};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { COUPON_PLACEHOLDER_DEFAULT as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
]),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { ToasterTypeOptions as n } from "../../enums/toaster.js";
|
|
2
|
+
import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
3
|
+
import { useToaster as i } from "../useToaster.js";
|
|
4
|
+
import { useTranslations as l } from "../useTranslations.js";
|
|
5
|
+
const c = /* @__PURE__ */ new Set([
|
|
6
|
+
s,
|
|
7
|
+
a
|
|
8
|
+
]), p = "newsletter.coupon-tag-modified";
|
|
9
|
+
function u(r) {
|
|
10
|
+
const e = new DOMParser().parseFromString(r, "text/html");
|
|
11
|
+
return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
|
|
12
|
+
var t;
|
|
13
|
+
return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
|
|
14
|
+
}).filter((o) => !c.has(o));
|
|
15
|
+
}
|
|
16
|
+
const T = () => {
|
|
17
|
+
const { showToaster: r } = i(), e = l();
|
|
18
|
+
return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
|
|
19
|
+
type: n.Warning,
|
|
20
|
+
message: e(p)
|
|
21
|
+
}), !1) : !0 };
|
|
21
22
|
};
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
p as COUPON_TAG_MODIFIED_KEY,
|
|
25
|
+
u as findInvalidCouponBlocks,
|
|
26
|
+
T as useCouponBlockValidator
|
|
24
27
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as r } from "../../enums/toaster.js";
|
|
2
2
|
import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
|
|
3
3
|
import { useHttp as d } from "../useHttp.js";
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
4
|
+
import { useToaster as p } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as c } from "../useTranslations.js";
|
|
6
6
|
const v = () => {
|
|
7
|
-
const { post: i } = d(), { showToaster:
|
|
7
|
+
const { post: i } = d(), { showToaster: t } = p(), s = c();
|
|
8
8
|
return { validateLiquidSyntax: async (o) => {
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
10
|
+
const e = await i("/newsletter/contents/validate-syntax", [{
|
|
11
11
|
identifier: "default",
|
|
12
12
|
syntax: "liquid",
|
|
13
13
|
contents: {
|
|
@@ -17,21 +17,21 @@ const v = () => {
|
|
|
17
17
|
ampHtml: null
|
|
18
18
|
}
|
|
19
19
|
}]);
|
|
20
|
-
if (!Array.isArray(
|
|
21
|
-
const l =
|
|
22
|
-
return
|
|
23
|
-
type:
|
|
20
|
+
if (!Array.isArray(e.data)) {
|
|
21
|
+
const l = e.data;
|
|
22
|
+
return t({
|
|
23
|
+
type: r.Warning,
|
|
24
24
|
message: l.message ?? s("journey-builder.liquid-validation-failed")
|
|
25
25
|
}), !1;
|
|
26
26
|
}
|
|
27
|
-
const [
|
|
28
|
-
return n.length ? (
|
|
29
|
-
type:
|
|
27
|
+
const [a] = e.data, n = Object.values((a == null ? void 0 : a.errors) ?? {});
|
|
28
|
+
return n.length ? (t({
|
|
29
|
+
type: r.Warning,
|
|
30
30
|
message: n[0].replace(/^line \d+:\s*/, "")
|
|
31
31
|
}), !1) : !0;
|
|
32
|
-
} catch {
|
|
33
|
-
return e({
|
|
34
|
-
type:
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return e != null && e.authReported || t({
|
|
34
|
+
type: r.Error,
|
|
35
35
|
message: s("journey-builder.liquid-validation-failed")
|
|
36
36
|
}), !1;
|
|
37
37
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
2
|
import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
3
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as p } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as l } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -12,30 +12,37 @@ const T = [
|
|
|
12
12
|
pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
13
13
|
messageKey: "unsubscription-preference.duplicate-pref-center"
|
|
14
14
|
}
|
|
15
|
-
], g = "unsubscription-preference.duplicate-both",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
|
|
16
|
+
function m(r) {
|
|
17
|
+
const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
|
|
18
|
+
return s.querySelectorAll(i).forEach((n) => {
|
|
19
|
+
const e = Number(n.getAttribute(a.PAGE_TYPE));
|
|
20
|
+
t.set(e, (t.get(e) ?? 0) + 1);
|
|
21
|
+
}), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
|
|
22
|
+
}
|
|
23
|
+
function b(r) {
|
|
24
|
+
const s = new DOMParser().parseFromString(r, "text/html");
|
|
25
|
+
return Array.from(s.querySelectorAll(i)).filter((t) => {
|
|
26
|
+
const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
|
|
27
|
+
return !n || !e;
|
|
28
|
+
}).length;
|
|
29
|
+
}
|
|
30
|
+
const y = () => {
|
|
31
|
+
const { showToaster: r } = p(), s = l();
|
|
32
|
+
return { validateUnsubscribeBlockUniqueness: (e) => {
|
|
33
|
+
const o = m(e);
|
|
34
|
+
return o.length ? (r({
|
|
35
|
+
type: c.Error,
|
|
36
|
+
message: s(o.length > 1 ? g : o[0].messageKey)
|
|
27
37
|
}), !1) : !0;
|
|
28
|
-
}, validateUnsubscribeBlockHasTemplate: (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return !e || !s;
|
|
33
|
-
}) ? (c({
|
|
34
|
-
type: i.Warning,
|
|
35
|
-
message: p(b)
|
|
36
|
-
}), !1) : !0;
|
|
37
|
-
} };
|
|
38
|
+
}, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
|
|
39
|
+
type: c.Warning,
|
|
40
|
+
message: s(E)
|
|
41
|
+
}), !1) };
|
|
38
42
|
};
|
|
39
43
|
export {
|
|
40
|
-
|
|
44
|
+
E as EMPTY_BLOCK_KEY,
|
|
45
|
+
b as countUnsubBlocksWithoutPage,
|
|
46
|
+
m as findDuplicateUnsubPageTypes,
|
|
47
|
+
y as useUnsubscribeBlockValidator
|
|
41
48
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
3
|
-
import { migrateItemsBlock as
|
|
4
|
-
import { migrateProductNameLink as
|
|
5
|
-
import { migrateRadioButton as
|
|
6
|
-
import { migrateRecommendation as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { migrateCheckbox as i } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
|
|
3
|
+
import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
|
|
4
|
+
import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
|
|
5
|
+
import { migrateRadioButton as c } from "./radioButtonMigrator.js";
|
|
6
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
7
|
+
import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
|
|
8
|
+
import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
|
|
9
|
+
import { migrateSocialIcons as d } from "./socialIconMigrator.js";
|
|
10
|
+
import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
|
|
11
|
+
const h = async (r, t = {}, o) => {
|
|
12
|
+
let m = r;
|
|
13
|
+
return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
|
|
13
14
|
};
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
h as migrate
|
|
16
17
|
};
|