@useinsider/guido 3.18.2-beta.c25d57c → 3.18.2-beta.c512191
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.
|
@@ -1,88 +1,97 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as m, computed as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { getCsrfToken as j } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as m, computed as v } from "vue";
|
|
3
|
+
const k = (b = {}) => {
|
|
4
|
+
const d = m(!1), n = m(null), u = m(null), g = v(() => d.value), y = v(() => n.value !== null), w = {
|
|
5
5
|
baseURL: "",
|
|
6
6
|
timeout: 1e4,
|
|
7
7
|
retry: 0,
|
|
8
8
|
retryDelay: 1e3,
|
|
9
9
|
headers: {
|
|
10
10
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
11
|
+
"X-CSRF-TOKEN": j(),
|
|
12
12
|
Accept: "application/json",
|
|
13
|
+
// The panel backend only answers 401/419 to ajax requests; without this a guest
|
|
14
|
+
// fetch gets a 302 to the login page and never sees an auth status.
|
|
13
15
|
"X-Requested-With": "XMLHttpRequest"
|
|
14
16
|
},
|
|
15
17
|
...b
|
|
16
|
-
},
|
|
18
|
+
}, P = (e, r) => {
|
|
17
19
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
18
20
|
return e;
|
|
19
|
-
const t =
|
|
21
|
+
const t = r || w.baseURL || "";
|
|
20
22
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
21
|
-
},
|
|
23
|
+
}, x = (e) => new Promise((r, t) => {
|
|
22
24
|
setTimeout(() => {
|
|
23
25
|
t(new Error("Request timeout"));
|
|
24
26
|
}, e);
|
|
25
|
-
}),
|
|
26
|
-
setTimeout(
|
|
27
|
-
}), i = async (e,
|
|
28
|
-
|
|
29
|
-
const
|
|
27
|
+
}), C = (e) => new Promise((r) => {
|
|
28
|
+
setTimeout(r, e);
|
|
29
|
+
}), i = async (e, r, t, D = {}) => {
|
|
30
|
+
n.value = null, d.value = !0, u.value = new AbortController();
|
|
31
|
+
const a = { ...w, ...D }, T = P(r, a.baseURL), c = {
|
|
30
32
|
method: e,
|
|
31
|
-
headers: { ...
|
|
33
|
+
headers: { ...a.headers },
|
|
32
34
|
signal: u.value.signal,
|
|
33
|
-
...
|
|
35
|
+
...a
|
|
34
36
|
};
|
|
35
37
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
36
|
-
const E = async (
|
|
38
|
+
const E = async (p = 0) => {
|
|
37
39
|
try {
|
|
38
|
-
const o = [fetch(
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const H = `HTTP Error: ${
|
|
43
|
-
throw
|
|
40
|
+
const o = [fetch(T, c)];
|
|
41
|
+
a.timeout && o.push(x(a.timeout));
|
|
42
|
+
const s = await Promise.race(o);
|
|
43
|
+
if (!s.ok) {
|
|
44
|
+
const H = `HTTP Error: ${s.status} ${s.statusText}`, h = new Error(H);
|
|
45
|
+
throw h.status = s.status, h.statusText = s.statusText, h.response = s, [401, 403, 419].includes(s.status) && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((O) => window.dispatchEvent(new CustomEvent("insider:http-auth-error", {
|
|
46
|
+
detail: {
|
|
47
|
+
status: s.status,
|
|
48
|
+
body: O,
|
|
49
|
+
url: new URL(T, window.location.href).href
|
|
50
|
+
}
|
|
51
|
+
}))).catch(() => {
|
|
52
|
+
}), h;
|
|
44
53
|
}
|
|
45
54
|
let f;
|
|
46
|
-
const l =
|
|
47
|
-
return l != null && l.includes("application/json") ? f = await
|
|
55
|
+
const l = s.headers.get("content-type");
|
|
56
|
+
return l != null && l.includes("application/json") ? f = await s.json() : l != null && l.includes("text/") ? f = await s.text() : f = await s.blob(), {
|
|
48
57
|
data: f,
|
|
49
|
-
status:
|
|
50
|
-
statusText:
|
|
51
|
-
headers:
|
|
58
|
+
status: s.status,
|
|
59
|
+
statusText: s.statusText,
|
|
60
|
+
headers: s.headers
|
|
52
61
|
};
|
|
53
62
|
} catch (o) {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
return await
|
|
57
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
63
|
+
const s = o instanceof Error && o.name === "AbortError";
|
|
64
|
+
if (p < (a.retry || 0) && !s)
|
|
65
|
+
return await C(a.retryDelay || 1e3), E(p + 1);
|
|
66
|
+
throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
|
|
58
67
|
}
|
|
59
68
|
};
|
|
60
69
|
try {
|
|
61
70
|
return await E();
|
|
62
71
|
} finally {
|
|
63
|
-
|
|
72
|
+
d.value = !1, u.value = null;
|
|
64
73
|
}
|
|
65
|
-
},
|
|
74
|
+
}, R = (e, r) => i("GET", e, void 0, r), U = (e, r, t) => i("POST", e, r, t), $ = (e, r, t) => i("PUT", e, r, t), q = (e, r, t) => i("PATCH", e, r, t), A = (e, r) => i("DELETE", e, void 0, r), L = (e) => {
|
|
66
75
|
u.value && u.value.abort(e);
|
|
67
76
|
}, W = () => {
|
|
68
|
-
|
|
77
|
+
n.value = null;
|
|
69
78
|
};
|
|
70
79
|
return {
|
|
71
80
|
// State
|
|
72
81
|
loading: g,
|
|
73
|
-
error:
|
|
82
|
+
error: v(() => n.value),
|
|
74
83
|
hasError: y,
|
|
75
84
|
// Methods
|
|
76
85
|
request: i,
|
|
77
|
-
get:
|
|
78
|
-
post:
|
|
86
|
+
get: R,
|
|
87
|
+
post: U,
|
|
79
88
|
put: $,
|
|
80
89
|
patch: q,
|
|
81
90
|
delete: A,
|
|
82
|
-
cancel:
|
|
91
|
+
cancel: L,
|
|
83
92
|
clearError: W
|
|
84
93
|
};
|
|
85
94
|
};
|
|
86
95
|
export {
|
|
87
|
-
|
|
96
|
+
k as useHttp
|
|
88
97
|
};
|
|
@@ -67,7 +67,7 @@ class se extends ut {
|
|
|
67
67
|
(d, c) => `
|
|
68
68
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
69
69
|
<${_.BUTTON}
|
|
70
|
-
class="
|
|
70
|
+
class="drag-handle-btn flat-inline flat-white"
|
|
71
71
|
${O.BUTTON.name}="${P}${c}"
|
|
72
72
|
>
|
|
73
73
|
<${_.ICON}
|
|
@@ -328,7 +328,7 @@ class se extends ut {
|
|
|
328
328
|
_createBuiltInItemHtml(t, e) {
|
|
329
329
|
return `
|
|
330
330
|
<div class="orderable-item" draggable="true" data-key="${t.key}">
|
|
331
|
-
<span class="
|
|
331
|
+
<span class="drag-handle" data-reorder-icon-slot="${e}"></span>
|
|
332
332
|
<span class="item-label">${this.api.translate(t.label)}</span>
|
|
333
333
|
<div class="item-action" data-action-for="${t.key}"></div>
|
|
334
334
|
</div>
|
|
@@ -353,7 +353,7 @@ class se extends ut {
|
|
|
353
353
|
<div class="orderable-item price-group-item" draggable="true"
|
|
354
354
|
data-key="${C}" data-group="prices">
|
|
355
355
|
<div class="price-group-header">
|
|
356
|
-
<span class="
|
|
356
|
+
<span class="drag-handle" data-reorder-icon-slot="${t}"></span>
|
|
357
357
|
<span class="item-label">${this.api.translate("Product Prices")}</span>
|
|
358
358
|
<div class="item-action" data-action-for="${C}"></div>
|
|
359
359
|
</div>
|
|
@@ -365,7 +365,7 @@ class se extends ut {
|
|
|
365
365
|
return `
|
|
366
366
|
<div class="orderable-item" draggable="true"
|
|
367
367
|
data-key="${t}" data-custom-index="${e}">
|
|
368
|
-
<span class="
|
|
368
|
+
<span class="drag-handle" data-reorder-icon-slot="${r}"></span>
|
|
369
369
|
<div class="custom-attr-select-wrap"
|
|
370
370
|
data-custom-select-slot="${e}"></div>
|
|
371
371
|
<div class="item-action"
|
|
@@ -134,10 +134,7 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
134
134
|
border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
floating popups, which knocked this handle out of flow (SD-151734). */
|
|
139
|
-
.guido-drag-handle {
|
|
140
|
-
cursor: move;
|
|
137
|
+
.drag-handle {
|
|
141
138
|
user-select: none;
|
|
142
139
|
display: flex;
|
|
143
140
|
align-items: center;
|
|
@@ -147,13 +144,13 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
147
144
|
flex-shrink: 0;
|
|
148
145
|
}
|
|
149
146
|
|
|
150
|
-
.
|
|
147
|
+
.drag-handle .drag-handle-btn .button {
|
|
151
148
|
padding: 0;
|
|
152
149
|
min-width: auto;
|
|
153
150
|
cursor: move;
|
|
154
151
|
}
|
|
155
152
|
|
|
156
|
-
.
|
|
153
|
+
.drag-handle .drag-handle-btn .button .icon-button {
|
|
157
154
|
color: var(--guido-color-gray-600);
|
|
158
155
|
}
|
|
159
156
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.18.2-beta.
|
|
3
|
+
"version": "3.18.2-beta.c512191",
|
|
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",
|