@useinsider/guido 3.8.0-beta.84f6c0a → 3.8.0-beta.bf9ea20
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/config/compiler/utils/recommendationCompilerUtils.js +25 -19
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +26 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +333 -285
- package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +173 -142
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +105 -132
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +23 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +64 -112
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +11 -165
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -219
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
1
|
+
import { useConfig as g } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
function
|
|
5
|
+
function y(r, n, e, o, i = "") {
|
|
6
6
|
const c = `{{${i}${r}_${n}_${e}}}`, t = `{{${i}${r}_${n}_currency}}`;
|
|
7
7
|
return o === "before" ? `${t} ${c}` : `${c} ${t}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function A(r) {
|
|
10
10
|
let n = r;
|
|
11
11
|
for (; n.children.length === 1; )
|
|
12
12
|
[n] = n.children;
|
|
13
13
|
return n;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function f(r, n, e, o, i, c) {
|
|
16
16
|
switch (n) {
|
|
17
17
|
case "productImage": {
|
|
18
18
|
const t = r.querySelector("img");
|
|
@@ -23,12 +23,15 @@ function A(r, n, e, o, i, c) {
|
|
|
23
23
|
}
|
|
24
24
|
case "productName": {
|
|
25
25
|
const t = r.querySelector("p");
|
|
26
|
-
|
|
26
|
+
if (t) {
|
|
27
|
+
const s = t.querySelector("strong") || t;
|
|
28
|
+
s.textContent = `{{${c}${e}_${o}_name}}`;
|
|
29
|
+
}
|
|
27
30
|
break;
|
|
28
31
|
}
|
|
29
32
|
case "productPrice": {
|
|
30
33
|
const t = r.querySelector("p");
|
|
31
|
-
t && (
|
|
34
|
+
t && (A(t).textContent = y(
|
|
32
35
|
e,
|
|
33
36
|
o,
|
|
34
37
|
"price",
|
|
@@ -39,7 +42,7 @@ function A(r, n, e, o, i, c) {
|
|
|
39
42
|
}
|
|
40
43
|
case "productOldPrice": {
|
|
41
44
|
const t = r.querySelector("p");
|
|
42
|
-
t && (
|
|
45
|
+
t && (A(t).textContent = y(
|
|
43
46
|
e,
|
|
44
47
|
o,
|
|
45
48
|
"original_price",
|
|
@@ -75,7 +78,10 @@ function A(r, n, e, o, i, c) {
|
|
|
75
78
|
const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
76
79
|
if (t) {
|
|
77
80
|
const s = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
78
|
-
|
|
81
|
+
if (a) {
|
|
82
|
+
const u = a.querySelector("strong") || a;
|
|
83
|
+
u.textContent = `{{${c}${e}_${o}_${s}}}`;
|
|
84
|
+
}
|
|
79
85
|
}
|
|
80
86
|
break;
|
|
81
87
|
}
|
|
@@ -86,8 +92,8 @@ function w(r, n, e, o) {
|
|
|
86
92
|
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
87
93
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
88
94
|
p.length > 0 ? p.forEach((l) => {
|
|
89
|
-
|
|
90
|
-
}) :
|
|
95
|
+
f(l, u, n, t, e, o);
|
|
96
|
+
}) : f(a, u, n, t, e, o);
|
|
91
97
|
});
|
|
92
98
|
});
|
|
93
99
|
}
|
|
@@ -99,9 +105,9 @@ function E(r, n, e, o) {
|
|
|
99
105
|
i.forEach((a, u) => {
|
|
100
106
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
101
107
|
const d = l.getAttribute("data-attribute-type") || "";
|
|
102
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
108
|
+
l.querySelectorAll(".attribute-cell").forEach((h, $) => {
|
|
103
109
|
const S = u * s + $;
|
|
104
|
-
|
|
110
|
+
f(h, d, n, S, e, o);
|
|
105
111
|
});
|
|
106
112
|
});
|
|
107
113
|
});
|
|
@@ -115,7 +121,7 @@ function P(r, n, e) {
|
|
|
115
121
|
const o = r.getAttribute("data-layout") || "grid", i = r.getAttribute("currency-alignment") || "after";
|
|
116
122
|
o === "list" ? w(r, n, i, e) : R(r, n, i, e);
|
|
117
123
|
}
|
|
118
|
-
function
|
|
124
|
+
function b(r, n, e) {
|
|
119
125
|
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), i = r.match(o);
|
|
120
126
|
return i ? parseInt(i[1]) : e;
|
|
121
127
|
}
|
|
@@ -132,14 +138,14 @@ function T(r, n) {
|
|
|
132
138
|
return null;
|
|
133
139
|
}
|
|
134
140
|
function v(r) {
|
|
135
|
-
const n = r.getAttribute("style") || "", e =
|
|
141
|
+
const n = r.getAttribute("style") || "", e = b(n, "width", 600), o = b(n, "padding", 0) * 2, i = Math.max(0, e - o);
|
|
136
142
|
i !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
137
143
|
if (c.hasAttribute("width"))
|
|
138
144
|
return;
|
|
139
145
|
const t = T(c, r);
|
|
140
146
|
if (!t)
|
|
141
147
|
return;
|
|
142
|
-
const s = t.getAttribute("width"), a = parseFloat(s), u =
|
|
148
|
+
const s = t.getAttribute("width"), a = parseFloat(s), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(i * a / 100), l = Math.max(1, p - u);
|
|
143
149
|
c.setAttribute("width", String(l));
|
|
144
150
|
const d = c.getAttribute("style") || "";
|
|
145
151
|
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
@@ -157,9 +163,9 @@ function N(r) {
|
|
|
157
163
|
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
158
164
|
if (!o.length)
|
|
159
165
|
return r;
|
|
160
|
-
const { buildCampaignUrl: i } =
|
|
166
|
+
const { buildCampaignUrl: i } = _(), c = C();
|
|
161
167
|
c.recommendationCampaignUrls = {};
|
|
162
|
-
const { isFeatureEnabled: t } =
|
|
168
|
+
const { isFeatureEnabled: t } = g(), s = t("liquidSyntax") ? "reco_" : "";
|
|
163
169
|
return o.forEach((u) => {
|
|
164
170
|
var l, d;
|
|
165
171
|
const p = u.getAttribute("recommendation-id");
|
|
@@ -167,6 +173,6 @@ function N(r) {
|
|
|
167
173
|
}), O(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
168
174
|
}
|
|
169
175
|
export {
|
|
170
|
-
|
|
176
|
+
y as formatPriceVariable,
|
|
171
177
|
N as prepareRecommendationBlocks
|
|
172
178
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BlockId as
|
|
1
|
+
import { BlockId as u } from "../../../enums/block.js";
|
|
2
2
|
import { useOnboardingStore as p } from "../../../stores/onboarding.js";
|
|
3
|
-
import { getMigrationBannerHtml as
|
|
4
|
-
import { Block as
|
|
5
|
-
import { SETTINGS_ENUMS as
|
|
6
|
-
import { getDefaultTemplate as
|
|
7
|
-
import { getItemsBlockContainer as
|
|
8
|
-
const
|
|
9
|
-
class E extends
|
|
3
|
+
import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
|
|
4
|
+
import { Block as I, BlockCompositionType as y, ModificationDescription as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { SETTINGS_ENUMS as c, DefaultConfigValues as a } from "./enums/settingsEnums.js";
|
|
6
|
+
import { getDefaultTemplate as h } from "./template.js";
|
|
7
|
+
import { getItemsBlockContainer as l, getItemsBlockConfig as m, getDefaultItemsBlockConfig as b } from "./utils/nodeConfigUtils.js";
|
|
8
|
+
const d = u.Items;
|
|
9
|
+
class E extends I {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return d;
|
|
12
12
|
}
|
|
13
13
|
getIcon() {
|
|
14
14
|
return "items-icon";
|
|
15
15
|
}
|
|
16
16
|
getBlockCompositionType() {
|
|
17
|
-
return
|
|
17
|
+
return y.CONTAINER;
|
|
18
18
|
}
|
|
19
19
|
getName() {
|
|
20
20
|
return this.api.translate("Items");
|
|
@@ -23,41 +23,60 @@ class E extends u {
|
|
|
23
23
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
24
24
|
}
|
|
25
25
|
getSettingsPanelTitleHtml() {
|
|
26
|
-
return
|
|
27
|
-
|
|
26
|
+
return C(
|
|
27
|
+
d,
|
|
28
28
|
this.api.translate("Items"),
|
|
29
29
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
getTemplate() {
|
|
33
|
-
return
|
|
34
|
-
orientation:
|
|
35
|
-
itemsType:
|
|
33
|
+
return h({
|
|
34
|
+
orientation: c.ORIENTATION.VERTICAL,
|
|
35
|
+
itemsType: c.ITEMS_TYPE.CART_ITEMS,
|
|
36
36
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
37
|
-
currencySymbol:
|
|
38
|
-
currencyLocation:
|
|
39
|
-
formattedPrice:
|
|
37
|
+
currencySymbol: a.productPriceCurrencySymbolControlValue,
|
|
38
|
+
currencyLocation: a.productPriceCurrencyLocationControlValue,
|
|
39
|
+
formattedPrice: a.productPriceFormattedControlValue === "1"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
allowInnerBlocksDND() {
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
canBeSavedAsModule() {
|
|
46
|
+
return !0;
|
|
47
|
+
}
|
|
48
|
+
onCreated(i) {
|
|
49
|
+
const n = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
|
|
50
|
+
r.querySelector('[product-attr="imageSrc"] img') || n.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
51
|
+
const t = l(i);
|
|
52
|
+
if (!t)
|
|
50
53
|
return;
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
+
const e = t.getNodeConfig(), g = e && Object.keys(e).length > 0, o = m(i);
|
|
55
|
+
if (o != null && o.initialized)
|
|
56
|
+
g ? o.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...o, blockInstanceId: String(Date.now()) }).apply(new s("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new s("Migrate legacy config to nodeConfig"));
|
|
54
57
|
else {
|
|
55
|
-
const
|
|
56
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
58
|
+
const f = b();
|
|
59
|
+
this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(f).apply(new s("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
|
|
57
60
|
}
|
|
58
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
64
|
+
* surfaces via document load. Stripo strips esd-ext-config and never restores it
|
|
65
|
+
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
66
|
+
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
67
|
+
*/
|
|
68
|
+
onDocumentChanged(i) {
|
|
69
|
+
const n = l(i);
|
|
70
|
+
if (!n)
|
|
71
|
+
return;
|
|
72
|
+
const r = n.getNodeConfig();
|
|
73
|
+
if (r && Object.keys(r).length > 0)
|
|
74
|
+
return;
|
|
75
|
+
const e = m(i);
|
|
76
|
+
e != null && e.initialized && this.api.getDocumentModifier().modifyHtml(n).setNodeConfig(e).apply(new s("Recover Items block config from saved module"));
|
|
77
|
+
}
|
|
59
78
|
}
|
|
60
79
|
export {
|
|
61
|
-
|
|
80
|
+
d as BLOCK_ID,
|
|
62
81
|
E as ItemsBlock
|
|
63
82
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { DefaultConfigValues as
|
|
2
|
+
import { DefaultConfigValues as i, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
|
|
3
3
|
function _() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
6
|
const E = (r) => r.replace(/\$/g, "$$$$");
|
|
7
|
-
function
|
|
7
|
+
function y() {
|
|
8
8
|
return {
|
|
9
9
|
initialized: !0,
|
|
10
10
|
blockInstanceId: _(),
|
|
11
11
|
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
12
|
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
13
|
-
itemsSelectValue:
|
|
13
|
+
itemsSelectValue: i.cartItemsSelectControlValue,
|
|
14
14
|
orientation: n.ORIENTATION.VERTICAL,
|
|
15
|
-
nameTrimming:
|
|
16
|
-
priceHideDiscount:
|
|
17
|
-
priceFormatted:
|
|
15
|
+
nameTrimming: i.productNameTrimmingControlValue === "1",
|
|
16
|
+
priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
|
|
17
|
+
priceFormatted: i.productPriceFormattedControlValue === "1",
|
|
18
18
|
priceSinglePrice: !1,
|
|
19
|
-
priceCurrencySymbol:
|
|
20
|
-
priceCurrencyLocation:
|
|
19
|
+
priceCurrencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
20
|
+
priceCurrencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
21
21
|
priceOrientation: "horizontal",
|
|
22
|
-
quantityControlEnabled:
|
|
23
|
-
buttonLink:
|
|
24
|
-
imageLink:
|
|
22
|
+
quantityControlEnabled: i.productQuantityControlEnabled === "1",
|
|
23
|
+
buttonLink: i.productButtonLinkControlValue,
|
|
24
|
+
imageLink: i.productImageLinkControlValue,
|
|
25
25
|
buttonLabel: "Buy",
|
|
26
26
|
buttonFullWidth: !0,
|
|
27
27
|
// Default to full width (es-fw class)
|
|
28
|
-
imageVisible:
|
|
29
|
-
nameVisible:
|
|
30
|
-
quantityVisible:
|
|
31
|
-
priceVisible:
|
|
32
|
-
originalPriceVisible:
|
|
33
|
-
buttonVisible:
|
|
28
|
+
imageVisible: i.productImageVisible === "1",
|
|
29
|
+
nameVisible: i.productNameVisible === "1",
|
|
30
|
+
quantityVisible: i.productQuantityVisible === "1",
|
|
31
|
+
priceVisible: i.productPriceVisible === "1",
|
|
32
|
+
originalPriceVisible: i.productOriginalPriceVisible === "1",
|
|
33
|
+
buttonVisible: i.productButtonVisible === "1"
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function p(r) {
|
|
@@ -50,26 +50,26 @@ function m(r) {
|
|
|
50
50
|
PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
|
|
51
51
|
}[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function f(r, t) {
|
|
54
54
|
if (!r)
|
|
55
|
-
return
|
|
55
|
+
return i.cartItemsSelectControlValue;
|
|
56
56
|
if (r.includes("{{"))
|
|
57
57
|
return r;
|
|
58
58
|
if (/^\d+$/.test(r)) {
|
|
59
|
-
const e = parseInt(r) - 1,
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
59
|
+
const e = parseInt(r) - 1, o = g[t];
|
|
60
|
+
if (o && o[e])
|
|
61
|
+
return o[e].value;
|
|
62
62
|
}
|
|
63
|
-
return
|
|
63
|
+
return i.cartItemsSelectControlValue;
|
|
64
64
|
}
|
|
65
65
|
function C(r) {
|
|
66
66
|
const t = r.querySelector("esd-config-block");
|
|
67
67
|
if (!t)
|
|
68
68
|
return null;
|
|
69
|
-
const e = (
|
|
69
|
+
const e = (u, s) => u == null ? s : u === "1" || u === "true", o = (u, s) => u || s, c = t.getAttribute("data-type"), a = m(c), d = t.getAttribute("data-cart_items_select_control_value"), l = f(d, a);
|
|
70
70
|
return {
|
|
71
71
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
|
-
blockInstanceId:
|
|
72
|
+
blockInstanceId: o(
|
|
73
73
|
t.getAttribute("data-block-instance-id"),
|
|
74
74
|
_()
|
|
75
75
|
),
|
|
@@ -93,28 +93,28 @@ function C(r) {
|
|
|
93
93
|
t.getAttribute("data-product_price_control_single_price"),
|
|
94
94
|
!1
|
|
95
95
|
),
|
|
96
|
-
priceCurrencySymbol:
|
|
96
|
+
priceCurrencySymbol: o(
|
|
97
97
|
t.getAttribute("data-product_price_control_currency_symbol"),
|
|
98
|
-
|
|
98
|
+
i.productPriceCurrencySymbolControlValue
|
|
99
99
|
),
|
|
100
|
-
priceCurrencyLocation:
|
|
100
|
+
priceCurrencyLocation: o(
|
|
101
101
|
t.getAttribute("data-product_price_currency_location"),
|
|
102
|
-
|
|
102
|
+
i.productPriceCurrencyLocationControlValue
|
|
103
103
|
),
|
|
104
104
|
priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
|
|
105
105
|
quantityControlEnabled: e(
|
|
106
106
|
t.getAttribute("data-product_quantity_control_enabled"),
|
|
107
107
|
!0
|
|
108
108
|
),
|
|
109
|
-
buttonLink:
|
|
109
|
+
buttonLink: o(
|
|
110
110
|
t.getAttribute("data-product_button_link"),
|
|
111
|
-
|
|
111
|
+
i.productButtonLinkControlValue
|
|
112
112
|
),
|
|
113
|
-
imageLink:
|
|
113
|
+
imageLink: o(
|
|
114
114
|
t.getAttribute("data-product_image_link"),
|
|
115
|
-
|
|
115
|
+
i.productImageLinkControlValue
|
|
116
116
|
),
|
|
117
|
-
buttonLabel:
|
|
117
|
+
buttonLabel: o(
|
|
118
118
|
t.getAttribute("data-product_button_control_label"),
|
|
119
119
|
"Buy"
|
|
120
120
|
),
|
|
@@ -149,28 +149,45 @@ function C(r) {
|
|
|
149
149
|
)
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function I(r) {
|
|
153
|
+
if (typeof r.getAttribute != "function")
|
|
154
|
+
return null;
|
|
155
|
+
const t = r.getAttribute("esd-ext-config");
|
|
156
|
+
if (!t)
|
|
157
|
+
return null;
|
|
158
|
+
try {
|
|
159
|
+
const e = JSON.parse(t);
|
|
160
|
+
if (e && e.initialized)
|
|
161
|
+
return e;
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
function A(r) {
|
|
153
167
|
const t = p(r);
|
|
154
168
|
if (!t)
|
|
155
169
|
return null;
|
|
156
170
|
const e = t.getNodeConfig();
|
|
157
171
|
if (e && e.initialized)
|
|
158
172
|
return e;
|
|
159
|
-
const
|
|
160
|
-
|
|
173
|
+
const o = I(t);
|
|
174
|
+
if (o)
|
|
175
|
+
return o;
|
|
176
|
+
const c = C(t);
|
|
177
|
+
return c || null;
|
|
161
178
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
179
|
+
function V(r, t, e, o) {
|
|
180
|
+
const c = p(r);
|
|
181
|
+
if (!c)
|
|
165
182
|
return;
|
|
166
|
-
const d = { ...
|
|
167
|
-
l.modifyHtml(
|
|
183
|
+
const d = { ...c.getNodeConfig() || {}, ...e }, l = o ?? t.getDocumentModifier();
|
|
184
|
+
l.modifyHtml(c).setNodeConfig(d), o || l.apply(new b("Update Items block configuration"));
|
|
168
185
|
}
|
|
169
186
|
export {
|
|
170
187
|
E as escapeReplacement,
|
|
171
188
|
_ as generateBlockInstanceId,
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
y as getDefaultItemsBlockConfig,
|
|
190
|
+
A as getItemsBlockConfig,
|
|
174
191
|
p as getItemsBlockContainer,
|
|
175
|
-
|
|
192
|
+
V as setItemsBlockConfig
|
|
176
193
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container",
|
|
1
|
+
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", n = ".ins-recommendation-mobile-container", t = ".ins-recommendation-mobile-row", r = "reco-v3-button", _ = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
}, R = "productImage", e = "productName", O = "productPrice", s = "productOldPrice",
|
|
8
|
+
}, R = "productImage", e = "productName", O = "productPrice", s = "productOldPrice", i = "productOmnibusPrice", C = "productOmnibusDiscount", E = "productButton", A = "customAttr:", u = "data-custom-attributes", m = "product-attr", a = /* @__PURE__ */ new Set([
|
|
9
9
|
"name",
|
|
10
10
|
// productName
|
|
11
11
|
"price",
|
|
@@ -24,21 +24,20 @@ const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container
|
|
|
24
24
|
export {
|
|
25
25
|
A as ATTR_CUSTOM_PREFIX,
|
|
26
26
|
u as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
m as ATTR_PRODUCT_ATTR,
|
|
28
|
+
E as ATTR_PRODUCT_BUTTON,
|
|
29
29
|
R as ATTR_PRODUCT_IMAGE,
|
|
30
30
|
e as ATTR_PRODUCT_NAME,
|
|
31
31
|
s as ATTR_PRODUCT_OLD_PRICE,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
C as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
33
|
+
i as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
34
34
|
O as ATTR_PRODUCT_PRICE,
|
|
35
35
|
T as BLOCK_ROOT_SELECTOR,
|
|
36
|
-
|
|
36
|
+
a as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
37
37
|
c as CONTAINER_SELECTOR,
|
|
38
38
|
r as CSS_CLASS_RECO_BUTTON,
|
|
39
39
|
_ as CURRENCY_ATTR,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
m as PRODUCT_ATTRIBUTE_PREFIX
|
|
40
|
+
o as DESKTOP_CONTAINER_SELECTOR,
|
|
41
|
+
n as MOBILE_CONTAINER_SELECTOR,
|
|
42
|
+
t as MOBILE_ROW_SELECTOR
|
|
44
43
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
2
|
+
var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
|
-
import { DEFAULT_NODE_CONFIG as
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
6
|
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
8
|
import { AlgorithmControl as R } from "./algorithm.js";
|
|
@@ -16,13 +16,13 @@ import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
|
16
16
|
import { LocaleControl as _ } from "./locale.js";
|
|
17
17
|
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
18
18
|
import { ProductCountControl as O } from "./productCount.js";
|
|
19
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
19
|
+
import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
|
|
20
20
|
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
21
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
22
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
23
|
import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
|
|
24
24
|
import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as k, regenerateProductRowsWithStyles as D } from "./utils.js";
|
|
25
|
-
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt,
|
|
25
|
+
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Rt, updatePricesInPlace as bt, updateSingleProductContent as Nt } from "./utils.js";
|
|
26
26
|
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
27
|
const E = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
28
28
|
class K extends g {
|
|
@@ -241,26 +241,26 @@ class K extends g {
|
|
|
241
241
|
return;
|
|
242
242
|
const t = h.getConfig(this.currentNode), e = {};
|
|
243
243
|
let o = null, r = null, n = null;
|
|
244
|
-
if (t.currency.code ===
|
|
244
|
+
if (t.currency.code === a.currency.code) {
|
|
245
245
|
const { currencyList: i } = this.store;
|
|
246
246
|
i.length > 0 && (i.some(
|
|
247
|
-
(u) => u.value === `price.${
|
|
247
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
248
248
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
249
|
-
...
|
|
249
|
+
...a.currency,
|
|
250
250
|
code: o,
|
|
251
251
|
symbol: o
|
|
252
252
|
}));
|
|
253
253
|
}
|
|
254
|
-
if (t.strategy ===
|
|
254
|
+
if (t.strategy === a.strategy) {
|
|
255
255
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
256
256
|
i.length > 0 && (i.some(
|
|
257
|
-
(u) => u.value ===
|
|
257
|
+
(u) => u.value === a.strategy
|
|
258
258
|
) || (r = i[0].value, e.strategy = r));
|
|
259
259
|
}
|
|
260
|
-
if (t.language ===
|
|
260
|
+
if (t.language === a.language) {
|
|
261
261
|
const i = this.store.getLanguages;
|
|
262
262
|
i.length > 0 && (i.some(
|
|
263
|
-
(u) => u.value ===
|
|
263
|
+
(u) => u.value === a.language
|
|
264
264
|
) || (n = i[0].value, e.language = n));
|
|
265
265
|
}
|
|
266
266
|
!o && !r && !n || (h.updateConfig(
|
|
@@ -278,10 +278,10 @@ class K extends g {
|
|
|
278
278
|
name: o,
|
|
279
279
|
value: o,
|
|
280
280
|
symbol: o,
|
|
281
|
-
alignment:
|
|
282
|
-
decimalCount:
|
|
283
|
-
decimalSeparator:
|
|
284
|
-
thousandSeparator:
|
|
281
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
282
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
283
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
284
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
285
285
|
}
|
|
286
286
|
} : {},
|
|
287
287
|
...r ? { strategy: r } : {},
|
|
@@ -325,8 +325,8 @@ class K extends g {
|
|
|
325
325
|
}
|
|
326
326
|
const i = t.$state.configVersion;
|
|
327
327
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
328
|
-
const
|
|
329
|
-
u && f && (e =
|
|
328
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
329
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
/**
|
|
@@ -357,8 +357,8 @@ export {
|
|
|
357
357
|
it as LOCALE_CONTROL_ID,
|
|
358
358
|
I as LayoutOrientationControl,
|
|
359
359
|
_ as LocaleControl,
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
361
|
+
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
362
362
|
O as ProductCountControl,
|
|
363
363
|
T as ProductLayoutControl,
|
|
364
364
|
K as RecommendationBlockControl,
|
|
@@ -369,10 +369,12 @@ export {
|
|
|
369
369
|
P as getBlockElement,
|
|
370
370
|
Ct as getCardComposition,
|
|
371
371
|
pt as getCurrentLayout,
|
|
372
|
-
gt as
|
|
372
|
+
gt as reapplySpacing,
|
|
373
|
+
yt as regenerateMobileProductRows,
|
|
374
|
+
Rt as regenerateProductRows,
|
|
373
375
|
D as regenerateProductRowsWithStyles,
|
|
374
376
|
L as setCurrencyAttributes,
|
|
375
|
-
|
|
377
|
+
bt as updatePricesInPlace,
|
|
376
378
|
k as updateProductContentInPlace,
|
|
377
|
-
|
|
379
|
+
Nt as updateSingleProductContent
|
|
378
380
|
};
|