@useinsider/guido 3.4.1-beta.b69af42 → 3.4.1-beta.c04b4e7

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.
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "dee2e207"
15
+ "cdee3452"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,4 +1,4 @@
1
- import { defineComponent as J, defineAsyncComponent as N, ref as I, computed as W, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
1
+ import { defineComponent as J, defineAsyncComponent as R, ref as I, computed as W, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
2
2
  import { useCortexBlueprintBridge as Z } from "../composables/useCortexBlueprintBridge.js";
3
3
  import { provideGuidoActions as ee } from "../composables/useGuidoActions.js";
4
4
  import { useGuidoStateBridge as oe } from "../composables/useGuidoStateBridge.js";
@@ -8,36 +8,35 @@ import { useTimerClone as re } from "../composables/useTimerClone.js";
8
8
  import { migrate as x } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as G } from "../enums/defaults.js";
10
10
  import { RIBBON_SELECTOR as se } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as ce } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import ae from "./organisms/AutoSaveController.vue.js";
13
- import ie from "./organisms/base/Toaster.vue.js";
14
- import me from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import de from "./organisms/header/HeaderWrapper.vue.js";
16
- import le from "./organisms/LoadingWrapper.vue.js";
17
- import ue from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import pe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as fe } from "../services/stripoApi.js";
20
- import { useConfigStore as ve } from "../stores/config.js";
21
- import { useDynamicContentStore as ye } from "../stores/dynamic-content.js";
22
- import { useEditorStore as Se } from "../stores/editor.js";
11
+ import ce from "./organisms/AutoSaveController.vue.js";
12
+ import ae from "./organisms/base/Toaster.vue.js";
13
+ import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
14
+ import me from "./organisms/header/HeaderWrapper.vue.js";
15
+ import de from "./organisms/LoadingWrapper.vue.js";
16
+ import le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
17
+ import ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
18
+ import { useStripoApi as pe } from "../services/stripoApi.js";
19
+ import { useConfigStore as fe } from "../stores/config.js";
20
+ import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
21
+ import { useEditorStore as ye } from "../stores/editor.js";
23
22
  import { usePreviewStore as he } from "../stores/preview.js";
24
- import { useUnsubscribeStore as be } from "../stores/unsubscribe.js";
25
- const $e = /* @__PURE__ */ J({
23
+ import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
24
+ const He = /* @__PURE__ */ J({
26
25
  __name: "Guido",
27
26
  props: {
28
27
  config: null
29
28
  },
30
29
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
31
30
  setup(H, { expose: z, emit: n }) {
32
- const g = H, $ = N(
31
+ const g = H, q = R(
33
32
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
34
- ), q = N(
33
+ ), K = R(
35
34
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
36
- ), E = I(), u = I(), p = ye(), w = be(), i = ve();
35
+ ), w = I(), u = I(), p = ve(), E = Se(), i = fe();
37
36
  i.init(g.config);
38
- const f = Se(), K = he(), m = W(() => f.hasChanges), { isTestPartner: V } = te(), D = () => {
37
+ const f = ye(), V = he(), m = W(() => f.hasChanges), { isTestPartner: $ } = te(), D = () => {
39
38
  var e;
40
- return (e = E.value) == null ? void 0 : e.handleSave(!0);
39
+ return (e = w.value) == null ? void 0 : e.handleSave(!0);
41
40
  }, {
42
41
  templateId: v,
43
42
  userId: C,
@@ -47,7 +46,7 @@ const $e = /* @__PURE__ */ J({
47
46
  editor: s
48
47
  } = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
49
48
  f.templateId = v, Z(), oe();
50
- const S = {
49
+ const h = {
51
50
  emailId: v,
52
51
  userId: C,
53
52
  username: k,
@@ -59,7 +58,7 @@ const $e = /* @__PURE__ */ J({
59
58
  onReady: () => {
60
59
  console.debug("guido:ready"), n("ready");
61
60
  }
62
- }, { initPlugin: M } = ne(S, _), { getDefaultTemplate: O } = fe(), { cloneTimersOnSave: P, hasTimerBlocks: R } = re(), j = W(() => {
61
+ }, { initPlugin: M } = ne(h, _), { getDefaultTemplate: O } = pe(), { cloneTimersOnSave: P, hasTimerBlocks: A } = re(), j = W(() => {
63
62
  var e;
64
63
  return !((e = i.ui) != null && e.showHeader);
65
64
  });
@@ -71,22 +70,22 @@ const $e = /* @__PURE__ */ J({
71
70
  console.debug("guido:save:start"), n("save:start");
72
71
  },
73
72
  onSaveComplete: (e) => {
74
- const t = { ...e, metadata: S };
73
+ const t = { ...e, metadata: h };
75
74
  console.debug("guido:save:complete", t), n("save:complete", t);
76
75
  },
77
76
  onTestEmailClick: () => {
78
77
  console.debug("guido:test-email:click"), n("test-email:click");
79
78
  }
80
79
  });
81
- const A = (e) => {
80
+ const B = (e) => {
82
81
  console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
83
- }, B = () => {
82
+ }, N = () => {
84
83
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
85
84
  };
86
85
  Q(() => m.value, () => {
87
86
  n("on-change", m.value);
88
87
  });
89
- const h = (e) => {
88
+ const S = (e) => {
90
89
  const t = e, { attribute: l, position: a } = t.detail;
91
90
  console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
92
91
  };
@@ -98,23 +97,23 @@ const $e = /* @__PURE__ */ J({
98
97
  };
99
98
  return X(async () => {
100
99
  var t, l;
101
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ce().$reset(), b();
100
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
102
101
  const e = (t = u.value) == null ? void 0 : t.parentElement;
103
102
  e && (c = new ResizeObserver(b), c.observe(e));
104
103
  try {
105
- w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
104
+ E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
106
105
  const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
107
106
  let r = {
108
107
  html: d && await x(d, a),
109
108
  css: F
110
109
  };
111
- r.html || (r = await O(), r.html = await x(r.html, a)), R(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
110
+ r.html || (r = await O(), r.html = await x(r.html, a)), A(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
112
111
  } catch (a) {
113
112
  console.error("Failed to initialize Stripo editor:", a);
114
113
  }
115
- document.addEventListener("dynamic-content:open", h);
114
+ document.addEventListener("dynamic-content:open", S);
116
115
  }), Y(() => {
117
- c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", h);
116
+ c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", S);
118
117
  try {
119
118
  window.UIEditor.removeEditor();
120
119
  } catch {
@@ -123,14 +122,14 @@ const $e = /* @__PURE__ */ J({
123
122
  i.reset();
124
123
  }), z({
125
124
  dynamicContent: {
126
- insert: A,
127
- close: B
125
+ insert: B,
126
+ close: N
128
127
  },
129
128
  hasChanges: m,
130
129
  saveSilent: D
131
- }), { __sfc: !0, PreviewContainer: $, OnboardingWrapper: q, headerWrapperRef: E, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: w, props: g, configStore: i, editorStore: f, previewStore: K, hasChanges: m, isTestPartner: V, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: S, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: R, noHeader: j, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: h, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ae, Toaster: ie, FilterSelectionDrawer: me, HeaderWrapper: de, LoadingWrapper: le, SaveAsTemplateDrawer: ue, UnsubscribeWrapper: pe };
130
+ }), { __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: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: A, noHeader: j, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: S, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ce, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: me, LoadingWrapper: de, SaveAsTemplateDrawer: le, UnsubscribeWrapper: ue };
132
131
  }
133
132
  });
134
133
  export {
135
- $e as default
134
+ He as default
136
135
  };
@@ -21,9 +21,9 @@ const v = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, s = {
24
- callback: (l, r, d, c, u) => {
24
+ callback: (l, p, d, c, u) => {
25
25
  l ? a(l) : e({
26
- html: r,
26
+ html: p,
27
27
  ampHtml: d,
28
28
  ampErrors: c,
29
29
  displayConditions: u
@@ -36,11 +36,11 @@ const v = () => {
36
36
  return {
37
37
  getCompiledEmail: m,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: i, width: o, height: p, utmParams: s, syncModulesIds: l }) => t({
39
+ const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
40
40
  html: a,
41
41
  css: i,
42
42
  width: o,
43
- height: p,
43
+ height: r,
44
44
  utmParams: s,
45
45
  syncModulesIds: l
46
46
  });
@@ -91,7 +91,11 @@ const v = () => {
91
91
  },
92
92
  editorSave: () => new Promise((t) => {
93
93
  window.StripoEditorApi.actionsApi.save((e) => {
94
- e && n(e, "Failed to save template"), t();
94
+ if (e) {
95
+ n(e, "Failed to save template"), t(!1);
96
+ return;
97
+ }
98
+ t(!0);
95
99
  });
96
100
  })
97
101
  };
@@ -1,32 +1,31 @@
1
1
  import { useActionsApi as x } from "./useActionsApi.js";
2
2
  import { useConfig as y } from "./useConfig.js";
3
3
  import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as H } 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 L } from "./useHtmlValidator.js";
8
- import { useCouponBlockValidator as P } from "./validators/useCouponBlockValidator.js";
9
- import { useLiquidValidator as E } from "./validators/useLiquidValidator.js";
10
- const j = () => {
11
- const o = w(), s = C(), { validateHtml: r } = L(), { validateLiquidSyntax: l } = E(), { validateCouponBlockTags: n } = P(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = H(), { setSyncModuleUnsubscriptionPages: c } = b(), { editorSave: m } = x();
4
+ import { useSyncModuleExtractor as E } from "./useSyncModuleExtractor.js";
5
+ import { useStripoApi as H } from "../services/stripoApi.js";
6
+ import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
7
+ import { useHtmlValidator as q } from "./useHtmlValidator.js";
8
+ import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
+ import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
+ const z = () => {
11
+ const o = w(), s = C(), { validateHtml: r } = q(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = E(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = x();
12
12
  return { save: async (p = !1, f = !1) => {
13
13
  var i;
14
14
  o();
15
- const { prepareTemplateDetails: v } = q(), t = await v();
16
- if (!n(t.compiledHtml))
15
+ const { prepareTemplateDetails: v } = b(), t = await v();
16
+ if (!l(t.compiledHtml))
17
17
  return;
18
18
  if (d("liquidSyntax")) {
19
- if (!await l(t.compiledHtml))
19
+ if (!await n(t.compiledHtml))
20
20
  return;
21
21
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
22
22
  return;
23
- if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
23
+ if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
24
24
  return;
25
- await m();
26
25
  const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
27
26
  return await c(S), t.modules = V, p || s({ ...t, silent: f }), t;
28
27
  } };
29
28
  };
30
29
  export {
31
- j as useSave
30
+ z as useSave
32
31
  };
@@ -1,31 +1,34 @@
1
1
  var d = Object.defineProperty;
2
- var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
4
- import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
5
- import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
6
- import { Block as _, BlockCompositionType as S, BlockType as L, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { getDefaultTemplate as v } from "./template.js";
8
- import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
9
- import { parsePageList as p } from "./utils/utils.js";
10
- const g = "unsubscribe-block", T = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", B = "{{ins-unsubscribe-link}}", C = {
11
- [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
12
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
2
+ var _ = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
+ var c = (n, i, e) => _(n, typeof i != "symbol" ? i + "" : i, e);
4
+ import { useToaster as L } from "../../../composables/useToaster.js";
5
+ import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
6
+ import { PAGE_TYPES as b } from "../../../enums/unsubscribe.js";
7
+ import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
8
+ import { Block as g, BlockCompositionType as v, BlockType as k, ModificationDescription as E } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
+ import { getDefaultTemplate as f } from "./template.js";
10
+ import { UNSUBSCRIBE_EVENTS as u, DATA_ATTRIBUTES as o } from "./utils/constants.js";
11
+ import { parsePageList as h } from "./utils/utils.js";
12
+ const T = "unsubscribe-block", p = 'a[data-unsubscribe-link="true"]', B = ".unsubscribe-block-v2", U = "{{ins-unsubscribe-link}}", C = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", A = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", N = {
13
+ [b.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
+ [b.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
13
15
  };
14
- class I extends _ {
16
+ class x extends g {
15
17
  constructor() {
16
18
  super();
17
- u(this, "selectEventListener", null);
18
- u(this, "cancelEventListener", null);
19
- u(this, "currentNode");
19
+ c(this, "selectEventListener", null);
20
+ c(this, "cancelEventListener", null);
21
+ c(this, "currentNode");
22
+ c(this, "hadUnsubscribeLink", !1);
20
23
  }
21
24
  getId() {
22
- return g;
25
+ return T;
23
26
  }
24
27
  getIcon() {
25
28
  return "unsubscribe-icon";
26
29
  }
27
30
  getBlockCompositionType() {
28
- return S.BLOCK;
31
+ return v.BLOCK;
29
32
  }
30
33
  getName() {
31
34
  return this.api.translate("Unsubscribe Block");
@@ -34,39 +37,63 @@ class I extends _ {
34
37
  return this.api.translate("Unsubscribe Block Description");
35
38
  }
36
39
  getTemplate() {
37
- return v();
40
+ return f();
38
41
  }
39
42
  onSelect(e) {
40
- this.currentNode = e, !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
43
+ this.currentNode = e, this.hadUnsubscribeLink = this._hasUnsubscribeLink(e), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
44
+ }
45
+ onDocumentChanged(e) {
46
+ const t = this._hasUnsubscribeLink(e);
47
+ this.hadUnsubscribeLink && !t && this._warnLinkRemoved(), this.hadUnsubscribeLink = t;
41
48
  }
42
49
  onDelete(e) {
43
- this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
50
+ this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState(), this.hadUnsubscribeLink = !1;
44
51
  }
45
52
  onDestroy() {
46
- this._removeEventListeners(), this.currentNode = void 0;
53
+ this._removeEventListeners(), this.currentNode = void 0, this.hadUnsubscribeLink = !1;
54
+ }
55
+ _hasUnsubscribeLink(e) {
56
+ return "querySelector" in e ? !!e.querySelector(p) : !1;
57
+ }
58
+ _warnLinkRemoved() {
59
+ try {
60
+ const { showToaster: e } = L();
61
+ e({
62
+ type: S.Warning,
63
+ message: this.api.translate(A),
64
+ actionButton: {
65
+ text: this.api.translate("Visit Academy"),
66
+ onClick: () => {
67
+ window.open(C, "_blank", "noopener,noreferrer");
68
+ }
69
+ }
70
+ });
71
+ } catch (e) {
72
+ console.error("[UnsubscribeBlock] Failed to show warning toaster:", e);
73
+ }
47
74
  }
48
75
  _setupSelectEventListener() {
49
76
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
50
- const r = e, { collectionType: s, selectedPages: t } = r.detail;
51
- this._updateBlock(s, t.join(","));
52
- }, document.addEventListener(a.SELECT, this.selectEventListener);
77
+ const t = e, { collectionType: r, selectedPages: s } = t.detail;
78
+ this._updateBlock(r, s.join(","));
79
+ }, document.addEventListener(u.SELECT, this.selectEventListener);
53
80
  }
54
81
  _removeSelectEventListener() {
55
- this.selectEventListener && (document.removeEventListener(a.SELECT, this.selectEventListener), this.selectEventListener = null);
82
+ this.selectEventListener && (document.removeEventListener(u.SELECT, this.selectEventListener), this.selectEventListener = null);
56
83
  }
57
84
  _setupCancelEventListener() {
58
85
  this._removeCancelEventListener(), this.cancelEventListener = () => {
59
86
  this._handleCancel();
60
- }, document.addEventListener(a.CANCEL, this.cancelEventListener);
87
+ }, document.addEventListener(u.CANCEL, this.cancelEventListener);
61
88
  }
62
89
  _removeCancelEventListener() {
63
- this.cancelEventListener && (document.removeEventListener(a.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
90
+ this.cancelEventListener && (document.removeEventListener(u.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
64
91
  }
65
92
  _handleCancel() {
66
93
  try {
67
94
  if (!this.currentNode)
68
95
  return;
69
- this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${L.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
96
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${k.EMPTY_CONTAINER}/>`).apply(new E("Removed unsubscribe block due to cancel"));
70
97
  } catch (e) {
71
98
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
72
99
  }
@@ -74,35 +101,35 @@ class I extends _ {
74
101
  _removeEventListeners() {
75
102
  this._removeSelectEventListener(), this._removeCancelEventListener();
76
103
  }
77
- _updateBlock(e, r) {
104
+ _updateBlock(e, t) {
78
105
  if (!this.currentNode || !("querySelector" in this.currentNode))
79
106
  return;
80
- const s = this.currentNode.querySelector(T);
81
- if (!s)
107
+ const r = this.currentNode.querySelector(p);
108
+ if (!r)
82
109
  return;
83
- const t = this._getMergeTag(e);
84
- this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
110
+ const s = this._getMergeTag(e);
111
+ this.api.getDocumentModifier().modifyHtml(r).setAttribute("href", s).apply(new E(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, t).apply(new E("Updated unsubscribe block metadata"));
85
112
  }
86
113
  _getMergeTag(e) {
87
- return C[e] ?? B;
114
+ return N[e] ?? U;
88
115
  }
89
116
  _openDrawer() {
90
117
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
91
118
  try {
92
- const e = c();
119
+ const e = a();
93
120
  e.typeSelectionDrawerStatus = !0;
94
121
  } catch (e) {
95
122
  console.error("[UnsubscribeBlock] Failed to open drawer:", e);
96
123
  }
97
124
  }
98
125
  _checkExistingBlocks() {
99
- const e = c();
100
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((s) => {
101
- if ("getAttribute" in s) {
102
- const t = s.getAttribute(o.PAGE_TYPE);
103
- if (t) {
104
- const l = Number(t);
105
- l === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
126
+ const e = a();
127
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(B).forEach((r) => {
128
+ if ("getAttribute" in r) {
129
+ const s = r.getAttribute(o.PAGE_TYPE);
130
+ if (s) {
131
+ const l = Number(s);
132
+ l === b.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === b.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
106
133
  }
107
134
  }
108
135
  });
@@ -110,26 +137,26 @@ class I extends _ {
110
137
  async _loadBlockState(e) {
111
138
  if (!("getAttribute" in e))
112
139
  return;
113
- const r = e.getAttribute(o.PAGE_TYPE), s = e.getAttribute(o.PAGE_LIST);
114
- if (!r || !s)
140
+ const t = e.getAttribute(o.PAGE_TYPE), r = e.getAttribute(o.PAGE_LIST);
141
+ if (!t || !r)
115
142
  return;
116
- const t = c(), l = Number(r), m = p(s);
117
- await t.fetchTemplates(), t.setCollectionWithoutAutoSelection(l), t.loadSelectedTemplates(m);
143
+ const s = a(), l = Number(t), m = h(r);
144
+ await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(l), s.loadSelectedTemplates(m);
118
145
  }
119
146
  _resetStoreState() {
120
- c().$reset();
147
+ a().$reset();
121
148
  }
122
149
  _removeBlockTemplatesFromStore(e) {
123
150
  if (!("getAttribute" in e))
124
151
  return;
125
- const r = e.getAttribute(o.PAGE_LIST);
126
- if (!r)
152
+ const t = e.getAttribute(o.PAGE_LIST);
153
+ if (!t)
127
154
  return;
128
- const s = c(), t = p(r);
129
- s.removeUnsubscribePages(t);
155
+ const r = a(), s = h(t);
156
+ r.removeUnsubscribePages(s);
130
157
  }
131
158
  }
132
159
  export {
133
- g as UNSUBSCRIBE_BLOCK_ID,
134
- I as UnsubscribeBlock
160
+ T as UNSUBSCRIBE_BLOCK_ID,
161
+ x as UnsubscribeBlock
135
162
  };
@@ -1,22 +1,22 @@
1
- import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const s = "unsubscribe", n = "{{ins-unsubscribe-link}}", t = `
3
- <${e.BLOCK_TEXT}
1
+ import { BlockType as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const e = "unsubscribe", n = "{{ins-unsubscribe-link}}", t = `
3
+ <${s.BLOCK_TEXT}
4
4
  class="unsubscribe-block-v2 esd-block-unsubscribe es-p0"
5
5
  align="center"
6
6
  data-unsubscribe-page-type=""
7
7
  data-unsubscribe-page-list=""
8
8
  >
9
- <p>You can <strong><a
9
+ <p>&nbsp;<strong><a
10
10
  href="${n}"
11
11
  class="unsubscribe-link"
12
12
  target="_blank"
13
13
  data-unsubscribe-link="true"
14
- >${s}</a></strong> from our emails, if you need to.</p>
15
- </${e.BLOCK_TEXT}>
14
+ >${e}</a></strong></p>
15
+ </${s.BLOCK_TEXT}>
16
16
  `;
17
- function r() {
17
+ function u() {
18
18
  return t;
19
19
  }
20
20
  export {
21
- r as getDefaultTemplate
21
+ u as getDefaultTemplate
22
22
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-dee2e207]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-dee2e207]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-dee2e207]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-cdee3452]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-cdee3452]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-cdee3452]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
@@ -7,5 +7,5 @@ export declare const useActionsApi: () => {
7
7
  getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
8
8
  updateTimerInClonedTemplate: () => Promise<string | null>;
9
9
  updateHtmlAndCss: (html: string, css: string) => void;
10
- editorSave: () => Promise<void>;
10
+ editorSave: () => Promise<boolean>;
11
11
  };
@@ -1,10 +1,11 @@
1
- import type { ImmutableHtmlElementNode } from '@stripoinc/ui-editor-extensions';
1
+ import type { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
2
  import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
3
3
  export declare const UNSUBSCRIBE_BLOCK_ID = "unsubscribe-block";
4
4
  export declare class UnsubscribeBlock extends Block {
5
5
  private selectEventListener;
6
6
  private cancelEventListener;
7
7
  private currentNode?;
8
+ private hadUnsubscribeLink;
8
9
  constructor();
9
10
  getId(): string;
10
11
  getIcon(): string;
@@ -13,8 +14,11 @@ export declare class UnsubscribeBlock extends Block {
13
14
  getDescription(): string;
14
15
  getTemplate(): string;
15
16
  onSelect(node: ImmutableHtmlElementNode): void;
17
+ onDocumentChanged(node: ImmutableHtmlNode): void;
16
18
  onDelete(node: ImmutableHtmlElementNode): void;
17
19
  onDestroy(): void;
20
+ private _hasUnsubscribeLink;
21
+ private _warnLinkRemoved;
18
22
  private _setupSelectEventListener;
19
23
  private _removeSelectEventListener;
20
24
  private _setupCancelEventListener;
@@ -1,79 +1,87 @@
1
- import { useActionsApi as T } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { useActionsApi as C } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
9
- function U(i, r) {
10
- const s = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), c = [];
11
- return s.forEach((t) => {
12
- const o = t.getAttribute(y.PAGE_LIST);
13
- o && c.push(...P(o));
14
- }), r.filter((t) => c.includes(t));
5
+ import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
9
+ function E(i, o) {
10
+ const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
11
+ return t.forEach((r) => {
12
+ const a = r.getAttribute(S.PAGE_LIST);
13
+ a && c.push(...D(a));
14
+ }), o.filter((r) => c.includes(r));
15
15
  }
16
- function F(i) {
16
+ async function U(i) {
17
17
  const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
18
  if (m.length === 0)
19
19
  return;
20
- const d = b();
21
- m.forEach((s) => {
22
- var g, f, u, n, S;
23
- const c = s.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
24
- if (!Number.isFinite(t))
20
+ const l = b();
21
+ m.forEach((t) => {
22
+ var g, f, u, n, y;
23
+ const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
24
+ if (!Number.isFinite(r))
25
25
  return;
26
- const o = s.getAttribute("esd-ext-config");
27
- if (!o)
26
+ const a = t.getAttribute("esd-ext-config");
27
+ if (!a)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(o);
31
+ e = JSON.parse(a);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
37
  const p = {
38
- strategy: e.strategy ?? a.strategy,
39
- language: e.language ?? a.language,
40
- size: e.size ?? a.size,
38
+ strategy: e.strategy ?? s.strategy,
39
+ language: e.language ?? s.language,
40
+ size: e.size ?? s.size,
41
41
  // Spread the default arrays so each block gets a fresh reference
42
42
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
- productIds: e.productIds ?? [...a.productIds],
44
- filters: e.filters ?? [...a.filters],
45
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
46
- currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? l.code,
47
- currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? l.alignment,
48
- currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? l.decimalCount,
49
- currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? l.decimalSeparator,
50
- currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? l.thousandSeparator
43
+ productIds: e.productIds ?? [...s.productIds],
44
+ filters: e.filters ?? [...s.filters],
45
+ shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
46
+ currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
47
+ currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
48
+ currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
49
+ currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
50
+ currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
51
51
  };
52
- d.seedBlockUrlConfig(t, p);
52
+ l.seedBlockUrlConfig(r, p);
53
53
  });
54
+ try {
55
+ await l.fetchRecommendationCreateData();
56
+ } catch (t) {
57
+ console.warn(
58
+ "Recommendation reference data pre-load failed; validator will skip the availability check.",
59
+ t
60
+ );
61
+ }
54
62
  }
55
63
  const _ = () => {
56
- const i = D(), r = E(), { getCompiledEmail: m, getTemplateData: d } = T(), { compileHtml: s } = C();
64
+ const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
57
65
  return {
58
66
  prepareTemplateDetails: async () => {
59
- const { html: t, ampHtml: o = "", ampErrors: e = [] } = await m({
67
+ const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
60
68
  minimize: !0,
61
69
  resetDataSavedFlag: !1
62
- }), { html: p, css: g, syncModulesIds: f = [] } = await d();
63
- r.selectedUnsubscribePages.length && await r.fetchTemplates(), F(p);
64
- const { compiledHtml: u, stats: n, appliedRules: S } = s(t), h = i.getSelectedDynamicContentList, A = b();
70
+ }), { html: p, css: g, syncModulesIds: f = [] } = await l();
71
+ o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
72
+ const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
65
73
  return console.debug("HTML Compilation Stats:", {
66
74
  originalSize: n.originalSize,
67
75
  compiledSize: n.compiledSize,
68
76
  reduction: `${n.reductionPercentage.toFixed(2)}%`,
69
- appliedRules: S,
77
+ appliedRules: y,
70
78
  executionTime: `${n.executionTime.toFixed(2)}ms`
71
79
  }), {
72
80
  dynamicContentList: h,
73
81
  compiledHtml: u,
74
82
  rawHtml: p,
75
83
  css: g,
76
- ampHtml: o,
84
+ ampHtml: a,
77
85
  ampErrors: e,
78
86
  modules: f.map(Number),
79
87
  recommendation: {
@@ -81,8 +89,8 @@ const _ = () => {
81
89
  configs: {}
82
90
  },
83
91
  unsubscribe: {
84
- status: r.unsubscribePagesStatus,
85
- config: U(u, r.selectedUnsubscribePages)
92
+ status: o.unsubscribePagesStatus,
93
+ config: E(u, o.selectedUnsubscribePages)
86
94
  }
87
95
  };
88
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.4.1-beta.b69af42",
3
+ "version": "3.4.1-beta.c04b4e7",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",