@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.
Files changed (151) hide show
  1. package/README.md +22 -3
  2. package/dist/@types/config/schemas.js +76 -53
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +105 -89
  5. package/dist/components/organisms/AutoSaveController.vue2.js +10 -8
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  8. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  9. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  10. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
  11. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  12. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  13. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
  14. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  15. package/dist/components/organisms/header/EditorActions.vue2.js +83 -48
  16. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  17. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  18. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  19. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  20. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  21. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  22. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  23. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  24. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +50 -0
  25. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  26. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  27. package/dist/components/wrappers/WpModal.vue.js +1 -1
  28. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  29. package/dist/composables/useActionsApi.js +52 -47
  30. package/dist/composables/useAuthError.js +52 -0
  31. package/dist/composables/useAutoSave.js +44 -42
  32. package/dist/composables/useCodeEditorApi.js +23 -9
  33. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  34. package/dist/composables/useCustomInterfaceAppearance.js +65 -51
  35. package/dist/composables/useEmailTemplateApplier.js +111 -50
  36. package/dist/composables/useHtmlCompiler.js +37 -26
  37. package/dist/composables/useHtmlValidator.js +89 -82
  38. package/dist/composables/useHttp.js +64 -54
  39. package/dist/composables/useLegacyStrategyConversion.js +65 -0
  40. package/dist/composables/useRecommendation.js +40 -35
  41. package/dist/composables/useSave.js +93 -45
  42. package/dist/composables/useSaveValidation.js +284 -0
  43. package/dist/composables/useSaveValidationRollout.js +20 -0
  44. package/dist/composables/useStripo.js +43 -39
  45. package/dist/composables/useToaster.js +18 -22
  46. package/dist/composables/useTranslations.js +3 -2
  47. package/dist/composables/useVersionHistoryApi.js +33 -24
  48. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  49. package/dist/composables/validators/useLiquidValidator.js +15 -15
  50. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  51. package/dist/config/migrator/index.js +14 -13
  52. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  53. package/dist/config/migrator/recommendationMigrator.js +28 -21
  54. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  55. package/dist/enums/extensions/recommendationBlock.js +51 -34
  56. package/dist/enums/save-validation.js +4 -0
  57. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  58. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  59. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  60. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  61. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  62. package/dist/extensions/Blocks/Items/template.js +219 -204
  63. package/dist/extensions/Blocks/Recommendation/block.js +65 -45
  64. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  65. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
  66. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
  67. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  68. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -92
  69. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  70. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  71. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  72. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  73. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  74. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  75. package/dist/guido.css +1 -1
  76. package/dist/services/recommendationApi.js +46 -37
  77. package/dist/services/settingsApi.js +11 -0
  78. package/dist/src/@types/config/schemas.d.ts +36 -0
  79. package/dist/src/@types/save-validation.d.ts +19 -0
  80. package/dist/src/components/Guido.vue.d.ts +17 -1
  81. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  82. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  83. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  84. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  85. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  86. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  87. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  88. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  89. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  90. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  91. package/dist/src/composables/useAuthError.d.ts +12 -0
  92. package/dist/src/composables/useAutoSave.d.ts +4 -1
  93. package/dist/src/composables/useConfig.d.ts +8 -0
  94. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  95. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  96. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  97. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  98. package/dist/src/composables/useHttp.d.ts +2 -0
  99. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  100. package/dist/src/composables/useSave.d.ts +6 -1
  101. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  102. package/dist/src/composables/useSaveValidationRollout.d.ts +4 -0
  103. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  104. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  105. package/dist/src/config/migrator/index.d.ts +2 -1
  106. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  107. package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
  108. package/dist/src/enums/save-validation.d.ts +27 -0
  109. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  110. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  111. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  112. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  113. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  114. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  115. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  116. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
  117. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  118. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
  119. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  120. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  121. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  122. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  123. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  124. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  125. package/dist/src/services/recommendationApi.d.ts +2 -1
  126. package/dist/src/services/settingsApi.d.ts +6 -0
  127. package/dist/src/stores/config.d.ts +374 -0
  128. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  129. package/dist/src/stores/onboarding.d.ts +812 -10
  130. package/dist/src/stores/recommendation.d.ts +5 -0
  131. package/dist/src/stores/save-validation.d.ts +22 -0
  132. package/dist/src/stores/setup-settings.d.ts +4 -0
  133. package/dist/src/utils/dateUtil.d.ts +10 -0
  134. package/dist/src/utils/genericUtil.d.ts +3 -0
  135. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  136. package/dist/src/utils/templatePreparation.d.ts +30 -0
  137. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  138. package/dist/static/assets/icons/line-info.svg.js +5 -0
  139. package/dist/static/styles/components/recommendation-strategy.css.js +113 -9
  140. package/dist/static/styles/components/skeleton.css.js +23 -0
  141. package/dist/static/styles/components/version-history.css.js +2 -6
  142. package/dist/stores/config.js +55 -24
  143. package/dist/stores/guido-email-editor.js +3 -1
  144. package/dist/stores/onboarding.js +50 -36
  145. package/dist/stores/save-validation.js +30 -0
  146. package/dist/stores/setup-settings.js +10 -0
  147. package/dist/stores/unsubscribe.js +3 -3
  148. package/dist/utils/pairProductVariables.js +71 -71
  149. package/dist/utils/stripoEditorApi.js +11 -0
  150. package/dist/utils/templatePreparation.js +54 -51
  151. package/package.json +2 -1
@@ -1,32 +1,28 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
- import { useToasterStore as c } from "../stores/toaster.js";
3
- import { watch as u, nextTick as f } from "vue";
4
- const p = () => {
5
- const o = c();
6
- let t = null;
7
- const s = () => {
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 r(e = { message: "" }) {
11
- s(), o.hideToaster(), f(() => {
12
- o.showToaster(e);
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 i() {
16
- s(), o.hideToaster();
16
+ function n() {
17
+ o(), t.hideToaster();
17
18
  }
18
- function n(e, a) {
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
- r({ type: T.Error, message: `${a}: ${m}` });
23
+ i({ type: T.Error, message: `${r}: ${m}` });
21
24
  }
22
- return u(
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
- const r = translations.value[t];
9
+ var s;
10
+ const r = (s = translations.value) == null ? void 0 : s[t];
10
11
  return r ? n ? Object.entries(n).reduce(
11
- (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
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 c } from "../stores/version-history.js";
3
- import { useToaster as w } from "./useToaster.js";
4
- const S = () => {
5
- const i = c(), { showToaster: s } = w(), n = (e) => {
6
- i.$reset(), i.updateState(e);
7
- }, p = () => {
8
- i.$reset();
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
- window.StripoEditorApi.versionHistoryApi.openVersionHistory(n, p);
21
+ o((e) => e.openVersionHistory(p, a));
13
22
  },
14
23
  closeVersionHistory: () => {
15
- window.StripoEditorApi.versionHistoryApi.closeVersionHistory();
24
+ o((e) => e.closeVersionHistory());
16
25
  },
17
26
  switchToDesktopPreview: () => {
18
- window.StripoEditorApi.versionHistoryApi.switchToDesktopPreview();
27
+ o((e) => e.switchToDesktopPreview());
19
28
  },
20
29
  switchToMobilePreview: () => {
21
- window.StripoEditorApi.versionHistoryApi.switchToMobilePreview();
30
+ o((e) => e.switchToMobilePreview());
22
31
  },
23
32
  previewVersion: (e) => {
24
- window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
25
- const r = o instanceof Error ? o.message : String(o);
26
- s({
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: ${r}`
37
+ message: `Error compiling email: ${c}`
29
38
  });
30
- });
39
+ }));
31
40
  },
32
41
  restoreVersion: (e) => {
33
- window.StripoEditorApi.versionHistoryApi.restoreVersion(
42
+ o((r) => r.restoreVersion(
34
43
  e,
35
44
  () => {
36
- s({
45
+ i({
37
46
  type: t.Success,
38
47
  message: "Your version has been restored successfully."
39
48
  });
40
49
  },
41
- (o) => {
42
- const r = o instanceof Error ? o.message : String(o);
43
- s({
50
+ (s) => {
51
+ const c = s instanceof Error ? s.message : String(s);
52
+ i({
44
53
  type: t.Error,
45
- message: `Error compiling email: ${r}`
54
+ message: `Error compiling email: ${c}`
46
55
  });
47
56
  }
48
- );
57
+ ));
49
58
  }
50
59
  };
51
60
  };
52
61
  export {
53
- S as useVersionHistoryApi
62
+ d as useVersionHistoryApi
54
63
  };
@@ -1,24 +1,27 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
- import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
- import { useToaster as m } from "../useToaster.js";
4
- import { useTranslations as p } from "../useTranslations.js";
5
- const u = /* @__PURE__ */ new Set([
6
- i,
7
- l
8
- ]), A = () => {
9
- const { showToaster: t } = m(), r = p();
10
- return { validateCouponBlockTags: (e) => {
11
- const n = new DOMParser().parseFromString(e, "text/html");
12
- return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
- var o;
14
- const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
- return !u.has(a);
16
- }) ? (t({
17
- type: c.Warning,
18
- message: r("newsletter.coupon-tag-modified")
19
- }), !1) : !0;
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
- A as useCouponBlockValidator
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 a } from "../../enums/toaster.js";
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 c } from "../useToaster.js";
5
- import { useTranslations as p } from "../useTranslations.js";
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: e } = c(), s = p();
7
+ const { post: i } = d(), { showToaster: t } = p(), s = c();
8
8
  return { validateLiquidSyntax: async (o) => {
9
9
  try {
10
- const t = await i("/newsletter/contents/validate-syntax", [{
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(t.data)) {
21
- const l = t.data;
22
- return e({
23
- type: a.Warning,
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 [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
28
- return n.length ? (e({
29
- type: a.Warning,
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: a.Error,
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 i } from "../../enums/toaster.js";
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 l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as E } from "../useToaster.js";
5
- import { useTranslations as m } from "../useTranslations.js";
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", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
- const { showToaster: c } = E(), p = m();
17
- return { validateUnsubscribeBlockUniqueness: (n) => {
18
- const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
- o.querySelectorAll(l).forEach((e) => {
20
- const s = Number(e.getAttribute(a.PAGE_TYPE));
21
- r.set(s, (r.get(s) ?? 0) + 1);
22
- });
23
- const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
- return t.length ? (c({
25
- type: i.Error,
26
- message: p(t.length > 1 ? g : t[0])
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: (n) => {
29
- const o = new DOMParser().parseFromString(n, "text/html");
30
- return Array.from(o.querySelectorAll(l)).some((t) => {
31
- const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
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
- P as useUnsubscribeBlockValidator
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 t } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
- import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
5
- import { migrateRadioButton as n } from "./radioButtonMigrator.js";
6
- import { migrateRecommendation as c } from "./recommendationMigrator.js";
7
- import { migrateRecommendationTitle as g } from "./recommendationTitleMigrator.js";
8
- import { migrateSocialIcons as p } from "./socialIconMigrator.js";
9
- import { migrateUnsubscribe as f } from "./unsubscribeMigrator.js";
10
- const C = async (o, r = {}) => {
11
- let m = o;
12
- return m = t(m), m = n(m), m = await f(m), m = i(m), m = c(m, r), m = g(m), m = e(m), m = a(m), m = p(m), m;
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
- C as migrate
16
+ h as migrate
16
17
  };