@useinsider/guido 3.20.0 → 3.20.1-beta.04cd240
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/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +11 -10
- package/dist/composables/useVersionHistoryApi.js +42 -37
- package/dist/config/compiler/itemsCompilerRules.js +21 -5
- package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
- package/dist/config/migrator/itemsBlockMigrator.js +112 -108
- package/dist/extensions/Blocks/Items/block.js +76 -64
- package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +60 -49
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +163 -149
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +102 -78
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +313 -210
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +17 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +92 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +219 -193
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +12 -9
- package/dist/extensions/Blocks/Recommendation/extension.js +4 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +240 -190
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
- package/dist/extensions/Blocks/Recommendation/utils/followUpApply.js +34 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +73 -28
- package/dist/extensions/Blocks/Recommendation/utils/restoreRefresh.js +36 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
- package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +22 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +1 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +10 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +28 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/followUpApply.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +15 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/restoreRefresh.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/src/utils/liquidProtection.d.ts +3 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/dist/utils/liquidProtection.js +5 -0
- package/dist/utils/templatePreparation.js +61 -85
- package/package.json +3 -3
|
@@ -1,140 +1,144 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
1
|
+
import { ModificationDescription as V } 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
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { prepareProductRows as
|
|
3
|
+
import { CURRENCY_ATTR as p, CSS_CLASS_SKIP_COMPILE as W, MOBILE_CONTAINER_SELECTOR as L, ATTR_DATA_CARD_COMPOSITION as h, DESKTOP_CONTAINER_SELECTOR as k, CONTAINER_SELECTOR as z, MOBILE_ROW_SELECTOR as w, ATTR_DATA_CUSTOM_ATTRIBUTES as q, ATTR_PRODUCT_ATTR as J, PRODUCT_ATTRIBUTE_PREFIX as M } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as b } from "../../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
6
|
+
import { prepareProductRows as D } from "../../templates/index.js";
|
|
7
7
|
import { captureStyles as x } from "../../utils/captureStyleTemplates.js";
|
|
8
|
-
import { normalizeCompositionKeys as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { normalizeCompositionKeys as U, normalizeCustomAttrValues as X } from "../../utils/compositionKeys.js";
|
|
9
|
+
import { applyFollowUp as T } from "../../utils/followUpApply.js";
|
|
10
|
+
import { formatPrice as Q } from "../../utils/priceFormatter.js";
|
|
11
|
+
import { getDefaultProducts as H, DEFAULT_CARD_COMPOSITION as I, sanitizeImageUrl as Z, isSamePrice as tt, toDisplayableAttributeValue as et } from "../../templates/utils.js";
|
|
12
|
+
const O = "recommendation-block-v2";
|
|
13
|
+
function A(e) {
|
|
13
14
|
if (!e)
|
|
14
15
|
return null;
|
|
15
16
|
if ("getAttribute" in e) {
|
|
16
17
|
const t = e.getAttribute("class");
|
|
17
|
-
if (t && t.includes(
|
|
18
|
+
if (t && t.includes(O))
|
|
18
19
|
return e;
|
|
19
20
|
}
|
|
20
|
-
return "querySelector" in e ? e.querySelector(`.${
|
|
21
|
+
return "querySelector" in e ? e.querySelector(`.${O}`) ?? null : null;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
24
|
-
return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(
|
|
23
|
+
function nt(e) {
|
|
24
|
+
const t = A(e);
|
|
25
|
+
return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(W);
|
|
25
26
|
}
|
|
26
27
|
function P(e) {
|
|
27
|
-
const t =
|
|
28
|
+
const t = A(e);
|
|
28
29
|
if (!t || !("getAttribute" in t))
|
|
29
30
|
return "grid";
|
|
30
31
|
const n = t.getAttribute("data-layout");
|
|
31
32
|
return n === "list" || n === "horizontal" ? "list" : "grid";
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
const n =
|
|
34
|
+
function B(e, t = {}) {
|
|
35
|
+
const n = A(e);
|
|
35
36
|
if (!n || !("getAttribute" in n))
|
|
36
|
-
return
|
|
37
|
-
const o = n.getAttribute(
|
|
38
|
-
return o ?
|
|
37
|
+
return I;
|
|
38
|
+
const o = n.getAttribute(h);
|
|
39
|
+
return o ? U(
|
|
39
40
|
o.split(",").filter(Boolean),
|
|
40
41
|
n,
|
|
41
42
|
t
|
|
42
|
-
) :
|
|
43
|
+
) : I;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function $(e) {
|
|
45
46
|
if (!e || !("childNodes" in e))
|
|
46
47
|
return null;
|
|
47
48
|
const t = e.childNodes(), n = t.find(
|
|
48
49
|
(o) => "getType" in o && o.getType() === "text"
|
|
49
50
|
);
|
|
50
|
-
return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o :
|
|
51
|
+
return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : $(r), null);
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
const o =
|
|
54
|
-
return o ? (e.modifyHtml(o).setText(n), !0)
|
|
53
|
+
function y(e, t, n) {
|
|
54
|
+
const o = $(t);
|
|
55
|
+
return !o || "getTextContent" in o && o.getTextContent() === n ? !1 : (e.modifyHtml(o).setText(n), !0);
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function C(e, t, n, o) {
|
|
58
|
+
return "getAttribute" in t && t.getAttribute(n) === o ? !1 : (e.modifyHtml(t).setAttribute(n, o), !0);
|
|
59
|
+
}
|
|
60
|
+
function v(e, t) {
|
|
57
61
|
return e && e.length > 0 ? e : t.length > 0 ? t : H();
|
|
58
62
|
}
|
|
59
|
-
function
|
|
63
|
+
function j(e) {
|
|
60
64
|
if (typeof e == "number")
|
|
61
65
|
return `0 ${e / 2}px`;
|
|
62
66
|
}
|
|
63
|
-
function
|
|
67
|
+
function ot(e) {
|
|
64
68
|
const { currentNode: t, documentModifier: n } = e;
|
|
65
69
|
if (!t || !("querySelector" in t))
|
|
66
70
|
return !1;
|
|
67
71
|
const o = t.querySelector(w);
|
|
68
72
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
69
73
|
}
|
|
70
|
-
function
|
|
74
|
+
function rt(e) {
|
|
71
75
|
return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
|
|
72
76
|
}
|
|
73
|
-
function
|
|
77
|
+
function it(e) {
|
|
74
78
|
const t = e.querySelector(".container");
|
|
75
79
|
return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
|
|
76
80
|
}
|
|
77
|
-
function
|
|
78
|
-
const o =
|
|
81
|
+
function lt(e, t, n) {
|
|
82
|
+
const o = it(e);
|
|
79
83
|
if (!o || !("childNodes" in o))
|
|
80
84
|
return;
|
|
81
|
-
const r = o.childNodes().map(
|
|
82
|
-
t.modifyHtml(o).setInnerHtml(r + s), t.apply(new
|
|
85
|
+
const r = o.childNodes().map(rt).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
|
|
86
|
+
t.modifyHtml(o).setInnerHtml(r + s), t.apply(new V("Added mobile product row"));
|
|
83
87
|
}
|
|
84
|
-
function
|
|
88
|
+
function F(e, t = {}) {
|
|
85
89
|
const {
|
|
86
90
|
currentNode: n,
|
|
87
91
|
documentModifier: o,
|
|
88
92
|
products: r,
|
|
89
93
|
layout: s,
|
|
90
|
-
composition:
|
|
94
|
+
composition: u
|
|
91
95
|
} = e;
|
|
92
96
|
if (!n || !("querySelector" in n))
|
|
93
97
|
return !1;
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
return
|
|
97
|
-
const c =
|
|
98
|
+
const l = s ?? P(n), i = b.getConfig(n);
|
|
99
|
+
if (l === "list" || !i.mobileLayoutEnabled)
|
|
100
|
+
return ot({ currentNode: n, documentModifier: o });
|
|
101
|
+
const c = E(), f = v(r, c.recommendationProducts), a = u ?? B(n, c.filterList), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${D(f, l, {
|
|
98
102
|
productsPerRow: i.mobileCardsInRow,
|
|
99
|
-
composition:
|
|
103
|
+
composition: a,
|
|
100
104
|
filterList: c.filterList,
|
|
101
105
|
priceInline: !i.priceMovedToNextLine,
|
|
102
106
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
103
|
-
cellPadding:
|
|
107
|
+
cellPadding: j(i.mobileColumnSpacing),
|
|
104
108
|
rowSpacingPx: i.mobileRowSpacing,
|
|
105
109
|
...t
|
|
106
|
-
})}</table></td>`,
|
|
107
|
-
return
|
|
110
|
+
})}</table></td>`, S = n.querySelector(w);
|
|
111
|
+
return S ? (o.modifyHtml(S).setInnerHtml(g), !0) : (lt(n, o, g), !1);
|
|
108
112
|
}
|
|
109
|
-
function
|
|
110
|
-
|
|
113
|
+
function ht(e) {
|
|
114
|
+
F(e, x(e.currentNode)) && T(e.documentModifier, "Updated mobile product rows", e.hidden);
|
|
111
115
|
}
|
|
112
|
-
function
|
|
116
|
+
function ct(e, t = {}) {
|
|
113
117
|
const {
|
|
114
118
|
currentNode: n,
|
|
115
119
|
documentModifier: o,
|
|
116
120
|
products: r,
|
|
117
121
|
layout: s,
|
|
118
|
-
composition:
|
|
122
|
+
composition: u
|
|
119
123
|
} = e;
|
|
120
124
|
if (!n || !("querySelector" in n))
|
|
121
125
|
return !1;
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
126
|
+
const l = n.querySelector(k) ?? n.querySelector(z);
|
|
127
|
+
if (!l)
|
|
124
128
|
return !1;
|
|
125
|
-
const i =
|
|
126
|
-
productsPerRow:
|
|
127
|
-
composition:
|
|
129
|
+
const i = E(), c = v(r, i.recommendationProducts), { cardsInRow: f } = b.getConfig(n), a = u ?? B(n, i.filterList), d = s ?? P(n), g = b.getConfig(n), S = D(c, d, {
|
|
130
|
+
productsPerRow: f,
|
|
131
|
+
composition: a,
|
|
128
132
|
filterList: i.filterList,
|
|
129
|
-
priceInline: !
|
|
133
|
+
priceInline: !g.priceMovedToNextLine,
|
|
130
134
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
131
|
-
cellPadding:
|
|
132
|
-
rowSpacingPx:
|
|
135
|
+
cellPadding: j(g.columnSpacing),
|
|
136
|
+
rowSpacingPx: g.rowSpacing,
|
|
133
137
|
...t
|
|
134
138
|
});
|
|
135
|
-
return o.modifyHtml(
|
|
139
|
+
return o.modifyHtml(l).setInnerHtml(S), !0;
|
|
136
140
|
}
|
|
137
|
-
function
|
|
141
|
+
function ut(e) {
|
|
138
142
|
if (!e)
|
|
139
143
|
return null;
|
|
140
144
|
try {
|
|
@@ -144,58 +148,59 @@ function le(e) {
|
|
|
144
148
|
return null;
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
function
|
|
148
|
-
const o =
|
|
151
|
+
function st(e, t, n) {
|
|
152
|
+
const o = A(e);
|
|
149
153
|
if (n || !o || !("getAttribute" in o))
|
|
150
154
|
return !1;
|
|
151
|
-
const r = o.getAttribute(
|
|
155
|
+
const r = o.getAttribute(h);
|
|
152
156
|
if (!r)
|
|
153
157
|
return !1;
|
|
154
|
-
const s =
|
|
155
|
-
c && i.push([
|
|
156
|
-
const
|
|
158
|
+
const s = E(), u = r.split(",").filter(Boolean), l = U(u, o, s.filterList), i = [], c = l.join(",") !== u.join(",");
|
|
159
|
+
c && i.push([h, l.join(",")]);
|
|
160
|
+
const f = ut(
|
|
157
161
|
o.getAttribute(q)
|
|
158
|
-
),
|
|
159
|
-
if (
|
|
162
|
+
), a = f && X(f, o, s.filterList);
|
|
163
|
+
if (f && a && a.join(",") !== f.join(",") && i.push([q, JSON.stringify(a)]), i.length === 0)
|
|
160
164
|
return !1;
|
|
161
|
-
if (i.forEach(([d,
|
|
162
|
-
t.modifyHtml(o).setAttribute(d,
|
|
163
|
-
}), c &&
|
|
165
|
+
if (i.forEach(([d, g]) => {
|
|
166
|
+
t.modifyHtml(o).setAttribute(d, g);
|
|
167
|
+
}), c && b.hasConfig(e)) {
|
|
164
168
|
const d = {
|
|
165
|
-
...
|
|
166
|
-
composition:
|
|
169
|
+
...b.getConfig(e),
|
|
170
|
+
composition: l
|
|
167
171
|
};
|
|
168
172
|
t.modifyHtml(e).setNodeConfig(d);
|
|
169
173
|
}
|
|
170
174
|
return !0;
|
|
171
175
|
}
|
|
172
|
-
function
|
|
176
|
+
function qt(e) {
|
|
173
177
|
const {
|
|
174
178
|
currentNode: t,
|
|
175
179
|
documentModifier: n,
|
|
176
180
|
afterRegenerate: o,
|
|
177
181
|
products: r,
|
|
178
182
|
layout: s,
|
|
179
|
-
composition:
|
|
180
|
-
skipStylePreservation:
|
|
183
|
+
composition: u,
|
|
184
|
+
skipStylePreservation: l,
|
|
185
|
+
hidden: i
|
|
181
186
|
} = e;
|
|
182
187
|
if (!t)
|
|
183
188
|
return !1;
|
|
184
|
-
const
|
|
189
|
+
const c = l ? {} : x(t), f = {
|
|
185
190
|
currentNode: t,
|
|
186
191
|
documentModifier: n,
|
|
187
192
|
products: r,
|
|
188
193
|
layout: s,
|
|
189
|
-
composition:
|
|
194
|
+
composition: u
|
|
190
195
|
};
|
|
191
|
-
let a =
|
|
192
|
-
return a =
|
|
196
|
+
let a = ct(f, c);
|
|
197
|
+
return a = F(f, c) || a, a && (st(t, n, u), T(n, "Regenerate products with styles", i)), o == null || o(), a;
|
|
193
198
|
}
|
|
194
|
-
function
|
|
199
|
+
function Mt(e, t) {
|
|
195
200
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
|
|
196
201
|
}
|
|
197
|
-
function
|
|
198
|
-
const e =
|
|
202
|
+
function Y() {
|
|
203
|
+
const e = E(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
|
|
199
204
|
return {
|
|
200
205
|
code: t.value,
|
|
201
206
|
symbol: t.symbol,
|
|
@@ -205,79 +210,82 @@ function F() {
|
|
|
205
210
|
thousandSeparator: t.thousandSeparator
|
|
206
211
|
};
|
|
207
212
|
}
|
|
208
|
-
function
|
|
209
|
-
const n =
|
|
210
|
-
return
|
|
213
|
+
function R(e, t = "price") {
|
|
214
|
+
const n = Y(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
215
|
+
return Q({
|
|
211
216
|
price: r,
|
|
212
217
|
currency: n
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
|
-
function
|
|
216
|
-
var s,
|
|
217
|
-
const t =
|
|
220
|
+
function at(e) {
|
|
221
|
+
var s, u;
|
|
222
|
+
const t = Y(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((u = e.price) == null ? void 0 : u[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
218
223
|
return r > 0 ? `-${r}%` : "0%";
|
|
219
224
|
}
|
|
220
|
-
function
|
|
221
|
-
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl:
|
|
222
|
-
let
|
|
225
|
+
function G(e) {
|
|
226
|
+
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: u } = e;
|
|
227
|
+
let l = !1;
|
|
223
228
|
if (o && "querySelector" in o) {
|
|
224
|
-
const i = o.querySelector("strong") ?? o.querySelector("p"), c =
|
|
225
|
-
|
|
229
|
+
const i = o.querySelector("strong") ?? o.querySelector("p"), c = R(n, "price");
|
|
230
|
+
y(t, i ?? null, c) && (l = !0);
|
|
226
231
|
}
|
|
227
232
|
if (r && "querySelector" in r) {
|
|
228
|
-
const i = r.querySelector("strong") ?? r.querySelector("p"), c =
|
|
229
|
-
|
|
233
|
+
const i = r.querySelector("strong") ?? r.querySelector("p"), c = R(n, "original_price");
|
|
234
|
+
y(t, i ?? null, c) && (l = !0), C(t, r, "data-same-price", String(tt(n))) && (l = !0);
|
|
230
235
|
}
|
|
231
236
|
if (s && "querySelector" in s) {
|
|
232
|
-
const i = s.querySelector(".omnibus-price-value") ?? null, c =
|
|
233
|
-
|
|
237
|
+
const i = s.querySelector(".omnibus-price-value") ?? null, c = R(n, "original_price");
|
|
238
|
+
y(t, i, c) && (l = !0);
|
|
234
239
|
}
|
|
235
|
-
if (
|
|
236
|
-
const i =
|
|
237
|
-
|
|
240
|
+
if (u && "querySelector" in u) {
|
|
241
|
+
const i = u.querySelector(".omnibus-discount-value") ?? null, c = at(n);
|
|
242
|
+
y(t, i, c) && (l = !0);
|
|
238
243
|
}
|
|
239
|
-
return
|
|
244
|
+
return l;
|
|
240
245
|
}
|
|
241
|
-
function
|
|
246
|
+
function ft(e) {
|
|
242
247
|
const {
|
|
243
248
|
documentModifier: t,
|
|
244
249
|
product: n,
|
|
245
250
|
imageEl: o,
|
|
246
251
|
nameEl: r,
|
|
247
252
|
priceEl: s,
|
|
248
|
-
oldPriceEl:
|
|
249
|
-
omnibusPriceEl:
|
|
253
|
+
oldPriceEl: u,
|
|
254
|
+
omnibusPriceEl: l,
|
|
250
255
|
omnibusDiscountEl: i,
|
|
251
256
|
buttonEl: c
|
|
252
257
|
} = e;
|
|
253
|
-
let
|
|
258
|
+
let f = !1;
|
|
254
259
|
if (o && "querySelector" in o) {
|
|
255
|
-
const
|
|
256
|
-
|
|
260
|
+
const a = o.querySelector("img");
|
|
261
|
+
if (a) {
|
|
262
|
+
const g = C(t, a, "src", Z(n.image_url)), S = C(t, a, "alt", n.name);
|
|
263
|
+
f = f || g || S;
|
|
264
|
+
}
|
|
257
265
|
const d = o.querySelector("a");
|
|
258
|
-
d && (t
|
|
266
|
+
d && C(t, d, "href", n.url) && (f = !0);
|
|
259
267
|
}
|
|
260
268
|
if (r && "querySelector" in r) {
|
|
261
|
-
const
|
|
262
|
-
|
|
269
|
+
const a = r.querySelector("strong") ?? r.querySelector("p");
|
|
270
|
+
y(t, a ?? null, n.name) && (f = !0);
|
|
263
271
|
}
|
|
264
|
-
if (
|
|
272
|
+
if (G({
|
|
265
273
|
documentModifier: t,
|
|
266
274
|
product: n,
|
|
267
275
|
priceEl: s,
|
|
268
|
-
oldPriceEl:
|
|
269
|
-
omnibusPriceEl:
|
|
276
|
+
oldPriceEl: u,
|
|
277
|
+
omnibusPriceEl: l,
|
|
270
278
|
omnibusDiscountEl: i
|
|
271
|
-
}) && (
|
|
272
|
-
const
|
|
273
|
-
|
|
279
|
+
}) && (f = !0), c && "querySelector" in c) {
|
|
280
|
+
const a = c.querySelector("a.es-button") || c.querySelector("a");
|
|
281
|
+
a && C(t, a, "href", n.url) && (f = !0);
|
|
274
282
|
}
|
|
275
|
-
return
|
|
283
|
+
return f;
|
|
276
284
|
}
|
|
277
|
-
function
|
|
278
|
-
return "querySelector" in e ? e.querySelector(
|
|
285
|
+
function K(e) {
|
|
286
|
+
return "querySelector" in e ? e.querySelector(k) ?? e : e;
|
|
279
287
|
}
|
|
280
|
-
function
|
|
288
|
+
function dt(e, t) {
|
|
281
289
|
var o;
|
|
282
290
|
let n;
|
|
283
291
|
if (e.startsWith(M)) {
|
|
@@ -285,9 +293,9 @@ function ae(e, t) {
|
|
|
285
293
|
n = (o = t.product_attributes) == null ? void 0 : o[r];
|
|
286
294
|
} else
|
|
287
295
|
n = t[e];
|
|
288
|
-
return
|
|
296
|
+
return et(n) || null;
|
|
289
297
|
}
|
|
290
|
-
function
|
|
298
|
+
function mt(e, t, n) {
|
|
291
299
|
if (!("querySelectorAll" in e))
|
|
292
300
|
return !1;
|
|
293
301
|
const o = e.querySelectorAll(
|
|
@@ -296,30 +304,30 @@ function fe(e, t, n) {
|
|
|
296
304
|
if (o.length === 0)
|
|
297
305
|
return !1;
|
|
298
306
|
const r = /* @__PURE__ */ new Map();
|
|
299
|
-
o.forEach((
|
|
300
|
-
if (!("getAttribute" in
|
|
307
|
+
o.forEach((u) => {
|
|
308
|
+
if (!("getAttribute" in u))
|
|
301
309
|
return;
|
|
302
|
-
const
|
|
303
|
-
if (!
|
|
310
|
+
const l = u.getAttribute(J);
|
|
311
|
+
if (!l)
|
|
304
312
|
return;
|
|
305
|
-
const i = r.get(
|
|
306
|
-
i.push(
|
|
313
|
+
const i = r.get(l) ?? [];
|
|
314
|
+
i.push(u), r.set(l, i);
|
|
307
315
|
});
|
|
308
316
|
let s = !1;
|
|
309
|
-
return r.forEach((
|
|
310
|
-
const i = Math.min(
|
|
311
|
-
|
|
317
|
+
return r.forEach((u, l) => {
|
|
318
|
+
const i = Math.min(u.length, n.length);
|
|
319
|
+
u.slice(0, i).forEach((c, f) => {
|
|
312
320
|
if (!("querySelector" in c))
|
|
313
321
|
return;
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
322
|
+
const a = dt(l, n[f]);
|
|
323
|
+
if (a === null)
|
|
316
324
|
return;
|
|
317
325
|
const d = c.querySelector("p") ?? null;
|
|
318
|
-
|
|
326
|
+
y(t, d, a) && (s = !0);
|
|
319
327
|
});
|
|
320
328
|
}), s;
|
|
321
329
|
}
|
|
322
|
-
function
|
|
330
|
+
function N(e, t, n) {
|
|
323
331
|
if (!("querySelectorAll" in e))
|
|
324
332
|
return !1;
|
|
325
333
|
const o = e.querySelectorAll(
|
|
@@ -328,55 +336,55 @@ function O(e, t, n) {
|
|
|
328
336
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
329
337
|
), s = e.querySelectorAll(
|
|
330
338
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
331
|
-
), l = e.querySelectorAll(
|
|
332
|
-
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
333
339
|
), u = e.querySelectorAll(
|
|
340
|
+
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
341
|
+
), l = e.querySelectorAll(
|
|
334
342
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
335
343
|
), i = e.querySelectorAll(
|
|
336
344
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
337
345
|
), c = e.querySelectorAll(
|
|
338
346
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
339
|
-
),
|
|
340
|
-
let
|
|
341
|
-
for (let d = 0; d <
|
|
342
|
-
const
|
|
347
|
+
), f = Math.min(o.length, n.length);
|
|
348
|
+
let a = !1;
|
|
349
|
+
for (let d = 0; d < f; d++) {
|
|
350
|
+
const g = ft({
|
|
343
351
|
documentModifier: t,
|
|
344
352
|
product: n[d],
|
|
345
353
|
imageEl: o[d] ?? null,
|
|
346
354
|
nameEl: r[d] ?? null,
|
|
347
355
|
priceEl: s[d] ?? null,
|
|
348
|
-
oldPriceEl:
|
|
349
|
-
omnibusPriceEl:
|
|
356
|
+
oldPriceEl: u[d] ?? null,
|
|
357
|
+
omnibusPriceEl: l[d] ?? null,
|
|
350
358
|
omnibusDiscountEl: i[d] ?? null,
|
|
351
359
|
buttonEl: c[d] ?? null
|
|
352
360
|
});
|
|
353
|
-
|
|
361
|
+
a = a || g;
|
|
354
362
|
}
|
|
355
|
-
return
|
|
363
|
+
return mt(e, t, n) && (a = !0), a;
|
|
356
364
|
}
|
|
357
|
-
function
|
|
358
|
-
const { currentNode: t, documentModifier: n, products: o, onApplied: r } = e;
|
|
365
|
+
function It(e) {
|
|
366
|
+
const { currentNode: t, documentModifier: n, products: o, onApplied: r, hidden: s } = e;
|
|
359
367
|
if (!t || !("querySelectorAll" in t))
|
|
360
368
|
return !1;
|
|
361
|
-
const
|
|
362
|
-
if (!("querySelectorAll" in
|
|
369
|
+
const u = K(t);
|
|
370
|
+
if (!("querySelectorAll" in u) || u.querySelectorAll(
|
|
363
371
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
364
372
|
).length !== o.length)
|
|
365
373
|
return !1;
|
|
366
|
-
let
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
const a = t.querySelector(
|
|
374
|
+
let i = N(u, n, o);
|
|
375
|
+
const c = P(t), f = b.getConfig(t);
|
|
376
|
+
if (c !== "list" && f.mobileLayoutEnabled && "querySelector" in t) {
|
|
377
|
+
const a = t.querySelector(L);
|
|
370
378
|
if (a) {
|
|
371
|
-
const
|
|
379
|
+
const d = N(
|
|
372
380
|
a,
|
|
373
381
|
n,
|
|
374
382
|
o
|
|
375
383
|
);
|
|
376
|
-
|
|
384
|
+
i = i || d;
|
|
377
385
|
}
|
|
378
386
|
}
|
|
379
|
-
return
|
|
387
|
+
return i && (T(n, "Updated product content in-place", s), r == null || r()), !0;
|
|
380
388
|
}
|
|
381
389
|
function _(e, t, n) {
|
|
382
390
|
if (!("querySelectorAll" in e))
|
|
@@ -387,63 +395,81 @@ function _(e, t, n) {
|
|
|
387
395
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
388
396
|
), s = e.querySelectorAll(
|
|
389
397
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
390
|
-
),
|
|
398
|
+
), u = e.querySelectorAll(
|
|
391
399
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
392
|
-
),
|
|
400
|
+
), l = Math.min(o.length, n.length);
|
|
393
401
|
let i = !1;
|
|
394
|
-
for (let c = 0; c <
|
|
395
|
-
|
|
402
|
+
for (let c = 0; c < l; c++)
|
|
403
|
+
G({
|
|
396
404
|
documentModifier: t,
|
|
397
405
|
product: n[c],
|
|
398
406
|
priceEl: o[c] ?? null,
|
|
399
407
|
oldPriceEl: r[c] ?? null,
|
|
400
408
|
omnibusPriceEl: s[c] ?? null,
|
|
401
|
-
omnibusDiscountEl:
|
|
409
|
+
omnibusDiscountEl: u[c] ?? null
|
|
402
410
|
}) && (i = !0);
|
|
403
411
|
return i;
|
|
404
412
|
}
|
|
405
|
-
function
|
|
406
|
-
const { currentNode: t, documentModifier: n } = e;
|
|
413
|
+
function Ot(e) {
|
|
414
|
+
const { currentNode: t, documentModifier: n, hidden: o } = e;
|
|
407
415
|
if (!t || !("querySelectorAll" in t))
|
|
408
416
|
return !1;
|
|
409
|
-
if (
|
|
417
|
+
if (nt(t))
|
|
410
418
|
return !0;
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
419
|
+
const s = E().recommendationProducts;
|
|
420
|
+
if (s.length === 0)
|
|
413
421
|
return !1;
|
|
414
|
-
const
|
|
415
|
-
let l = _(
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
const a = _(
|
|
422
|
+
const u = K(t);
|
|
423
|
+
let l = _(u, n, s);
|
|
424
|
+
const i = P(t), c = b.getConfig(t);
|
|
425
|
+
if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
426
|
+
const f = t.querySelector(L);
|
|
427
|
+
if (f) {
|
|
428
|
+
const a = _(f, n, s);
|
|
421
429
|
l = l || a;
|
|
422
430
|
}
|
|
423
431
|
}
|
|
424
|
-
return l && n
|
|
432
|
+
return l && T(n, "Updated price formatting in-place", o), l;
|
|
425
433
|
}
|
|
426
|
-
function
|
|
427
|
-
const { currentNode: t, documentModifier: n, currency: o } = e,
|
|
428
|
-
if (!
|
|
434
|
+
function Nt(e) {
|
|
435
|
+
const { currentNode: t, documentModifier: n, currency: o, hidden: r } = e, s = A(t);
|
|
436
|
+
if (!s)
|
|
429
437
|
return;
|
|
430
|
-
const
|
|
431
|
-
n.modifyHtml(
|
|
438
|
+
const u = o.alignment === "before" ? "0" : "1", l = (i, c) => {
|
|
439
|
+
n.modifyHtml(s).setAttribute(i, c);
|
|
440
|
+
};
|
|
441
|
+
l(p.CURRENCY, o.code), l(p.SYMBOL, o.symbol), l(p.ALIGNMENT, u), l(p.THOUSAND_SEPARATOR, o.thousandSeparator), l(p.DECIMAL_SEPARATOR, o.decimalSeparator), l(p.DECIMAL_COUNT, o.decimalCount.toString()), T(n, "Update currency attributes", r);
|
|
442
|
+
}
|
|
443
|
+
function _t(e) {
|
|
444
|
+
const t = A(e);
|
|
445
|
+
if (!t || !("getAttribute" in t))
|
|
446
|
+
return null;
|
|
447
|
+
const n = t.getAttribute(p.CURRENCY);
|
|
448
|
+
if (!n)
|
|
449
|
+
return null;
|
|
450
|
+
const r = t.getAttribute(p.ALIGNMENT) === "1" ? "after" : "before", s = t.getAttribute(p.DECIMAL_COUNT), u = s ? parseInt(s) : 2, l = t.getAttribute(p.THOUSAND_SEPARATOR) ?? ",", i = t.getAttribute(p.DECIMAL_SEPARATOR) ?? ".";
|
|
451
|
+
return {
|
|
452
|
+
code: n,
|
|
453
|
+
symbol: t.getAttribute(p.SYMBOL) ?? n,
|
|
454
|
+
alignment: r,
|
|
455
|
+
thousandSeparator: l,
|
|
456
|
+
decimalSeparator: i,
|
|
457
|
+
decimalCount: Number.isNaN(u) ? 2 : u
|
|
432
458
|
};
|
|
433
|
-
l(g.CURRENCY, o.code), l(g.SYMBOL, o.symbol), l(g.ALIGNMENT, s), l(g.THOUSAND_SEPARATOR, o.thousandSeparator), l(g.DECIMAL_SEPARATOR, o.decimalSeparator), l(g.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new S("Update currency attributes"));
|
|
434
459
|
}
|
|
435
460
|
export {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
461
|
+
Mt as adjustProductsToSize,
|
|
462
|
+
R as formatProductPrice,
|
|
463
|
+
A as getBlockElement,
|
|
464
|
+
B as getCardComposition,
|
|
465
|
+
_t as getCurrencyAttributesFromBlock,
|
|
440
466
|
P as getCurrentLayout,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
467
|
+
it as getMainContainerTbody,
|
|
468
|
+
nt as isPartnerManagedBlock,
|
|
469
|
+
ht as regenerateMobileProductRows,
|
|
470
|
+
qt as regenerateProductRowsWithStyles,
|
|
471
|
+
Nt as setCurrencyAttributes,
|
|
472
|
+
Ot as updatePricesInPlace,
|
|
473
|
+
It as updateProductContentInPlace,
|
|
474
|
+
ft as updateSingleProductContent
|
|
449
475
|
};
|