@useinsider/guido 3.1.1-beta.6b60896 → 3.1.1-beta.761c167
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/@types/config/schemas.js +7 -9
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +53 -55
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.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 +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/stores/config.d.ts +0 -18
- package/package.json +3 -3
|
@@ -114,9 +114,7 @@ const m = {
|
|
|
114
114
|
/** Enable unsubscribe block */
|
|
115
115
|
unsubscribe: e(a(), !0),
|
|
116
116
|
/** Disable modules panel in the editor */
|
|
117
|
-
modulesDisabled: e(a(), !1)
|
|
118
|
-
/** Enable Liquid template syntax */
|
|
119
|
-
liquidSyntax: e(a(), !1)
|
|
117
|
+
modulesDisabled: e(a(), !1)
|
|
120
118
|
}), E = n([
|
|
121
119
|
"amp-accordion",
|
|
122
120
|
"amp-carousel",
|
|
@@ -193,12 +191,12 @@ const m = {
|
|
|
193
191
|
M,
|
|
194
192
|
N,
|
|
195
193
|
D
|
|
196
|
-
]),
|
|
194
|
+
]), U = o({
|
|
197
195
|
/** Custom compiler rules to apply */
|
|
198
196
|
customRules: e(c(v), []),
|
|
199
197
|
/** Skip default compiler rules */
|
|
200
198
|
ignoreDefaultRules: e(a(), !1)
|
|
201
|
-
}),
|
|
199
|
+
}), x = o({
|
|
202
200
|
/**
|
|
203
201
|
* External validation handler called before save completes.
|
|
204
202
|
* Return false to cancel the save operation.
|
|
@@ -227,15 +225,15 @@ const m = {
|
|
|
227
225
|
/** Block configuration */
|
|
228
226
|
blocks: e(O, {}),
|
|
229
227
|
/** Compiler configuration */
|
|
230
|
-
compiler: e(
|
|
228
|
+
compiler: e(U, {}),
|
|
231
229
|
/** Callbacks and event handlers */
|
|
232
|
-
callbacks: e(
|
|
230
|
+
callbacks: e(x, {})
|
|
233
231
|
});
|
|
234
232
|
export {
|
|
235
233
|
O as BlocksSchema,
|
|
236
|
-
|
|
234
|
+
x as CallbacksSchema,
|
|
237
235
|
v as CompilerRuleSchema,
|
|
238
|
-
|
|
236
|
+
U as CompilerSchema,
|
|
239
237
|
g as CustomBlockTypeSchema,
|
|
240
238
|
D as CustomRuleSchema,
|
|
241
239
|
E as DefaultBlockTypeSchema,
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return o === "before" ? `${t} ${u}` : `${u} ${t}`;
|
|
1
|
+
import { useRecommendation as $ } from "../../../composables/useRecommendation.js";
|
|
2
|
+
function b(e, u, r, o) {
|
|
3
|
+
const n = `{{${e}_${u}_${r}}}`, t = `{{${e}_${u}_currency}}`;
|
|
4
|
+
return o === "before" ? `${t} ${n}` : `${n} ${t}`;
|
|
6
5
|
}
|
|
7
|
-
function p(e,
|
|
8
|
-
switch (
|
|
6
|
+
function p(e, u, r, o, n) {
|
|
7
|
+
switch (u) {
|
|
9
8
|
case "productImage": {
|
|
10
9
|
const t = e.querySelector("img");
|
|
11
|
-
t && (t.setAttribute("src", `{{${
|
|
10
|
+
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
12
11
|
const c = e.querySelector("a");
|
|
13
|
-
c && c.setAttribute("href", `{{${
|
|
12
|
+
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
14
13
|
break;
|
|
15
14
|
}
|
|
16
15
|
case "productName": {
|
|
17
16
|
const t = e.querySelector("p");
|
|
18
17
|
if (t) {
|
|
19
18
|
const c = t.querySelector("strong") || t;
|
|
20
|
-
c.textContent = `{{${
|
|
19
|
+
c.textContent = `{{${r}_${o}_name}}`;
|
|
21
20
|
}
|
|
22
21
|
break;
|
|
23
22
|
}
|
|
@@ -25,7 +24,7 @@ function p(e, n, r, o, s, u) {
|
|
|
25
24
|
const t = e.querySelector("p");
|
|
26
25
|
if (t) {
|
|
27
26
|
const c = t.querySelector("strong") || t;
|
|
28
|
-
c.textContent =
|
|
27
|
+
c.textContent = b(r, o, "price", n);
|
|
29
28
|
}
|
|
30
29
|
break;
|
|
31
30
|
}
|
|
@@ -33,25 +32,24 @@ function p(e, n, r, o, s, u) {
|
|
|
33
32
|
const t = e.querySelector("p");
|
|
34
33
|
if (t) {
|
|
35
34
|
const c = t.querySelector("strong") || t;
|
|
36
|
-
c.textContent =
|
|
35
|
+
c.textContent = b(
|
|
37
36
|
r,
|
|
38
37
|
o,
|
|
39
38
|
"original_price",
|
|
40
|
-
|
|
41
|
-
u
|
|
39
|
+
n
|
|
42
40
|
), t.setAttribute("product-attr", "discount");
|
|
43
41
|
}
|
|
44
42
|
break;
|
|
45
43
|
}
|
|
46
44
|
case "productButton": {
|
|
47
45
|
const t = e.querySelector("a");
|
|
48
|
-
t && t.setAttribute("href", `{{${
|
|
46
|
+
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
49
47
|
break;
|
|
50
48
|
}
|
|
51
49
|
case "productOmnibusPrice": {
|
|
52
50
|
const t = e.querySelector(".omnibus-price-value");
|
|
53
51
|
if (t) {
|
|
54
|
-
t.textContent = `{{${
|
|
52
|
+
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
55
53
|
const c = t.closest("p");
|
|
56
54
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
57
55
|
}
|
|
@@ -60,7 +58,7 @@ function p(e, n, r, o, s, u) {
|
|
|
60
58
|
case "productOmnibusDiscount": {
|
|
61
59
|
const t = e.querySelector(".omnibus-discount-value");
|
|
62
60
|
if (t) {
|
|
63
|
-
t.textContent = `{{${
|
|
61
|
+
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
64
62
|
const c = t.closest("p");
|
|
65
63
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
66
64
|
}
|
|
@@ -69,66 +67,66 @@ function p(e, n, r, o, s, u) {
|
|
|
69
67
|
default: {
|
|
70
68
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
71
69
|
if (t) {
|
|
72
|
-
const c = t.getAttribute("product-attr"),
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
70
|
+
const c = t.getAttribute("product-attr"), s = t.querySelector("p");
|
|
71
|
+
if (s) {
|
|
72
|
+
const i = s.querySelector("strong") || s;
|
|
73
|
+
i.textContent = `{{${r}_${o}_${c}}}`;
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
break;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
function
|
|
83
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
p(
|
|
88
|
-
}) : p(
|
|
80
|
+
function S(e, u, r) {
|
|
81
|
+
e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
|
|
82
|
+
n.querySelectorAll("[data-attribute-type]").forEach((s) => {
|
|
83
|
+
const i = s.getAttribute("data-attribute-type") || "", l = s.querySelectorAll(".attribute-cell");
|
|
84
|
+
l.length > 0 ? l.forEach((a) => {
|
|
85
|
+
p(a, i, u, t, r);
|
|
86
|
+
}) : p(s, i, u, t, r);
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
89
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
90
|
+
function _(e, u, r) {
|
|
91
|
+
const o = e.querySelectorAll(".recommendation-product-row");
|
|
92
|
+
if (!o.length)
|
|
95
93
|
return;
|
|
96
|
-
const [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const m =
|
|
102
|
-
p(
|
|
94
|
+
const [n] = o, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
95
|
+
o.forEach((s, i) => {
|
|
96
|
+
s.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
97
|
+
const f = a.getAttribute("data-attribute-type") || "";
|
|
98
|
+
a.querySelectorAll(".attribute-cell").forEach((y, A) => {
|
|
99
|
+
const m = i * c + A;
|
|
100
|
+
p(y, f, u, m, r);
|
|
103
101
|
});
|
|
104
102
|
});
|
|
105
103
|
});
|
|
106
104
|
}
|
|
107
|
-
function
|
|
108
|
-
e.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
109
|
-
|
|
105
|
+
function q(e, u, r) {
|
|
106
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
|
|
107
|
+
_(n, u, r);
|
|
110
108
|
});
|
|
111
109
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
|
|
110
|
+
function d(e, u) {
|
|
111
|
+
const r = e.getAttribute("data-layout") || "grid", o = e.getAttribute("currency-alignment") || "after";
|
|
112
|
+
r === "list" ? S(e, u, o) : q(e, u, o);
|
|
115
113
|
}
|
|
116
|
-
function
|
|
114
|
+
function g(e, u) {
|
|
117
115
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
118
116
|
return (r ? `${r[0]}
|
|
119
|
-
` : "") +
|
|
117
|
+
` : "") + u.documentElement.outerHTML;
|
|
120
118
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
119
|
+
function E(e) {
|
|
120
|
+
const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
123
121
|
if (!o.length)
|
|
124
122
|
return e;
|
|
125
|
-
const { buildCampaignUrl:
|
|
126
|
-
return o.forEach((
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
}),
|
|
123
|
+
const { buildCampaignUrl: n } = $();
|
|
124
|
+
return o.forEach((c) => {
|
|
125
|
+
const s = c.getAttribute("recommendation-id");
|
|
126
|
+
s && (n(s), d(c, s));
|
|
127
|
+
}), g(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
130
128
|
}
|
|
131
129
|
export {
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
b as formatPriceVariable,
|
|
131
|
+
E as prepareRecommendationBlocks
|
|
134
132
|
};
|
|
@@ -28,8 +28,8 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
30
30
|
COMPOSITION: /composition="true"/gm,
|
|
31
|
-
CUSTOM_FIELD: /{{
|
|
32
|
-
CUSTOM_FIELD_INDEXES_PART: /{{
|
|
31
|
+
CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
+
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
34
|
}, n = {
|
|
35
35
|
PARAGRAPH_END_TAG: "</p>"
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-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 = {
|
|
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
|
-
},
|
|
8
|
+
}, R = "productImage", _ = "productName", e = "productPrice", O = "productOldPrice", s = "productOmnibusPrice", i = "productOmnibusDiscount", E = "productButton", A = "customAttr:", C = "data-custom-attributes", u = "product-attr", m = /* @__PURE__ */ new Set([
|
|
9
|
+
"name",
|
|
10
|
+
// productName
|
|
11
|
+
"price",
|
|
12
|
+
// productPrice
|
|
13
|
+
"original_price",
|
|
14
|
+
// productOldPrice
|
|
15
|
+
"image_url",
|
|
16
|
+
// productImage
|
|
17
|
+
"url",
|
|
18
|
+
// productButton
|
|
19
|
+
"omnibus_price",
|
|
20
|
+
// productOmnibusPrice
|
|
21
|
+
"omnibus_discount"
|
|
22
|
+
// productOmnibusDiscount
|
|
23
|
+
]);
|
|
9
24
|
export {
|
|
10
25
|
A as ATTR_CUSTOM_PREFIX,
|
|
11
|
-
|
|
26
|
+
C as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
12
27
|
u as ATTR_PRODUCT_ATTR,
|
|
13
28
|
E as ATTR_PRODUCT_BUTTON,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
R as ATTR_PRODUCT_IMAGE,
|
|
30
|
+
_ as ATTR_PRODUCT_NAME,
|
|
31
|
+
O as ATTR_PRODUCT_OLD_PRICE,
|
|
32
|
+
i as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
18
33
|
s as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
19
|
-
|
|
34
|
+
e as ATTR_PRODUCT_PRICE,
|
|
20
35
|
T as BLOCK_ROOT_SELECTOR,
|
|
36
|
+
m as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
21
37
|
c as CONTAINER_SELECTOR,
|
|
22
|
-
|
|
38
|
+
r as CURRENCY_ATTR,
|
|
23
39
|
o as DESKTOP_CONTAINER_SELECTOR,
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
n as MOBILE_CONTAINER_SELECTOR,
|
|
41
|
+
t as MOBILE_ROW_SELECTOR
|
|
26
42
|
};
|