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