@useinsider/guido 3.9.0-beta.978f9ce → 3.9.0-beta.aa5cfb6
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/migrator/unsubscribeMigrator.js +89 -67
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -33
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -62
- package/dist/extensions/Blocks/common-control.js +45 -58
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +1 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -7
- package/package.json +2 -2
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { MERGE_TAGS as
|
|
5
|
-
import { DATA_ATTRIBUTES as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
class
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var B = (c, e, r) => e in c ? x(c, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : c[e] = r;
|
|
3
|
+
var A = (c, e, r) => B(c, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { MERGE_TAGS as f, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
|
|
5
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as h, DATA_ATTRIBUTES as k } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
|
|
7
|
+
class $ {
|
|
8
8
|
constructor() {
|
|
9
|
-
|
|
9
|
+
A(this, "parser");
|
|
10
10
|
this.parser = new DOMParser();
|
|
11
11
|
}
|
|
12
12
|
async migrate(e) {
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
pageIds: b,
|
|
24
|
-
paddingClass: g,
|
|
25
|
-
bgColor: u
|
|
26
|
-
});
|
|
27
|
-
const f = this.buildUnsubscribeBlock(
|
|
28
|
-
n,
|
|
29
|
-
s,
|
|
30
|
-
b,
|
|
31
|
-
g,
|
|
32
|
-
u
|
|
33
|
-
), a = this.parser.parseFromString(
|
|
34
|
-
`<table id="tempDoc"><tbody><tr>${f}</tr></tbody></table>`,
|
|
35
|
-
"text/html"
|
|
36
|
-
).querySelector(".unsubscribe-block-v2");
|
|
37
|
-
a && r.parentNode && (a.setAttribute("id", c || ""), r.parentNode.replaceChild(a, r));
|
|
38
|
-
}), t.documentElement.outerHTML;
|
|
39
|
-
} catch (t) {
|
|
40
|
-
return console.error("UnsubscribeMigrator failed:", t), e;
|
|
14
|
+
const r = this.parser.parseFromString(e, "text/html"), t = r.querySelectorAll("td.unsubscribe-block");
|
|
15
|
+
if (t.length) {
|
|
16
|
+
const s = C();
|
|
17
|
+
await s.fetchTemplates(), this.migrateLegacyBlocks(t, s);
|
|
18
|
+
}
|
|
19
|
+
const n = this.repairUnsubscribeLinks(r);
|
|
20
|
+
return !t.length && !n ? e : r.documentElement.outerHTML;
|
|
21
|
+
} catch (r) {
|
|
22
|
+
return console.error("UnsubscribeMigrator failed:", r), e;
|
|
41
23
|
}
|
|
42
24
|
}
|
|
25
|
+
migrateLegacyBlocks(e, r) {
|
|
26
|
+
e.forEach((t) => {
|
|
27
|
+
const n = t.getAttribute("id"), s = this.extractPaddingClass(t), l = t.getAttribute("bgcolor") || "", a = this.extractUnsubscribeContent(t), o = this.getCollectionTypeFromMergeTag(a.linkHref), b = r.getSelectedUnsubscribePagesByCollection(o);
|
|
28
|
+
console.debug("[UnsubscribeMigrator]", {
|
|
29
|
+
mergeTag: a.linkHref,
|
|
30
|
+
collectionType: o,
|
|
31
|
+
pageIds: b,
|
|
32
|
+
paddingClass: s,
|
|
33
|
+
bgColor: l
|
|
34
|
+
});
|
|
35
|
+
const u = this.buildUnsubscribeBlock(
|
|
36
|
+
a,
|
|
37
|
+
o,
|
|
38
|
+
b,
|
|
39
|
+
s,
|
|
40
|
+
l
|
|
41
|
+
), i = this.parser.parseFromString(
|
|
42
|
+
`<table id="tempDoc"><tbody><tr>${u}</tr></tbody></table>`,
|
|
43
|
+
"text/html"
|
|
44
|
+
).querySelector(h);
|
|
45
|
+
i && t.parentNode && (i.setAttribute("id", n || ""), t.parentNode.replaceChild(i, t));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// Re-derives the typed merge tag from data-unsubscribe-page-type for any v2
|
|
49
|
+
// block whose anchor href is missing or the legacy default. Returns true when
|
|
50
|
+
// at least one href was rewritten. Typed tags and custom URLs are left intact.
|
|
51
|
+
repairUnsubscribeLinks(e) {
|
|
52
|
+
const r = e.querySelectorAll(`${h}[${k.PAGE_TYPE}]`);
|
|
53
|
+
let t = !1;
|
|
54
|
+
return r.forEach((n) => {
|
|
55
|
+
const s = n.querySelector('a[data-unsubscribe-link="true"], a.unsubscribe-link');
|
|
56
|
+
if (!s)
|
|
57
|
+
return;
|
|
58
|
+
const l = s.getAttribute("href") || "";
|
|
59
|
+
if (l && l !== f.default)
|
|
60
|
+
return;
|
|
61
|
+
const a = Number(n.getAttribute(k.PAGE_TYPE)), o = f[a];
|
|
62
|
+
o && (s.setAttribute("href", o), t = !0);
|
|
63
|
+
}), t;
|
|
64
|
+
}
|
|
43
65
|
extractPaddingClass(e) {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
66
|
+
const t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
|
|
67
|
+
return t ? t[0] : "";
|
|
46
68
|
}
|
|
47
69
|
extractUnsubscribeContent(e) {
|
|
48
|
-
var
|
|
49
|
-
const t = e.querySelector("p");
|
|
70
|
+
var d;
|
|
71
|
+
const r = e.querySelector("a.unsubscribe-link") || e.querySelector('a[href*="unsubscribe"]'), t = (r == null ? void 0 : r.closest("p")) || e.querySelector("p");
|
|
50
72
|
if (!t)
|
|
51
73
|
return {
|
|
52
74
|
textBefore: "You can ",
|
|
@@ -59,7 +81,7 @@ class C {
|
|
|
59
81
|
align: "center",
|
|
60
82
|
paragraphStyle: ""
|
|
61
83
|
};
|
|
62
|
-
const
|
|
84
|
+
const n = e.getAttribute("align") || t.getAttribute("align") || "center", s = t.getAttribute("style") || "";
|
|
63
85
|
if (!r)
|
|
64
86
|
return {
|
|
65
87
|
textBefore: "You can ",
|
|
@@ -69,55 +91,55 @@ class C {
|
|
|
69
91
|
textAfter: " from our emails, if you need to.",
|
|
70
92
|
isBold: !1,
|
|
71
93
|
isItalic: !1,
|
|
72
|
-
align:
|
|
73
|
-
paragraphStyle:
|
|
94
|
+
align: n,
|
|
95
|
+
paragraphStyle: s
|
|
74
96
|
};
|
|
75
|
-
const
|
|
97
|
+
const l = ((d = r.textContent) == null ? void 0 : d.trim()) || "unsubscribe", a = r.getAttribute("href") || "{{ins-unsubscribe-link}}", o = r.getAttribute("style") || "", b = t.textContent || "", u = b.indexOf(l), g = u >= 0 ? b.substring(0, u).trim() : "You can ", i = u >= 0 ? b.substring(u + l.length).trim() : " from our emails, if you need to.", m = !!t.querySelector("b, strong"), y = !!t.querySelector("i, em");
|
|
76
98
|
return {
|
|
77
|
-
textBefore:
|
|
78
|
-
linkText:
|
|
79
|
-
linkHref: this.normalizeUnsubscribeHref(
|
|
80
|
-
linkStyle:
|
|
81
|
-
textAfter:
|
|
82
|
-
isBold:
|
|
83
|
-
isItalic:
|
|
84
|
-
align:
|
|
85
|
-
paragraphStyle:
|
|
99
|
+
textBefore: g,
|
|
100
|
+
linkText: l,
|
|
101
|
+
linkHref: this.normalizeUnsubscribeHref(a),
|
|
102
|
+
linkStyle: o,
|
|
103
|
+
textAfter: i,
|
|
104
|
+
isBold: m,
|
|
105
|
+
isItalic: y,
|
|
106
|
+
align: n,
|
|
107
|
+
paragraphStyle: s
|
|
86
108
|
};
|
|
87
109
|
}
|
|
88
|
-
buildUnsubscribeBlock(e,
|
|
89
|
-
const
|
|
90
|
-
e.textBefore &&
|
|
91
|
-
let
|
|
92
|
-
e.isBold && e.isItalic ?
|
|
93
|
-
const
|
|
110
|
+
buildUnsubscribeBlock(e, r, t, n, s) {
|
|
111
|
+
const l = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${Object.values(f).includes(e.linkHref) ? f[r] : e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${l}>${e.linkText}</a>`, g = [];
|
|
112
|
+
e.textBefore && g.push(e.textBefore), g.push(u), e.textAfter && g.push(e.textAfter);
|
|
113
|
+
let i = g.join(" ");
|
|
114
|
+
e.isBold && e.isItalic ? i = `<strong path="1,0"><em path="1,0,0">${i}</em></strong>` : e.isBold ? i = `<strong path="1,0">${i}</strong>` : e.isItalic && (i = `<em path="1,0">${i}</em>`);
|
|
115
|
+
const m = e.align ? ` align="${e.align}"` : "", y = s ? ` bgcolor="${s}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", T = t.length > 0 ? ` ${k.PAGE_LIST}="${t.join(",")}"` : "", E = ` ${k.PAGE_TYPE}="${r}"`, S = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
|
|
94
116
|
return `
|
|
95
117
|
<td
|
|
96
118
|
data-migration="true"
|
|
97
119
|
esd-extension-block-id="unsubscribe-block"
|
|
98
|
-
class="${
|
|
99
|
-
${
|
|
120
|
+
class="${n ? `${S} ${n}` : S}"
|
|
121
|
+
${m}${y}${E}${T}
|
|
100
122
|
>
|
|
101
123
|
<p path="1"${d}>
|
|
102
|
-
${
|
|
124
|
+
${i}
|
|
103
125
|
</p>
|
|
104
126
|
</td>
|
|
105
127
|
`;
|
|
106
128
|
}
|
|
107
129
|
getCollectionTypeFromMergeTag(e) {
|
|
108
|
-
return e ===
|
|
130
|
+
return e === f[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === f[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
|
|
109
131
|
}
|
|
110
132
|
normalizeUnsubscribeHref(e) {
|
|
111
|
-
if (Object.values(
|
|
133
|
+
if (Object.values(f).includes(e))
|
|
112
134
|
return e;
|
|
113
|
-
const
|
|
114
|
-
return
|
|
135
|
+
const t = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
|
|
136
|
+
return t ? t[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
|
|
115
137
|
`[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
|
|
116
138
|
), "{{ins-unsubscribe-link}}") : e;
|
|
117
139
|
}
|
|
118
140
|
}
|
|
119
|
-
async function M(
|
|
120
|
-
return new
|
|
141
|
+
async function M(c) {
|
|
142
|
+
return new $().migrate(c);
|
|
121
143
|
}
|
|
122
144
|
export {
|
|
123
145
|
M as migrateUnsubscribe
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
|
|
3
|
+
var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as d } 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 m } from "../../store/recommendation.js";
|
|
8
|
+
import { mapLegacyStrategy as g } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const u = "recommendation-algorithm-control", i = {
|
|
10
10
|
ALGORITHM: "strategy",
|
|
11
11
|
PRODUCT_IDS: "productIds"
|
|
12
12
|
};
|
|
13
|
-
class R extends
|
|
13
|
+
class R extends d {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
17
|
-
|
|
17
|
+
a(this, "store", m());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return u;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
@@ -30,10 +30,10 @@ class R extends m {
|
|
|
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._GuTextInput({
|
|
34
34
|
name: i.PRODUCT_IDS,
|
|
35
35
|
placeholder: this.api.translate("Enter Product Ids"),
|
|
36
|
-
className: "
|
|
36
|
+
className: "es-180w"
|
|
37
37
|
})
|
|
38
38
|
])}
|
|
39
39
|
</div>
|
|
@@ -46,19 +46,11 @@ class R extends m {
|
|
|
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 = g(t.strategy) ?? t.strategy;
|
|
50
50
|
this._setProductIdsVisibility(e), this.api.updateValues({
|
|
51
51
|
[i.ALGORITHM]: e,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}), this._clearProductIdsDraft();
|
|
55
|
-
}
|
|
56
|
-
// Stripo reuses one control instance across blocks and updateValues only
|
|
57
|
-
// rebinds the committed chips — clear any un-committed draft text on switch,
|
|
58
|
-
// but not while focused (the user is mid-typing in the current block).
|
|
59
|
-
_clearProductIdsDraft() {
|
|
60
|
-
const t = this.getContainer(), e = t == null ? void 0 : t.querySelector(".product-ids-multiselect .multiple-input");
|
|
61
|
-
e && e.value !== "" && (t == null ? void 0 : t.activeElement) !== e && (e.value = "", e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
52
|
+
[i.PRODUCT_IDS]: t.productIds.join(",")
|
|
53
|
+
});
|
|
62
54
|
}
|
|
63
55
|
_initializeSelectItems() {
|
|
64
56
|
var e;
|
|
@@ -67,16 +59,16 @@ class R extends m {
|
|
|
67
59
|
try {
|
|
68
60
|
this.api.setUIEAttribute(
|
|
69
61
|
i.ALGORITHM,
|
|
70
|
-
|
|
62
|
+
h.SELECTPICKER.items,
|
|
71
63
|
t
|
|
72
64
|
);
|
|
73
|
-
} catch (
|
|
74
|
-
console.warn("[AlgorithmControl] Failed to set algorithm options:",
|
|
65
|
+
} catch (r) {
|
|
66
|
+
console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
|
|
75
67
|
}
|
|
76
68
|
}
|
|
77
69
|
_setProductIdsVisibility(t) {
|
|
78
|
-
const
|
|
79
|
-
this.api.setVisibility(i.PRODUCT_IDS,
|
|
70
|
+
const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
71
|
+
this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
|
|
80
72
|
}
|
|
81
73
|
_onAlgorithmChange(t) {
|
|
82
74
|
!this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
|
|
@@ -89,13 +81,13 @@ class R extends m {
|
|
|
89
81
|
_onProductIdsChange(t) {
|
|
90
82
|
if (!this.currentNode)
|
|
91
83
|
return;
|
|
92
|
-
const e =
|
|
93
|
-
|
|
84
|
+
const e = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
85
|
+
n.updateConfig(
|
|
94
86
|
this.api,
|
|
95
87
|
this.currentNode,
|
|
96
88
|
{ productIds: e },
|
|
97
89
|
"Updated product IDs"
|
|
98
|
-
), this.store.patchCurrentBlockConfig({ productIds: e })
|
|
90
|
+
), this.store.patchCurrentBlockConfig({ productIds: e });
|
|
99
91
|
}
|
|
100
92
|
_listenToFormUpdates() {
|
|
101
93
|
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
@@ -106,6 +98,6 @@ class R extends m {
|
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
100
|
export {
|
|
109
|
-
|
|
101
|
+
u as ALGORITHM_CONTROL_ID,
|
|
110
102
|
R as AlgorithmControl
|
|
111
103
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
const n = `/* Utils */
|
|
2
|
-
.es-180w {
|
|
3
|
-
width: 180px;
|
|
4
|
-
}
|
|
2
|
+
.es-180w { width: 180px; }
|
|
5
3
|
|
|
6
4
|
/* Recommendation Controls - Main settings panel separators */
|
|
7
|
-
.recommendation-controls-container>div {
|
|
5
|
+
.recommendation-controls-container > div {
|
|
8
6
|
border-bottom: 1px solid #eee;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
.recommendation-controls-container>div:first-child {
|
|
9
|
+
.recommendation-controls-container > div:first-child {
|
|
12
10
|
padding-top: 0;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
.recommendation-controls-container>div:last-child {
|
|
13
|
+
.recommendation-controls-container > div:last-child {
|
|
16
14
|
border-bottom: none;
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -291,62 +289,6 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
291
289
|
font-weight: 400;
|
|
292
290
|
line-height: 16px;
|
|
293
291
|
}
|
|
294
|
-
|
|
295
|
-
/* product ID multiselect — initial */
|
|
296
|
-
.product-ids-multiselect {
|
|
297
|
-
background-color: var(--guido-color-gray-0);
|
|
298
|
-
border: 1px solid var(--guido-color-gray-300);
|
|
299
|
-
width: 180px;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/* product ID multiselect — hover */
|
|
303
|
-
.product-ids-multiselect:hover {
|
|
304
|
-
border-color: var(--guido-color-primary-500);
|
|
305
|
-
background-color: var(--guido-color-gray-0) !important;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/* product ID multiselect — selected (.on) */
|
|
309
|
-
.product-ids-multiselect.on,
|
|
310
|
-
.product-ids-multiselect.on:hover {
|
|
311
|
-
border-color: var(--guido-color-primary-500);
|
|
312
|
-
box-shadow: 0 0 0 3px var(--guido-color-primary-200) !important;
|
|
313
|
-
background-color: var(--guido-color-gray-0) !important;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.product-ids-multiselect .multiple-wrapper .multiple-item {
|
|
317
|
-
display: flex;
|
|
318
|
-
align-items: center;
|
|
319
|
-
border-radius: 4px;
|
|
320
|
-
border: 1px solid var(--guido-color-primary-200);
|
|
321
|
-
background-color: var(--guido-color-primary-0);
|
|
322
|
-
font-size: 13px;
|
|
323
|
-
color: var(--guido-color-primary-500);
|
|
324
|
-
line-height: 16px;
|
|
325
|
-
box-shadow: none;
|
|
326
|
-
padding: 0 4px;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/* Close (×): always visible, moved to the right, split off by a left border (Figma).
|
|
330
|
-
Label is a text node (can't be ordered) so the icon gets order:1 to sit after it;
|
|
331
|
-
Stripo toggles visibility inline on hover, hence !important to keep it shown. */
|
|
332
|
-
.product-ids-multiselect .multiple-wrapper .multiple-item .multiple-item-remove-icon {
|
|
333
|
-
visibility: visible !important;
|
|
334
|
-
opacity: 1;
|
|
335
|
-
position: static !important;
|
|
336
|
-
order: 1;
|
|
337
|
-
margin-left: 4px;
|
|
338
|
-
border-left: 1px solid var(--guido-color-primary-200);
|
|
339
|
-
color: var(--guido-color-primary-500);
|
|
340
|
-
cursor: pointer;
|
|
341
|
-
width: 16px;
|
|
342
|
-
height: 16px;
|
|
343
|
-
padding: 4px 0 4px 3px;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.product-ids-multiselect .multiple-wrapper .multiple-item:hover {
|
|
347
|
-
background-color: var(--guido-color-primary-0);
|
|
348
|
-
padding: 0 4px;
|
|
349
|
-
}
|
|
350
292
|
`;
|
|
351
293
|
export {
|
|
352
294
|
n as default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
|
-
var i = (s,
|
|
3
|
-
var
|
|
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 u = (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 d extends I {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
u(this, "currentNode");
|
|
9
|
+
u(this, "lastBlockInstanceId", null);
|
|
10
10
|
}
|
|
11
11
|
getContainer() {
|
|
12
12
|
var e;
|
|
@@ -47,15 +47,15 @@ class _ extends I {
|
|
|
47
47
|
const t = this.getBlockInstanceId();
|
|
48
48
|
if (!t)
|
|
49
49
|
return !1;
|
|
50
|
-
const
|
|
51
|
-
return e(),
|
|
50
|
+
const o = t !== this.lastBlockInstanceId;
|
|
51
|
+
return e(), o && (this.lastBlockInstanceId = t), o;
|
|
52
52
|
}
|
|
53
|
-
_GuLabel({ text: e, name: t = "", hint:
|
|
53
|
+
_GuLabel({ text: e, name: t = "", hint: o }) {
|
|
54
54
|
return `
|
|
55
55
|
<${n.LABEL}
|
|
56
56
|
${$.LABEL.text}="${e}"
|
|
57
57
|
${$.LABEL.name}="${t || `${e} Label`}"
|
|
58
|
-
${
|
|
58
|
+
${o ? `${$.LABEL.hint}="${o}"` : ""}>
|
|
59
59
|
</${n.LABEL}>
|
|
60
60
|
`;
|
|
61
61
|
}
|
|
@@ -73,7 +73,7 @@ class _ 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: o = "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 _ 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: o })}
|
|
85
85
|
</div>
|
|
86
86
|
`;
|
|
87
87
|
}
|
|
@@ -91,7 +91,7 @@ class _ 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 o = this.getContainer(), E = o.querySelector(`[data-icon-key="${e}"]`), a = E == null ? void 0 : E.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 _ extends I {
|
|
|
104
104
|
</div>
|
|
105
105
|
`
|
|
106
106
|
);
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const T = o.querySelector(`[data-info-message="${e}"]`);
|
|
108
|
+
T && (T.style.display = "");
|
|
109
109
|
}
|
|
110
110
|
_GuToggle(e) {
|
|
111
111
|
return `
|
|
@@ -121,59 +121,59 @@ class _ 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: o, className: E = "es-180w" }) {
|
|
125
125
|
return `
|
|
126
126
|
<${n.SELECTPICKER}
|
|
127
|
-
class="${
|
|
127
|
+
class="${E}"
|
|
128
128
|
${$.SELECTPICKER.name}="${e}"
|
|
129
129
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
130
|
-
${
|
|
130
|
+
${o.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: o = "", disabled: E = !1 }) {
|
|
135
135
|
return `
|
|
136
136
|
<${n.TEXT}
|
|
137
|
-
class=${
|
|
137
|
+
class=${o}
|
|
138
138
|
${$.TEXT.name}="${e}"
|
|
139
139
|
placeholder="${t || e}"
|
|
140
|
-
${
|
|
140
|
+
${E ? `${$.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: o = 1, step: E = 1 }) {
|
|
145
145
|
return `
|
|
146
146
|
<${n.COUNTER}
|
|
147
147
|
${$.COUNTER.name}="${e}"
|
|
148
|
-
${$.COUNTER.minValue}="${
|
|
148
|
+
${$.COUNTER.minValue}="${o}"
|
|
149
149
|
${$.COUNTER.maxValue}="${t}"
|
|
150
|
-
${$.COUNTER.step}="${
|
|
150
|
+
${$.COUNTER.step}="${E}">
|
|
151
151
|
</${n.COUNTER}>
|
|
152
152
|
`;
|
|
153
153
|
}
|
|
154
|
-
_GuRadioButtonItem({ text: e, value: t, icon:
|
|
154
|
+
_GuRadioButtonItem({ text: e, value: t, icon: o }) {
|
|
155
155
|
return `
|
|
156
156
|
<${n.RADIO_ITEM}
|
|
157
157
|
${$.RADIO_ITEM.value}="${t}"
|
|
158
158
|
${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
|
|
159
|
-
${
|
|
159
|
+
${o ? `${$.RADIO_ITEM.icon}="${o}"` : ""}>
|
|
160
160
|
</${n.RADIO_ITEM}>
|
|
161
161
|
`;
|
|
162
162
|
}
|
|
163
|
-
_GuRadioButton({ name: e, buttons: t, id:
|
|
163
|
+
_GuRadioButton({ name: e, buttons: t, id: o = "" }) {
|
|
164
164
|
return `
|
|
165
165
|
<${n.RADIO_BUTTONS}
|
|
166
|
-
${
|
|
166
|
+
${o ? `id="${o}"` : ""}
|
|
167
167
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
168
|
-
${t.map((
|
|
168
|
+
${t.map((E) => this._GuRadioButtonItem(E)).join("")}
|
|
169
169
|
</${n.RADIO_BUTTONS}>
|
|
170
170
|
`;
|
|
171
171
|
}
|
|
172
|
-
_GuButton({ name: e, label: t, id:
|
|
172
|
+
_GuButton({ name: e, label: t, id: o = "" }) {
|
|
173
173
|
return `
|
|
174
174
|
<${n.BUTTON}
|
|
175
175
|
${$.BUTTON.name}="${e}"
|
|
176
|
-
${
|
|
176
|
+
${o ? `id="${o}"` : ""}
|
|
177
177
|
${$.BUTTON.caption}="${t}"}>
|
|
178
178
|
</${n.BUTTON}>
|
|
179
179
|
`;
|
|
@@ -191,10 +191,10 @@ class _ 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: o = "" }) {
|
|
195
195
|
return `
|
|
196
196
|
<${n.BUTTON}
|
|
197
|
-
class="${
|
|
197
|
+
class="${o}"
|
|
198
198
|
${$.BUTTON.name}="${e}"
|
|
199
199
|
${$.BUTTON.icon}="${t}">
|
|
200
200
|
</${n.BUTTON}>
|
|
@@ -222,19 +222,19 @@ class _ extends I {
|
|
|
222
222
|
* @returns HTML string for the orderable control
|
|
223
223
|
*/
|
|
224
224
|
_GuOrderable(e, t) {
|
|
225
|
-
let
|
|
226
|
-
t.forEach((
|
|
225
|
+
let o = "";
|
|
226
|
+
t.forEach((a) => {
|
|
227
227
|
const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
228
|
-
|
|
229
|
-
<${n.ORDERABLE_ITEM} ${l}="${
|
|
230
|
-
${
|
|
228
|
+
o += `
|
|
229
|
+
<${n.ORDERABLE_ITEM} ${l}="${a.key}">
|
|
230
|
+
${a.content}
|
|
231
231
|
</${n.ORDERABLE_ITEM}>
|
|
232
232
|
`;
|
|
233
233
|
});
|
|
234
|
-
const
|
|
234
|
+
const E = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
|
|
235
235
|
return `
|
|
236
|
-
<${n.ORDERABLE} ${
|
|
237
|
-
${
|
|
236
|
+
<${n.ORDERABLE} ${E}="${e}">
|
|
237
|
+
${o}
|
|
238
238
|
</${n.ORDERABLE}>
|
|
239
239
|
`;
|
|
240
240
|
}
|
|
@@ -275,16 +275,16 @@ class _ extends I {
|
|
|
275
275
|
`;
|
|
276
276
|
}
|
|
277
277
|
_GuRadioButtons(e, t) {
|
|
278
|
-
const
|
|
278
|
+
const o = t.map((E) => `
|
|
279
279
|
<${n.RADIO_ITEM}
|
|
280
|
-
${$.RADIO_ITEM.text}="${
|
|
281
|
-
${$.RADIO_ITEM.value}="${
|
|
280
|
+
${$.RADIO_ITEM.text}="${E.text}"
|
|
281
|
+
${$.RADIO_ITEM.value}="${E.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
|
+
${o}
|
|
288
288
|
</${n.RADIO_BUTTONS}>
|
|
289
289
|
`;
|
|
290
290
|
}
|
|
@@ -296,20 +296,7 @@ class _ 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
|
-
const r = [E, o ? "" : "click-enabled"].filter(Boolean).join(" ");
|
|
303
|
-
return `
|
|
304
|
-
<${n.MULTIPLE_SELECT}
|
|
305
|
-
class="${r}"
|
|
306
|
-
${$.MULTIPLE_SELECT.name}="${e}"
|
|
307
|
-
${$.MULTIPLE_SELECT.placeholder}="${t}"
|
|
308
|
-
${o ? `${$.MULTIPLE_SELECT.disabled}="true"` : ""}>
|
|
309
|
-
</${n.MULTIPLE_SELECT}>
|
|
310
|
-
`;
|
|
311
|
-
}
|
|
312
299
|
}
|
|
313
300
|
export {
|
|
314
|
-
|
|
301
|
+
d as CommonControl
|
|
315
302
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -21,10 +21,9 @@ export declare class AlgorithmControl extends CommonControl {
|
|
|
21
21
|
onRender(): void;
|
|
22
22
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
23
23
|
_setFormValues(): void;
|
|
24
|
-
_clearProductIdsDraft(): void;
|
|
25
24
|
_initializeSelectItems(): void;
|
|
26
25
|
_setProductIdsVisibility(strategy?: string): void;
|
|
27
26
|
_onAlgorithmChange(value: string): void;
|
|
28
|
-
_onProductIdsChange(value: string
|
|
27
|
+
_onProductIdsChange(value: string): void;
|
|
29
28
|
_listenToFormUpdates(): void;
|
|
30
29
|
}
|
|
@@ -6,12 +6,6 @@ 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
|
-
}
|
|
15
9
|
interface LabelProps {
|
|
16
10
|
text: string;
|
|
17
11
|
name?: string;
|
|
@@ -151,6 +145,5 @@ export declare abstract class CommonControl extends Control {
|
|
|
151
145
|
value: string;
|
|
152
146
|
}[]): string;
|
|
153
147
|
_GuCheckbox(name: string, caption: string): string;
|
|
154
|
-
_GuMultiSelect({ name, placeholder, className, disabled }: MultiSelectProps): string;
|
|
155
148
|
}
|
|
156
149
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.aa5cfb6",
|
|
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",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"guido": {
|
|
106
106
|
"stripo": {
|
|
107
|
-
"version": "2.
|
|
107
|
+
"version": "2.66.0"
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|