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

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 (79) hide show
  1. package/README.md +0 -92
  2. package/dist/@types/config/schemas.js +94 -150
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +75 -75
  5. package/dist/composables/useCortexBlueprintBridge.js +38 -0
  6. package/dist/composables/useEmailTemplateApplier.js +41 -0
  7. package/dist/composables/useRecommendation.js +26 -46
  8. package/dist/composables/useSave.js +18 -21
  9. package/dist/composables/useStripo.js +16 -14
  10. package/dist/config/compiler/recommendationCompilerRules.js +27 -27
  11. package/dist/config/migrator/index.js +9 -9
  12. package/dist/config/migrator/radioButtonMigrator.js +44 -64
  13. package/dist/config/migrator/recommendationMigrator.js +290 -74
  14. package/dist/enums/displayConditions.js +80 -0
  15. package/dist/enums/extensions/recommendationBlock.js +1 -2
  16. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  17. package/dist/extensions/Blocks/Recommendation/block.js +32 -35
  18. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  19. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +24 -25
  20. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +181 -228
  21. package/dist/extensions/Blocks/Recommendation/services/configService.js +29 -65
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -130
  23. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  24. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  26. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +22 -13
  27. package/dist/guido.css +1 -1
  28. package/dist/node_modules/valibot/dist/index.js +235 -450
  29. package/dist/src/@types/config/defaults.d.ts +1 -5
  30. package/dist/src/@types/config/index.d.ts +3 -3
  31. package/dist/src/@types/config/schemas.d.ts +0 -213
  32. package/dist/src/@types/config/types.d.ts +1 -9
  33. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  34. package/dist/src/composables/useConfig.d.ts +0 -56
  35. package/dist/src/composables/useCortexBlueprintBridge.d.ts +17 -0
  36. package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
  37. package/dist/src/composables/useRecommendation.d.ts +1 -10
  38. package/dist/src/config/migrator/index.d.ts +1 -2
  39. package/dist/src/config/migrator/recommendationMigrator.d.ts +1 -13
  40. package/dist/src/enums/displayConditions.d.ts +2 -0
  41. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  42. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -10
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -34
  44. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  45. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +3 -0
  46. package/dist/src/library.d.ts +1 -1
  47. package/dist/src/stores/config.d.ts +0 -504
  48. package/dist/utils/templatePreparation.js +32 -72
  49. package/package.json +1 -5
  50. package/dist/composables/validators/useCouponBlockValidator.js +0 -24
  51. package/dist/config/migrator/recommendation/compositionMapper.js +0 -98
  52. package/dist/config/migrator/recommendation/extractors.js +0 -27
  53. package/dist/config/migrator/recommendation/htmlBuilder.js +0 -496
  54. package/dist/config/migrator/recommendation/parseLegacyConfig.js +0 -33
  55. package/dist/config/migrator/recommendation/settingsMapper.js +0 -70
  56. package/dist/config/migrator/recommendation/themeMapper.js +0 -93
  57. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +0 -21
  58. package/dist/src/composables/useRecommendation.test.d.ts +0 -1
  59. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  60. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +0 -2
  61. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +0 -1
  62. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -7
  63. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +0 -1
  64. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -11
  65. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +0 -15
  66. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +0 -1
  67. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +0 -7
  68. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +0 -1
  69. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +0 -5
  70. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +0 -1
  71. package/dist/src/config/migrator/recommendation/types.d.ts +0 -205
  72. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +0 -1
  73. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +0 -1
  74. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +0 -1
  75. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +0 -21
  76. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +0 -1
  77. package/dist/src/utils/htmlEscape.d.ts +0 -5
  78. package/dist/src/utils/htmlEscape.test.d.ts +0 -1
  79. package/dist/utils/htmlEscape.js +0 -13
@@ -1,13 +1,14 @@
1
- import { defineComponent as J, defineAsyncComponent as I, ref as W, computed as B, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
1
+ import { defineComponent as j, defineAsyncComponent as R, ref as A, computed as B, watch as J, onMounted as Q, onUnmounted as X } from "vue";
2
+ import { useCortexBlueprintBridge as Y } from "../composables/useCortexBlueprintBridge.js";
2
3
  import { provideGuidoActions as Z } from "../composables/useGuidoActions.js";
3
4
  import { usePartner as ee } from "../composables/usePartner.js";
4
- import { useStripo as oe } from "../composables/useStripo.js";
5
- import { useTimerClone as te } from "../composables/useTimerClone.js";
6
- import { migrate as H } from "../config/migrator/index.js";
7
- import { ModuleFolderDefaults as x } from "../enums/defaults.js";
5
+ import { useStripo as te } from "../composables/useStripo.js";
6
+ import { useTimerClone as oe } from "../composables/useTimerClone.js";
7
+ import { migrate as I } from "../config/migrator/index.js";
8
+ import { ModuleFolderDefaults as W } from "../enums/defaults.js";
8
9
  import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
9
- import se from "./organisms/base/Toaster.vue.js";
10
- import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
10
+ import re from "./organisms/base/Toaster.vue.js";
11
+ import se from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
11
12
  import ce from "./organisms/header/HeaderWrapper.vue.js";
12
13
  import ae from "./organisms/LoadingWrapper.vue.js";
13
14
  import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
@@ -18,115 +19,114 @@ import { useDynamicContentStore as ue } from "../stores/dynamic-content.js";
18
19
  import { useEditorStore as pe } from "../stores/editor.js";
19
20
  import { usePreviewStore as fe } from "../stores/preview.js";
20
21
  import { useUnsubscribeStore as ve } from "../stores/unsubscribe.js";
21
- const Ae = /* @__PURE__ */ J({
22
+ const Be = /* @__PURE__ */ j({
22
23
  __name: "Guido",
23
24
  props: {
24
25
  config: null
25
26
  },
26
27
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
27
- setup(G, { expose: z, emit: n }) {
28
- const g = G, q = I(
28
+ setup(x, { expose: H, emit: r }) {
29
+ const b = x, G = R(
29
30
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
30
- ), K = I(
31
+ ), z = R(
31
32
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
32
- ), w = W(), u = W(), p = ue(), E = ve(), i = le();
33
- i.init(g.config);
34
- const f = pe(), V = fe(), m = B(() => f.hasChanges), { isTestPartner: $ } = ee(), D = () => {
33
+ ), S = A(), d = A(), l = ue(), g = ve(), a = le();
34
+ a.init(b.config);
35
+ const u = pe(), q = fe(), i = B(() => u.hasChanges), { isTestPartner: K } = ee(), w = () => {
35
36
  var e;
36
- return (e = w.value) == null ? void 0 : e.handleSave(!0);
37
+ return (e = S.value) == null ? void 0 : e.handleSave(!0);
37
38
  }, {
38
- templateId: v,
39
- userId: C,
40
- partnerName: T,
41
- username: k,
42
- template: o,
43
- editor: r
44
- } = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (r == null ? void 0 : r.savedModulesFolderName) || x.SAVED_MODULES, U = (r == null ? void 0 : r.defaultModulesFolderName) || x.DEFAULT_MODULES;
45
- f.templateId = v;
46
- const h = {
47
- emailId: v,
48
- userId: C,
49
- username: k,
50
- partnerName: T,
51
- savedModulesFolderName: L,
52
- defaultModulesFolderName: U
53
- }, _ = {
54
- preselectedDynamicContentList: y,
39
+ templateId: p,
40
+ userId: E,
41
+ partnerName: D,
42
+ username: C,
43
+ template: t,
44
+ editor: s
45
+ } = a, m = (t == null ? void 0 : t.html) || "", T = (t == null ? void 0 : t.css) || "", f = (t == null ? void 0 : t.preselectedDynamicContent) || [], k = (s == null ? void 0 : s.savedModulesFolderName) || W.SAVED_MODULES, F = (s == null ? void 0 : s.defaultModulesFolderName) || W.DEFAULT_MODULES;
46
+ u.templateId = p, Y();
47
+ const v = {
48
+ emailId: p,
49
+ userId: E,
50
+ username: C,
51
+ partnerName: D,
52
+ savedModulesFolderName: k,
53
+ defaultModulesFolderName: F
54
+ }, L = {
55
+ preselectedDynamicContentList: f,
55
56
  onReady: () => {
56
- console.debug("guido:ready"), n("ready");
57
+ console.debug("guido:ready"), r("ready");
57
58
  }
58
- }, { initPlugin: M } = oe(h, _), { getDefaultTemplate: O } = de(), { cloneTimersOnSave: P, hasTimerBlocks: N } = te(), j = B(() => {
59
+ }, { initPlugin: U } = te(v, L), { getDefaultTemplate: _ } = de(), { cloneTimersOnSave: M, hasTimerBlocks: O } = oe(), V = B(() => {
59
60
  var e;
60
- return !((e = i.ui) != null && e.showHeader);
61
+ return !((e = a.ui) != null && e.showHeader);
61
62
  });
62
63
  Z({
63
64
  onBack: () => {
64
- console.debug("guido:back"), n("back");
65
+ console.debug("guido:back"), r("back");
65
66
  },
66
67
  onSaveStart: () => {
67
- console.debug("guido:save:start"), n("save:start");
68
+ console.debug("guido:save:start"), r("save:start");
68
69
  },
69
70
  onSaveComplete: (e) => {
70
- const t = { ...e, metadata: h };
71
- console.debug("guido:save:complete", t), n("save:complete", t);
71
+ const n = { ...e, metadata: v };
72
+ console.debug("guido:save:complete", n), r("save:complete", n);
72
73
  },
73
74
  onTestEmailClick: () => {
74
- console.debug("guido:test-email:click"), n("test-email:click");
75
+ console.debug("guido:test-email:click"), r("test-email:click");
75
76
  }
76
77
  });
77
- const R = (e) => {
78
- console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
79
- }, A = () => {
78
+ const P = (e) => {
79
+ console.debug("dynamic-content:close", e), l.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
80
+ }, N = () => {
80
81
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
81
82
  };
82
- Q(() => m.value, () => {
83
- n("on-change", m.value);
83
+ J(() => i.value, () => {
84
+ r("on-change", i.value);
84
85
  });
85
- const b = (e) => {
86
- const t = e, { attribute: l, position: a } = t.detail;
87
- console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
86
+ const y = (e) => {
87
+ const n = e, { attribute: o, position: $ } = n.detail;
88
+ console.debug("dynamic-content:open", n.detail), r("dynamic-content:open", o, $);
88
89
  };
89
90
  let c = null;
90
- const S = () => {
91
- var t;
91
+ const h = () => {
92
+ var n;
92
93
  const e = document.querySelector(ne);
93
- (t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
94
+ (n = d.value) == null || n.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
94
95
  };
95
- return X(async () => {
96
- var t, l;
97
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), S();
98
- const e = (t = u.value) == null ? void 0 : t.parentElement;
99
- e && (c = new ResizeObserver(S), c.observe(e));
96
+ return Q(async () => {
97
+ var n;
98
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h();
99
+ const e = (n = d.value) == null ? void 0 : n.parentElement;
100
+ e && (c = new ResizeObserver(h), c.observe(e));
100
101
  try {
101
- E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
102
- const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
103
- let s = {
104
- html: d && await H(d, a),
105
- css: F
102
+ g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
103
+ let o = {
104
+ html: m && await I(m),
105
+ css: T
106
106
  };
107
- s.html || (s = await O(), s.html = await H(s.html, a)), N(s.html) && (s.html = await P(s.html)), await M(s), p.selectedDynamicContentList = y;
108
- } catch (a) {
109
- console.error("Failed to initialize Stripo editor:", a);
107
+ o.html || (o = await _(), o.html = await I(o.html)), O(o.html) && (o.html = await M(o.html)), await U(o), l.selectedDynamicContentList = f;
108
+ } catch (o) {
109
+ console.error("Failed to initialize Stripo editor:", o);
110
110
  }
111
- document.addEventListener("dynamic-content:open", b);
112
- }), Y(() => {
113
- c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b);
111
+ document.addEventListener("dynamic-content:open", y);
112
+ }), X(() => {
113
+ c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", y);
114
114
  try {
115
115
  window.UIEditor.removeEditor();
116
116
  } catch {
117
117
  console.debug("Failed to remove Stripo editor: No editor found");
118
118
  }
119
- i.reset();
120
- }), z({
119
+ a.reset();
120
+ }), H({
121
121
  dynamicContent: {
122
- insert: R,
123
- close: A
122
+ insert: P,
123
+ close: N
124
124
  },
125
- hasChanges: m,
126
- saveSilent: D
127
- }), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: r, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: N, noHeader: j, insertDynamicContent: R, closeDynamicContent: A, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: S, Toaster: se, FilterSelectionDrawer: re, HeaderWrapper: ce, LoadingWrapper: ae, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: me };
125
+ hasChanges: i,
126
+ saveSilent: w
127
+ }), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: z, headerWrapperRef: S, wrapperRef: d, dynamicContentStore: l, unsubscribeStore: g, props: b, configStore: a, editorStore: u, previewStore: q, hasChanges: i, isTestPartner: K, saveSilent: w, templateId: p, userId: E, partnerName: D, username: C, templateConfig: t, editorConfig: s, html: m, css: T, preselectedDynamicContentList: f, savedModulesFolderName: k, defaultModulesFolderName: F, emit: r, metadata: v, options: L, initPlugin: U, getDefaultTemplate: _, cloneTimersOnSave: M, hasTimerBlocks: O, noHeader: V, insertDynamicContent: P, closeDynamicContent: N, handleDynamicContentOpen: y, ribbonObserver: c, updateRibbonOffset: h, Toaster: re, FilterSelectionDrawer: se, HeaderWrapper: ce, LoadingWrapper: ae, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: me };
128
128
  }
129
129
  });
130
130
  export {
131
- Ae as default
131
+ Be as default
132
132
  };
@@ -0,0 +1,38 @@
1
+ import { useEmailTemplateApplier as T, resetEmailTemplateApplier as E } from "./useEmailTemplateApplier.js";
2
+ import { getActivePinia as h } from "pinia";
3
+ import { watch as d, onUnmounted as y } from "vue";
4
+ const _ = "email_template", b = "chat", B = () => {
5
+ const l = h();
6
+ if (!l)
7
+ return;
8
+ const p = l._s, c = p == null ? void 0 : p.get(b);
9
+ if (!c)
10
+ return;
11
+ const { applyTemplate: m, applyTemplateDebounced: f } = T(), e = /* @__PURE__ */ new Map(), A = d(
12
+ () => c.messages,
13
+ (a) => {
14
+ Array.isArray(a) && a.forEach((n) => {
15
+ const u = n == null ? void 0 : n.segments;
16
+ Array.isArray(u) && u.forEach((i) => {
17
+ if ((i == null ? void 0 : i.type) !== "blueprint")
18
+ return;
19
+ const o = i;
20
+ if (o.blueprintType !== _)
21
+ return;
22
+ const r = o.blueprintId, t = o.blueprintData;
23
+ if (!r || !(t != null && t.html))
24
+ return;
25
+ const s = e.get(r);
26
+ s === void 0 ? (e.set(r, t.html), m(r, t)) : s !== t.html && (e.set(r, t.html), f(r, t));
27
+ });
28
+ });
29
+ },
30
+ { deep: !0, immediate: !0 }
31
+ );
32
+ y(() => {
33
+ A(), e.clear(), E();
34
+ });
35
+ };
36
+ export {
37
+ B as useCortexBlueprintBridge
38
+ };
@@ -0,0 +1,41 @@
1
+ import { useActionsApi as u } from "./useActionsApi.js";
2
+ import { useToaster as T } from "./useToaster.js";
3
+ import { useTranslations as f } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as n } from "../enums/toaster.js";
5
+ import { ref as y } from "vue";
6
+ const h = 250, s = y({}), o = {}, j = () => {
7
+ const { updateHtmlAndCss: l } = u(), { showToaster: r } = T(), i = f(), c = (e, t, p) => {
8
+ s.value = { ...s.value, [e]: "applying" };
9
+ try {
10
+ l(t, p), s.value = { ...s.value, [e]: "applied" }, r({
11
+ type: n.Success,
12
+ message: i("newsletter.ai-template-applied")
13
+ });
14
+ } catch (a) {
15
+ s.value = { ...s.value, [e]: "failed" }, r({
16
+ type: n.Alert,
17
+ message: a instanceof Error ? a.message : "Failed to apply template"
18
+ });
19
+ }
20
+ }, m = (e) => {
21
+ const t = o[e];
22
+ t && (clearTimeout(t), delete o[e]);
23
+ };
24
+ return { applyStatus: s, applyTemplate: (e, t) => {
25
+ t.html && (m(e), c(e, t.html, t.css ?? ""));
26
+ }, applyTemplateDebounced: (e, t) => {
27
+ if (!t.html)
28
+ return;
29
+ m(e);
30
+ const { html: p } = t, a = t.css ?? "";
31
+ o[e] = setTimeout(() => {
32
+ delete o[e], c(e, p, a);
33
+ }, h);
34
+ } };
35
+ }, w = () => {
36
+ Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
37
+ };
38
+ export {
39
+ w as resetEmailTemplateApplier,
40
+ j as useEmailTemplateApplier
41
+ };
@@ -1,21 +1,21 @@
1
- import { RecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
1
+ import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
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 = () => ({
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 = () => ({
7
7
  calculateCardWidth: ({
8
- mobileLeftPadding: s,
9
- mobileRightPadding: a,
10
- cardsInRow: c,
11
- unresponsive: n
8
+ mobileLeftPadding: i,
9
+ mobileRightPadding: n,
10
+ cardsInRow: o,
11
+ unresponsive: a
12
12
  }) => {
13
- const r = n ? c : 1, e = s + a + (r - 1) * b;
13
+ const r = a ? o : 1, e = i + n + (r - 1) * b;
14
14
  return (R - e) / r;
15
15
  },
16
- getRecommendationCampaignData: (s) => {
17
- const a = m(), c = Number(s), n = a.blockStates[c];
18
- if (!n)
16
+ getRecommendationCampaignData: (i) => {
17
+ const n = u(), o = Number(i), a = n.blockStates[o];
18
+ if (!a)
19
19
  return {
20
20
  textTrimming: !1,
21
21
  orientation: "vertical",
@@ -28,7 +28,7 @@ const w = () => ({
28
28
  discountBeforeTextValue: "",
29
29
  discountAfterTextValue: ""
30
30
  };
31
- const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
31
+ const { recommendationConfigs: r } = a, e = r.orientation === "grid" ? "vertical" : "horizontal";
32
32
  return {
33
33
  textTrimming: r.textTrimming,
34
34
  orientation: e,
@@ -42,39 +42,19 @@ const w = () => ({
42
42
  discountAfterTextValue: ""
43
43
  };
44
44
  },
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;
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;
76
56
  }
77
57
  });
78
58
  export {
79
- w as useRecommendation
59
+ N as useRecommendation
80
60
  };
@@ -1,32 +1,29 @@
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) => {
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) => {
13
12
  var i;
14
13
  o();
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))
14
+ const { prepareTemplateDetails: p } = q(), t = await p();
15
+ if (l("liquidSyntax")) {
16
+ if (!await n(t.compiledHtml))
20
17
  return;
21
18
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
22
19
  return;
23
20
  if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
24
21
  return;
25
- await m();
26
- const { unsubscribePayload: v, stripoModules: S } = u(t.rawHtml);
27
- return await c(v), t.modules = S, p || s(t), t;
22
+ await c();
23
+ const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
24
+ return await u(f), t.modules = v, m || s(t), t;
28
25
  } };
29
26
  };
30
27
  export {
31
- h as useSave
28
+ F as useSave
32
29
  };
@@ -6,19 +6,20 @@ 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 { 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) => {
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) => {
16
17
  var g, S, y;
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;
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;
18
19
  window.UIEditor.initEditor(
19
20
  document.querySelector("#guido-editor"),
20
21
  {
21
- metadata: C,
22
+ metadata: E,
22
23
  html: p,
23
24
  css: a,
24
25
  forceRecreate: v,
@@ -31,9 +32,10 @@ const se = (C, l) => {
31
32
  customAppearanceMergetags: !u("liquidSyntax"),
32
33
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
34
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: j,
35
+ customViewStyles: L,
35
36
  conditionsEnabled: f,
36
37
  customConditionsEnabled: f,
38
+ conditionCategories: O,
37
39
  enableXSSSecurity: !0,
38
40
  modulesDisabled: F,
39
41
  syncModulesEnabled: s,
@@ -52,7 +54,7 @@ const se = (C, l) => {
52
54
  },
53
55
  mergeTags: [
54
56
  {
55
- entries: L(
57
+ entries: $(
56
58
  l.preselectedDynamicContentList,
57
59
  u("liquidSyntax")
58
60
  )
@@ -104,7 +106,7 @@ const se = (C, l) => {
104
106
  i(), r();
105
107
  return;
106
108
  }
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");
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");
108
110
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
109
111
  i(), r();
110
112
  }, o.onerror = () => {
@@ -113,7 +115,7 @@ const se = (C, l) => {
113
115
  });
114
116
  return { initPlugin: async (i) => {
115
117
  await _(async () => {
116
- const r = E(), [s, e] = await Promise.all([
118
+ const r = C(), [s, e] = await Promise.all([
117
119
  b(),
118
120
  k()
119
121
  ]);
@@ -122,5 +124,5 @@ const se = (C, l) => {
122
124
  } };
123
125
  };
124
126
  export {
125
- se as useStripo
127
+ ae as useStripo
126
128
  };