@useinsider/guido 3.2.0-beta.8e8f902 → 3.2.0-beta.8f147c3

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 (72) hide show
  1. package/README.md +1 -25
  2. package/dist/@types/config/schemas.js +163 -109
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +77 -77
  5. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  6. package/dist/components/organisms/header/RightSlot.vue2.js +8 -9
  7. package/dist/composables/useSave.js +15 -15
  8. package/dist/config/migrator/index.js +9 -9
  9. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  10. package/dist/config/migrator/recommendation/extractors.js +27 -0
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +486 -0
  12. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  13. package/dist/config/migrator/recommendation/settingsMapper.js +78 -0
  14. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  15. package/dist/config/migrator/recommendationMigrator.js +60 -290
  16. package/dist/enums/extensions/recommendationBlock.js +2 -1
  17. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  18. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  20. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  22. package/dist/guido.css +1 -1
  23. package/dist/node_modules/valibot/dist/index.js +450 -235
  24. package/dist/services/templateLibraryApi.js +4 -5
  25. package/dist/src/@types/config/defaults.d.ts +5 -1
  26. package/dist/src/@types/config/index.d.ts +3 -3
  27. package/dist/src/@types/config/schemas.d.ts +213 -4
  28. package/dist/src/@types/config/types.d.ts +9 -1
  29. package/dist/src/components/Guido.vue.d.ts +1 -1
  30. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  31. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  32. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  33. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  34. package/dist/src/composables/useConfig.d.ts +56 -2
  35. package/dist/src/composables/useSave.d.ts +1 -1
  36. package/dist/src/config/migrator/index.d.ts +2 -1
  37. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  38. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  39. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  40. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  41. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  42. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  43. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  44. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  45. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  46. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  47. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  48. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  49. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  50. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  51. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  53. package/dist/src/stores/config.d.ts +504 -18
  54. package/dist/src/stores/editor.d.ts +0 -23
  55. package/dist/src/utils/htmlEscape.d.ts +5 -0
  56. package/dist/stores/editor.js +1 -3
  57. package/dist/utils/htmlEscape.js +13 -0
  58. package/dist/utils/pairProductVariables.js +88 -89
  59. package/package.json +5 -1
  60. package/dist/components/organisms/AutoSaveController.vue.js +0 -17
  61. package/dist/components/organisms/AutoSaveController.vue2.js +0 -13
  62. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  63. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  64. package/dist/composables/useAutoSave.js +0 -71
  65. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  66. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +0 -2
  67. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +0 -2
  68. package/dist/src/composables/useAutoSave.d.ts +0 -3
  69. package/dist/src/stores/autosave.d.ts +0 -12
  70. package/dist/src/utils/timeUtil.d.ts +0 -8
  71. package/dist/stores/autosave.js +0 -17
  72. package/dist/utils/timeUtil.js +0 -19
@@ -1,14 +1,13 @@
1
- import { defineComponent as j, defineAsyncComponent as N, ref as R, computed as I, watch as J, onMounted as Q, onUnmounted as X } from "vue";
2
- import { provideGuidoActions as Y } from "../composables/useGuidoActions.js";
3
- import { usePartner as Z } from "../composables/usePartner.js";
4
- import { useStripo as ee } from "../composables/useStripo.js";
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";
2
+ import { provideGuidoActions as Z } from "../composables/useGuidoActions.js";
3
+ import { usePartner as ee } from "../composables/usePartner.js";
4
+ import { useStripo as oe } from "../composables/useStripo.js";
5
5
  import { useTimerClone as te } from "../composables/useTimerClone.js";
6
- import { migrate as W } from "../config/migrator/index.js";
7
- import { ModuleFolderDefaults as B } from "../enums/defaults.js";
8
- import { RIBBON_SELECTOR as oe } from "../enums/onboarding.js";
9
- import ne from "./organisms/AutoSaveController.vue.js";
10
- import re from "./organisms/base/Toaster.vue.js";
11
- import se from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
6
+ import { migrate as H } from "../config/migrator/index.js";
7
+ import { ModuleFolderDefaults as x } from "../enums/defaults.js";
8
+ 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";
12
11
  import ce from "./organisms/header/HeaderWrapper.vue.js";
13
12
  import ae from "./organisms/LoadingWrapper.vue.js";
14
13
  import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
@@ -19,114 +18,115 @@ import { useDynamicContentStore as ue } from "../stores/dynamic-content.js";
19
18
  import { useEditorStore as pe } from "../stores/editor.js";
20
19
  import { usePreviewStore as fe } from "../stores/preview.js";
21
20
  import { useUnsubscribeStore as ve } from "../stores/unsubscribe.js";
22
- const Ie = /* @__PURE__ */ j({
21
+ const Ae = /* @__PURE__ */ J({
23
22
  __name: "Guido",
24
23
  props: {
25
24
  config: null
26
25
  },
27
26
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
28
- setup(H, { expose: x, emit: r }) {
29
- const S = H, G = N(
27
+ setup(G, { expose: z, emit: n }) {
28
+ const g = G, q = I(
30
29
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
31
- ), z = N(
30
+ ), K = I(
32
31
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
33
- ), b = R(), d = R(), l = ue(), g = ve(), a = le();
34
- a.init(S.config);
35
- const u = pe(), q = fe(), i = I(() => u.hasChanges), { isTestPartner: K } = Z(), w = () => {
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 = () => {
36
35
  var e;
37
- return (e = b.value) == null ? void 0 : e.handleSave(!0);
36
+ return (e = w.value) == null ? void 0 : e.handleSave(!0);
38
37
  }, {
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) || B.SAVED_MODULES, F = (s == null ? void 0 : s.defaultModulesFolderName) || B.DEFAULT_MODULES;
46
- u.templateId = p;
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,
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,
56
55
  onReady: () => {
57
- console.debug("guido:ready"), r("ready");
56
+ console.debug("guido:ready"), n("ready");
58
57
  }
59
- }, { initPlugin: U } = ee(v, L), { getDefaultTemplate: _ } = de(), { cloneTimersOnSave: M, hasTimerBlocks: O } = te(), V = I(() => {
58
+ }, { initPlugin: M } = oe(h, _), { getDefaultTemplate: O } = de(), { cloneTimersOnSave: P, hasTimerBlocks: N } = te(), j = B(() => {
60
59
  var e;
61
- return !((e = a.ui) != null && e.showHeader);
60
+ return !((e = i.ui) != null && e.showHeader);
62
61
  });
63
- Y({
62
+ Z({
64
63
  onBack: () => {
65
- console.debug("guido:back"), r("back");
64
+ console.debug("guido:back"), n("back");
66
65
  },
67
66
  onSaveStart: () => {
68
- console.debug("guido:save:start"), r("save:start");
67
+ console.debug("guido:save:start"), n("save:start");
69
68
  },
70
69
  onSaveComplete: (e) => {
71
- const n = { ...e, metadata: v };
72
- console.debug("guido:save:complete", n), r("save:complete", n);
70
+ const t = { ...e, metadata: h };
71
+ console.debug("guido:save:complete", t), n("save:complete", t);
73
72
  },
74
73
  onTestEmailClick: () => {
75
- console.debug("guido:test-email:click"), r("test-email:click");
74
+ console.debug("guido:test-email:click"), n("test-email:click");
76
75
  }
77
76
  });
78
- const P = (e) => {
79
- console.debug("dynamic-content:close", e), l.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
77
+ const R = (e) => {
78
+ console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
80
79
  }, A = () => {
81
80
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
82
81
  };
83
- J(() => i.value, () => {
84
- r("on-change", i.value);
82
+ Q(() => m.value, () => {
83
+ n("on-change", m.value);
85
84
  });
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, $);
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);
89
88
  };
90
89
  let c = null;
91
- const h = () => {
92
- var n;
93
- const e = document.querySelector(oe);
94
- (n = d.value) == null || n.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
90
+ const S = () => {
91
+ var t;
92
+ const e = document.querySelector(ne);
93
+ (t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
95
94
  };
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));
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));
101
100
  try {
102
- g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
103
- let o = {
104
- html: m && await W(m),
105
- css: T
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
106
106
  };
107
- o.html || (o = await _(), o.html = await W(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);
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);
110
110
  }
111
- document.addEventListener("dynamic-content:open", y);
112
- }), X(() => {
113
- c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", y);
111
+ document.addEventListener("dynamic-content:open", b);
112
+ }), Y(() => {
113
+ c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b);
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
- a.reset();
120
- }), x({
119
+ i.reset();
120
+ }), z({
121
121
  dynamicContent: {
122
- insert: P,
122
+ insert: R,
123
123
  close: A
124
124
  },
125
- hasChanges: i,
126
- saveSilent: w
127
- }), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: z, headerWrapperRef: b, wrapperRef: d, dynamicContentStore: l, unsubscribeStore: g, props: S, 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: A, handleDynamicContentOpen: y, ribbonObserver: c, updateRibbonOffset: h, AutoSaveController: ne, Toaster: re, FilterSelectionDrawer: se, HeaderWrapper: ce, LoadingWrapper: ae, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: me };
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 };
128
128
  }
129
129
  });
130
130
  export {
131
- Ie as default
131
+ Ae as default
132
132
  };
@@ -1,11 +1,11 @@
1
- import s from "./RightSlot.vue2.js";
2
- import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var r = function() {
4
- var i = this, e = i._self._c, t = i._self._setupProxy;
5
- return e("div", { staticClass: "d-f a-i-c" }, [t.editorStore.isVersionHistoryOpen ? i._e() : e(t.AutoSaveToggle), t.isLiquidEnabled && !t.editorStore.isVersionHistoryOpen ? e(t.InChips, { staticClass: "mr-1", attrs: { id: "guido__liquid-tag-chip", styles: "stroke", type: "default", value: "liquid-tags", "close-button": !1, "disabled-status": t.editorStore.loadingStatus, interactive: !1, text: t.trans("email-editor.liquid-tags-enabled") } }) : i._e(), t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : e(t.EditorActions, { ref: "editorActionsRef" })], 1);
6
- }, a = [], n = /* @__PURE__ */ o(
7
- s,
8
- r,
1
+ import i from "./RightSlot.vue2.js";
2
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var o = function() {
4
+ var s = this, e = s._self._c, t = s._self._setupProxy;
5
+ return e("div", { staticClass: "d-f a-i-c" }, [t.isLiquidEnabled && !t.editorStore.isVersionHistoryOpen ? e(t.InChips, { staticClass: "mr-3", attrs: { id: "guido__liquid-tag-chip", styles: "stroke", type: "default", value: "liquid-tags", "close-button": !1, "disabled-status": t.editorStore.loadingStatus, interactive: !1, text: t.trans("email-editor.liquid-tags-enabled") } }) : s._e(), t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : e(t.EditorActions, { ref: "editorActionsRef" })], 1);
6
+ }, a = [], n = /* @__PURE__ */ r(
7
+ i,
8
+ o,
9
9
  a,
10
10
  !1,
11
11
  null,
@@ -1,23 +1,22 @@
1
1
  import { defineComponent as a, ref as f, computed as p } from "vue";
2
2
  import { useConfig as u } from "../../../composables/useConfig.js";
3
3
  import { useTranslations as d } from "../../../composables/useTranslations.js";
4
- import { useEditorStore as l } from "../../../stores/editor.js";
5
- import { InChips as c } from "@useinsider/design-system-vue";
6
- import _ from "./AutoSaveToggle.vue.js";
7
- import S from "./EditorActions.vue.js";
8
- import g from "./version-history/RestoreButton.vue.js";
9
- const T = /* @__PURE__ */ a({
4
+ import { useEditorStore as c } from "../../../stores/editor.js";
5
+ import { InChips as l } from "@useinsider/design-system-vue";
6
+ import _ from "./EditorActions.vue.js";
7
+ import S from "./version-history/RestoreButton.vue.js";
8
+ const x = /* @__PURE__ */ a({
10
9
  __name: "RightSlot",
11
10
  setup(h, { expose: r }) {
12
- const { isFeatureEnabled: o } = u(), i = d(), n = l(), t = f(null), s = p(() => o("liquidSyntax"));
11
+ const { isFeatureEnabled: o } = u(), n = d(), i = c(), t = f(null), s = p(() => o("liquidSyntax"));
13
12
  return r({
14
13
  handleSave: (m) => {
15
14
  var e;
16
15
  return (e = t.value) == null ? void 0 : e.handleSave(m);
17
16
  }
18
- }), { __sfc: !0, isFeatureEnabled: o, trans: i, editorStore: n, editorActionsRef: t, isLiquidEnabled: s, InChips: c, AutoSaveToggle: _, EditorActions: S, RestoreButton: g };
17
+ }), { __sfc: !0, isFeatureEnabled: o, trans: n, editorStore: i, editorActionsRef: t, isLiquidEnabled: s, InChips: l, EditorActions: _, RestoreButton: S };
19
18
  }
20
19
  });
21
20
  export {
22
- T as default
21
+ x as default
23
22
  };
@@ -1,17 +1,17 @@
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 b } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as q } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as H } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as L } from "./useHtmlValidator.js";
8
- import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
9
- const U = () => {
10
- const o = y(), s = w(), { validateHtml: r } = L(), { validateLiquidSyntax: n } = P(), { callbacks: a, isFeatureEnabled: l } = x(), { extractSyncModuleData: d } = b(), { setSyncModuleUnsubscriptionPages: u } = q(), { editorSave: c } = V();
11
- return { save: async (m = !1, 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) => {
12
12
  var i;
13
13
  o();
14
- const { prepareTemplateDetails: f } = H(), t = await f();
14
+ const { prepareTemplateDetails: p } = q(), t = await p();
15
15
  if (l("liquidSyntax")) {
16
16
  if (!await n(t.compiledHtml))
17
17
  return;
@@ -20,10 +20,10 @@ const U = () => {
20
20
  if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
21
21
  return;
22
22
  await c();
23
- const { unsubscribePayload: v, stripoModules: S } = d(t.rawHtml);
24
- return await u(v), t.modules = S, m || s({ ...t, silent: p }), t;
23
+ const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
24
+ return await u(f), t.modules = v, m || s(t), t;
25
25
  } };
26
26
  };
27
27
  export {
28
- U as useSave
28
+ F as useSave
29
29
  };
@@ -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
  };
@@ -0,0 +1,98 @@
1
+ import { DEFAULT_COMPOSITION as d, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
+ const C = "__title__", a = "product_attribute.";
5
+ function N(r) {
6
+ const t = r.variable ?? "";
7
+ switch (t) {
8
+ case "p_recommendation_title":
9
+ return { key: C, kind: "title" };
10
+ case "p_image":
11
+ return { key: y, kind: "image" };
12
+ case "p_name":
13
+ return { key: h, kind: "text" };
14
+ case "p_price":
15
+ return { key: R, kind: "text" };
16
+ case "p_original_price":
17
+ return { key: f, kind: "text" };
18
+ case "p_omnibus_price":
19
+ return { key: x, kind: "text" };
20
+ case "p_omnibus_discount":
21
+ return { key: A, kind: "text" };
22
+ case "p_button":
23
+ return { key: k, kind: "button" };
24
+ default:
25
+ if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
+ const s = r.value ?? "", o = s.startsWith(a) ? s.slice(a.length) : s;
27
+ return o ? {
28
+ key: `${l}${o}`,
29
+ kind: "custom",
30
+ customAttrName: o,
31
+ customAttrValue: s || `${a}${o}`
32
+ } : null;
33
+ }
34
+ return null;
35
+ }
36
+ }
37
+ function p(r) {
38
+ const t = d.indexOf(r);
39
+ return t === -1 ? Number.POSITIVE_INFINITY : t;
40
+ }
41
+ function S(r) {
42
+ const t = {
43
+ composition: [],
44
+ visibility: { ...I },
45
+ customAttributes: [],
46
+ customAttrValues: {},
47
+ perElementStyles: {},
48
+ anyTextTrimming: !1
49
+ };
50
+ if (!r || r.length === 0)
51
+ return t.composition = [...d], t;
52
+ const s = [];
53
+ r.forEach((e, i) => {
54
+ const n = N(e);
55
+ if (n) {
56
+ if (n.kind === "title") {
57
+ t.titleVariable = e;
58
+ return;
59
+ }
60
+ s.push({
61
+ key: n.key,
62
+ kind: n.kind,
63
+ hidden: e.hidden === !0,
64
+ positionIdx: typeof e.positionIdx == "number" ? e.positionIdx : Number.MAX_SAFE_INTEGER,
65
+ legacy: e,
66
+ customAttrName: n.customAttrName,
67
+ customAttrValue: n.customAttrValue,
68
+ originalIndex: i
69
+ });
70
+ }
71
+ }), s.sort((e, i) => {
72
+ if (e.positionIdx !== i.positionIdx)
73
+ return e.positionIdx - i.positionIdx;
74
+ const n = p(e.key), u = p(i.key);
75
+ return n !== u ? n - u : e.originalIndex - i.originalIndex;
76
+ });
77
+ const o = {};
78
+ return s.forEach((e) => {
79
+ const { key: i, kind: n, hidden: u, legacy: m, customAttrName: c, customAttrValue: T } = e;
80
+ switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && c && T && (t.customAttributes.includes(c) || t.customAttributes.push(c), t.customAttrValues[i] = T), n) {
81
+ case "image":
82
+ o[i] = b(m.theme);
83
+ break;
84
+ case "button":
85
+ o[i] = O(m.theme);
86
+ break;
87
+ case "text":
88
+ case "custom": {
89
+ const _ = E(m.theme);
90
+ o[i] = _, _.textTrimming && (t.anyTextTrimming = !0);
91
+ break;
92
+ }
93
+ }
94
+ }), t.perElementStyles = o, t;
95
+ }
96
+ export {
97
+ S as mapComposition
98
+ };
@@ -0,0 +1,27 @@
1
+ const i = "You May Also Like!";
2
+ function s(r) {
3
+ var e;
4
+ const o = r.querySelector(".ext-recommendation-title");
5
+ if (!o)
6
+ return i;
7
+ const t = (e = o.textContent) == null ? void 0 : e.trim();
8
+ return t && t.length > 0 ? t : i;
9
+ }
10
+ function u(r) {
11
+ const o = [
12
+ r,
13
+ ...Array.from(r.querySelectorAll(".product-card, .ext-recommendation-card"))
14
+ ];
15
+ let t = "";
16
+ return o.some((e) => {
17
+ const n = e.getAttribute("bgcolor");
18
+ if (n && n.trim())
19
+ return t = n.trim(), !0;
20
+ const c = (e.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
21
+ return c && c[1] ? (t = c[1].trim(), !0) : !1;
22
+ }), t;
23
+ }
24
+ export {
25
+ u as extractCardBgColor,
26
+ s as extractTitleText
27
+ };