@useinsider/guido 2.2.0-beta.fa4cec8 → 3.0.0-beta.1df56b8

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 (94) hide show
  1. package/README.md +41 -2
  2. package/dist/@types/config/schemas.js +1 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +66 -66
  5. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  6. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  9. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
  10. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
  11. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
  12. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
  13. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
  14. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
  15. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
  16. package/dist/composables/useRecommendation.js +9 -9
  17. package/dist/composables/useSave.js +16 -12
  18. package/dist/composables/useStripo.js +66 -62
  19. package/dist/composables/useStripoEventHandler.js +27 -12
  20. package/dist/composables/useSyncModuleExtractor.js +45 -0
  21. package/dist/config/compiler/utils/recommendationCompilerUtils.js +1 -1
  22. package/dist/config/migrator/recommendationMigrator.js +1 -1
  23. package/dist/enums/unsubscribe.js +25 -21
  24. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  25. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
  26. package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
  27. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
  28. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
  29. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
  30. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
  31. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
  32. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
  33. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +194 -104
  34. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
  35. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
  36. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +291 -217
  38. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +14 -14
  39. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
  40. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  41. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
  42. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
  43. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
  44. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
  47. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
  48. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
  49. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
  50. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +172 -85
  51. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -2
  52. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
  53. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +2 -2
  54. package/dist/extensions/Blocks/Recommendation/templates/utils.js +32 -32
  55. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
  56. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
  57. package/dist/guido.css +1 -1
  58. package/dist/services/stripoApi.js +55 -19
  59. package/dist/src/@types/config/schemas.d.ts +1 -1
  60. package/dist/src/@types/events.d.ts +38 -2
  61. package/dist/src/App.vue.d.ts +3 -1
  62. package/dist/src/components/Guido.vue.d.ts +2 -2
  63. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
  64. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
  65. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  66. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  67. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  68. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  69. package/dist/src/composables/useSave.d.ts +2 -2
  70. package/dist/src/composables/useStripo.d.ts +2 -2
  71. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  72. package/dist/src/enums/unsubscribe.d.ts +3 -0
  73. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
  74. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
  75. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
  76. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +8 -1
  77. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +38 -10
  78. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +27 -14
  79. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
  80. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +19 -2
  81. package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -2
  83. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
  84. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
  85. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
  86. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
  87. package/dist/src/mock/api/settings.d.ts +2 -0
  88. package/dist/src/services/stripoApi.d.ts +5 -0
  89. package/dist/src/stores/editor.d.ts +23 -0
  90. package/dist/src/utils/templatePreparation.d.ts +1 -1
  91. package/dist/static/styles/customEditorStyle.css.js +50 -23
  92. package/dist/stores/editor.js +2 -1
  93. package/dist/utils/templatePreparation.js +1 -1
  94. package/package.json +2 -2
@@ -1,20 +1,20 @@
1
1
  import s from "./Filters.vue2.js";
2
2
  /* empty css */
3
- import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
5
- var i = this, e = i._self._c, t = i._self._setupProxy;
6
- return e("div", { staticClass: "d-f f-d-c gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e(t.InSegments, { staticClass: "f-g-1 w-1", attrs: { id: "guido__filter-group-segments", "segment-list": t.filterGroupList, selected: t.selectedFilterGroup, "with-icon": !1 }, on: { click: t.changeFilterGroup } }), e(t.InButtonV2, { staticClass: "w-20-s f-g-1", attrs: { id: "guido__add-filter-group-button", "left-icon": "line-plus-netural", type: "secondary", "disabled-status": t.isMaxFilterGroupCount, "label-text": t.trans("smart-recommender.add-filter-group"), "tooltip-text": t.isMaxFilterGroupCount ? t.trans("email-editor.add-filter-tooltip") : "" }, on: { click: t.handleAddFilterGroup } })], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e("div", { staticClass: "d-f a-i-c" }, [t.selectedFilterGroup > 1 ? e(t.LogicAdapter, { staticClass: "mr-2" }) : i._e(), e("p", [i._v(" " + i._s(t.trans("email-editor.filter-group")) + " " + i._s(t.selectedFilterGroup) + " ")])], 1), t.hasRemoveFilterButton ? e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: t.handleDeleteFilterGroup } }) : i._e()], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b f-d-c" }, i._l(t.selectedFilterGroupFilters, function(l, r) {
7
- return e(t.FilterItem, { key: r, attrs: { filter: l, "has-logic-adapter": t.hasLogicAdapter && r !== t.selectedFilterGroupFilters.length - 1, index: r }, on: { "delete-filter": t.handleDeleteFilter } });
8
- }), 1), e("div", { staticClass: "d-f a-i-c j-c-c mt-3" }, [e(t.InButtonV2, { staticClass: "w-11-s", attrs: { id: "filter-group--add-filter-button", "left-icon": "line-plus-netural", type: "subtle-primary", "label-text": t.trans("smart-recommender.add-filter-condition") }, on: { click: t.handleAddFilter } })], 1)]);
9
- }, d = [], n = /* @__PURE__ */ a(
3
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var a = function() {
5
+ var r = this, e = r._self._c, t = r._self._setupProxy;
6
+ return e("div", { staticClass: "d-f f-d-c gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e(t.InSegments, { staticClass: "f-g-1 w-1", attrs: { id: "guido__filter-group-segments", "segment-list": t.filterGroupList, selected: t.selectedFilterGroup, "with-icon": !1 }, on: { click: t.switchToGroup } }), e(t.InButtonV2, { staticClass: "w-20-s f-g-1", attrs: { id: "guido__add-filter-group-button", "left-icon": "line-plus-netural", type: "secondary", "disabled-status": t.isMaxFilterGroupCount, "label-text": t.trans("smart-recommender.add-filter-group"), "tooltip-options": t.getTooltipOptions("add-filter-group-tooltip"), "tooltip-text": t.isMaxFilterGroupCount ? t.trans("email-editor.add-filter-group-tooltip") : "" }, on: { click: t.handleAddFilterGroup } })], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e("div", { staticClass: "d-f a-i-c" }, [t.selectedFilterGroup > 1 ? e(t.LogicAdapter, { staticClass: "mr-2", attrs: { logic: t.outerGroupOperator }, on: { change: t.handleOuterGroupOperatorChange } }) : r._e(), e("p", [r._v(" " + r._s(t.trans("email-editor.filter-group")) + " " + r._s(t.selectedFilterGroup) + " ")])], 1), t.hasRemoveFilterButton ? e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: t.handleDeleteFilterGroup } }) : r._e()], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b f-d-c" }, r._l(t.selectedFilterGroupFilters, function(l, i) {
7
+ return e(t.FilterItem, { key: i, attrs: { filter: l, "has-logic-adapter": t.hasLogicAdapter && i !== t.selectedFilterGroupFilters.length - 1, index: i, submitted: r.submitted }, on: { "delete-filter": t.handleDeleteFilter } });
8
+ }), 1), e("div", { staticClass: "d-f a-i-c j-c-c mt-3" }, [e(t.InButtonV2, { staticClass: "w-11-s", attrs: { id: "filter-group--add-filter-button", "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.isMaxFilterPerGroupCount, "label-text": t.trans("smart-recommender.add-filter-condition"), "tooltip-text": t.isMaxFilterPerGroupCount ? t.trans("email-editor.add-filter-tooltip") : "" }, on: { click: t.handleAddFilter } })], 1)]);
9
+ }, d = [], n = /* @__PURE__ */ o(
10
10
  s,
11
- o,
11
+ a,
12
12
  d,
13
13
  !1,
14
14
  null,
15
- "1ccb6d4a"
15
+ "0e1b0c54"
16
16
  );
17
- const _ = n.exports;
17
+ const g = n.exports;
18
18
  export {
19
- _ as default
19
+ g as default
20
20
  };
@@ -1,44 +1,56 @@
1
- import { defineComponent as m, computed as o, ref as h } from "vue";
2
- import { useTranslations as G } from "../../../../composables/useTranslations.js";
3
- import { useRecommendationExtensionStore as g } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { InButtonV2 as v, InSegments as f } from "@useinsider/design-system-vue";
5
- import _ from "./FilterItem.vue.js";
6
- import A from "./LogicAdapter.vue.js";
7
- const E = /* @__PURE__ */ m({
1
+ import { defineComponent as v, computed as l, ref as O, watch as f } from "vue";
2
+ import { useTranslations as g } from "../../../../composables/useTranslations.js";
3
+ import { useRecommendationExtensionStore as R } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { getTooltipOptions as T } from "../../../../utils/tooltipUtils.js";
5
+ import { InButtonV2 as U, InSegments as E } from "@useinsider/design-system-vue";
6
+ import A from "./FilterItem.vue.js";
7
+ import C from "./LogicAdapter.vue.js";
8
+ const V = /* @__PURE__ */ v({
8
9
  __name: "Filters",
9
- setup(R) {
10
- const i = G(), l = g(), u = o(() => l.getFilterGroupCount), t = o(() => Array.from({ length: u.value }, (e, a) => ({
11
- text: (a + 1).toString(),
12
- value: a + 1
13
- }))), r = h(1), s = (e) => {
10
+ props: {
11
+ submitted: { type: Boolean }
12
+ },
13
+ emits: ["reset-validation"],
14
+ setup(x, { expose: u, emit: s }) {
15
+ const p = g(), t = R(), a = l(() => t.getUniqueFilterGroups.map((e) => ({
16
+ text: e.toString(),
17
+ value: e
18
+ }))), r = O(1);
19
+ f(a, (e) => {
20
+ if (!e.length)
21
+ return;
22
+ e.some((h) => h.value === r.value) || (r.value = e[0].value);
23
+ });
24
+ const i = (e) => {
14
25
  r.value = e;
15
- }, d = () => {
16
- const e = t.value.length + 1;
17
- console.debug("handleAddFilterGroup", e), t.value.push({
18
- text: e.toString(),
19
- value: e
20
- }), l.addFilterGroup(e);
21
- }, p = o(() => t.value.length >= 3), n = o(() => l.getSelectedFilterGroup(r.value)), c = o(() => n.value.length > 1), F = o(() => t.value.length > 1);
22
- return { __sfc: !0, MAX_FILTER_GROUP_COUNT: 3, trans: i, store: l, filterGroupCount: u, filterGroupList: t, selectedFilterGroup: r, changeFilterGroup: s, handleAddFilterGroup: d, isMaxFilterGroupCount: p, selectedFilterGroupFilters: n, hasLogicAdapter: c, hasRemoveFilterButton: F, handleAddFilter: () => {
23
- l.addFilter({
24
- type: "standardFilter",
25
- attribute: "",
26
- operatorReplace: "",
27
- operator: "",
28
- innerGroupOperator: "*",
29
- outerGroupOperator: "*",
30
- filterNumber: n.value.length + 1,
31
- filterGroup: r.value,
32
- isValid: !1,
33
- value: ""
34
- }), console.debug("handleAddFilter");
26
+ };
27
+ u({ switchToGroup: i });
28
+ const c = () => {
29
+ s("reset-validation");
30
+ const e = t.getUniqueFilterGroups, o = e.length > 0 ? Math.max(...e) + 1 : 1;
31
+ t.addFilterGroup(o), r.value = o;
32
+ }, d = l(() => a.value.length >= 3), n = l(() => t.getSelectedFilterGroup(r.value)), F = l(() => n.value.length >= 10), _ = l(() => n.value.length > 1), G = l(() => a.value.length > 1), m = l(() => {
33
+ var o;
34
+ return ((o = n.value[0]) == null ? void 0 : o.outerGroupOperator) || "*";
35
+ });
36
+ return { __sfc: !0, MAX_FILTER_GROUP_COUNT: 3, MAX_FILTER_PER_GROUP_COUNT: 10, trans: p, store: t, emit: s, filterGroupList: a, selectedFilterGroup: r, switchToGroup: i, handleAddFilterGroup: c, isMaxFilterGroupCount: d, selectedFilterGroupFilters: n, isMaxFilterPerGroupCount: F, hasLogicAdapter: _, hasRemoveFilterButton: G, outerGroupOperator: m, handleOuterGroupOperatorChange: (e) => {
37
+ n.value.forEach((o) => {
38
+ t.updateFilter({ ...o, outerGroupOperator: e });
39
+ });
40
+ }, handleAddFilter: () => {
41
+ s("reset-validation"), t.addFilter(
42
+ t.createDefaultFilter(
43
+ r.value,
44
+ n.value.length + 1
45
+ )
46
+ );
35
47
  }, handleDeleteFilter: (e) => {
36
- console.debug("handleDeleteFilter: ", e), l.deleteFilter(e);
48
+ t.deleteFilter(e);
37
49
  }, handleDeleteFilterGroup: () => {
38
- t.value.length !== 1 && (console.debug("handleDeleteFilterGroup"), t.value.splice(r.value - 1, 1), r.value > 1 && r.value--);
39
- }, InSegments: f, InButtonV2: v, FilterItem: _, LogicAdapter: A };
50
+ a.value.length <= 1 || t.deleteFilterGroup(r.value);
51
+ }, getTooltipOptions: T, InSegments: E, InButtonV2: U, FilterItem: A, LogicAdapter: C };
40
52
  }
41
53
  });
42
54
  export {
43
- E as default
55
+ V as default
44
56
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as s, ref as n } from "vue";
2
- import { InSegments as p } from "@useinsider/design-system-vue";
3
- const l = /* @__PURE__ */ s({
1
+ import { defineComponent as s, ref as n, watch as p } from "vue";
2
+ import { InSegments as g } from "@useinsider/design-system-vue";
3
+ const m = /* @__PURE__ */ s({
4
4
  __name: "LogicAdapter",
5
5
  props: {
6
6
  logic: null
7
7
  },
8
8
  emits: ["change"],
9
- setup(r, { emit: e }) {
10
- const t = r, a = n([
9
+ setup(a, { emit: c }) {
10
+ const t = a, r = n([
11
11
  {
12
12
  text: "and",
13
13
  value: "*"
@@ -17,11 +17,13 @@ const l = /* @__PURE__ */ s({
17
17
  value: "|"
18
18
  }
19
19
  ]), o = n(t.logic || "*");
20
- return { __sfc: !0, logicAdapterList: a, emit: e, props: t, selectedLogicAdapter: o, changeLogicAdapter: (c) => {
21
- o.value = c, e("change", c);
22
- }, InSegments: p };
20
+ return p(() => t.logic, (e) => {
21
+ o.value = e || "*";
22
+ }), { __sfc: !0, logicAdapterList: r, emit: c, props: t, selectedLogicAdapter: o, changeLogicAdapter: (e) => {
23
+ o.value = e, c("change", e);
24
+ }, InSegments: g };
23
25
  }
24
26
  });
25
27
  export {
26
- l as default
28
+ m as default
27
29
  };
@@ -1,8 +1,8 @@
1
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 l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { useConfigStore as C } from "../stores/config.js";
5
+ import { useConfigStore as I } from "../stores/config.js";
6
6
  const N = () => ({
7
7
  calculateCardWidth: ({
8
8
  mobileLeftPadding: i,
@@ -14,7 +14,7 @@ const N = () => ({
14
14
  return (R - e) / r;
15
15
  },
16
16
  getRecommendationCampaignData: (i) => {
17
- const n = l(), o = Number(i), a = n.blockStates[o];
17
+ const n = u(), o = Number(i), a = n.blockStates[o];
18
18
  if (!a)
19
19
  return {
20
20
  textTrimming: !1,
@@ -43,16 +43,16 @@ const N = () => ({
43
43
  };
44
44
  },
45
45
  buildCampaignUrl: (i) => {
46
- var d;
47
- const n = l(), o = C(), a = Number(i), r = n.blockStates[a];
46
+ var m;
47
+ const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
48
48
  if (!r)
49
49
  return "";
50
- const { recommendationConfigs: e } = r, u = ((d = g.find((s) => s.key === e.strategy)) == null ? void 0 : d.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}");
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
52
  const f = e.filters.filter((s) => s.isValid), c = x(f);
53
53
  c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
54
- const m = `${p.RECOMMENDATION_API_URL}/v2/${u}?${t.toString()}`;
55
- return n.recommendationCampaignUrls[i] = m, m;
54
+ const d = `${p.RECOMMENDATION_API_URL}/v2/${l}?${t.toString()}`;
55
+ return n.recommendationCampaignUrls[i] = d, d;
56
56
  }
57
57
  });
58
58
  export {
@@ -1,17 +1,21 @@
1
- import { useConfig as l } from "./useConfig.js";
2
- import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
3
- import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
4
- import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
- const w = () => {
6
- const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
7
- return { save: async (r = !1) => {
1
+ import { useConfig as d } from "./useConfig.js";
2
+ import { useSaveStart as p, useSaveComplete as f } from "./useGuidoActions.js";
3
+ import { useSyncModuleExtractor as v } from "./useSyncModuleExtractor.js";
4
+ import { useStripoApi as S } from "../services/stripoApi.js";
5
+ import { useTemplatePreparation as x } from "../utils/templatePreparation.js";
6
+ import { useHtmlValidator as V } from "./useHtmlValidator.js";
7
+ const g = () => {
8
+ const o = p(), s = f(), { validateHtml: i } = V(), { callbacks: a } = d(), { extractSyncModuleData: r } = v(), { setSyncModuleUnsubscriptionPages: n } = S();
9
+ return { save: async (l = !1) => {
8
10
  var e;
9
- i();
10
- const { prepareTemplateDetails: n } = d(), t = await n();
11
- if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
12
- return r || s(t), t;
11
+ o();
12
+ const { prepareTemplateDetails: c } = x(), t = await c();
13
+ if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
14
+ return;
15
+ const { unsubscribePayload: m, stripoModules: u } = r(t.rawHtml);
16
+ return await n(m), t.modules = u, l || s(t), t;
13
17
  } };
14
18
  };
15
19
  export {
16
- w as useSave
20
+ g as useSave
17
21
  };
@@ -1,27 +1,27 @@
1
- import { useActionsApi as _ } from "./useActionsApi.js";
2
- import { useBlocksConfig as B } from "./useBlocksConfig.js";
3
- import { useConfig as v } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
- import { useToaster as D } from "./useToaster.js";
7
- import { localePatch as I } from "../config/i18n/index.js";
8
- import { displayConditions as M } from "../enums/displayConditions.js";
9
- import { useStripoApi as U } from "../services/stripoApi.js";
10
- import P from "../static/styles/customEditorStyle.css.js";
11
- import { useEditorStore as R } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
13
- import O from "../package.json.js";
14
- const Z = (c) => {
15
- const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = U(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, r = []) => {
16
- var m, f, g;
17
- const o = R(), { html: n, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, T = ((g = y.value) == null ? void 0 : g.forceRecreate) ?? !1;
1
+ import { useActionsApi as A } from "./useActionsApi.js";
2
+ import { useBlocksConfig as F } from "./useBlocksConfig.js";
3
+ import { useConfig as D } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as I } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as P } from "./useStripoEventHandler.js";
6
+ import { useToaster as U } from "./useToaster.js";
7
+ import { localePatch as R } from "../config/i18n/index.js";
8
+ import { displayConditions as H } from "../enums/displayConditions.js";
9
+ import { useStripoApi as O } from "../services/stripoApi.js";
10
+ import q from "../static/styles/customEditorStyle.css.js";
11
+ import { useEditorStore as S } from "../stores/editor.js";
12
+ import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
13
+ import L from "../package.json.js";
14
+ const oe = (C, c) => {
15
+ const { features: l, template: E } = D(), { handleError: u } = U(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = O(), { handleEvent: k } = P(), { getStripoBlocksConfig: T } = F(), V = async (i, n = [], r = !1) => {
16
+ var f, g, y;
17
+ const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await T(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, B = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
18
  window.UIEditor.initEditor(
19
19
  document.querySelector("#guido-editor"),
20
20
  {
21
- metadata: c,
22
- html: n,
23
- css: p,
24
- forceRecreate: T,
21
+ metadata: C,
22
+ html: m,
23
+ css: a,
24
+ forceRecreate: v,
25
25
  locale: "en",
26
26
  undoButtonSelector: "#guido__undo-button",
27
27
  redoButtonSelector: "#guido__redo-button",
@@ -31,89 +31,93 @@ const Z = (c) => {
31
31
  customAppearanceMergetags: !0,
32
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
33
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: P,
35
- conditionsEnabled: a,
36
- customConditionsEnabled: a,
37
- conditionCategories: M,
34
+ customViewStyles: q,
35
+ conditionsEnabled: p,
36
+ customConditionsEnabled: p,
37
+ conditionCategories: H,
38
38
  enableXSSSecurity: !0,
39
- modulesDisabled: k,
39
+ modulesDisabled: B,
40
+ syncModulesEnabled: r,
40
41
  messageSettingsEnabled: !0,
41
42
  displayGmailAnnotations: !0,
42
43
  displayHiddenPreheader: !1,
43
44
  displayTitle: !1,
44
45
  displayUTM: !1,
45
46
  selectElementAfterDrop: !0,
46
- ...s ? { baseBlocks: s } : {},
47
+ ...o ? { baseBlocks: o } : {},
47
48
  editorFonts: {
48
49
  showDefaultStandardFonts: !0,
49
50
  showDefaultNotStandardFonts: !0,
50
- customFonts: r
51
+ customFonts: n
51
52
  },
52
53
  mergeTags: [
53
54
  {
54
- entries: H(c.preselectedDynamicContentList)
55
+ entries: x(c.preselectedDynamicContentList)
55
56
  }
56
57
  ],
57
- async onTokenRefreshRequest(e) {
58
+ async onTokenRefreshRequest(t) {
58
59
  try {
59
- const d = await C();
60
- e(d);
61
- } catch (d) {
62
- u(d, "Failed to refresh token");
60
+ const s = await h();
61
+ t(s);
62
+ } catch (s) {
63
+ u(s, "Failed to refresh token");
63
64
  }
64
65
  },
65
66
  onTemplateLoaded() {
66
67
  try {
67
- const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
68
- e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
69
- o.hasChanges = !1;
68
+ const { importCss: t } = I(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = A();
69
+ t(), s(), M(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
70
+ e.hasChanges = !1;
70
71
  }, 1e3);
71
- } catch (e) {
72
- u(e, "Failed to load custom interface appearance");
72
+ } catch (t) {
73
+ u(t, "Failed to load custom interface appearance");
73
74
  }
74
75
  },
75
- onCodeEditorVisibilityChanged(e) {
76
- o.isCodeEditorOpen = e;
76
+ onCodeEditorVisibilityChanged(t) {
77
+ e.isCodeEditorOpen = t;
77
78
  },
78
- onEditorVisualModeChanged(e) {
79
- o.editorVisualMode = e.toLowerCase();
79
+ onEditorVisualModeChanged(t) {
80
+ e.editorVisualMode = t.toLowerCase();
80
81
  },
81
- onVersionHistoryVisibilityChanged(e) {
82
- o.isVersionHistoryOpen = e;
82
+ onVersionHistoryVisibilityChanged(t) {
83
+ e.isVersionHistoryOpen = t;
83
84
  },
84
85
  onDataChanged() {
85
- o.hasChanges = !0;
86
+ e.hasChanges = !0;
86
87
  },
87
- onEvent: E,
88
+ onEvent: k,
88
89
  ignoreClickOutsideSelectors: [
89
90
  "#guido-dynamic-content-modal",
90
91
  ".in-on-board-wrapper",
91
92
  ".in-drawer__container"
92
93
  ],
93
- extensions: t,
94
- localePatch: I
94
+ extensions: d,
95
+ localePatch: R
95
96
  }
96
97
  );
97
- }, b = (i) => new Promise((r, o) => {
98
- var a;
98
+ }, _ = (i) => new Promise((n, r) => {
99
+ var d;
99
100
  if (document.getElementById("UiEditorScript")) {
100
- i(), r();
101
+ i(), n();
101
102
  return;
102
103
  }
103
- const n = O.guido, s = `https://email-static.useinsider.com/guido/${(a = n == null ? void 0 : n.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
104
- t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
105
- i(), r();
106
- }, t.onerror = () => {
107
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
108
- }, document.body.appendChild(t);
104
+ const e = L.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");
105
+ o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
106
+ i(), n();
107
+ }, o.onerror = () => {
108
+ r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
109
+ }, document.body.appendChild(o);
109
110
  });
110
111
  return { initPlugin: async (i) => {
111
- await b(async () => {
112
- const r = await S();
113
- await w(i, r);
112
+ await _(async () => {
113
+ const n = S(), [r, e] = await Promise.all([
114
+ w(),
115
+ b()
116
+ ]);
117
+ n.syncModulesEnabled = e, await V(i, r, e);
114
118
  });
115
119
  } };
116
120
  };
117
121
  export {
118
- Z as useStripo
122
+ oe as useStripo
119
123
  };
@@ -1,20 +1,35 @@
1
- import { useOnboardingStore as i } from "../stores/onboarding.js";
2
- const c = () => {
3
- const e = {
4
- block_dropped: ({ blockName: t }) => {
5
- if (t === "BLOCK_TEXT") {
6
- const n = i(), o = !n.shouldShowOnboarding("textBlockOnboarding"), r = n.isActive("textBlockOnboarding");
7
- if (o || r)
1
+ import { useStripoApi as i } from "../services/stripoApi.js";
2
+ import { useEditorStore as u } from "../stores/editor.js";
3
+ import { useOnboardingStore as l } from "../stores/onboarding.js";
4
+ import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
5
+ const v = () => {
6
+ const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
7
+ block_dropped: ({ blockName: e }) => {
8
+ if (e === "BLOCK_TEXT") {
9
+ const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
10
+ if (t || c)
8
11
  return;
9
- n.start("textBlockOnboarding");
12
+ o.start("textBlockOnboarding");
10
13
  }
14
+ },
15
+ module_saved: async (e) => {
16
+ n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
17
+ },
18
+ module_dropped: async (e) => {
19
+ if (!n.syncModulesEnabled)
20
+ return;
21
+ const { moduleId: o } = e, t = await r(o);
22
+ console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
23
+ },
24
+ module_updated: async (e) => {
25
+ n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
11
26
  }
12
27
  };
13
- return { handleEvent: async (t, n) => {
14
- const o = e[t];
15
- o && await o(n);
28
+ return { handleEvent: async (e, o) => {
29
+ const t = a[e];
30
+ console.debug("Stripo Event: ", e, o), t && await t(o);
16
31
  } };
17
32
  };
18
33
  export {
19
- c as useStripoEventHandler
34
+ v as useStripoEventHandler
20
35
  };
@@ -0,0 +1,45 @@
1
+ import { UNSUBSCRIBE_SYNC_MODULE_TYPES as T } from "../enums/unsubscribe.js";
2
+ import { DATA_ATTRIBUTES as p } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
+ import { useEditorStore as f } from "../stores/editor.js";
4
+ const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscribe-block"]', _ = "esd-custom-block-id", B = () => {
5
+ const d = f();
6
+ return { extractSyncModuleData: (E) => {
7
+ const S = {
8
+ unsubscribePayload: [],
9
+ stripoModules: []
10
+ };
11
+ if (!d.syncModulesEnabled)
12
+ return S;
13
+ const b = new DOMParser().parseFromString(E, "text/html").querySelectorAll(y), r = [], s = [];
14
+ return b.forEach((o) => {
15
+ const t = o.getAttribute(_);
16
+ if (!t)
17
+ return;
18
+ const n = o.querySelectorAll(A);
19
+ if (n.length === 0) {
20
+ s.push(Number(t));
21
+ return;
22
+ }
23
+ n.forEach((c) => {
24
+ const u = c.getAttribute(p.PAGE_LIST), i = c.getAttribute(p.PAGE_TYPE);
25
+ if (!u || !i)
26
+ return;
27
+ const m = parseInt(i), a = T[m];
28
+ if (!a)
29
+ return;
30
+ const l = u.split(",").map((e) => parseInt(e.trim())).filter((e) => !Number.isNaN(e));
31
+ l.length !== 0 && r.push({
32
+ stripoModuleId: t,
33
+ unsubscriptionPreferencePages: l,
34
+ type: a
35
+ });
36
+ });
37
+ }), {
38
+ unsubscribePayload: r,
39
+ stripoModules: s
40
+ };
41
+ } };
42
+ };
43
+ export {
44
+ B as useSyncModuleExtractor
45
+ };
@@ -106,7 +106,7 @@ function h(e, u) {
106
106
  ` : "") + u.documentElement.outerHTML;
107
107
  }
108
108
  function w(e) {
109
- const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".ins-recommendation-v3-block-v2");
109
+ const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
110
110
  if (!o.length)
111
111
  return e;
112
112
  const { buildCampaignUrl: n } = _();
@@ -17,7 +17,7 @@ class w {
17
17
  const l = o.getAttribute("id"), r = this.extractBgColor(o), i = this.extractTitle(o), u = this.extractProductRows(o), c = P.replace("{-{-TITLE-}-}", i).replace("{-{-PRODUCT_ROWS-}-}", u), a = this.parser.parseFromString(
18
18
  `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
19
19
  "text/html"
20
- ).querySelector(".ins-recommendation-v3-block-v2");
20
+ ).querySelector(".recommendation-block-v2");
21
21
  a && o.parentNode && (l && a.setAttribute("id", l), r && a.setAttribute("bgcolor", r), o.parentNode.replaceChild(a, o));
22
22
  }), t.documentElement.outerHTML);
23
23
  } catch (t) {
@@ -1,17 +1,17 @@
1
1
  import { useTranslations as e } from "../composables/useTranslations.js";
2
2
  import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const I = {
3
+ const _ = {
4
4
  UNSUBSCRIBE_LINK_TYPE: 1,
5
5
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
6
+ }, I = {
7
7
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
12
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
11
+ }, n = R(), r = {
12
+ UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
13
+ PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
14
+ }, B = "iid", i = {
15
15
  name: "Global Unsubscribe",
16
16
  sendGridId: "G"
17
17
  }, C = "/email/unsubscribe-pages", E = {
@@ -20,6 +20,9 @@ const I = {
20
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
22
  RESUBSCRIBE: 5
23
+ }, U = {
24
+ [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
25
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
23
26
  }, t = {
24
27
  [E.GLOBAL_UNSUBSCRIBE]: [
25
28
  E.GLOBAL_UNSUBSCRIBE,
@@ -30,29 +33,30 @@ const I = {
30
33
  E.SUBSCRIPTION_PREFERENCE_CENTER,
31
34
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
35
  ]
33
- }, U = () => {
34
- const n = e();
36
+ }, c = () => {
37
+ const s = e();
35
38
  return {
36
- [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
37
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
38
- [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
39
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
40
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
39
+ [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
40
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
41
+ [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
42
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
43
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
41
44
  };
42
- }, c = {
45
+ }, o = {
43
46
  default: "{{ins-unsubscribe-link}}",
44
47
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
45
48
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
46
49
  };
47
50
  export {
48
- B as DEFAULT_UNSUBSCRIBE_GROUP,
49
- i as INSIDER_ID,
50
- r as LINK_REGEXES,
51
- I as LINK_TYPES,
52
- c as MERGE_TAGS,
51
+ i as DEFAULT_UNSUBSCRIBE_GROUP,
52
+ B as INSIDER_ID,
53
+ I as LINK_REGEXES,
54
+ _ as LINK_TYPES,
55
+ o as MERGE_TAGS,
53
56
  E as PAGE_TYPES,
54
57
  t as TYPE_COLLECTIONS,
55
58
  C as UNSUBSCRIBE_PAGES_LINK,
56
- _ as URLS,
57
- U as getTypeTranslations
59
+ U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
60
+ r as URLS,
61
+ c as getTypeTranslations
58
62
  };