@useinsider/guido 3.12.1-beta.3214ec4 → 3.13.0
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/README.md +16 -1
- package/dist/@types/config/schemas.js +27 -25
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +110 -101
- package/dist/composables/useAllowlist.js +50 -0
- package/dist/composables/useSave.js +42 -23
- package/dist/composables/useStripo.js +72 -69
- package/dist/composables/useUserRole.js +12 -0
- package/dist/enums/roles.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +12 -12
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +7 -7
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/services/allowlistApi.js +15 -0
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/Guido.vue.d.ts +18 -2
- package/dist/src/composables/useAllowlist.d.ts +6 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useStripo.d.ts +3 -2
- package/dist/src/composables/useUserRole.d.ts +3 -0
- package/dist/src/enums/roles.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/services/allowlistApi.d.ts +4 -0
- package/dist/src/stores/config.d.ts +21 -1
- package/dist/static/styles/components/base-input.css.js +6 -7
- package/dist/stores/config.js +21 -19
- package/dist/utils/pairProductVariables.js +44 -43
- package/dist/{extensions/Blocks/Recommendation/utils → utils}/preserveTextStyles.js +1 -1
- package/package.json +1 -1
- /package/dist/src/{extensions/Blocks/Recommendation/utils → utils}/preserveTextStyles.d.ts +0 -0
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { productPairs as
|
|
2
|
-
import { DefaultConfigValues as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { productPairs as N } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
+
import { DefaultConfigValues as O } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
3
|
+
import { preserveTextStyles as C } from "./preserveTextStyles.js";
|
|
4
|
+
function V(L) {
|
|
5
|
+
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), g = new DOMParser().parseFromString(H, "text/html"), m = N.PAIRS_FOR_EXTENSION;
|
|
5
6
|
Object.entries(m).forEach(([r, f]) => {
|
|
6
7
|
g.querySelectorAll(".ins-product-td").forEach((c) => {
|
|
7
|
-
const A = c.getAttribute("data-number") || "1",
|
|
8
|
-
c.querySelectorAll(`[product-attr="${r}"]`).forEach((
|
|
8
|
+
const A = c.getAttribute("data-number") || "1", y = c.getAttribute("data-type") || "CART_ITEMS";
|
|
9
|
+
c.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
9
10
|
var F, I, w;
|
|
10
|
-
const
|
|
11
|
+
const T = t.getAttribute("data-type") || y, u = t.getAttribute("data-number") || A, d = f[T];
|
|
11
12
|
if (d)
|
|
12
13
|
switch (r) {
|
|
13
14
|
case "imageSrc": {
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
15
|
+
let e = null, i = null;
|
|
16
|
+
if (t.tagName === "IMG" ? (e = t, i = e.closest("a")) : (e = t.querySelector("img"), i = t.querySelector("a") || t.closest("a")), !e)
|
|
16
17
|
break;
|
|
17
18
|
const a = d.DEFAULT, s = d.ATTR;
|
|
18
|
-
if (a &&
|
|
19
|
-
const o =
|
|
19
|
+
if (a && e.src) {
|
|
20
|
+
const o = e.src;
|
|
20
21
|
a.some((h) => {
|
|
21
|
-
const l = h.split("/").pop() || "",
|
|
22
|
-
return o.includes(h) || o.includes(l) ||
|
|
23
|
-
}) && (
|
|
22
|
+
const l = h.split("/").pop() || "", $ = o.split("/").pop() || "";
|
|
23
|
+
return o.includes(h) || o.includes(l) || $ === l;
|
|
24
|
+
}) && (e.src = `{{${s}_${u}}}`);
|
|
24
25
|
}
|
|
25
|
-
const n = (I = (F = m.name) == null ? void 0 : F[
|
|
26
|
-
if (n &&
|
|
27
|
-
const o = (w = m.itemLink) == null ? void 0 : w[
|
|
26
|
+
const n = (I = (F = m.name) == null ? void 0 : F[T]) == null ? void 0 : I.ATTR;
|
|
27
|
+
if (n && e.setAttribute("alt", `{{${n}_${u}}}`), i) {
|
|
28
|
+
const o = (w = m.itemLink) == null ? void 0 : w[T];
|
|
28
29
|
if (o) {
|
|
29
30
|
const E = o.HREF, h = o.DEFAULT_HREF || "#!", l = i.href;
|
|
30
31
|
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${u}}}`);
|
|
@@ -33,9 +34,9 @@ function W(M) {
|
|
|
33
34
|
break;
|
|
34
35
|
}
|
|
35
36
|
case "name": {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const n =
|
|
37
|
+
const e = d, i = e.ATTR, a = e.DEFAULT_HREF || "#!", s = e.HREF;
|
|
38
|
+
t.textContent && (t.innerHTML = C(t, `{{${i}_${u}}}`));
|
|
39
|
+
const n = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
39
40
|
if (n && s) {
|
|
40
41
|
const o = n.href, E = `${window.location.href}${a}`;
|
|
41
42
|
(o === E || o.endsWith(a)) && (n.href = `{{${s}_${u}}}`);
|
|
@@ -44,23 +45,23 @@ function W(M) {
|
|
|
44
45
|
}
|
|
45
46
|
case "price":
|
|
46
47
|
case "originalPrice": {
|
|
47
|
-
const
|
|
48
|
+
const e = d, i = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), s = i === "true", n = a === "true", o = t.getAttribute("data-curency") || "before";
|
|
48
49
|
let E;
|
|
49
|
-
n ? E = s ?
|
|
50
|
-
const h =
|
|
50
|
+
n ? E = s ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : E = s ? e.PRICE_FORMATTED : e.PRICE;
|
|
51
|
+
const h = e.CURRENCY;
|
|
51
52
|
let l = `{{${E}_${u}}}`;
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
|
|
53
|
+
const $ = (t.getAttribute("data-currency_symbol") || "").trim(), q = $ !== "" && $ !== O.productPriceCurrencySymbolControlValue;
|
|
54
|
+
let b = "";
|
|
55
|
+
q ? b = $ : h && (b = `{{${h}_${u}}}`), b && (l = o === "after" ? `${l} ${b}` : `${b} ${l}`), t.innerHTML = C(t, l);
|
|
55
56
|
break;
|
|
56
57
|
}
|
|
57
58
|
case "quantity": {
|
|
58
|
-
const
|
|
59
|
-
|
|
59
|
+
const e = d, i = e.ATTR, a = e.DEFAULT;
|
|
60
|
+
t.textContent && t.textContent.trim() === a && (t.innerHTML = C(t, `{{${i}_${u}}}`));
|
|
60
61
|
break;
|
|
61
62
|
}
|
|
62
63
|
case "button": {
|
|
63
|
-
const
|
|
64
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t.tagName === "A" ? t : t.querySelector("a");
|
|
64
65
|
if (s) {
|
|
65
66
|
const n = s.href || "", o = `${window.location.href}${a}`;
|
|
66
67
|
(n === "" || n === "#" || n === o || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${u}}}`);
|
|
@@ -68,7 +69,7 @@ function W(M) {
|
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
70
71
|
case "itemLink": {
|
|
71
|
-
const
|
|
72
|
+
const e = d, i = e.HREF, a = e.DEFAULT_HREF || "#!", s = t;
|
|
72
73
|
if (s.href) {
|
|
73
74
|
const n = s.href, o = `${window.location.href}${a}`;
|
|
74
75
|
(n === o || n.endsWith(a)) && (s.href = `{{${i}_${u}}}`);
|
|
@@ -77,8 +78,8 @@ function W(M) {
|
|
|
77
78
|
}
|
|
78
79
|
default: {
|
|
79
80
|
if ("ATTR" in d) {
|
|
80
|
-
const
|
|
81
|
-
|
|
81
|
+
const e = d.ATTR;
|
|
82
|
+
t.textContent && (t.innerHTML = C(t, `{{${e}_${u}}}`));
|
|
82
83
|
}
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
@@ -86,11 +87,11 @@ function W(M) {
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
|
-
const
|
|
90
|
-
` : "", D = g.querySelectorAll(".ins-product-td"),
|
|
90
|
+
const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
|
|
91
|
+
` : "", D = g.querySelectorAll(".ins-product-td"), M = [];
|
|
91
92
|
D.forEach((r) => {
|
|
92
93
|
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
93
|
-
|
|
94
|
+
M.push({
|
|
94
95
|
element: r,
|
|
95
96
|
outerHtml: A,
|
|
96
97
|
type: f,
|
|
@@ -99,7 +100,7 @@ function W(M) {
|
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
102
|
let _ = P + g.documentElement.outerHTML;
|
|
102
|
-
|
|
103
|
+
M.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
103
104
|
let c = "";
|
|
104
105
|
switch (f) {
|
|
105
106
|
case "CART_ITEMS":
|
|
@@ -113,21 +114,21 @@ function W(M) {
|
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
116
|
if (c) {
|
|
116
|
-
const
|
|
117
|
-
_ = _.replace(r,
|
|
117
|
+
const y = parseInt(p) - 1, T = `${`{% if ${c} > ${y} %}`}${r}{% endif %}`;
|
|
118
|
+
_ = _.replace(r, T);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const
|
|
121
|
-
return
|
|
121
|
+
const x = g.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
122
|
+
return x.forEach((r) => {
|
|
122
123
|
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
123
124
|
if (!f || p !== "CART_ITEMS")
|
|
124
125
|
return;
|
|
125
126
|
const c = r.closest(".product-original-price-class");
|
|
126
127
|
if (c) {
|
|
127
128
|
const A = c.outerHTML;
|
|
128
|
-
|
|
129
|
+
R.some((S) => S.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
|
|
129
130
|
}
|
|
130
|
-
}),
|
|
131
|
+
}), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
|
|
131
132
|
const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
|
|
132
133
|
if (!_.includes(p) && !r.includes("{% if")) {
|
|
133
134
|
const A = `${p}${r}{% endif %}`;
|
|
@@ -136,5 +137,5 @@ function W(M) {
|
|
|
136
137
|
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
137
138
|
}
|
|
138
139
|
export {
|
|
139
|
-
|
|
140
|
+
V as pairProductVariables
|
|
140
141
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { escapeHtml as g } from "
|
|
1
|
+
import { escapeHtml as g } from "./htmlEscape.js";
|
|
2
2
|
function u(n) {
|
|
3
3
|
return "getInnerHTML" in n && typeof n.getInnerHTML == "function" ? n.getInnerHTML().trim() : "innerHTML" in n ? n.innerHTML : "";
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
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",
|
|
File without changes
|