@useinsider/guido 3.10.0-beta.dfe1fa6 → 3.10.0-beta.f40b5d9
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/dist/composables/useCortexBlueprintBridge.js +7 -7
- package/dist/composables/useCustomInterfaceAppearance.js +18 -16
- package/dist/composables/useEmailTemplateApplier.js +9 -9
- package/dist/composables/useExport.js +18 -18
- package/dist/composables/useHtmlValidator.js +90 -90
- package/dist/composables/useStripo.js +56 -57
- package/dist/composables/useToaster.js +11 -11
- package/dist/composables/useVersionHistoryApi.js +2 -2
- package/dist/composables/validators/useLiquidValidator.js +1 -1
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +10 -10
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +94 -125
- package/dist/enums/toaster.js +2 -2
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
- package/dist/package.json.js +1 -1
- package/dist/services/blankTemplate.js +1 -1
- package/dist/services/templateLibraryApi.js +7 -8
- package/dist/src/enums/toaster.d.ts +2 -2
- package/dist/src/stores/toaster.d.ts +3 -2
- package/dist/static/styles/components/notification.css.js +74 -0
- package/dist/static/styles/components/wide-panel.css.js +0 -7
- package/dist/stores/toaster.js +10 -10
- package/package.json +3 -3
- package/dist/composables/useStripoNotifications.js +0 -26
- package/dist/src/composables/useStripoNotifications.d.ts +0 -10
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useStripoEventHandler as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { localePatch as L } from "../config/i18n/index.js";
|
|
1
|
+
import { useActionsApi as I } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as U } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as R } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as x } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as O } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
|
+
import { useToaster as H } from "./useToaster.js";
|
|
8
|
+
import { localePatch as z } from "../config/i18n/index.js";
|
|
10
9
|
import { en as h } from "../config/i18n/en/index.js";
|
|
11
|
-
import { ToasterTypeOptions as
|
|
12
|
-
import { useStripoApi as
|
|
13
|
-
import
|
|
10
|
+
import { ToasterTypeOptions as L } from "../enums/toaster.js";
|
|
11
|
+
import { useStripoApi as $ } from "../services/stripoApi.js";
|
|
12
|
+
import G from "../static/styles/customEditorStyle.css.js";
|
|
14
13
|
import { useEditorStore as E } from "../stores/editor.js";
|
|
15
|
-
import { dynamicContentToMergeTags as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
18
|
-
const { features: c, template: w, isFeatureEnabled: u } =
|
|
14
|
+
import { dynamicContentToMergeTags as J } from "../utils/genericUtil.js";
|
|
15
|
+
import N from "../package.json.js";
|
|
16
|
+
const ce = (C, l) => {
|
|
17
|
+
const { features: c, template: w, isFeatureEnabled: u } = R(), { handleError: m, showToaster: b } = H(), { getToken: k, getCustomFonts: T, getSyncModulesStatus: B } = $(), { handleEvent: F } = q(), { getStripoBlocksConfig: v } = U(), V = async (s, r = [], i = !1) => {
|
|
19
18
|
var g, S, y;
|
|
20
|
-
const
|
|
19
|
+
const e = E(), { html: p, css: a } = s, { baseBlocks: o, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
21
20
|
await window.UIEditor.initEditor(
|
|
22
21
|
document.querySelector("#guido-editor"),
|
|
23
22
|
{
|
|
24
23
|
metadata: C,
|
|
25
24
|
html: p,
|
|
26
25
|
css: a,
|
|
27
|
-
forceRecreate:
|
|
26
|
+
forceRecreate: M,
|
|
28
27
|
locale: "en",
|
|
29
28
|
undoButtonSelector: "#guido__undo-button",
|
|
30
29
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -34,101 +33,101 @@ const fo = (C, l) => {
|
|
|
34
33
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
35
34
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
36
35
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
37
|
-
customViewStyles:
|
|
36
|
+
customViewStyles: G,
|
|
38
37
|
conditionsEnabled: f,
|
|
39
38
|
customConditionsEnabled: f,
|
|
40
39
|
enableXSSSecurity: !0,
|
|
41
|
-
modulesDisabled:
|
|
42
|
-
syncModulesEnabled:
|
|
40
|
+
modulesDisabled: A,
|
|
41
|
+
syncModulesEnabled: i,
|
|
43
42
|
messageSettingsEnabled: !0,
|
|
44
43
|
displayGmailAnnotations: !0,
|
|
45
44
|
displayHiddenPreheader: !1,
|
|
45
|
+
keepModuleStylesEnabled: !0,
|
|
46
46
|
displayTitle: !1,
|
|
47
47
|
displayUTM: !1,
|
|
48
48
|
selectElementAfterDrop: !0,
|
|
49
49
|
sameFontSizeForOutlook: !0,
|
|
50
50
|
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
51
|
-
...
|
|
51
|
+
...o ? { baseBlocks: o } : {},
|
|
52
52
|
editorFonts: {
|
|
53
53
|
showDefaultStandardFonts: !0,
|
|
54
54
|
showDefaultNotStandardFonts: !0,
|
|
55
|
-
customFonts:
|
|
55
|
+
customFonts: r
|
|
56
56
|
},
|
|
57
57
|
mergeTags: [
|
|
58
58
|
{
|
|
59
|
-
entries:
|
|
59
|
+
entries: J(
|
|
60
60
|
l.preselectedDynamicContentList,
|
|
61
61
|
u("liquidSyntax")
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
|
-
async onTokenRefreshRequest(
|
|
65
|
+
async onTokenRefreshRequest(t) {
|
|
66
66
|
try {
|
|
67
|
-
const n = await
|
|
68
|
-
|
|
67
|
+
const n = await k();
|
|
68
|
+
t(n);
|
|
69
69
|
} catch (n) {
|
|
70
70
|
m(n, "Failed to refresh token");
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
onTemplateLoaded() {
|
|
74
74
|
try {
|
|
75
|
-
const { importCss:
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const { importCss: t } = x(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: P } = I(), { injectFullStory: D } = O();
|
|
76
|
+
t(), n(), D(), P(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
77
|
+
e.hasChanges = !1;
|
|
78
78
|
}, 1e3);
|
|
79
|
-
} catch (
|
|
80
|
-
m(
|
|
79
|
+
} catch (t) {
|
|
80
|
+
m(t, "Failed to load custom interface appearance");
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
onCodeEditorVisibilityChanged(
|
|
84
|
-
|
|
83
|
+
onCodeEditorVisibilityChanged(t) {
|
|
84
|
+
e.isCodeEditorOpen = t;
|
|
85
85
|
},
|
|
86
|
-
onEditorVisualModeChanged(
|
|
87
|
-
|
|
86
|
+
onEditorVisualModeChanged(t) {
|
|
87
|
+
e.editorVisualMode = t.toLowerCase();
|
|
88
88
|
},
|
|
89
|
-
onVersionHistoryVisibilityChanged(
|
|
90
|
-
|
|
89
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
90
|
+
e.isVersionHistoryOpen = t;
|
|
91
91
|
},
|
|
92
92
|
onDataChanged() {
|
|
93
|
-
|
|
93
|
+
e.hasChanges = !0;
|
|
94
94
|
},
|
|
95
95
|
onEvent: F,
|
|
96
|
-
notifications: V(),
|
|
97
96
|
ignoreClickOutsideSelectors: [
|
|
98
97
|
"#guido-dynamic-content-modal",
|
|
99
98
|
".in-on-board-wrapper",
|
|
100
99
|
".in-drawer__container"
|
|
101
100
|
],
|
|
102
101
|
extensions: d,
|
|
103
|
-
localePatch:
|
|
102
|
+
localePatch: z
|
|
104
103
|
}
|
|
105
104
|
);
|
|
106
|
-
},
|
|
105
|
+
}, _ = (s) => new Promise((r, i) => {
|
|
107
106
|
var d;
|
|
108
107
|
if (document.getElementById("UiEditorScript")) {
|
|
109
|
-
Promise.resolve(s()).then(
|
|
108
|
+
Promise.resolve(s()).then(r, i);
|
|
110
109
|
return;
|
|
111
110
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
Promise.resolve(s()).then(
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
}, document.body.appendChild(
|
|
111
|
+
const e = N.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
112
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
113
|
+
Promise.resolve(s()).then(r, i);
|
|
114
|
+
}, o.onerror = () => {
|
|
115
|
+
i(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
116
|
+
}, document.body.appendChild(o);
|
|
118
117
|
});
|
|
119
118
|
return { initPlugin: async (s) => {
|
|
120
|
-
const
|
|
119
|
+
const r = E();
|
|
121
120
|
try {
|
|
122
|
-
await
|
|
123
|
-
const [
|
|
124
|
-
|
|
121
|
+
await _(async () => {
|
|
122
|
+
const [i, e] = await Promise.all([
|
|
123
|
+
T(),
|
|
125
124
|
B()
|
|
126
125
|
]);
|
|
127
|
-
|
|
126
|
+
r.syncModulesEnabled = e, await V(s, i, e);
|
|
128
127
|
});
|
|
129
128
|
} catch {
|
|
130
|
-
|
|
131
|
-
type:
|
|
129
|
+
r.loadingStatus = !1, b({
|
|
130
|
+
type: L.Alert,
|
|
132
131
|
message: h["An error has occurred. Please report the error code to support."],
|
|
133
132
|
actionButton: {
|
|
134
133
|
text: h["Reload page"],
|
|
@@ -139,5 +138,5 @@ const fo = (C, l) => {
|
|
|
139
138
|
} };
|
|
140
139
|
};
|
|
141
140
|
export {
|
|
142
|
-
|
|
141
|
+
ce as useStripo
|
|
143
142
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
2
|
import { useToasterStore as c } from "../stores/toaster.js";
|
|
3
|
-
import { watch as u, nextTick as
|
|
3
|
+
import { watch as u, nextTick as l } from "vue";
|
|
4
4
|
const p = () => {
|
|
5
|
-
const
|
|
6
|
-
let
|
|
5
|
+
const t = c();
|
|
6
|
+
let o = null;
|
|
7
7
|
const s = () => {
|
|
8
|
-
|
|
8
|
+
o && (clearTimeout(o), o = null);
|
|
9
9
|
};
|
|
10
10
|
function r(e = { message: "" }) {
|
|
11
|
-
s(),
|
|
12
|
-
|
|
11
|
+
s(), t.hideToaster(), l(() => {
|
|
12
|
+
t.showToaster(e);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
function i() {
|
|
16
|
-
s(),
|
|
16
|
+
s(), t.hideToaster();
|
|
17
17
|
}
|
|
18
18
|
function n(e, a) {
|
|
19
19
|
const m = e instanceof Error ? e.message : String(e);
|
|
20
|
-
r({ type: T.
|
|
20
|
+
r({ type: T.Alert, message: `${a}: ${m}` });
|
|
21
21
|
}
|
|
22
22
|
return u(
|
|
23
|
-
() =>
|
|
23
|
+
() => t.shouldAutoHide,
|
|
24
24
|
(e) => {
|
|
25
|
-
s(), e && (
|
|
26
|
-
|
|
25
|
+
s(), e && (o = setTimeout(() => {
|
|
26
|
+
t.hideToaster(), s();
|
|
27
27
|
}, 6e3));
|
|
28
28
|
}
|
|
29
29
|
), { showToaster: r, hideToaster: i, handleError: n };
|
|
@@ -24,7 +24,7 @@ const S = () => {
|
|
|
24
24
|
window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
|
|
25
25
|
const r = o instanceof Error ? o.message : String(o);
|
|
26
26
|
s({
|
|
27
|
-
type: t.
|
|
27
|
+
type: t.Alert,
|
|
28
28
|
message: `Error compiling email: ${r}`
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -41,7 +41,7 @@ const S = () => {
|
|
|
41
41
|
(o) => {
|
|
42
42
|
const r = o instanceof Error ? o.message : String(o);
|
|
43
43
|
s({
|
|
44
|
-
type: t.
|
|
44
|
+
type: t.Alert,
|
|
45
45
|
message: `Error compiling email: ${r}`
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ToasterTypeOptions as i } from "../../enums/toaster.js";
|
|
2
2
|
import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
3
|
import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
4
|
+
import { useToaster as m } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as E } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -13,23 +13,23 @@ const T = [
|
|
|
13
13
|
messageKey: "unsubscription-preference.duplicate-pref-center"
|
|
14
14
|
}
|
|
15
15
|
], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
|
|
16
|
-
const { showToaster: c } =
|
|
16
|
+
const { showToaster: c } = m(), p = E();
|
|
17
17
|
return { validateUnsubscribeBlockUniqueness: (n) => {
|
|
18
|
-
const o = new DOMParser().parseFromString(n, "text/html"),
|
|
18
|
+
const o = new DOMParser().parseFromString(n, "text/html"), s = /* @__PURE__ */ new Map();
|
|
19
19
|
o.querySelectorAll(l).forEach((e) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const r = Number(e.getAttribute(a.PAGE_TYPE));
|
|
21
|
+
s.set(r, (s.get(r) ?? 0) + 1);
|
|
22
22
|
});
|
|
23
|
-
const t = T.filter((e) => (
|
|
23
|
+
const t = T.filter((e) => (s.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
|
|
24
24
|
return t.length ? (c({
|
|
25
|
-
type: i.
|
|
25
|
+
type: i.Alert,
|
|
26
26
|
message: p(t.length > 1 ? g : t[0])
|
|
27
27
|
}), !1) : !0;
|
|
28
28
|
}, validateUnsubscribeBlockHasTemplate: (n) => {
|
|
29
29
|
const o = new DOMParser().parseFromString(n, "text/html");
|
|
30
30
|
return Array.from(o.querySelectorAll(l)).some((t) => {
|
|
31
|
-
const e = t.getAttribute(a.PAGE_TYPE),
|
|
32
|
-
return !e || !
|
|
31
|
+
const e = t.getAttribute(a.PAGE_TYPE), r = t.getAttribute(a.PAGE_LIST);
|
|
32
|
+
return !e || !r;
|
|
33
33
|
}) ? (c({
|
|
34
34
|
type: i.Warning,
|
|
35
35
|
message: p(b)
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
3
|
-
import { CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { isIgnoredRecommendationBlock as
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
function
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as q } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as C } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as E } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
6
|
+
function P(t, r, e, n, s = "") {
|
|
7
|
+
const c = `{{${s}${t}_${r}_${e}}}`, o = `{{${s}${t}_${r}_currency}}`;
|
|
8
|
+
return n === "before" ? `${o} ${c}` : `${c} ${o}`;
|
|
9
|
+
}
|
|
10
|
+
function m(t) {
|
|
11
11
|
let r = t;
|
|
12
12
|
for (; r.children.length === 1; )
|
|
13
13
|
[r] = r.children;
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function b(t, r, e, n, s, c) {
|
|
17
17
|
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
const o = t.querySelector("img");
|
|
20
|
+
o && (o.setAttribute("src", `{{${c}${e}_${n}_image_url}}`), o.setAttribute("alt", `{{${c}${e}_${n}_name}}`));
|
|
21
|
+
const i = t.querySelector("a");
|
|
22
|
+
i && (i.setAttribute("href", `{{${c}${e}_${n}_url}}`), i.classList.add(C));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const o = t.querySelector("p");
|
|
27
|
+
o && (m(o).textContent = `{{${c}${e}_${n}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
// Inline mode ("Move to next line" OFF) merges BOTH prices into one row
|
|
@@ -32,176 +32,145 @@ function A(t, r, e, o, s, i) {
|
|
|
32
32
|
// substitute by cell content, not by the row's anchor (SD-145161).
|
|
33
33
|
case "productPrice":
|
|
34
34
|
case "productOldPrice": {
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const o = (d, l) => {
|
|
36
|
+
d && (m(d).textContent = P(
|
|
37
37
|
e,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
n,
|
|
39
|
+
l,
|
|
40
40
|
s,
|
|
41
|
-
|
|
41
|
+
c
|
|
42
42
|
));
|
|
43
|
-
},
|
|
44
|
-
|
|
43
|
+
}, i = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !i && !a ? t.querySelector("p") : null;
|
|
44
|
+
o(i ?? (r === "productPrice" ? u : null), "price"), o(a ?? (r === "productOldPrice" ? u : null), "original_price");
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
case "productButton": {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const o = t.querySelector("a");
|
|
49
|
+
o && o.setAttribute("href", `{{${c}${e}_${n}_url}}`);
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
case "productOmnibusPrice": {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
53
|
+
const o = t.querySelector(".omnibus-price-value");
|
|
54
|
+
if (o) {
|
|
55
|
+
o.textContent = `{{${c}${e}_${n}_omnibus_price}}`;
|
|
56
|
+
const i = o.closest("p");
|
|
57
|
+
i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "productOmnibusDiscount": {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
62
|
+
const o = t.querySelector(".omnibus-discount-value");
|
|
63
|
+
if (o) {
|
|
64
|
+
o.textContent = `{{${c}${e}_${n}_omnibus_discount}}`;
|
|
65
|
+
const i = o.closest("p");
|
|
66
|
+
i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
default: {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
a && (
|
|
71
|
+
const o = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
72
|
+
if (o) {
|
|
73
|
+
const i = o.getAttribute("product-attr"), a = o.querySelector("p");
|
|
74
|
+
a && (m(a).textContent = `{{${c}${e}_${n}_${i}}}`);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
function L(t, r, e) {
|
|
89
|
-
return S(t, r, 0, e);
|
|
90
|
-
}
|
|
91
|
-
function N(t, r, e, o) {
|
|
92
|
-
if (!t.innerHTML.includes("{{"))
|
|
93
|
-
return;
|
|
94
|
-
const { open: s, close: i } = S(t.ownerDocument, r, e, o);
|
|
95
|
-
t.insertBefore(s, t.firstChild), t.appendChild(i);
|
|
96
|
-
}
|
|
97
|
-
function T(t, r, e, o) {
|
|
98
|
-
var n, c;
|
|
99
|
-
if (!t.innerHTML.includes("{{"))
|
|
100
|
-
return;
|
|
101
|
-
const { open: s, close: i } = S(t.ownerDocument, r, e, o);
|
|
102
|
-
(n = t.parentNode) == null || n.insertBefore(s, t), (c = t.parentNode) == null || c.insertBefore(i, t.nextSibling);
|
|
103
|
-
}
|
|
104
|
-
function v(t, r, e, o) {
|
|
105
|
-
t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
|
|
106
|
-
i.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
107
|
-
const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
|
|
108
|
-
l.length > 0 ? l.forEach((d) => {
|
|
109
|
-
A(d, u, r, n, e, o);
|
|
110
|
-
}) : A(a, u, r, n, e, o);
|
|
111
|
-
}), T(i, r, n, o);
|
|
80
|
+
function R(t, r, e, n) {
|
|
81
|
+
t.querySelectorAll(".recommendation-product-row").forEach((c, o) => {
|
|
82
|
+
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
83
|
+
const u = a.getAttribute("data-attribute-type") || "", d = a.querySelectorAll(".attribute-cell");
|
|
84
|
+
d.length > 0 ? d.forEach((l) => {
|
|
85
|
+
b(l, u, r, o, e, n);
|
|
86
|
+
}) : b(a, u, r, o, e, n);
|
|
87
|
+
});
|
|
112
88
|
});
|
|
113
89
|
}
|
|
114
|
-
function
|
|
90
|
+
function W(t, r, e, n) {
|
|
115
91
|
const s = t.querySelectorAll(".recommendation-product-row");
|
|
116
92
|
if (!s.length)
|
|
117
93
|
return;
|
|
118
|
-
const [
|
|
94
|
+
const [c] = s, o = c.querySelector("[data-attribute-type]"), i = o ? o.querySelectorAll(".attribute-cell").length : 1;
|
|
119
95
|
s.forEach((a, u) => {
|
|
120
|
-
a.querySelectorAll("[data-attribute-type]").forEach((
|
|
121
|
-
const p =
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
96
|
+
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
97
|
+
const p = l.getAttribute("data-attribute-type") || "";
|
|
98
|
+
l.querySelectorAll(".attribute-cell").forEach(($, S) => {
|
|
99
|
+
const g = u * i + S;
|
|
100
|
+
b($, p, r, g, e, n);
|
|
125
101
|
});
|
|
126
102
|
});
|
|
127
103
|
});
|
|
128
104
|
}
|
|
129
|
-
function
|
|
130
|
-
t.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
131
|
-
|
|
105
|
+
function v(t, r, e, n) {
|
|
106
|
+
t.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
107
|
+
W(c, r, e, n);
|
|
132
108
|
});
|
|
133
109
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
|
|
110
|
+
function O(t, r, e) {
|
|
111
|
+
const n = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
|
|
112
|
+
n === "list" ? R(t, r, s, e) : v(t, r, s, e);
|
|
137
113
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
114
|
+
function f(t, r, e) {
|
|
115
|
+
const n = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(n);
|
|
140
116
|
return s ? parseInt(s[1]) : e;
|
|
141
117
|
}
|
|
142
|
-
function
|
|
118
|
+
function y(t) {
|
|
143
119
|
const r = t.trim();
|
|
144
120
|
return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
|
|
145
121
|
}
|
|
146
|
-
function
|
|
122
|
+
function A(t) {
|
|
147
123
|
const r = t.getAttribute("width");
|
|
148
|
-
if (r &&
|
|
124
|
+
if (r && y(r))
|
|
149
125
|
return r.trim();
|
|
150
126
|
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
151
|
-
return e &&
|
|
127
|
+
return e && y(e[1]) ? e[1] : null;
|
|
152
128
|
}
|
|
153
129
|
function M(t, r) {
|
|
154
130
|
let e = t.parentElement;
|
|
155
131
|
for (; e && e !== r; ) {
|
|
156
|
-
if (e.tagName === "TD" &&
|
|
132
|
+
if (e.tagName === "TD" && A(e))
|
|
157
133
|
return e;
|
|
158
134
|
e = e.parentElement;
|
|
159
135
|
}
|
|
160
136
|
return null;
|
|
161
137
|
}
|
|
162
|
-
function
|
|
163
|
-
const r = t.getAttribute("style") || "", e =
|
|
164
|
-
s !== 0 && t.querySelectorAll("img.adapt-img").forEach((
|
|
165
|
-
if (
|
|
138
|
+
function T(t) {
|
|
139
|
+
const r = t.getAttribute("style") || "", e = f(r, "width", 600), n = f(r, "padding", 0) * 2, s = Math.max(0, e - n);
|
|
140
|
+
s !== 0 && t.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
141
|
+
if (c.hasAttribute("width"))
|
|
166
142
|
return;
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
143
|
+
const o = M(c, t);
|
|
144
|
+
if (!o)
|
|
169
145
|
return;
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
if (!/\bwidth\s*:\s*\d/i.test(
|
|
174
|
-
const p =
|
|
175
|
-
|
|
146
|
+
const i = A(o), a = f(o.getAttribute("style") || "", "padding", 0) * 2, u = i.endsWith("%") ? Math.floor(s * parseFloat(i) / 100) : parseInt(i), d = Math.max(1, u - a);
|
|
147
|
+
c.setAttribute("width", String(d));
|
|
148
|
+
const l = c.getAttribute("style") || "";
|
|
149
|
+
if (!/\bwidth\s*:\s*\d/i.test(l)) {
|
|
150
|
+
const p = l && !l.trim().endsWith(";") ? "; " : "";
|
|
151
|
+
c.setAttribute("style", `${l}${p}width: ${d}px`);
|
|
176
152
|
}
|
|
177
153
|
});
|
|
178
154
|
}
|
|
179
|
-
function
|
|
155
|
+
function B(t, r) {
|
|
180
156
|
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
181
157
|
return (e ? `${e[0]}
|
|
182
158
|
` : "") + r.documentElement.outerHTML;
|
|
183
159
|
}
|
|
184
|
-
function
|
|
185
|
-
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"),
|
|
186
|
-
if (!
|
|
160
|
+
function G(t) {
|
|
161
|
+
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), n = e.querySelectorAll(".recommendation-block-v2");
|
|
162
|
+
if (!n.length)
|
|
187
163
|
return t;
|
|
188
|
-
const { buildCampaignUrl: s } =
|
|
189
|
-
|
|
190
|
-
const { isFeatureEnabled:
|
|
191
|
-
return
|
|
192
|
-
var
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
D(u, l, c);
|
|
197
|
-
const { open: f, close: h } = L(e, l, c);
|
|
198
|
-
(b = u.parentNode) == null || b.insertBefore(f, u), (m = u.parentNode) == null || m.insertBefore(h, u.nextSibling);
|
|
199
|
-
}
|
|
200
|
-
G(u);
|
|
201
|
-
}
|
|
202
|
-
}), H(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
164
|
+
const { buildCampaignUrl: s } = q(), c = E();
|
|
165
|
+
c.recommendationCampaignUrls = {};
|
|
166
|
+
const { isFeatureEnabled: o } = _(), i = o("liquidSyntax") ? "reco_" : "";
|
|
167
|
+
return n.forEach((u) => {
|
|
168
|
+
var l, p;
|
|
169
|
+
const d = u.getAttribute("recommendation-id");
|
|
170
|
+
d && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), s(d), w(u) || O(u, d, i), T(u));
|
|
171
|
+
}), B(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
203
172
|
}
|
|
204
173
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
174
|
+
P as formatPriceVariable,
|
|
175
|
+
G as prepareRecommendationBlocks
|
|
207
176
|
};
|
package/dist/enums/toaster.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
c as ToasterTypeOptions
|
|
4
4
|
};
|