@useinsider/guido 3.7.0-beta.b2980d8 → 3.7.0-beta.ec4dd67

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 (35) hide show
  1. package/dist/composables/useHtmlValidator.js +165 -118
  2. package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
  3. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  4. package/dist/config/migrator/recommendation/extractors.js +44 -22
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  6. package/dist/config/migrator/recommendationMigrator.js +30 -31
  7. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +39 -38
  10. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +44 -33
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -52
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +75 -68
  14. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  15. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
  19. package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
  20. package/dist/extensions/Blocks/Unsubscribe/block.js +72 -122
  21. package/dist/extensions/Blocks/Unsubscribe/template.js +4 -4
  22. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  23. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  24. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  25. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  26. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  27. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  28. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  33. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  34. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +0 -9
  35. package/package.json +1 -1
@@ -1,41 +1,39 @@
1
- var S = Object.defineProperty;
2
- var L = (c, o, e) => o in c ? S(c, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[o] = e;
3
- var a = (c, o, e) => L(c, typeof o != "symbol" ? o + "" : o, e);
4
- import { useToaster as f } from "../../../composables/useToaster.js";
5
- import { ToasterTypeOptions as A } from "../../../enums/toaster.js";
6
- import { PAGE_TYPES as h } from "../../../enums/unsubscribe.js";
7
- import { useUnsubscribeStore as u } from "../../../stores/unsubscribe.js";
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
- import { getDefaultTemplate as v } from "./template.js";
10
- import { DATA_ATTRIBUTES as n, UNSUBSCRIBE_EVENTS as p } from "./utils/constants.js";
11
- import { parsePageList as B } from "./utils/utils.js";
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
- [h.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
- [h.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
- }, w = 3;
16
- class H extends y {
1
+ var g = Object.defineProperty;
2
+ var k = (c, n, e) => n in c ? g(c, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[n] = e;
3
+ var l = (c, n, e) => k(c, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useToaster as B } from "../../../composables/useToaster.js";
5
+ import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
6
+ import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
7
+ import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
8
+ import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
+ import { getDefaultTemplate as A } from "./template.js";
10
+ import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
11
+ import { parsePageList as p } from "./utils/utils.js";
12
+ const y = "unsubscribe-block", m = 'a[data-unsubscribe-link="true"]', _ = ".unsubscribe-block-v2", I = "{{ins-unsubscribe-link}}", T = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", C = "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
+ [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
+ };
16
+ class F extends L {
17
17
  constructor() {
18
18
  super();
19
- a(this, "selectEventListener", null);
20
- a(this, "cancelEventListener", null);
21
- a(this, "currentNode");
19
+ l(this, "selectEventListener", null);
20
+ l(this, "cancelEventListener", null);
21
+ l(this, "currentNode");
22
22
  // Per-block "did this instance have a link last time we saw it?" tracking.
23
23
  // Keyed by the stable `data-unsubscribe-block-id` we assign, because
24
24
  // ImmutableHtmlNode instances are recreated on every document mutation and
25
25
  // can't be used as Map keys directly. A singleton boolean here would be
26
26
  // polluted across blocks since Stripo fires onDocumentChanged per-instance.
27
- a(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
28
- // Per-block prepend retry counter for the leading text guard (SD-143097).
29
- a(this, "guardAttemptsByBlockId", /* @__PURE__ */ new Map());
27
+ l(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
30
28
  }
31
29
  getId() {
32
- return C;
30
+ return y;
33
31
  }
34
32
  getIcon() {
35
33
  return "unsubscribe-icon";
36
34
  }
37
35
  getBlockCompositionType() {
38
- return T.BLOCK;
36
+ return f.BLOCK;
39
37
  }
40
38
  getName() {
41
39
  return this.api.translate("Unsubscribe Block");
@@ -44,84 +42,36 @@ class H extends y {
44
42
  return this.api.translate("Unsubscribe Block Description");
45
43
  }
46
44
  getTemplate() {
47
- return v();
45
+ return A();
48
46
  }
49
47
  getContextActionsIds() {
50
- return [k.MOVE, k.REMOVE];
48
+ return [h.MOVE, h.REMOVE];
51
49
  }
52
50
  onSelect(e) {
53
51
  this.currentNode = e;
54
52
  const t = this._getOrAssignBlockId(e);
55
53
  t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
56
54
  }
57
- onCreated(e) {
58
- this._ensureLeadingTextGuard(e);
59
- }
60
- onDocumentInit() {
61
- try {
62
- const e = this.api.getDocumentRoot();
63
- e && "querySelectorAll" in e && e.querySelectorAll(E).forEach((t) => {
64
- this._ensureLeadingTextGuard(t);
65
- });
66
- } catch {
67
- }
68
- }
69
55
  onDocumentChanged(e) {
70
- this._ensureLeadingTextGuard(e);
71
56
  const t = this._getOrAssignBlockId(e);
72
57
  if (!t)
73
58
  return;
74
- const s = this._hasUnsubscribeLink(e);
75
- this.linkStateByBlockId.get(t) === !0 && !s && this._warnLinkRemoved(), this.linkStateByBlockId.set(t, s);
59
+ const r = this._hasUnsubscribeLink(e);
60
+ this.linkStateByBlockId.get(t) === !0 && !r && this._warnLinkRemoved(), this.linkStateByBlockId.set(t, r);
76
61
  }
77
62
  onDelete(e) {
78
63
  this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
79
64
  const t = this._readBlockId(e);
80
- t && (this.linkStateByBlockId.delete(t), this.guardAttemptsByBlockId.delete(t));
65
+ t && this.linkStateByBlockId.delete(t);
81
66
  }
82
67
  onDestroy() {
83
- this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear(), this.guardAttemptsByBlockId.clear();
84
- }
85
- /**
86
- * Guarantees a plain-text node before the link's wrapper inside the <p>.
87
- * Without it the only caret position left of the link is inside the anchor,
88
- * so anything typed there becomes part of the link (SD-143097).
89
- */
90
- _ensureLeadingTextGuard(e) {
91
- if (!("querySelector" in e))
92
- return;
93
- const t = e.querySelector(m);
94
- if (!t)
95
- return;
96
- let s = t, r = s.parent();
97
- for (; r && "getTagName" in r && r.getTagName().toLowerCase() !== "p"; )
98
- s = r, r = r.parent();
99
- if (!r || !("getTagName" in r) || r.getTagName().toLowerCase() !== "p")
100
- return;
101
- const i = s.previousSibling();
102
- if (!!(i && i.getType() === "text" && i.getTextContent())) {
103
- const b = this._readBlockId(e);
104
- b && this.guardAttemptsByBlockId.delete(b);
105
- return;
106
- }
107
- const g = this._getOrAssignBlockId(e);
108
- if (!g)
109
- return;
110
- const _ = this.guardAttemptsByBlockId.get(g) ?? 0;
111
- if (!(_ >= w)) {
112
- this.guardAttemptsByBlockId.set(g, _ + 1);
113
- try {
114
- this.api.getDocumentModifier().modifyHtml(r).prepend("&nbsp;").apply(new d("Ensure unsubscribe link text guard"));
115
- } catch (b) {
116
- console.warn("[UnsubscribeBlock] Failed to ensure link text guard:", b);
117
- }
118
- }
68
+ this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear();
119
69
  }
120
70
  _hasUnsubscribeLink(e) {
121
71
  return "querySelector" in e ? !!e.querySelector(m) : !1;
122
72
  }
123
73
  _readBlockId(e) {
124
- return "getAttribute" in e ? e.getAttribute(n.BLOCK_ID) : null;
74
+ return "getAttribute" in e ? e.getAttribute(i.BLOCK_ID) : null;
125
75
  }
126
76
  /**
127
77
  * Returns the block's stable id, assigning one via the document modifier if
@@ -135,13 +85,13 @@ class H extends y {
135
85
  return t;
136
86
  if (!("getAttribute" in e))
137
87
  return null;
138
- const s = this._generateNextBlockId();
88
+ const r = this._generateNextBlockId();
139
89
  try {
140
- this.api.getDocumentModifier().modifyHtml(e).setAttribute(n.BLOCK_ID, s).apply(new d(`Assign unsubscribe block id ${s}`));
141
- } catch (r) {
142
- return console.warn("[UnsubscribeBlock] Failed to assign block id:", r), null;
90
+ this.api.getDocumentModifier().modifyHtml(e).setAttribute(i.BLOCK_ID, r).apply(new b(`Assign unsubscribe block id ${r}`));
91
+ } catch (s) {
92
+ return console.warn("[UnsubscribeBlock] Failed to assign block id:", s), null;
143
93
  }
144
- return s;
94
+ return r;
145
95
  }
146
96
  /**
147
97
  * Generates a unique id by scanning the document for the highest existing
@@ -152,10 +102,10 @@ class H extends y {
152
102
  let e = 0;
153
103
  try {
154
104
  const t = this.api.getDocumentRoot();
155
- t && "querySelectorAll" in t && t.querySelectorAll(E).forEach((r) => {
156
- if ("getAttribute" in r) {
157
- const i = r.getAttribute(n.BLOCK_ID), l = i ? parseInt(i) : 0;
158
- l > e && (e = l);
105
+ t && "querySelectorAll" in t && t.querySelectorAll(_).forEach((s) => {
106
+ if ("getAttribute" in s) {
107
+ const o = s.getAttribute(i.BLOCK_ID), u = o ? parseInt(o) : 0;
108
+ u > e && (e = u);
159
109
  }
160
110
  });
161
111
  } catch {
@@ -164,14 +114,14 @@ class H extends y {
164
114
  }
165
115
  _warnLinkRemoved() {
166
116
  try {
167
- const { showToaster: e } = f();
117
+ const { showToaster: e } = B();
168
118
  e({
169
- type: A.Warning,
170
- message: this.api.translate(R),
119
+ type: S.Warning,
120
+ message: this.api.translate(C),
171
121
  actionButton: {
172
122
  text: this.api.translate("Visit Academy"),
173
123
  onClick: () => {
174
- window.open(U, "_blank", "noopener,noreferrer");
124
+ window.open(T, "_blank", "noopener,noreferrer");
175
125
  }
176
126
  }
177
127
  });
@@ -181,26 +131,26 @@ class H extends y {
181
131
  }
182
132
  _setupSelectEventListener() {
183
133
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
184
- const t = e, { collectionType: s, selectedPages: r } = t.detail;
185
- this._updateBlock(s, r.join(","));
186
- }, document.addEventListener(p.SELECT, this.selectEventListener);
134
+ const t = e, { collectionType: r, selectedPages: s } = t.detail;
135
+ this._updateBlock(r, s.join(","));
136
+ }, document.addEventListener(d.SELECT, this.selectEventListener);
187
137
  }
188
138
  _removeSelectEventListener() {
189
- this.selectEventListener && (document.removeEventListener(p.SELECT, this.selectEventListener), this.selectEventListener = null);
139
+ this.selectEventListener && (document.removeEventListener(d.SELECT, this.selectEventListener), this.selectEventListener = null);
190
140
  }
191
141
  _setupCancelEventListener() {
192
142
  this._removeCancelEventListener(), this.cancelEventListener = () => {
193
143
  this._handleCancel();
194
- }, document.addEventListener(p.CANCEL, this.cancelEventListener);
144
+ }, document.addEventListener(d.CANCEL, this.cancelEventListener);
195
145
  }
196
146
  _removeCancelEventListener() {
197
- this.cancelEventListener && (document.removeEventListener(p.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
147
+ this.cancelEventListener && (document.removeEventListener(d.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
198
148
  }
199
149
  _handleCancel() {
200
150
  try {
201
151
  if (!this.currentNode)
202
152
  return;
203
- this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${I.EMPTY_CONTAINER}/>`).apply(new d("Removed unsubscribe block due to cancel"));
153
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${v.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
204
154
  } catch (e) {
205
155
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
206
156
  }
@@ -211,32 +161,32 @@ class H extends y {
211
161
  _updateBlock(e, t) {
212
162
  if (!this.currentNode || !("querySelector" in this.currentNode))
213
163
  return;
214
- const s = this.currentNode.querySelector(m);
215
- if (!s)
164
+ const r = this.currentNode.querySelector(m);
165
+ if (!r)
216
166
  return;
217
- const r = this._getMergeTag(e);
218
- this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", r).apply(new d(`Updated unsubscribe link to ${r}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(n.PAGE_TYPE, e.toString()).setAttribute(n.PAGE_LIST, t).apply(new d("Updated unsubscribe block metadata"));
167
+ const s = this._getMergeTag(e);
168
+ this.api.getDocumentModifier().modifyHtml(r).setAttribute("href", s).apply(new b(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(i.PAGE_TYPE, e.toString()).setAttribute(i.PAGE_LIST, t).apply(new b("Updated unsubscribe block metadata"));
219
169
  }
220
170
  _getMergeTag(e) {
221
- return D[e] ?? N;
171
+ return N[e] ?? I;
222
172
  }
223
173
  _openDrawer() {
224
174
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
225
175
  try {
226
- const e = u();
176
+ const e = a();
227
177
  e.typeSelectionDrawerStatus = !0;
228
178
  } catch (e) {
229
179
  console.error("[UnsubscribeBlock] Failed to open drawer:", e);
230
180
  }
231
181
  }
232
182
  _checkExistingBlocks() {
233
- const e = u();
234
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(E).forEach((s) => {
235
- if ("getAttribute" in s) {
236
- const r = s.getAttribute(n.PAGE_TYPE);
237
- if (r) {
238
- const i = Number(r);
239
- i === h.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : i === h.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
183
+ const e = a();
184
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((r) => {
185
+ if ("getAttribute" in r) {
186
+ const s = r.getAttribute(i.PAGE_TYPE);
187
+ if (s) {
188
+ const o = Number(s);
189
+ o === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : o === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
240
190
  }
241
191
  }
242
192
  });
@@ -244,26 +194,26 @@ class H extends y {
244
194
  async _loadBlockState(e) {
245
195
  if (!("getAttribute" in e))
246
196
  return;
247
- const t = e.getAttribute(n.PAGE_TYPE), s = e.getAttribute(n.PAGE_LIST);
248
- if (!t || !s)
197
+ const t = e.getAttribute(i.PAGE_TYPE), r = e.getAttribute(i.PAGE_LIST);
198
+ if (!t || !r)
249
199
  return;
250
- const r = u(), i = Number(t), l = B(s);
251
- await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(i), r.loadSelectedTemplates(l);
200
+ const s = a(), o = Number(t), u = p(r);
201
+ await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(o), s.loadSelectedTemplates(u);
252
202
  }
253
203
  _resetStoreState() {
254
- u().$reset();
204
+ a().$reset();
255
205
  }
256
206
  _removeBlockTemplatesFromStore(e) {
257
207
  if (!("getAttribute" in e))
258
208
  return;
259
- const t = e.getAttribute(n.PAGE_LIST);
209
+ const t = e.getAttribute(i.PAGE_LIST);
260
210
  if (!t)
261
211
  return;
262
- const s = u(), r = B(t);
263
- s.removeUnsubscribePages(r);
212
+ const r = a(), s = p(t);
213
+ r.removeUnsubscribePages(s);
264
214
  }
265
215
  }
266
216
  export {
267
- C as UNSUBSCRIBE_BLOCK_ID,
268
- H as UnsubscribeBlock
217
+ y as UNSUBSCRIBE_BLOCK_ID,
218
+ F as UnsubscribeBlock
269
219
  };
@@ -1,21 +1,21 @@
1
1
  import { BlockType as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const e = "unsubscribe", n = "{{ins-unsubscribe-link}}", b = `
2
+ const e = "unsubscribe", n = "{{ins-unsubscribe-link}}", t = `
3
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>&nbsp;<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
- >${e}</a></p>
14
+ >${e}</a></strong></p>
15
15
  </${s.BLOCK_TEXT}>
16
16
  `;
17
17
  function u() {
18
- return b;
18
+ return t;
19
19
  }
20
20
  export {
21
21
  u as getDefaultTemplate
@@ -1,4 +1,31 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
+ import type { FiltersResponse } from '@@/Types/recommendation';
3
+ /**
4
+ * Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
5
+ * braces/whitespace) into its recommendation id and attribute name. Returns
6
+ * null for anything that isn't a well-formed recommendation variable.
7
+ */
8
+ export declare function parseRecommendationVariable(field: string): {
9
+ recoId: string;
10
+ attribute: string;
11
+ } | null;
12
+ /**
13
+ * Builds the set of attribute forms valid inside partner-authored
14
+ * `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
15
+ * each account attribute in its canonical token form — bare for
16
+ * `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
17
+ * `resolveProductAttrValue` (the same producer the block builder uses) keeps the
18
+ * validator's notion of "valid form" identical to what is actually emitted.
19
+ */
20
+ export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
21
+ /**
22
+ * Returns the `{{...}}` custom fields in the HTML that are invalid. Partner
23
+ * attributes in `ins-skip-compile` blocks (recoId ∈ ignoredIds) are checked
24
+ * against `ignoredAttributeNames`; Guido-generated reco variables and known merge
25
+ * tags pass. An unrecognized dotted token is ignored: it was never captured
26
+ * before, so flagging it would false-positive on merge tags like `{{user.name}}`.
27
+ */
28
+ export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
2
29
  export declare const useHtmlValidator: () => {
3
30
  validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
4
31
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Returns true when a recommendation block has opted out of Guido's
3
+ * product-data → template-variable substitution. Partners signal opt-out by
4
+ * adding the `ins-skip-compile` class on the `.recommendation-block-v2`
5
+ * element. Only the variable substitution is skipped — campaign URL building,
6
+ * hidden-row removal, Outlook image widths, discount conditions, text-trim CSS
7
+ * and general HTML optimizations still apply. See `CSS_CLASS_SKIP_COMPILE` for
8
+ * the full scope.
9
+ */
10
+ export declare function isIgnoredRecommendationBlock(block: Element): boolean;
11
+ /**
12
+ * DOM-parses the HTML once and returns the set of `recommendation-id`
13
+ * values that belong to ignored blocks. Use this in regex/string-based
14
+ * compiler rules where the rule processes flat matches and only has the
15
+ * extracted block ID rather than a DOM Element reference.
16
+ */
17
+ export declare function getIgnoredRecommendationBlockIds(html: string): Set<string>;
@@ -5,3 +5,18 @@ export declare function extractTitleText(block: Element): string;
5
5
  * the caller treats that as "no segment background".
6
6
  */
7
7
  export declare function extractCardBgColor(block: Element): string;
8
+ /**
9
+ * Reads the legacy block's own `currency-*` attributes into a
10
+ * `currencySettings`-shaped object that `mapCurrency` understands. Used as a
11
+ * fallback when the external recommendationConfigs map has no entry for this
12
+ * block, so the migrated block keeps its real currency instead of defaulting.
13
+ * Returns undefined when the block carries no `currency` attribute.
14
+ */
15
+ export declare function extractCurrencyFromBlock(block: Element): Record<string, string> | undefined;
16
+ /**
17
+ * True when a PM has manually opted the legacy block out of content
18
+ * regeneration by adding the `ins-skip-compile` class. Detected before rebuild
19
+ * so the migrator preserves the partner's markup verbatim (keeping their
20
+ * hand-authored variables) instead of regenerating the block.
21
+ */
22
+ export declare function isPartnerManagedBlock(block: Element): boolean;
@@ -8,4 +8,12 @@ export declare function buildBlockHtml(params: {
8
8
  extraClasses?: string;
9
9
  legacyId?: string;
10
10
  legacyBgColor?: string;
11
+ /**
12
+ * When set, the block's existing inner HTML is preserved verbatim instead
13
+ * of regenerating product rows — used for partner-customized blocks so
14
+ * their hand-authored `{{...}}` variables survive migration.
15
+ */
16
+ preserveInnerHtml?: string;
17
+ /** Adds the `ins-skip-compile` opt-out class to the migrated block. */
18
+ skipCompile?: boolean;
11
19
  }): string;
@@ -8,6 +8,6 @@
8
8
  */
9
9
  export { RecommendationBlockId } from './blockIds';
10
10
  export { RecommendationControlId } from './controlIds';
11
- export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
11
+ export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
12
12
  export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
13
  export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
@@ -23,6 +23,18 @@ export declare const MOBILE_ROW_SELECTOR = ".ins-recommendation-mobile-row";
23
23
  * `{{cId_pIdx_url}}` template variable.
24
24
  */
25
25
  export declare const CSS_CLASS_RECO_BUTTON = "reco-v3-button";
26
+ /**
27
+ * Opt-out class for partners who want to inject their own template variables
28
+ * into a recommendation block. When present on `.recommendation-block-v2`,
29
+ * Guido skips ONLY its product-data → template-variable substitution
30
+ * (`replaceProductAttributes`) for that block — partners author their own
31
+ * `{{recoId_index_attribute}}` variables. Everything else (campaign URL
32
+ * building, hidden-row removal, Outlook image widths, text-trim CSS, discount
33
+ * conditions, store hydration, store-level config validation, and general HTML
34
+ * optimizations) still applies. The class is preserved in the final compiled
35
+ * output so partners may use it for their own styling.
36
+ */
37
+ export declare const CSS_CLASS_SKIP_COMPILE = "ins-skip-compile";
26
38
  /**
27
39
  * Currency HTML attributes set on the block element
28
40
  * These are read by the HTML compiler at runtime to format prices
@@ -61,3 +73,12 @@ export declare const ATTR_PRODUCT_ATTR = "product-attr";
61
73
  * Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
62
74
  */
63
75
  export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
76
+ /**
77
+ * Attribute names valid inside a `{{recoId_index_attributeName}}` template
78
+ * variable regardless of the account's custom attribute list. Every built-in
79
+ * composition attribute is valid, plus `currency` and `discount` which the
80
+ * compiler emits but are not composition toggles. Custom attributes are
81
+ * validated separately against the account's fetched attribute list
82
+ * (`stripo/email-recommendation-attributes`).
83
+ */
84
+ export declare const RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES: Set<string>;
@@ -17,6 +17,13 @@ export declare class RecommendationCardCompositionControl extends CommonControl
17
17
  getId(): string;
18
18
  getTemplate(): string;
19
19
  onRender(): void;
20
+ /**
21
+ * Card composition restructures the block (toggles/reorders/adds attribute
22
+ * cells), which would corrupt a partner-managed (`ins-skip-compile`) block's
23
+ * preserved markup. There is no native tab-disable API, so the whole control
24
+ * container is rendered inert (greyed + non-interactive) instead.
25
+ */
26
+ _syncDisabledState(): void;
20
27
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
21
28
  onDestroy(): void;
22
29
  private _initializeComposition;
@@ -21,6 +21,11 @@ export declare class LayoutOrientationControl extends CommonControl {
21
21
  getTemplate(): string;
22
22
  onRender(): void;
23
23
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
24
+ /**
25
+ * Layout orientation restructures the whole block, which is meaningless for
26
+ * partner-managed (`ins-skip-compile`) blocks — disable the control there.
27
+ */
28
+ _syncDisabledState(): void;
24
29
  _setFormValues(): void;
25
30
  /**
26
31
  * Handles layout change
@@ -30,6 +30,12 @@ export declare class ProductLayoutControl extends CommonControl {
30
30
  getTemplate(): string;
31
31
  onRender(): void;
32
32
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
33
+ /**
34
+ * Products-per-row and mobile-layout restructure the block, which is
35
+ * meaningless for partner-managed (`ins-skip-compile`) blocks — disable
36
+ * these inputs there. Disabling coexists with the visibility logic above.
37
+ */
38
+ _syncDisabledState(): void;
33
39
  onDestroy(): void;
34
40
  _setFormValues(): void;
35
41
  /**
@@ -35,6 +35,15 @@ interface DocumentModifier {
35
35
  * @returns The block element or null if not found
36
36
  */
37
37
  export declare function getBlockElement(currentNode: ImmutableHtmlNode | null | undefined): ImmutableHtmlNode | null;
38
+ /**
39
+ * True when the recommendation block has opted out of Guido's content
40
+ * regeneration via the `ins-skip-compile` class. Partner-managed blocks carry
41
+ * hand-authored `{{...}}` variables in their cells, so Guido must never
42
+ * overwrite their content with product data (regenerate / in-place update).
43
+ * @param currentNode - The current template node
44
+ * @returns True if the block opted out of content regeneration
45
+ */
46
+ export declare function isPartnerManagedBlock(currentNode: ImmutableHtmlNode | null | undefined): boolean;
38
47
  /**
39
48
  * Gets the current layout orientation from the block's data attribute
40
49
  * Supports both old (horizontal/vertical) and new (list/grid) values for backward compatibility
@@ -6,7 +6,6 @@ export declare class UnsubscribeBlock extends Block {
6
6
  private cancelEventListener;
7
7
  private currentNode?;
8
8
  private linkStateByBlockId;
9
- private guardAttemptsByBlockId;
10
9
  constructor();
11
10
  getId(): string;
12
11
  getIcon(): string;
@@ -16,17 +15,9 @@ export declare class UnsubscribeBlock extends Block {
16
15
  getTemplate(): string;
17
16
  getContextActionsIds(): string[];
18
17
  onSelect(node: ImmutableHtmlElementNode): void;
19
- onCreated(node: ImmutableHtmlNode): void;
20
- onDocumentInit(): void;
21
18
  onDocumentChanged(node: ImmutableHtmlNode): void;
22
19
  onDelete(node: ImmutableHtmlElementNode): void;
23
20
  onDestroy(): void;
24
- /**
25
- * Guarantees a plain-text node before the link's wrapper inside the <p>.
26
- * Without it the only caret position left of the link is inside the anchor,
27
- * so anything typed there becomes part of the link (SD-143097).
28
- */
29
- private _ensureLeadingTextGuard;
30
21
  private _hasUnsubscribeLink;
31
22
  private _readBlockId;
32
23
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.7.0-beta.b2980d8",
3
+ "version": "3.7.0-beta.ec4dd67",
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",