@ozdao/prometheus-framework 0.1.23 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/BackofficeGallery-0e0132f5.mjs +306 -0
- package/dist/BackofficeGallery-a52a27b6.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-19e23006.mjs +1945 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-f3d37f29.js +1 -0
- package/dist/Button-d8e72ac0.mjs +296 -0
- package/dist/Button-ee08e6bf.js +1 -0
- package/dist/ButtonFollow-00d85977.mjs +133 -0
- package/dist/ButtonFollow-7c0180b3.js +1 -0
- package/dist/CardOrganization-3f4a13d3.mjs +230 -0
- package/dist/CardOrganization-bf366e4e.js +1 -0
- package/dist/Feed-0b1dad65.js +1 -0
- package/dist/Feed-8110366a.mjs +439 -0
- package/dist/Feed-82ad8e29.mjs +368 -0
- package/dist/Feed-c8b1c72d.js +1 -0
- package/dist/Image-2269667e.js +9 -0
- package/dist/Image-7dcfe90d.mjs +477 -0
- package/dist/MenuItem-1216a99f.js +1 -0
- package/dist/MenuItem-97c50b97.mjs +93 -0
- package/dist/Popup-0420381f.js +1 -0
- package/dist/Popup-47b37484.mjs +76 -0
- package/dist/Product-977a8a7f.js +7 -0
- package/dist/Product-bbe7171a.mjs +842 -0
- package/dist/ProductEdit-e4cad9d1.js +1 -0
- package/dist/ProductEdit-f7a9af17.mjs +303 -0
- package/dist/ProfileBlogposts-5379335e.js +1 -0
- package/dist/ProfileBlogposts-5deee0c5.mjs +65 -0
- package/dist/ProfileComments-3cf3e265.mjs +44 -0
- package/dist/ProfileComments-8c9146ef.js +1 -0
- package/dist/ProfileEvents-7502ed90.mjs +57 -0
- package/dist/ProfileEvents-ea023c17.js +1 -0
- package/dist/ProfileLikes-23b6f2f9.js +1 -0
- package/dist/ProfileLikes-5b52e4ae.mjs +44 -0
- package/dist/ProfileOrganizations-769325c7.js +1 -0
- package/dist/ProfileOrganizations-c5151835.mjs +214 -0
- package/dist/Publics-4438ca51.js +1 -0
- package/dist/Publics-538180a8.mjs +45 -0
- package/dist/UploadImage-33f6a9f4.js +1 -0
- package/dist/UploadImage-f7b0335f.mjs +83 -0
- package/dist/UploadImageMultiple-297b3897.js +1 -0
- package/dist/UploadImageMultiple-7b132ba0.mjs +58 -0
- package/dist/auth-2f9b2dfc.js +7 -0
- package/dist/auth-b047fdc0.mjs +612 -0
- package/dist/auth.client.cjs +8 -8
- package/dist/auth.client.js +24 -23
- package/dist/auth.validation-02e0629b.mjs +20 -0
- package/dist/auth.validation-6a59443b.js +1 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +1 -1
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +69 -68
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +21 -20
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/index-0ab9d59c.mjs +934 -0
- package/dist/index-7ecbf72a.js +2 -0
- package/dist/legal.client.cjs +1 -0
- package/dist/legal.client.js +8426 -0
- package/dist/modules/landing/components/pages/Legal.vue.d.ts +2 -0
- package/dist/modules/landing/components/pages/legal/Cookies.vue.d.ts +2 -0
- package/dist/modules/landing/components/pages/legal/Privacy.vue.d.ts +2 -0
- package/dist/modules/landing/components/pages/legal/Terms.vue.d.ts +2 -0
- package/dist/modules/legal/components/pages/Legal.vue.d.ts +2 -0
- package/dist/modules/legal/components/pages/legal/Cookies.vue.d.ts +2 -0
- package/dist/modules/legal/components/pages/legal/Privacy.vue.d.ts +2 -0
- package/dist/modules/legal/components/pages/legal/Terms.vue.d.ts +2 -0
- package/dist/organizations-aed4245d.mjs +122 -0
- package/dist/organizations-bb8f676d.js +1 -0
- package/dist/organizations.client-5548024c.js +3 -0
- package/dist/organizations.client-976762d2.mjs +3021 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +45 -44
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +254 -324
- package/package.json +5 -1
- package/src/modules/community/components/pages/CreateBlogPost.vue +1 -1
- package/src/modules/constructor/components/sections/Constructor.vue +3 -3
- package/src/modules/files/middlewares/server/middlewareMulter.js +1 -2
- package/src/modules/landing/landing.client.js +1 -2
- package/src/modules/legal/components/pages/Legal.vue +43 -0
- package/src/modules/legal/components/pages/legal/Cookies.vue +370 -0
- package/src/modules/legal/components/pages/legal/Privacy.vue +4284 -0
- package/src/modules/legal/components/pages/legal/Terms.vue +1283 -0
- package/src/modules/legal/legal.client.js +16 -0
- package/src/modules/legal/router/legal.js +22 -0
- package/src/modules/users/components/pages/Profile.vue +13 -0
@@ -0,0 +1,612 @@
|
|
1
|
+
import { g as le, a as z } from "./index-0ab9d59c.mjs";
|
2
|
+
import { reactive as N, watch as Z } from "vue";
|
3
|
+
import { s as x } from "./globals-96ba60e4.mjs";
|
4
|
+
var Q = { exports: {} };
|
5
|
+
/*!
|
6
|
+
* JavaScript Cookie v2.2.1
|
7
|
+
* https://github.com/js-cookie/js-cookie
|
8
|
+
*
|
9
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
10
|
+
* Released under the MIT license
|
11
|
+
*/
|
12
|
+
(function(r, e) {
|
13
|
+
(function(t) {
|
14
|
+
var o;
|
15
|
+
if (r.exports = t(), o = !0, !o) {
|
16
|
+
var n = window.Cookies, s = window.Cookies = t();
|
17
|
+
s.noConflict = function() {
|
18
|
+
return window.Cookies = n, s;
|
19
|
+
};
|
20
|
+
}
|
21
|
+
})(function() {
|
22
|
+
function t() {
|
23
|
+
for (var s = 0, i = {}; s < arguments.length; s++) {
|
24
|
+
var a = arguments[s];
|
25
|
+
for (var d in a)
|
26
|
+
i[d] = a[d];
|
27
|
+
}
|
28
|
+
return i;
|
29
|
+
}
|
30
|
+
function o(s) {
|
31
|
+
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
32
|
+
}
|
33
|
+
function n(s) {
|
34
|
+
function i() {
|
35
|
+
}
|
36
|
+
function a(c, p, l) {
|
37
|
+
if (!(typeof document > "u")) {
|
38
|
+
l = t({
|
39
|
+
path: "/"
|
40
|
+
}, i.defaults, l), typeof l.expires == "number" && (l.expires = new Date(/* @__PURE__ */ new Date() * 1 + l.expires * 864e5)), l.expires = l.expires ? l.expires.toUTCString() : "";
|
41
|
+
try {
|
42
|
+
var b = JSON.stringify(p);
|
43
|
+
/^[\{\[]/.test(b) && (p = b);
|
44
|
+
} catch {
|
45
|
+
}
|
46
|
+
p = s.write ? s.write(p, c) : encodeURIComponent(String(p)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), c = encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape);
|
47
|
+
var y = "";
|
48
|
+
for (var C in l)
|
49
|
+
l[C] && (y += "; " + C, l[C] !== !0 && (y += "=" + l[C].split(";")[0]));
|
50
|
+
return document.cookie = c + "=" + p + y;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
function d(c, p) {
|
54
|
+
if (!(typeof document > "u")) {
|
55
|
+
for (var l = {}, b = document.cookie ? document.cookie.split("; ") : [], y = 0; y < b.length; y++) {
|
56
|
+
var C = b[y].split("="), h = C.slice(1).join("=");
|
57
|
+
!p && h.charAt(0) === '"' && (h = h.slice(1, -1));
|
58
|
+
try {
|
59
|
+
var U = o(C[0]);
|
60
|
+
if (h = (s.read || s)(h, U) || o(h), p)
|
61
|
+
try {
|
62
|
+
h = JSON.parse(h);
|
63
|
+
} catch {
|
64
|
+
}
|
65
|
+
if (l[U] = h, c === U)
|
66
|
+
break;
|
67
|
+
} catch {
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return c ? l[c] : l;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return i.set = a, i.get = function(c) {
|
74
|
+
return d(
|
75
|
+
c,
|
76
|
+
!1
|
77
|
+
/* read as raw */
|
78
|
+
);
|
79
|
+
}, i.getJSON = function(c) {
|
80
|
+
return d(
|
81
|
+
c,
|
82
|
+
!0
|
83
|
+
/* read as json */
|
84
|
+
);
|
85
|
+
}, i.remove = function(c, p) {
|
86
|
+
a(c, "", t(p, {
|
87
|
+
expires: -1
|
88
|
+
}));
|
89
|
+
}, i.defaults = {}, i.withConverter = n, i;
|
90
|
+
}
|
91
|
+
return n(function() {
|
92
|
+
});
|
93
|
+
});
|
94
|
+
})(Q);
|
95
|
+
var de = Q.exports;
|
96
|
+
const D = /* @__PURE__ */ le(de);
|
97
|
+
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
98
|
+
const ue = (r) => {
|
99
|
+
const e = /* @__PURE__ */ new Map();
|
100
|
+
e.set("web", { name: "web" });
|
101
|
+
const t = r.CapacitorPlatforms || {
|
102
|
+
currentPlatform: { name: "web" },
|
103
|
+
platforms: e
|
104
|
+
}, o = (s, i) => {
|
105
|
+
t.platforms.set(s, i);
|
106
|
+
}, n = (s) => {
|
107
|
+
t.platforms.has(s) && (t.currentPlatform = t.platforms.get(s));
|
108
|
+
};
|
109
|
+
return t.addPlatform = o, t.setPlatform = n, t;
|
110
|
+
}, fe = (r) => r.CapacitorPlatforms = ue(r), X = /* @__PURE__ */ fe(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
111
|
+
X.addPlatform;
|
112
|
+
X.setPlatform;
|
113
|
+
var _;
|
114
|
+
(function(r) {
|
115
|
+
r.Unimplemented = "UNIMPLEMENTED", r.Unavailable = "UNAVAILABLE";
|
116
|
+
})(_ || (_ = {}));
|
117
|
+
class q extends Error {
|
118
|
+
constructor(e, t, o) {
|
119
|
+
super(e), this.message = e, this.code = t, this.data = o;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
const pe = (r) => {
|
123
|
+
var e, t;
|
124
|
+
return r != null && r.androidBridge ? "android" : !((t = (e = r == null ? void 0 : r.webkit) === null || e === void 0 ? void 0 : e.messageHandlers) === null || t === void 0) && t.bridge ? "ios" : "web";
|
125
|
+
}, me = (r) => {
|
126
|
+
var e, t, o, n, s;
|
127
|
+
const i = r.CapacitorCustomPlatform || null, a = r.Capacitor || {}, d = a.Plugins = a.Plugins || {}, c = r.CapacitorPlatforms, p = () => i !== null ? i.name : pe(r), l = ((e = c == null ? void 0 : c.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || p, b = () => l() !== "web", y = ((t = c == null ? void 0 : c.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || b, C = (u) => {
|
128
|
+
const f = H.get(u);
|
129
|
+
return !!(f != null && f.platforms.has(l()) || R(u));
|
130
|
+
}, h = ((o = c == null ? void 0 : c.currentPlatform) === null || o === void 0 ? void 0 : o.isPluginAvailable) || C, U = (u) => {
|
131
|
+
var f;
|
132
|
+
return (f = a.PluginHeaders) === null || f === void 0 ? void 0 : f.find((E) => E.name === u);
|
133
|
+
}, R = ((n = c == null ? void 0 : c.currentPlatform) === null || n === void 0 ? void 0 : n.getPluginHeader) || U, re = (u) => r.console.error(u), se = (u, f, E) => Promise.reject(`${E} does not have an implementation of "${f}".`), H = /* @__PURE__ */ new Map(), ne = (u, f = {}) => {
|
134
|
+
const E = H.get(u);
|
135
|
+
if (E)
|
136
|
+
return console.warn(`Capacitor plugin "${u}" already registered. Cannot register plugins twice.`), E.proxy;
|
137
|
+
const k = l(), S = R(u);
|
138
|
+
let O;
|
139
|
+
const ae = async () => (!O && k in f ? O = typeof f[k] == "function" ? O = await f[k]() : O = f[k] : i !== null && !O && "web" in f && (O = typeof f.web == "function" ? O = await f.web() : O = f.web), O), ie = (m, w) => {
|
140
|
+
var P, L;
|
141
|
+
if (S) {
|
142
|
+
const j = S == null ? void 0 : S.methods.find((v) => w === v.name);
|
143
|
+
if (j)
|
144
|
+
return j.rtype === "promise" ? (v) => a.nativePromise(u, w.toString(), v) : (v, T) => a.nativeCallback(u, w.toString(), v, T);
|
145
|
+
if (m)
|
146
|
+
return (P = m[w]) === null || P === void 0 ? void 0 : P.bind(m);
|
147
|
+
} else {
|
148
|
+
if (m)
|
149
|
+
return (L = m[w]) === null || L === void 0 ? void 0 : L.bind(m);
|
150
|
+
throw new q(`"${u}" plugin is not implemented on ${k}`, _.Unimplemented);
|
151
|
+
}
|
152
|
+
}, B = (m) => {
|
153
|
+
let w;
|
154
|
+
const P = (...L) => {
|
155
|
+
const j = ae().then((v) => {
|
156
|
+
const T = ie(v, m);
|
157
|
+
if (T) {
|
158
|
+
const I = T(...L);
|
159
|
+
return w = I == null ? void 0 : I.remove, I;
|
160
|
+
} else
|
161
|
+
throw new q(`"${u}.${m}()" is not implemented on ${k}`, _.Unimplemented);
|
162
|
+
});
|
163
|
+
return m === "addListener" && (j.remove = async () => w()), j;
|
164
|
+
};
|
165
|
+
return P.toString = () => `${m.toString()}() { [capacitor code] }`, Object.defineProperty(P, "name", {
|
166
|
+
value: m,
|
167
|
+
writable: !1,
|
168
|
+
configurable: !1
|
169
|
+
}), P;
|
170
|
+
}, J = B("addListener"), G = B("removeListener"), ce = (m, w) => {
|
171
|
+
const P = J({ eventName: m }, w), L = async () => {
|
172
|
+
const v = await P;
|
173
|
+
G({
|
174
|
+
eventName: m,
|
175
|
+
callbackId: v
|
176
|
+
}, w);
|
177
|
+
}, j = new Promise((v) => P.then(() => v({ remove: L })));
|
178
|
+
return j.remove = async () => {
|
179
|
+
console.warn("Using addListener() without 'await' is deprecated."), await L();
|
180
|
+
}, j;
|
181
|
+
}, W = new Proxy({}, {
|
182
|
+
get(m, w) {
|
183
|
+
switch (w) {
|
184
|
+
case "$$typeof":
|
185
|
+
return;
|
186
|
+
case "toJSON":
|
187
|
+
return () => ({});
|
188
|
+
case "addListener":
|
189
|
+
return S ? ce : J;
|
190
|
+
case "removeListener":
|
191
|
+
return G;
|
192
|
+
default:
|
193
|
+
return B(w);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
});
|
197
|
+
return d[u] = W, H.set(u, {
|
198
|
+
name: u,
|
199
|
+
proxy: W,
|
200
|
+
platforms: /* @__PURE__ */ new Set([
|
201
|
+
...Object.keys(f),
|
202
|
+
...S ? [k] : []
|
203
|
+
])
|
204
|
+
}), W;
|
205
|
+
}, oe = ((s = c == null ? void 0 : c.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ne;
|
206
|
+
return a.convertFileSrc || (a.convertFileSrc = (u) => u), a.getPlatform = l, a.handleError = re, a.isNativePlatform = y, a.isPluginAvailable = h, a.pluginMethodNoop = se, a.registerPlugin = oe, a.Exception = q, a.DEBUG = !!a.DEBUG, a.isLoggingEnabled = !!a.isLoggingEnabled, a.platform = a.getPlatform(), a.isNative = a.isNativePlatform(), a;
|
207
|
+
}, ge = (r) => r.Capacitor = me(r), M = /* @__PURE__ */ ge(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}), Y = M.registerPlugin;
|
208
|
+
M.Plugins;
|
209
|
+
class ee {
|
210
|
+
constructor(e) {
|
211
|
+
this.listeners = {}, this.windowListeners = {}, e && (console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`), this.config = e);
|
212
|
+
}
|
213
|
+
addListener(e, t) {
|
214
|
+
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t);
|
215
|
+
const n = this.windowListeners[e];
|
216
|
+
n && !n.registered && this.addWindowListener(n);
|
217
|
+
const s = async () => this.removeListener(e, t), i = Promise.resolve({ remove: s });
|
218
|
+
return Object.defineProperty(i, "remove", {
|
219
|
+
value: async () => {
|
220
|
+
console.warn("Using addListener() without 'await' is deprecated."), await s();
|
221
|
+
}
|
222
|
+
}), i;
|
223
|
+
}
|
224
|
+
async removeAllListeners() {
|
225
|
+
this.listeners = {};
|
226
|
+
for (const e in this.windowListeners)
|
227
|
+
this.removeWindowListener(this.windowListeners[e]);
|
228
|
+
this.windowListeners = {};
|
229
|
+
}
|
230
|
+
notifyListeners(e, t) {
|
231
|
+
const o = this.listeners[e];
|
232
|
+
o && o.forEach((n) => n(t));
|
233
|
+
}
|
234
|
+
hasListeners(e) {
|
235
|
+
return !!this.listeners[e].length;
|
236
|
+
}
|
237
|
+
registerWindowListener(e, t) {
|
238
|
+
this.windowListeners[t] = {
|
239
|
+
registered: !1,
|
240
|
+
windowEventName: e,
|
241
|
+
pluginEventName: t,
|
242
|
+
handler: (o) => {
|
243
|
+
this.notifyListeners(t, o);
|
244
|
+
}
|
245
|
+
};
|
246
|
+
}
|
247
|
+
unimplemented(e = "not implemented") {
|
248
|
+
return new M.Exception(e, _.Unimplemented);
|
249
|
+
}
|
250
|
+
unavailable(e = "not available") {
|
251
|
+
return new M.Exception(e, _.Unavailable);
|
252
|
+
}
|
253
|
+
async removeListener(e, t) {
|
254
|
+
const o = this.listeners[e];
|
255
|
+
if (!o)
|
256
|
+
return;
|
257
|
+
const n = o.indexOf(t);
|
258
|
+
this.listeners[e].splice(n, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
259
|
+
}
|
260
|
+
addWindowListener(e) {
|
261
|
+
window.addEventListener(e.windowEventName, e.handler), e.registered = !0;
|
262
|
+
}
|
263
|
+
removeWindowListener(e) {
|
264
|
+
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
const K = (r) => encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), V = (r) => r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
268
|
+
class we extends ee {
|
269
|
+
async getCookies() {
|
270
|
+
const e = document.cookie, t = {};
|
271
|
+
return e.split(";").forEach((o) => {
|
272
|
+
if (o.length <= 0)
|
273
|
+
return;
|
274
|
+
let [n, s] = o.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
275
|
+
n = V(n).trim(), s = V(s).trim(), t[n] = s;
|
276
|
+
}), t;
|
277
|
+
}
|
278
|
+
async setCookie(e) {
|
279
|
+
try {
|
280
|
+
const t = K(e.key), o = K(e.value), n = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), i = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
281
|
+
document.cookie = `${t}=${o || ""}${n}; path=${s}; ${i};`;
|
282
|
+
} catch (t) {
|
283
|
+
return Promise.reject(t);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
async deleteCookie(e) {
|
287
|
+
try {
|
288
|
+
document.cookie = `${e.key}=; Max-Age=0`;
|
289
|
+
} catch (t) {
|
290
|
+
return Promise.reject(t);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
async clearCookies() {
|
294
|
+
try {
|
295
|
+
const e = document.cookie.split(";") || [];
|
296
|
+
for (const t of e)
|
297
|
+
document.cookie = t.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
298
|
+
} catch (e) {
|
299
|
+
return Promise.reject(e);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
async clearAllCookies() {
|
303
|
+
try {
|
304
|
+
await this.clearCookies();
|
305
|
+
} catch (e) {
|
306
|
+
return Promise.reject(e);
|
307
|
+
}
|
308
|
+
}
|
309
|
+
}
|
310
|
+
const te = Y("CapacitorCookies", {
|
311
|
+
web: () => new we()
|
312
|
+
}), he = async (r) => new Promise((e, t) => {
|
313
|
+
const o = new FileReader();
|
314
|
+
o.onload = () => {
|
315
|
+
const n = o.result;
|
316
|
+
e(n.indexOf(",") >= 0 ? n.split(",")[1] : n);
|
317
|
+
}, o.onerror = (n) => t(n), o.readAsDataURL(r);
|
318
|
+
}), ve = (r = {}) => {
|
319
|
+
const e = Object.keys(r);
|
320
|
+
return Object.keys(r).map((n) => n.toLocaleLowerCase()).reduce((n, s, i) => (n[s] = r[e[i]], n), {});
|
321
|
+
}, Pe = (r, e = !0) => r ? Object.entries(r).reduce((o, n) => {
|
322
|
+
const [s, i] = n;
|
323
|
+
let a, d;
|
324
|
+
return Array.isArray(i) ? (d = "", i.forEach((c) => {
|
325
|
+
a = e ? encodeURIComponent(c) : c, d += `${s}=${a}&`;
|
326
|
+
}), d.slice(0, -1)) : (a = e ? encodeURIComponent(i) : i, d = `${s}=${a}`), `${o}&${d}`;
|
327
|
+
}, "").substr(1) : null, be = (r, e = {}) => {
|
328
|
+
const t = Object.assign({ method: r.method || "GET", headers: r.headers }, e), n = ve(r.headers)["content-type"] || "";
|
329
|
+
if (typeof r.data == "string")
|
330
|
+
t.body = r.data;
|
331
|
+
else if (n.includes("application/x-www-form-urlencoded")) {
|
332
|
+
const s = new URLSearchParams();
|
333
|
+
for (const [i, a] of Object.entries(r.data || {}))
|
334
|
+
s.set(i, a);
|
335
|
+
t.body = s.toString();
|
336
|
+
} else if (n.includes("multipart/form-data")) {
|
337
|
+
const s = new FormData();
|
338
|
+
if (r.data instanceof FormData)
|
339
|
+
r.data.forEach((a, d) => {
|
340
|
+
s.append(d, a);
|
341
|
+
});
|
342
|
+
else
|
343
|
+
for (const a of Object.keys(r.data))
|
344
|
+
s.append(a, r.data[a]);
|
345
|
+
t.body = s;
|
346
|
+
const i = new Headers(t.headers);
|
347
|
+
i.delete("content-type"), t.headers = i;
|
348
|
+
} else
|
349
|
+
(n.includes("application/json") || typeof r.data == "object") && (t.body = JSON.stringify(r.data));
|
350
|
+
return t;
|
351
|
+
};
|
352
|
+
class ye extends ee {
|
353
|
+
/**
|
354
|
+
* Perform an Http request given a set of options
|
355
|
+
* @param options Options to build the HTTP request
|
356
|
+
*/
|
357
|
+
async request(e) {
|
358
|
+
const t = be(e, e.webFetchExtra), o = Pe(e.params, e.shouldEncodeUrlParams), n = o ? `${e.url}?${o}` : e.url, s = await fetch(n, t), i = s.headers.get("content-type") || "";
|
359
|
+
let { responseType: a = "text" } = s.ok ? e : {};
|
360
|
+
i.includes("application/json") && (a = "json");
|
361
|
+
let d, c;
|
362
|
+
switch (a) {
|
363
|
+
case "arraybuffer":
|
364
|
+
case "blob":
|
365
|
+
c = await s.blob(), d = await he(c);
|
366
|
+
break;
|
367
|
+
case "json":
|
368
|
+
d = await s.json();
|
369
|
+
break;
|
370
|
+
case "document":
|
371
|
+
case "text":
|
372
|
+
default:
|
373
|
+
d = await s.text();
|
374
|
+
}
|
375
|
+
const p = {};
|
376
|
+
return s.headers.forEach((l, b) => {
|
377
|
+
p[b] = l;
|
378
|
+
}), {
|
379
|
+
data: d,
|
380
|
+
headers: p,
|
381
|
+
status: s.status,
|
382
|
+
url: s.url
|
383
|
+
};
|
384
|
+
}
|
385
|
+
/**
|
386
|
+
* Perform an Http GET request given a set of options
|
387
|
+
* @param options Options to build the HTTP request
|
388
|
+
*/
|
389
|
+
async get(e) {
|
390
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "GET" }));
|
391
|
+
}
|
392
|
+
/**
|
393
|
+
* Perform an Http POST request given a set of options
|
394
|
+
* @param options Options to build the HTTP request
|
395
|
+
*/
|
396
|
+
async post(e) {
|
397
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "POST" }));
|
398
|
+
}
|
399
|
+
/**
|
400
|
+
* Perform an Http PUT request given a set of options
|
401
|
+
* @param options Options to build the HTTP request
|
402
|
+
*/
|
403
|
+
async put(e) {
|
404
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PUT" }));
|
405
|
+
}
|
406
|
+
/**
|
407
|
+
* Perform an Http PATCH request given a set of options
|
408
|
+
* @param options Options to build the HTTP request
|
409
|
+
*/
|
410
|
+
async patch(e) {
|
411
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PATCH" }));
|
412
|
+
}
|
413
|
+
/**
|
414
|
+
* Perform an Http DELETE request given a set of options
|
415
|
+
* @param options Options to build the HTTP request
|
416
|
+
*/
|
417
|
+
async delete(e) {
|
418
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "DELETE" }));
|
419
|
+
}
|
420
|
+
}
|
421
|
+
Y("CapacitorHttp", {
|
422
|
+
web: () => new ye()
|
423
|
+
});
|
424
|
+
const Ce = z.create({ baseURL: process.env.API_URL, withCredentials: !0 }), $ = N({
|
425
|
+
code: {
|
426
|
+
value: "",
|
427
|
+
type: "",
|
428
|
+
method: "",
|
429
|
+
isSended: !1,
|
430
|
+
isValid: !1
|
431
|
+
}
|
432
|
+
});
|
433
|
+
async function Oe(r, e, t) {
|
434
|
+
return await Ce.post("/api/twofa/sendcode", {
|
435
|
+
phone: r.phone.number,
|
436
|
+
email: r.email,
|
437
|
+
method: e,
|
438
|
+
type: t
|
439
|
+
}).then(
|
440
|
+
(o) => ($.code = o.data, $.code.isSended = !0, Promise.resolve(o.data)),
|
441
|
+
(o) => (console.log(o), x(o), Promise.reject(o))
|
442
|
+
);
|
443
|
+
}
|
444
|
+
Z($, (r, e) => {
|
445
|
+
});
|
446
|
+
const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
447
|
+
__proto__: null,
|
448
|
+
sendCode: Oe,
|
449
|
+
state: $
|
450
|
+
}, Symbol.toStringTag, { value: "Module" })), A = z.create({ baseURL: process.env.API_URL, withCredentials: !0 }), g = N({
|
451
|
+
user: {
|
452
|
+
_id: "",
|
453
|
+
username: "",
|
454
|
+
email: "",
|
455
|
+
phone: "",
|
456
|
+
password: "",
|
457
|
+
passwordRepeat: ""
|
458
|
+
},
|
459
|
+
access: {
|
460
|
+
roles: null,
|
461
|
+
token: null,
|
462
|
+
status: !1
|
463
|
+
}
|
464
|
+
});
|
465
|
+
if (D.get("user")) {
|
466
|
+
const { _id: r, email: e, phone: t, roles: o, accessToken: n } = JSON.parse(D.get("user"));
|
467
|
+
Object.assign(g.user, { _id: r, email: e, phone: t }), Object.assign(g.access, { token: n, roles: o, status: !!n }), A.interceptors.request.use((s) => (n && (s.headers["x-access-token"] = n), s), (s) => Promise.reject(s));
|
468
|
+
}
|
469
|
+
const Le = {
|
470
|
+
async login(r, e) {
|
471
|
+
try {
|
472
|
+
const t = await A.post("/api/auth/signin", {
|
473
|
+
...r,
|
474
|
+
type: e
|
475
|
+
});
|
476
|
+
return F("user", t.data), Object.assign(g.user, {
|
477
|
+
...t.data
|
478
|
+
}), Object.assign(g.access, {
|
479
|
+
token: t.data.accessToken,
|
480
|
+
status: !0,
|
481
|
+
roles: t.data.roles
|
482
|
+
}), t.data;
|
483
|
+
} catch (t) {
|
484
|
+
return Object.assign(g.access, {
|
485
|
+
token: null,
|
486
|
+
status: !1,
|
487
|
+
roles: null
|
488
|
+
}), x(t), Promise.reject(t);
|
489
|
+
}
|
490
|
+
},
|
491
|
+
async signup(r, e, t) {
|
492
|
+
const { password: o, passwordRepeat: n } = g.user;
|
493
|
+
if (o !== n) {
|
494
|
+
const s = {
|
495
|
+
response: {
|
496
|
+
data: { errorCode: "PASSWORDS_DO_NOT_MATCH" }
|
497
|
+
}
|
498
|
+
};
|
499
|
+
throw x(s), new Error(s.response.status);
|
500
|
+
}
|
501
|
+
try {
|
502
|
+
r.phone = r.phone.number;
|
503
|
+
const s = await A.post("/api/auth/signup", {
|
504
|
+
...r,
|
505
|
+
type: e,
|
506
|
+
inviteCode: t
|
507
|
+
});
|
508
|
+
return s.data.accessToken && F("user", s.data), Object.assign(g.user, {
|
509
|
+
...s.data
|
510
|
+
}), Object.assign(g.access, {
|
511
|
+
token: s.data.accessToken,
|
512
|
+
status: !0,
|
513
|
+
roles: s.data.roles
|
514
|
+
}), s.data;
|
515
|
+
} catch (s) {
|
516
|
+
throw x(s), console.log("Sign up falied"), s;
|
517
|
+
}
|
518
|
+
},
|
519
|
+
logout() {
|
520
|
+
ke("user"), Object.assign(g.user, {
|
521
|
+
email: "",
|
522
|
+
phone: "",
|
523
|
+
password: "",
|
524
|
+
passwordRepeat: ""
|
525
|
+
}), Object.assign(g.access, {
|
526
|
+
token: null,
|
527
|
+
status: !1
|
528
|
+
});
|
529
|
+
},
|
530
|
+
async resetPassword(r, e) {
|
531
|
+
try {
|
532
|
+
const t = await A.post("/api/auth/reset-password", {
|
533
|
+
email: r.email,
|
534
|
+
phone: r.phone.number,
|
535
|
+
type: e
|
536
|
+
});
|
537
|
+
return Object.assign($.code, {
|
538
|
+
...t.data,
|
539
|
+
isSended: !0
|
540
|
+
}), t.data;
|
541
|
+
} catch (t) {
|
542
|
+
return x(t), Promise.reject(t);
|
543
|
+
}
|
544
|
+
},
|
545
|
+
async updatePassword(r, e) {
|
546
|
+
const { password: t, passwordRepeat: o } = g.user;
|
547
|
+
if (t !== o) {
|
548
|
+
const n = {
|
549
|
+
response: {
|
550
|
+
data: { errorCode: "PASSWORDS_DO_NOT_MATCH" }
|
551
|
+
}
|
552
|
+
};
|
553
|
+
throw x(n), new Error(n.response.status);
|
554
|
+
}
|
555
|
+
try {
|
556
|
+
const n = await A.post("/api/auth/update-password", {
|
557
|
+
email: r.email,
|
558
|
+
phone: r.phone.number,
|
559
|
+
password: r.password,
|
560
|
+
passwordRepeat: r.passwordRepeat,
|
561
|
+
type: e
|
562
|
+
});
|
563
|
+
return n.data.accessToken && F("user", n.data), Object.assign(g.user, {
|
564
|
+
...n.data
|
565
|
+
}), Object.assign(g.access, {
|
566
|
+
token: n.data.accessToken,
|
567
|
+
status: !0
|
568
|
+
}), n.data;
|
569
|
+
} catch (n) {
|
570
|
+
return x(n), Promise.reject(n);
|
571
|
+
}
|
572
|
+
}
|
573
|
+
}, je = {
|
574
|
+
development: { secure: !1, expires: 1 },
|
575
|
+
production: { expires: 1, domain: process.env.API_URL, sameSite: "none", secure: !0 }
|
576
|
+
};
|
577
|
+
function F(r, e, t = process.env.NODE_ENV) {
|
578
|
+
process.env.MOBILE_APP ? te.setCookie({
|
579
|
+
url: process.env.API_URL,
|
580
|
+
// используйте ваш API_URL
|
581
|
+
key: r,
|
582
|
+
value: JSON.stringify(e)
|
583
|
+
}) : D.set(r, JSON.stringify(e), je[t]);
|
584
|
+
}
|
585
|
+
function ke(r, e = process.env.NODE_ENV) {
|
586
|
+
if (process.env.MOBILE_APP)
|
587
|
+
te.deleteCookie({
|
588
|
+
url: process.env.API_URL,
|
589
|
+
// используйте ваш API_URL
|
590
|
+
key: r
|
591
|
+
});
|
592
|
+
else {
|
593
|
+
const t = e === "production" ? { domain: process.env.API_URL } : {};
|
594
|
+
D.remove(r, t);
|
595
|
+
}
|
596
|
+
}
|
597
|
+
Z(g, (r, e) => {
|
598
|
+
});
|
599
|
+
const Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
600
|
+
__proto__: null,
|
601
|
+
actions: Le,
|
602
|
+
state: g
|
603
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
604
|
+
export {
|
605
|
+
D as C,
|
606
|
+
Le as a,
|
607
|
+
$ as b,
|
608
|
+
Oe as c,
|
609
|
+
Ue as d,
|
610
|
+
g as s,
|
611
|
+
_e as t
|
612
|
+
};
|