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