@useinsider/guido 3.21.2-beta.1cc8327 → 3.21.2-beta.4b0fed7
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/useActionsApi.js +21 -22
- package/dist/composables/useFullStoryBridge.js +9 -10
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
- package/dist/config/migrator/index.js +10 -11
- package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
- package/dist/config/migrator/recommendation/extractors.js +68 -29
- package/dist/config/migrator/recommendation/htmlBuilder.js +283 -200
- package/dist/config/migrator/recommendation/settingsMapper.js +35 -32
- package/dist/config/migrator/recommendationMigrator.js +32 -29
- package/dist/extensions/Blocks/Recommendation/block.js +33 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +146 -162
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +1 -2
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +3 -2
- package/package.json +1 -1
- package/dist/config/migrator/fullStoryScriptMigrator.js +0 -5
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +0 -1
- package/dist/src/utils/fullStoryScripts.d.ts +0 -6
- package/dist/utils/fullStoryScripts.js +0 -8
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
3
|
-
import { getEditorApi as r } from "../utils/stripoEditorApi.js";
|
|
1
|
+
import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { getEditorApi as s } from "../utils/stripoEditorApi.js";
|
|
4
3
|
import { useToaster as D } from "./useToaster.js";
|
|
5
|
-
const
|
|
4
|
+
const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
6
5
|
const f = setTimeout(
|
|
7
6
|
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
8
7
|
l
|
|
@@ -14,8 +13,8 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
14
13
|
} catch (t) {
|
|
15
14
|
d(t);
|
|
16
15
|
}
|
|
17
|
-
}),
|
|
18
|
-
const { handleError: n } = D(), l = (t = {}) =>
|
|
16
|
+
}), P = () => {
|
|
17
|
+
const { handleError: n } = D(), l = (t = {}) => r(
|
|
19
18
|
"compileEmail",
|
|
20
19
|
T,
|
|
21
20
|
(e, i) => {
|
|
@@ -39,38 +38,38 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
39
38
|
resetDataSavedFlag: !1,
|
|
40
39
|
disableLineHeightsReplace: !0
|
|
41
40
|
}, ...t }, u = {
|
|
42
|
-
callback: (
|
|
43
|
-
|
|
41
|
+
callback: (m, g, w, S, v) => {
|
|
42
|
+
m ? i(m) : e({
|
|
44
43
|
html: g,
|
|
45
44
|
ampHtml: w,
|
|
46
|
-
ampErrors:
|
|
47
|
-
displayConditions:
|
|
45
|
+
ampErrors: y(S ?? []),
|
|
46
|
+
displayConditions: v
|
|
48
47
|
});
|
|
49
48
|
},
|
|
50
49
|
...o
|
|
51
50
|
};
|
|
52
|
-
|
|
51
|
+
s().actionsApi.compileEmail(u);
|
|
53
52
|
}
|
|
54
53
|
);
|
|
55
54
|
return {
|
|
56
55
|
getCompiledEmail: l,
|
|
57
|
-
getTemplateData: () =>
|
|
56
|
+
getTemplateData: () => r(
|
|
58
57
|
"getTemplateData",
|
|
59
58
|
T,
|
|
60
59
|
(t) => {
|
|
61
|
-
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds:
|
|
62
|
-
html:
|
|
60
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
61
|
+
html: i,
|
|
63
62
|
css: a,
|
|
64
63
|
width: o,
|
|
65
64
|
height: E,
|
|
66
65
|
utmParams: u,
|
|
67
|
-
syncModulesIds:
|
|
66
|
+
syncModulesIds: m
|
|
68
67
|
});
|
|
69
|
-
|
|
68
|
+
s().actionsApi.getTemplateData(e);
|
|
70
69
|
}
|
|
71
70
|
),
|
|
72
71
|
activateCustomViewStyles: (t = !0) => {
|
|
73
|
-
|
|
72
|
+
s().actionsApi.activateCustomViewStyles(t);
|
|
74
73
|
},
|
|
75
74
|
getPreviewData: async (t) => {
|
|
76
75
|
try {
|
|
@@ -110,16 +109,16 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
110
109
|
}
|
|
111
110
|
}),
|
|
112
111
|
updateHtmlAndCss: (t, e) => {
|
|
113
|
-
const { actionsApi: i } =
|
|
114
|
-
return
|
|
112
|
+
const { actionsApi: i } = s();
|
|
113
|
+
return r("updateHtmlAndCss", h, (a) => {
|
|
115
114
|
i.updateHtmlAndCss(t, e, () => a());
|
|
116
115
|
});
|
|
117
116
|
},
|
|
118
|
-
editorSave: () =>
|
|
117
|
+
editorSave: () => r(
|
|
119
118
|
"save",
|
|
120
119
|
T,
|
|
121
120
|
(t) => {
|
|
122
|
-
|
|
121
|
+
s().actionsApi.save((e) => {
|
|
123
122
|
if (e) {
|
|
124
123
|
n(e, "Failed to save template"), t(!1);
|
|
125
124
|
return;
|
|
@@ -131,5 +130,5 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
131
130
|
};
|
|
132
131
|
};
|
|
133
132
|
export {
|
|
134
|
-
|
|
133
|
+
P as useActionsApi
|
|
135
134
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (typeof n._fs_org != "string" || !n._fs_org)
|
|
1
|
+
const c = "https://email-static.useinsider.com/guido/guido-fs.js", u = () => ({ injectFullStory: () => {
|
|
2
|
+
var n;
|
|
3
|
+
const s = window;
|
|
4
|
+
if (typeof s._fs_org != "string" || !s._fs_org)
|
|
6
5
|
return;
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
6
|
+
const r = document.querySelector("ui-editor"), o = (n = r == null ? void 0 : r.shadowRoot) == null ? void 0 : n.querySelector("iframe"), e = o == null ? void 0 : o.contentDocument;
|
|
7
|
+
if (!e || e.querySelector('script[data-fullstory-bridge="true"]'))
|
|
9
8
|
return;
|
|
10
|
-
const t =
|
|
11
|
-
t.src =
|
|
9
|
+
const t = e.createElement("script");
|
|
10
|
+
t.src = c, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", e.head.appendChild(t);
|
|
12
11
|
} });
|
|
13
12
|
export {
|
|
14
|
-
|
|
13
|
+
u as useFullStoryBridge
|
|
15
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as C } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as O } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as B } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as N } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
@@ -13,7 +13,7 @@ function A(t) {
|
|
|
13
13
|
[r] = r.children;
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function _(t, r, e, o, c, i) {
|
|
17
17
|
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
19
|
const n = t.querySelector("img");
|
|
@@ -78,7 +78,7 @@ function y(t, r, e, o, c, i) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
const P = "name";
|
|
81
|
-
function
|
|
81
|
+
function y(t, r, e, o) {
|
|
82
82
|
const c = `${o}${r}_${e}_${P}`;
|
|
83
83
|
return {
|
|
84
84
|
open: t.createComment(`{% if ${c} and ${c} != "" %}`),
|
|
@@ -86,19 +86,19 @@ function b(t, r, e, o) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
function R(t, r, e) {
|
|
89
|
-
return
|
|
89
|
+
return y(t, r, 0, e);
|
|
90
90
|
}
|
|
91
91
|
function w(t, r, e, o) {
|
|
92
92
|
if (!t.innerHTML.includes("{{"))
|
|
93
93
|
return;
|
|
94
|
-
const { open: c, close: i } =
|
|
94
|
+
const { open: c, close: i } = y(t.ownerDocument, r, e, o);
|
|
95
95
|
t.insertBefore(c, t.firstChild), t.appendChild(i);
|
|
96
96
|
}
|
|
97
97
|
function D(t, r, e, o) {
|
|
98
98
|
var n, s;
|
|
99
99
|
if (!t.innerHTML.includes("{{"))
|
|
100
100
|
return;
|
|
101
|
-
const { open: c, close: i } =
|
|
101
|
+
const { open: c, close: i } = y(t.ownerDocument, r, e, o);
|
|
102
102
|
(n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
|
|
103
103
|
}
|
|
104
104
|
function v(t, r, e, o) {
|
|
@@ -106,8 +106,8 @@ function v(t, r, e, o) {
|
|
|
106
106
|
i.querySelectorAll("[data-attribute-type]").forEach((d) => {
|
|
107
107
|
const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
|
|
108
108
|
a.length > 0 ? a.forEach((l) => {
|
|
109
|
-
|
|
110
|
-
}) :
|
|
109
|
+
_(l, u, r, n, e, o);
|
|
110
|
+
}) : _(d, u, r, n, e, o);
|
|
111
111
|
}), D(i, r, n, o);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -119,9 +119,9 @@ function H(t, r, e, o) {
|
|
|
119
119
|
c.forEach((d, u) => {
|
|
120
120
|
d.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
121
121
|
const p = l.getAttribute("data-attribute-type") || "";
|
|
122
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
122
|
+
l.querySelectorAll(".attribute-cell").forEach((m, h) => {
|
|
123
123
|
const S = u * s + h;
|
|
124
|
-
|
|
124
|
+
_(m, p, r, S, e, o), w(m, r, S, o);
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
});
|
|
@@ -132,10 +132,10 @@ function W(t, r, e, o) {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
function F(t, r, e) {
|
|
135
|
-
const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment") || "after";
|
|
136
|
-
o === "list" ? v(t, r,
|
|
135
|
+
const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
|
|
136
|
+
o === "list" ? v(t, r, i, e) : W(t, r, i, e);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function b(t, r, e) {
|
|
139
139
|
const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
|
|
140
140
|
return c ? parseInt(c[1]) : e;
|
|
141
141
|
}
|
|
@@ -143,7 +143,7 @@ function $(t) {
|
|
|
143
143
|
const r = t.trim();
|
|
144
144
|
return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function g(t) {
|
|
147
147
|
const r = t.getAttribute("width");
|
|
148
148
|
if (r && $(r))
|
|
149
149
|
return r.trim();
|
|
@@ -153,28 +153,28 @@ function C(t) {
|
|
|
153
153
|
function x(t, r) {
|
|
154
154
|
let e = t.parentElement;
|
|
155
155
|
for (; e && e !== r; ) {
|
|
156
|
-
if (e.tagName === "TD" &&
|
|
156
|
+
if (e.tagName === "TD" && g(e))
|
|
157
157
|
return e;
|
|
158
158
|
e = e.parentElement;
|
|
159
159
|
}
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
162
|
function G(t) {
|
|
163
|
-
const r = t.getAttribute("style") || "", e =
|
|
163
|
+
const r = t.getAttribute("style") || "", e = b(r, "width", 600), o = b(r, "padding", 0) * 2, c = Math.max(0, e - o);
|
|
164
164
|
c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
165
165
|
if (i.hasAttribute("width"))
|
|
166
166
|
return;
|
|
167
167
|
const n = x(i, t);
|
|
168
168
|
if (!n)
|
|
169
169
|
return;
|
|
170
|
-
const s =
|
|
170
|
+
const s = g(n), d = b(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
|
|
171
171
|
if (p) {
|
|
172
172
|
i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
|
|
176
|
-
const
|
|
177
|
-
i.setAttribute("style", `${l}${
|
|
176
|
+
const f = l && !l.trim().endsWith(";") ? "; " : "";
|
|
177
|
+
i.setAttribute("style", `${l}${f}width: ${a}px`);
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}
|
|
@@ -200,15 +200,15 @@ function Q(t) {
|
|
|
200
200
|
return t;
|
|
201
201
|
const { buildCampaignUrl: c } = O(), i = N();
|
|
202
202
|
i.recommendationCampaignUrls = {};
|
|
203
|
-
const { isFeatureEnabled: n } =
|
|
203
|
+
const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
|
|
204
204
|
return o.forEach((u) => {
|
|
205
|
-
var l, p,
|
|
205
|
+
var l, p, f, m;
|
|
206
206
|
const a = u.getAttribute("recommendation-id");
|
|
207
207
|
if (a) {
|
|
208
208
|
if ((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()), c(a), U(u, e), !T(u)) {
|
|
209
209
|
F(u, a, s);
|
|
210
210
|
const { open: h, close: S } = R(e, a, s);
|
|
211
|
-
(
|
|
211
|
+
(f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
|
|
212
212
|
}
|
|
213
213
|
G(u);
|
|
214
214
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { migrateCheckbox as i } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { migrateRecommendation as p } from "./recommendationMigrator.js";
|
|
3
|
+
import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
|
|
4
|
+
import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
|
|
5
|
+
import { migrateRadioButton as c } from "./radioButtonMigrator.js";
|
|
6
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
8
7
|
import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
|
|
9
|
-
import { migrateRecommendationTitle as
|
|
10
|
-
import { migrateSocialIcons as
|
|
11
|
-
import { migrateUnsubscribe as
|
|
12
|
-
const h = async (
|
|
13
|
-
let m =
|
|
14
|
-
return m = i(m), m =
|
|
8
|
+
import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
|
|
9
|
+
import { migrateSocialIcons as d } from "./socialIconMigrator.js";
|
|
10
|
+
import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
|
|
11
|
+
const h = async (r, t = {}, o) => {
|
|
12
|
+
let m = r;
|
|
13
|
+
return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
17
16
|
h as migrate
|
|
@@ -1,101 +1,108 @@
|
|
|
1
|
-
import { DEFAULT_COMPOSITION as
|
|
2
|
-
import { ATTR_RECOMMENDATION_TITLE as
|
|
3
|
-
import { mapTextTheme as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
switch (
|
|
1
|
+
import { DEFAULT_COMPOSITION as k, DEFAULT_VISIBILITY as f } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
2
|
+
import { ATTR_RECOMMENDATION_TITLE as R, ATTR_CUSTOM_PREFIX as x, ATTR_PRODUCT_BUTTON as E, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as O, ATTR_PRODUCT_OLD_PRICE as a, ATTR_PRODUCT_PRICE as d, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_IMAGE as b } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
|
+
import { mapTextTheme as C, mapButtonTheme as N, mapImageTheme as P } from "./themeMapper.js";
|
|
4
|
+
const U = "__title__", _ = "product_attribute.";
|
|
5
|
+
function D(n) {
|
|
6
|
+
const s = n.variable ?? "";
|
|
7
|
+
switch (s) {
|
|
8
8
|
case "p_recommendation_title":
|
|
9
|
-
return { key:
|
|
9
|
+
return { key: U, kind: "title" };
|
|
10
10
|
case "p_image":
|
|
11
|
-
return { key:
|
|
11
|
+
return { key: b, kind: "image" };
|
|
12
12
|
case "p_name":
|
|
13
|
-
return { key:
|
|
13
|
+
return { key: y, kind: "text" };
|
|
14
14
|
case "p_price":
|
|
15
|
-
return { key:
|
|
15
|
+
return { key: d, kind: "text" };
|
|
16
16
|
case "p_original_price":
|
|
17
|
-
return { key:
|
|
17
|
+
return { key: a, kind: "text" };
|
|
18
18
|
case "p_omnibus_price":
|
|
19
|
-
return { key:
|
|
19
|
+
return { key: O, kind: "text" };
|
|
20
20
|
case "p_omnibus_discount":
|
|
21
|
-
return { key:
|
|
21
|
+
return { key: h, kind: "text" };
|
|
22
22
|
case "p_button":
|
|
23
|
-
return { key:
|
|
23
|
+
return { key: E, kind: "button" };
|
|
24
24
|
default:
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
25
|
+
if (n.variableType === "p_attribute" || s.startsWith("p_attribute_")) {
|
|
26
|
+
const t = n.value ?? "", o = t.startsWith(_) ? t.slice(_.length) : t;
|
|
27
|
+
if (!o)
|
|
28
28
|
return null;
|
|
29
|
-
const
|
|
29
|
+
const u = t || `${_}${o}`;
|
|
30
30
|
return {
|
|
31
|
-
key: `${
|
|
31
|
+
key: `${x}${u}`,
|
|
32
32
|
kind: "custom",
|
|
33
|
-
customAttrName:
|
|
34
|
-
customAttrValue:
|
|
33
|
+
customAttrName: o,
|
|
34
|
+
customAttrValue: u
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
return
|
|
40
|
+
function I(n) {
|
|
41
|
+
const s = k.indexOf(n);
|
|
42
|
+
return s === -1 ? Number.POSITIVE_INFINITY : s;
|
|
43
|
+
}
|
|
44
|
+
const l = [d, a];
|
|
45
|
+
function S(n, s, t) {
|
|
46
|
+
return n === s || !l.includes(n) || !l.includes(s) ? 0 : n === (t ? a : d) ? -1 : 1;
|
|
43
47
|
}
|
|
44
|
-
function
|
|
48
|
+
function F(n, { oldPriceFirst: s = !1 } = {}) {
|
|
45
49
|
const t = {
|
|
46
50
|
composition: [],
|
|
47
|
-
visibility: { ...
|
|
51
|
+
visibility: { ...f },
|
|
48
52
|
customAttributes: [],
|
|
49
53
|
customAttrValues: {},
|
|
50
54
|
perElementStyles: {},
|
|
51
55
|
anyTextTrimming: !1
|
|
52
56
|
};
|
|
53
|
-
if (!
|
|
54
|
-
return t.composition = [...
|
|
57
|
+
if (!n || n.length === 0)
|
|
58
|
+
return t.composition = [...k], t;
|
|
55
59
|
const o = [];
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
t.titleVariable = e, t.visibility[
|
|
60
|
+
n.forEach((e, i) => {
|
|
61
|
+
const r = D(e);
|
|
62
|
+
if (r) {
|
|
63
|
+
if (r.kind === "title") {
|
|
64
|
+
t.titleVariable = e, t.visibility[R] = e.hidden !== !0;
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
67
|
o.push({
|
|
64
|
-
key:
|
|
65
|
-
kind:
|
|
68
|
+
key: r.key,
|
|
69
|
+
kind: r.kind,
|
|
66
70
|
hidden: e.hidden === !0,
|
|
67
71
|
positionIdx: typeof e.positionIdx == "number" ? e.positionIdx : Number.MAX_SAFE_INTEGER,
|
|
68
72
|
legacy: e,
|
|
69
|
-
customAttrName:
|
|
70
|
-
customAttrValue:
|
|
73
|
+
customAttrName: r.customAttrName,
|
|
74
|
+
customAttrValue: r.customAttrValue,
|
|
71
75
|
originalIndex: i
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
}), o.sort((e, i) => {
|
|
75
79
|
if (e.positionIdx !== i.positionIdx)
|
|
76
80
|
return e.positionIdx - i.positionIdx;
|
|
77
|
-
const
|
|
78
|
-
|
|
81
|
+
const r = S(e.key, i.key, s);
|
|
82
|
+
if (r !== 0)
|
|
83
|
+
return r;
|
|
84
|
+
const m = I(e.key), c = I(i.key);
|
|
85
|
+
return m !== c ? m - c : e.originalIndex - i.originalIndex;
|
|
79
86
|
});
|
|
80
|
-
const
|
|
87
|
+
const u = {};
|
|
81
88
|
return o.forEach((e) => {
|
|
82
|
-
const { key: i, kind:
|
|
83
|
-
switch (t.composition.push(i), t.visibility[i] = !
|
|
89
|
+
const { key: i, kind: r, hidden: m, legacy: c, customAttrName: A, customAttrValue: T } = e;
|
|
90
|
+
switch (t.composition.push(i), t.visibility[i] = !m, r === "custom" && A && T && (t.customAttributes.includes(T) || t.customAttributes.push(T), t.customAttrValues[i] = T), r) {
|
|
84
91
|
case "image":
|
|
85
|
-
|
|
92
|
+
u[i] = P(c.theme);
|
|
86
93
|
break;
|
|
87
94
|
case "button":
|
|
88
|
-
|
|
95
|
+
u[i] = N(c.theme);
|
|
89
96
|
break;
|
|
90
97
|
case "text":
|
|
91
98
|
case "custom": {
|
|
92
|
-
const
|
|
93
|
-
|
|
99
|
+
const p = C(c.theme);
|
|
100
|
+
u[i] = p, p.textTrimming && (t.anyTextTrimming = !0);
|
|
94
101
|
break;
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
|
-
}), t.perElementStyles =
|
|
104
|
+
}), t.perElementStyles = u, t;
|
|
98
105
|
}
|
|
99
106
|
export {
|
|
100
|
-
|
|
107
|
+
F as mapComposition
|
|
101
108
|
};
|
|
@@ -1,54 +1,93 @@
|
|
|
1
|
-
import { CURRENCY_ATTR as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
var
|
|
1
|
+
import { CURRENCY_ATTR as c, CSS_CLASS_SKIP_COMPILE as a } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
+
const m = "You May Also Like!";
|
|
3
|
+
function S(t) {
|
|
4
|
+
var o;
|
|
5
5
|
const e = t.querySelector(".ext-recommendation-title");
|
|
6
6
|
if (!e)
|
|
7
|
-
return
|
|
8
|
-
const r = (
|
|
9
|
-
return r && r.length > 0 ? r :
|
|
7
|
+
return m;
|
|
8
|
+
const r = (o = e.textContent) == null ? void 0 : o.trim();
|
|
9
|
+
return r && r.length > 0 ? r : m;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function T(t) {
|
|
12
12
|
const e = t.querySelector(".ext-recommendation-title");
|
|
13
13
|
return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function f(t) {
|
|
16
|
+
var r;
|
|
17
|
+
const e = t.querySelector(".ext-recommendation-title");
|
|
18
|
+
return !!e && !((r = e == null ? void 0 : e.textContent) != null && r.trim());
|
|
19
|
+
}
|
|
20
|
+
function g(t) {
|
|
21
|
+
const e = t.querySelector(".ext-product-price"), r = t.querySelector(".ext-product-original-price");
|
|
22
|
+
return !e || !r ? !1 : e.compareDocumentPosition(r) === Node.DOCUMENT_POSITION_PRECEDING;
|
|
23
|
+
}
|
|
24
|
+
const d = /* @__PURE__ */ new Map([
|
|
25
|
+
["p_name", ".ext-product-name p"],
|
|
26
|
+
["p_price", ".ext-product-price p"],
|
|
27
|
+
["p_original_price", ".ext-product-original-price p"]
|
|
28
|
+
]);
|
|
29
|
+
function p(t) {
|
|
30
|
+
const e = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
|
|
31
|
+
return (e == null ? void 0 : e[1].trim()) || void 0;
|
|
32
|
+
}
|
|
33
|
+
const A = "ins-trim-text";
|
|
34
|
+
function x(t, e) {
|
|
35
|
+
return t == null ? void 0 : t.map((r) => {
|
|
36
|
+
var s, l;
|
|
37
|
+
const o = d.get(r.variable ?? "");
|
|
38
|
+
if (!o)
|
|
39
|
+
return r;
|
|
40
|
+
const n = e.querySelector(o), u = (l = (s = r.theme) == null ? void 0 : s.textColor) != null && l.color ? void 0 : p(n), i = r.variable === "p_name" && (n == null ? void 0 : n.classList.contains(A));
|
|
41
|
+
return !u && !i ? r : {
|
|
42
|
+
...r,
|
|
43
|
+
theme: {
|
|
44
|
+
...r.theme,
|
|
45
|
+
...u ? { textColor: { color: u } } : {},
|
|
46
|
+
...i ? { textTrimming: !0 } : {}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function E(t) {
|
|
16
52
|
const e = [
|
|
17
53
|
t,
|
|
18
54
|
...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
19
55
|
];
|
|
20
56
|
let r = "";
|
|
21
|
-
return e.some((
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return r =
|
|
25
|
-
const
|
|
26
|
-
return
|
|
57
|
+
return e.some((o) => {
|
|
58
|
+
const n = o.getAttribute("bgcolor");
|
|
59
|
+
if (n && n.trim())
|
|
60
|
+
return r = n.trim(), !0;
|
|
61
|
+
const i = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
|
|
62
|
+
return i && i[1] ? (r = i[1].trim(), !0) : !1;
|
|
27
63
|
}), r;
|
|
28
64
|
}
|
|
29
|
-
function
|
|
30
|
-
const e = t.getAttribute(
|
|
65
|
+
function _(t) {
|
|
66
|
+
const e = t.getAttribute(c.CURRENCY);
|
|
31
67
|
if (!e)
|
|
32
68
|
return;
|
|
33
|
-
const r = t.getAttribute(
|
|
69
|
+
const r = t.getAttribute(c.SYMBOL);
|
|
34
70
|
return {
|
|
35
71
|
value: e,
|
|
36
72
|
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
37
73
|
// the currency code as the symbol.
|
|
38
74
|
...r ? { symbol: r } : {},
|
|
39
|
-
alignment: t.getAttribute(
|
|
40
|
-
decimalCount: t.getAttribute(
|
|
41
|
-
decimalSeparator: t.getAttribute(
|
|
42
|
-
thousandSeparator: t.getAttribute(
|
|
75
|
+
alignment: t.getAttribute(c.ALIGNMENT) ?? "",
|
|
76
|
+
decimalCount: t.getAttribute(c.DECIMAL_COUNT) ?? "",
|
|
77
|
+
decimalSeparator: t.getAttribute(c.DECIMAL_SEPARATOR) ?? "",
|
|
78
|
+
thousandSeparator: t.getAttribute(c.THOUSAND_SEPARATOR) ?? ""
|
|
43
79
|
};
|
|
44
80
|
}
|
|
45
|
-
function
|
|
46
|
-
return t.classList.contains(
|
|
81
|
+
function y(t) {
|
|
82
|
+
return t.classList.contains(a);
|
|
47
83
|
}
|
|
48
84
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
85
|
+
E as extractCardBgColor,
|
|
86
|
+
_ as extractCurrencyFromBlock,
|
|
87
|
+
S as extractTitleText,
|
|
88
|
+
f as hasEmptyTitle,
|
|
89
|
+
T as hasVisibleTitle,
|
|
90
|
+
g as isOldPriceFirst,
|
|
91
|
+
y as isPartnerManagedBlock,
|
|
92
|
+
x as withRenderedTextTheme
|
|
54
93
|
};
|