@opengis/surveyor 0.0.5 → 0.0.7

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.
Files changed (29) hide show
  1. package/dist/chunks/AppIcon-CO70tpMX.js +95 -0
  2. package/dist/chunks/{AppealStatusBadge-CefimzY3.js → AppealStatusBadge-BlAaNUSK.js} +16 -16
  3. package/dist/chunks/{ApplicationHistorySection-PwToBfej.js → ApplicationHistorySection-Cwq0-Frd.js} +252 -247
  4. package/dist/chunks/{FormFilePicker-CKVdZJU9.js → FormFilePicker-DxPQlxgy.js} +1 -1
  5. package/dist/chunks/{applications-CsCsndMV.js → applications-CLhv5l_j.js} +24 -24
  6. package/dist/chunks/auth-acuaYbYM.js +60 -0
  7. package/dist/chunks/{card-B_SfARf7.js → card-9r6Si3cz.js} +315 -315
  8. package/dist/chunks/card-rXkTqZqA.js +609 -0
  9. package/dist/chunks/create-BAsyL76t.js +1306 -0
  10. package/dist/chunks/forgot-DoG6vXhq.js +100 -0
  11. package/dist/chunks/list-search-D5VdmGdV.js +5 -0
  12. package/dist/chunks/login-BWGylcSU.js +124 -0
  13. package/dist/chunks/{map-dvA3ayAK.js → map-UTBxwT7-.js} +1 -1
  14. package/dist/chunks/{mapLayersApi-CWoQ2be-.js → mapLayersApi-CBLcbADa.js} +1 -1
  15. package/dist/chunks/organizations-DbVDoURw.js +93 -0
  16. package/dist/chunks/{profile-CuxlkEev.js → profile-CkwMFh82.js} +21 -19
  17. package/dist/chunks/profile-aXlo4qqA.js +104 -0
  18. package/dist/chunks/registration-3GLgq-ae.js +102 -0
  19. package/dist/chunks/{requests-Bt8fEdRc.js → requests-BM6XqgpC.js} +213 -212
  20. package/dist/chunks/reset-CP9LsLkC.js +111 -0
  21. package/dist/chunks/surveyor-CDkI2Dcp.js +92 -0
  22. package/dist/index.css +1 -1
  23. package/dist/index.js +533 -114
  24. package/package.json +1 -1
  25. package/surveyor-types.d.ts +4 -0
  26. package/dist/chunks/card-DCyBFoDZ.js +0 -607
  27. package/dist/chunks/create-DTP9x2uS.js +0 -1046
  28. package/dist/chunks/organizations-BtuMZ5s_.js +0 -14
  29. package/dist/chunks/profile-DxZHxGum.js +0 -164
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { o as t } from "./profile-DxZHxGum.js";
2
+ import { t } from "./AppIcon-CO70tpMX.js";
3
3
  import { createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, openBlock as s, ref as c, toDisplayString as l, watch as u } from "vue";
4
4
  //#region cabinet/src/components/ui/FormFilePicker.vue?vue&type=script&setup=true&lang.ts
5
5
  var d = /*@__PURE__*/ o({
@@ -1,5 +1,5 @@
1
- import { i as e } from "./geometry-DyhIVRcw.js";
2
- import { a as t, r as n } from "./profile-DxZHxGum.js";
1
+ import { a as e, t } from "./surveyor-CDkI2Dcp.js";
2
+ import { i as n } from "./geometry-DyhIVRcw.js";
3
3
  //#region cabinet/src/api/applications.ts
4
4
  function r(e) {
5
5
  let t = new URLSearchParams();
@@ -8,15 +8,15 @@ function r(e) {
8
8
  let n = t.toString();
9
9
  return n ? `?${n}` : "";
10
10
  }
11
- async function i(e = {}) {
12
- let i = await fetch(n(`/api/resource/public_applications${r(e)}`), { credentials: "include" });
13
- if (!i.ok) throw Error(t(await i.text(), i.status));
11
+ async function i(n = {}) {
12
+ let i = await fetch(t(`/api/resource/public_applications${r(n)}`), { credentials: "include" });
13
+ if (!i.ok) throw Error(e(await i.text(), i.status));
14
14
  return i.json();
15
15
  }
16
- async function a(e) {
17
- let r = await fetch(n(`/api/resource/public_applications/${encodeURIComponent(e)}?include=history`), { credentials: "include" });
16
+ async function a(n) {
17
+ let r = await fetch(t(`/api/resource/public_applications/${encodeURIComponent(n)}?include=history`), { credentials: "include" });
18
18
  if (r.status === 404) return null;
19
- if (!r.ok) throw Error(t(await r.text(), r.status));
19
+ if (!r.ok) throw Error(e(await r.text(), r.status));
20
20
  let i = await r.json();
21
21
  return !i || typeof i != "object" || !i.app_id ? null : i;
22
22
  }
@@ -50,27 +50,27 @@ async function s(e) {
50
50
  throw Error("Звернення не знайдено");
51
51
  }
52
52
  function c(e) {
53
- return n(`/api/file/${encodeURIComponent(e)}?download=true`);
53
+ return t(`/api/file/${encodeURIComponent(e)}?download=true`);
54
54
  }
55
55
  function l(e) {
56
- return n(`/api/surveyor/applications/${encodeURIComponent(e)}/export/geometry`);
56
+ return t(`/api/surveyor/applications/${encodeURIComponent(e)}/export/geometry`);
57
57
  }
58
- function u(e, n) {
58
+ function u(t, n) {
59
59
  try {
60
- let t = JSON.parse(e);
61
- if (t.detail) return t.detail;
60
+ let e = JSON.parse(t);
61
+ if (e.detail) return e.detail;
62
62
  } catch {}
63
- return t(e, n);
63
+ return e(t, n);
64
64
  }
65
65
  async function d(e) {
66
- let t = await fetch(n("/api/surveyor/applications"), {
66
+ let n = await fetch(t("/api/surveyor/applications"), {
67
67
  method: "POST",
68
68
  credentials: "include",
69
69
  headers: { "Content-Type": "application/json" },
70
70
  body: JSON.stringify(e)
71
71
  });
72
- if (!t.ok) throw Error(u(await t.text(), t.status));
73
- return t.json();
72
+ if (!n.ok) throw Error(u(await n.text(), n.status));
73
+ return n.json();
74
74
  }
75
75
  var f = 52428800, p = /* @__PURE__ */ new Set([
76
76
  "zip",
@@ -94,22 +94,22 @@ function h(e) {
94
94
  }, r.onerror = () => n(/* @__PURE__ */ Error("Не вдалося прочитати файл")), r.readAsDataURL(e);
95
95
  });
96
96
  }
97
- async function g(t) {
98
- let r = m(t.name);
97
+ async function g(e) {
98
+ let r = m(e.name);
99
99
  if (!p.has(r)) throw Error("Підтримуються файли ZIP (Shapefile) та GeoJSON");
100
- if (!t.size) throw Error("Файл порожній");
101
- if (t.size > f) throw Error("Файл перевищує ліміт 50 МіБ");
102
- let i = await h(t), a = await fetch(n("/api/surveyor/import/geometry"), {
100
+ if (!e.size) throw Error("Файл порожній");
101
+ if (e.size > f) throw Error("Файл перевищує ліміт 50 МіБ");
102
+ let i = await h(e), a = await fetch(t("/api/surveyor/import/geometry"), {
103
103
  method: "POST",
104
104
  credentials: "include",
105
105
  headers: { "Content-Type": "application/json" },
106
106
  body: JSON.stringify({
107
107
  file: i,
108
- filename: t.name
108
+ filename: e.name
109
109
  })
110
110
  });
111
111
  if (!a.ok) throw Error(u(await a.text(), a.status));
112
- let o = e(await a.json());
112
+ let o = n(await a.json());
113
113
  if (!o || o.type !== "Polygon") throw Error("Файл не містить полігональну геометрію");
114
114
  return {
115
115
  type: "Polygon",
@@ -0,0 +1,60 @@
1
+ //#region cabinet/src/utils/auth.ts
2
+ var e = "surveyor_user";
3
+ function t(e) {
4
+ return `${"".replace(/\/$/, "")}${e}`;
5
+ }
6
+ function n() {
7
+ try {
8
+ let t = localStorage.getItem(e);
9
+ return t ? JSON.parse(t) : null;
10
+ } catch {
11
+ return localStorage.removeItem(e), null;
12
+ }
13
+ }
14
+ async function r(t, n) {
15
+ let { loginSurveyor: r } = await import("./surveyor-CDkI2Dcp.js").then((e) => e.c), i = await r(t, n);
16
+ localStorage.setItem(e, JSON.stringify(i.user));
17
+ }
18
+ async function i() {
19
+ try {
20
+ let n = await fetch(t("/api/auth/user"), { credentials: "include" });
21
+ if (!n.ok) return localStorage.removeItem(e), null;
22
+ let r = await n.json();
23
+ return r.id ? (localStorage.setItem(e, JSON.stringify(r)), r) : (localStorage.removeItem(e), null);
24
+ } catch {
25
+ return localStorage.removeItem(e), null;
26
+ }
27
+ }
28
+ async function a() {
29
+ try {
30
+ await fetch(t("/api/auth/logout"), {
31
+ method: "POST",
32
+ credentials: "include"
33
+ });
34
+ } finally {
35
+ localStorage.removeItem(e);
36
+ let { resetCabinetContext: t } = await import("./organizations-DbVDoURw.js").then((e) => e.a);
37
+ t();
38
+ }
39
+ }
40
+ async function o(e) {
41
+ if (await a(), typeof window < "u" && window.location.pathname.startsWith("/cabinet")) {
42
+ window.location.assign("/");
43
+ return;
44
+ }
45
+ await e.push({ name: "login" });
46
+ }
47
+ var s = {
48
+ get currentUser() {
49
+ return n();
50
+ },
51
+ get isAuthenticated() {
52
+ return !!n()?.id;
53
+ },
54
+ login: r,
55
+ checkUser: i,
56
+ logout: a,
57
+ logoutFromCabinet: o
58
+ };
59
+ //#endregion
60
+ export { s as t };