@tagsamurai/gsts-api-services 1.0.2-beta.3 → 1.0.2-beta.4
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
|
@@ -2,10 +2,10 @@ import _ from "axios";
|
|
|
2
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: n = "",
|
|
6
6
|
headers: i = {},
|
|
7
7
|
...c
|
|
8
|
-
} = t, y = "".concat(T(r)).concat(
|
|
8
|
+
} = t, y = "".concat(T(r)).concat(n), A = _.create({
|
|
9
9
|
...c,
|
|
10
10
|
baseURL: y,
|
|
11
11
|
headers: e ? i : {
|
|
@@ -20,15 +20,15 @@ const b = { 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
|
+
}), E = (t) => {
|
|
24
|
+
var e, r, n, i;
|
|
25
|
+
return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((i = (n = t.response) == null ? void 0 : n.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, E), 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 b = { 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
|
+
}, h = (t, e, r) => {
|
|
53
|
+
const n = new URL(T("APP_TAGSAMURAI_API") || "").origin;
|
|
54
|
+
let i = t.startsWith("http") ? t : "".concat(n, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
|
|
55
55
|
if (e || r) {
|
|
56
56
|
const c = new URLSearchParams();
|
|
57
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, n;
|
|
62
62
|
const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
|
|
63
|
-
return (
|
|
63
|
+
return (n = (r = t.jwt) != null ? r : t.token) != null ? n : "";
|
|
64
64
|
}, R = async (t, e) => {
|
|
65
65
|
const r = await fetch(t, {
|
|
66
66
|
headers: {
|
|
@@ -69,8 +69,8 @@ const b = { 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 n = await r.arrayBuffer();
|
|
73
|
+
return new Blob([n], {
|
|
74
74
|
type: r.headers.get("Content-Type") || "image/webp"
|
|
75
75
|
});
|
|
76
76
|
}, w = async (t) => {
|
|
@@ -80,11 +80,11 @@ const b = { 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, n) => {
|
|
84
84
|
if (!t) return;
|
|
85
|
-
const i =
|
|
86
|
-
return
|
|
87
|
-
},
|
|
85
|
+
const i = h(t, e, r);
|
|
86
|
+
return n ? i : w(i);
|
|
87
|
+
}, N = (t) => {
|
|
88
88
|
if (!t || typeof t == "string")
|
|
89
89
|
return;
|
|
90
90
|
const e = {};
|
|
@@ -95,11 +95,11 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
95
95
|
[r]: t[r]
|
|
96
96
|
});
|
|
97
97
|
}), e;
|
|
98
|
-
},
|
|
98
|
+
}, m = a({
|
|
99
99
|
prefix: "/v1/global-settings/change-log"
|
|
100
|
-
}),
|
|
101
|
-
getChangelogs: (t) =>
|
|
102
|
-
getChangelogOptions: (t) =>
|
|
100
|
+
}), k = {
|
|
101
|
+
getChangelogs: (t) => m.get("", { params: t }),
|
|
102
|
+
getChangelogOptions: (t) => m.get("/options", { params: t })
|
|
103
103
|
}, p = a({
|
|
104
104
|
prefix: "/v1/global-settings/division"
|
|
105
105
|
}), B = {
|
|
@@ -111,7 +111,10 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
111
111
|
const e = { id: JSON.stringify(t) };
|
|
112
112
|
return p.delete("", { params: e });
|
|
113
113
|
},
|
|
114
|
-
|
|
114
|
+
getAvailableDivision: (t) => {
|
|
115
|
+
const e = { name: t };
|
|
116
|
+
return p.get("/available", { params: e });
|
|
117
|
+
}
|
|
115
118
|
}, u = a({
|
|
116
119
|
prefix: "/v1/global-settings"
|
|
117
120
|
}), j = {
|
|
@@ -124,45 +127,45 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
124
127
|
putAuditTAG: (t, e) => u.put("/".concat(t, "/audit"), e),
|
|
125
128
|
putAllocateTAG: (t, e) => u.put("/".concat(t, "/allocate"), e),
|
|
126
129
|
putCombineTAG: (t) => u.put("/combine", t)
|
|
127
|
-
},
|
|
130
|
+
}, s = a({
|
|
128
131
|
prefix: "/v1/global-settings"
|
|
129
132
|
}), M = {
|
|
130
|
-
getHandheldReader: (t) =>
|
|
131
|
-
getHandheldReaderDetail: (t) =>
|
|
132
|
-
getHandheldReaderOptions: (t) =>
|
|
133
|
-
putMarkHandheldStatus: (t) =>
|
|
134
|
-
putPingReaders: (t) =>
|
|
135
|
-
putMarkIOTStatus: (t, e) =>
|
|
136
|
-
putEditReaderGroup: (t, e, r) =>
|
|
133
|
+
getHandheldReader: (t) => s.get("/reader", { params: t }),
|
|
134
|
+
getHandheldReaderDetail: (t) => s.get("/reader/".concat(t)),
|
|
135
|
+
getHandheldReaderOptions: (t) => s.get("/reader/options", { params: t }),
|
|
136
|
+
putMarkHandheldStatus: (t) => s.put("/reader/mark-status", t),
|
|
137
|
+
putPingReaders: (t) => s.put("/iot-reader/ping", t),
|
|
138
|
+
putMarkIOTStatus: (t, e) => s.put("/".concat(e, "/mark-status"), t),
|
|
139
|
+
putEditReaderGroup: (t, e, r) => s.put(
|
|
137
140
|
"/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-group"),
|
|
138
141
|
e
|
|
139
142
|
),
|
|
140
|
-
putEditAntennaGroup: (t, e) =>
|
|
141
|
-
putEditPortStatus: (t, e) =>
|
|
142
|
-
putEditAliasName: (t, e, r) =>
|
|
143
|
+
putEditAntennaGroup: (t, e) => s.put("/iot-reader/".concat(e, "/set-port-group"), t),
|
|
144
|
+
putEditPortStatus: (t, e) => s.put("/iot-reader/".concat(e, "/set-port-status"), t),
|
|
145
|
+
putEditAliasName: (t, e, r) => s.put(
|
|
143
146
|
"/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-alias-name"),
|
|
144
147
|
e
|
|
145
148
|
),
|
|
146
|
-
putAntennaPower: (t, e) =>
|
|
147
|
-
getIOTReaderOrAntenna: (t, e) =>
|
|
148
|
-
getIOTReaderDetail: (t) =>
|
|
149
|
-
getIOTReaderOrAntennaOptions: (t, e) =>
|
|
150
|
-
getActivityLog: (t) =>
|
|
151
|
-
getActivityLogOptions: (t) =>
|
|
152
|
-
getDetailActivityLog: (t) =>
|
|
153
|
-
getDetailActivityLogOptions: (t) =>
|
|
154
|
-
getExistingAliasNames: () =>
|
|
155
|
-
getIotReaderPort: (t, e) =>
|
|
149
|
+
putAntennaPower: (t, e) => s.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
|
|
150
|
+
getIOTReaderOrAntenna: (t, e) => s.get("/".concat(t), { params: e }),
|
|
151
|
+
getIOTReaderDetail: (t) => s.get("/iot-reader/".concat(t)),
|
|
152
|
+
getIOTReaderOrAntennaOptions: (t, e) => s.get("/".concat(t, "/options"), { params: e }),
|
|
153
|
+
getActivityLog: (t) => s.get("/activity-log", { params: t }),
|
|
154
|
+
getActivityLogOptions: (t) => s.get("/activity-log/options", { params: t }),
|
|
155
|
+
getDetailActivityLog: (t) => s.get("/activity-log", { params: t }),
|
|
156
|
+
getDetailActivityLogOptions: (t) => s.get("/activity-log/options", { params: t }),
|
|
157
|
+
getExistingAliasNames: () => s.get("/reader/alias-names"),
|
|
158
|
+
getIotReaderPort: (t, e) => s.get("/iot-reader/".concat(t, "/ports"), { params: e })
|
|
156
159
|
}, G = a({
|
|
157
160
|
env: "APP_LOGS_NOTIFICATION_API",
|
|
158
161
|
prefix: "/v2"
|
|
159
162
|
}), q = {
|
|
160
163
|
getSessionLogList: (t) => G.get("/session-log", { params: t })
|
|
161
|
-
},
|
|
164
|
+
}, I = a({
|
|
162
165
|
prefix: "/v1/global-settings/option"
|
|
163
166
|
}), J = {
|
|
164
|
-
getPositions: () =>
|
|
165
|
-
getDivisions: () =>
|
|
167
|
+
getPositions: () => I.get("/position"),
|
|
168
|
+
getDivisions: () => I.get("/division")
|
|
166
169
|
}, l = a({
|
|
167
170
|
prefix: "/v1/global-settings/position"
|
|
168
171
|
}), V = {
|
|
@@ -174,7 +177,10 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
174
177
|
const e = { id: JSON.stringify(t) };
|
|
175
178
|
return l.delete("", { params: e });
|
|
176
179
|
},
|
|
177
|
-
|
|
180
|
+
getAvailablePosition: (t) => {
|
|
181
|
+
const e = { name: t };
|
|
182
|
+
return l.get("/available", { params: e });
|
|
183
|
+
}
|
|
178
184
|
}, U = a({
|
|
179
185
|
env: "APP_TAGSAMURAI_API",
|
|
180
186
|
prefix: "/tag/v2"
|
|
@@ -219,7 +225,7 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
|
|
|
219
225
|
};
|
|
220
226
|
export {
|
|
221
227
|
x as AuthServices,
|
|
222
|
-
|
|
228
|
+
k as ChangelogServices,
|
|
223
229
|
B as DivisionServices,
|
|
224
230
|
j as GlobalTagServices,
|
|
225
231
|
M as HardwareServices,
|
|
@@ -231,5 +237,5 @@ export {
|
|
|
231
237
|
z as UserServices,
|
|
232
238
|
T as getBaseURL,
|
|
233
239
|
C as getImageURL,
|
|
234
|
-
|
|
240
|
+
N as queryParamsStringfy
|
|
235
241
|
};
|
package/package.json
CHANGED
|
@@ -9,8 +9,6 @@ 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
|
-
|
|
13
|
-
name: string;
|
|
14
|
-
}) => Promise<AxiosResponse>;
|
|
12
|
+
getAvailableDivision: (name: string) => Promise<AxiosResponse>;
|
|
15
13
|
};
|
|
16
14
|
export default DivisionServices;
|
|
@@ -9,8 +9,6 @@ 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
|
-
|
|
13
|
-
name: string;
|
|
14
|
-
}) => Promise<AxiosResponse>;
|
|
12
|
+
getAvailablePosition: (name: string) => Promise<AxiosResponse>;
|
|
15
13
|
};
|
|
16
14
|
export default PositionServices;
|