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