@useinsider/guido 3.7.1-beta.05a2232 → 3.7.1-beta.748af43

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.
@@ -1,32 +1,31 @@
1
1
  import { useActionsApi as x } from "./useActionsApi.js";
2
2
  import { useConfig as y } from "./useConfig.js";
3
- import { useSaveStart as w, useSaveComplete as H } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as C } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as k } from "./useHtmlValidator.js";
3
+ import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
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
8
  import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
9
  import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
- import { useUnsubscribeBlockValidator as B } from "./validators/useUnsubscribeBlockValidator.js";
11
- const J = () => {
12
- const o = w(), s = H(), { validateHtml: r } = k(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { validateUnsubscribeBlockUniqueness: d } = B(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: c } = q(), { setSyncModuleUnsubscriptionPages: m } = C(), { editorSave: p } = x();
13
- return { save: async (f = !1, v = !1) => {
14
- var a;
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
+ return { save: async (p = !1, f = !1) => {
13
+ var i;
15
14
  o();
16
- const { prepareTemplateDetails: S } = E(), t = await S();
17
- if (!l(t.compiledHtml) || !d(t.compiledHtml))
15
+ const { prepareTemplateDetails: v } = b(), t = await v();
16
+ if (!l(t.compiledHtml))
18
17
  return;
19
- if (u("liquidSyntax")) {
18
+ if (d("liquidSyntax")) {
20
19
  if (!await n(t.compiledHtml))
21
20
  return;
22
21
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
23
22
  return;
24
- if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await p())
23
+ if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
25
24
  return;
26
- const { unsubscribePayload: V, stripoModules: b } = c(t.rawHtml);
27
- return await m(V), t.modules = b, f || s({ ...t, silent: v }), t;
25
+ const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
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,20 +1,20 @@
1
- import { BlockId as g } from "../../../enums/block.js";
1
+ import { BlockId as u } from "../../../enums/block.js";
2
2
  import { useOnboardingStore as p } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as f } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as u, BlockCompositionType as I, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as a, DefaultConfigValues as i } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as C } from "./template.js";
7
- import { getItemsBlockContainer as y, getItemsBlockConfig as b, getDefaultItemsBlockConfig as h } from "./utils/nodeConfigUtils.js";
8
- const c = g.Items;
9
- class E extends u {
3
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
4
+ import { Block as I, BlockCompositionType as y, ModificationDescription as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { SETTINGS_ENUMS as c, DefaultConfigValues as a } from "./enums/settingsEnums.js";
6
+ import { getDefaultTemplate as h } from "./template.js";
7
+ import { getItemsBlockContainer as l, getItemsBlockConfig as m, getDefaultItemsBlockConfig as b } from "./utils/nodeConfigUtils.js";
8
+ const d = u.Items;
9
+ class E extends I {
10
10
  getId() {
11
- return c;
11
+ return d;
12
12
  }
13
13
  getIcon() {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return I.CONTAINER;
17
+ return y.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,41 +23,60 @@ class E extends u {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getSettingsPanelTitleHtml() {
26
- return f(
27
- c,
26
+ return C(
27
+ d,
28
28
  this.api.translate("Items"),
29
29
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
30
30
  );
31
31
  }
32
32
  getTemplate() {
33
- return C({
34
- orientation: a.ORIENTATION.VERTICAL,
35
- itemsType: a.ITEMS_TYPE.CART_ITEMS,
33
+ return h({
34
+ orientation: c.ORIENTATION.VERTICAL,
35
+ itemsType: c.ITEMS_TYPE.CART_ITEMS,
36
36
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: i.productPriceCurrencySymbolControlValue,
38
- currencyLocation: i.productPriceCurrencyLocationControlValue,
39
- formattedPrice: i.productPriceFormattedControlValue === "1"
37
+ currencySymbol: a.productPriceCurrencySymbolControlValue,
38
+ currencyLocation: a.productPriceCurrencyLocationControlValue,
39
+ formattedPrice: a.productPriceFormattedControlValue === "1"
40
40
  });
41
41
  }
42
42
  allowInnerBlocksDND() {
43
43
  return !1;
44
44
  }
45
- onCreated(n) {
46
- const l = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
47
- r.querySelector('[product-attr="imageSrc"] img') || l.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
48
- const e = y(n);
49
- if (!e)
45
+ canBeSavedAsModule() {
46
+ return !0;
47
+ }
48
+ onCreated(i) {
49
+ const n = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
50
+ r.querySelector('[product-attr="imageSrc"] img') || n.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
+ const t = l(i);
52
+ if (!t)
50
53
  return;
51
- const s = e.getNodeConfig(), m = s && Object.keys(s).length > 0, t = b(n);
52
- if (t != null && t.initialized)
53
- m ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
54
+ const e = t.getNodeConfig(), g = e && Object.keys(e).length > 0, o = m(i);
55
+ if (o != null && o.initialized)
56
+ g ? o.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...o, blockInstanceId: String(Date.now()) }).apply(new s("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new s("Migrate legacy config to nodeConfig"));
54
57
  else {
55
- const d = h();
56
- this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(d).apply(new o("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
58
+ const f = b();
59
+ this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(f).apply(new s("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
57
60
  }
58
61
  }
62
+ /**
63
+ * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
64
+ * surfaces via document load. Stripo strips esd-ext-config and never restores it
65
+ * into nodeConfig, so without this a reused module would reset to defaults.
66
+ * Guarded to the nodeConfig-empty case so it runs once and never loops.
67
+ */
68
+ onDocumentChanged(i) {
69
+ const n = l(i);
70
+ if (!n)
71
+ return;
72
+ const r = n.getNodeConfig();
73
+ if (r && Object.keys(r).length > 0)
74
+ return;
75
+ const e = m(i);
76
+ e != null && e.initialized && this.api.getDocumentModifier().modifyHtml(n).setNodeConfig(e).apply(new s("Recover Items block config from saved module"));
77
+ }
59
78
  }
60
79
  export {
61
- c as BLOCK_ID,
80
+ d as BLOCK_ID,
62
81
  E as ItemsBlock
63
82
  };
@@ -1,36 +1,36 @@
1
1
  import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { DefaultConfigValues as o, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
2
+ import { DefaultConfigValues as i, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
3
3
  function _() {
4
4
  return String(Date.now() + Math.floor(Math.random() * 1e3));
5
5
  }
6
6
  const E = (r) => r.replace(/\$/g, "$$$$");
7
- function S() {
7
+ function y() {
8
8
  return {
9
9
  initialized: !0,
10
10
  blockInstanceId: _(),
11
11
  source: n.ITEMS_TYPE.CART_ITEMS,
12
12
  type: n.ITEMS_TYPE.CART_ITEMS,
13
- itemsSelectValue: o.cartItemsSelectControlValue,
13
+ itemsSelectValue: i.cartItemsSelectControlValue,
14
14
  orientation: n.ORIENTATION.VERTICAL,
15
- nameTrimming: o.productNameTrimmingControlValue === "1",
16
- priceHideDiscount: o.productPriceHideDiscountControlValue === "1",
17
- priceFormatted: o.productPriceFormattedControlValue === "1",
15
+ nameTrimming: i.productNameTrimmingControlValue === "1",
16
+ priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
17
+ priceFormatted: i.productPriceFormattedControlValue === "1",
18
18
  priceSinglePrice: !1,
19
- priceCurrencySymbol: o.productPriceCurrencySymbolControlValue,
20
- priceCurrencyLocation: o.productPriceCurrencyLocationControlValue,
19
+ priceCurrencySymbol: i.productPriceCurrencySymbolControlValue,
20
+ priceCurrencyLocation: i.productPriceCurrencyLocationControlValue,
21
21
  priceOrientation: "horizontal",
22
- quantityControlEnabled: o.productQuantityControlEnabled === "1",
23
- buttonLink: o.productButtonLinkControlValue,
24
- imageLink: o.productImageLinkControlValue,
22
+ quantityControlEnabled: i.productQuantityControlEnabled === "1",
23
+ buttonLink: i.productButtonLinkControlValue,
24
+ imageLink: i.productImageLinkControlValue,
25
25
  buttonLabel: "Buy",
26
26
  buttonFullWidth: !0,
27
27
  // Default to full width (es-fw class)
28
- imageVisible: o.productImageVisible === "1",
29
- nameVisible: o.productNameVisible === "1",
30
- quantityVisible: o.productQuantityVisible === "1",
31
- priceVisible: o.productPriceVisible === "1",
32
- originalPriceVisible: o.productOriginalPriceVisible === "1",
33
- buttonVisible: o.productButtonVisible === "1"
28
+ imageVisible: i.productImageVisible === "1",
29
+ nameVisible: i.productNameVisible === "1",
30
+ quantityVisible: i.productQuantityVisible === "1",
31
+ priceVisible: i.productPriceVisible === "1",
32
+ originalPriceVisible: i.productOriginalPriceVisible === "1",
33
+ buttonVisible: i.productButtonVisible === "1"
34
34
  };
35
35
  }
36
36
  function p(r) {
@@ -50,26 +50,26 @@ function m(r) {
50
50
  PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
51
51
  }[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
52
52
  }
53
- function I(r, t) {
53
+ function f(r, t) {
54
54
  if (!r)
55
- return o.cartItemsSelectControlValue;
55
+ return i.cartItemsSelectControlValue;
56
56
  if (r.includes("{{"))
57
57
  return r;
58
58
  if (/^\d+$/.test(r)) {
59
- const e = parseInt(r) - 1, i = g[t];
60
- if (i && i[e])
61
- return i[e].value;
59
+ const e = parseInt(r) - 1, o = g[t];
60
+ if (o && o[e])
61
+ return o[e].value;
62
62
  }
63
- return o.cartItemsSelectControlValue;
63
+ return i.cartItemsSelectControlValue;
64
64
  }
65
65
  function C(r) {
66
66
  const t = r.querySelector("esd-config-block");
67
67
  if (!t)
68
68
  return null;
69
- const e = (c, s) => c == null ? s : c === "1" || c === "true", i = (c, s) => c || s, u = t.getAttribute("data-type"), a = m(u), d = t.getAttribute("data-cart_items_select_control_value"), l = I(d, a);
69
+ const e = (u, s) => u == null ? s : u === "1" || u === "true", o = (u, s) => u || s, c = t.getAttribute("data-type"), a = m(c), d = t.getAttribute("data-cart_items_select_control_value"), l = f(d, a);
70
70
  return {
71
71
  initialized: e(t.getAttribute("data-initialized"), !1),
72
- blockInstanceId: i(
72
+ blockInstanceId: o(
73
73
  t.getAttribute("data-block-instance-id"),
74
74
  _()
75
75
  ),
@@ -93,28 +93,28 @@ function C(r) {
93
93
  t.getAttribute("data-product_price_control_single_price"),
94
94
  !1
95
95
  ),
96
- priceCurrencySymbol: i(
96
+ priceCurrencySymbol: o(
97
97
  t.getAttribute("data-product_price_control_currency_symbol"),
98
- o.productPriceCurrencySymbolControlValue
98
+ i.productPriceCurrencySymbolControlValue
99
99
  ),
100
- priceCurrencyLocation: i(
100
+ priceCurrencyLocation: o(
101
101
  t.getAttribute("data-product_price_currency_location"),
102
- o.productPriceCurrencyLocationControlValue
102
+ i.productPriceCurrencyLocationControlValue
103
103
  ),
104
104
  priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
105
105
  quantityControlEnabled: e(
106
106
  t.getAttribute("data-product_quantity_control_enabled"),
107
107
  !0
108
108
  ),
109
- buttonLink: i(
109
+ buttonLink: o(
110
110
  t.getAttribute("data-product_button_link"),
111
- o.productButtonLinkControlValue
111
+ i.productButtonLinkControlValue
112
112
  ),
113
- imageLink: i(
113
+ imageLink: o(
114
114
  t.getAttribute("data-product_image_link"),
115
- o.productImageLinkControlValue
115
+ i.productImageLinkControlValue
116
116
  ),
117
- buttonLabel: i(
117
+ buttonLabel: o(
118
118
  t.getAttribute("data-product_button_control_label"),
119
119
  "Buy"
120
120
  ),
@@ -149,28 +149,45 @@ function C(r) {
149
149
  )
150
150
  };
151
151
  }
152
- function y(r) {
152
+ function I(r) {
153
+ if (typeof r.getAttribute != "function")
154
+ return null;
155
+ const t = r.getAttribute("esd-ext-config");
156
+ if (!t)
157
+ return null;
158
+ try {
159
+ const e = JSON.parse(t);
160
+ if (e && e.initialized)
161
+ return e;
162
+ } catch {
163
+ }
164
+ return null;
165
+ }
166
+ function A(r) {
153
167
  const t = p(r);
154
168
  if (!t)
155
169
  return null;
156
170
  const e = t.getNodeConfig();
157
171
  if (e && e.initialized)
158
172
  return e;
159
- const i = C(t);
160
- return i || null;
173
+ const o = I(t);
174
+ if (o)
175
+ return o;
176
+ const c = C(t);
177
+ return c || null;
161
178
  }
162
- function A(r, t, e, i) {
163
- const u = p(r);
164
- if (!u)
179
+ function V(r, t, e, o) {
180
+ const c = p(r);
181
+ if (!c)
165
182
  return;
166
- const d = { ...u.getNodeConfig() || {}, ...e }, l = i ?? t.getDocumentModifier();
167
- l.modifyHtml(u).setNodeConfig(d), i || l.apply(new b("Update Items block configuration"));
183
+ const d = { ...c.getNodeConfig() || {}, ...e }, l = o ?? t.getDocumentModifier();
184
+ l.modifyHtml(c).setNodeConfig(d), o || l.apply(new b("Update Items block configuration"));
168
185
  }
169
186
  export {
170
187
  E as escapeReplacement,
171
188
  _ as generateBlockInstanceId,
172
- S as getDefaultItemsBlockConfig,
173
- y as getItemsBlockConfig,
189
+ y as getDefaultItemsBlockConfig,
190
+ A as getItemsBlockConfig,
174
191
  p as getItemsBlockContainer,
175
- A as setItemsBlockConfig
192
+ V as setItemsBlockConfig
176
193
  };
@@ -7,9 +7,9 @@ import { PAGE_TYPES as h } from "../../../enums/unsubscribe.js";
7
7
  import { useUnsubscribeStore as u } from "../../../stores/unsubscribe.js";
8
8
  import { Block as y, BlockCompositionType as T, ContextActionType as k, ModificationDescription as d, BlockType as I } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
9
  import { getDefaultTemplate as v } from "./template.js";
10
- import { UNSUBSCRIBE_BLOCK_SELECTOR as m, DATA_ATTRIBUTES as n, UNSUBSCRIBE_EVENTS as b } from "./utils/constants.js";
10
+ import { DATA_ATTRIBUTES as n, UNSUBSCRIBE_EVENTS as p } from "./utils/constants.js";
11
11
  import { parsePageList as B } from "./utils/utils.js";
12
- const C = "unsubscribe-block", E = 'a[data-unsubscribe-link="true"]', N = "{{ins-unsubscribe-link}}", U = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", R = "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.", D = {
12
+ const C = "unsubscribe-block", m = 'a[data-unsubscribe-link="true"]', E = ".unsubscribe-block-v2", N = "{{ins-unsubscribe-link}}", U = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", R = "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.", D = {
13
13
  [h.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
14
  [h.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
15
  }, w = 3;
@@ -60,7 +60,7 @@ class H extends y {
60
60
  onDocumentInit() {
61
61
  try {
62
62
  const e = this.api.getDocumentRoot();
63
- e && "querySelectorAll" in e && e.querySelectorAll(m).forEach((t) => {
63
+ e && "querySelectorAll" in e && e.querySelectorAll(E).forEach((t) => {
64
64
  this._ensureLeadingTextGuard(t);
65
65
  });
66
66
  } catch {
@@ -90,7 +90,7 @@ class H extends y {
90
90
  _ensureLeadingTextGuard(e) {
91
91
  if (!("querySelector" in e))
92
92
  return;
93
- const t = e.querySelector(E);
93
+ const t = e.querySelector(m);
94
94
  if (!t)
95
95
  return;
96
96
  let s = t, r = s.parent();
@@ -100,8 +100,8 @@ class H extends y {
100
100
  return;
101
101
  const i = s.previousSibling();
102
102
  if (!!(i && i.getType() === "text" && i.getTextContent())) {
103
- const p = this._readBlockId(e);
104
- p && this.guardAttemptsByBlockId.delete(p);
103
+ const b = this._readBlockId(e);
104
+ b && this.guardAttemptsByBlockId.delete(b);
105
105
  return;
106
106
  }
107
107
  const g = this._getOrAssignBlockId(e);
@@ -112,13 +112,13 @@ class H extends y {
112
112
  this.guardAttemptsByBlockId.set(g, _ + 1);
113
113
  try {
114
114
  this.api.getDocumentModifier().modifyHtml(r).prepend(" ").apply(new d("Ensure unsubscribe link text guard"));
115
- } catch (p) {
116
- console.warn("[UnsubscribeBlock] Failed to ensure link text guard:", p);
115
+ } catch (b) {
116
+ console.warn("[UnsubscribeBlock] Failed to ensure link text guard:", b);
117
117
  }
118
118
  }
119
119
  }
120
120
  _hasUnsubscribeLink(e) {
121
- return "querySelector" in e ? !!e.querySelector(E) : !1;
121
+ return "querySelector" in e ? !!e.querySelector(m) : !1;
122
122
  }
123
123
  _readBlockId(e) {
124
124
  return "getAttribute" in e ? e.getAttribute(n.BLOCK_ID) : null;
@@ -152,7 +152,7 @@ class H extends y {
152
152
  let e = 0;
153
153
  try {
154
154
  const t = this.api.getDocumentRoot();
155
- t && "querySelectorAll" in t && t.querySelectorAll(m).forEach((r) => {
155
+ t && "querySelectorAll" in t && t.querySelectorAll(E).forEach((r) => {
156
156
  if ("getAttribute" in r) {
157
157
  const i = r.getAttribute(n.BLOCK_ID), l = i ? parseInt(i) : 0;
158
158
  l > e && (e = l);
@@ -183,18 +183,18 @@ class H extends y {
183
183
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
184
184
  const t = e, { collectionType: s, selectedPages: r } = t.detail;
185
185
  this._updateBlock(s, r.join(","));
186
- }, document.addEventListener(b.SELECT, this.selectEventListener);
186
+ }, document.addEventListener(p.SELECT, this.selectEventListener);
187
187
  }
188
188
  _removeSelectEventListener() {
189
- this.selectEventListener && (document.removeEventListener(b.SELECT, this.selectEventListener), this.selectEventListener = null);
189
+ this.selectEventListener && (document.removeEventListener(p.SELECT, this.selectEventListener), this.selectEventListener = null);
190
190
  }
191
191
  _setupCancelEventListener() {
192
192
  this._removeCancelEventListener(), this.cancelEventListener = () => {
193
193
  this._handleCancel();
194
- }, document.addEventListener(b.CANCEL, this.cancelEventListener);
194
+ }, document.addEventListener(p.CANCEL, this.cancelEventListener);
195
195
  }
196
196
  _removeCancelEventListener() {
197
- this.cancelEventListener && (document.removeEventListener(b.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
197
+ this.cancelEventListener && (document.removeEventListener(p.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
198
198
  }
199
199
  _handleCancel() {
200
200
  try {
@@ -211,7 +211,7 @@ class H extends y {
211
211
  _updateBlock(e, t) {
212
212
  if (!this.currentNode || !("querySelector" in this.currentNode))
213
213
  return;
214
- const s = this.currentNode.querySelector(E);
214
+ const s = this.currentNode.querySelector(m);
215
215
  if (!s)
216
216
  return;
217
217
  const r = this._getMergeTag(e);
@@ -231,7 +231,7 @@ class H extends y {
231
231
  }
232
232
  _checkExistingBlocks() {
233
233
  const e = u();
234
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(m).forEach((s) => {
234
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(E).forEach((s) => {
235
235
  if ("getAttribute" in s) {
236
236
  const r = s.getAttribute(n.PAGE_TYPE);
237
237
  if (r) {
@@ -1,13 +1,12 @@
1
1
  const s = {
2
2
  SELECT: "unsubscribe:select",
3
3
  CANCEL: "unsubscribe:cancel"
4
- }, b = {
4
+ }, e = {
5
5
  PAGE_TYPE: "data-unsubscribe-page-type",
6
6
  PAGE_LIST: "data-unsubscribe-page-list",
7
7
  BLOCK_ID: "data-unsubscribe-block-id"
8
- }, c = ".unsubscribe-block-v2";
8
+ };
9
9
  export {
10
- b as DATA_ATTRIBUTES,
11
- c as UNSUBSCRIBE_BLOCK_SELECTOR,
10
+ e as DATA_ATTRIBUTES,
12
11
  s as UNSUBSCRIBE_EVENTS
13
12
  };
@@ -24,5 +24,13 @@ export declare class ItemsBlock extends Block {
24
24
  getSettingsPanelTitleHtml(): string;
25
25
  getTemplate(): string;
26
26
  allowInnerBlocksDND(): boolean;
27
+ canBeSavedAsModule(): boolean;
27
28
  onCreated(node: ImmutableHtmlNode): void;
29
+ /**
30
+ * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
31
+ * surfaces via document load. Stripo strips esd-ext-config and never restores it
32
+ * into nodeConfig, so without this a reused module would reset to defaults.
33
+ * Guarded to the nodeConfig-empty case so it runs once and never loops.
34
+ */
35
+ onDocumentChanged(node: ImmutableHtmlNode): void;
28
36
  }
@@ -55,7 +55,7 @@ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode |
55
55
  /**
56
56
  * Gets the node configuration from the Items block.
57
57
  * Uses Stripo V2's getNodeConfig() API.
58
- * Falls back to migrating from legacy config block if nodeConfig is empty.
58
+ * Falls back to the persisted esd-ext-config (saved modules), then legacy config block.
59
59
  * @param currentNode - The current node from the control
60
60
  * @returns The ItemsBlockConfig object or null if not found
61
61
  */
@@ -8,4 +8,3 @@ export declare const DATA_ATTRIBUTES: {
8
8
  readonly PAGE_LIST: "data-unsubscribe-page-list";
9
9
  readonly BLOCK_ID: "data-unsubscribe-block-id";
10
10
  };
11
- export declare const UNSUBSCRIBE_BLOCK_SELECTOR = ".unsubscribe-block-v2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.7.1-beta.05a2232",
3
+ "version": "3.7.1-beta.748af43",
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",
@@ -1,32 +0,0 @@
1
- import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
- import { PAGE_TYPES as n } from "../../enums/unsubscribe.js";
3
- import { UNSUBSCRIBE_BLOCK_SELECTOR as u, DATA_ATTRIBUTES as l } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as T } from "../useToaster.js";
5
- import { useTranslations as E } from "../useTranslations.js";
6
- const m = [
7
- {
8
- pageType: n.GLOBAL_UNSUBSCRIBE,
9
- messageKey: "unsubscription-preference.duplicate-global-unsub"
10
- },
11
- {
12
- pageType: n.SUBSCRIPTION_PREFERENCE_CENTER,
13
- messageKey: "unsubscription-preference.duplicate-pref-center"
14
- }
15
- ], g = "unsubscription-preference.duplicate-both", y = () => {
16
- const { showToaster: o } = T(), a = E();
17
- return { validateUnsubscribeBlockUniqueness: (c) => {
18
- const p = new DOMParser().parseFromString(c, "text/html"), t = /* @__PURE__ */ new Map();
19
- p.querySelectorAll(u).forEach((e) => {
20
- const r = Number(e.getAttribute(l.PAGE_TYPE));
21
- t.set(r, (t.get(r) ?? 0) + 1);
22
- });
23
- const s = m.filter((e) => (t.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
- return s.length ? (o({
25
- type: i.Alert,
26
- message: a(s.length > 1 ? g : s[0])
27
- }), !1) : !0;
28
- } };
29
- };
30
- export {
31
- y as useUnsubscribeBlockValidator
32
- };
@@ -1,3 +0,0 @@
1
- export declare const useUnsubscribeBlockValidator: () => {
2
- validateUnsubscribeBlockUniqueness: (html: string) => boolean;
3
- };