@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.
- package/README.md +36 -4
- package/dist/@types/config/schemas.js +41 -39
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +118 -108
- package/dist/composables/useActionsApi.js +22 -21
- package/dist/composables/useEditorOpenMetrics.js +167 -0
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/useStripo.js +94 -82
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -10
- package/dist/package.json.js +6 -4
- package/dist/public/prefetchRuntime.js +4 -0
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
- package/dist/src/composables/useStripo.d.ts +2 -1
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/prefetchRuntime.d.ts +1 -0
- package/dist/src/stores/config.d.ts +20 -0
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/src/utils/runtimePrefetch.d.ts +4 -0
- package/dist/src/utils/stripoRuntime.d.ts +3 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/static/stripo-runtime-manifest.json.js +9 -0
- package/dist/utils/fullStoryScripts.js +8 -0
- package/dist/utils/pairProductVariables.js +98 -90
- package/dist/utils/runtimePrefetch.js +26 -0
- package/dist/utils/stripoRuntime.js +13 -0
- package/dist/utils/templatePreparation.js +30 -30
- 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;
|
|
@@ -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
|
|
2
|
-
import { productPairs as
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
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
|
-
},
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 (
|
|
35
|
+
switch (o) {
|
|
29
36
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
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
|
|
36
|
-
l.some((
|
|
37
|
-
const u =
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${c}_${
|
|
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 = (
|
|
42
|
-
if (i && e.setAttribute("alt", `{{${i}_${
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(
|
|
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,
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
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
|
|
57
|
-
(
|
|
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,
|
|
64
|
-
let
|
|
65
|
-
i ?
|
|
66
|
-
const
|
|
67
|
-
let u = `{{${
|
|
68
|
-
const H = (t.getAttribute(
|
|
69
|
-
let
|
|
70
|
-
G ?
|
|
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,
|
|
75
|
-
c && l.includes(c) && (t.innerHTML =
|
|
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,
|
|
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 || "",
|
|
82
|
-
(i === "" || i === "#" || i ===
|
|
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,
|
|
95
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
96
|
if (c.href) {
|
|
89
|
-
const i = c.href,
|
|
90
|
-
(i ===
|
|
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 =
|
|
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
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
element:
|
|
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:
|
|
113
|
-
number:
|
|
120
|
+
type: p,
|
|
121
|
+
number: T
|
|
114
122
|
});
|
|
115
123
|
});
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
const r =
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
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 =
|
|
125
|
-
return V.forEach((
|
|
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
|
|
128
|
-
if (!
|
|
135
|
+
const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
|
|
136
|
+
if (!p || !q[T])
|
|
129
137
|
return;
|
|
130
|
-
const r =
|
|
131
|
-
if (!r ||
|
|
138
|
+
const r = o.closest(".product-original-price-class");
|
|
139
|
+
if (!r || D.has(r))
|
|
132
140
|
return;
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
if (r.includes("{% if") || !
|
|
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
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
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
|
-
|
|
146
|
-
}),
|
|
153
|
+
h = m + h.slice(n);
|
|
154
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
155
|
}
|
|
148
156
|
export {
|
|
149
|
-
|
|
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
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
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
|
|
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
|
|
8
|
-
import { useDynamicContentStore as
|
|
9
|
-
import { useEditorStore as
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
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(...
|
|
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
|
-
|
|
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
|
|
50
|
-
const n =
|
|
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:
|
|
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:
|
|
57
|
-
c.trackIdSessionFloor =
|
|
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:
|
|
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:
|
|
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:
|
|
71
|
+
appliedRules: C,
|
|
72
72
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
73
|
}), {
|
|
74
|
-
dynamicContentList:
|
|
75
|
-
compiledHtml:
|
|
74
|
+
dynamicContentList: k,
|
|
75
|
+
compiledHtml: w,
|
|
76
76
|
rawHtml: s,
|
|
77
77
|
css: u,
|
|
78
|
-
ampHtml:
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
78
|
+
ampHtml: H,
|
|
79
|
+
ampErrors: A,
|
|
80
|
+
modules: y.map(Number),
|
|
81
81
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
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
|
-
|
|
98
|
-
|
|
97
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
98
|
+
Z as useTemplatePreparation
|
|
99
99
|
};
|