@tagsamurai/gsts-api-services 1.0.2-beta.2 → 1.0.2-beta.3
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/api-services.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _ from "axios";
|
|
2
|
-
const
|
|
2
|
+
const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://staging-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://staging-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://staging-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://staging-api.tagsamurai.com" }, T = (t = "APP_TAGSAMURAI_API") => b["VITE_" + t], a = (t = {}, e = !1) => {
|
|
3
3
|
const {
|
|
4
4
|
env: r = "APP_GLOBAL_SETTINGS_API",
|
|
5
|
-
prefix:
|
|
5
|
+
prefix: s = "",
|
|
6
6
|
headers: i = {},
|
|
7
|
-
...
|
|
8
|
-
} = t, y = "".concat(T(r)).concat(
|
|
9
|
-
...
|
|
7
|
+
...c
|
|
8
|
+
} = t, y = "".concat(T(r)).concat(s), A = _.create({
|
|
9
|
+
...c,
|
|
10
10
|
baseURL: y,
|
|
11
11
|
headers: e ? i : {
|
|
12
12
|
"Content-Type": "application/json",
|
|
@@ -20,15 +20,15 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
20
20
|
}), A;
|
|
21
21
|
}, g = a({
|
|
22
22
|
prefix: "/v1/global-settings/auth"
|
|
23
|
-
}),
|
|
24
|
-
var e, r,
|
|
25
|
-
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((i = (
|
|
23
|
+
}), h = (t) => {
|
|
24
|
+
var e, r, s, i;
|
|
25
|
+
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((i = (s = t.response) == null ? void 0 : s.data) == null ? void 0 : i.message) === "jwt malformed" ? (window.onblur = null, window.onfocus = null, window.sessionExpired = !0, window.dispatchEvent(new CustomEvent("user:expired"))) : Promise.reject(t);
|
|
26
26
|
}, x = {
|
|
27
27
|
login: (t) => {
|
|
28
28
|
const e = { ...t, isMobile: !1 };
|
|
29
29
|
return g.post("/login", e);
|
|
30
30
|
},
|
|
31
|
-
reLogin: (t) => (g.interceptors.response.use((e) => e,
|
|
31
|
+
reLogin: (t) => (g.interceptors.response.use((e) => e, h), g.post("/login", t)),
|
|
32
32
|
requestOTP: (t) => {
|
|
33
33
|
const e = { email: t };
|
|
34
34
|
return g.post("/request-otp", e);
|
|
@@ -49,18 +49,18 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
49
49
|
* @deprecated use postLogout instead
|
|
50
50
|
*/
|
|
51
51
|
logout: () => g.post("/logout")
|
|
52
|
-
},
|
|
53
|
-
const
|
|
54
|
-
let i = t.startsWith("http") ? t : "".concat(
|
|
52
|
+
}, E = (t, e, r) => {
|
|
53
|
+
const s = new URL(T("APP_TAGSAMURAI_API") || "").origin;
|
|
54
|
+
let i = t.startsWith("http") ? t : "".concat(s, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
|
|
55
55
|
if (e || r) {
|
|
56
|
-
const
|
|
57
|
-
e && (
|
|
56
|
+
const c = new URLSearchParams();
|
|
57
|
+
e && (c.set("width", e.toString()), c.set("height", (r == null ? void 0 : r.toString()) || e.toString())), i += "?".concat(c.toString());
|
|
58
58
|
}
|
|
59
59
|
return i;
|
|
60
60
|
}, L = () => {
|
|
61
|
-
var e, r,
|
|
61
|
+
var e, r, s;
|
|
62
62
|
const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
|
|
63
|
-
return (
|
|
63
|
+
return (s = (r = t.jwt) != null ? r : t.token) != null ? s : "";
|
|
64
64
|
}, R = async (t, e) => {
|
|
65
65
|
const r = await fetch(t, {
|
|
66
66
|
headers: {
|
|
@@ -69,8 +69,8 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
69
69
|
});
|
|
70
70
|
if (!r.ok)
|
|
71
71
|
throw new Error("Image fetch failed: ".concat(r.status, " ").concat(r.statusText));
|
|
72
|
-
const
|
|
73
|
-
return new Blob([
|
|
72
|
+
const s = await r.arrayBuffer();
|
|
73
|
+
return new Blob([s], {
|
|
74
74
|
type: r.headers.get("Content-Type") || "image/webp"
|
|
75
75
|
});
|
|
76
76
|
}, w = async (t) => {
|
|
@@ -80,11 +80,11 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
80
80
|
} catch (e) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
}, C = async (t, e, r,
|
|
83
|
+
}, C = async (t, e, r, s) => {
|
|
84
84
|
if (!t) return;
|
|
85
|
-
const i =
|
|
86
|
-
return
|
|
87
|
-
},
|
|
85
|
+
const i = E(t, e, r);
|
|
86
|
+
return s ? i : w(i);
|
|
87
|
+
}, k = (t) => {
|
|
88
88
|
if (!t || typeof t == "string")
|
|
89
89
|
return;
|
|
90
90
|
const e = {};
|
|
@@ -97,20 +97,21 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
97
97
|
}), e;
|
|
98
98
|
}, I = a({
|
|
99
99
|
prefix: "/v1/global-settings/change-log"
|
|
100
|
-
}),
|
|
100
|
+
}), N = {
|
|
101
101
|
getChangelogs: (t) => I.get("", { params: t }),
|
|
102
102
|
getChangelogOptions: (t) => I.get("/options", { params: t })
|
|
103
|
-
},
|
|
103
|
+
}, p = a({
|
|
104
104
|
prefix: "/v1/global-settings/division"
|
|
105
105
|
}), B = {
|
|
106
|
-
getDivisions: (t) =>
|
|
107
|
-
getDivisionDetail: (t) =>
|
|
108
|
-
postCreateDivision: (t) =>
|
|
109
|
-
putEditDivision: (t, e) =>
|
|
106
|
+
getDivisions: (t) => p.get("", { params: t }),
|
|
107
|
+
getDivisionDetail: (t) => p.get("/".concat(t)),
|
|
108
|
+
postCreateDivision: (t) => p.post("/", t),
|
|
109
|
+
putEditDivision: (t, e) => p.put("/".concat(t), e),
|
|
110
110
|
deleteDivisions: (t) => {
|
|
111
111
|
const e = { id: JSON.stringify(t) };
|
|
112
|
-
return
|
|
113
|
-
}
|
|
112
|
+
return p.delete("", { params: e });
|
|
113
|
+
},
|
|
114
|
+
checkDivisionAvailability: (t) => p.get("/available", { params: t })
|
|
114
115
|
}, u = a({
|
|
115
116
|
prefix: "/v1/global-settings"
|
|
116
117
|
}), j = {
|
|
@@ -123,35 +124,35 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
123
124
|
putAuditTAG: (t, e) => u.put("/".concat(t, "/audit"), e),
|
|
124
125
|
putAllocateTAG: (t, e) => u.put("/".concat(t, "/allocate"), e),
|
|
125
126
|
putCombineTAG: (t) => u.put("/combine", t)
|
|
126
|
-
},
|
|
127
|
+
}, n = a({
|
|
127
128
|
prefix: "/v1/global-settings"
|
|
128
129
|
}), M = {
|
|
129
|
-
getHandheldReader: (t) =>
|
|
130
|
-
getHandheldReaderDetail: (t) =>
|
|
131
|
-
getHandheldReaderOptions: (t) =>
|
|
132
|
-
putMarkHandheldStatus: (t) =>
|
|
133
|
-
putPingReaders: (t) =>
|
|
134
|
-
putMarkIOTStatus: (t, e) =>
|
|
135
|
-
putEditReaderGroup: (t, e, r) =>
|
|
130
|
+
getHandheldReader: (t) => n.get("/reader", { params: t }),
|
|
131
|
+
getHandheldReaderDetail: (t) => n.get("/reader/".concat(t)),
|
|
132
|
+
getHandheldReaderOptions: (t) => n.get("/reader/options", { params: t }),
|
|
133
|
+
putMarkHandheldStatus: (t) => n.put("/reader/mark-status", t),
|
|
134
|
+
putPingReaders: (t) => n.put("/iot-reader/ping", t),
|
|
135
|
+
putMarkIOTStatus: (t, e) => n.put("/".concat(e, "/mark-status"), t),
|
|
136
|
+
putEditReaderGroup: (t, e, r) => n.put(
|
|
136
137
|
"/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-group"),
|
|
137
138
|
e
|
|
138
139
|
),
|
|
139
|
-
putEditAntennaGroup: (t, e) =>
|
|
140
|
-
putEditPortStatus: (t, e) =>
|
|
141
|
-
putEditAliasName: (t, e, r) =>
|
|
140
|
+
putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
|
|
141
|
+
putEditPortStatus: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-status"), t),
|
|
142
|
+
putEditAliasName: (t, e, r) => n.put(
|
|
142
143
|
"/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-alias-name"),
|
|
143
144
|
e
|
|
144
145
|
),
|
|
145
|
-
putAntennaPower: (t, e) =>
|
|
146
|
-
getIOTReaderOrAntenna: (t, e) =>
|
|
147
|
-
getIOTReaderDetail: (t) =>
|
|
148
|
-
getIOTReaderOrAntennaOptions: (t, e) =>
|
|
149
|
-
getActivityLog: (t) =>
|
|
150
|
-
getActivityLogOptions: (t) =>
|
|
151
|
-
getDetailActivityLog: (t) =>
|
|
152
|
-
getDetailActivityLogOptions: (t) =>
|
|
153
|
-
getExistingAliasNames: () =>
|
|
154
|
-
getIotReaderPort: (t, e) =>
|
|
146
|
+
putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
|
|
147
|
+
getIOTReaderOrAntenna: (t, e) => n.get("/".concat(t), { params: e }),
|
|
148
|
+
getIOTReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
|
|
149
|
+
getIOTReaderOrAntennaOptions: (t, e) => n.get("/".concat(t, "/options"), { params: e }),
|
|
150
|
+
getActivityLog: (t) => n.get("/activity-log", { params: t }),
|
|
151
|
+
getActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
|
|
152
|
+
getDetailActivityLog: (t) => n.get("/activity-log", { params: t }),
|
|
153
|
+
getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
|
|
154
|
+
getExistingAliasNames: () => n.get("/reader/alias-names"),
|
|
155
|
+
getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
|
|
155
156
|
}, G = a({
|
|
156
157
|
env: "APP_LOGS_NOTIFICATION_API",
|
|
157
158
|
prefix: "/v2"
|
|
@@ -172,7 +173,8 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
172
173
|
deletePositions: (t) => {
|
|
173
174
|
const e = { id: JSON.stringify(t) };
|
|
174
175
|
return l.delete("", { params: e });
|
|
175
|
-
}
|
|
176
|
+
},
|
|
177
|
+
checkPositionAvailability: (t) => l.get("/available", { params: t })
|
|
176
178
|
}, U = a({
|
|
177
179
|
env: "APP_TAGSAMURAI_API",
|
|
178
180
|
prefix: "/tag/v2"
|
|
@@ -217,7 +219,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
217
219
|
};
|
|
218
220
|
export {
|
|
219
221
|
x as AuthServices,
|
|
220
|
-
|
|
222
|
+
N as ChangelogServices,
|
|
221
223
|
B as DivisionServices,
|
|
222
224
|
j as GlobalTagServices,
|
|
223
225
|
M as HardwareServices,
|
|
@@ -229,5 +231,5 @@ export {
|
|
|
229
231
|
z as UserServices,
|
|
230
232
|
T as getBaseURL,
|
|
231
233
|
C as getImageURL,
|
|
232
|
-
|
|
234
|
+
k as queryParamsStringfy
|
|
233
235
|
};
|
package/package.json
CHANGED
|
@@ -9,5 +9,8 @@ declare const DivisionServices: {
|
|
|
9
9
|
postCreateDivision: (body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
|
|
10
10
|
putEditDivision: (id: string, body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
|
|
11
11
|
deleteDivisions: (ids: string[]) => Promise<AxiosResponse>;
|
|
12
|
+
checkDivisionAvailability: (params: {
|
|
13
|
+
name: string;
|
|
14
|
+
}) => Promise<AxiosResponse>;
|
|
12
15
|
};
|
|
13
16
|
export default DivisionServices;
|
|
@@ -9,5 +9,8 @@ declare const PositionServices: {
|
|
|
9
9
|
postCreatePosition: (body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
|
|
10
10
|
putEditPosition: (id: string, body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
|
|
11
11
|
deletePositions: (ids: string[]) => Promise<AxiosResponse>;
|
|
12
|
+
checkPositionAvailability: (params: {
|
|
13
|
+
name: string;
|
|
14
|
+
}) => Promise<AxiosResponse>;
|
|
12
15
|
};
|
|
13
16
|
export default PositionServices;
|