@useinsider/guido 3.7.2-beta.af89512 → 3.7.2-beta.b445a7a
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/composables/useHtmlCompiler.js +6 -8
- package/dist/config/compiler/htmlCompilerRules.js +7 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +19 -25
- package/dist/config/migrator/index.js +7 -8
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +24 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +30 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +28 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +285 -333
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -30
- package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +219 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- package/dist/src/extensions/Blocks/Items/controls/index.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 +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
- 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 +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- package/package.json +1 -1
- package/dist/config/migrator/fontTagMigrator.js +0 -7
- package/dist/src/config/migrator/fontTagMigrator.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/utils/stripFontTags.d.ts +0 -13
- package/dist/utils/stripFontTags.js +0 -13
|
@@ -13,8 +13,6 @@ const y = /* @__PURE__ */ new Set([
|
|
|
13
13
|
"fix-url-encoding-end",
|
|
14
14
|
"fix-tags-start",
|
|
15
15
|
"fix-tags-end",
|
|
16
|
-
// Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
|
|
17
|
-
"strip-font-tags",
|
|
18
16
|
// Image domain corrections — plain string replacement.
|
|
19
17
|
"replace-old-image-domain",
|
|
20
18
|
"replace-old-v2-image-domain",
|
|
@@ -28,22 +26,22 @@ const y = /* @__PURE__ */ new Set([
|
|
|
28
26
|
// Coupon placeholder replacement (only present when liquidSyntax is enabled).
|
|
29
27
|
"liquid-coupon-code"
|
|
30
28
|
]), M = () => {
|
|
31
|
-
var
|
|
32
|
-
const { compiler: e, isFeatureEnabled: a, partner: n } = k(),
|
|
33
|
-
...!!((
|
|
29
|
+
var m, t, r;
|
|
30
|
+
const { compiler: e, isFeatureEnabled: a, partner: n } = k(), u = ((m = e.value) == null ? void 0 : m.customRules) || [], l = [
|
|
31
|
+
...!!((t = e.value) != null && t.ignoreDefaultRules) ? [] : R,
|
|
34
32
|
...v,
|
|
35
33
|
...x,
|
|
36
34
|
...g,
|
|
37
35
|
...b,
|
|
38
36
|
...H,
|
|
39
37
|
...a("liquidSyntax") ? C : [],
|
|
40
|
-
...
|
|
38
|
+
...u.map((o, f) => ({
|
|
41
39
|
...o,
|
|
42
40
|
priority: o.priority + 1e3 + f
|
|
43
41
|
// Ensure additional rules run after default rules
|
|
44
42
|
}))
|
|
45
|
-
],
|
|
46
|
-
return { compileHtml: (o) =>
|
|
43
|
+
], p = s(l), c = l.filter((o) => y.has(o.id)), d = s(c), i = (r = n.value) == null ? void 0 : r.fallbackFont;
|
|
44
|
+
return { compileHtml: (o) => p.compile(o, void 0, i), compileAmpHtml: (o) => d.compile(o, void 0, i) };
|
|
47
45
|
};
|
|
48
46
|
export {
|
|
49
47
|
M as useHtmlCompiler
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const l = [
|
|
1
|
+
const a = [
|
|
3
2
|
{
|
|
4
3
|
id: "fix-url-encoding-start",
|
|
5
4
|
description: "Replace {%22 with %7B%22 to fix URL encoding",
|
|
@@ -54,13 +53,6 @@ const l = [
|
|
|
54
53
|
replaceAll: !0,
|
|
55
54
|
priority: 14
|
|
56
55
|
},
|
|
57
|
-
{
|
|
58
|
-
id: "strip-font-tags",
|
|
59
|
-
description: 'Unwrap <font dir="auto"> tags injected by browser translate extensions (e.g. Google Translate), keeping inner content — prevents Chrome DOM-depth overflow ("512 nodes"). Other <font> elements are left intact.',
|
|
60
|
-
type: "custom",
|
|
61
|
-
processor: (e) => n(e),
|
|
62
|
-
priority: 15
|
|
63
|
-
},
|
|
64
56
|
{
|
|
65
57
|
id: "remove-apty-iframe",
|
|
66
58
|
description: "Cleanup Apty Iframe Code",
|
|
@@ -99,7 +91,7 @@ const l = [
|
|
|
99
91
|
description: "Adding MSO Conditions",
|
|
100
92
|
type: "custom",
|
|
101
93
|
processor: (e) => {
|
|
102
|
-
const
|
|
94
|
+
const t = [
|
|
103
95
|
`<!--[if gte mso 9]>
|
|
104
96
|
<style>sup {
|
|
105
97
|
font-size: 100% !important;
|
|
@@ -122,10 +114,10 @@ const l = [
|
|
|
122
114
|
], s = /<head>([\S\s]*)<\/head>/, o = new RegExp(s);
|
|
123
115
|
if (!e.match(o))
|
|
124
116
|
return e;
|
|
125
|
-
let
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
}),
|
|
117
|
+
let i = e;
|
|
118
|
+
return t.forEach((r) => {
|
|
119
|
+
i = i.replace("</head>", `${r}</head>`);
|
|
120
|
+
}), i;
|
|
129
121
|
},
|
|
130
122
|
priority: 30
|
|
131
123
|
},
|
|
@@ -149,5 +141,5 @@ const l = [
|
|
|
149
141
|
}
|
|
150
142
|
];
|
|
151
143
|
export {
|
|
152
|
-
|
|
144
|
+
a as defaultHtmlCompilerRules
|
|
153
145
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as g } 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 h(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 b(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 A(r, n, e, o, i, c) {
|
|
16
16
|
switch (n) {
|
|
17
17
|
case "productImage": {
|
|
18
18
|
const t = r.querySelector("img");
|
|
@@ -23,15 +23,12 @@ function f(r, n, e, o, i, c) {
|
|
|
23
23
|
}
|
|
24
24
|
case "productName": {
|
|
25
25
|
const t = r.querySelector("p");
|
|
26
|
-
|
|
27
|
-
const s = t.querySelector("strong") || t;
|
|
28
|
-
s.textContent = `{{${c}${e}_${o}_name}}`;
|
|
29
|
-
}
|
|
26
|
+
t && (b(t).textContent = `{{${c}${e}_${o}_name}}`);
|
|
30
27
|
break;
|
|
31
28
|
}
|
|
32
29
|
case "productPrice": {
|
|
33
30
|
const t = r.querySelector("p");
|
|
34
|
-
t && (
|
|
31
|
+
t && (b(t).textContent = h(
|
|
35
32
|
e,
|
|
36
33
|
o,
|
|
37
34
|
"price",
|
|
@@ -42,7 +39,7 @@ function f(r, n, e, o, i, c) {
|
|
|
42
39
|
}
|
|
43
40
|
case "productOldPrice": {
|
|
44
41
|
const t = r.querySelector("p");
|
|
45
|
-
t && (
|
|
42
|
+
t && (b(t).textContent = h(
|
|
46
43
|
e,
|
|
47
44
|
o,
|
|
48
45
|
"original_price",
|
|
@@ -78,10 +75,7 @@ function f(r, n, e, o, i, c) {
|
|
|
78
75
|
const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
79
76
|
if (t) {
|
|
80
77
|
const s = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
81
|
-
|
|
82
|
-
const u = a.querySelector("strong") || a;
|
|
83
|
-
u.textContent = `{{${c}${e}_${o}_${s}}}`;
|
|
84
|
-
}
|
|
78
|
+
a && (b(a).textContent = `{{${c}${e}_${o}_${s}}}`);
|
|
85
79
|
}
|
|
86
80
|
break;
|
|
87
81
|
}
|
|
@@ -92,8 +86,8 @@ function w(r, n, e, o) {
|
|
|
92
86
|
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
93
87
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
94
88
|
p.length > 0 ? p.forEach((l) => {
|
|
95
|
-
|
|
96
|
-
}) :
|
|
89
|
+
A(l, u, n, t, e, o);
|
|
90
|
+
}) : A(a, u, n, t, e, o);
|
|
97
91
|
});
|
|
98
92
|
});
|
|
99
93
|
}
|
|
@@ -105,9 +99,9 @@ function E(r, n, e, o) {
|
|
|
105
99
|
i.forEach((a, u) => {
|
|
106
100
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
107
101
|
const d = l.getAttribute("data-attribute-type") || "";
|
|
108
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
102
|
+
l.querySelectorAll(".attribute-cell").forEach((y, $) => {
|
|
109
103
|
const S = u * s + $;
|
|
110
|
-
|
|
104
|
+
A(y, d, n, S, e, o);
|
|
111
105
|
});
|
|
112
106
|
});
|
|
113
107
|
});
|
|
@@ -121,7 +115,7 @@ function P(r, n, e) {
|
|
|
121
115
|
const o = r.getAttribute("data-layout") || "grid", i = r.getAttribute("currency-alignment") || "after";
|
|
122
116
|
o === "list" ? w(r, n, i, e) : R(r, n, i, e);
|
|
123
117
|
}
|
|
124
|
-
function
|
|
118
|
+
function f(r, n, e) {
|
|
125
119
|
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), i = r.match(o);
|
|
126
120
|
return i ? parseInt(i[1]) : e;
|
|
127
121
|
}
|
|
@@ -138,14 +132,14 @@ function T(r, n) {
|
|
|
138
132
|
return null;
|
|
139
133
|
}
|
|
140
134
|
function v(r) {
|
|
141
|
-
const n = r.getAttribute("style") || "", e =
|
|
135
|
+
const n = r.getAttribute("style") || "", e = f(n, "width", 600), o = f(n, "padding", 0) * 2, i = Math.max(0, e - o);
|
|
142
136
|
i !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
143
137
|
if (c.hasAttribute("width"))
|
|
144
138
|
return;
|
|
145
139
|
const t = T(c, r);
|
|
146
140
|
if (!t)
|
|
147
141
|
return;
|
|
148
|
-
const s = t.getAttribute("width"), a = parseFloat(s), u =
|
|
142
|
+
const s = t.getAttribute("width"), a = parseFloat(s), u = f(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(i * a / 100), l = Math.max(1, p - u);
|
|
149
143
|
c.setAttribute("width", String(l));
|
|
150
144
|
const d = c.getAttribute("style") || "";
|
|
151
145
|
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
@@ -163,9 +157,9 @@ function N(r) {
|
|
|
163
157
|
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
164
158
|
if (!o.length)
|
|
165
159
|
return r;
|
|
166
|
-
const { buildCampaignUrl: i } =
|
|
160
|
+
const { buildCampaignUrl: i } = g(), c = C();
|
|
167
161
|
c.recommendationCampaignUrls = {};
|
|
168
|
-
const { isFeatureEnabled: t } =
|
|
162
|
+
const { isFeatureEnabled: t } = _(), s = t("liquidSyntax") ? "reco_" : "";
|
|
169
163
|
return o.forEach((u) => {
|
|
170
164
|
var l, d;
|
|
171
165
|
const p = u.getAttribute("recommendation-id");
|
|
@@ -173,6 +167,6 @@ function N(r) {
|
|
|
173
167
|
}), O(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
174
168
|
}
|
|
175
169
|
export {
|
|
176
|
-
|
|
170
|
+
h as formatPriceVariable,
|
|
177
171
|
N as prepareRecommendationBlocks
|
|
178
172
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { migrateCheckbox as o } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const k = async (r, t = {}) => {
|
|
3
|
+
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
|
+
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
7
|
+
const b = async (r, t = {}) => {
|
|
9
8
|
let m = r;
|
|
10
|
-
return m =
|
|
9
|
+
return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
|
|
11
10
|
};
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
b as migrate
|
|
14
13
|
};
|
|
@@ -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", t = ".ins-recommendation-desktop-container", o = ".ins-recommendation-mobile-container", n = ".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", E = "productOmnibusPrice", i = "productOmnibusDiscount", C = "productButton", A = "customAttr:", u = "data-custom-attributes", a = "product-attr", m = "product_attribute.", U = /* @__PURE__ */ new Set([
|
|
9
9
|
"name",
|
|
10
10
|
// productName
|
|
11
11
|
"price",
|
|
@@ -24,20 +24,21 @@ 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
|
+
a as ATTR_PRODUCT_ATTR,
|
|
28
|
+
C 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
|
+
i as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
33
|
+
E as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
34
34
|
O as ATTR_PRODUCT_PRICE,
|
|
35
35
|
T as BLOCK_ROOT_SELECTOR,
|
|
36
|
-
|
|
36
|
+
U 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
|
-
|
|
40
|
+
t as DESKTOP_CONTAINER_SELECTOR,
|
|
41
|
+
o as MOBILE_CONTAINER_SELECTOR,
|
|
42
|
+
n as MOBILE_ROW_SELECTOR,
|
|
43
|
+
m as PRODUCT_ATTRIBUTE_PREFIX
|
|
43
44
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
2
|
+
var p = (d, a, t) => a in d ? C(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
|
|
3
|
+
var s = (d, a, t) => p(d, typeof a != "symbol" ? a + "" : a, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
|
-
import { DEFAULT_NODE_CONFIG as
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as l } 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 lt } 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 ct } 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, regenerateMobileProductRows as gt, updatePricesInPlace as yt, updateSingleProductContent as Rt } 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 === l.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.${l.currency.code}`
|
|
248
248
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
249
|
-
...
|
|
249
|
+
...l.currency,
|
|
250
250
|
code: o,
|
|
251
251
|
symbol: o
|
|
252
252
|
}));
|
|
253
253
|
}
|
|
254
|
-
if (t.strategy ===
|
|
254
|
+
if (t.strategy === l.strategy) {
|
|
255
255
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
256
256
|
i.length > 0 && (i.some(
|
|
257
|
-
(u) => u.value ===
|
|
257
|
+
(u) => u.value === l.strategy
|
|
258
258
|
) || (r = i[0].value, e.strategy = r));
|
|
259
259
|
}
|
|
260
|
-
if (t.language ===
|
|
260
|
+
if (t.language === l.language) {
|
|
261
261
|
const i = this.store.getLanguages;
|
|
262
262
|
i.length > 0 && (i.some(
|
|
263
|
-
(u) => u.value ===
|
|
263
|
+
(u) => u.value === l.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: l.currency.alignment === "before" ? "0" : "1",
|
|
282
|
+
decimalCount: l.currency.decimalCount.toString(),
|
|
283
|
+
decimalSeparator: l.currency.decimalSeparator,
|
|
284
|
+
thousandSeparator: l.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 c = t.recommendationProducts, u = c !== e, f = Array.isArray(c) && c.length > 0;
|
|
329
|
+
u && f && (e = c, 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
|
+
lt as PRODUCT_COUNT_CONTROL_ID,
|
|
361
|
+
ct as PRODUCT_LAYOUT_CONTROL_ID,
|
|
362
362
|
O as ProductCountControl,
|
|
363
363
|
T as ProductLayoutControl,
|
|
364
364
|
K as RecommendationBlockControl,
|
|
@@ -369,12 +369,10 @@ export {
|
|
|
369
369
|
P as getBlockElement,
|
|
370
370
|
Ct as getCardComposition,
|
|
371
371
|
pt as getCurrentLayout,
|
|
372
|
-
gt as
|
|
373
|
-
yt as regenerateMobileProductRows,
|
|
374
|
-
Rt as regenerateProductRows,
|
|
372
|
+
gt as regenerateMobileProductRows,
|
|
375
373
|
D as regenerateProductRowsWithStyles,
|
|
376
374
|
L as setCurrencyAttributes,
|
|
377
|
-
|
|
375
|
+
yt as updatePricesInPlace,
|
|
378
376
|
k as updateProductContentInPlace,
|
|
379
|
-
|
|
377
|
+
Rt as updateSingleProductContent
|
|
380
378
|
};
|
|
@@ -1,64 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var _ = (o, e, t) => e in o ? L(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var s = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as N } from "../../../common-control.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
|
|
12
|
-
const U = "recommendation-layout-orientation-control", O = "recommendationInfoBannerTest", a = {
|
|
6
|
+
import { LAYOUT_OPTIONS as O, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as a } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as A } from "../../store/recommendation.js";
|
|
9
|
+
import { getCurrentLayout as C, getBlockElement as f, getCardComposition as S, regenerateProductRowsWithStyles as T } from "./utils.js";
|
|
10
|
+
const I = "recommendation-layout-orientation-control", u = {
|
|
13
11
|
LAYOUT: "layout"
|
|
14
|
-
},
|
|
12
|
+
}, n = {
|
|
15
13
|
LAYOUT: "data-layout",
|
|
16
14
|
COLUMN_SPACING: "data-column-spacing",
|
|
17
15
|
ROW_SPACING: "data-row-spacing",
|
|
18
16
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
19
17
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
20
18
|
};
|
|
21
|
-
class
|
|
19
|
+
class w extends N {
|
|
22
20
|
constructor() {
|
|
23
21
|
super(...arguments);
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
s(this, "store", A());
|
|
23
|
+
s(this, "isChangingLayout", !1);
|
|
26
24
|
}
|
|
27
25
|
getId() {
|
|
28
|
-
return
|
|
26
|
+
return I;
|
|
29
27
|
}
|
|
30
28
|
getTemplate() {
|
|
31
29
|
return `
|
|
32
30
|
<div class="layout-control-container">
|
|
33
|
-
${this._GuOnPageMessage({ name: O })}
|
|
34
|
-
|
|
35
31
|
${this._GuTwoColumns([
|
|
36
32
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
37
33
|
this._GuRadioButton({
|
|
38
|
-
name:
|
|
39
|
-
buttons:
|
|
34
|
+
name: u.LAYOUT,
|
|
35
|
+
buttons: O
|
|
40
36
|
})
|
|
41
37
|
])}
|
|
42
38
|
</div>
|
|
43
39
|
`;
|
|
44
40
|
}
|
|
45
41
|
onRender() {
|
|
46
|
-
this.
|
|
47
|
-
O,
|
|
48
|
-
this.api.translate(
|
|
49
|
-
`Note that updating the Layout Orientation, Number of Products,
|
|
50
|
-
Products in One Row and Mobile Layout Optimization settings
|
|
51
|
-
resets the style of your Recommendation block.`
|
|
52
|
-
)
|
|
53
|
-
), this._setFormValues(), this._listenToFormUpdates();
|
|
42
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
54
43
|
}
|
|
55
44
|
onTemplateNodeUpdated(t) {
|
|
56
45
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
57
46
|
}
|
|
58
47
|
_setFormValues() {
|
|
59
|
-
const
|
|
48
|
+
const r = a.getConfig(this.currentNode).layout || C(this.currentNode);
|
|
60
49
|
this.api.updateValues({
|
|
61
|
-
[
|
|
50
|
+
[u.LAYOUT]: r
|
|
62
51
|
});
|
|
63
52
|
}
|
|
64
53
|
/**
|
|
@@ -66,13 +55,14 @@ class Y extends N {
|
|
|
66
55
|
* Updates node config, data attribute and regenerates product rows
|
|
67
56
|
*/
|
|
68
57
|
_onLayoutChange(t) {
|
|
69
|
-
if (this.isChangingLayout || !this.currentNode || (
|
|
58
|
+
if (this.isChangingLayout || !this.currentNode || (a.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
|
|
70
59
|
return;
|
|
71
|
-
const c =
|
|
60
|
+
const c = f(this.currentNode);
|
|
72
61
|
if (c) {
|
|
73
62
|
this.isChangingLayout = !0;
|
|
74
63
|
try {
|
|
75
|
-
|
|
64
|
+
const p = S(this.currentNode);
|
|
65
|
+
a.updateConfig(
|
|
76
66
|
this.api,
|
|
77
67
|
this.currentNode,
|
|
78
68
|
{
|
|
@@ -85,7 +75,7 @@ class Y extends N {
|
|
|
85
75
|
`Changed layout to ${t}`
|
|
86
76
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
87
77
|
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
|
|
88
|
-
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.
|
|
78
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t, p);
|
|
89
79
|
} finally {
|
|
90
80
|
this.isChangingLayout = !1;
|
|
91
81
|
}
|
|
@@ -95,22 +85,23 @@ class Y extends N {
|
|
|
95
85
|
* Regenerates product rows based on the selected layout
|
|
96
86
|
* Uses unified style-preserving regeneration to maintain user customizations
|
|
97
87
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
88
|
+
* @param composition - The preserved card composition, incl. customAttr:* entries
|
|
98
89
|
*/
|
|
99
|
-
_regenerateProductRows(t) {
|
|
100
|
-
this.currentNode &&
|
|
90
|
+
_regenerateProductRows(t, r) {
|
|
91
|
+
this.currentNode && T({
|
|
101
92
|
currentNode: this.currentNode,
|
|
102
93
|
documentModifier: this.api.getDocumentModifier(),
|
|
103
94
|
layout: t,
|
|
104
|
-
composition:
|
|
95
|
+
composition: r
|
|
105
96
|
});
|
|
106
97
|
}
|
|
107
98
|
_listenToFormUpdates() {
|
|
108
|
-
this.api.onValueChanged(
|
|
99
|
+
this.api.onValueChanged(u.LAYOUT, (t) => {
|
|
109
100
|
this._onLayoutChange(t);
|
|
110
101
|
});
|
|
111
102
|
}
|
|
112
103
|
}
|
|
113
104
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
I as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
106
|
+
w as LayoutOrientationControl
|
|
116
107
|
};
|