@useinsider/guido 2.2.0-beta.fa4cec8 → 3.0.0-beta.44d4c8e
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 +41 -2
- package/dist/@types/config/schemas.js +1 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +66 -66
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +66 -62
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +1 -1
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +194 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +291 -217
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +172 -85
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +2 -2
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +32 -32
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +55 -19
- package/dist/src/@types/config/schemas.d.ts +1 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +38 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +27 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +19 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/static/styles/customEditorStyle.css.js +50 -23
- package/dist/stores/editor.js +2 -1
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +2 -2
|
@@ -1,307 +1,381 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
1
|
+
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import {
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
if (!
|
|
3
|
+
import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as q, CONTAINER_SELECTOR as $, MOBILE_ROW_SELECTOR as O } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as N } from "../../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
6
|
+
import { prepareProductRows as k } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as B } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as v } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as T, DEFAULT_CARD_COMPOSITION as P, sanitizeImageUrl as j } from "../../templates/utils.js";
|
|
10
|
+
const M = "recommendation-block-v2";
|
|
11
|
+
function A(t) {
|
|
12
|
+
if (!t)
|
|
13
13
|
return null;
|
|
14
|
-
if ("getAttribute" in
|
|
15
|
-
const e =
|
|
16
|
-
if (e && e.includes(
|
|
17
|
-
return
|
|
14
|
+
if ("getAttribute" in t) {
|
|
15
|
+
const e = t.getAttribute("class");
|
|
16
|
+
if (e && e.includes(M))
|
|
17
|
+
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${M}`) : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const e =
|
|
21
|
+
function b(t) {
|
|
22
|
+
const e = A(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const o = e.getAttribute("data-layout");
|
|
26
|
+
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const e =
|
|
28
|
+
function _(t) {
|
|
29
|
+
const e = A(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
32
|
-
const
|
|
33
|
-
return
|
|
31
|
+
return P;
|
|
32
|
+
const o = e.getAttribute("data-card-composition");
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : P;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function S(t, e, o) {
|
|
36
36
|
if (!e || !("childNodes" in e))
|
|
37
37
|
return !1;
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
const r = e.childNodes().find(
|
|
39
|
+
(c) => "getType" in c && c.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return
|
|
41
|
+
return r ? (t.modifyHtml(r).setText(o), !0) : !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function x(t, e) {
|
|
44
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : T();
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const { currentNode: e, documentModifier:
|
|
46
|
+
function V(t) {
|
|
47
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
48
48
|
if (!e || !("querySelector" in e))
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
50
|
+
const n = e.querySelector(O), r = e.querySelector(g);
|
|
51
|
+
n && o.modifyHtml(n).setStyle("display", "none"), r && o.modifyHtml(r).setInnerHtml(""), (n || r) && o.apply(new p("Hide mobile row for list layout"));
|
|
52
|
+
}
|
|
53
|
+
function W(t) {
|
|
54
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
55
|
+
if (!e || !("querySelector" in e))
|
|
56
|
+
return;
|
|
57
|
+
const n = e.querySelector(O);
|
|
58
|
+
n && o.modifyHtml(n).removeStyle("display").apply(new p("Show mobile row for grid layout"));
|
|
59
|
+
}
|
|
60
|
+
function G(t) {
|
|
61
|
+
const { currentNode: e, documentModifier: o, products: n, layout: r } = t;
|
|
62
|
+
if (!e || !("querySelector" in e))
|
|
63
|
+
return;
|
|
64
|
+
const c = r ?? b(e);
|
|
65
|
+
if (c === "list") {
|
|
66
|
+
V({ currentNode: e, documentModifier: o });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
W({ currentNode: e, documentModifier: o });
|
|
70
|
+
const i = e.querySelector(g);
|
|
51
71
|
if (!i)
|
|
52
72
|
return;
|
|
53
|
-
const
|
|
73
|
+
const s = E(), u = N.getConfig(e), l = x(n, s.recommendationProducts), f = _(e), a = k(l, c, {
|
|
54
74
|
productsPerRow: u.mobileCardsInRow,
|
|
55
|
-
composition:
|
|
75
|
+
composition: f
|
|
56
76
|
});
|
|
57
|
-
|
|
77
|
+
o.modifyHtml(i).setInnerHtml(a).apply(new p("Updated mobile product rows"));
|
|
58
78
|
}
|
|
59
|
-
function
|
|
79
|
+
function Y(t) {
|
|
60
80
|
const {
|
|
61
81
|
currentNode: e,
|
|
62
|
-
documentModifier:
|
|
63
|
-
afterRegenerate:
|
|
64
|
-
products:
|
|
65
|
-
layout:
|
|
66
|
-
} =
|
|
82
|
+
documentModifier: o,
|
|
83
|
+
afterRegenerate: n,
|
|
84
|
+
products: r,
|
|
85
|
+
layout: c
|
|
86
|
+
} = t;
|
|
67
87
|
if (!e || !("querySelector" in e))
|
|
68
88
|
return;
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
89
|
+
const i = e.querySelector(q) ?? e.querySelector($);
|
|
90
|
+
if (!i)
|
|
71
91
|
return;
|
|
72
|
-
const
|
|
73
|
-
productsPerRow:
|
|
74
|
-
composition:
|
|
92
|
+
const s = E(), u = x(r, s.recommendationProducts), { cardsInRow: l } = s.recommendationConfigs, f = _(e), a = c ?? b(e), d = k(u, a, {
|
|
93
|
+
productsPerRow: l,
|
|
94
|
+
composition: f
|
|
75
95
|
});
|
|
76
|
-
|
|
96
|
+
o.modifyHtml(i).setInnerHtml(d).apply(new p("Updated product")), G(t), n == null || n();
|
|
77
97
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
let c = !1;
|
|
81
|
-
return r === "grid" ? Array.from(
|
|
82
|
-
o.querySelectorAll(".attribute-cell")
|
|
83
|
-
).forEach((l) => {
|
|
84
|
-
e.modifyHtml(l).setStyle("padding", i), c = !0;
|
|
85
|
-
}) : Array.from(
|
|
86
|
-
o.querySelectorAll(".product-card-wrapper")
|
|
87
|
-
).forEach((l) => {
|
|
88
|
-
const s = "parentNode" in l ? l.parentNode : null;
|
|
89
|
-
s && L(s) && (e.modifyHtml(s).setStyle("padding", i), c = !0);
|
|
90
|
-
}), c;
|
|
91
|
-
}
|
|
92
|
-
function v(o, e, t) {
|
|
93
|
-
const r = `${t}px`, n = Array.from(o.querySelectorAll(".spacer"));
|
|
98
|
+
function h(t, e, o, n) {
|
|
99
|
+
const c = `0 ${Math.floor(o / 2)}px`;
|
|
94
100
|
let i = !1;
|
|
95
|
-
return n.
|
|
96
|
-
|
|
101
|
+
return n === "grid" ? Array.from(
|
|
102
|
+
t.querySelectorAll(".attribute-cell")
|
|
103
|
+
).forEach((u) => {
|
|
104
|
+
e.modifyHtml(u).setStyle("padding", c), i = !0;
|
|
105
|
+
}) : Array.from(
|
|
106
|
+
t.querySelectorAll(".product-card-wrapper")
|
|
107
|
+
).forEach((u) => {
|
|
108
|
+
const l = "parentNode" in u ? u.parentNode : null;
|
|
109
|
+
l && v(l) && (e.modifyHtml(l).setStyle("padding", c), i = !0);
|
|
97
110
|
}), i;
|
|
98
111
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
112
|
+
function R(t, e, o) {
|
|
113
|
+
const n = `${o}px`, r = Array.from(t.querySelectorAll(".spacer"));
|
|
114
|
+
let c = !1;
|
|
115
|
+
return r.forEach((i) => {
|
|
116
|
+
e.modifyHtml(i).setStyle("height", n), c = !0;
|
|
117
|
+
}), c;
|
|
118
|
+
}
|
|
119
|
+
function F(t) {
|
|
120
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
101
121
|
if (!e)
|
|
102
122
|
return;
|
|
103
|
-
const r =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const n = r.getAttribute("data-column-spacing"), i = r.getAttribute("data-row-spacing"), c = P(e);
|
|
107
|
-
let u = !1;
|
|
108
|
-
if (n) {
|
|
109
|
-
const l = parseInt(n);
|
|
110
|
-
Number.isNaN(l) || (u = B(
|
|
111
|
-
e,
|
|
112
|
-
t,
|
|
113
|
-
l,
|
|
114
|
-
c
|
|
115
|
-
));
|
|
116
|
-
}
|
|
123
|
+
const n = N.getConfig(e), r = b(e);
|
|
124
|
+
let c = !1;
|
|
125
|
+
const i = e.querySelector(q);
|
|
117
126
|
if (i) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
c = h(
|
|
128
|
+
i,
|
|
129
|
+
o,
|
|
130
|
+
n.columnSpacing,
|
|
131
|
+
r
|
|
132
|
+
);
|
|
133
|
+
const l = R(
|
|
134
|
+
i,
|
|
135
|
+
o,
|
|
136
|
+
n.rowSpacing
|
|
137
|
+
);
|
|
138
|
+
c = c || l;
|
|
123
139
|
}
|
|
124
|
-
|
|
140
|
+
const s = e.querySelector(g);
|
|
141
|
+
if (s) {
|
|
142
|
+
const u = h(
|
|
143
|
+
s,
|
|
144
|
+
o,
|
|
145
|
+
n.mobileColumnSpacing,
|
|
146
|
+
r
|
|
147
|
+
);
|
|
148
|
+
c = c || u;
|
|
149
|
+
const l = R(
|
|
150
|
+
s,
|
|
151
|
+
o,
|
|
152
|
+
n.mobileRowSpacing
|
|
153
|
+
);
|
|
154
|
+
c = c || l;
|
|
155
|
+
}
|
|
156
|
+
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
125
157
|
}
|
|
126
|
-
function
|
|
127
|
-
const { currentNode: e, documentModifier:
|
|
128
|
-
e &&
|
|
158
|
+
function ie(t) {
|
|
159
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c } = t;
|
|
160
|
+
e && Y({
|
|
129
161
|
currentNode: e,
|
|
130
|
-
documentModifier:
|
|
131
|
-
products:
|
|
132
|
-
layout:
|
|
162
|
+
documentModifier: o,
|
|
163
|
+
products: r,
|
|
164
|
+
layout: c,
|
|
133
165
|
afterRegenerate: () => {
|
|
134
166
|
setTimeout(() => {
|
|
135
|
-
|
|
136
|
-
}, 0),
|
|
167
|
+
F({ currentNode: e, documentModifier: o });
|
|
168
|
+
}, 0), n == null || n();
|
|
137
169
|
}
|
|
138
170
|
});
|
|
139
171
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
172
|
+
function ce(t, e) {
|
|
173
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...T(e - t.length)];
|
|
174
|
+
}
|
|
175
|
+
function D() {
|
|
176
|
+
const t = E(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
142
177
|
return {
|
|
143
178
|
code: e.value,
|
|
144
179
|
symbol: e.symbol,
|
|
145
180
|
alignment: e.alignment === "0" ? "before" : "after",
|
|
146
|
-
decimalCount:
|
|
181
|
+
decimalCount: Number.isNaN(o) ? 2 : o,
|
|
147
182
|
decimalSeparator: e.decimalSeparator,
|
|
148
183
|
thousandSeparator: e.thousandSeparator
|
|
149
184
|
};
|
|
150
185
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
price:
|
|
155
|
-
currency:
|
|
186
|
+
function C(t, e = "price") {
|
|
187
|
+
const o = D(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
188
|
+
return B({
|
|
189
|
+
price: r,
|
|
190
|
+
currency: o
|
|
156
191
|
});
|
|
157
192
|
}
|
|
158
|
-
function
|
|
159
|
-
var
|
|
160
|
-
const e =
|
|
161
|
-
return
|
|
193
|
+
function K(t) {
|
|
194
|
+
var c, i;
|
|
195
|
+
const e = D(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
196
|
+
return r > 0 ? `-${r}%` : "0%";
|
|
162
197
|
}
|
|
163
|
-
function
|
|
164
|
-
const { documentModifier: e, product:
|
|
165
|
-
let
|
|
166
|
-
if (r && "querySelector" in r) {
|
|
167
|
-
const l = r.querySelector("strong"), s = A(t, "price");
|
|
168
|
-
g(e, l, s) && (u = !0);
|
|
169
|
-
}
|
|
198
|
+
function H(t) {
|
|
199
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: c, omnibusDiscountEl: i } = t;
|
|
200
|
+
let s = !1;
|
|
170
201
|
if (n && "querySelector" in n) {
|
|
171
|
-
const
|
|
172
|
-
|
|
202
|
+
const u = n.querySelector("strong"), l = C(o, "price");
|
|
203
|
+
S(e, u, l) && (s = !0);
|
|
173
204
|
}
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
176
|
-
|
|
205
|
+
if (r && "querySelector" in r) {
|
|
206
|
+
const u = r.querySelector("strong"), l = C(o, "original_price");
|
|
207
|
+
S(e, u, l) && (s = !0);
|
|
177
208
|
}
|
|
178
209
|
if (c && "querySelector" in c) {
|
|
179
|
-
const
|
|
180
|
-
|
|
210
|
+
const u = c.querySelector(".omnibus-price-value"), l = C(o, "original_price");
|
|
211
|
+
S(e, u, l) && (s = !0);
|
|
181
212
|
}
|
|
182
|
-
|
|
213
|
+
if (i && "querySelector" in i) {
|
|
214
|
+
const u = i.querySelector(".omnibus-discount-value"), l = K(o);
|
|
215
|
+
S(e, u, l) && (s = !0);
|
|
216
|
+
}
|
|
217
|
+
return s;
|
|
183
218
|
}
|
|
184
|
-
function
|
|
219
|
+
function z(t) {
|
|
185
220
|
const {
|
|
186
221
|
documentModifier: e,
|
|
187
|
-
product:
|
|
188
|
-
imageEl:
|
|
189
|
-
nameEl:
|
|
190
|
-
priceEl:
|
|
191
|
-
oldPriceEl:
|
|
192
|
-
omnibusPriceEl:
|
|
193
|
-
omnibusDiscountEl:
|
|
194
|
-
buttonEl:
|
|
195
|
-
} =
|
|
196
|
-
let
|
|
197
|
-
if (r && "querySelector" in r) {
|
|
198
|
-
const a = r.querySelector("img");
|
|
199
|
-
a && (e.modifyHtml(a).setAttribute("src", U(t.image_url)).setAttribute("alt", t.name), d = !0);
|
|
200
|
-
const p = r.querySelector("a");
|
|
201
|
-
p && (e.modifyHtml(p).setAttribute("href", t.url), d = !0);
|
|
202
|
-
}
|
|
222
|
+
product: o,
|
|
223
|
+
imageEl: n,
|
|
224
|
+
nameEl: r,
|
|
225
|
+
priceEl: c,
|
|
226
|
+
oldPriceEl: i,
|
|
227
|
+
omnibusPriceEl: s,
|
|
228
|
+
omnibusDiscountEl: u,
|
|
229
|
+
buttonEl: l
|
|
230
|
+
} = t;
|
|
231
|
+
let f = !1;
|
|
203
232
|
if (n && "querySelector" in n) {
|
|
204
|
-
const a = n.querySelector("
|
|
205
|
-
|
|
233
|
+
const a = n.querySelector("img");
|
|
234
|
+
a && (e.modifyHtml(a).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), f = !0);
|
|
235
|
+
const d = n.querySelector("a");
|
|
236
|
+
d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
|
|
237
|
+
}
|
|
238
|
+
if (r && "querySelector" in r) {
|
|
239
|
+
const a = r.querySelector("strong");
|
|
240
|
+
S(e, a, o.name) && (f = !0);
|
|
206
241
|
}
|
|
207
|
-
if (
|
|
242
|
+
if (H({
|
|
208
243
|
documentModifier: e,
|
|
209
|
-
product:
|
|
210
|
-
priceEl:
|
|
211
|
-
oldPriceEl:
|
|
212
|
-
omnibusPriceEl:
|
|
213
|
-
omnibusDiscountEl:
|
|
214
|
-
}) && (
|
|
215
|
-
const a =
|
|
216
|
-
a && (e.modifyHtml(a).setAttribute("href",
|
|
244
|
+
product: o,
|
|
245
|
+
priceEl: c,
|
|
246
|
+
oldPriceEl: i,
|
|
247
|
+
omnibusPriceEl: s,
|
|
248
|
+
omnibusDiscountEl: u
|
|
249
|
+
}) && (f = !0), l && "querySelector" in l) {
|
|
250
|
+
const a = l.querySelector("a.es-button") || l.querySelector("a");
|
|
251
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
|
|
217
252
|
}
|
|
218
|
-
return
|
|
253
|
+
return f;
|
|
219
254
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
222
|
-
|
|
255
|
+
function L(t) {
|
|
256
|
+
return "querySelector" in t ? t.querySelector(q) ?? t : t;
|
|
257
|
+
}
|
|
258
|
+
function I(t, e, o) {
|
|
259
|
+
if (!("querySelectorAll" in t))
|
|
223
260
|
return !1;
|
|
224
|
-
const n =
|
|
261
|
+
const n = t.querySelectorAll(
|
|
225
262
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
226
|
-
),
|
|
263
|
+
), r = t.querySelectorAll(
|
|
227
264
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
228
|
-
), c =
|
|
265
|
+
), c = t.querySelectorAll(
|
|
229
266
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
230
|
-
),
|
|
267
|
+
), i = t.querySelectorAll(
|
|
231
268
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
232
|
-
),
|
|
269
|
+
), s = t.querySelectorAll(
|
|
233
270
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
234
|
-
),
|
|
271
|
+
), u = t.querySelectorAll(
|
|
235
272
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
236
|
-
),
|
|
273
|
+
), l = t.querySelectorAll(
|
|
237
274
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
238
|
-
);
|
|
239
|
-
if (n.length !== r.length)
|
|
240
|
-
return !1;
|
|
275
|
+
), f = Math.min(n.length, o.length);
|
|
241
276
|
let a = !1;
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
documentModifier:
|
|
245
|
-
product:
|
|
246
|
-
imageEl: n[
|
|
247
|
-
nameEl:
|
|
248
|
-
priceEl: c[
|
|
249
|
-
oldPriceEl:
|
|
250
|
-
omnibusPriceEl:
|
|
251
|
-
omnibusDiscountEl:
|
|
252
|
-
buttonEl: d
|
|
277
|
+
for (let d = 0; d < f; d++) {
|
|
278
|
+
const U = z({
|
|
279
|
+
documentModifier: e,
|
|
280
|
+
product: o[d],
|
|
281
|
+
imageEl: n[d] ?? null,
|
|
282
|
+
nameEl: r[d] ?? null,
|
|
283
|
+
priceEl: c[d] ?? null,
|
|
284
|
+
oldPriceEl: i[d] ?? null,
|
|
285
|
+
omnibusPriceEl: s[d] ?? null,
|
|
286
|
+
omnibusDiscountEl: u[d] ?? null,
|
|
287
|
+
buttonEl: l[d] ?? null
|
|
253
288
|
});
|
|
254
|
-
a = a ||
|
|
255
|
-
}
|
|
289
|
+
a = a || U;
|
|
290
|
+
}
|
|
291
|
+
return a;
|
|
256
292
|
}
|
|
257
|
-
function
|
|
258
|
-
const { currentNode: e, documentModifier:
|
|
293
|
+
function le(t) {
|
|
294
|
+
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
259
295
|
if (!e || !("querySelectorAll" in e))
|
|
260
296
|
return !1;
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
297
|
+
const r = L(e);
|
|
298
|
+
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
299
|
+
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
300
|
+
).length !== n.length)
|
|
301
|
+
return !1;
|
|
302
|
+
let i = I(r, o, n);
|
|
303
|
+
if (b(e) !== "list" && "querySelector" in e) {
|
|
304
|
+
const u = e.querySelector(g);
|
|
305
|
+
if (u) {
|
|
306
|
+
const l = I(
|
|
307
|
+
u,
|
|
308
|
+
o,
|
|
309
|
+
n
|
|
310
|
+
);
|
|
311
|
+
i = i || l;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return i && o.apply(new p("Updated product content in-place")), !0;
|
|
315
|
+
}
|
|
316
|
+
function w(t, e, o) {
|
|
317
|
+
if (!("querySelectorAll" in t))
|
|
263
318
|
return !1;
|
|
264
|
-
const
|
|
319
|
+
const n = t.querySelectorAll(
|
|
265
320
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
266
|
-
),
|
|
321
|
+
), r = t.querySelectorAll(
|
|
267
322
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
268
|
-
),
|
|
323
|
+
), c = t.querySelectorAll(
|
|
269
324
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
270
|
-
),
|
|
325
|
+
), i = t.querySelectorAll(
|
|
271
326
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
272
|
-
);
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
documentModifier:
|
|
277
|
-
product:
|
|
278
|
-
priceEl:
|
|
279
|
-
oldPriceEl:
|
|
280
|
-
omnibusPriceEl:
|
|
281
|
-
omnibusDiscountEl: l
|
|
282
|
-
}) && (
|
|
283
|
-
|
|
327
|
+
), s = Math.min(n.length, o.length);
|
|
328
|
+
let u = !1;
|
|
329
|
+
for (let l = 0; l < s; l++)
|
|
330
|
+
H({
|
|
331
|
+
documentModifier: e,
|
|
332
|
+
product: o[l],
|
|
333
|
+
priceEl: n[l] ?? null,
|
|
334
|
+
oldPriceEl: r[l] ?? null,
|
|
335
|
+
omnibusPriceEl: c[l] ?? null,
|
|
336
|
+
omnibusDiscountEl: i[l] ?? null
|
|
337
|
+
}) && (u = !0);
|
|
338
|
+
return u;
|
|
339
|
+
}
|
|
340
|
+
function ue(t) {
|
|
341
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
342
|
+
if (!e || !("querySelectorAll" in e))
|
|
343
|
+
return !1;
|
|
344
|
+
const r = E().recommendationProducts;
|
|
345
|
+
if (r.length === 0)
|
|
346
|
+
return !1;
|
|
347
|
+
const c = L(e);
|
|
348
|
+
let i = w(c, o, r);
|
|
349
|
+
if (b(e) !== "list" && "querySelector" in e) {
|
|
350
|
+
const u = e.querySelector(g);
|
|
351
|
+
if (u) {
|
|
352
|
+
const l = w(u, o, r);
|
|
353
|
+
i = i || l;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
284
357
|
}
|
|
285
|
-
function
|
|
286
|
-
const { currentNode: e, documentModifier:
|
|
287
|
-
if (!
|
|
358
|
+
function se(t) {
|
|
359
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = A(e);
|
|
360
|
+
if (!r)
|
|
288
361
|
return;
|
|
289
|
-
const
|
|
290
|
-
|
|
362
|
+
const c = n.alignment === "before" ? "0" : "1", i = (s, u) => {
|
|
363
|
+
o.modifyHtml(r).setAttribute(s, u);
|
|
291
364
|
};
|
|
292
|
-
|
|
365
|
+
i(y.CURRENCY, n.code), i(y.SYMBOL, n.symbol), i(y.ALIGNMENT, c), i(y.THOUSAND_SEPARATOR, n.thousandSeparator), i(y.DECIMAL_SEPARATOR, n.decimalSeparator), i(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
293
366
|
}
|
|
294
367
|
export {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
368
|
+
ce as adjustProductsToSize,
|
|
369
|
+
C as formatProductPrice,
|
|
370
|
+
A as getBlockElement,
|
|
371
|
+
_ as getCardComposition,
|
|
372
|
+
b as getCurrentLayout,
|
|
373
|
+
F as reapplySpacing,
|
|
374
|
+
G as regenerateMobileProductRows,
|
|
375
|
+
Y as regenerateProductRows,
|
|
376
|
+
ie as regenerateProductRowsWithStyles,
|
|
377
|
+
se as setCurrencyAttributes,
|
|
378
|
+
ue as updatePricesInPlace,
|
|
379
|
+
le as updateProductContentInPlace,
|
|
380
|
+
z as updateSingleProductContent
|
|
307
381
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return !!
|
|
1
|
+
import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const s = "ins-recommendation-desktop-container", i = "ins-recommendation-mobile-container", o = "ins-recommendation-list-layout", a = `.${i} { display: none; }`, d = `@media only screen and (max-width: 480px) { .${s} { display: none !important; } .${i} { display: table !important; } .${o} .${s} { display: table !important; } .${o} .${i}, .${o} .ins-recommendation-mobile-row { display: none !important; } .${o} .product-image-cell { width: 80px !important; } .${o} .product-image-cell img { max-width: 80px !important; } .${o} .button-cell { width: 80px !important; } .${o} .product-info-cell { padding: 5px 8px !important; } }`, p = `.${i}`;
|
|
3
|
+
function c(t, e) {
|
|
4
|
+
return !!t.querySelector(e);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function m(t) {
|
|
7
|
+
return t.querySelectorAll(`*${s}`).length > 0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
9
|
+
function S(t) {
|
|
10
|
+
const e = t.getDocumentRootCssNode();
|
|
11
11
|
if (!e)
|
|
12
12
|
return;
|
|
13
|
-
const n =
|
|
14
|
-
let
|
|
15
|
-
|
|
13
|
+
const n = t.getDocumentModifier();
|
|
14
|
+
let r = !1;
|
|
15
|
+
c(e, p) || (n.modifyCss(e).appendRule(a), r = !0), m(e) || (n.modifyCss(e).appendRule(d), r = !0), r && n.apply(new l("Add mobile layout CSS rules"));
|
|
16
16
|
}
|
|
17
17
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
s as CSS_CLASS_DESKTOP_CONTAINER,
|
|
19
|
+
i as CSS_CLASS_MOBILE_CONTAINER,
|
|
20
|
+
S as ensureMobileCssRulesExist
|
|
21
21
|
};
|