@useinsider/guido 3.8.2-beta.151aeb6 → 3.8.2-beta.2ed8604
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 +71 -91
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +22 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +36 -0
- package/dist/extensions/Blocks/common-control.js +53 -41
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +1 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
|
-
import { CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
6
|
-
function
|
|
7
|
-
const i = `{{${c}${
|
|
8
|
-
return o === "before" ? `${
|
|
6
|
+
function h(r, n, e, o, c = "") {
|
|
7
|
+
const i = `{{${c}${r}_${n}_${e}}}`, t = `{{${c}${r}_${n}_currency}}`;
|
|
8
|
+
return o === "before" ? `${t} ${i}` : `${i} ${t}`;
|
|
9
9
|
}
|
|
10
|
-
function f(
|
|
11
|
-
let n =
|
|
10
|
+
function f(r) {
|
|
11
|
+
let n = r;
|
|
12
12
|
for (; n.children.length === 1; )
|
|
13
13
|
[n] = n.children;
|
|
14
14
|
return n;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function A(r, n, e, o, c, i) {
|
|
17
17
|
switch (n) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const s =
|
|
22
|
-
s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(
|
|
19
|
+
const t = r.querySelector("img");
|
|
20
|
+
t && (t.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
|
|
21
|
+
const s = r.querySelector("a");
|
|
22
|
+
s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(q));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const t = r.querySelector("p");
|
|
27
|
+
t && (f(t).textContent = `{{${i}${e}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "productPrice": {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const t = r.querySelector("p");
|
|
32
|
+
t && (f(t).textContent = h(
|
|
33
33
|
e,
|
|
34
34
|
o,
|
|
35
35
|
"price",
|
|
@@ -39,109 +39,89 @@ function h(t, n, e, o, c, i) {
|
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
case "productOldPrice": {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const t = r.querySelector("p");
|
|
43
|
+
t && (f(t).textContent = h(
|
|
44
44
|
e,
|
|
45
45
|
o,
|
|
46
46
|
"original_price",
|
|
47
47
|
c,
|
|
48
48
|
i
|
|
49
|
-
),
|
|
49
|
+
), t.setAttribute("product-attr", "discount"));
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
case "productButton": {
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const t = r.querySelector("a");
|
|
54
|
+
t && t.setAttribute("href", `{{${i}${e}_${o}_url}}`);
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
57
|
case "productOmnibusPrice": {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
const s =
|
|
58
|
+
const t = r.querySelector(".omnibus-price-value");
|
|
59
|
+
if (t) {
|
|
60
|
+
t.textContent = `{{${i}${e}_${o}_omnibus_price}}`;
|
|
61
|
+
const s = t.closest("p");
|
|
62
62
|
s && (s.setAttribute("product-attr", "omnibus_price"), s.setAttribute("composition", "true"));
|
|
63
63
|
}
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
case "productOmnibusDiscount": {
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
const s =
|
|
67
|
+
const t = r.querySelector(".omnibus-discount-value");
|
|
68
|
+
if (t) {
|
|
69
|
+
t.textContent = `{{${i}${e}_${o}_omnibus_discount}}`;
|
|
70
|
+
const s = t.closest("p");
|
|
71
71
|
s && (s.setAttribute("product-attr", "omnibus_discount"), s.setAttribute("composition", "true"));
|
|
72
72
|
}
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
default: {
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
const s =
|
|
76
|
+
const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
77
|
+
if (t) {
|
|
78
|
+
const s = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
79
79
|
a && (f(a).textContent = `{{${i}${e}_${o}_${s}}}`);
|
|
80
80
|
}
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const c = `${o}${n}_${e}_${R}`;
|
|
88
|
-
return {
|
|
89
|
-
open: t.createComment(`{% if ${c} != "" %}`),
|
|
90
|
-
close: t.createComment("{% endif %}")
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function T(t, n, e, o) {
|
|
94
|
-
if (!t.innerHTML.includes("{{"))
|
|
95
|
-
return;
|
|
96
|
-
const { open: c, close: i } = S(t.ownerDocument, n, e, o);
|
|
97
|
-
t.insertBefore(c, t.firstChild), t.appendChild(i);
|
|
98
|
-
}
|
|
99
|
-
function P(t, n, e, o) {
|
|
100
|
-
if (!t.innerHTML.includes("{{"))
|
|
101
|
-
return;
|
|
102
|
-
const { open: c, close: i } = S(t.ownerDocument, n, e, o), r = t.parentNode;
|
|
103
|
-
r.insertBefore(c, t), r.insertBefore(i, t.nextSibling);
|
|
104
|
-
}
|
|
105
|
-
function L(t, n, e, o) {
|
|
106
|
-
t.querySelectorAll(".recommendation-product-row").forEach((i, r) => {
|
|
85
|
+
function E(r, n, e, o) {
|
|
86
|
+
r.querySelectorAll(".recommendation-product-row").forEach((i, t) => {
|
|
107
87
|
i.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
108
88
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
109
89
|
p.length > 0 ? p.forEach((l) => {
|
|
110
|
-
|
|
111
|
-
}) :
|
|
112
|
-
})
|
|
90
|
+
A(l, u, n, t, e, o);
|
|
91
|
+
}) : A(a, u, n, t, e, o);
|
|
92
|
+
});
|
|
113
93
|
});
|
|
114
94
|
}
|
|
115
|
-
function
|
|
116
|
-
const c =
|
|
95
|
+
function R(r, n, e, o) {
|
|
96
|
+
const c = r.querySelectorAll(".recommendation-product-row");
|
|
117
97
|
if (!c.length)
|
|
118
98
|
return;
|
|
119
|
-
const [i] = c,
|
|
99
|
+
const [i] = c, t = i.querySelector("[data-attribute-type]"), s = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
120
100
|
c.forEach((a, u) => {
|
|
121
101
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
122
102
|
const m = l.getAttribute("data-attribute-type") || "";
|
|
123
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
124
|
-
const
|
|
125
|
-
|
|
103
|
+
l.querySelectorAll(".attribute-cell").forEach((y, $) => {
|
|
104
|
+
const S = u * s + $;
|
|
105
|
+
A(y, m, n, S, e, o);
|
|
126
106
|
});
|
|
127
107
|
});
|
|
128
108
|
});
|
|
129
109
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
|
|
110
|
+
function P(r, n, e, o) {
|
|
111
|
+
r.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
112
|
+
R(i, n, e, o);
|
|
133
113
|
});
|
|
134
114
|
}
|
|
135
|
-
function
|
|
136
|
-
const o =
|
|
137
|
-
o === "list" ?
|
|
115
|
+
function T(r, n, e) {
|
|
116
|
+
const o = r.getAttribute("data-layout") || "grid", c = r.getAttribute("currency-alignment") || "after";
|
|
117
|
+
o === "list" ? E(r, n, c, e) : P(r, n, c, e);
|
|
138
118
|
}
|
|
139
|
-
function b(
|
|
140
|
-
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c =
|
|
119
|
+
function b(r, n, e) {
|
|
120
|
+
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c = r.match(o);
|
|
141
121
|
return c ? parseInt(c[1]) : e;
|
|
142
122
|
}
|
|
143
|
-
function
|
|
144
|
-
let e =
|
|
123
|
+
function v(r, n) {
|
|
124
|
+
let e = r.parentElement;
|
|
145
125
|
for (; e && e !== n; ) {
|
|
146
126
|
if (e.tagName === "TD") {
|
|
147
127
|
const o = e.getAttribute("width");
|
|
@@ -152,15 +132,15 @@ function O(t, n) {
|
|
|
152
132
|
}
|
|
153
133
|
return null;
|
|
154
134
|
}
|
|
155
|
-
function
|
|
156
|
-
const n =
|
|
157
|
-
c !== 0 &&
|
|
135
|
+
function O(r) {
|
|
136
|
+
const n = r.getAttribute("style") || "", e = b(n, "width", 600), o = b(n, "padding", 0) * 2, c = Math.max(0, e - o);
|
|
137
|
+
c !== 0 && r.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
158
138
|
if (i.hasAttribute("width"))
|
|
159
139
|
return;
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
140
|
+
const t = v(i, r);
|
|
141
|
+
if (!t)
|
|
162
142
|
return;
|
|
163
|
-
const s =
|
|
143
|
+
const s = t.getAttribute("width"), a = parseFloat(s), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(c * a / 100), l = Math.max(1, p - u);
|
|
164
144
|
i.setAttribute("width", String(l));
|
|
165
145
|
const m = i.getAttribute("style") || "";
|
|
166
146
|
if (!/\bwidth\s*:\s*\d/i.test(m)) {
|
|
@@ -169,25 +149,25 @@ function M(t) {
|
|
|
169
149
|
}
|
|
170
150
|
});
|
|
171
151
|
}
|
|
172
|
-
function
|
|
173
|
-
const e =
|
|
152
|
+
function W(r, n) {
|
|
153
|
+
const e = r.match(/<!DOCTYPE[^>]*>/i);
|
|
174
154
|
return (e ? `${e[0]}
|
|
175
155
|
` : "") + n.documentElement.outerHTML;
|
|
176
156
|
}
|
|
177
|
-
function
|
|
178
|
-
const n =
|
|
157
|
+
function F(r) {
|
|
158
|
+
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
179
159
|
if (!o.length)
|
|
180
|
-
return
|
|
181
|
-
const { buildCampaignUrl: c } = g(), i =
|
|
160
|
+
return r;
|
|
161
|
+
const { buildCampaignUrl: c } = g(), i = C();
|
|
182
162
|
i.recommendationCampaignUrls = {};
|
|
183
|
-
const { isFeatureEnabled:
|
|
163
|
+
const { isFeatureEnabled: t } = _(), s = t("liquidSyntax") ? "reco_" : "";
|
|
184
164
|
return o.forEach((u) => {
|
|
185
165
|
var l, m;
|
|
186
166
|
const p = u.getAttribute("recommendation-id");
|
|
187
|
-
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (m = u.parentNode) == null || m.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((d) => d.remove()), c(p), w(u) ||
|
|
188
|
-
}),
|
|
167
|
+
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (m = u.parentNode) == null || m.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((d) => d.remove()), c(p), w(u) || T(u, p, s), O(u));
|
|
168
|
+
}), W(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
189
169
|
}
|
|
190
170
|
export {
|
|
191
|
-
|
|
192
|
-
|
|
171
|
+
h as formatPriceVariable,
|
|
172
|
+
F as prepareRecommendationBlocks
|
|
193
173
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (s, o, t) => o in s ? d(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
|
|
3
|
+
var c = (s, o, t) => h(s, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
6
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { mapLegacyStrategy as
|
|
9
|
-
const
|
|
7
|
+
import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
|
|
8
|
+
import { mapLegacyStrategy as p } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const C = "recommendation-algorithm-control", i = {
|
|
10
10
|
ALGORITHM: "strategy",
|
|
11
11
|
PRODUCT_IDS: "productIds"
|
|
12
12
|
};
|
|
13
|
-
class
|
|
13
|
+
class y extends m {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
17
|
-
|
|
17
|
+
c(this, "store", u());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return C;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
@@ -30,10 +30,10 @@ class R extends d {
|
|
|
30
30
|
options: this.store.getActivePredictiveAlgorithms
|
|
31
31
|
}),
|
|
32
32
|
this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
|
|
33
|
-
this.
|
|
33
|
+
this._GuMultiSelect({
|
|
34
34
|
name: i.PRODUCT_IDS,
|
|
35
35
|
placeholder: this.api.translate("Enter Product Ids"),
|
|
36
|
-
className: "
|
|
36
|
+
className: "product-ids-multiselect"
|
|
37
37
|
})
|
|
38
38
|
])}
|
|
39
39
|
</div>
|
|
@@ -46,10 +46,11 @@ class R extends d {
|
|
|
46
46
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
47
47
|
}
|
|
48
48
|
_setFormValues() {
|
|
49
|
-
const t = n.getConfig(this.currentNode), e =
|
|
49
|
+
const t = n.getConfig(this.currentNode), e = p(t.strategy) ?? t.strategy;
|
|
50
50
|
this._setProductIdsVisibility(e), this.api.updateValues({
|
|
51
51
|
[i.ALGORITHM]: e,
|
|
52
|
-
[
|
|
52
|
+
// MULTIPLE_SELECT consumes a string[] directly (was a comma-joined string).
|
|
53
|
+
[i.PRODUCT_IDS]: t.productIds
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
_initializeSelectItems() {
|
|
@@ -59,7 +60,7 @@ class R extends d {
|
|
|
59
60
|
try {
|
|
60
61
|
this.api.setUIEAttribute(
|
|
61
62
|
i.ALGORITHM,
|
|
62
|
-
|
|
63
|
+
g.SELECTPICKER.items,
|
|
63
64
|
t
|
|
64
65
|
);
|
|
65
66
|
} catch (r) {
|
|
@@ -81,13 +82,13 @@ class R extends d {
|
|
|
81
82
|
_onProductIdsChange(t) {
|
|
82
83
|
if (!this.currentNode)
|
|
83
84
|
return;
|
|
84
|
-
const e = t
|
|
85
|
-
n.updateConfig(
|
|
85
|
+
const e = [...new Set((t ?? []).map((a) => String(a).trim()).filter(Boolean))], r = n.getConfig(this.currentNode).productIds;
|
|
86
|
+
r.length === e.length && r.every((a, l) => a === e[l]) || (n.updateConfig(
|
|
86
87
|
this.api,
|
|
87
88
|
this.currentNode,
|
|
88
89
|
{ productIds: e },
|
|
89
90
|
"Updated product IDs"
|
|
90
|
-
), this.store.patchCurrentBlockConfig({ productIds: e });
|
|
91
|
+
), this.store.patchCurrentBlockConfig({ productIds: e }));
|
|
91
92
|
}
|
|
92
93
|
_listenToFormUpdates() {
|
|
93
94
|
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
@@ -98,6 +99,6 @@ class R extends d {
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
C as ALGORITHM_CONTROL_ID,
|
|
103
|
+
y as AlgorithmControl
|
|
103
104
|
};
|
|
@@ -229,6 +229,42 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
229
229
|
font-weight: 400;
|
|
230
230
|
line-height: 16px;
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
/* ─── Manual-merchandising Product IDs tags input ───────────────────────── */
|
|
234
|
+
/* The product-ids field uses Stripo's native MULTIPLE_SELECT (chips: add by
|
|
235
|
+
Enter, remove by ×). These overrides force the Figma palette
|
|
236
|
+
(#F1F3FE bg / #B5C1F1 border / #0A2ECC text) onto the chips, since the
|
|
237
|
+
element's default styling is Stripo's.
|
|
238
|
+
NOTE: the inner chip/close selectors below target Stripo's light-DOM render
|
|
239
|
+
for ui-editor-extensions@3.8.0 and MUST be re-verified against the rendered
|
|
240
|
+
DOM (bun start) — adjust if a Stripo upgrade changes the internal markup. */
|
|
241
|
+
|
|
242
|
+
.algorithm-control-container .product-ids-multiselect {
|
|
243
|
+
display: block;
|
|
244
|
+
width: 100%;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* Each entered ID renders as a chip */
|
|
248
|
+
.algorithm-control-container .product-ids-multiselect .tag,
|
|
249
|
+
.algorithm-control-container .product-ids-multiselect .chip {
|
|
250
|
+
display: inline-flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 4px;
|
|
253
|
+
border-radius: 4px;
|
|
254
|
+
background: var(--guido-color-primary-0, #f1f3fe);
|
|
255
|
+
border: 1px solid var(--guido-color-primary-200, #b5c1f1);
|
|
256
|
+
color: var(--guido-color-primary-500, #0a2ecc);
|
|
257
|
+
font-size: 13px;
|
|
258
|
+
line-height: 16px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* The × removal control, divided from the label by a left border */
|
|
262
|
+
.algorithm-control-container .product-ids-multiselect .tag .remove,
|
|
263
|
+
.algorithm-control-container .product-ids-multiselect .chip .remove {
|
|
264
|
+
border-left: 1px solid var(--guido-color-primary-200, #b5c1f1);
|
|
265
|
+
color: var(--guido-color-primary-500, #0a2ecc);
|
|
266
|
+
cursor: pointer;
|
|
267
|
+
}
|
|
232
268
|
`;
|
|
233
269
|
export {
|
|
234
270
|
n as default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
2
|
var i = (s, r, e) => r in s ? c(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
|
|
3
|
-
var
|
|
3
|
+
var T = (s, r, e) => i(s, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import { Control as I, UIElementType as n, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
class
|
|
5
|
+
class _ extends I {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
T(this, "currentNode");
|
|
9
|
+
T(this, "lastBlockInstanceId", null);
|
|
10
10
|
}
|
|
11
11
|
getContainer() {
|
|
12
12
|
var e;
|
|
@@ -47,15 +47,15 @@ class d extends I {
|
|
|
47
47
|
const t = this.getBlockInstanceId();
|
|
48
48
|
if (!t)
|
|
49
49
|
return !1;
|
|
50
|
-
const
|
|
51
|
-
return e(),
|
|
50
|
+
const E = t !== this.lastBlockInstanceId;
|
|
51
|
+
return e(), E && (this.lastBlockInstanceId = t), E;
|
|
52
52
|
}
|
|
53
|
-
_GuLabel({ text: e, name: t = "", hint:
|
|
53
|
+
_GuLabel({ text: e, name: t = "", hint: E }) {
|
|
54
54
|
return `
|
|
55
55
|
<${n.LABEL}
|
|
56
56
|
${$.LABEL.text}="${e}"
|
|
57
57
|
${$.LABEL.name}="${t || `${e} Label`}"
|
|
58
|
-
${
|
|
58
|
+
${E ? `${$.LABEL.hint}="${E}"` : ""}>
|
|
59
59
|
</${n.LABEL}>
|
|
60
60
|
`;
|
|
61
61
|
}
|
|
@@ -73,7 +73,7 @@ class d extends I {
|
|
|
73
73
|
* Use in getTemplate() — the icon is registered in a hidden store so Stripo initializes it.
|
|
74
74
|
* Pair with _setInfoMessageValue() in onRender() to set the text content.
|
|
75
75
|
*/
|
|
76
|
-
_GuOnPageMessage({ name: e, icon: t = "not-found", type:
|
|
76
|
+
_GuOnPageMessage({ name: e, icon: t = "not-found", type: E = "info" }) {
|
|
77
77
|
return `
|
|
78
78
|
<div data-info-message="${e}" style="display: none; padding: 16px 16px 0;">
|
|
79
79
|
<div class="icon-store" style="display: none;">
|
|
@@ -81,7 +81,7 @@ class d extends I {
|
|
|
81
81
|
${this._GuIcon({ src: t, className: "icon" })}
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
|
-
${this._GuMessage({ name: e, type:
|
|
84
|
+
${this._GuMessage({ name: e, type: E })}
|
|
85
85
|
</div>
|
|
86
86
|
`;
|
|
87
87
|
}
|
|
@@ -91,7 +91,7 @@ class d extends I {
|
|
|
91
91
|
* and combines it with the text in Stripo's alert-message layout.
|
|
92
92
|
*/
|
|
93
93
|
_setInfoMessageValue(e, t) {
|
|
94
|
-
const
|
|
94
|
+
const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`), a = o == null ? void 0 : o.querySelector("ue-icon-component"), l = (a == null ? void 0 : a.outerHTML) ?? "";
|
|
95
95
|
this.api.setUIEAttribute(
|
|
96
96
|
e,
|
|
97
97
|
"value",
|
|
@@ -104,8 +104,8 @@ class d extends I {
|
|
|
104
104
|
</div>
|
|
105
105
|
`
|
|
106
106
|
);
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const u = E.querySelector(`[data-info-message="${e}"]`);
|
|
108
|
+
u && (u.style.display = "");
|
|
109
109
|
}
|
|
110
110
|
_GuToggle(e) {
|
|
111
111
|
return `
|
|
@@ -121,59 +121,59 @@ class d extends I {
|
|
|
121
121
|
${$.SELECT_ITEM.value}="${t}">
|
|
122
122
|
</${n.SELECT_ITEM}>`;
|
|
123
123
|
}
|
|
124
|
-
_GuSelect({ name: e, placeholder: t, options:
|
|
124
|
+
_GuSelect({ name: e, placeholder: t, options: E, className: o = "es-180w" }) {
|
|
125
125
|
return `
|
|
126
126
|
<${n.SELECTPICKER}
|
|
127
|
-
class="${
|
|
127
|
+
class="${o}"
|
|
128
128
|
${$.SELECTPICKER.name}="${e}"
|
|
129
129
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
130
|
-
${
|
|
130
|
+
${E.map((a) => this._GuSelectItem(a)).join("")}
|
|
131
131
|
</${n.SELECTPICKER}>
|
|
132
132
|
`;
|
|
133
133
|
}
|
|
134
|
-
_GuTextInput({ name: e, placeholder: t, className:
|
|
134
|
+
_GuTextInput({ name: e, placeholder: t, className: E = "", disabled: o = !1 }) {
|
|
135
135
|
return `
|
|
136
136
|
<${n.TEXT}
|
|
137
|
-
class=${
|
|
137
|
+
class=${E}
|
|
138
138
|
${$.TEXT.name}="${e}"
|
|
139
139
|
placeholder="${t || e}"
|
|
140
|
-
${
|
|
140
|
+
${o ? `${$.TEXT.disabled}="true"` : ""}>
|
|
141
141
|
</${n.TEXT}>
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
144
|
-
_GuCounter({ name: e, maxValue: t, minValue:
|
|
144
|
+
_GuCounter({ name: e, maxValue: t, minValue: E = 1, step: o = 1 }) {
|
|
145
145
|
return `
|
|
146
146
|
<${n.COUNTER}
|
|
147
147
|
${$.COUNTER.name}="${e}"
|
|
148
|
-
${$.COUNTER.minValue}="${
|
|
148
|
+
${$.COUNTER.minValue}="${E}"
|
|
149
149
|
${$.COUNTER.maxValue}="${t}"
|
|
150
|
-
${$.COUNTER.step}="${
|
|
150
|
+
${$.COUNTER.step}="${o}">
|
|
151
151
|
</${n.COUNTER}>
|
|
152
152
|
`;
|
|
153
153
|
}
|
|
154
|
-
_GuRadioButtonItem({ text: e, value: t, icon:
|
|
154
|
+
_GuRadioButtonItem({ text: e, value: t, icon: E }) {
|
|
155
155
|
return `
|
|
156
156
|
<${n.RADIO_ITEM}
|
|
157
157
|
${$.RADIO_ITEM.value}="${t}"
|
|
158
158
|
${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
|
|
159
|
-
${
|
|
159
|
+
${E ? `${$.RADIO_ITEM.icon}="${E}"` : ""}>
|
|
160
160
|
</${n.RADIO_ITEM}>
|
|
161
161
|
`;
|
|
162
162
|
}
|
|
163
|
-
_GuRadioButton({ name: e, buttons: t, id:
|
|
163
|
+
_GuRadioButton({ name: e, buttons: t, id: E = "" }) {
|
|
164
164
|
return `
|
|
165
165
|
<${n.RADIO_BUTTONS}
|
|
166
|
-
${
|
|
166
|
+
${E ? `id="${E}"` : ""}
|
|
167
167
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
168
|
-
${t.map((
|
|
168
|
+
${t.map((o) => this._GuRadioButtonItem(o)).join("")}
|
|
169
169
|
</${n.RADIO_BUTTONS}>
|
|
170
170
|
`;
|
|
171
171
|
}
|
|
172
|
-
_GuButton({ name: e, label: t, id:
|
|
172
|
+
_GuButton({ name: e, label: t, id: E = "" }) {
|
|
173
173
|
return `
|
|
174
174
|
<${n.BUTTON}
|
|
175
175
|
${$.BUTTON.name}="${e}"
|
|
176
|
-
${
|
|
176
|
+
${E ? `id="${E}"` : ""}
|
|
177
177
|
${$.BUTTON.caption}="${t}"}>
|
|
178
178
|
</${n.BUTTON}>
|
|
179
179
|
`;
|
|
@@ -191,10 +191,10 @@ class d extends I {
|
|
|
191
191
|
* @param param0
|
|
192
192
|
* @returns It returns a button with an icon.
|
|
193
193
|
*/
|
|
194
|
-
_GuIconButton({ name: e, icon: t, className:
|
|
194
|
+
_GuIconButton({ name: e, icon: t, className: E = "" }) {
|
|
195
195
|
return `
|
|
196
196
|
<${n.BUTTON}
|
|
197
|
-
class="${
|
|
197
|
+
class="${E}"
|
|
198
198
|
${$.BUTTON.name}="${e}"
|
|
199
199
|
${$.BUTTON.icon}="${t}">
|
|
200
200
|
</${n.BUTTON}>
|
|
@@ -222,19 +222,19 @@ class d extends I {
|
|
|
222
222
|
* @returns HTML string for the orderable control
|
|
223
223
|
*/
|
|
224
224
|
_GuOrderable(e, t) {
|
|
225
|
-
let
|
|
225
|
+
let E = "";
|
|
226
226
|
t.forEach((a) => {
|
|
227
227
|
const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
228
|
-
|
|
228
|
+
E += `
|
|
229
229
|
<${n.ORDERABLE_ITEM} ${l}="${a.key}">
|
|
230
230
|
${a.content}
|
|
231
231
|
</${n.ORDERABLE_ITEM}>
|
|
232
232
|
`;
|
|
233
233
|
});
|
|
234
|
-
const
|
|
234
|
+
const o = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
|
|
235
235
|
return `
|
|
236
|
-
<${n.ORDERABLE} ${
|
|
237
|
-
${
|
|
236
|
+
<${n.ORDERABLE} ${o}="${e}">
|
|
237
|
+
${E}
|
|
238
238
|
</${n.ORDERABLE}>
|
|
239
239
|
`;
|
|
240
240
|
}
|
|
@@ -275,16 +275,16 @@ class d extends I {
|
|
|
275
275
|
`;
|
|
276
276
|
}
|
|
277
277
|
_GuRadioButtons(e, t) {
|
|
278
|
-
const
|
|
278
|
+
const E = t.map((o) => `
|
|
279
279
|
<${n.RADIO_ITEM}
|
|
280
|
-
${$.RADIO_ITEM.text}="${
|
|
281
|
-
${$.RADIO_ITEM.value}="${
|
|
280
|
+
${$.RADIO_ITEM.text}="${o.text}"
|
|
281
|
+
${$.RADIO_ITEM.value}="${o.value}">
|
|
282
282
|
</${n.RADIO_ITEM}>
|
|
283
283
|
`).join("");
|
|
284
284
|
return `
|
|
285
285
|
<${n.RADIO_BUTTONS}
|
|
286
286
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
287
|
-
${
|
|
287
|
+
${E}
|
|
288
288
|
</${n.RADIO_BUTTONS}>
|
|
289
289
|
`;
|
|
290
290
|
}
|
|
@@ -296,7 +296,19 @@ class d extends I {
|
|
|
296
296
|
</${n.CHECKBOX}>
|
|
297
297
|
`;
|
|
298
298
|
}
|
|
299
|
+
// Tag/chips input (Stripo MULTIPLE_SELECT): add-by-Enter, remove-by-×.
|
|
300
|
+
// Value is read/written as a string[] via updateValues / onValueChanged.
|
|
301
|
+
_GuMultiSelect({ name: e, placeholder: t = "", className: E = "", disabled: o = !1 }) {
|
|
302
|
+
return `
|
|
303
|
+
<${n.MULTIPLE_SELECT}
|
|
304
|
+
class="${E}"
|
|
305
|
+
${$.MULTIPLE_SELECT.name}="${e}"
|
|
306
|
+
${$.MULTIPLE_SELECT.placeholder}="${t}"
|
|
307
|
+
${o ? `${$.MULTIPLE_SELECT.disabled}="true"` : ""}>
|
|
308
|
+
</${n.MULTIPLE_SELECT}>
|
|
309
|
+
`;
|
|
310
|
+
}
|
|
299
311
|
}
|
|
300
312
|
export {
|
|
301
|
-
|
|
313
|
+
_ as CommonControl
|
|
302
314
|
};
|
|
@@ -24,6 +24,6 @@ export declare class AlgorithmControl extends CommonControl {
|
|
|
24
24
|
_initializeSelectItems(): void;
|
|
25
25
|
_setProductIdsVisibility(strategy?: string): void;
|
|
26
26
|
_onAlgorithmChange(value: string): void;
|
|
27
|
-
_onProductIdsChange(value: string): void;
|
|
27
|
+
_onProductIdsChange(value: string[]): void;
|
|
28
28
|
_listenToFormUpdates(): void;
|
|
29
29
|
}
|
|
@@ -6,6 +6,12 @@ interface TextInputProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
9
|
+
interface MultiSelectProps {
|
|
10
|
+
name: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
9
15
|
interface LabelProps {
|
|
10
16
|
text: string;
|
|
11
17
|
name?: string;
|
|
@@ -145,5 +151,6 @@ export declare abstract class CommonControl extends Control {
|
|
|
145
151
|
value: string;
|
|
146
152
|
}[]): string;
|
|
147
153
|
_GuCheckbox(name: string, caption: string): string;
|
|
154
|
+
_GuMultiSelect({ name, placeholder, className, disabled }: MultiSelectProps): string;
|
|
148
155
|
}
|
|
149
156
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.8.2-beta.
|
|
3
|
+
"version": "3.8.2-beta.2ed8604",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|