@useinsider/guido 3.8.2-beta.189e91c → 3.8.2
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/@types/config/schemas.js +66 -70
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
- package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +41 -60
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +264 -345
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
- package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/stores/config.d.ts +0 -36
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -111
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,206 +1,204 @@
|
|
|
1
1
|
import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as F, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as
|
|
3
|
+
import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as F, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as G, MOBILE_ROW_SELECTOR as N, ATTR_PRODUCT_ATTR as K, PRODUCT_ATTRIBUTE_PREFIX as R } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as S } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { captureStyles as
|
|
6
|
+
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
7
|
+
import { captureStyles as k } from "../../utils/captureStyleTemplates.js";
|
|
8
8
|
import { formatPrice as V } from "../../utils/priceFormatter.js";
|
|
9
|
-
import { getDefaultProducts as
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as T, sanitizeImageUrl as W, toDisplayableAttributeValue as Y } from "../../templates/utils.js";
|
|
10
10
|
const M = "recommendation-block-v2";
|
|
11
|
-
function A(
|
|
12
|
-
if (!
|
|
11
|
+
function A(e) {
|
|
12
|
+
if (!e)
|
|
13
13
|
return null;
|
|
14
|
-
if ("getAttribute" in
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
14
|
+
if ("getAttribute" in e) {
|
|
15
|
+
const t = e.getAttribute("class");
|
|
16
|
+
if (t && t.includes(M))
|
|
17
|
+
return e;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in
|
|
19
|
+
return "querySelector" in e ? e.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return !
|
|
21
|
+
function X(e) {
|
|
22
|
+
const t = A(e);
|
|
23
|
+
return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(F);
|
|
24
24
|
}
|
|
25
|
-
function C(
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
25
|
+
function C(e) {
|
|
26
|
+
const t = A(e);
|
|
27
|
+
if (!t || !("getAttribute" in t))
|
|
28
28
|
return "grid";
|
|
29
|
-
const n =
|
|
29
|
+
const n = t.getAttribute("data-layout");
|
|
30
30
|
return n === "list" || n === "horizontal" ? "list" : "grid";
|
|
31
31
|
}
|
|
32
|
-
function x(
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
return
|
|
36
|
-
const n =
|
|
37
|
-
return n ? n.split(",").filter(Boolean) :
|
|
32
|
+
function x(e) {
|
|
33
|
+
const t = A(e);
|
|
34
|
+
if (!t || !("getAttribute" in t))
|
|
35
|
+
return T;
|
|
36
|
+
const n = t.getAttribute("data-card-composition");
|
|
37
|
+
return n ? n.split(",").filter(Boolean) : T;
|
|
38
38
|
}
|
|
39
|
-
function D(
|
|
40
|
-
if (!
|
|
39
|
+
function D(e) {
|
|
40
|
+
if (!e || !("childNodes" in e))
|
|
41
41
|
return null;
|
|
42
|
-
const
|
|
42
|
+
const t = e.childNodes(), n = t.find(
|
|
43
43
|
(o) => "getType" in o && o.getType() === "text"
|
|
44
44
|
);
|
|
45
|
-
return n ||
|
|
45
|
+
return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : D(r), null);
|
|
46
46
|
}
|
|
47
|
-
function b(
|
|
48
|
-
const o = D(
|
|
49
|
-
return o ? (
|
|
47
|
+
function b(e, t, n) {
|
|
48
|
+
const o = D(t);
|
|
49
|
+
return o ? (e.modifyHtml(o).setText(n), !0) : !1;
|
|
50
50
|
}
|
|
51
|
-
function H(
|
|
52
|
-
return
|
|
51
|
+
function H(e, t) {
|
|
52
|
+
return e && e.length > 0 ? e : t.length > 0 ? t : L();
|
|
53
53
|
}
|
|
54
|
-
function U(
|
|
55
|
-
if (typeof
|
|
56
|
-
return `0 ${
|
|
54
|
+
function U(e) {
|
|
55
|
+
if (typeof e == "number")
|
|
56
|
+
return `0 ${e / 2}px`;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const { currentNode:
|
|
60
|
-
if (!
|
|
58
|
+
function z(e) {
|
|
59
|
+
const { currentNode: t, documentModifier: n } = e;
|
|
60
|
+
if (!t || !("querySelector" in t))
|
|
61
61
|
return !1;
|
|
62
|
-
const o =
|
|
62
|
+
const o = t.querySelector(N);
|
|
63
63
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return "getOuterHTML" in
|
|
65
|
+
function J(e) {
|
|
66
|
+
return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
return !
|
|
68
|
+
function Q(e) {
|
|
69
|
+
const t = e.querySelector(".container");
|
|
70
|
+
return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const o =
|
|
72
|
+
function Z(e, t, n) {
|
|
73
|
+
const o = Q(e);
|
|
74
74
|
if (!o || !("childNodes" in o))
|
|
75
75
|
return;
|
|
76
|
-
const r = o.childNodes().map(
|
|
77
|
-
|
|
76
|
+
const r = o.childNodes().map(J).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
|
|
77
|
+
t.modifyHtml(o).setInnerHtml(r + s), t.apply(new g("Added mobile product row"));
|
|
78
78
|
}
|
|
79
|
-
function $(
|
|
79
|
+
function $(e, t = {}) {
|
|
80
80
|
const {
|
|
81
81
|
currentNode: n,
|
|
82
82
|
documentModifier: o,
|
|
83
83
|
products: r,
|
|
84
84
|
layout: s,
|
|
85
85
|
composition: i
|
|
86
|
-
} =
|
|
86
|
+
} = e;
|
|
87
87
|
if (!n || !("querySelector" in n))
|
|
88
88
|
return !1;
|
|
89
89
|
const u = s ?? C(n), c = S.getConfig(n);
|
|
90
90
|
if (u === "list" || !c.mobileLayoutEnabled)
|
|
91
|
-
return
|
|
92
|
-
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${
|
|
91
|
+
return z({ currentNode: n, documentModifier: o });
|
|
92
|
+
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(a, u, {
|
|
93
93
|
productsPerRow: c.mobileCardsInRow,
|
|
94
94
|
composition: d,
|
|
95
95
|
filterList: l.filterList,
|
|
96
|
-
|
|
97
|
-
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
96
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023).
|
|
98
97
|
cellPadding: U(c.mobileColumnSpacing),
|
|
99
98
|
rowSpacingPx: c.mobileRowSpacing,
|
|
100
|
-
...
|
|
101
|
-
})}</table></td>`, E = n.querySelector(
|
|
102
|
-
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (
|
|
99
|
+
...t
|
|
100
|
+
})}</table></td>`, E = n.querySelector(N);
|
|
101
|
+
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (Z(n, o, p), !1);
|
|
103
102
|
}
|
|
104
|
-
function
|
|
105
|
-
$(
|
|
103
|
+
function pe(e) {
|
|
104
|
+
$(e, k(e.currentNode)) && e.documentModifier.apply(new g("Updated mobile product rows"));
|
|
106
105
|
}
|
|
107
|
-
function
|
|
106
|
+
function ee(e, t = {}) {
|
|
108
107
|
const {
|
|
109
108
|
currentNode: n,
|
|
110
109
|
documentModifier: o,
|
|
111
110
|
products: r,
|
|
112
111
|
layout: s,
|
|
113
112
|
composition: i
|
|
114
|
-
} =
|
|
113
|
+
} = e;
|
|
115
114
|
if (!n || !("querySelector" in n))
|
|
116
115
|
return !1;
|
|
117
|
-
const u = n.querySelector(
|
|
116
|
+
const u = n.querySelector(w) ?? n.querySelector(G);
|
|
118
117
|
if (!u)
|
|
119
118
|
return !1;
|
|
120
|
-
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), p = S.getConfig(n), E =
|
|
119
|
+
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), p = S.getConfig(n), E = _(l, f, {
|
|
121
120
|
productsPerRow: a,
|
|
122
121
|
composition: d,
|
|
123
122
|
filterList: c.filterList,
|
|
124
|
-
|
|
125
|
-
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
123
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023).
|
|
126
124
|
cellPadding: U(p.columnSpacing),
|
|
127
125
|
rowSpacingPx: p.rowSpacing,
|
|
128
|
-
...
|
|
126
|
+
...t
|
|
129
127
|
});
|
|
130
128
|
return o.modifyHtml(u).setInnerHtml(E), !0;
|
|
131
129
|
}
|
|
132
|
-
function
|
|
130
|
+
function ye(e) {
|
|
133
131
|
const {
|
|
134
|
-
currentNode:
|
|
132
|
+
currentNode: t,
|
|
135
133
|
documentModifier: n,
|
|
136
134
|
afterRegenerate: o,
|
|
137
135
|
products: r,
|
|
138
136
|
layout: s,
|
|
139
137
|
composition: i,
|
|
140
138
|
skipStylePreservation: u
|
|
141
|
-
} =
|
|
142
|
-
if (!
|
|
139
|
+
} = e;
|
|
140
|
+
if (!t)
|
|
143
141
|
return;
|
|
144
|
-
const c = u ? {} :
|
|
145
|
-
currentNode:
|
|
142
|
+
const c = u ? {} : k(t), l = {
|
|
143
|
+
currentNode: t,
|
|
146
144
|
documentModifier: n,
|
|
147
145
|
products: r,
|
|
148
146
|
layout: s,
|
|
149
147
|
composition: i
|
|
150
148
|
};
|
|
151
|
-
let a =
|
|
149
|
+
let a = ee(l, c);
|
|
152
150
|
a = $(l, c) || a, a && n.apply(new g("Regenerate products with styles")), o == null || o();
|
|
153
151
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
152
|
+
function be(e, t) {
|
|
153
|
+
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...L(t - e.length)];
|
|
156
154
|
}
|
|
157
155
|
function B() {
|
|
158
|
-
const
|
|
156
|
+
const e = P(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
|
|
159
157
|
return {
|
|
160
|
-
code:
|
|
161
|
-
symbol:
|
|
162
|
-
alignment:
|
|
158
|
+
code: t.value,
|
|
159
|
+
symbol: t.symbol,
|
|
160
|
+
alignment: t.alignment === "0" ? "before" : "after",
|
|
163
161
|
decimalCount: Number.isNaN(n) ? 2 : n,
|
|
164
|
-
decimalSeparator:
|
|
165
|
-
thousandSeparator:
|
|
162
|
+
decimalSeparator: t.decimalSeparator,
|
|
163
|
+
thousandSeparator: t.thousandSeparator
|
|
166
164
|
};
|
|
167
165
|
}
|
|
168
|
-
function q(
|
|
169
|
-
const n = B(), o = t
|
|
166
|
+
function q(e, t = "price") {
|
|
167
|
+
const n = B(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
170
168
|
return V({
|
|
171
169
|
price: r,
|
|
172
170
|
currency: n
|
|
173
171
|
});
|
|
174
172
|
}
|
|
175
|
-
function
|
|
173
|
+
function te(e) {
|
|
176
174
|
var s, i;
|
|
177
|
-
const
|
|
175
|
+
const t = B(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((i = e.price) == null ? void 0 : i[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
178
176
|
return r > 0 ? `-${r}%` : "0%";
|
|
179
177
|
}
|
|
180
|
-
function v(
|
|
181
|
-
const { documentModifier:
|
|
178
|
+
function v(e) {
|
|
179
|
+
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = e;
|
|
182
180
|
let u = !1;
|
|
183
181
|
if (o && "querySelector" in o) {
|
|
184
182
|
const c = o.querySelector("strong") ?? o.querySelector("p"), l = q(n, "price");
|
|
185
|
-
b(
|
|
183
|
+
b(t, c ?? null, l) && (u = !0);
|
|
186
184
|
}
|
|
187
185
|
if (r && "querySelector" in r) {
|
|
188
186
|
const c = r.querySelector("strong") ?? r.querySelector("p"), l = q(n, "original_price");
|
|
189
|
-
b(
|
|
187
|
+
b(t, c ?? null, l) && (u = !0);
|
|
190
188
|
}
|
|
191
189
|
if (s && "querySelector" in s) {
|
|
192
190
|
const c = s.querySelector(".omnibus-price-value") ?? null, l = q(n, "original_price");
|
|
193
|
-
b(
|
|
191
|
+
b(t, c, l) && (u = !0);
|
|
194
192
|
}
|
|
195
193
|
if (i && "querySelector" in i) {
|
|
196
|
-
const c = i.querySelector(".omnibus-discount-value") ?? null, l =
|
|
197
|
-
b(
|
|
194
|
+
const c = i.querySelector(".omnibus-discount-value") ?? null, l = te(n);
|
|
195
|
+
b(t, c, l) && (u = !0);
|
|
198
196
|
}
|
|
199
197
|
return u;
|
|
200
198
|
}
|
|
201
|
-
function
|
|
199
|
+
function ne(e) {
|
|
202
200
|
const {
|
|
203
|
-
documentModifier:
|
|
201
|
+
documentModifier: t,
|
|
204
202
|
product: n,
|
|
205
203
|
imageEl: o,
|
|
206
204
|
nameEl: r,
|
|
@@ -209,20 +207,20 @@ function oe(t) {
|
|
|
209
207
|
omnibusPriceEl: u,
|
|
210
208
|
omnibusDiscountEl: c,
|
|
211
209
|
buttonEl: l
|
|
212
|
-
} =
|
|
210
|
+
} = e;
|
|
213
211
|
let a = !1;
|
|
214
212
|
if (o && "querySelector" in o) {
|
|
215
213
|
const d = o.querySelector("img");
|
|
216
|
-
d && (
|
|
214
|
+
d && (t.modifyHtml(d).setAttribute("src", W(n.image_url)).setAttribute("alt", n.name), a = !0);
|
|
217
215
|
const f = o.querySelector("a");
|
|
218
|
-
f && (
|
|
216
|
+
f && (t.modifyHtml(f).setAttribute("href", n.url), a = !0);
|
|
219
217
|
}
|
|
220
218
|
if (r && "querySelector" in r) {
|
|
221
219
|
const d = r.querySelector("strong") ?? r.querySelector("p");
|
|
222
|
-
b(
|
|
220
|
+
b(t, d ?? null, n.name) && (a = !0);
|
|
223
221
|
}
|
|
224
222
|
if (v({
|
|
225
|
-
documentModifier:
|
|
223
|
+
documentModifier: t,
|
|
226
224
|
product: n,
|
|
227
225
|
priceEl: s,
|
|
228
226
|
oldPriceEl: i,
|
|
@@ -230,27 +228,27 @@ function oe(t) {
|
|
|
230
228
|
omnibusDiscountEl: c
|
|
231
229
|
}) && (a = !0), l && "querySelector" in l) {
|
|
232
230
|
const d = l.querySelector("a.es-button") || l.querySelector("a");
|
|
233
|
-
d && (
|
|
231
|
+
d && (t.modifyHtml(d).setAttribute("href", n.url), a = !0);
|
|
234
232
|
}
|
|
235
233
|
return a;
|
|
236
234
|
}
|
|
237
|
-
function j(
|
|
238
|
-
return "querySelector" in
|
|
235
|
+
function j(e) {
|
|
236
|
+
return "querySelector" in e ? e.querySelector(w) ?? e : e;
|
|
239
237
|
}
|
|
240
|
-
function
|
|
238
|
+
function oe(e, t) {
|
|
241
239
|
var o;
|
|
242
240
|
let n;
|
|
243
|
-
if (
|
|
244
|
-
const r =
|
|
245
|
-
n = (o =
|
|
241
|
+
if (e.startsWith(R)) {
|
|
242
|
+
const r = e.slice(R.length);
|
|
243
|
+
n = (o = t.product_attributes) == null ? void 0 : o[r];
|
|
246
244
|
} else
|
|
247
|
-
n = e
|
|
248
|
-
return
|
|
245
|
+
n = t[e];
|
|
246
|
+
return Y(n) || null;
|
|
249
247
|
}
|
|
250
|
-
function
|
|
251
|
-
if (!("querySelectorAll" in
|
|
248
|
+
function re(e, t, n) {
|
|
249
|
+
if (!("querySelectorAll" in e))
|
|
252
250
|
return !1;
|
|
253
|
-
const o =
|
|
251
|
+
const o = e.querySelectorAll(
|
|
254
252
|
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
255
253
|
);
|
|
256
254
|
if (o.length === 0)
|
|
@@ -271,36 +269,36 @@ function ie(t, e, n) {
|
|
|
271
269
|
i.slice(0, c).forEach((l, a) => {
|
|
272
270
|
if (!("querySelector" in l))
|
|
273
271
|
return;
|
|
274
|
-
const d =
|
|
272
|
+
const d = oe(u, n[a]);
|
|
275
273
|
if (d === null)
|
|
276
274
|
return;
|
|
277
275
|
const f = l.querySelector("p") ?? null;
|
|
278
|
-
b(
|
|
276
|
+
b(t, f, d) && (s = !0);
|
|
279
277
|
});
|
|
280
278
|
}), s;
|
|
281
279
|
}
|
|
282
|
-
function
|
|
283
|
-
if (!("querySelectorAll" in
|
|
280
|
+
function h(e, t, n) {
|
|
281
|
+
if (!("querySelectorAll" in e))
|
|
284
282
|
return !1;
|
|
285
|
-
const o =
|
|
283
|
+
const o = e.querySelectorAll(
|
|
286
284
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
287
|
-
), r =
|
|
285
|
+
), r = e.querySelectorAll(
|
|
288
286
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
289
|
-
), s =
|
|
287
|
+
), s = e.querySelectorAll(
|
|
290
288
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
291
|
-
), i =
|
|
289
|
+
), i = e.querySelectorAll(
|
|
292
290
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
293
|
-
), u =
|
|
291
|
+
), u = e.querySelectorAll(
|
|
294
292
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
295
|
-
), c =
|
|
293
|
+
), c = e.querySelectorAll(
|
|
296
294
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
297
|
-
), l =
|
|
295
|
+
), l = e.querySelectorAll(
|
|
298
296
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
299
297
|
), a = Math.min(o.length, n.length);
|
|
300
298
|
let d = !1;
|
|
301
299
|
for (let f = 0; f < a; f++) {
|
|
302
|
-
const p =
|
|
303
|
-
documentModifier:
|
|
300
|
+
const p = ne({
|
|
301
|
+
documentModifier: t,
|
|
304
302
|
product: n[f],
|
|
305
303
|
imageEl: o[f] ?? null,
|
|
306
304
|
nameEl: r[f] ?? null,
|
|
@@ -312,23 +310,23 @@ function I(t, e, n) {
|
|
|
312
310
|
});
|
|
313
311
|
d = d || p;
|
|
314
312
|
}
|
|
315
|
-
return
|
|
313
|
+
return re(e, t, n) && (d = !0), d;
|
|
316
314
|
}
|
|
317
|
-
function
|
|
318
|
-
const { currentNode:
|
|
319
|
-
if (!
|
|
315
|
+
function ge(e) {
|
|
316
|
+
const { currentNode: t, documentModifier: n, products: o } = e;
|
|
317
|
+
if (!t || !("querySelectorAll" in t))
|
|
320
318
|
return !1;
|
|
321
|
-
const r = j(
|
|
319
|
+
const r = j(t);
|
|
322
320
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
323
321
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
324
322
|
).length !== o.length)
|
|
325
323
|
return !1;
|
|
326
|
-
let i =
|
|
327
|
-
const u = C(
|
|
328
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
329
|
-
const l =
|
|
324
|
+
let i = h(r, n, o);
|
|
325
|
+
const u = C(t), c = S.getConfig(t);
|
|
326
|
+
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
327
|
+
const l = t.querySelector(O);
|
|
330
328
|
if (l) {
|
|
331
|
-
const a =
|
|
329
|
+
const a = h(
|
|
332
330
|
l,
|
|
333
331
|
n,
|
|
334
332
|
o
|
|
@@ -338,22 +336,22 @@ function Se(t) {
|
|
|
338
336
|
}
|
|
339
337
|
return i && n.apply(new g("Updated product content in-place")), !0;
|
|
340
338
|
}
|
|
341
|
-
function
|
|
342
|
-
if (!("querySelectorAll" in
|
|
339
|
+
function I(e, t, n) {
|
|
340
|
+
if (!("querySelectorAll" in e))
|
|
343
341
|
return !1;
|
|
344
|
-
const o =
|
|
342
|
+
const o = e.querySelectorAll(
|
|
345
343
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
346
|
-
), r =
|
|
344
|
+
), r = e.querySelectorAll(
|
|
347
345
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
348
|
-
), s =
|
|
346
|
+
), s = e.querySelectorAll(
|
|
349
347
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
350
|
-
), i =
|
|
348
|
+
), i = e.querySelectorAll(
|
|
351
349
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
352
350
|
), u = Math.min(o.length, n.length);
|
|
353
351
|
let c = !1;
|
|
354
352
|
for (let l = 0; l < u; l++)
|
|
355
353
|
v({
|
|
356
|
-
documentModifier:
|
|
354
|
+
documentModifier: t,
|
|
357
355
|
product: n[l],
|
|
358
356
|
priceEl: o[l] ?? null,
|
|
359
357
|
oldPriceEl: r[l] ?? null,
|
|
@@ -362,29 +360,29 @@ function h(t, e, n) {
|
|
|
362
360
|
}) && (c = !0);
|
|
363
361
|
return c;
|
|
364
362
|
}
|
|
365
|
-
function
|
|
366
|
-
const { currentNode:
|
|
367
|
-
if (!
|
|
363
|
+
function Se(e) {
|
|
364
|
+
const { currentNode: t, documentModifier: n } = e;
|
|
365
|
+
if (!t || !("querySelectorAll" in t))
|
|
368
366
|
return !1;
|
|
369
|
-
if (
|
|
367
|
+
if (X(t))
|
|
370
368
|
return !0;
|
|
371
369
|
const r = P().recommendationProducts;
|
|
372
370
|
if (r.length === 0)
|
|
373
371
|
return !1;
|
|
374
|
-
const s = j(
|
|
375
|
-
let i =
|
|
376
|
-
const u = C(
|
|
377
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
378
|
-
const l =
|
|
372
|
+
const s = j(t);
|
|
373
|
+
let i = I(s, n, r);
|
|
374
|
+
const u = C(t), c = S.getConfig(t);
|
|
375
|
+
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
376
|
+
const l = t.querySelector(O);
|
|
379
377
|
if (l) {
|
|
380
|
-
const a =
|
|
378
|
+
const a = I(l, n, r);
|
|
381
379
|
i = i || a;
|
|
382
380
|
}
|
|
383
381
|
}
|
|
384
382
|
return i && n.apply(new g("Updated price formatting in-place")), i;
|
|
385
383
|
}
|
|
386
|
-
function
|
|
387
|
-
const { currentNode:
|
|
384
|
+
function Ee(e) {
|
|
385
|
+
const { currentNode: t, documentModifier: n, currency: o } = e, r = A(t);
|
|
388
386
|
if (!r)
|
|
389
387
|
return;
|
|
390
388
|
const s = o.alignment === "before" ? "0" : "1", i = (u, c) => {
|
|
@@ -393,16 +391,16 @@ function Pe(t) {
|
|
|
393
391
|
i(y.CURRENCY, o.code), i(y.SYMBOL, o.symbol), i(y.ALIGNMENT, s), i(y.THOUSAND_SEPARATOR, o.thousandSeparator), i(y.DECIMAL_SEPARATOR, o.decimalSeparator), i(y.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new g("Update currency attributes"));
|
|
394
392
|
}
|
|
395
393
|
export {
|
|
396
|
-
|
|
394
|
+
be as adjustProductsToSize,
|
|
397
395
|
q as formatProductPrice,
|
|
398
396
|
A as getBlockElement,
|
|
399
397
|
x as getCardComposition,
|
|
400
398
|
C as getCurrentLayout,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
399
|
+
X as isPartnerManagedBlock,
|
|
400
|
+
pe as regenerateMobileProductRows,
|
|
401
|
+
ye as regenerateProductRowsWithStyles,
|
|
402
|
+
Ee as setCurrencyAttributes,
|
|
403
|
+
Se as updatePricesInPlace,
|
|
404
|
+
ge as updateProductContentInPlace,
|
|
405
|
+
ne as updateSingleProductContent
|
|
408
406
|
};
|
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
|
-
import n from "./
|
|
4
|
-
import { RecommendationBlockControl as i } from "./controls/main/index.js";
|
|
3
|
+
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
5
4
|
import "./constants/selectors.js";
|
|
6
5
|
import "./store/recommendation.js";
|
|
7
6
|
import "./utils/captureStyleTemplates.js";
|
|
8
|
-
import { NameControls as
|
|
9
|
-
import { PriceControls as
|
|
10
|
-
import { OldPriceControls as
|
|
11
|
-
import { OmnibusPriceControls as
|
|
12
|
-
import { OmnibusDiscountControls as
|
|
13
|
-
import { ButtonControls as
|
|
14
|
-
import { ImageControls as
|
|
7
|
+
import { NameControls as i } from "./controls/name/index.js";
|
|
8
|
+
import { PriceControls as e } from "./controls/price/index.js";
|
|
9
|
+
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
10
|
+
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
11
|
+
import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
|
|
12
|
+
import { ButtonControls as a } from "./controls/button/index.js";
|
|
13
|
+
import { ImageControls as c } from "./controls/image/index.js";
|
|
15
14
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
16
|
-
import { SpacingControl as
|
|
17
|
-
import { CardBackgroundColorControl as
|
|
18
|
-
import { RecommendationCardCompositionControl as
|
|
19
|
-
import { SyncInfoMessageControl as
|
|
20
|
-
import { RecommendationIconsRegistry as
|
|
21
|
-
import
|
|
22
|
-
import { SettingsPanel as
|
|
23
|
-
const
|
|
15
|
+
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
16
|
+
import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
|
|
17
|
+
import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
|
|
18
|
+
import { SyncInfoMessageControl as g } from "./controls/syncInfoMessage.js";
|
|
19
|
+
import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
|
|
20
|
+
import y from "./recommendation.css.js";
|
|
21
|
+
import { SettingsPanel as B } from "./settingsPanel.js";
|
|
22
|
+
const b = [
|
|
23
|
+
i,
|
|
24
24
|
e,
|
|
25
25
|
s,
|
|
26
26
|
l,
|
|
27
27
|
p,
|
|
28
28
|
a,
|
|
29
29
|
c,
|
|
30
|
-
f,
|
|
31
30
|
C
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
u,
|
|
31
|
+
], P = [
|
|
32
|
+
n,
|
|
35
33
|
d,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...
|
|
41
|
-
|
|
34
|
+
f,
|
|
35
|
+
u,
|
|
36
|
+
g
|
|
37
|
+
], S = [
|
|
38
|
+
...P,
|
|
39
|
+
...b.flatMap((o) => Object.values(o))
|
|
40
|
+
], Q = S.reduce(
|
|
42
41
|
(o, t) => o.addControl(t),
|
|
43
|
-
new r().addBlock(m).withSettingsPanelRegistry(
|
|
44
|
-
).addStyles(
|
|
42
|
+
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
43
|
+
).addStyles(y).withIconsRegistry(R).build();
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
Q as default
|
|
47
46
|
};
|