@useinsider/guido 3.2.0-beta.c2a858e → 3.2.0-beta.caa22bf

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 (90) hide show
  1. package/README.md +92 -0
  2. package/dist/@types/config/schemas.js +150 -94
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +88 -87
  5. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  7. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  8. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  9. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  10. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  11. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  12. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  13. package/dist/composables/useRecommendation.js +46 -26
  14. package/dist/composables/useRibbonOffset.js +21 -0
  15. package/dist/composables/useSave.js +21 -18
  16. package/dist/composables/useStripo.js +14 -16
  17. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  18. package/dist/config/compiler/recommendationCompilerRules.js +27 -27
  19. package/dist/config/migrator/index.js +9 -9
  20. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  21. package/dist/config/migrator/recommendation/extractors.js +27 -0
  22. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  23. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  24. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  25. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  26. package/dist/config/migrator/recommendationMigrator.js +74 -290
  27. package/dist/enums/extensions/recommendationBlock.js +2 -1
  28. package/dist/enums/onboarding.js +7 -2
  29. package/dist/extensions/Blocks/Recommendation/block.js +35 -32
  30. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  31. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
  32. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  33. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  34. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
  35. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  36. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  37. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  38. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  39. package/dist/guido.css +1 -1
  40. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
  41. package/dist/node_modules/valibot/dist/index.js +450 -235
  42. package/dist/package.json.js +1 -1
  43. package/dist/services/templateLibraryApi.js +5 -4
  44. package/dist/src/@types/config/defaults.d.ts +5 -1
  45. package/dist/src/@types/config/index.d.ts +3 -3
  46. package/dist/src/@types/config/schemas.d.ts +213 -0
  47. package/dist/src/@types/config/types.d.ts +9 -1
  48. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  49. package/dist/src/composables/useConfig.d.ts +56 -0
  50. package/dist/src/composables/useRecommendation.d.ts +10 -1
  51. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  52. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  53. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  54. package/dist/src/config/migrator/index.d.ts +2 -1
  55. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  56. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  57. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  58. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  59. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  60. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  61. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  62. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  63. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  64. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  65. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  66. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  67. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  68. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  69. package/dist/src/enums/onboarding.d.ts +6 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  71. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  72. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  73. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  74. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  75. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  76. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  77. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  78. package/dist/src/library.d.ts +1 -1
  79. package/dist/src/stores/config.d.ts +504 -0
  80. package/dist/src/stores/onboarding.d.ts +4 -0
  81. package/dist/src/utils/htmlEscape.d.ts +5 -0
  82. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  83. package/dist/stores/onboarding.js +4 -0
  84. package/dist/utils/htmlEscape.js +13 -0
  85. package/dist/utils/pairProductVariables.js +89 -88
  86. package/dist/utils/templatePreparation.js +72 -32
  87. package/package.json +7 -3
  88. package/dist/enums/displayConditions.js +0 -80
  89. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  90. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,74 +1,63 @@
1
- import { defineComponent as u, computed as a, watch as b } from "vue";
2
- import { useTranslations as m } from "../../../composables/useTranslations.js";
3
- import { useOnboardingStore as k } from "../../../stores/onboarding.js";
4
- import { InOnboard as B } from "@useinsider/design-system-vue";
5
- const y = /* @__PURE__ */ u({
1
+ import { defineComponent as l, computed as c, watch as g } from "vue";
2
+ import { useRibbonOffset as b } from "../../../composables/useRibbonOffset.js";
3
+ import { useTranslations as x } from "../../../composables/useTranslations.js";
4
+ import { useOnboardingStore as u } from "../../../stores/onboarding.js";
5
+ import { InOnboard as p } from "@useinsider/design-system-vue";
6
+ const O = /* @__PURE__ */ l({
6
7
  __name: "TextBlockOnboarding",
7
- setup(h) {
8
- const i = m(), o = k(), e = a(() => {
9
- const n = window.innerHeight - 128, r = Math.max(90, n * 0.15), s = Math.max(490, n * 0.71), d = 200, g = 40;
10
- return {
11
- settings: {
12
- top: `${r}px`,
13
- position: r + d + g > n ? "Right Bottom" : "Right Top"
14
- },
15
- dynamic: {
16
- top: `${s}px`,
17
- position: s + d + g > n ? "Right Bottom" : "Right Top"
18
- }
19
- };
20
- }), c = a(() => [
8
+ setup(k) {
9
+ const n = x(), o = u(), { getTopPosition: i } = b(), r = c(() => [
21
10
  {
22
11
  classes: "guido-text-block-onboarding-settings",
23
12
  right: "426px",
24
- top: e.value.settings.top,
25
- position: e.value.settings.position,
26
- title: i("email-editor.onboarding-text-block-title"),
27
- description: i("email-editor.onboarding-text-block-description"),
13
+ top: i(90),
14
+ position: "Right Top",
15
+ title: n("email-editor.onboarding-text-block-title"),
16
+ description: n("email-editor.onboarding-text-block-description"),
28
17
  imageSource: "",
29
18
  backButtonClick: () => {
30
19
  },
31
20
  nextButtonType: "text",
32
- nextButtonText: i("products.next"),
21
+ nextButtonText: n("products.next"),
33
22
  nextButtonClick: () => {
34
23
  o.next("textBlockOnboarding");
35
24
  }
36
25
  },
37
26
  {
38
27
  classes: "guido-text-block-onboarding-dynamic",
39
- right: "426px",
40
- top: e.value.dynamic.top,
41
- position: e.value.dynamic.position,
42
- title: i("email-editor.onboarding-dynamic-content-title"),
43
- description: i("email-editor.onboarding-dynamic-content-description"),
28
+ right: "409px",
29
+ top: i(607),
30
+ position: "Right Top",
31
+ title: n("email-editor.onboarding-dynamic-content-title"),
32
+ description: n("email-editor.onboarding-dynamic-content-description"),
44
33
  imageSource: "",
45
34
  backButtonType: "text",
46
- backButtonText: i("ds-steps.back"),
35
+ backButtonText: n("ds-steps.back"),
47
36
  backButtonClick: () => {
48
37
  o.previous("textBlockOnboarding");
49
38
  },
50
39
  nextButtonType: "text",
51
- nextButtonText: i("action-builder.ok"),
40
+ nextButtonText: n("action-builder.ok"),
52
41
  nextButtonClick: () => {
53
42
  o.close("textBlockOnboarding");
54
43
  }
55
44
  }
56
- ]), l = a(() => o.onboardings.textBlockOnboarding.config.length > 0 && o.onboardings.textBlockOnboarding.isActive), p = () => {
57
- var t, n;
58
- (n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.nextButtonClick) == null || n.call(t);
59
- }, x = () => {
60
- var t, n;
61
- (n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.backButtonClick) == null || n.call(t);
45
+ ]), a = c(() => o.onboardings.textBlockOnboarding.config.length > 0 && o.onboardings.textBlockOnboarding.isActive), s = () => {
46
+ var t, e;
47
+ (e = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.nextButtonClick) == null || e.call(t);
48
+ }, d = () => {
49
+ var t, e;
50
+ (e = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.backButtonClick) == null || e.call(t);
62
51
  };
63
- return b(
52
+ return g(
64
53
  () => o.isActive("textBlockOnboarding"),
65
54
  (t) => {
66
- t && o.setConfig("textBlockOnboarding", c.value);
55
+ t && o.setConfig("textBlockOnboarding", r.value);
67
56
  },
68
57
  { immediate: !0 }
69
- ), { __sfc: !0, trans: i, onboardingStore: o, dynamicPosition: e, onboardingCardsConfig: c, isVisible: l, handleNext: p, handleBack: x, InOnboard: B };
58
+ ), { __sfc: !0, trans: n, onboardingStore: o, getTopPosition: i, onboardingCardsConfig: r, isVisible: a, handleNext: s, handleBack: d, InOnboard: p };
70
59
  }
71
60
  });
72
61
  export {
73
- y as default
62
+ O as default
74
63
  };
@@ -1,15 +1,16 @@
1
- import { defineComponent as c, computed as e, watch as g } from "vue";
2
- import { useTranslations as b } from "../../../composables/useTranslations.js";
3
- import { useOnboardingStore as u } from "../../../stores/onboarding.js";
4
- import { InOnboard as l } from "@useinsider/design-system-vue";
5
- const C = /* @__PURE__ */ c({
1
+ import { defineComponent as g, computed as s, watch as b } from "vue";
2
+ import { useRibbonOffset as u } from "../../../composables/useRibbonOffset.js";
3
+ import { useTranslations as l } from "../../../composables/useTranslations.js";
4
+ import { useOnboardingStore as m } from "../../../stores/onboarding.js";
5
+ import { InOnboard as p } from "@useinsider/design-system-vue";
6
+ const k = /* @__PURE__ */ g({
6
7
  __name: "VersionHistoryOnboarding",
7
- setup(p) {
8
- const t = b(), n = u(), r = e(() => [
8
+ setup(f) {
9
+ const t = l(), n = m(), { getTopPosition: r } = u(), e = s(() => [
9
10
  {
10
11
  classes: "guido-version-history-onboarding",
11
12
  left: "409px",
12
- top: "192px",
13
+ top: r(192),
13
14
  position: "Left Top",
14
15
  title: t("email-editor.onboarding-version-history-title"),
15
16
  description: t("email-editor.onboarding-version-history-description"),
@@ -20,18 +21,18 @@ const C = /* @__PURE__ */ c({
20
21
  nextButtonText: t("action-builder.ok"),
21
22
  nextButtonClick: () => void n.close("versionHistoryOnboarding")
22
23
  }
23
- ]), s = e(() => n.onboardings.versionHistoryOnboarding.config.length > 0 && n.onboardings.versionHistoryOnboarding.isActive), a = () => {
24
+ ]), a = s(() => n.onboardings.versionHistoryOnboarding.config.length > 0 && n.onboardings.versionHistoryOnboarding.isActive), d = () => {
24
25
  var o, i;
25
26
  (i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.nextButtonClick) == null || i.call(o);
26
- }, d = () => {
27
+ }, c = () => {
27
28
  var o, i;
28
29
  (i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.backButtonClick) == null || i.call(o);
29
30
  };
30
- return g(() => n.onboardings.versionHistoryOnboarding.isActive, (o) => {
31
- o && n.setConfig("versionHistoryOnboarding", r.value);
32
- }, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, onboardingCardsConfig: r, isVisible: s, handleNext: a, handleBack: d, InOnboard: l };
31
+ return b(() => n.onboardings.versionHistoryOnboarding.isActive, (o) => {
32
+ o && n.setConfig("versionHistoryOnboarding", e.value);
33
+ }, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, getTopPosition: r, onboardingCardsConfig: e, isVisible: a, handleNext: d, handleBack: c, InOnboard: p };
33
34
  }
34
35
  });
35
36
  export {
36
- C as default
37
+ k as default
37
38
  };
@@ -1,21 +1,21 @@
1
- import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
1
+ import { RecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { useConfigStore as I } from "../stores/config.js";
6
- const N = () => ({
3
+ import { useRecommendationExtensionStore as m } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
+ import { useConfigStore as x } from "../stores/config.js";
6
+ const w = () => ({
7
7
  calculateCardWidth: ({
8
- mobileLeftPadding: i,
9
- mobileRightPadding: n,
10
- cardsInRow: o,
11
- unresponsive: a
8
+ mobileLeftPadding: s,
9
+ mobileRightPadding: a,
10
+ cardsInRow: c,
11
+ unresponsive: n
12
12
  }) => {
13
- const r = a ? o : 1, e = i + n + (r - 1) * b;
13
+ const r = n ? c : 1, e = s + a + (r - 1) * b;
14
14
  return (R - e) / r;
15
15
  },
16
- getRecommendationCampaignData: (i) => {
17
- const n = u(), o = Number(i), a = n.blockStates[o];
18
- if (!a)
16
+ getRecommendationCampaignData: (s) => {
17
+ const a = m(), c = Number(s), n = a.blockStates[c];
18
+ if (!n)
19
19
  return {
20
20
  textTrimming: !1,
21
21
  orientation: "vertical",
@@ -28,7 +28,7 @@ const N = () => ({
28
28
  discountBeforeTextValue: "",
29
29
  discountAfterTextValue: ""
30
30
  };
31
- const { recommendationConfigs: r } = a, e = r.orientation === "grid" ? "vertical" : "horizontal";
31
+ const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
32
32
  return {
33
33
  textTrimming: r.textTrimming,
34
34
  orientation: e,
@@ -42,19 +42,39 @@ const N = () => ({
42
42
  discountAfterTextValue: ""
43
43
  };
44
44
  },
45
- buildCampaignUrl: (i) => {
46
- var m;
47
- const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
48
- if (!r)
49
- return "";
50
- const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
51
- t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
52
- const f = e.filters.filter((s) => s.isValid), c = x(f);
53
- c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
54
- const d = `${p.RECOMMENDATION_API_URL}/v2/${l}?${t.toString()}`;
55
- return n.recommendationCampaignUrls[i] = d, d;
45
+ buildCampaignUrl: (s, a) => {
46
+ var l;
47
+ const c = m(), n = x(), r = Number(s);
48
+ let e;
49
+ if (a)
50
+ e = a;
51
+ else {
52
+ const i = c.blockStates[r];
53
+ if (!i)
54
+ return "";
55
+ const { recommendationConfigs: o } = i;
56
+ e = {
57
+ strategy: o.strategy,
58
+ language: o.language,
59
+ currencyCode: o.currencySettings.value,
60
+ size: o.size,
61
+ productIds: o.productIds,
62
+ filters: o.filters,
63
+ shuffleProducts: o.shuffleProducts
64
+ };
65
+ }
66
+ const f = ((l = I.find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
67
+ if (t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising") {
68
+ const i = parseInt(e.size) || 6;
69
+ t.set("productId", e.productIds.slice(0, i).join(","));
70
+ } else e.strategy === "similarViewed" && t.set("productId", "{itemId}");
71
+ e.strategy === "userBased" && t.set("userId", "{user_id}");
72
+ const g = e.filters.filter((i) => i.isValid), d = h(g);
73
+ d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
74
+ const p = decodeURIComponent(t.toString()), u = `${C.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
75
+ return c.recommendationCampaignUrls[s] = u, u;
56
76
  }
57
77
  });
58
78
  export {
59
- N as useRecommendation
79
+ w as useRecommendation
60
80
  };
@@ -0,0 +1,21 @@
1
+ import { RIBBON_SELECTOR as r } from "../enums/onboarding.js";
2
+ import { ref as f, onMounted as c, onBeforeUnmount as i } from "vue";
3
+ const m = () => {
4
+ const o = f(0);
5
+ let e = null;
6
+ const n = () => {
7
+ const t = document.querySelector(r), s = (t == null ? void 0 : t.offsetHeight) ?? 0;
8
+ o.value !== s && (o.value = s);
9
+ }, u = (t) => `${t + o.value}px`;
10
+ return c(() => {
11
+ n(), e = new MutationObserver(n), e.observe(document.body, {
12
+ childList: !0,
13
+ subtree: !0
14
+ });
15
+ }), i(() => {
16
+ e == null || e.disconnect();
17
+ }), { ribbonOffset: o, getTopPosition: u };
18
+ };
19
+ export {
20
+ m as useRibbonOffset
21
+ };
@@ -1,29 +1,32 @@
1
- import { useActionsApi as S } from "./useActionsApi.js";
2
- import { useConfig as V } from "./useConfig.js";
3
- import { useSaveStart as x, useSaveComplete as y } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as w } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as b } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as q } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as H } from "./useHtmlValidator.js";
8
- import { useLiquidValidator as L } from "./validators/useLiquidValidator.js";
9
- const F = () => {
10
- const o = x(), s = y(), { validateHtml: r } = H(), { validateLiquidSyntax: n } = L(), { callbacks: a, isFeatureEnabled: l } = V(), { extractSyncModuleData: d } = w(), { setSyncModuleUnsubscriptionPages: u } = b(), { editorSave: c } = S();
11
- return { save: async (m = !1) => {
1
+ import { useActionsApi as V } from "./useActionsApi.js";
2
+ import { useConfig as x } from "./useConfig.js";
3
+ import { useSaveStart as y, useSaveComplete as w } from "./useGuidoActions.js";
4
+ import { useSyncModuleExtractor as C } from "./useSyncModuleExtractor.js";
5
+ import { useStripoApi as H } from "../services/stripoApi.js";
6
+ import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
7
+ import { useHtmlValidator as q } from "./useHtmlValidator.js";
8
+ import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
+ import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
+ const h = () => {
11
+ const o = y(), s = w(), { validateHtml: r } = q(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { callbacks: a, isFeatureEnabled: d } = x(), { extractSyncModuleData: u } = C(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = V();
12
+ return { save: async (p = !1) => {
12
13
  var i;
13
14
  o();
14
- const { prepareTemplateDetails: p } = q(), t = await p();
15
- if (l("liquidSyntax")) {
16
- if (!await n(t.compiledHtml))
15
+ const { prepareTemplateDetails: f } = b(), t = await f();
16
+ if (!n(t.compiledHtml))
17
+ return;
18
+ if (d("liquidSyntax")) {
19
+ if (!await l(t.compiledHtml))
17
20
  return;
18
21
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
19
22
  return;
20
23
  if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
21
24
  return;
22
- await c();
23
- const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
24
- return await u(f), t.modules = v, m || s(t), t;
25
+ await m();
26
+ const { unsubscribePayload: v, stripoModules: S } = u(t.rawHtml);
27
+ return await c(v), t.modules = S, p || s(t), t;
25
28
  } };
26
29
  };
27
30
  export {
28
- F as useSave
31
+ h as useSave
29
32
  };
@@ -6,20 +6,19 @@ import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
6
6
  import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
7
  import { useToaster as x } from "./useToaster.js";
8
8
  import { localePatch as H } from "../config/i18n/index.js";
9
- import { displayConditions as O } from "../enums/displayConditions.js";
10
- import { useStripoApi as j } from "../services/stripoApi.js";
11
- import L from "../static/styles/customEditorStyle.css.js";
12
- import { useEditorStore as C } from "../stores/editor.js";
13
- import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
14
- import z from "../package.json.js";
15
- const ae = (E, l) => {
16
- const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
9
+ import { useStripoApi as O } from "../services/stripoApi.js";
10
+ import j from "../static/styles/customEditorStyle.css.js";
11
+ import { useEditorStore as E } from "../stores/editor.js";
12
+ import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
13
+ import $ from "../package.json.js";
14
+ const se = (C, l) => {
15
+ const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
17
16
  var g, S, y;
18
- const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
17
+ const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
19
18
  window.UIEditor.initEditor(
20
19
  document.querySelector("#guido-editor"),
21
20
  {
22
- metadata: E,
21
+ metadata: C,
23
22
  html: p,
24
23
  css: a,
25
24
  forceRecreate: v,
@@ -32,10 +31,9 @@ const ae = (E, l) => {
32
31
  customAppearanceMergetags: !u("liquidSyntax"),
33
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
34
33
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
35
- customViewStyles: L,
34
+ customViewStyles: j,
36
35
  conditionsEnabled: f,
37
36
  customConditionsEnabled: f,
38
- conditionCategories: O,
39
37
  enableXSSSecurity: !0,
40
38
  modulesDisabled: F,
41
39
  syncModulesEnabled: s,
@@ -54,7 +52,7 @@ const ae = (E, l) => {
54
52
  },
55
53
  mergeTags: [
56
54
  {
57
- entries: $(
55
+ entries: L(
58
56
  l.preselectedDynamicContentList,
59
57
  u("liquidSyntax")
60
58
  )
@@ -106,7 +104,7 @@ const ae = (E, l) => {
106
104
  i(), r();
107
105
  return;
108
106
  }
109
- const e = z.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
107
+ const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
110
108
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
111
109
  i(), r();
112
110
  }, o.onerror = () => {
@@ -115,7 +113,7 @@ const ae = (E, l) => {
115
113
  });
116
114
  return { initPlugin: async (i) => {
117
115
  await _(async () => {
118
- const r = C(), [s, e] = await Promise.all([
116
+ const r = E(), [s, e] = await Promise.all([
119
117
  b(),
120
118
  k()
121
119
  ]);
@@ -124,5 +122,5 @@ const ae = (E, l) => {
124
122
  } };
125
123
  };
126
124
  export {
127
- ae as useStripo
125
+ se as useStripo
128
126
  };
@@ -0,0 +1,24 @@
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
+ } };
21
+ };
22
+ export {
23
+ A as useCouponBlockValidator
24
+ };
@@ -1,5 +1,5 @@
1
- import { useRecommendation as C } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as h, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as N } from "../../enums/recommendation.js";
1
+ import { useRecommendation as N } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as y, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as h } from "../../enums/recommendation.js";
3
3
  import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
4
4
  const w = [
5
5
  {
@@ -8,7 +8,7 @@ const w = [
8
8
  type: "custom",
9
9
  processor: (c) => {
10
10
  let e = c;
11
- return Object.entries(h).forEach(([, l]) => {
11
+ return Object.entries(y).forEach(([, l]) => {
12
12
  Object.entries(l).forEach(([n, s]) => {
13
13
  e = e.replaceAll(s, `{{${n}}}`);
14
14
  });
@@ -30,13 +30,13 @@ const w = [
30
30
  description: "Adding recommendation unresponsive css",
31
31
  type: "custom",
32
32
  processor: (c) => {
33
- const { calculateCardWidth: e, getRecommendationCampaignData: l } = C();
33
+ const { calculateCardWidth: e, getRecommendationCampaignData: l } = N();
34
34
  let n = c;
35
35
  const s = n.match(T.ID);
36
36
  if (s) {
37
37
  const a = [];
38
38
  if (s.forEach((i) => {
39
- const d = /recommendation-id="(.*?)"/i.exec(i), _ = d ? d[1].trim() : "", R = l(_);
39
+ const u = /recommendation-id="(.*?)"/i.exec(i), _ = u ? u[1].trim() : "", R = l(_);
40
40
  R.textTrimming && R.orientation === M && a.push(e(R));
41
41
  }), a.length) {
42
42
  const i = `width:${Math.min(...a)}px!important;`;
@@ -60,25 +60,25 @@ const w = [
60
60
  type: "custom",
61
61
  processor: (c) => {
62
62
  let e = c;
63
- const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = C();
63
+ const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = N();
64
64
  return l !== null && l.forEach((s) => {
65
65
  const a = s.match(T.CUSTOM_FIELD);
66
66
  if (!a)
67
67
  return;
68
- const [i] = a, d = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
- if (!d || !_ || !R)
68
+ const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
+ if (!u || !_ || !R)
70
70
  return;
71
- const [S] = d, [b] = _, [m] = R, o = b.substring(1, b.length - 2), r = m.match(T.COMPOSITION) !== null;
71
+ const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
72
72
  let t = i;
73
73
  if (r) {
74
- const I = S.substring(2, S.length - 3), p = n(I);
75
- o === A.OMNIBUS_PRICE && (p.priceBeforeTextValue && (t = `${p.priceBeforeTextValue}${t}`), p.priceAfterTextValue && (t = `${t}${p.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (p.discountBeforeTextValue && (t = `${p.discountBeforeTextValue}${t}`), p.discountAfterTextValue && (t = `${t}${p.discountAfterTextValue}`));
74
+ const I = S.substring(2, S.length - 3), m = n(I);
75
+ o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
76
76
  }
77
- const u = S.substring(2);
77
+ const p = S.substring(2);
78
78
  let f = "";
79
- o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${u}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${u}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${u}${A.OMNIBUS_PRICE}`));
80
- const $ = `${m}${t}${N.PARAGRAPH_END_TAG}`, y = `${f}${r ? $ : s}${g.ELSE}${m}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
81
- e = e.replace(s, y);
79
+ o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
80
+ const $ = `${d}${t}${h.PARAGRAPH_END_TAG}`, C = `${f}${r ? $ : s}${g.ELSE}${d}${h.PARAGRAPH_END_TAG}${g.END_IF}`;
81
+ e = e.replace(s, C);
82
82
  }), e;
83
83
  },
84
84
  priority: 53
@@ -136,7 +136,7 @@ const w = [
136
136
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
137
137
  (l, n) => {
138
138
  const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
139
- return s.every((d) => a.test(d)) ? "" : l;
139
+ return s.every((u) => a.test(u)) ? "" : l;
140
140
  }
141
141
  )), e;
142
142
  },
@@ -151,7 +151,7 @@ const w = [
151
151
  /<a\b[^>]*\bes-button\b[^>]*>/g,
152
152
  (o) => o.replace(
153
153
  /([;"]color:)([^;"]+)/g,
154
- (r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
154
+ (r, t, p) => p.includes("!important") ? r : `${t}${p} !important`
155
155
  )
156
156
  ), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
157
157
  let a = l.exec(e);
@@ -163,12 +163,12 @@ const w = [
163
163
  }
164
164
  n.lastIndex = 0, a = l.exec(e);
165
165
  }
166
- const i = /* @__PURE__ */ new Map(), d = [];
166
+ const i = /* @__PURE__ */ new Map(), u = [];
167
167
  let _ = 0;
168
168
  if (s.forEach((o, r) => {
169
169
  if (o >= 6) {
170
- const t = `rc${_++}`;
171
- i.set(r, t), d.push(`.${t}{${r}}`);
170
+ const t = `rc${_++}`, p = r.endsWith(";") ? r : `${r};`;
171
+ i.set(r, t), u.push(`.${t}{${p}}`);
172
172
  }
173
173
  }), i.size === 0) {
174
174
  let o = e;
@@ -182,23 +182,23 @@ const w = [
182
182
  caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
183
183
  });
184
184
  });
185
- let m = e.replace("</style>", `${d.join("")}</style>`);
186
- return m = m.replace(
185
+ let d = e.replace("</style>", `${u.join("")}</style>`);
186
+ return d = d.replace(
187
187
  /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
188
188
  (o, r) => {
189
189
  let t = r;
190
- return i.forEach((u, f) => {
190
+ return i.forEach((p, f) => {
191
191
  const $ = b.get(f);
192
192
  t = t.replace(
193
193
  $.caseA,
194
- (y, I, p) => S(I, u) + p
194
+ (C, I, m) => S(I, p) + m
195
195
  ), t = t.replace(
196
196
  $.caseB,
197
- (y, I, p) => I + S(p, u)
198
- ), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
197
+ (C, I, m) => I + S(m, p)
198
+ ), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
199
199
  }), t;
200
200
  }
201
- ), m = m.replaceAll("<!--REC_START-->", ""), m = m.replaceAll("<!--REC_END-->", ""), m;
201
+ ), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
202
202
  },
203
203
  priority: 58
204
204
  }
@@ -1,13 +1,13 @@
1
- import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as i } from "./itemsBlockMigrator.js";
4
- import { migrateRadioButton as e } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as a } from "./recommendationMigrator.js";
6
- import { migrateUnsubscribe as g } from "./unsubscribeMigrator.js";
7
- const u = async (r) => {
1
+ import { migrateCheckbox as o } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
+ import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
+ import { migrateRadioButton as a } from "./radioButtonMigrator.js";
5
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
6
+ import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
7
+ const b = async (r, t = {}) => {
8
8
  let m = r;
9
- return m = t(m), m = e(m), m = await g(m), m = o(m), m = a(m), m = i(m), m;
9
+ return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
10
10
  };
11
11
  export {
12
- u as migrate
12
+ b as migrate
13
13
  };