@useinsider/guido 3.21.2 → 3.22.0-beta.0523ffa

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 (37) hide show
  1. package/README.md +36 -4
  2. package/dist/@types/config/schemas.js +41 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +118 -108
  5. package/dist/composables/useActionsApi.js +22 -21
  6. package/dist/composables/useEditorOpenMetrics.js +167 -0
  7. package/dist/composables/useFullStoryBridge.js +10 -9
  8. package/dist/composables/useSave.js +75 -68
  9. package/dist/composables/useStripo.js +94 -82
  10. package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
  11. package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
  12. package/dist/config/migrator/index.js +11 -10
  13. package/dist/guido.css +1 -1
  14. package/dist/library.js +12 -10
  15. package/dist/package.json.js +6 -4
  16. package/dist/public/prefetchRuntime.js +4 -0
  17. package/dist/services/templateLibraryApi.js +36 -31
  18. package/dist/src/@types/config/schemas.d.ts +4 -0
  19. package/dist/src/composables/useConfig.d.ts +2 -0
  20. package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
  21. package/dist/src/composables/useStripo.d.ts +2 -1
  22. package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
  23. package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
  24. package/dist/src/library.d.ts +1 -0
  25. package/dist/src/public/prefetchRuntime.d.ts +1 -0
  26. package/dist/src/stores/config.d.ts +20 -0
  27. package/dist/src/utils/fullStoryScripts.d.ts +6 -0
  28. package/dist/src/utils/runtimePrefetch.d.ts +4 -0
  29. package/dist/src/utils/stripoRuntime.d.ts +3 -0
  30. package/dist/src/utils/templatePreparation.d.ts +2 -1
  31. package/dist/static/stripo-runtime-manifest.json.js +9 -0
  32. package/dist/utils/fullStoryScripts.js +8 -0
  33. package/dist/utils/pairProductVariables.js +98 -90
  34. package/dist/utils/runtimePrefetch.js +26 -0
  35. package/dist/utils/stripoRuntime.js +13 -0
  36. package/dist/utils/templatePreparation.js +30 -30
  37. package/package.json +6 -1
@@ -103,6 +103,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
103
103
  displayConditions: boolean;
104
104
  unsubscribe: boolean;
105
105
  modulesDisabled: boolean;
106
+ buttonTextDecorationsEnabled: boolean;
106
107
  liquidSyntax: boolean;
107
108
  autosave: boolean;
108
109
  allowlistEnabled: boolean;
@@ -248,6 +249,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
248
249
  displayConditions: boolean;
249
250
  unsubscribe: boolean;
250
251
  modulesDisabled: boolean;
252
+ buttonTextDecorationsEnabled: boolean;
251
253
  liquidSyntax: boolean;
252
254
  autosave: boolean;
253
255
  allowlistEnabled: boolean;
@@ -393,6 +395,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
393
395
  displayConditions: boolean;
394
396
  unsubscribe: boolean;
395
397
  modulesDisabled: boolean;
398
+ buttonTextDecorationsEnabled: boolean;
396
399
  liquidSyntax: boolean;
397
400
  autosave: boolean;
398
401
  allowlistEnabled: boolean;
@@ -538,6 +541,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
538
541
  displayConditions: boolean;
539
542
  unsubscribe: boolean;
540
543
  modulesDisabled: boolean;
544
+ buttonTextDecorationsEnabled: boolean;
541
545
  liquidSyntax: boolean;
542
546
  autosave: boolean;
543
547
  allowlistEnabled: boolean;
@@ -683,6 +687,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
683
687
  displayConditions: boolean;
684
688
  unsubscribe: boolean;
685
689
  modulesDisabled: boolean;
690
+ buttonTextDecorationsEnabled: boolean;
686
691
  liquidSyntax: boolean;
687
692
  autosave: boolean;
688
693
  allowlistEnabled: boolean;
@@ -828,6 +833,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
828
833
  displayConditions: boolean;
829
834
  unsubscribe: boolean;
830
835
  modulesDisabled: boolean;
836
+ buttonTextDecorationsEnabled: boolean;
831
837
  liquidSyntax: boolean;
832
838
  autosave: boolean;
833
839
  allowlistEnabled: boolean;
@@ -973,6 +979,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
973
979
  displayConditions: boolean;
974
980
  unsubscribe: boolean;
975
981
  modulesDisabled: boolean;
982
+ buttonTextDecorationsEnabled: boolean;
976
983
  liquidSyntax: boolean;
977
984
  autosave: boolean;
978
985
  allowlistEnabled: boolean;
@@ -1118,6 +1125,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1118
1125
  displayConditions: boolean;
1119
1126
  unsubscribe: boolean;
1120
1127
  modulesDisabled: boolean;
1128
+ buttonTextDecorationsEnabled: boolean;
1121
1129
  liquidSyntax: boolean;
1122
1130
  autosave: boolean;
1123
1131
  allowlistEnabled: boolean;
@@ -1263,6 +1271,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1263
1271
  displayConditions: boolean;
1264
1272
  unsubscribe: boolean;
1265
1273
  modulesDisabled: boolean;
1274
+ buttonTextDecorationsEnabled: boolean;
1266
1275
  liquidSyntax: boolean;
1267
1276
  autosave: boolean;
1268
1277
  allowlistEnabled: boolean;
@@ -1408,6 +1417,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1408
1417
  displayConditions: boolean;
1409
1418
  unsubscribe: boolean;
1410
1419
  modulesDisabled: boolean;
1420
+ buttonTextDecorationsEnabled: boolean;
1411
1421
  liquidSyntax: boolean;
1412
1422
  autosave: boolean;
1413
1423
  allowlistEnabled: boolean;
@@ -1553,6 +1563,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1553
1563
  displayConditions: boolean;
1554
1564
  unsubscribe: boolean;
1555
1565
  modulesDisabled: boolean;
1566
+ buttonTextDecorationsEnabled: boolean;
1556
1567
  liquidSyntax: boolean;
1557
1568
  autosave: boolean;
1558
1569
  allowlistEnabled: boolean;
@@ -1698,6 +1709,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1698
1709
  displayConditions: boolean;
1699
1710
  unsubscribe: boolean;
1700
1711
  modulesDisabled: boolean;
1712
+ buttonTextDecorationsEnabled: boolean;
1701
1713
  liquidSyntax: boolean;
1702
1714
  autosave: boolean;
1703
1715
  allowlistEnabled: boolean;
@@ -1843,6 +1855,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1843
1855
  displayConditions: boolean;
1844
1856
  unsubscribe: boolean;
1845
1857
  modulesDisabled: boolean;
1858
+ buttonTextDecorationsEnabled: boolean;
1846
1859
  liquidSyntax: boolean;
1847
1860
  autosave: boolean;
1848
1861
  allowlistEnabled: boolean;
@@ -1988,6 +2001,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1988
2001
  displayConditions: boolean;
1989
2002
  unsubscribe: boolean;
1990
2003
  modulesDisabled: boolean;
2004
+ buttonTextDecorationsEnabled: boolean;
1991
2005
  liquidSyntax: boolean;
1992
2006
  autosave: boolean;
1993
2007
  allowlistEnabled: boolean;
@@ -2133,6 +2147,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2133
2147
  displayConditions: boolean;
2134
2148
  unsubscribe: boolean;
2135
2149
  modulesDisabled: boolean;
2150
+ buttonTextDecorationsEnabled: boolean;
2136
2151
  liquidSyntax: boolean;
2137
2152
  autosave: boolean;
2138
2153
  allowlistEnabled: boolean;
@@ -2278,6 +2293,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2278
2293
  displayConditions: boolean;
2279
2294
  unsubscribe: boolean;
2280
2295
  modulesDisabled: boolean;
2296
+ buttonTextDecorationsEnabled: boolean;
2281
2297
  liquidSyntax: boolean;
2282
2298
  autosave: boolean;
2283
2299
  allowlistEnabled: boolean;
@@ -2423,6 +2439,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2423
2439
  displayConditions: boolean;
2424
2440
  unsubscribe: boolean;
2425
2441
  modulesDisabled: boolean;
2442
+ buttonTextDecorationsEnabled: boolean;
2426
2443
  liquidSyntax: boolean;
2427
2444
  autosave: boolean;
2428
2445
  allowlistEnabled: boolean;
@@ -2580,6 +2597,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2580
2597
  displayConditions: boolean;
2581
2598
  unsubscribe: boolean;
2582
2599
  modulesDisabled: boolean;
2600
+ buttonTextDecorationsEnabled: boolean;
2583
2601
  liquidSyntax: boolean;
2584
2602
  autosave: boolean;
2585
2603
  allowlistEnabled: boolean;
@@ -2725,6 +2743,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2725
2743
  displayConditions: boolean;
2726
2744
  unsubscribe: boolean;
2727
2745
  modulesDisabled: boolean;
2746
+ buttonTextDecorationsEnabled: boolean;
2728
2747
  liquidSyntax: boolean;
2729
2748
  autosave: boolean;
2730
2749
  allowlistEnabled: boolean;
@@ -2872,6 +2891,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2872
2891
  displayConditions: boolean;
2873
2892
  unsubscribe: boolean;
2874
2893
  modulesDisabled: boolean;
2894
+ buttonTextDecorationsEnabled: boolean;
2875
2895
  liquidSyntax: boolean;
2876
2896
  autosave: boolean;
2877
2897
  allowlistEnabled: boolean;
@@ -0,0 +1,6 @@
1
+ export declare const FULLSTORY_BRIDGE_SCRIPT_URL = "https://email-static.useinsider.com/guido/guido-fs.js";
2
+ /**
3
+ * Removes FullStory `<script>` elements that the panel / bridge leave in the editor iframe head,
4
+ * which Stripo then serializes into the stored source. Other scripts are left untouched.
5
+ */
6
+ export declare function stripFullStoryScripts(html: string): string;
@@ -0,0 +1,4 @@
1
+ export type RuntimePrefetchState = 'none' | 'pending' | 'done';
2
+ export declare const RUNTIME_PREFETCH_ATTRIBUTE = "data-guido-prefetch";
3
+ export declare const prefetchGuidoRuntime: () => void;
4
+ export declare const readRuntimePrefetchState: () => RuntimePrefetchState;
@@ -0,0 +1,3 @@
1
+ /** Null when package.json does not pin `guido.stripo.version`. */
2
+ export declare const getStripoVersion: () => string | null;
3
+ export declare const getStripoRuntimeBaseUrl: () => string | null;
@@ -1,3 +1,4 @@
1
+ import type { TemplateData } from '@@/Types/actions-api';
1
2
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
3
  /**
3
4
  * Collects every unsubscribe page id referenced by the unsubscribe blocks
@@ -44,7 +45,7 @@ export declare function getHtmlReferencedUnsubscribePages(html: string): number[
44
45
  */
45
46
  declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
46
47
  export declare const useTemplatePreparation: () => {
47
- prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
+ prepareTemplateDetails: (prefetched?: TemplateData) => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
49
  hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
49
50
  };
50
51
  export {};
@@ -0,0 +1,9 @@
1
+ const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
2
+ version: s,
3
+ files: n
4
+ };
5
+ export {
6
+ i as default,
7
+ n as files,
8
+ s as version
9
+ };
@@ -0,0 +1,8 @@
1
+ const o = "https://email-static.useinsider.com/guido/guido-fs.js", E = new RegExp("<script\\b([^>]*?)(?<!\\/)>([\\s\\S]*?)<\\/script\\s*>", "gi"), _ = /<script\b([^>]*?)\/>/gi, e = /\bsrc\s*=\s*["']?(?:https?:)?\/\/(?:[\w-]+\.)*fullstory\.com[/"'\s>]/i, R = /\bdata-fullstory-bridge\b/i, S = /\b_fs_(?:script|namespace)\b/, i = (s, t = "") => e.test(`${s} `) || R.test(s) || s.includes(o) || S.test(t);
2
+ function n(s) {
3
+ return !s || !/fullstory|_fs_|guido-fs\.js/i.test(s) ? s : s.replace(E, (t, c, r) => i(c, r) ? "" : t).replace(_, (t, c) => i(c) ? "" : t);
4
+ }
5
+ export {
6
+ o as FULLSTORY_BRIDGE_SCRIPT_URL,
7
+ n as stripFullStoryScripts
8
+ };
@@ -1,100 +1,108 @@
1
- import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
- import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
- import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
6
- const O = {
1
+ import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
3
+ import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
+ import { preserveTextStyles as L } from "./preserveTextStyles.js";
5
+ import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ const q = {
7
7
  CART_ITEMS: "ins_apr",
8
8
  BROWSED_ITEMS: "browsed_item",
9
9
  PURCHASED_ITEMS: "purchased_item"
10
- }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function B(S, y, b) {
12
- let h = y;
13
- for (; h > 0 && /\s/.test(S[h - 1]); )
14
- h -= 1;
15
- return b.some((I) => S.endsWith(I, h));
10
+ }, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function v($, C, A) {
12
+ let d = C;
13
+ for (; d > 0 && /\s/.test($[d - 1]); )
14
+ d -= 1;
15
+ return A.some((E) => $.endsWith(E, d));
16
16
  }
17
- function Z(S) {
18
- const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
- v(b);
20
- const h = w.PAIRS_FOR_EXTENSION;
21
- Object.entries(h).forEach(([n, d]) => {
22
- b.querySelectorAll(".ins-product-td").forEach((r) => {
23
- const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
- r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var $, F, D, N;
26
- const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
17
+ const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
18
+ function Q($, C) {
19
+ var d;
20
+ const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
21
+ for (let E = A.nextNode(); E; E = A.nextNode())
22
+ (d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(j, (k, P) => `${P}href="${C}"`));
23
+ }
24
+ function et($) {
25
+ const C = W($), A = new DOMParser().parseFromString(C, "text/html");
26
+ X(A);
27
+ const d = M.PAIRS_FOR_EXTENSION;
28
+ Object.entries(d).forEach(([o, p]) => {
29
+ A.querySelectorAll(".ins-product-td").forEach((r) => {
30
+ const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
31
+ r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
32
+ var S, I, O, x;
33
+ const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
27
34
  if (f)
28
- switch (n) {
35
+ switch (o) {
29
36
  case "imageSrc": {
30
- let e = null, a = null;
31
- if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
37
+ let e = null, s = null;
38
+ if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
32
39
  break;
33
40
  const l = f.DEFAULT, c = f.ATTR;
34
41
  if (l && e.src) {
35
- const s = e.src;
36
- l.some((R) => {
37
- const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
38
- return s.includes(R) || s.includes(u) || H === u;
39
- }) && (e.src = `{{${c}_${o}}}`);
42
+ const a = e.src;
43
+ l.some((g) => {
44
+ const u = g.split("/").pop() || "", H = a.split("/").pop() || "";
45
+ return a.includes(g) || a.includes(u) || H === u;
46
+ }) && (e.src = `{{${c}_${n}}}`);
40
47
  }
41
- const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
42
- if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
43
- const s = (D = h.itemLink) == null ? void 0 : D[g];
44
- if (s) {
45
- const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
46
- (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
48
+ const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
49
+ if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
50
+ const a = (O = d.itemLink) == null ? void 0 : O[m];
51
+ if (a) {
52
+ const b = a.HREF, g = a.DEFAULT_HREF || "#!", u = s.href;
53
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${b}_${n}}}`);
47
54
  }
48
55
  }
49
56
  break;
50
57
  }
51
58
  case "name": {
52
- const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
53
- t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
59
+ const e = f, s = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
60
+ t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
54
61
  const i = t.closest("a") || (t.tagName === "A" ? t : null);
55
62
  if (i && c) {
56
- const s = i.href, _ = `${window.location.href}${l}`;
57
- (s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
63
+ const a = i.href, b = `${window.location.href}${l}`;
64
+ (a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
58
65
  }
59
66
  break;
60
67
  }
61
68
  case "price":
62
69
  case "originalPrice": {
63
- const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
64
- let _;
65
- i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
66
- const R = e.CURRENCY;
67
- let u = `{{${_}_${o}}}`;
68
- const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
69
- let C = "";
70
- G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
70
+ const e = f, s = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = s === "true", i = l === "true", a = t.getAttribute(U.POSITION) || "before";
71
+ let b;
72
+ i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
73
+ const g = e.CURRENCY;
74
+ let u = `{{${b}_${n}}}`;
75
+ const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
76
+ let F = "";
77
+ G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
71
78
  break;
72
79
  }
73
80
  case "quantity": {
74
- const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
75
- c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
81
+ const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
82
+ c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
76
83
  break;
77
84
  }
78
85
  case "button": {
79
- const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
86
+ const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
80
87
  if (c) {
81
- const i = c.href || "", s = `${window.location.href}${l}`;
82
- (i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
88
+ const i = c.href || "", a = `${window.location.href}${l}`;
89
+ (i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
83
90
  }
91
+ Q(t, `{{${s}_${n}}}`);
84
92
  break;
85
93
  }
86
94
  case "itemLink": {
87
- const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
95
+ const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
88
96
  if (c.href) {
89
- const i = c.href, s = `${window.location.href}${l}`;
90
- (i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
97
+ const i = c.href, a = `${window.location.href}${l}`;
98
+ (i === a || i.endsWith(l)) && (c.href = `{{${s}_${n}}}`);
91
99
  }
92
100
  break;
93
101
  }
94
102
  default: {
95
103
  if ("ATTR" in f) {
96
104
  const e = f.ATTR;
97
- t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
105
+ t.textContent && (t.innerHTML = L(t, `{{${e}_${n}}}`));
98
106
  }
99
107
  break;
100
108
  }
@@ -102,49 +110,49 @@ function Z(S) {
102
110
  });
103
111
  });
104
112
  });
105
- const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
106
- ` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
107
- W.forEach((n) => {
108
- const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
109
- M.push({
110
- element: n,
113
+ const E = C.match(/<!DOCTYPE[^>]*>/i), k = E ? `${E[0]}
114
+ ` : "", P = A.querySelectorAll(".ins-product-td"), N = [];
115
+ P.forEach((o) => {
116
+ const p = o.getAttribute("data-type") || "CART_ITEMS", T = o.getAttribute("data-number") || "1", r = o.outerHTML;
117
+ N.push({
118
+ element: o,
111
119
  outerHtml: r,
112
- type: d,
113
- number: p
120
+ type: p,
121
+ number: T
114
122
  });
115
123
  });
116
- let A = U + b.documentElement.outerHTML;
117
- M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
- const r = O[d], E = r ? `${r}_total_product_kind` : "";
119
- if (E) {
120
- const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
121
- A = A.replace(n, X(o));
124
+ let h = k + A.documentElement.outerHTML;
125
+ N.reverse().forEach(({ outerHtml: o, type: p, number: T }) => {
126
+ const r = q[p], _ = r ? `${r}_total_product_kind` : "";
127
+ if (_) {
128
+ const R = parseInt(T) - 1, n = `${`{% if ${_} > ${R} %}`}${o}{% endif %}`;
129
+ h = h.replace(o, B(n));
122
130
  }
123
131
  });
124
- const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
- return V.forEach((n) => {
132
+ const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
133
+ return V.forEach((o) => {
126
134
  var t;
127
- const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
- if (!d || !O[p])
135
+ const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
136
+ if (!p || !q[T])
129
137
  return;
130
- const r = n.closest(".product-original-price-class");
131
- if (!r || k.has(r))
138
+ const r = o.closest(".product-original-price-class");
139
+ if (!r || D.has(r))
132
140
  return;
133
- k.add(r);
134
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
135
- T.wrap.push(m !== "false"), L.set(E, T);
136
- }), L.forEach(({ number: n, type: d, wrap: p }, r) => {
137
- if (r.includes("{% if") || !p.some(Boolean))
141
+ D.add(r);
142
+ const _ = r.outerHTML, y = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), R = w.get(_) ?? { number: p, type: T, wrap: [] };
143
+ R.wrap.push(y !== "false"), w.set(_, R);
144
+ }), w.forEach(({ number: o, type: p, wrap: T }, r) => {
145
+ if (r.includes("{% if") || !T.some(Boolean))
138
146
  return;
139
- const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
140
- let g = "", o = 0, f = 0, $ = A.indexOf(r);
141
- for (; $ !== -1; ) {
142
- const F = p[f] === !0 && !B(A, $, t);
143
- g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
147
+ const _ = M.PAIRS_FOR_EXTENSION.price[p].PRICE, y = M.PAIRS_FOR_EXTENSION.originalPrice[p].PRICE, R = `{% if ${_}_${o} != ${y}_${o} %}`, t = [R, W(R)];
148
+ let m = "", n = 0, f = 0, S = h.indexOf(r);
149
+ for (; S !== -1; ) {
150
+ const I = T[f] === !0 && !v(h, S, t);
151
+ m += h.slice(n, S) + (I ? `${R}${r}{% endif %}` : r), n = S + r.length, f += 1, S = h.indexOf(r, n);
144
152
  }
145
- A = g + A.slice(o);
146
- }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
153
+ h = m + h.slice(n);
154
+ }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
155
  }
148
156
  export {
149
- Z as pairProductVariables
157
+ et as pairProductVariables
150
158
  };
@@ -0,0 +1,26 @@
1
+ import i from "../static/stripo-runtime-manifest.json.js";
2
+ import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
3
+ const n = "data-guido-prefetch", d = "pending", o = "settled", s = `link[${n}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, p = () => document.createElement("link").relList.supports("prefetch"), E = () => {
4
+ const { connection: e } = navigator;
5
+ return (e == null ? void 0 : e.saveData) === !0 || u.includes((e == null ? void 0 : e.effectiveType) ?? "");
6
+ }, m = (e) => {
7
+ const t = document.createElement("link"), r = () => t.setAttribute(n, o);
8
+ t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(n, d), t.addEventListener("load", r, { once: !0 }), t.addEventListener("error", r, { once: !0 }), document.head.appendChild(t);
9
+ }, T = () => {
10
+ try {
11
+ const e = c(), t = document.querySelector(s) !== null;
12
+ if (!e || t || !p() || a() || E())
13
+ return;
14
+ i.files.forEach((r) => m(`${e}${r}`));
15
+ } catch (e) {
16
+ console.debug("guido: runtime prefetch skipped", e);
17
+ }
18
+ }, g = () => {
19
+ const e = Array.from(document.querySelectorAll(s));
20
+ return e.length ? e.every((t) => t.getAttribute(n) === o) ? "done" : "pending" : "none";
21
+ };
22
+ export {
23
+ n as RUNTIME_PREFETCH_ATTRIBUTE,
24
+ T as prefetchGuidoRuntime,
25
+ g as readRuntimePrefetchState
26
+ };
@@ -0,0 +1,13 @@
1
+ import r from "../package.json.js";
2
+ const s = "https://email-static.useinsider.com/guido/", e = () => {
3
+ var o;
4
+ const t = r.guido;
5
+ return (o = t == null ? void 0 : t.stripo) == null ? void 0 : o.version;
6
+ }, n = () => {
7
+ const t = e();
8
+ return t ? `${s}${t}/` : null;
9
+ };
10
+ export {
11
+ n as getStripoRuntimeBaseUrl,
12
+ e as getStripoVersion
13
+ };
@@ -1,20 +1,20 @@
1
- import { useActionsApi as D } from "../composables/useActionsApi.js";
2
- import { useConfig as E } from "../composables/useConfig.js";
3
- import { useHtmlCompiler as F } from "../composables/useHtmlCompiler.js";
1
+ import { useActionsApi as E } from "../composables/useActionsApi.js";
2
+ import { useConfig as F } from "../composables/useConfig.js";
3
+ import { useHtmlCompiler as I } from "../composables/useHtmlCompiler.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { toBlockUrlConfig as I } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
5
+ import { toBlockUrlConfig as R } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
6
6
  import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
7
- import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
8
- import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
9
- import { useEditorStore as L } from "../stores/editor.js";
10
- import { useUnsubscribeStore as N } from "../stores/unsubscribe.js";
11
- import { isPlainObject as v } from "./genericUtil.js";
12
- import { assignTrackingIds as z } from "./linkTrackingIds.js";
13
- function M(n) {
7
+ import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
8
+ import { useDynamicContentStore as L } from "../stores/dynamic-content.js";
9
+ import { useEditorStore as N } from "../stores/editor.js";
10
+ import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
11
+ import { isPlainObject as z } from "./genericUtil.js";
12
+ import { assignTrackingIds as M } from "./linkTrackingIds.js";
13
+ function O(n) {
14
14
  const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
15
15
  return r.forEach((i) => {
16
16
  const t = i.getAttribute(g.PAGE_LIST);
17
- t && e.push(...R(t));
17
+ t && e.push(...U(t));
18
18
  }), [...new Set(e)];
19
19
  }
20
20
  async function S(n) {
@@ -35,7 +35,7 @@ async function S(n) {
35
35
  } catch {
36
36
  return;
37
37
  }
38
- v(a) && r.seedBlockUrlConfig(t, I(a));
38
+ z(a) && r.seedBlockUrlConfig(t, R(a));
39
39
  });
40
40
  try {
41
41
  await r.fetchRecommendationCreateData();
@@ -46,40 +46,40 @@ async function S(n) {
46
46
  );
47
47
  }
48
48
  }
49
- const Y = () => {
50
- const n = U(), c = L(), o = N(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = D(), { compileHtml: t, compileAmpHtml: m } = F(), { isFeatureEnabled: a } = E();
49
+ const Z = () => {
50
+ const n = L(), c = N(), o = v(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = E(), { compileHtml: t, compileAmpHtml: m } = I(), { isFeatureEnabled: a } = F();
51
51
  return {
52
- prepareTemplateDetails: async () => {
53
- let { html: s, css: u, syncModulesIds: h = [] } = await e();
52
+ prepareTemplateDetails: async (h) => {
53
+ let { html: s, css: u, syncModulesIds: y = [] } = h ?? await e();
54
54
  if (a("linkTrackingIds"))
55
55
  try {
56
- const { html: d, changed: P, nextSeq: x } = z(s, c.trackIdSessionFloor);
57
- c.trackIdSessionFloor = x, P && (s = d, await i(d, u));
56
+ const { html: d, changed: x, nextSeq: D } = M(s, c.trackIdSessionFloor);
57
+ c.trackIdSessionFloor = D, x && (s = d, await i(d, u));
58
58
  } catch (d) {
59
59
  console.error("Tracking-id step failed, saving anyway:", d);
60
60
  }
61
- const { html: y, ampHtml: p = "", ampErrors: T = [] } = await r({
61
+ const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
62
62
  minimize: !0,
63
63
  resetDataSavedFlag: !1
64
64
  });
65
65
  o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
66
- const { compiledHtml: A, stats: l, appliedRules: w } = t(y), C = p && m(p).compiledHtml, H = n.getSelectedDynamicContentList, k = b(), f = M(s);
66
+ const { compiledHtml: w, stats: l, appliedRules: C } = t(T), H = p && m(p).compiledHtml, k = n.getSelectedDynamicContentList, P = b(), f = O(s);
67
67
  return console.debug("HTML Compilation Stats:", {
68
68
  originalSize: l.originalSize,
69
69
  compiledSize: l.compiledSize,
70
70
  reduction: `${l.reductionPercentage.toFixed(2)}%`,
71
- appliedRules: w,
71
+ appliedRules: C,
72
72
  executionTime: `${l.executionTime.toFixed(2)}ms`
73
73
  }), {
74
- dynamicContentList: H,
75
- compiledHtml: A,
74
+ dynamicContentList: k,
75
+ compiledHtml: w,
76
76
  rawHtml: s,
77
77
  css: u,
78
- ampHtml: C,
79
- ampErrors: T,
80
- modules: h.map(Number),
78
+ ampHtml: H,
79
+ ampErrors: A,
80
+ modules: y.map(Number),
81
81
  recommendation: {
82
- campaignUrls: k.recommendationCampaignUrls,
82
+ campaignUrls: P.recommendationCampaignUrls,
83
83
  configs: {}
84
84
  },
85
85
  unsubscribe: {
@@ -94,6 +94,6 @@ const Y = () => {
94
94
  };
95
95
  };
96
96
  export {
97
- M as getHtmlReferencedUnsubscribePages,
98
- Y as useTemplatePreparation
97
+ O as getHtmlReferencedUnsubscribePages,
98
+ Z as useTemplatePreparation
99
99
  };