@tagsamurai/gsts-api-services 2.0.1-alpha.16 → 2.0.1-alpha.18

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,28 +1,28 @@
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" }, O = (t = "APP_TAGSAMURAI_API") => D["VITE_" + t], u = (t = {}, e = !1) => {
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], u = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
- prefix: o = "",
5
+ prefix: n = "",
6
6
  headers: i = {},
7
7
  ...l
8
- } = t, I = "".concat(O(r)).concat(o), A = E.create({
8
+ } = t, O = "".concat(I(r)).concat(n), m = E.create({
9
9
  ...l,
10
- baseURL: I,
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((m) => {
17
- var P, y, S;
18
- const b = JSON.parse((P = localStorage.getItem("user")) != null ? P : "{}"), w = (S = (y = b.jwt) != null ? y : b.token) != null ? S : "";
19
- return m.headers.Authorization = "Bearer ".concat(w), m;
20
- }), A;
16
+ return m.interceptors.request.use((A) => {
17
+ var P, y, $;
18
+ const h = JSON.parse((P = localStorage.getItem("user")) != null ? P : "{}"), w = ($ = (y = h.jwt) != null ? y : h.token) != null ? $ : "";
19
+ return A.headers.Authorization = "Bearer ".concat(w), A;
20
+ }), m;
21
21
  }, c = u({
22
22
  prefix: "/v1/global-settings/auth"
23
23
  }), L = (t) => {
24
- var e, r, o, i;
25
- return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((i = (o = t.response) == null ? void 0 : o.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);
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
  }, j = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
@@ -50,17 +50,17 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
50
50
  */
51
51
  logout: () => c.post("/logout")
52
52
  }, U = (t, e, r) => {
53
- const o = new URL(O("APP_TAGSAMURAI_API") || "").origin;
54
- let i = t.startsWith("http") ? t : "".concat(o, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
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
56
  const l = new URLSearchParams();
57
57
  e && (l.set("width", e.toString()), l.set("height", (r == null ? void 0 : r.toString()) || e.toString())), i += "?".concat(l.toString());
58
58
  }
59
59
  return i;
60
60
  }, _ = () => {
61
- var e, r, o;
61
+ var e, r, n;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
- return (o = (r = t.jwt) != null ? r : t.token) != null ? o : "";
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 D = { 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 o = await r.arrayBuffer();
73
- return new Blob([o], {
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
  }, G = async (t) => {
@@ -80,10 +80,10 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, B = async (t, e, r, o) => {
83
+ }, B = async (t, e, r, n) => {
84
84
  if (!t) return;
85
85
  const i = U(t, e, r);
86
- return o ? i : G(i);
86
+ return n ? i : G(i);
87
87
  }, J = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
@@ -109,14 +109,14 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
109
109
  return {};
110
110
  const e = {};
111
111
  return Object.keys(t).forEach((r) => {
112
- const o = t[r];
113
- e[r] = x(o) ? JSON.parse(o.trim()) : o;
112
+ const n = t[r];
113
+ e[r] = x(n) ? JSON.parse(n.trim()) : n;
114
114
  }), e;
115
- }, T = u({
115
+ }, S = u({
116
116
  prefix: "/v1/global-settings/change-log"
117
117
  }), M = {
118
- getChangelogs: (t) => T.get("", { params: t }),
119
- getChangelogOptions: (t) => T.get("/options", { params: t })
118
+ getChangelogs: (t) => S.get("", { params: t }),
119
+ getChangelogOptions: (t) => S.get("/options", { params: t })
120
120
  }, d = u({
121
121
  prefix: "/v1/global-settings/division"
122
122
  }), q = {
@@ -160,58 +160,56 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
160
160
  const e = a(t);
161
161
  return g.post("/paired/options", e);
162
162
  }
163
- }, n = u({
163
+ }, o = u({
164
164
  prefix: "/v2/hardware-tagging"
165
165
  }), H = {
166
166
  getHandheldReader: (t) => {
167
167
  const e = a(t);
168
- return n.post("/handheld-reader/list", e);
169
- },
170
- getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
171
- getHandheldReaderOptions: (t) => {
172
- const e = a(t);
173
- return n.post("/handheld-reader/options", e);
168
+ return o.post("/handheld-reader/list", e);
174
169
  },
175
- putMarkHandheldStatus: (t) => n.patch("/handheld-reader/status", t),
176
- putPingReaders: (t) => n.put("/iot-reader/ping", t),
177
- putMarkIOTStatus: (t, e) => n.put("/".concat(e, "/mark-status"), t),
178
- putEditReaderGroup: (t, e, r) => n.patch(
179
- "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/group"),
180
- e
181
- ),
182
- putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
183
- putEditPortStatus: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-status"), t),
184
- putEditAliasName: (t, e, r) => n.patch(
185
- "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/alias-name"),
186
- e
187
- ),
188
- postActivateHardware: (t, e) => n.post(
189
- "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/activate"),
190
- e
191
- ),
192
- deleteHardware: (t, e) => n.delete("/".concat(t === "iot" ? "iot-" : "handheld-", "-reader"), {
170
+ getHandheldReaderDetail: (t) => o.get("/handheld-reader/".concat(t)),
171
+ getHandheldReaderOptions: (t) => o.post("/handheld-reader/options", t),
172
+ putMarkHandheldStatus: (t, e, r) => o.patch("/".concat(t, "/status"), r, { params: e }),
173
+ postPingReaders: (t) => o.post("/iot-reader/ping", t),
174
+ putMarkIOTStatus: (t, e) => o.put("/".concat(e, "/mark-status"), t),
175
+ putEditReaderGroup: (t, e, r) => o.patch("/".concat(t, "-reader/").concat(r, "/group"), e),
176
+ putEditAntennaGroup: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-group"), t),
177
+ putEditPortStatus: (t, e) => o.put("/iot-reader/".concat(e, "/set-port-status"), t),
178
+ putEditAliasName: (t, e, r) => o.patch("/".concat(t, "-reader/").concat(r, "/alias-name"), e),
179
+ postActivateHardware: (t, e) => o.post("/".concat(t, "-reader/activate"), e),
180
+ deleteHardware: (t, e) => o.delete("/".concat(t, "-reader"), {
193
181
  params: e
194
182
  }),
195
- putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
196
- getIOTReaderOrAntenna: (t, e) => n.get("/".concat(t), { params: e }),
197
- getIOTReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
198
- getIOTReaderOrAntennaOptions: (t, e) => n.get("/".concat(t, "/options"), { params: e }),
199
- getActivityLog: (t) => n.get("/activity-log", { params: t }),
200
- getActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
201
- getDetailActivityLog: (t) => n.get("/activity-log", { params: t }),
202
- getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
203
- getExistingAliasNames: () => n.get("/reader/alias-names"),
204
- getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
183
+ putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
184
+ getIotReader: (t) => {
185
+ const e = a({ ...t });
186
+ return o.post("/iot-reader", e);
187
+ },
188
+ getIotReaderDetail: (t) => o.get("/iot-reader/".concat(t)),
189
+ getIotReaderOptions: (t) => o.post("/iot-reader/options", t),
190
+ getIotReaderPort: (t, e) => o.post("/iot-reader/".concat(t, "/port/list"), { params: e }),
191
+ getIotReaderTablet: (t, e) => o.post("/iot-reader/".concat(t, "/tablet/list"), { params: e }),
192
+ getIotReaderTabletOptions: (t, e) => o.post("/iot-reader/".concat(t, "/tablet/options"), e),
193
+ putEditIotReader: (t, e) => o.patch("/iot-reader/".concat(t), e),
194
+ disconnectIotTablet: (t, e) => o.delete("/iot-reader/".concat(t, "/tablet"), {
195
+ data: e
196
+ }),
197
+ // TODO: Activity API spec not finished yet
198
+ getActivityLog: (t) => o.get("/activity-log", { params: t }),
199
+ getActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
200
+ getDetailActivityLog: (t) => o.get("/activity-log", { params: t }),
201
+ getDetailActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
202
+ getExistingAliasNames: () => o.get("/reader/alias-names")
205
203
  }, C = u({
206
204
  env: "APP_LOGS_NOTIFICATION_API",
207
205
  prefix: "/v2"
208
206
  }), V = {
209
207
  getSessionLogList: (t) => C.get("/session-log", { params: t })
210
- }, $ = u({
208
+ }, T = u({
211
209
  prefix: "/v1/global-settings/option"
212
210
  }), Y = {
213
- getPositions: () => $.get("/position"),
214
- getDivisions: () => $.get("/division")
211
+ getPositions: () => T.get("/position"),
212
+ getDivisions: () => T.get("/division")
215
213
  }, v = u({
216
214
  prefix: "/v1/global-settings/position"
217
215
  }), z = {
@@ -228,18 +226,18 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
228
226
  prefix: "/tag/v2"
229
227
  }), X = {
230
228
  getTagInfo: (t) => N.get("/rfid-qr/scan", { params: t })
231
- }, f = u({
229
+ }, b = u({
232
230
  prefix: "/v2/hardware-tagging"
233
231
  }), W = {
234
232
  getTAGEventlog: (t) => {
235
233
  const e = a(t);
236
- return f.post("/tag-event-log/list", e);
234
+ return b.post("/tag-event-log/list", e);
237
235
  },
238
236
  getTAGEventlogOptions: (t) => {
239
237
  const e = a(t);
240
- return f.post("/tag-event-log/options", e);
238
+ return b.post("/tag-event-log/options", e);
241
239
  },
242
- getDetailTAGEventlog: (t) => f.get("/tag-event-log/".concat(t))
240
+ getDetailTAGEventlog: (t) => b.get("/tag-event-log/".concat(t))
243
241
  }, p = u({
244
242
  prefix: "/v1/global-settings/user"
245
243
  }), K = {
@@ -270,14 +268,14 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
270
268
  deleteCancelEmailChange: (t) => p.delete("/cancel-email-change/".concat(t)),
271
269
  postResendEmail: (t) => p.post("/resend-email", t),
272
270
  putChangePassword: (t, e) => p.put("/change-password/".concat(t), e)
273
- }, h = u({
271
+ }, f = u({
274
272
  prefix: "/v2/hardware-tagging"
275
273
  }), Q = {
276
- getTabletList: (t) => h.post("/tablet/list", t),
277
- getTabletOption: (t) => h.post("/tablet/options", t),
278
- updateTabletStatus: (t, e) => h.patch("/tablet/status", e, { params: { ids: t } }),
279
- disconnectTablet: (t) => h.patch("/tablet/disconnect-reader", { params: { ids: t } }),
280
- deleteTablet: (t) => h.delete("/tablet", { params: { ids: t } })
274
+ getTabletList: (t) => f.post("/tablet/list", t),
275
+ getTabletOption: (t) => f.post("/tablet/options", t),
276
+ updateTabletStatus: (t, e) => f.patch("/tablet/status", e, { params: { ids: t } }),
277
+ disconnectTablet: (t) => f.patch("/tablet/disconnect-reader", { params: { ids: t } }),
278
+ deleteTablet: (t) => f.delete("/tablet", { params: { ids: t } })
281
279
  }, s = u({
282
280
  prefix: "/v2/iam"
283
281
  }), Z = {
@@ -313,8 +311,8 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
313
311
  },
314
312
  createUsers: (t) => {
315
313
  const e = new FormData();
316
- return Object.entries(t).forEach(([r, o]) => {
317
- o != null && e.append(r, o);
314
+ return Object.entries(t).forEach(([r, n]) => {
315
+ n != null && e.append(r, n);
318
316
  }), s.post("/users", e, {
319
317
  headers: { "Content-Type": "multipart/form-data" }
320
318
  });
@@ -334,8 +332,8 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
334
332
  },
335
333
  editUsers: (t, e) => {
336
334
  const r = new FormData();
337
- return Object.entries(e).forEach(([o, i]) => {
338
- i != null && r.append(o, i);
335
+ return Object.entries(e).forEach(([n, i]) => {
336
+ i != null && r.append(n, i);
339
337
  }), s.patch("/users/".concat(t), r, {
340
338
  headers: { "Content-Type": "multipart/form-data" }
341
339
  });
@@ -377,7 +375,7 @@ export {
377
375
  W as TagEventlogServices,
378
376
  X as TagServices,
379
377
  K as UserServices,
380
- O as getBaseURL,
378
+ I as getBaseURL,
381
379
  B as getImageURL,
382
380
  J as queryParamsStringfy
383
381
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.16",
3
+ "version": "2.0.1-alpha.18",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -1,5 +1,4 @@
1
1
  import { MultiSelectOption } from '../types/options.type';
2
- import { ApplicationModule } from '../types/tag.type';
3
2
  export type FilterOptions = {
4
3
  skuOptions?: MultiSelectOption[];
5
4
  statusOptions?: MultiSelectOption[];
@@ -20,24 +19,3 @@ export type FilterOptions = {
20
19
  actionOptions?: MultiSelectOption[];
21
20
  objectNameOptions?: MultiSelectOption[];
22
21
  };
23
- export type BooleanOptions = {
24
- tab?: 'Available' | 'Damaged/Missing';
25
- deviceNameOptions?: boolean;
26
- nameOptions?: boolean;
27
- userFullNameOptions?: boolean;
28
- networkStatusOptions?: boolean;
29
- brandOptions?: boolean;
30
- modelOptions?: boolean;
31
- moduleOptions?: boolean;
32
- reportedByOptions?: boolean;
33
- modifiedByOptions?: boolean;
34
- fieldOptions?: boolean;
35
- activityOptions?: boolean;
36
- pairedInOptions?: boolean;
37
- availabilityOptions?: boolean;
38
- module?: ApplicationModule;
39
- status?: string;
40
- skuOptions?: boolean;
41
- statusOptions?: boolean;
42
- typeOptions?: boolean;
43
- };
@@ -1,80 +1,21 @@
1
- import { AntennaPortDetail, HandheldDataType, HandheldDetailDataType, HardwareDataType, HardwareDetailDataType } from '../types/hardware.type';
2
- import { MultiSelectOption } from '../types/options.type';
1
+ import { TableParams } from '../types/dataTable.type';
2
+ import { Tab } from '../types/tablet.type';
3
3
  type TAG = 'RFID' | 'NFC';
4
- export interface HardwareFetchResponse<T = HardwareDataType> {
5
- message: string;
6
- status: number;
7
- data: {
8
- data: T[];
9
- totalRecords: number;
10
- };
11
- }
12
- export interface HandheldFetchResponse<T = HandheldDataType> {
13
- message: string;
14
- data: {
15
- data: T[];
16
- totalRecords: number;
17
- };
18
- }
19
- export interface HardwareFetchDetailResponse<T = HardwareDetailDataType> {
20
- message: string;
21
- status: number;
22
- data: T;
23
- }
24
- export interface HandheldFetchDetailResponse<T = HandheldDetailDataType> {
25
- message: string;
26
- status: number;
27
- data: T;
28
- }
29
- export type HardwareFetchOptionResponse<Opt = Record<string, boolean>> = Record<keyof Opt, MultiSelectOption[]>;
30
- export interface HardwareShortFetchResponse<T = AntennaPortDetail> {
31
- message: string;
32
- status: number;
33
- data: T[];
34
- }
35
- export type HardwareFilterRaw = {
36
- tab?: 'Available' | 'Damaged/Missing';
37
- page?: number;
38
- limit?: number;
39
- sortBy?: string;
40
- sortOrder?: number;
41
- search?: string;
42
- column?: string[];
4
+ export interface HandheldFilterRaw extends TableParams {
5
+ tab?: Tab;
43
6
  deviceName?: string[];
44
- name?: number[];
45
7
  type?: string[];
46
- readerGroup?: number[];
47
- readerType?: string;
48
- networkStatus?: string[];
49
- brand?: number[];
50
- model?: number[];
51
8
  status?: string[];
52
- tag?: string;
53
9
  sku?: string[];
54
- groupModule?: string[];
55
10
  group?: string[];
56
- antennaGroupModule?: string[];
57
- antennaGroup?: number[];
58
- userFullName?: number[];
59
- action?: string[];
60
11
  reportedBy?: string[];
61
12
  reportedAt?: number[];
62
- createdAt?: number[];
63
- lastReportDate?: number[];
64
- };
65
- export type HardwareFilterQuery = Partial<Record<keyof HardwareFilterRaw, string>>;
66
- export type HardwareDetailFilterRaw = {
67
- date?: number[];
68
- readerId?: string;
69
- groupModule?: string[];
70
- antennaGroupModule?: string[];
71
- action?: string[];
72
- userFullName?: number[];
73
- modifiedBy?: number[];
74
- isActive?: string[];
75
- field?: string[];
76
- };
77
- export type HardwareDetailFilterQuery = Partial<Record<keyof HardwareDetailFilterRaw, string>>;
13
+ }
14
+ export interface HandheldOptions {
15
+ deviceNameOptions?: boolean;
16
+ skuOptions?: boolean;
17
+ reportedByOptions?: boolean;
18
+ }
78
19
  export type DetailTableFilterParams = {
79
20
  createdAt?: string;
80
21
  activity?: string;
@@ -89,9 +30,42 @@ export type DetailTableFilterParams = {
89
30
  group?: string;
90
31
  tag?: string;
91
32
  };
92
- export type DetailTableFilteredParams = Partial<Record<keyof DetailTableFilterParams, string>>;
33
+ export interface IotFilterRaw extends TableParams {
34
+ tab?: Tab;
35
+ deviceName?: string[];
36
+ sku?: string[];
37
+ networkStatus?: string[];
38
+ brand?: string[];
39
+ model?: string[];
40
+ type?: string[];
41
+ readerGroup?: string[];
42
+ portGroup?: string[];
43
+ status?: string[];
44
+ reportedBy?: string[];
45
+ reportedAt?: number[];
46
+ }
47
+ export interface IotOptions {
48
+ deviceNameOptions?: boolean;
49
+ skuOptions?: boolean;
50
+ brandOptions?: boolean;
51
+ modelOptions?: boolean;
52
+ typeOptions?: boolean;
53
+ reportedByOptions?: boolean;
54
+ }
55
+ export interface IotPortFilterRaw extends TableParams {
56
+ isActive: boolean[];
57
+ group: string[];
58
+ }
59
+ export interface IotTabletFilterRaw extends TableParams {
60
+ deviceName: string[];
61
+ }
62
+ export interface IotTabletOptions {
63
+ deviceNameOptions?: boolean;
64
+ skuOptions?: boolean;
65
+ reportedByOptions?: boolean;
66
+ }
93
67
  export interface PutEditAliasName {
94
- aliasName: string;
68
+ aliasName: string | null;
95
69
  }
96
70
  export interface PostActivateHardware {
97
71
  serialNumber: string;
@@ -107,6 +81,34 @@ export interface PutEditReaderGroup {
107
81
  receivingFixedAssetGroup?: string[];
108
82
  receivingSupplyAssetGroup?: string[];
109
83
  }
84
+ export interface PutEditIotReader {
85
+ antennaPower: number[];
86
+ rssi: number;
87
+ }
88
+ export interface SmartFixedReaderBody extends PutEditIotReader {
89
+ type: 'Smart Fixed Reader';
90
+ smartFixedReaderGroup?: SmartFixedReaderGroup;
91
+ portGroup?: SmartFixedReaderGroup[];
92
+ }
93
+ export interface AssetControlBody extends PutEditIotReader {
94
+ type: 'Asset Control';
95
+ assetControlSize: 'Small' | 'Medium' | 'Large';
96
+ assetControlReaderGroup: AssetControlReaderGroup;
97
+ portDirection: string[];
98
+ }
99
+ interface AssetControlReaderGroup {
100
+ fixedAsset?: FixedAsset;
101
+ supplyAsset?: FixedAsset;
102
+ }
103
+ interface FixedAsset {
104
+ group?: string;
105
+ isRoleRestricted: boolean;
106
+ receivingGroups: string[];
107
+ }
108
+ interface SmartFixedReaderGroup {
109
+ fixedAsset?: string;
110
+ supplyAsset?: string;
111
+ }
110
112
  export interface PutEditAntennaGroup {
111
113
  group: Omit<PutEditReaderGroup, 'receivingFixedAssetGroup' | 'receivingSupplyAssetGroup'>[];
112
114
  }
@@ -119,28 +121,22 @@ export interface PutEditPortStatus {
119
121
  port: number;
120
122
  }[];
121
123
  }
122
- export interface PutPingReadersBody {
124
+ export interface PostPingReadersBody {
123
125
  ids: string[];
124
126
  }
125
127
  export interface PutHardwareStatusBody {
126
128
  status: 'Missing' | 'Damaged' | 'Available';
127
- ids?: string[];
128
129
  }
129
130
  export type HardwareFormType = PutEditAliasName | PutEditAntennaGroup | PutEditAntennaPower | PutHardwareStatusBody | PutEditReaderGroup;
130
- export type GetAllTAGParams = {
131
- page?: number;
132
- limit?: number;
133
- search?: string;
131
+ export interface GetAllTAGParams extends TableParams {
134
132
  sortBy?: string;
135
- sortOrder?: number;
136
- column?: string[];
137
133
  tagType?: string[];
138
134
  rfidSku?: string[];
139
135
  nfcSku?: string[];
140
136
  type?: string[];
141
137
  status?: string[];
142
138
  lastScanned?: string[];
143
- };
139
+ }
144
140
  export type GetAllTAGOptionsQuery = {
145
141
  tagTypeOptions?: boolean;
146
142
  rfidSkuOptions?: boolean;
@@ -1,4 +1,4 @@
1
- import { QueryParams } from '../types/fetchResponse.type';
1
+ import { TableParams } from '../types/dataTable.type';
2
2
  import { GlobalUserOptions, ModuleAccess } from '../types/iam.type';
3
3
  export interface LoginPayload {
4
4
  email: string;
@@ -14,20 +14,12 @@ export interface SetPasswordPayload {
14
14
  token: string;
15
15
  password: string;
16
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 {
17
+ export interface GetPositionListParams extends TableParams {
26
18
  }
27
19
  export interface CreateEditPositionPayload {
28
20
  name: string;
29
21
  }
30
- export interface GetDivisionListParams extends BaseParams {
22
+ export interface GetDivisionListParams extends TableParams {
31
23
  }
32
24
  export interface CreateEditDivisionPayload {
33
25
  name: string;
@@ -44,7 +36,7 @@ export interface CreateUserPayload {
44
36
  expiryDate?: string;
45
37
  tag?: string;
46
38
  }
47
- export interface GetGlobalUserListParams extends BaseParams {
39
+ export interface GetGlobalUserListParams extends TableParams {
48
40
  isActive?: boolean[];
49
41
  position?: string[];
50
42
  division?: string[];
@@ -73,7 +65,7 @@ export interface ChangePasswordPayload {
73
65
  export interface ModuleAuthPayload {
74
66
  module: ModuleAccess;
75
67
  }
76
- export interface GetConcurrentUsersParams extends BaseParams {
68
+ export interface GetConcurrentUsersParams extends TableParams {
77
69
  }
78
70
  export interface LogoutSessionPayload {
79
71
  sessionId: string;
@@ -1,14 +1,9 @@
1
+ import { TableParams } from '../types/dataTable.type';
1
2
  import { FetchDetailResponse, FetchResponse } from '../types/fetchResponse.type';
2
3
  import { MultiSelectOption } from '../types/options.type';
3
4
  import { Tab, Tablet } from '../types/tablet.type';
4
- export interface GetTabletListQuery {
5
+ export interface GetTabletListQuery extends TableParams {
5
6
  tab?: Tab;
6
- page?: number;
7
- limit?: number;
8
- sortBy?: string;
9
- sortOrder?: number;
10
- search?: string;
11
- column?: string[];
12
7
  deviceName?: string[];
13
8
  status?: string[];
14
9
  group?: string[];
@@ -29,7 +29,6 @@ export interface TAGFilterRaw {
29
29
  supplyAssetGroup?: number[];
30
30
  tag?: string[];
31
31
  }
32
- export type TAGFilterQuery = Partial<Record<keyof TAGFilterRaw, string>>;
33
32
  export interface PUTAuditTAGBody {
34
33
  ids: string[];
35
34
  markNotFoundAsDamagedMissing: boolean;
@@ -1,13 +1,9 @@
1
+ import { TableParams } from '../types/dataTable.type';
1
2
  import { FetchListResponse, FetchOptionResponse } from '../types/fetchResponse.type';
2
3
  import { MultiSelectOption } from '../types/options.type';
3
4
  import { TAGEventlogData } from '../types/tagEventlog.type';
4
- export interface TAGEventlogFilterQuery {
5
- page?: number;
6
- limit?: number;
7
- search?: string;
5
+ export interface TAGEventlogFilterQuery extends TableParams {
8
6
  sortBy?: string;
9
- sortOrder?: number;
10
- column?: string[];
11
7
  type?: string;
12
8
  createdAt?: string[];
13
9
  action?: string[];
@@ -48,7 +44,7 @@ export type TAGEventlogDetailResponse = {
48
44
  };
49
45
  export type GetTAGEventLogOptionsBody = {
50
46
  type: 'Audit TAG' | 'Combine & Separate TAG';
51
- modifiedByOptions: boolean;
52
- actionOptions: boolean;
53
- moduleOptions: boolean;
47
+ modifiedByOptions?: boolean;
48
+ actionOptions?: boolean;
49
+ moduleOptions?: boolean;
54
50
  };
@@ -1,15 +1,18 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { BooleanOptions } from '../dto/dataTable.dto';
3
- import { DeleteHardware, HandheldFetchDetailResponse, HandheldFetchResponse, HardwareDetailFilterQuery, HardwareFetchDetailResponse, HardwareFetchOptionResponse, HardwareFetchResponse, HardwareFilterQuery, PostActivateHardware, PutEditAliasName, PutEditAntennaGroup, PutEditAntennaPower, PutEditPortStatus, PutEditReaderGroup, PutHardwareStatusBody, PutPingReadersBody } from '../dto/hardware.dto';
4
- import { AntennaPortDetail, HardwareDataType, HardwareDetailUserActivity } from '../types/hardware.type';
2
+ import { DeleteHardware, HandheldFilterRaw, HandheldOptions, IotFilterRaw, IotOptions, IotPortFilterRaw, IotTabletFilterRaw, IotTabletOptions, PostActivateHardware, PutEditAliasName, PutEditAntennaGroup, PutEditAntennaPower, PutEditPortStatus, PutEditReaderGroup, PutHardwareStatusBody, PostPingReadersBody, SmartFixedReaderBody, AssetControlBody } from '../dto/hardware.dto';
3
+ import { AntennaPortDetail, HandheldDataType, HandheldDetailDataType, HardwareDetailUserActivity, IotDataType, IotDetailDataType, IotTablet, PingIot } from '../types/hardware.type';
4
+ import { FetchDetailResponse, FetchListResponse, FetchOptionResponse, FilterQuery, ShortFetchListResponse } from '../types/fetchResponse.type';
5
+ import { Tab } from '../types/tablet.type';
5
6
  declare const HardwareServices: {
6
- getHandheldReader: (params?: HardwareFilterQuery) => Promise<AxiosResponse<HandheldFetchResponse>>;
7
- getHandheldReaderDetail: (handheldId?: string) => Promise<AxiosResponse<HandheldFetchDetailResponse>>;
8
- getHandheldReaderOptions: (params?: BooleanOptions) => Promise<AxiosResponse<{
9
- data: HardwareFetchOptionResponse;
7
+ getHandheldReader: (params?: FilterQuery<HandheldFilterRaw>) => Promise<AxiosResponse<FetchListResponse<HandheldDataType>>>;
8
+ getHandheldReaderDetail: (handheldId?: string) => Promise<AxiosResponse<FetchDetailResponse<HandheldDetailDataType>>>;
9
+ getHandheldReaderOptions: (body?: HandheldOptions & {
10
+ tab?: Tab;
11
+ }) => Promise<AxiosResponse<{
12
+ data: FetchOptionResponse<HandheldOptions>;
10
13
  }>>;
11
- putMarkHandheldStatus: (body: PutHardwareStatusBody) => Promise<AxiosResponse>;
12
- putPingReaders: (body: PutPingReadersBody) => Promise<AxiosResponse>;
14
+ putMarkHandheldStatus: (moduleTab: "iot" | "handheld", ids: string[], body: PutHardwareStatusBody) => Promise<AxiosResponse>;
15
+ postPingReaders: (body: PostPingReadersBody) => Promise<AxiosResponse<ShortFetchListResponse<PingIot>>>;
13
16
  putMarkIOTStatus: (body: PutHardwareStatusBody, subTab: "iot-reader" | "antenna") => Promise<AxiosResponse>;
14
17
  putEditReaderGroup: (moduleTab: "iot" | "handheld", body: PutEditReaderGroup, hardwareId?: string) => Promise<AxiosResponse>;
15
18
  putEditAntennaGroup: (body: PutEditAntennaGroup, hardwareId?: string) => Promise<AxiosResponse>;
@@ -18,20 +21,28 @@ declare const HardwareServices: {
18
21
  postActivateHardware: (moduleTab: "iot" | "handheld", body: PostActivateHardware) => Promise<AxiosResponse>;
19
22
  deleteHardware: (moduleTab: "iot" | "handheld", params?: DeleteHardware) => Promise<AxiosResponse>;
20
23
  putAntennaPower: (body: PutEditAntennaPower, iotId?: string) => Promise<AxiosResponse>;
21
- getIOTReaderOrAntenna: (subTab: "iot-reader" | "antenna", params?: HardwareFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse>>;
22
- getIOTReaderDetail: (iotId?: string) => Promise<AxiosResponse<HardwareFetchDetailResponse>>;
23
- getIOTReaderOrAntennaOptions: (subTab: "iot-reader" | "antenna", params?: BooleanOptions) => Promise<AxiosResponse<{
24
- data: HardwareFetchOptionResponse;
24
+ getIotReader: (params?: FilterQuery<IotFilterRaw>) => Promise<AxiosResponse<FetchListResponse<IotDataType>>>;
25
+ getIotReaderDetail: (iotId?: string) => Promise<AxiosResponse<FetchDetailResponse<IotDetailDataType>>>;
26
+ getIotReaderOptions: (params?: IotOptions & {
27
+ tab?: Tab;
28
+ }) => Promise<AxiosResponse<{
29
+ data: FetchOptionResponse<IotOptions>;
25
30
  }>>;
26
- getActivityLog: (params?: HardwareFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse<HardwareDataType>>>;
27
- getActivityLogOptions: (params?: BooleanOptions) => Promise<AxiosResponse<{
28
- data: HardwareFetchOptionResponse;
31
+ getIotReaderPort: (id: string, params?: FilterQuery<IotPortFilterRaw>) => Promise<AxiosResponse<FetchListResponse<AntennaPortDetail>>>;
32
+ getIotReaderTablet: (id: string, params?: FilterQuery<IotTabletFilterRaw>) => Promise<AxiosResponse<FetchListResponse<IotTablet>>>;
33
+ getIotReaderTabletOptions: (id: string, params?: IotTabletOptions) => Promise<AxiosResponse<{
34
+ data: FetchOptionResponse<IotTabletOptions>;
29
35
  }>>;
30
- getDetailActivityLog: (params?: HardwareDetailFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse<HardwareDetailUserActivity>>>;
31
- getDetailActivityLogOptions: (params?: BooleanOptions) => Promise<AxiosResponse<{
32
- data: HardwareFetchOptionResponse;
36
+ putEditIotReader: (id: string, body: SmartFixedReaderBody | AssetControlBody) => Promise<AxiosResponse>;
37
+ disconnectIotTablet: (id: string, body?: DeleteHardware) => Promise<AxiosResponse>;
38
+ getActivityLog: (params?: FilterQuery) => Promise<AxiosResponse<FetchListResponse>>;
39
+ getActivityLogOptions: (params?: Record<string, boolean>) => Promise<AxiosResponse<{
40
+ data: FetchOptionResponse;
41
+ }>>;
42
+ getDetailActivityLog: (params?: FilterQuery) => Promise<AxiosResponse<FetchListResponse<HardwareDetailUserActivity>>>;
43
+ getDetailActivityLogOptions: (params?: Record<string, boolean>) => Promise<AxiosResponse<{
44
+ data: FetchOptionResponse;
33
45
  }>>;
34
46
  getExistingAliasNames: () => Promise<AxiosResponse>;
35
- getIotReaderPort: (id: string, params?: HardwareDetailFilterQuery) => Promise<AxiosResponse<HardwareFetchResponse<AntennaPortDetail>>>;
36
47
  };
37
48
  export default HardwareServices;
@@ -1,12 +1,14 @@
1
+ import { QueryParams } from './fetchResponse.type';
1
2
  export type ChildGroup = {
2
3
  groupHeader: string;
3
4
  groupItems: Data[];
4
5
  };
5
- export type TableParams = {
6
- search?: string;
6
+ export interface TableParams extends QueryParams {
7
7
  page?: number;
8
8
  limit?: number;
9
9
  sortBy?: string;
10
10
  sortOrder?: number;
11
- };
11
+ search?: string;
12
+ column?: string[];
13
+ }
12
14
  export type Data = Record<string, unknown>;
@@ -27,6 +27,7 @@ export type FetchOptionResponse<Opt = Record<string, boolean>> = {
27
27
  message: string;
28
28
  data: FilterOptions<Opt>;
29
29
  };
30
+ export type FilterQuery<T = Record<string, any>> = Partial<Record<keyof T, string>>;
30
31
  export type StatusMessageResponse = {
31
32
  status: number;
32
33
  message: string;
@@ -1,112 +1,73 @@
1
1
  import { FetchResponse } from './fetchResponse.type';
2
2
  export type HardwareTabType = 'activity-log' | 'handheld-damaged-missing' | 'handheld' | 'iot-reader' | 'iot-antenna' | 'iot-damaged-missing-reader' | 'iot-damaged-missing-antenna';
3
3
  export type HardwareDetailTabType = 'All' | 'Tagging' | 'User' | 'Antenna' | 'Changelog';
4
- export type ModuleGroup = {
5
- _id: string;
6
- key: number;
7
- name: string;
8
- module: 'fixedAsset' | 'supplyAsset';
9
- };
10
- export interface HardwareDataType {
11
- _id: string;
12
- imageSmall?: string;
13
- imageBig?: string;
14
- name: string;
15
- sku: string;
16
- aliasName?: string;
17
- brand?: string;
18
- model?: string;
19
- type: string;
20
- networkStatus?: 'Online' | 'Offline';
21
- status: string;
22
- createdAt?: string;
23
- updatedAt?: string;
24
- group?: ModuleGroup[];
25
- antennaGroup?: {
26
- port?: number;
27
- groups?: ModuleGroup[];
28
- }[];
29
- activePort?: string;
30
- reportedBy?: string;
31
- lastReportDate?: string;
32
- action?: string;
33
- userFullName?: string;
34
- readerName?: string;
35
- }
36
4
  export interface HardwareDetailDataType {
37
- _id: string;
38
- imageSmall?: string;
39
- imageBig?: string;
40
- readerName?: string;
41
- serialNumber?: string;
42
- name: {
43
- _id: string;
44
- nameWithSequence: string;
45
- name: string;
46
- key: number;
47
- nameNumber?: number;
48
- };
49
- aliasName?: string;
50
- networkStatus?: 'Online' | 'Offline';
51
- lastReportDate?: string;
52
- group?: ModuleGroup[];
53
- brand?: {
54
- name?: string;
55
- key?: number;
56
- };
57
- model?: {
58
- name?: string;
59
- key?: number;
60
- };
61
- manager?: {
62
- _id: string;
63
- name?: string;
64
- key?: number;
65
- };
66
- type: string;
67
- status: string;
68
- key: number;
69
- }
70
- export interface HandheldDataType {
71
5
  _id: string;
72
6
  image?: string;
73
7
  deviceName: string;
74
8
  sku: string;
75
9
  serialNumber: string;
76
10
  aliasName?: string;
11
+ }
12
+ export interface HandheldDataType extends HandheldDetailDataType {
13
+ reportedBy?: string;
14
+ reportedAt?: Date;
15
+ }
16
+ export interface HandheldDetailDataType extends HardwareDetailDataType {
77
17
  type: string;
78
18
  status: string;
79
- group?: {
19
+ group: {
80
20
  fixedAsset?: string;
81
21
  supplyAsset?: string;
82
22
  admin?: string;
83
23
  };
24
+ }
25
+ export interface IotGroup {
26
+ fixedAsset?: string;
27
+ supplyAsset?: string;
28
+ }
29
+ export interface IotGroupList {
30
+ fixedAsset: (string | null)[];
31
+ supplyAsset: (string | null)[];
32
+ }
33
+ export interface IotDataType extends Omit<IotDetailDataType, 'rssi'> {
34
+ connectedTablet: number;
35
+ status: string;
36
+ portGroup: IotGroupList;
84
37
  reportedBy?: string;
85
- reportedAt?: Date;
38
+ reportedAt?: string;
39
+ }
40
+ export interface IotDetailDataType extends HardwareDetailDataType {
41
+ activePort: string;
42
+ networkStatus: string;
43
+ brand: string;
44
+ model: string;
45
+ type: string;
46
+ readerGroup: IotGroup;
47
+ rssi: string;
86
48
  }
87
- export interface HandheldDetailDataType {
49
+ export interface IotPort {
50
+ _id: string;
51
+ isActive: boolean;
52
+ port: string;
53
+ portGroup: IotGroupList;
54
+ antennaPower: string;
55
+ }
56
+ export interface IotTablet {
88
57
  _id: string;
89
- image?: string;
90
58
  deviceName: string;
91
- sku: string;
92
- serialNumber: string;
93
- aliasName?: string;
94
- type: string;
95
- status: string;
96
- group?: {
97
- fixedAsset?: string;
98
- supplyAsset?: string;
99
- admin?: string;
100
- };
59
+ deviceId: string;
101
60
  }
102
61
  export interface AntennaPortDetail {
103
62
  _id: number;
104
63
  isActive: boolean;
105
64
  port: string;
106
- group: ModuleGroup[];
65
+ portGroup: IotGroup;
107
66
  antennaPower: string;
108
- powerInt: number;
109
- invalid?: boolean;
67
+ }
68
+ export interface PingIot {
69
+ _id: string;
70
+ isOnline: boolean;
110
71
  }
111
72
  export interface HardwareDetailUserActivity {
112
73
  _id: string;