@useinsider/guido 3.30.0-beta.a94eba0 → 3.30.0-beta.abc28c7

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.
@@ -13,8 +13,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
13
13
  changeSeq: number;
14
14
  isStripoInitialized: boolean;
15
15
  isLegacyUnsubscribeModalRequested: boolean;
16
- isSfmcUnsubscribeModalRequested: boolean;
17
- isUnsubscribeConvertedOnLoad: boolean;
18
16
  templateId: string;
19
17
  syncModulesEnabled: boolean;
20
18
  trackIdSessionFloor: number;
@@ -33,8 +31,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
33
31
  changeSeq: number;
34
32
  isStripoInitialized: boolean;
35
33
  isLegacyUnsubscribeModalRequested: boolean;
36
- isSfmcUnsubscribeModalRequested: boolean;
37
- isUnsubscribeConvertedOnLoad: boolean;
38
34
  templateId: string;
39
35
  syncModulesEnabled: boolean;
40
36
  trackIdSessionFloor: number;
@@ -52,8 +48,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
52
48
  changeSeq: number;
53
49
  isStripoInitialized: boolean;
54
50
  isLegacyUnsubscribeModalRequested: boolean;
55
- isSfmcUnsubscribeModalRequested: boolean;
56
- isUnsubscribeConvertedOnLoad: boolean;
57
51
  templateId: string;
58
52
  syncModulesEnabled: boolean;
59
53
  trackIdSessionFloor: number;
@@ -72,8 +66,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
72
66
  changeSeq: number;
73
67
  isStripoInitialized: boolean;
74
68
  isLegacyUnsubscribeModalRequested: boolean;
75
- isSfmcUnsubscribeModalRequested: boolean;
76
- isUnsubscribeConvertedOnLoad: boolean;
77
69
  templateId: string;
78
70
  syncModulesEnabled: boolean;
79
71
  trackIdSessionFloor: number;
@@ -91,8 +83,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
91
83
  changeSeq: number;
92
84
  isStripoInitialized: boolean;
93
85
  isLegacyUnsubscribeModalRequested: boolean;
94
- isSfmcUnsubscribeModalRequested: boolean;
95
- isUnsubscribeConvertedOnLoad: boolean;
96
86
  templateId: string;
97
87
  syncModulesEnabled: boolean;
98
88
  trackIdSessionFloor: number;
@@ -111,8 +101,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
111
101
  changeSeq: number;
112
102
  isStripoInitialized: boolean;
113
103
  isLegacyUnsubscribeModalRequested: boolean;
114
- isSfmcUnsubscribeModalRequested: boolean;
115
- isUnsubscribeConvertedOnLoad: boolean;
116
104
  templateId: string;
117
105
  syncModulesEnabled: boolean;
118
106
  trackIdSessionFloor: number;
@@ -130,8 +118,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
130
118
  changeSeq: number;
131
119
  isStripoInitialized: boolean;
132
120
  isLegacyUnsubscribeModalRequested: boolean;
133
- isSfmcUnsubscribeModalRequested: boolean;
134
- isUnsubscribeConvertedOnLoad: boolean;
135
121
  templateId: string;
136
122
  syncModulesEnabled: boolean;
137
123
  trackIdSessionFloor: number;
@@ -150,8 +136,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
150
136
  changeSeq: number;
151
137
  isStripoInitialized: boolean;
152
138
  isLegacyUnsubscribeModalRequested: boolean;
153
- isSfmcUnsubscribeModalRequested: boolean;
154
- isUnsubscribeConvertedOnLoad: boolean;
155
139
  templateId: string;
156
140
  syncModulesEnabled: boolean;
157
141
  trackIdSessionFloor: number;
@@ -169,8 +153,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
169
153
  changeSeq: number;
170
154
  isStripoInitialized: boolean;
171
155
  isLegacyUnsubscribeModalRequested: boolean;
172
- isSfmcUnsubscribeModalRequested: boolean;
173
- isUnsubscribeConvertedOnLoad: boolean;
174
156
  templateId: string;
175
157
  syncModulesEnabled: boolean;
176
158
  trackIdSessionFloor: number;
@@ -189,8 +171,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
189
171
  changeSeq: number;
190
172
  isStripoInitialized: boolean;
191
173
  isLegacyUnsubscribeModalRequested: boolean;
192
- isSfmcUnsubscribeModalRequested: boolean;
193
- isUnsubscribeConvertedOnLoad: boolean;
194
174
  templateId: string;
195
175
  syncModulesEnabled: boolean;
196
176
  trackIdSessionFloor: number;
@@ -208,8 +188,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
208
188
  changeSeq: number;
209
189
  isStripoInitialized: boolean;
210
190
  isLegacyUnsubscribeModalRequested: boolean;
211
- isSfmcUnsubscribeModalRequested: boolean;
212
- isUnsubscribeConvertedOnLoad: boolean;
213
191
  templateId: string;
214
192
  syncModulesEnabled: boolean;
215
193
  trackIdSessionFloor: number;
@@ -228,8 +206,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
228
206
  changeSeq: number;
229
207
  isStripoInitialized: boolean;
230
208
  isLegacyUnsubscribeModalRequested: boolean;
231
- isSfmcUnsubscribeModalRequested: boolean;
232
- isUnsubscribeConvertedOnLoad: boolean;
233
209
  templateId: string;
234
210
  syncModulesEnabled: boolean;
235
211
  trackIdSessionFloor: number;
@@ -247,8 +223,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
247
223
  changeSeq: number;
248
224
  isStripoInitialized: boolean;
249
225
  isLegacyUnsubscribeModalRequested: boolean;
250
- isSfmcUnsubscribeModalRequested: boolean;
251
- isUnsubscribeConvertedOnLoad: boolean;
252
226
  templateId: string;
253
227
  syncModulesEnabled: boolean;
254
228
  trackIdSessionFloor: number;
@@ -267,8 +241,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
267
241
  changeSeq: number;
268
242
  isStripoInitialized: boolean;
269
243
  isLegacyUnsubscribeModalRequested: boolean;
270
- isSfmcUnsubscribeModalRequested: boolean;
271
- isUnsubscribeConvertedOnLoad: boolean;
272
244
  templateId: string;
273
245
  syncModulesEnabled: boolean;
274
246
  trackIdSessionFloor: number;
@@ -286,8 +258,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
286
258
  changeSeq: number;
287
259
  isStripoInitialized: boolean;
288
260
  isLegacyUnsubscribeModalRequested: boolean;
289
- isSfmcUnsubscribeModalRequested: boolean;
290
- isUnsubscribeConvertedOnLoad: boolean;
291
261
  templateId: string;
292
262
  syncModulesEnabled: boolean;
293
263
  trackIdSessionFloor: number;
@@ -306,8 +276,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
306
276
  changeSeq: number;
307
277
  isStripoInitialized: boolean;
308
278
  isLegacyUnsubscribeModalRequested: boolean;
309
- isSfmcUnsubscribeModalRequested: boolean;
310
- isUnsubscribeConvertedOnLoad: boolean;
311
279
  templateId: string;
312
280
  syncModulesEnabled: boolean;
313
281
  trackIdSessionFloor: number;
@@ -325,8 +293,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
325
293
  changeSeq: number;
326
294
  isStripoInitialized: boolean;
327
295
  isLegacyUnsubscribeModalRequested: boolean;
328
- isSfmcUnsubscribeModalRequested: boolean;
329
- isUnsubscribeConvertedOnLoad: boolean;
330
296
  templateId: string;
331
297
  syncModulesEnabled: boolean;
332
298
  trackIdSessionFloor: number;
@@ -345,8 +311,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
345
311
  changeSeq: number;
346
312
  isStripoInitialized: boolean;
347
313
  isLegacyUnsubscribeModalRequested: boolean;
348
- isSfmcUnsubscribeModalRequested: boolean;
349
- isUnsubscribeConvertedOnLoad: boolean;
350
314
  templateId: string;
351
315
  syncModulesEnabled: boolean;
352
316
  trackIdSessionFloor: number;
@@ -364,8 +328,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
364
328
  changeSeq: number;
365
329
  isStripoInitialized: boolean;
366
330
  isLegacyUnsubscribeModalRequested: boolean;
367
- isSfmcUnsubscribeModalRequested: boolean;
368
- isUnsubscribeConvertedOnLoad: boolean;
369
331
  templateId: string;
370
332
  syncModulesEnabled: boolean;
371
333
  trackIdSessionFloor: number;
@@ -384,8 +346,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
384
346
  changeSeq: number;
385
347
  isStripoInitialized: boolean;
386
348
  isLegacyUnsubscribeModalRequested: boolean;
387
- isSfmcUnsubscribeModalRequested: boolean;
388
- isUnsubscribeConvertedOnLoad: boolean;
389
349
  templateId: string;
390
350
  syncModulesEnabled: boolean;
391
351
  trackIdSessionFloor: number;
@@ -403,8 +363,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
403
363
  changeSeq: number;
404
364
  isStripoInitialized: boolean;
405
365
  isLegacyUnsubscribeModalRequested: boolean;
406
- isSfmcUnsubscribeModalRequested: boolean;
407
- isUnsubscribeConvertedOnLoad: boolean;
408
366
  templateId: string;
409
367
  syncModulesEnabled: boolean;
410
368
  trackIdSessionFloor: number;
@@ -423,8 +381,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
423
381
  changeSeq: number;
424
382
  isStripoInitialized: boolean;
425
383
  isLegacyUnsubscribeModalRequested: boolean;
426
- isSfmcUnsubscribeModalRequested: boolean;
427
- isUnsubscribeConvertedOnLoad: boolean;
428
384
  templateId: string;
429
385
  syncModulesEnabled: boolean;
430
386
  trackIdSessionFloor: number;
@@ -442,8 +398,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
442
398
  changeSeq: number;
443
399
  isStripoInitialized: boolean;
444
400
  isLegacyUnsubscribeModalRequested: boolean;
445
- isSfmcUnsubscribeModalRequested: boolean;
446
- isUnsubscribeConvertedOnLoad: boolean;
447
401
  templateId: string;
448
402
  syncModulesEnabled: boolean;
449
403
  trackIdSessionFloor: number;
@@ -462,8 +416,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
462
416
  changeSeq: number;
463
417
  isStripoInitialized: boolean;
464
418
  isLegacyUnsubscribeModalRequested: boolean;
465
- isSfmcUnsubscribeModalRequested: boolean;
466
- isUnsubscribeConvertedOnLoad: boolean;
467
419
  templateId: string;
468
420
  syncModulesEnabled: boolean;
469
421
  trackIdSessionFloor: number;
@@ -481,8 +433,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
481
433
  changeSeq: number;
482
434
  isStripoInitialized: boolean;
483
435
  isLegacyUnsubscribeModalRequested: boolean;
484
- isSfmcUnsubscribeModalRequested: boolean;
485
- isUnsubscribeConvertedOnLoad: boolean;
486
436
  templateId: string;
487
437
  syncModulesEnabled: boolean;
488
438
  trackIdSessionFloor: number;
@@ -501,8 +451,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
501
451
  changeSeq: number;
502
452
  isStripoInitialized: boolean;
503
453
  isLegacyUnsubscribeModalRequested: boolean;
504
- isSfmcUnsubscribeModalRequested: boolean;
505
- isUnsubscribeConvertedOnLoad: boolean;
506
454
  templateId: string;
507
455
  syncModulesEnabled: boolean;
508
456
  trackIdSessionFloor: number;
@@ -520,8 +468,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
520
468
  changeSeq: number;
521
469
  isStripoInitialized: boolean;
522
470
  isLegacyUnsubscribeModalRequested: boolean;
523
- isSfmcUnsubscribeModalRequested: boolean;
524
- isUnsubscribeConvertedOnLoad: boolean;
525
471
  templateId: string;
526
472
  syncModulesEnabled: boolean;
527
473
  trackIdSessionFloor: number;
@@ -5,9 +5,6 @@ export interface LegacyUnsubscribeConversionResult {
5
5
  converted: boolean;
6
6
  }
7
7
  export declare const hasLegacyUnsubscribeClass: (html: string) => boolean;
8
- export declare const hasAnyUnsubscribeClass: (html: string) => boolean;
9
8
  export declare const convertLinklessLegacyUnsubscribeBlocks: (root: ParentNode) => number;
10
9
  export declare const convertLegacyUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
11
10
  export declare const convertLegacyUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
12
- export declare const convertAllUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
13
- export declare const convertAllUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
@@ -17,8 +17,6 @@ const o = e("guidoEditor", {
17
17
  changeSeq: 0,
18
18
  isStripoInitialized: !1,
19
19
  isLegacyUnsubscribeModalRequested: !1,
20
- isSfmcUnsubscribeModalRequested: !1,
21
- isUnsubscribeConvertedOnLoad: !1,
22
20
  templateId: "",
23
21
  syncModulesEnabled: !1,
24
22
  // In-session id high-water mark; floors tracking-id minting so ids
@@ -1,90 +1,49 @@
1
- import { hasInsiderUnsubscribeCode as f } from "../composables/validators/useUnsubscribeBlockValidator.js";
2
- import { UNSUBSCRIBE_LINK_SELECTOR as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
- import { protectLiquid as C, restoreLiquid as _ } from "./liquidProtection.js";
4
- const u = "td.unsubscribe-block", p = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], v = `${u}, .unsubscribe-block-v2`, y = "esd-block-text", U = [
1
+ import { protectLiquid as a, restoreLiquid as u } from "./liquidProtection.js";
2
+ const b = "td.unsubscribe-block", l = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], d = "esd-block-text", m = [
5
3
  "unsubscribe-block",
6
4
  "esd-extension",
7
5
  "esd-extension-block",
8
6
  "esd-unsubscribe-block",
9
7
  "esd-block-unsubscribe"
10
- ], h = "unsubscribe-block-v2", T = "esd-extension-block-id", l = "data-unsubscribe-", g = "unsubscribe-link", k = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", I = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), N = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?:-v2)?(?![\\w-])`, "i"), R = (e) => typeof e == "string" && I.test(e), B = (e) => p.some((t) => e.querySelector(t) !== null), b = (e) => {
11
- e.classList.remove(...U), e.classList.add(y), e.removeAttribute(T), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(l)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(k) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
12
- }, O = (e) => {
13
- const t = e.getAttribute("href") ?? "";
14
- return f(t) || t.trim() === "" && e.matches(A);
15
- }, M = (e) => {
16
- e.classList.remove(g), e.classList.length === 0 && e.removeAttribute("class"), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(l)).forEach(({ name: t }) => e.removeAttribute(t));
17
- }, x = (e) => {
18
- Array.from(e.querySelectorAll("a")).forEach((t) => {
19
- if (O(t)) {
20
- t.replaceWith(...Array.from(t.childNodes));
21
- return;
22
- }
23
- M(t);
24
- });
25
- }, q = (e) => typeof e == "string" && N.test(e), D = (e) => {
26
- const t = Array.from(e.querySelectorAll(v));
27
- return t.forEach((r) => {
28
- r.classList.remove(h), x(r), b(r);
29
- }), t.length;
30
- }, H = (e) => {
31
- const t = Array.from(e.querySelectorAll(u)).filter((r) => !B(r));
32
- return t.forEach(b), t.length;
33
- }, a = (e) => {
8
+ ], L = "esd-extension-block-id", S = "data-unsubscribe-", E = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", f = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), p = (e) => typeof e == "string" && f.test(e), y = (e) => l.some((t) => e.querySelector(t) !== null), g = (e) => {
9
+ e.classList.remove(...m), e.classList.add(d), e.removeAttribute(L), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(S)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(E) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
10
+ }, h = (e) => {
11
+ const t = Array.from(e.querySelectorAll(b)).filter((r) => !y(r));
12
+ return t.forEach(g), t.length;
13
+ }, v = (e) => {
34
14
  const t = e.trimStart(), r = new DOMParser();
35
15
  return /^<t[dh][\s>]/i.test(t) ? r.parseFromString(`<table><tbody><tr>${e}</tr></tbody></table>`, "text/html").querySelector("tr") : /^<tr[\s>]/i.test(t) ? r.parseFromString(`<table><tbody>${e}</tbody></table>`, "text/html").querySelector("tbody") : /^<table[\s>]/i.test(t) ? r.parseFromString(e, "text/html").body : (console.debug("[LegacyUnsubscribeConversion] Skipped module with a non-table root"), null);
36
- }, d = (e) => {
16
+ }, c = (e) => {
37
17
  const t = e.search(/<html[\s>]/i), r = [...e.matchAll(/<\/html\s*>/gi)].at(-1), s = (r == null ? void 0 : r.index) === void 0 ? -1 : r.index + r[0].length;
38
18
  return t < 0 || s <= t ? { head: "", root: e, tail: "" } : { head: e.slice(0, t), root: e.slice(t, s), tail: e.slice(s) };
39
- }, K = {
40
- detect: R,
41
- convertCells: H
42
- }, S = {
43
- detect: q,
44
- convertCells: D
45
- }, n = (e, t, r, s, i = K) => {
46
- if (!i.detect(e))
19
+ }, i = (e, t, r, s) => {
20
+ if (!p(e))
47
21
  return { html: e, converted: !1 };
48
22
  try {
49
- const o = C(e), c = t(o);
50
- return !c || i.convertCells(c) === 0 ? { html: e, converted: !1 } : { html: _(r(c, o)), converted: !0 };
23
+ const o = a(e), n = t(o);
24
+ return !n || h(n) === 0 ? { html: e, converted: !1 } : { html: u(r(n, o)), converted: !0 };
51
25
  } catch (o) {
52
26
  return console.error(`Failed to convert legacy unsubscribe blocks in ${s}:`, o), { html: e, converted: !1 };
53
27
  }
54
- }, m = (e) => e.innerHTML, E = (e) => new DOMParser().parseFromString(d(e).root, "text/html"), L = (e, t) => {
55
- const { head: r, tail: s } = d(t);
56
- return `${r}${e.documentElement.outerHTML}${s}`;
57
- }, F = (e) => n(
28
+ }, C = (e) => i(
58
29
  e,
59
- a,
60
- m,
30
+ v,
31
+ (t) => t.innerHTML,
61
32
  "module"
62
- ), G = (e) => n(
33
+ ), _ = (e) => i(
63
34
  e,
64
- E,
65
- L,
35
+ (t) => new DOMParser().parseFromString(c(t).root, "text/html"),
36
+ (t, r) => {
37
+ const { head: s, tail: o } = c(r);
38
+ return `${s}${t.documentElement.outerHTML}${o}`;
39
+ },
66
40
  "document"
67
- ), P = (e) => n(
68
- e,
69
- a,
70
- m,
71
- "module",
72
- S
73
- ), V = (e) => n(
74
- e,
75
- E,
76
- L,
77
- "document",
78
- S
79
41
  );
80
42
  export {
81
- p as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
82
- u as LEGACY_UNSUBSCRIBE_SELECTOR,
83
- V as convertAllUnsubscribeInDocumentHtml,
84
- P as convertAllUnsubscribeInModuleHtml,
85
- G as convertLegacyUnsubscribeInDocumentHtml,
86
- F as convertLegacyUnsubscribeInModuleHtml,
87
- H as convertLinklessLegacyUnsubscribeBlocks,
88
- q as hasAnyUnsubscribeClass,
89
- R as hasLegacyUnsubscribeClass
43
+ l as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
44
+ b as LEGACY_UNSUBSCRIBE_SELECTOR,
45
+ _ as convertLegacyUnsubscribeInDocumentHtml,
46
+ C as convertLegacyUnsubscribeInModuleHtml,
47
+ h as convertLinklessLegacyUnsubscribeBlocks,
48
+ p as hasLegacyUnsubscribeClass
90
49
  };