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