@tagsamurai/gsts-api-services 2.0.1-alpha.0 → 2.0.1-alpha.10

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,67 +1,67 @@
1
- import _ from "axios";
2
- const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://dev-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://dev-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, T = (t = "APP_TAGSAMURAI_API") => E["VITE_" + t], a = (t = {}, e = !1) => {
1
+ import E from "axios";
2
+ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://dev-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://dev-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, I = (t = "APP_TAGSAMURAI_API") => D["VITE_" + t], a = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
- prefix: s = "",
5
+ prefix: n = "",
6
6
  headers: i = {},
7
- ...p
8
- } = t, y = "".concat(T(r)).concat(s), A = _.create({
9
- ...p,
10
- baseURL: y,
7
+ ...c
8
+ } = t, O = "".concat(I(r)).concat(n), h = E.create({
9
+ ...c,
10
+ baseURL: O,
11
11
  headers: e ? i : {
12
12
  "Content-Type": "application/json",
13
13
  ...i
14
14
  }
15
15
  });
16
- return A.interceptors.request.use((v) => {
17
- var f, $, S;
18
- const P = JSON.parse((f = localStorage.getItem("user")) != null ? f : "{}"), O = (S = ($ = P.jwt) != null ? $ : P.token) != null ? S : "";
19
- return v.headers.Authorization = "Bearer ".concat(O), v;
20
- }), A;
21
- }, u = a({
16
+ return h.interceptors.request.use((m) => {
17
+ var b, $, T;
18
+ const P = JSON.parse((b = localStorage.getItem("user")) != null ? b : "{}"), w = (T = ($ = P.jwt) != null ? $ : P.token) != null ? T : "";
19
+ return m.headers.Authorization = "Bearer ".concat(w), m;
20
+ }), h;
21
+ }, p = a({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), b = (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
- }, x = {
23
+ }), U = (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
+ }, j = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
29
- return u.post("/login", e);
29
+ return p.post("/login", e);
30
30
  },
31
- reLogin: (t) => (u.interceptors.response.use((e) => e, b), u.post("/login", t)),
31
+ reLogin: (t) => (p.interceptors.response.use((e) => e, U), p.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
- return u.post("/request-otp", e);
34
+ return p.post("/request-otp", e);
35
35
  },
36
36
  requestResetPassLink: (t) => {
37
37
  const e = { email: t };
38
- return u.post("/request-reset-link", e);
38
+ return p.post("/request-reset-link", e);
39
39
  },
40
- setPassword: (t) => u.post("/set-password", t),
41
- verifyToken: (t) => u.get("/verify-token/".concat(t)),
40
+ setPassword: (t) => p.post("/set-password", t),
41
+ verifyToken: (t) => p.get("/verify-token/".concat(t)),
42
42
  confirmEmailChange: (t) => {
43
43
  const e = { token: t };
44
- return u.put("/confirm-email-change/confirm", e);
44
+ return p.put("/confirm-email-change/confirm", e);
45
45
  },
46
- postLogout: () => u.post("/logout"),
46
+ postLogout: () => p.post("/logout"),
47
47
  /**
48
48
  *
49
49
  * @deprecated use postLogout instead
50
50
  */
51
- logout: () => u.post("/logout")
52
- }, h = (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(/^\/+/, ""));
51
+ logout: () => p.post("/logout")
52
+ }, _ = (t, e, r) => {
53
+ const n = new URL(I("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
- const p = new URLSearchParams();
57
- e && (p.set("width", e.toString()), p.set("height", (r == null ? void 0 : r.toString()) || e.toString())), i += "?".concat(p.toString());
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, s;
61
+ var e, r, n;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
- return (s = (r = t.jwt) != null ? r : t.token) != null ? s : "";
64
- }, R = async (t, e) => {
63
+ return (n = (r = t.jwt) != null ? r : t.token) != null ? n : "";
64
+ }, G = async (t, e) => {
65
65
  const r = await fetch(t, {
66
66
  headers: {
67
67
  Authorization: "Bearer ".concat(e)
@@ -69,22 +69,22 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
69
69
  });
70
70
  if (!r.ok)
71
71
  throw new Error("Image fetch failed: ".concat(r.status, " ").concat(r.statusText));
72
- const s = await r.arrayBuffer();
73
- return new Blob([s], {
72
+ const n = await r.arrayBuffer();
73
+ return new Blob([n], {
74
74
  type: r.headers.get("Content-Type") || "image/webp"
75
75
  });
76
- }, w = async (t) => {
76
+ }, R = async (t) => {
77
77
  try {
78
- const e = L(), r = await R(t, e);
78
+ const e = L(), r = await G(t, e);
79
79
  return URL.createObjectURL(r);
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, C = async (t, e, r, s) => {
83
+ }, B = async (t, e, r, n) => {
84
84
  if (!t) return;
85
- const i = h(t, e, r);
86
- return s ? i : w(i);
87
- }, N = (t) => {
85
+ const i = _(t, e, r);
86
+ return n ? i : R(i);
87
+ }, J = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
90
90
  const e = {};
@@ -95,25 +95,42 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
95
95
  [r]: t[r]
96
96
  });
97
97
  }), e;
98
- }, I = a({
98
+ }, x = (t) => {
99
+ if (typeof t != "string") return !1;
100
+ const e = t.trim();
101
+ if (!e) return !1;
102
+ try {
103
+ return JSON.parse(e), !0;
104
+ } catch (r) {
105
+ return !1;
106
+ }
107
+ }, l = (t) => {
108
+ if (!t)
109
+ return {};
110
+ const e = {};
111
+ return Object.keys(t).forEach((r) => {
112
+ const n = t[r];
113
+ e[r] = x(n) ? JSON.parse(n.trim()) : n;
114
+ }), e;
115
+ }, S = a({
99
116
  prefix: "/v1/global-settings/change-log"
100
- }), k = {
101
- getChangelogs: (t) => I.get("", { params: t }),
102
- getChangelogOptions: (t) => I.get("/options", { params: t })
103
- }, c = a({
117
+ }), M = {
118
+ getChangelogs: (t) => S.get("", { params: t }),
119
+ getChangelogOptions: (t) => S.get("/options", { params: t })
120
+ }, d = a({
104
121
  prefix: "/v1/global-settings/division"
105
- }), B = {
106
- getDivisions: (t) => c.get("", { params: t }),
107
- getDivisionDetail: (t) => c.get("/".concat(t)),
108
- postCreateDivision: (t) => c.post("/", t),
109
- putEditDivision: (t, e) => c.put("/".concat(t), e),
122
+ }), q = {
123
+ getDivisions: (t) => d.get("", { params: t }),
124
+ getDivisionDetail: (t) => d.get("/".concat(t)),
125
+ postCreateDivision: (t) => d.post("/", t),
126
+ putEditDivision: (t, e) => d.put("/".concat(t), e),
110
127
  deleteDivisions: (t) => {
111
128
  const e = { id: JSON.stringify(t) };
112
- return c.delete("", { params: e });
129
+ return d.delete("", { params: e });
113
130
  }
114
131
  }, g = a({
115
132
  prefix: "/v1/global-settings"
116
- }), j = {
133
+ }), F = {
117
134
  getTAGAllPaired: (t, e) => g.get("/".concat(t), { params: e }),
118
135
  getTAGAllPairedOptions: (t, e) => g.get("/".concat(t, "/options"), { params: e }),
119
136
  getTAGNotPaired: (t, e) => g.get("/".concat(t, "/not-paired"), { params: e }),
@@ -123,111 +140,218 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
123
140
  putAuditTAG: (t, e) => g.put("/".concat(t, "/audit"), e),
124
141
  putAllocateTAG: (t, e) => g.put("/".concat(t, "/allocate"), e),
125
142
  putCombineTAG: (t) => g.put("/combine", t)
126
- }, n = a({
127
- prefix: "/v1/global-settings"
128
- }), M = {
129
- getHandheldReader: (t) => n.get("/reader", { params: t }),
130
- getHandheldReaderDetail: (t) => n.get("/reader/".concat(t)),
131
- getHandheldReaderOptions: (t) => n.get("/reader/options", { params: t }),
132
- putMarkHandheldStatus: (t) => n.put("/reader/mark-status", t),
133
- putPingReaders: (t) => n.put("/iot-reader/ping", t),
134
- putMarkIOTStatus: (t, e) => n.put("/".concat(e, "/mark-status"), t),
135
- putEditReaderGroup: (t, e, r) => n.put(
136
- "/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-group"),
143
+ }, o = a({
144
+ prefix: "/v2/hardware-tagging"
145
+ }), H = {
146
+ getHandheldReader: (t) => {
147
+ const e = l(t);
148
+ return o.post("/handheld-reader/list", e);
149
+ },
150
+ getHandheldReaderDetail: (t) => o.get("/handheld-reader/".concat(t)),
151
+ getHandheldReaderOptions: (t) => {
152
+ const e = l(t);
153
+ return o.post("/handheld-reader/options", e);
154
+ },
155
+ putMarkHandheldStatus: (t) => o.patch("/handheld-reader/status", t),
156
+ putPingReaders: (t) => o.put("/iot-reader/ping", t),
157
+ putMarkIOTStatus: (t, e) => o.put("/".concat(e, "/mark-status"), t),
158
+ putEditReaderGroup: (t, e, r) => o.patch(
159
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/group"),
137
160
  e
138
161
  ),
139
- putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
140
- putEditPortStatus: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-status"), t),
141
- putEditAliasName: (t, e, r) => n.put(
142
- "/".concat(t === "iot" ? "iot-" : "", "reader/").concat(r, "/set-alias-name"),
162
+ putEditAntennaGroup: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-group"), t),
163
+ putEditPortStatus: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-status"), t),
164
+ putEditAliasName: (t, e, r) => o.patch(
165
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/alias-name"),
143
166
  e
144
167
  ),
145
- putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
146
- getIOTReaderOrAntenna: (t, e) => n.get("/".concat(t), { params: e }),
147
- getIOTReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
148
- getIOTReaderOrAntennaOptions: (t, e) => n.get("/".concat(t, "/options"), { params: e }),
149
- getActivityLog: (t) => n.get("/activity-log", { params: t }),
150
- getActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
151
- getDetailActivityLog: (t) => n.get("/activity-log", { params: t }),
152
- getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
153
- getExistingAliasNames: () => n.get("/reader/alias-names"),
154
- getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
155
- }, G = a({
168
+ postActivateHardware: (t, e) => o.post(
169
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/activate"),
170
+ e
171
+ ),
172
+ deleteHardware: (t, e) => o.delete("/".concat(t === "iot" ? "iot-" : "handheld-", "-reader"), {
173
+ params: e
174
+ }),
175
+ putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
176
+ getIOTReaderOrAntenna: (t, e) => o.get("/".concat(t), { params: e }),
177
+ getIOTReaderDetail: (t) => o.get("/iot-reader/".concat(t)),
178
+ getIOTReaderOrAntennaOptions: (t, e) => o.get("/".concat(t, "/options"), { params: e }),
179
+ getActivityLog: (t) => o.get("/activity-log", { params: t }),
180
+ getActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
181
+ getDetailActivityLog: (t) => o.get("/activity-log", { params: t }),
182
+ getDetailActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
183
+ getExistingAliasNames: () => o.get("/reader/alias-names"),
184
+ getIotReaderPort: (t, e) => o.get("/iot-reader/".concat(t, "/ports"), { params: e })
185
+ }, C = a({
156
186
  env: "APP_LOGS_NOTIFICATION_API",
157
187
  prefix: "/v2"
158
- }), q = {
159
- getSessionLogList: (t) => G.get("/session-log", { params: t })
160
- }, m = a({
188
+ }), V = {
189
+ getSessionLogList: (t) => C.get("/session-log", { params: t })
190
+ }, y = a({
161
191
  prefix: "/v1/global-settings/option"
162
- }), J = {
163
- getPositions: () => m.get("/position"),
164
- getDivisions: () => m.get("/division")
165
- }, l = a({
192
+ }), z = {
193
+ getPositions: () => y.get("/position"),
194
+ getDivisions: () => y.get("/division")
195
+ }, v = a({
166
196
  prefix: "/v1/global-settings/position"
167
- }), V = {
168
- getPositions: (t) => l.get("", { params: t }),
169
- getPositionDetail: (t) => l.get("/".concat(t)),
170
- postCreatePosition: (t) => l.post("/", t),
171
- putEditPosition: (t, e) => l.put("/".concat(t), e),
197
+ }), X = {
198
+ getPositions: (t) => v.get("", { params: t }),
199
+ getPositionDetail: (t) => v.get("/".concat(t)),
200
+ postCreatePosition: (t) => v.post("/", t),
201
+ putEditPosition: (t, e) => v.put("/".concat(t), e),
172
202
  deletePositions: (t) => {
173
203
  const e = { id: JSON.stringify(t) };
174
- return l.delete("", { params: e });
204
+ return v.delete("", { params: e });
175
205
  }
176
- }, U = a({
206
+ }, N = a({
177
207
  env: "APP_TAGSAMURAI_API",
178
208
  prefix: "/tag/v2"
179
- }), H = {
180
- getTagInfo: (t) => U.get("/rfid-qr/scan", { params: t })
181
- }, d = a({
209
+ }), W = {
210
+ getTagInfo: (t) => N.get("/rfid-qr/scan", { params: t })
211
+ }, f = a({
182
212
  prefix: "/v1/global-settings/change-log"
183
- }), F = {
184
- getTAGEventlog: (t) => d.get("/tag-event-log", { params: t }),
185
- getTAGEventlogOptions: (t) => d.get("/tag-event-log/options", { params: t }),
186
- getDetailTAGEventlog: (t) => d.get("/tag-event-log/".concat(t))
187
- }, o = a({
213
+ }), K = {
214
+ getTAGEventlog: (t) => f.get("/tag-event-log", { params: t }),
215
+ getTAGEventlogOptions: (t) => f.get("/tag-event-log/options", { params: t }),
216
+ getDetailTAGEventlog: (t) => f.get("/tag-event-log/".concat(t))
217
+ }, u = a({
188
218
  prefix: "/v1/global-settings/user"
189
- }), z = {
190
- getUsers: (t) => o.get("", { params: t }),
191
- getUserDetail: (t) => o.get("/".concat(t)),
192
- getUserSystemLogs: (t, e) => o.get("/".concat(t, "/system-logs"), { params: e }),
219
+ }), Q = {
220
+ getUsers: (t) => u.get("", { params: t }),
221
+ getUserDetail: (t) => u.get("/".concat(t)),
222
+ getUserSystemLogs: (t, e) => u.get("/".concat(t, "/system-logs"), { params: e }),
193
223
  getUserSystemLogOptions: (t, e) => {
194
224
  const r = {};
195
- return r[e] = !0, o.get("/".concat(t, "/system-logs/options"), { params: r });
225
+ return r[e] = !0, u.get("/".concat(t, "/system-logs/options"), { params: r });
196
226
  },
197
227
  postCreateUser: (t) => {
198
228
  const e = { "Content-Type": "multipart/form-data" };
199
- return o.post("", t, { headers: e });
229
+ return u.post("", t, { headers: e });
200
230
  },
201
231
  putEditUser: (t, e) => {
202
232
  const r = { "Content-Type": "multipart/form-data" };
203
- return o.put("/".concat(t), e, { headers: r });
233
+ return u.put("/".concat(t), e, { headers: r });
204
234
  },
205
235
  deleteUsers: (t) => {
206
236
  const e = { id: JSON.stringify(t) };
207
- return o.delete("", { params: e });
237
+ return u.delete("", { params: e });
208
238
  },
209
- putToggleStatusUsers: (t) => o.put("/active-status", t),
239
+ putToggleStatusUsers: (t) => u.put("/active-status", t),
210
240
  getUserOptions: (t) => {
211
241
  const e = {};
212
- return e[t] = !0, o.get("/options", { params: e });
242
+ return e[t] = !0, u.get("/options", { params: e });
243
+ },
244
+ deleteCancelEmailChange: (t) => u.delete("/cancel-email-change/".concat(t)),
245
+ postResendEmail: (t) => u.post("/resend-email", t),
246
+ putChangePassword: (t, e) => u.put("/change-password/".concat(t), e)
247
+ }, A = a({
248
+ prefix: "/v2/hardware-tagging"
249
+ }), Y = {
250
+ getTabletList: (t) => A.post("/tablet/list", t),
251
+ getTabletOption: (t) => A.post("/tablet/options", t),
252
+ updateTabletStatus: (t, e) => A.patch("/tablet/status", e, { params: { ids: t } }),
253
+ disconnectTablet: (t) => A.patch("/tablet/disconnect-reader", { params: { ids: t } }),
254
+ deleteTablet: (t) => A.delete("/tablet", { params: { ids: t } })
255
+ }, s = a({
256
+ prefix: "/v2/iam"
257
+ }), Z = {
258
+ login: (t) => s.post("/auth/login", t),
259
+ logout: () => s.post("/auth/logout"),
260
+ verifyToken: (t) => s.get("/auth/verify-token/".concat(t)),
261
+ requestOtp: (t) => s.post("/auth/request-otp", { email: t }),
262
+ requestResetLink: (t) => s.post("/auth/request-reset-link", { email: t }),
263
+ setPassword: (t) => s.post("/auth/set-password", t),
264
+ confirmEmailChange: (t) => s.post("/auth/confirm-email-change", { token: t }),
265
+ cancelEmailChange: (t) => s.delete("/auth/cancel-email-change/".concat(t)),
266
+ getPositionList: (t) => {
267
+ const e = l(t);
268
+ return s.post("/position/list", e);
269
+ },
270
+ getPositionDetail: (t) => s.get("/position/".concat(t)),
271
+ createPosition: (t) => s.post("/position", t),
272
+ editPosition: (t, e) => s.patch("/position/".concat(t), e),
273
+ deletePosition: (t) => {
274
+ const e = { ids: JSON.stringify(t) };
275
+ return s.delete("/position", { params: e });
276
+ },
277
+ getDivisionList: (t) => {
278
+ const e = l(t);
279
+ return s.post("/division/list", e);
280
+ },
281
+ getDivisionDetail: (t) => s.get("/division/".concat(t)),
282
+ createDivision: (t) => s.post("/division", t),
283
+ editDivision: (t, e) => s.patch("/division/".concat(t), e),
284
+ deleteDivision: (t) => {
285
+ const e = { ids: JSON.stringify(t) };
286
+ return s.delete("/division", { params: e });
287
+ },
288
+ createUsers: (t) => {
289
+ const e = new FormData();
290
+ return Object.entries(t).forEach(([r, n]) => {
291
+ n != null && e.append(r, n);
292
+ }), s.post("/users", e, {
293
+ headers: { "Content-Type": "multipart/form-data" }
294
+ });
295
+ },
296
+ getGlobalUserList: (t) => {
297
+ const e = l(t);
298
+ return s.post("/users/list", e);
299
+ },
300
+ getGlobalUserOptions: (t) => {
301
+ const e = l(t);
302
+ return s.post("/users/options", e);
303
+ },
304
+ getGlobalUserDetail: (t) => s.get("/users/".concat(t)),
305
+ setActiveGlobalUser: (t, e) => {
306
+ const r = { ids: JSON.stringify(t) };
307
+ return s.patch("/users/set-active", e, { params: r });
308
+ },
309
+ editUsers: (t, e) => {
310
+ const r = new FormData();
311
+ return Object.entries(e).forEach(([n, i]) => {
312
+ i != null && r.append(n, i);
313
+ }), s.patch("/users/".concat(t), r, {
314
+ headers: { "Content-Type": "multipart/form-data" }
315
+ });
316
+ },
317
+ editUsersFcmToken: (t) => s.patch("/users/fcm-token", t),
318
+ resendActivationEmail: (t) => s.post("/users/resend-activation-email", t),
319
+ changePassword: (t, e) => s.patch("/users/".concat(t, "/change-password"), e),
320
+ deleteUsers: (t) => {
321
+ const e = { ids: JSON.stringify(t) };
322
+ return s.delete("/users", { params: e });
323
+ },
324
+ logoutModule: (t) => s.post("/auth/logout/module", t),
325
+ loginModule: (t) => s.post("/auth/login/module", t),
326
+ getConcurrentUsers: (t, e) => {
327
+ const r = e ? { "X-Module-ID": e } : {};
328
+ return s.post("/concurrent-users", t, { headers: r });
329
+ },
330
+ logoutSession: (t, e) => {
331
+ const r = e ? { "X-Module-ID": e } : {};
332
+ return s.post("/auth/logout/session", t, { headers: r });
213
333
  },
214
- deleteCancelEmailChange: (t) => o.delete("/cancel-email-change/".concat(t)),
215
- postResendEmail: (t) => o.post("/resend-email", t),
216
- putChangePassword: (t, e) => o.put("/change-password/".concat(t), e)
334
+ getPositionDropdown: () => s.get("/position/dropdown"),
335
+ getDivisionDropdown: () => s.get("/division/dropdown"),
336
+ exportPositionTable: () => s.post("/position/list/export", {}, { responseType: "blob" }),
337
+ exportDivisionTable: () => s.post("/division/list/export", {}, { responseType: "blob" }),
338
+ exportUserTable: () => s.post("/users/list/export", {}, { responseType: "blob" })
217
339
  };
218
340
  export {
219
- x as AuthServices,
220
- k as ChangelogServices,
221
- B as DivisionServices,
222
- j as GlobalTagServices,
223
- M as HardwareServices,
224
- q as LogServices,
225
- J as OptionServices,
226
- V as PositionServices,
227
- F as TagEventlogServices,
228
- H as TagServices,
229
- z as UserServices,
230
- T as getBaseURL,
231
- C as getImageURL,
232
- N as queryParamsStringfy
341
+ j as AuthServices,
342
+ M as ChangelogServices,
343
+ q as DivisionServices,
344
+ F as GlobalTagServices,
345
+ H as HardwareServices,
346
+ Z as IamServices,
347
+ V as LogServices,
348
+ z as OptionServices,
349
+ X as PositionServices,
350
+ Y as TabletServices,
351
+ K as TagEventlogServices,
352
+ W as TagServices,
353
+ Q as UserServices,
354
+ I as getBaseURL,
355
+ B as getImageURL,
356
+ J as queryParamsStringfy
233
357
  };
package/main.d.ts CHANGED
@@ -9,4 +9,6 @@ export { default as PositionServices } from './src/services/position.service';
9
9
  export { default as TagServices } from './src/services/tag.service';
10
10
  export { default as TagEventlogServices } from './src/services/tagEventlog.service';
11
11
  export { default as UserServices } from './src/services/user.service';
12
+ export { default as TabletServices } from './src/services/tablet.service';
13
+ export { default as IamServices } from './src/services/iam.service';
12
14
  export { getBaseURL, getImageURL, queryParamsStringfy } from './src/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.0",
3
+ "version": "2.0.1-alpha.10",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -71,6 +71,14 @@ export type DetailTableFilteredParams = Partial<Record<keyof DetailTableFilterPa
71
71
  export interface PutEditAliasName {
72
72
  aliasName: string;
73
73
  }
74
+ export interface PostActivateHardware {
75
+ serialNumber: string;
76
+ licenseKey: string;
77
+ hardwareId: string;
78
+ }
79
+ export interface DeleteHardware {
80
+ ids: string[];
81
+ }
74
82
  export interface PutEditReaderGroup {
75
83
  fixedAssetGroup?: string;
76
84
  supplyAssetGroup?: string;
@@ -0,0 +1,80 @@
1
+ import { QueryParams } from '../types/fetchResponse.type';
2
+ import { GlobalUserOptions, ModuleAccess } from '../types/iam.type';
3
+ export interface LoginPayload {
4
+ email: string;
5
+ password: string | null;
6
+ overrideSession: boolean;
7
+ isMobile: boolean;
8
+ otp: string | null;
9
+ captcha: string;
10
+ agreePolicy: boolean;
11
+ }
12
+ export interface SetPasswordPayload {
13
+ type: 'confirm' | 'reset';
14
+ token: string;
15
+ password: string;
16
+ }
17
+ export interface BaseParams extends QueryParams {
18
+ page?: number;
19
+ limit?: number;
20
+ search?: string;
21
+ sortBy?: string;
22
+ sortOrder?: number;
23
+ column?: string[];
24
+ }
25
+ export interface GetPositionListParams extends BaseParams {
26
+ }
27
+ export interface CreateEditPositionPayload {
28
+ name: string;
29
+ }
30
+ export interface GetDivisionListParams extends BaseParams {
31
+ }
32
+ export interface CreateEditDivisionPayload {
33
+ name: string;
34
+ }
35
+ export interface CreateUserPayload {
36
+ profilePicture?: File | string;
37
+ firstName: string;
38
+ lastName: string;
39
+ positionId?: string;
40
+ divisionId: string;
41
+ employeeId?: string;
42
+ email: string;
43
+ access: string;
44
+ expiryDate?: string;
45
+ tag?: string;
46
+ }
47
+ export interface GetGlobalUserListParams extends BaseParams {
48
+ isActive?: boolean[];
49
+ position?: string[];
50
+ division?: string[];
51
+ modifiedBy?: string[];
52
+ updatedAt?: string[];
53
+ }
54
+ export type GetGlobalUserOptionsParams = Partial<Record<keyof GlobalUserOptions, boolean>>;
55
+ export interface SetActiveGlobalUserPayload {
56
+ isActive: boolean;
57
+ }
58
+ export interface EditUserPayload extends CreateUserPayload {
59
+ }
60
+ export interface EditUserFcmTokenPayload {
61
+ data: {
62
+ userId: string;
63
+ token: string;
64
+ }[];
65
+ }
66
+ export interface ResendActivationEmailPayload {
67
+ ids: string[];
68
+ }
69
+ export interface ChangePasswordPayload {
70
+ oldPassword: string;
71
+ newPassword: string;
72
+ }
73
+ export interface ModuleAuthPayload {
74
+ module: ModuleAccess;
75
+ }
76
+ export interface GetConcurrentUsersParams extends BaseParams {
77
+ }
78
+ export interface LogoutSessionPayload {
79
+ sessionId: string;
80
+ }
@@ -0,0 +1,38 @@
1
+ import { FetchDetailResponse, FetchResponse } from '../types/fetchResponse.type';
2
+ import { MultiSelectOption } from '../types/options.type';
3
+ import { Tab, Tablet } from '../types/tablet.type';
4
+ export interface GetTabletListQuery {
5
+ tab?: Tab;
6
+ page?: number;
7
+ limit?: number;
8
+ sortBy?: string;
9
+ sortOrder?: number;
10
+ search?: string;
11
+ column?: string[];
12
+ deviceName?: string[];
13
+ status?: string[];
14
+ group?: string[];
15
+ reader?: string[];
16
+ registeredAt?: number[];
17
+ reportedBy?: string[];
18
+ reportedAt?: number[];
19
+ }
20
+ export type GetTabletListResponse = FetchDetailResponse<Tablet>;
21
+ export interface GetTabletOptionsQuery {
22
+ tab?: Tab;
23
+ statusOptions?: boolean;
24
+ deviceNameOptions?: boolean;
25
+ readerOptions?: boolean;
26
+ reportedByOptions?: boolean;
27
+ }
28
+ export type GetTabletOptionsResponse = FetchResponse & {
29
+ data: {
30
+ deviceNameOptions: MultiSelectOption[];
31
+ readerOptions: MultiSelectOption[];
32
+ statusOptions: MultiSelectOption[];
33
+ reportedByOptions: MultiSelectOption[];
34
+ };
35
+ };
36
+ export interface UpdateTabletStatusBody {
37
+ status?: Tab;
38
+ }
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { BooleanOptions } from '../dto/dataTable.dto';
3
- import { HardwareDetailFilterQuery, HardwareFetchDetailResponse, HardwareFetchOptionResponse, HardwareFetchResponse, HardwareFilterQuery, PutEditAliasName, PutEditAntennaGroup, PutEditAntennaPower, PutEditPortStatus, PutEditReaderGroup, PutHardwareStatusBody, PutPingReadersBody } from '../dto/hardware.dto';
3
+ import { DeleteHardware, HardwareDetailFilterQuery, HardwareFetchDetailResponse, HardwareFetchOptionResponse, HardwareFetchResponse, HardwareFilterQuery, PostActivateHardware, PutEditAliasName, PutEditAntennaGroup, PutEditAntennaPower, PutEditPortStatus, PutEditReaderGroup, PutHardwareStatusBody, PutPingReadersBody } from '../dto/hardware.dto';
4
4
  import { AntennaPortDetail, HardwareDataType, HardwareDetailUserActivity } from '../types/hardware.type';
5
5
  declare const HardwareServices: {
6
6
  getHandheldReader: (params?: HardwareFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse>>;
@@ -15,6 +15,8 @@ declare const HardwareServices: {
15
15
  putEditAntennaGroup: (body: PutEditAntennaGroup, hardwareId?: string) => Promise<AxiosResponse>;
16
16
  putEditPortStatus: (body: PutEditPortStatus, hardwareId?: string) => Promise<AxiosResponse>;
17
17
  putEditAliasName: (moduleTab: "iot" | "handheld", body: PutEditAliasName, hardwareId?: string) => Promise<AxiosResponse>;
18
+ postActivateHardware: (moduleTab: "iot" | "handheld", body: PostActivateHardware) => Promise<AxiosResponse>;
19
+ deleteHardware: (moduleTab: "iot" | "handheld", params?: DeleteHardware) => Promise<AxiosResponse>;
18
20
  putAntennaPower: (body: PutEditAntennaPower, iotId?: string) => Promise<AxiosResponse>;
19
21
  getIOTReaderOrAntenna: (subTab: "iot-reader" | "antenna", params?: HardwareFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse>>;
20
22
  getIOTReaderDetail: (iotId?: string) => Promise<AxiosResponse<HardwareFetchDetailResponse>>;
@@ -0,0 +1,45 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { DropdownOption } from '../types/options.type';
3
+ import { FetchDetailResponse, FetchListResponse } from '../types/fetchResponse.type';
4
+ import { CreateEditDivisionPayload, CreateEditPositionPayload, GetDivisionListParams, GetPositionListParams, LoginPayload, SetPasswordPayload, CreateUserPayload, GetGlobalUserListParams, GetGlobalUserOptionsParams, SetActiveGlobalUserPayload, EditUserPayload, EditUserFcmTokenPayload, ResendActivationEmailPayload, ChangePasswordPayload, ModuleAuthPayload, GetConcurrentUsersParams, LogoutSessionPayload } from '../dto/iam.dto';
5
+ import { PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse } from '../types/iam.type';
6
+ declare const IamServices: {
7
+ login: (payload: LoginPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginResponse>>>;
8
+ logout: () => Promise<AxiosResponse>;
9
+ verifyToken: (token: string) => Promise<AxiosResponse<FetchDetailResponse<VerifyTokenResponse>>>;
10
+ requestOtp: (email: string) => Promise<AxiosResponse<RequestOtpResponse>>;
11
+ requestResetLink: (email: string) => Promise<AxiosResponse<RequestResetLinkResponse>>;
12
+ setPassword: (payload: SetPasswordPayload) => Promise<AxiosResponse>;
13
+ confirmEmailChange: (token: string) => Promise<AxiosResponse>;
14
+ cancelEmailChange: (id: string) => Promise<AxiosResponse>;
15
+ getPositionList: (params: GetPositionListParams) => Promise<AxiosResponse<FetchListResponse<PositionList>>>;
16
+ getPositionDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<PositionDetail>>>;
17
+ createPosition: (payload: CreateEditPositionPayload) => Promise<AxiosResponse>;
18
+ editPosition: (id: string, payload: CreateEditPositionPayload) => Promise<AxiosResponse>;
19
+ deletePosition: (ids: string[]) => Promise<AxiosResponse>;
20
+ getDivisionList: (params: GetDivisionListParams) => Promise<AxiosResponse<FetchListResponse<DivisionList>>>;
21
+ getDivisionDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<DivisionListDetail>>>;
22
+ createDivision: (payload: CreateEditDivisionPayload) => Promise<AxiosResponse>;
23
+ editDivision: (id: string, payload: CreateEditDivisionPayload) => Promise<AxiosResponse>;
24
+ deleteDivision: (ids: string[]) => Promise<AxiosResponse>;
25
+ createUsers: (payload: CreateUserPayload) => Promise<AxiosResponse>;
26
+ getGlobalUserList: (params: GetGlobalUserListParams) => Promise<AxiosResponse<FetchListResponse<GlobalUserList>>>;
27
+ getGlobalUserOptions: (params: GetGlobalUserOptionsParams) => Promise<AxiosResponse<FetchDetailResponse<GlobalUserOptions>>>;
28
+ getGlobalUserDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<GlobalUserDetail>>>;
29
+ setActiveGlobalUser: (ids: string[], payload: SetActiveGlobalUserPayload) => Promise<AxiosResponse>;
30
+ editUsers: (id: string, payload: EditUserPayload) => Promise<AxiosResponse>;
31
+ editUsersFcmToken: (payload: EditUserFcmTokenPayload) => Promise<AxiosResponse>;
32
+ resendActivationEmail: (payload: ResendActivationEmailPayload) => Promise<AxiosResponse>;
33
+ changePassword: (id: string, payload: ChangePasswordPayload) => Promise<AxiosResponse<ChangePasswordResponse>>;
34
+ deleteUsers: (ids: string[]) => Promise<AxiosResponse>;
35
+ logoutModule: (payload: ModuleAuthPayload) => Promise<AxiosResponse>;
36
+ loginModule: (payload: ModuleAuthPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginModuleResponse>>>;
37
+ getConcurrentUsers: (params: GetConcurrentUsersParams, moduleId?: string) => Promise<AxiosResponse<FetchDetailResponse<ConcurrentUserList>>>;
38
+ logoutSession: (payload: LogoutSessionPayload, moduleId?: string) => Promise<AxiosResponse>;
39
+ getPositionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
40
+ getDivisionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
41
+ exportPositionTable: () => Promise<AxiosResponse<Blob>>;
42
+ exportDivisionTable: () => Promise<AxiosResponse<Blob>>;
43
+ exportUserTable: () => Promise<AxiosResponse<Blob>>;
44
+ };
45
+ export default IamServices;
@@ -0,0 +1,10 @@
1
+ import { GetTabletListQuery, GetTabletListResponse, GetTabletOptionsQuery, GetTabletOptionsResponse, UpdateTabletStatusBody } from '../dto/tablet.dto';
2
+ import { AxiosResponse } from 'axios';
3
+ declare const TabletServices: {
4
+ getTabletList: (body: GetTabletListQuery) => Promise<AxiosResponse<GetTabletListResponse>>;
5
+ getTabletOption: (body: GetTabletOptionsQuery) => Promise<AxiosResponse<GetTabletOptionsResponse>>;
6
+ updateTabletStatus: (ids: string, body: UpdateTabletStatusBody) => Promise<AxiosResponse>;
7
+ disconnectTablet: (ids: string) => Promise<AxiosResponse>;
8
+ deleteTablet: (ids: string) => Promise<AxiosResponse>;
9
+ };
10
+ export default TabletServices;
@@ -0,0 +1,144 @@
1
+ import { MultiSelectOption } from './options.type';
2
+ export interface LoginResponse {
3
+ _id: string;
4
+ companyName: string;
5
+ companyCode: string;
6
+ fullName: string;
7
+ profilePicture: string;
8
+ email: string;
9
+ isDefault: boolean;
10
+ access: string[];
11
+ generalSetting: {
12
+ dateFormat: string;
13
+ timeFormat: string;
14
+ timezone: string;
15
+ currency: {
16
+ currency: string;
17
+ symbol: string;
18
+ locale: string;
19
+ label: string;
20
+ };
21
+ };
22
+ }
23
+ type BaseMessage = string & {};
24
+ export interface VerifyTokenResponse {
25
+ message: 'Token Verified!' | 'Token not found' | 'Internal server error' | BaseMessage;
26
+ data: boolean;
27
+ }
28
+ interface BaseResponse<TMessage> {
29
+ status: number;
30
+ message: TMessage;
31
+ data?: boolean;
32
+ }
33
+ export type RequestResetLinkMessage = 'EMAIL_NOT_REGISTERED' | BaseMessage;
34
+ export type RequestOtpMessage = 'Successfully requested otp' | 'EMAIL_NOT_REGISTERED' | 'INACTIVE_USER' | BaseMessage;
35
+ export interface RequestResetLinkResponse extends BaseResponse<RequestResetLinkMessage> {
36
+ }
37
+ export interface RequestOtpResponse extends BaseResponse<RequestOtpMessage> {
38
+ }
39
+ interface BasePosition {
40
+ _id: string;
41
+ name: string;
42
+ }
43
+ export interface PositionList extends BasePosition {
44
+ inUse: boolean;
45
+ }
46
+ export interface PositionDetail extends BasePosition {
47
+ }
48
+ interface BaseDivision {
49
+ _id: string;
50
+ name: string;
51
+ }
52
+ export interface DivisionList extends BaseDivision {
53
+ inUse: boolean;
54
+ }
55
+ export interface DivisionListDetail extends BaseDivision {
56
+ }
57
+ export interface ChangePasswordResponse {
58
+ status?: number;
59
+ message?: 'INCORRECT_PASSWORD' | BaseMessage;
60
+ }
61
+ export interface GlobalUserList {
62
+ _id: string;
63
+ isActive: boolean;
64
+ isDefault: boolean;
65
+ profilePicture: string | null;
66
+ fullName: string;
67
+ email: string;
68
+ pendingEmail: string | null;
69
+ position: string | null;
70
+ division: string;
71
+ employeeId: string | null;
72
+ modifiedBy: string;
73
+ updatedAt: string;
74
+ pendingApproval: number;
75
+ assignedAssets: number;
76
+ borrowedAssets: number;
77
+ isEmailConfirmed: boolean;
78
+ }
79
+ export interface GlobalUserOptions {
80
+ isActiveOptions: {
81
+ label: string;
82
+ value: boolean;
83
+ }[];
84
+ positionOptions: MultiSelectOption[];
85
+ divisionOptions: MultiSelectOption[];
86
+ modifiedByOptions: MultiSelectOption[];
87
+ }
88
+ export type ModuleAccess = 'Global Settings' | 'Fixed Asset' | 'Supply Asset' | 'Admin Console';
89
+ export interface GlobalUserDetail {
90
+ _id: string;
91
+ isActive: boolean;
92
+ isDefault: boolean;
93
+ isEmailConfirmed: boolean;
94
+ profilePicture: string | null;
95
+ userTag: string | null;
96
+ userType: string;
97
+ firstName: string;
98
+ lastName: string;
99
+ fullName: string;
100
+ email: string;
101
+ pendingEmailChange: string | null;
102
+ position: string | null;
103
+ division: string;
104
+ employeeId: string | null;
105
+ expiryDate: string | null;
106
+ access: (ModuleAccess | BaseMessage)[];
107
+ }
108
+ export interface LoginModuleResponse extends LoginResponse {
109
+ isTotalControl: boolean;
110
+ isReadOnly: boolean;
111
+ plan: string;
112
+ addOn: Record<string, boolean>;
113
+ systemRoles: Record<string, {
114
+ create: boolean;
115
+ view: boolean;
116
+ update: boolean;
117
+ delete: boolean;
118
+ }>;
119
+ transactionRoles: Record<string, {
120
+ manager: boolean;
121
+ monitoringReport: boolean;
122
+ approver: boolean;
123
+ staff: boolean;
124
+ }>;
125
+ generalSetting: LoginResponse['generalSetting'] & {
126
+ geolocation: boolean;
127
+ };
128
+ }
129
+ export interface ConcurrentUser {
130
+ _id: string;
131
+ profilePicture: string;
132
+ name: string;
133
+ email: string;
134
+ userType: string;
135
+ position: string;
136
+ division: string;
137
+ lastLogin: string;
138
+ }
139
+ export interface ConcurrentUserList {
140
+ moduleId: string;
141
+ activeSessions: ConcurrentUser[];
142
+ count: number;
143
+ }
144
+ export {};
@@ -0,0 +1,16 @@
1
+ export type Tab = 'Available' | 'Damaged/Missing';
2
+ export interface Tablet {
3
+ _id: string;
4
+ deviceName: string;
5
+ deviceId: string;
6
+ status: string;
7
+ group: {
8
+ fixedAsset: string | null;
9
+ supplyAsset: string | null;
10
+ };
11
+ reader: string | null;
12
+ aliasName: string | null;
13
+ registeredAt: string;
14
+ reportedBy: string | null;
15
+ reportedAt: string | null;
16
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Builds body parameters by processing and parsing JSON values if valid.
3
+ *
4
+ * @param params - Optional filter parameters for asset data
5
+ * @returns An object containing processed parameters where JSON strings are parsed into objects
6
+ */
7
+ export declare const buildBodyParams: (params?: Record<string, unknown>) => Record<string, unknown>;
@@ -2,3 +2,4 @@ export { createAxiosInstance } from './createInstance.util';
2
2
  export { getBaseURL } from './getBaseURL.util';
3
3
  export { getImageURL } from './getImageURL.util';
4
4
  export { queryParamsStringfy } from './queryParamsStringify.util';
5
+ export { buildBodyParams } from './buildBodyParams.util';