@useinsider/guido 2.0.0 → 2.1.0-beta.e6bf76b

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 (134) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +57 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +15 -17
  5. package/dist/components/organisms/email-preview/PreviewContainer.vue.js +3 -3
  6. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +6 -6
  7. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +17 -13
  8. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +6 -6
  9. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +14 -12
  10. package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.js +18 -0
  11. package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue2.js +15 -0
  12. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -15
  13. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +14 -22
  14. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
  15. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +12 -11
  16. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +12 -10
  17. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +11 -10
  18. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
  19. package/dist/components/organisms/header/EditorActions.vue.js +21 -0
  20. package/dist/components/organisms/header/EditorActions.vue2.js +41 -0
  21. package/dist/components/organisms/header/EditorToolbar.vue.js +18 -0
  22. package/dist/components/organisms/header/EditorToolbar.vue2.js +17 -0
  23. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -5
  24. package/dist/components/organisms/header/LeftSlot.vue.js +9 -9
  25. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -13
  26. package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
  27. package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -15
  28. package/dist/components/organisms/header/RightSlot.vue.js +11 -14
  29. package/dist/components/organisms/header/RightSlot.vue2.js +13 -30
  30. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +5 -5
  31. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +15 -15
  32. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
  33. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +20 -19
  34. package/dist/composables/useActionsApi.js +33 -30
  35. package/dist/composables/useConfig.js +29 -27
  36. package/dist/composables/useSave.js +13 -11
  37. package/dist/composables/useStripo.js +57 -56
  38. package/dist/config/migrator/index.js +9 -8
  39. package/dist/config/migrator/itemsBlockMigrator.js +334 -0
  40. package/dist/enums/academy.js +8 -0
  41. package/dist/enums/onboarding.js +1 -2
  42. package/dist/enums/unsubscribe.js +20 -21
  43. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  44. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  45. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  46. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  47. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  48. package/dist/extensions/Blocks/Items/block.js +36 -40
  49. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  50. package/dist/extensions/Blocks/Items/controls/cardComposition.js +66 -46
  51. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  52. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  53. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  54. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  55. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +44 -38
  56. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  57. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  58. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  59. package/dist/extensions/Blocks/Items/controls/settingsControl.js +146 -131
  60. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  61. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  62. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -5
  63. package/dist/extensions/Blocks/Items/extension.js +11 -9
  64. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
  65. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
  66. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  67. package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
  68. package/dist/extensions/Blocks/Items/template.js +389 -141
  69. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +176 -0
  70. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  71. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  72. package/dist/extensions/Blocks/common-control.js +30 -32
  73. package/dist/extensions/Blocks/controlFactories.js +139 -118
  74. package/dist/guido.css +1 -1
  75. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +370 -286
  76. package/dist/package.json.js +1 -1
  77. package/dist/services/stripoApi.js +6 -10
  78. package/dist/src/@types/config/index.d.ts +2 -2
  79. package/dist/src/@types/config/schemas.d.ts +34 -0
  80. package/dist/src/@types/config/types.d.ts +7 -1
  81. package/dist/src/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.d.ts +2 -0
  82. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +4 -0
  83. package/dist/src/components/organisms/header/EditorToolbar.vue.d.ts +2 -0
  84. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  85. package/dist/src/composables/useActionsApi.d.ts +1 -0
  86. package/dist/src/composables/useConfig.d.ts +10 -0
  87. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  88. package/dist/src/enums/academy.d.ts +12 -0
  89. package/dist/src/enums/onboarding.d.ts +0 -1
  90. package/dist/src/enums/unsubscribe.d.ts +0 -1
  91. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  92. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  93. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  94. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  95. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  96. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  97. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  98. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  99. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  100. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  101. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  102. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -2
  103. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  104. package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
  105. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +76 -0
  106. package/dist/src/extensions/Blocks/common-control.d.ts +10 -11
  107. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  108. package/dist/src/stores/config.d.ts +181 -1
  109. package/dist/src/stores/editor.d.ts +21 -0
  110. package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
  111. package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
  112. package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
  113. package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
  114. package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
  115. package/dist/static/styles/components/button.css.js +1 -1
  116. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  117. package/dist/static/styles/components/wide-panel.css.js +1 -1
  118. package/dist/stores/config.js +7 -0
  119. package/dist/stores/editor.js +1 -0
  120. package/dist/utils/pairProductVariables.js +61 -58
  121. package/dist/utils/templatePreparation.js +17 -17
  122. package/package.json +3 -3
  123. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
  124. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
  125. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  126. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  127. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  128. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  129. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  130. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  131. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  132. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  133. package/dist/static/assets/inbox-mockup.svg.js +0 -4
  134. package/dist/static/assets/phone-mockup.svg.js +0 -4
@@ -1,18 +1,19 @@
1
- import { defineComponent as v, ref as b, computed as m, watch as _ } from "vue";
2
- import B from "../../wrappers/WpDrawer.vue.js";
1
+ import { defineComponent as h, ref as b, computed as g, watch as _ } from "vue";
2
+ import v from "../../wrappers/WpDrawer.vue.js";
3
3
  import { useToaster as U } from "../../../composables/useToaster.js";
4
- import { useTranslations as w } from "../../../composables/useTranslations.js";
5
- import { ToasterTypeOptions as N } from "../../../enums/toaster.js";
6
- import { PAGE_TYPES as l, ACADEMY_LINK as D, getTypeTranslations as P, UNSUBSCRIBE_PAGES_LINK as R } from "../../../enums/unsubscribe.js";
7
- import { useUnsubscribeStore as I } from "../../../stores/unsubscribe.js";
4
+ import { useTranslations as N } from "../../../composables/useTranslations.js";
5
+ import { ACADEMY_LINKS as w } from "../../../enums/academy.js";
6
+ import { ToasterTypeOptions as R } from "../../../enums/toaster.js";
7
+ import { PAGE_TYPES as l, getTypeTranslations as D, UNSUBSCRIBE_PAGES_LINK as I } from "../../../enums/unsubscribe.js";
8
+ import { useUnsubscribeStore as P } from "../../../stores/unsubscribe.js";
8
9
  import { InSegments as G } from "@useinsider/design-system-vue";
9
- const K = /* @__PURE__ */ v({
10
+ const V = /* @__PURE__ */ h({
10
11
  __name: "UnsubscribeTypeSelection",
11
- setup(x) {
12
- const e = w(), { showToaster: f } = U(), t = I(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), S = e(
12
+ setup(L) {
13
+ const e = N(), { showToaster: f } = U(), t = P(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), S = e(
13
14
  "unsubscription-preference.select-unsubscribe-page-description",
14
- { action: `<a href="${D}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
15
- ), T = m(() => [
15
+ { action: `<a href="${w.GLOBAL_UNSUBSCRIBE}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
16
+ ), T = g(() => [
16
17
  {
17
18
  description: e("unsubscription-preference.type-global-unsubscribe-description"),
18
19
  icon: "line-contact-global-unsub-page",
@@ -30,7 +31,7 @@ const K = /* @__PURE__ */ v({
30
31
  disable: t.isSubscriptionPreferencesCenterDisabled,
31
32
  tooltipText: t.isSubscriptionPreferencesCenterDisabled ? e("unsubscription-preference.pref-center-added") : ""
32
33
  }
33
- ]), y = m(() => ({
34
+ ]), y = g(() => ({
34
35
  primaryButton: {
35
36
  styling: "solid",
36
37
  type: "primary",
@@ -56,13 +57,13 @@ const K = /* @__PURE__ */ v({
56
57
  }, 500);
57
58
  }, E = (s) => {
58
59
  o.value = s;
59
- }, g = () => {
60
+ }, m = () => {
60
61
  const s = t.hasTemplatesByCollectionType, r = [];
61
62
  if (Object.entries(s).forEach(([c, p]) => {
62
63
  p || r.push(Number(c));
63
64
  }), r.length === 0)
64
65
  return !0;
65
- const h = P(), a = r.map((c) => h[c]);
66
+ const B = D(), a = r.map((c) => B[c]);
66
67
  let u = "";
67
68
  if (r.length === 1)
68
69
  u = e("unsubscription-preference.create-page-to-continue", {
@@ -81,17 +82,17 @@ const K = /* @__PURE__ */ v({
81
82
  });
82
83
  }
83
84
  return f({
84
- type: N.Warning,
85
+ type: R.Warning,
85
86
  message: u,
86
87
  actionButton: {
87
88
  text: "Go to Unsubscribe Pages",
88
89
  onClick: () => {
89
- window.location.href = R;
90
+ window.location.href = I;
90
91
  }
91
92
  }
92
93
  }), !1;
93
94
  }, C = async () => {
94
- if (n.value = !0, await t.fetchTemplates(), t.setCollection(o.value), !g()) {
95
+ if (n.value = !0, await t.fetchTemplates(), t.setCollection(o.value), !m()) {
95
96
  n.value = !1, d();
96
97
  return;
97
98
  }
@@ -99,9 +100,9 @@ const K = /* @__PURE__ */ v({
99
100
  };
100
101
  return _(() => t.typeSelectionDrawerStatus, (s) => {
101
102
  s && (i.value = !0, o.value = l.GLOBAL_UNSUBSCRIBE, t.isGlobalUnsubscribeDisabled && (o.value = t.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), i.value = !1);
102
- }), { __sfc: !0, trans: e, showToaster: f, unsubscribeStore: t, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: g, selectCollection: C, WpDrawer: B, InSegments: G };
103
+ }), { __sfc: !0, trans: e, showToaster: f, unsubscribeStore: t, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: m, selectCollection: C, WpDrawer: v, InSegments: G };
103
104
  }
104
105
  });
105
106
  export {
106
- K as default
107
+ V as default
107
108
  };
@@ -1,7 +1,7 @@
1
1
  import { useToaster as w } from "./useToaster.js";
2
- const S = () => {
3
- const { handleError: l } = w(), s = (t = {}) => new Promise((e, i) => {
4
- const n = { ...{
2
+ const v = () => {
3
+ const { handleError: l } = w(), r = (t = {}) => new Promise((e, a) => {
4
+ const o = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
7
7
  utmSource: "",
@@ -20,29 +20,29 @@ const S = () => {
20
20
  forceAmp: !1,
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
- }, ...t }, m = {
24
- callback: (o, p, d, c, u) => {
25
- o ? i(o) : e({
23
+ }, ...t }, s = {
24
+ callback: (n, p, d, c, u) => {
25
+ n ? a(n) : e({
26
26
  html: p,
27
27
  ampHtml: d,
28
28
  ampErrors: c,
29
29
  displayConditions: u
30
30
  });
31
31
  },
32
- ...n
32
+ ...o
33
33
  };
34
- window.StripoEditorApi.actionsApi.compileEmail(m);
34
+ window.StripoEditorApi.actionsApi.compileEmail(s);
35
35
  });
36
36
  return {
37
- getCompiledEmail: s,
37
+ getCompiledEmail: r,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: i, css: a, width: n, height: r, utmParams: m, syncModulesIds: o }) => t({
40
- html: i,
41
- css: a,
42
- width: n,
43
- height: r,
44
- utmParams: m,
45
- syncModulesIds: o
39
+ const e = ({ html: a, css: i, width: o, height: m, utmParams: s, syncModulesIds: n }) => t({
40
+ html: a,
41
+ css: i,
42
+ width: o,
43
+ height: m,
44
+ utmParams: s,
45
+ syncModulesIds: n
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -53,15 +53,15 @@ const S = () => {
53
53
  try {
54
54
  const {
55
55
  html: e,
56
- displayConditions: i,
57
- ampHtml: a = "",
58
- ampErrors: n = []
59
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
56
+ displayConditions: a,
57
+ ampHtml: i = "",
58
+ ampErrors: o = []
59
+ } = await r({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
- ampHtml: a,
63
- ampErrors: n,
64
- displayConditions: i
62
+ ampHtml: i,
63
+ ampErrors: o,
64
+ displayConditions: a
65
65
  };
66
66
  } catch (e) {
67
67
  return l(e, "Error loading preview"), {
@@ -73,24 +73,27 @@ const S = () => {
73
73
  }
74
74
  },
75
75
  updateTimerInClonedTemplate: () => new Promise((t) => {
76
- var e, i;
77
- if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
76
+ var e, a;
77
+ if (typeof ((a = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : a.updateTimerInClonedTemplate) != "function") {
78
78
  t(null);
79
79
  return;
80
80
  }
81
81
  try {
82
- window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, n) => {
83
- a ? (l(a, "Failed to update timer in cloned template"), t(null)) : t(n || null);
82
+ window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
83
+ i ? (l(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
84
84
  });
85
- } catch (a) {
86
- l(a, "Failed to call updateTimerInClonedTemplate"), t(null);
85
+ } catch (i) {
86
+ l(i, "Failed to call updateTimerInClonedTemplate"), t(null);
87
87
  }
88
88
  }),
89
89
  updateHtmlAndCss: (t, e) => {
90
90
  window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
+ },
92
+ editorSave: () => {
93
+ window.StripoEditorApi.actionsApi.save();
91
94
  }
92
95
  };
93
96
  };
94
97
  export {
95
- S as useActionsApi
98
+ v as useActionsApi
96
99
  };
@@ -1,26 +1,27 @@
1
- import { useConfigStore as F } from "../stores/config.js";
2
- import { storeToRefs as I } from "pinia";
3
- const k = () => {
4
- const e = F(), {
1
+ import { useConfigStore as I } from "../stores/config.js";
2
+ import { storeToRefs as T } from "pinia";
3
+ const w = () => {
4
+ const e = I(), {
5
5
  config: t,
6
6
  initialized: o,
7
7
  identity: r,
8
8
  partner: i,
9
- template: n,
10
- editor: a,
9
+ template: a,
10
+ editor: n,
11
11
  ui: s,
12
- features: u,
13
- blocks: d,
14
- compiler: p,
15
- templateId: c,
12
+ features: c,
13
+ blocks: u,
14
+ compiler: d,
15
+ callbacks: l,
16
+ templateId: p,
16
17
  userId: f,
17
18
  variationId: m,
18
19
  partnerName: g,
19
- productType: l,
20
- messageType: b,
21
- username: C,
22
- showHeader: y
23
- } = I(e);
20
+ productType: b,
21
+ messageType: C,
22
+ username: y,
23
+ showHeader: E
24
+ } = T(e);
24
25
  return {
25
26
  // State refs
26
27
  config: t,
@@ -28,26 +29,27 @@ const k = () => {
28
29
  // Section refs
29
30
  identity: r,
30
31
  partner: i,
31
- template: n,
32
- editor: a,
32
+ template: a,
33
+ editor: n,
33
34
  ui: s,
34
- features: u,
35
- blocks: d,
36
- compiler: p,
35
+ features: c,
36
+ blocks: u,
37
+ compiler: d,
38
+ callbacks: l,
37
39
  // Convenience refs
38
- templateId: c,
40
+ templateId: p,
39
41
  userId: f,
40
42
  variationId: m,
41
43
  partnerName: g,
42
- productType: l,
43
- messageType: b,
44
- username: C,
45
- showHeader: y,
44
+ productType: b,
45
+ messageType: C,
46
+ username: y,
47
+ showHeader: E,
46
48
  // Methods
47
49
  getConfig: () => t.value,
48
- isFeatureEnabled: (E) => e.isFeatureEnabled(E)
50
+ isFeatureEnabled: (F) => e.isFeatureEnabled(F)
49
51
  };
50
52
  };
51
53
  export {
52
- k as useConfig
54
+ w as useConfig
53
55
  };
@@ -1,15 +1,17 @@
1
- import { useSaveStart as i, useSaveComplete as m } from "./useGuidoActions.js";
2
- import { useTemplatePreparation as n } from "../utils/templatePreparation.js";
3
- import { useHtmlValidator as l } from "./useHtmlValidator.js";
4
- const f = () => {
5
- const e = i(), a = m(), { validateHtml: s } = l();
6
- return { save: async (o = !1) => {
7
- e();
8
- const { prepareTemplateDetails: r } = n(), t = await r();
9
- if (await s(t.compiledHtml, t.dynamicContentList, !0))
10
- return o || a(t), t;
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) => {
8
+ 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
13
  } };
12
14
  };
13
15
  export {
14
- f as useSave
16
+ w as useSave
15
17
  };
@@ -1,26 +1,26 @@
1
- import { useActionsApi as b } from "./useActionsApi.js";
2
- import { useBlocksConfig as k } from "./useBlocksConfig.js";
3
- import { useConfig as T } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
6
- import { useToaster as B } from "./useToaster.js";
7
- import { displayConditions as A } from "../enums/displayConditions.js";
8
- import { useStripoApi as v } from "../services/stripoApi.js";
9
- import F from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as I } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as M } from "../utils/genericUtil.js";
12
- import U from "../package.json.js";
13
- const N = (c) => {
14
- const { features: g } = T(), { handleError: l } = B(), { getToken: f, getCustomFonts: y } = v(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = k(), E = async (i, r = []) => {
15
- var m;
16
- const e = I(), { html: n, css: u, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await C(), p = ((m = g.value) == null ? void 0 : m.displayConditions) ?? !0;
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 { displayConditions as I } from "../enums/displayConditions.js";
8
+ import { useStripoApi as M } from "../services/stripoApi.js";
9
+ import U from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as P } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
+ import H from "../package.json.js";
13
+ const W = (c) => {
14
+ const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
+ var m, g, f;
16
+ const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
20
20
  metadata: c,
21
- html: n,
22
- css: u,
23
- forceRecreate: a,
21
+ html: r,
22
+ css: p,
23
+ forceRecreate: T,
24
24
  locale: "en",
25
25
  undoButtonSelector: "#guido__undo-button",
26
26
  redoButtonSelector: "#guido__redo-button",
@@ -30,87 +30,88 @@ const N = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: F,
34
- conditionsEnabled: p,
35
- customConditionsEnabled: p,
36
- conditionCategories: A,
33
+ customViewStyles: U,
34
+ conditionsEnabled: a,
35
+ customConditionsEnabled: a,
36
+ conditionCategories: I,
37
37
  enableXSSSecurity: !0,
38
+ modulesDisabled: k,
38
39
  messageSettingsEnabled: !0,
39
40
  displayGmailAnnotations: !0,
40
41
  displayHiddenPreheader: !1,
41
42
  displayTitle: !1,
42
43
  displayUTM: !1,
43
44
  selectElementAfterDrop: !0,
44
- ...t ? { baseBlocks: t } : {},
45
+ ...s ? { baseBlocks: s } : {},
45
46
  editorFonts: {
46
47
  showDefaultStandardFonts: !0,
47
48
  showDefaultNotStandardFonts: !0,
48
- customFonts: r
49
+ customFonts: n
49
50
  },
50
51
  mergeTags: [
51
52
  {
52
- entries: M(c.preselectedDynamicContentList)
53
+ entries: R(c.preselectedDynamicContentList)
53
54
  }
54
55
  ],
55
- async onTokenRefreshRequest(o) {
56
+ async onTokenRefreshRequest(e) {
56
57
  try {
57
- const s = await f();
58
- o(s);
59
- } catch (s) {
60
- l(s, "Failed to refresh token");
58
+ const d = await C();
59
+ e(d);
60
+ } catch (d) {
61
+ u(d, "Failed to refresh token");
61
62
  }
62
63
  },
63
64
  onTemplateLoaded() {
64
65
  try {
65
- const { importCss: o } = V(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: w } = b();
66
- o(), s(), w(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
67
- e.hasChanges = !1;
66
+ const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
67
+ e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
68
+ o.hasChanges = !1;
68
69
  }, 1e3);
69
- } catch (o) {
70
- l(o, "Failed to load custom interface appearance");
70
+ } catch (e) {
71
+ u(e, "Failed to load custom interface appearance");
71
72
  }
72
73
  },
73
- onCodeEditorVisibilityChanged(o) {
74
- e.isCodeEditorOpen = o;
74
+ onCodeEditorVisibilityChanged(e) {
75
+ o.isCodeEditorOpen = e;
75
76
  },
76
- onEditorVisualModeChanged(o) {
77
- e.editorVisualMode = o.toLowerCase();
77
+ onEditorVisualModeChanged(e) {
78
+ o.editorVisualMode = e.toLowerCase();
78
79
  },
79
- onVersionHistoryVisibilityChanged(o) {
80
- e.isVersionHistoryOpen = o;
80
+ onVersionHistoryVisibilityChanged(e) {
81
+ o.isVersionHistoryOpen = e;
81
82
  },
82
83
  onDataChanged() {
83
- e.hasChanges = !0;
84
+ o.hasChanges = !0;
84
85
  },
85
- onEvent: S,
86
+ onEvent: E,
86
87
  ignoreClickOutsideSelectors: [
87
88
  "#guido-dynamic-content-modal",
88
89
  ".in-on-board-wrapper",
89
90
  ".in-drawer__container"
90
91
  ],
91
- extensions: d
92
+ extensions: t
92
93
  }
93
94
  );
94
- }, h = (i) => new Promise((r, e) => {
95
- var d;
95
+ }, b = (i) => new Promise((n, o) => {
96
+ var a;
96
97
  if (document.getElementById("UiEditorScript")) {
97
- i(), r();
98
+ i(), n();
98
99
  return;
99
100
  }
100
- const n = U.guido, a = `https://email-static.useinsider.com/guido/${(d = n == null ? void 0 : n.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
101
- t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
102
- i(), r();
101
+ const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
102
+ t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
103
+ i(), n();
103
104
  }, t.onerror = () => {
104
- e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
+ o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
105
106
  }, document.body.appendChild(t);
106
107
  });
107
108
  return { initPlugin: async (i) => {
108
- await h(async () => {
109
- const r = await y();
110
- await E(i, r);
109
+ await b(async () => {
110
+ const n = await S();
111
+ await w(i, n);
111
112
  });
112
113
  } };
113
114
  };
114
115
  export {
115
- N as useStripo
116
+ W as useStripo
116
117
  };
@@ -1,12 +1,13 @@
1
- import { migrateCheckbox as m } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
3
- import { migrateRadioButton as i } from "./radioButtonMigrator.js";
4
- import { migrateRecommendation as e } from "./recommendationMigrator.js";
5
- import { migrateUnsubscribe as a } from "./unsubscribeMigrator.js";
6
- const s = async (t) => {
7
- let r = t;
8
- return r = m(r), r = i(r), r = await a(r), r = o(r), r = e(r), r;
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) => {
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
10
  };
10
11
  export {
11
- s as migrate
12
+ u as migrate
12
13
  };