@tagsamurai/gsts-api-services 2.0.1-alpha.15 → 2.0.1-alpha.17

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.15",
3
+ "version": "2.0.1-alpha.17",
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,23 +19,3 @@ export type FilterOptions = {
20
19
  actionOptions?: MultiSelectOption[];
21
20
  objectNameOptions?: MultiSelectOption[];
22
21
  };
23
- export type BooleanOptions = {
24
- deviceNameOptions?: boolean;
25
- nameOptions?: boolean;
26
- userFullNameOptions?: boolean;
27
- networkStatusOptions?: boolean;
28
- brandOptions?: boolean;
29
- modelOptions?: boolean;
30
- moduleOptions?: boolean;
31
- reportedByOptions?: boolean;
32
- modifiedByOptions?: boolean;
33
- fieldOptions?: boolean;
34
- activityOptions?: boolean;
35
- pairedInOptions?: boolean;
36
- availabilityOptions?: boolean;
37
- module?: ApplicationModule;
38
- status?: string;
39
- skuOptions?: boolean;
40
- statusOptions?: boolean;
41
- typeOptions?: boolean;
42
- };
@@ -1,59 +1,21 @@
1
- import { AntennaPortDetail, 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 HardwareFetchDetailResponse<T = HardwareDetailDataType> {
13
- message: string;
14
- status: number;
15
- data: T;
16
- }
17
- export type HardwareFetchOptionResponse<Opt = Record<string, boolean>> = Record<keyof Opt, MultiSelectOption[]>;
18
- export interface HardwareShortFetchResponse<T = AntennaPortDetail> {
19
- message: string;
20
- status: number;
21
- data: T[];
22
- }
23
- export type HardwareFilterRaw = {
24
- deviceName?: number[];
25
- name?: number[];
4
+ export interface HandheldFilterRaw extends TableParams {
5
+ tab?: Tab;
6
+ deviceName?: string[];
26
7
  type?: string[];
27
- readerGroup?: number[];
28
- readerType?: string;
29
- networkStatus?: string[];
30
- brand?: number[];
31
- model?: number[];
32
8
  status?: string[];
33
- tag?: string;
34
9
  sku?: string[];
35
- groupModule?: string[];
36
- antennaGroupModule?: string[];
37
- antennaGroup?: number[];
38
- userFullName?: number[];
39
- action?: string[];
40
- reportedBy?: number[];
41
- createdAt?: number[];
42
- lastReportDate?: number[];
43
- };
44
- export type HardwareFilterQuery = Partial<Record<keyof HardwareFilterRaw, string>>;
45
- export type HardwareDetailFilterRaw = {
46
- date?: number[];
47
- readerId?: string;
48
- groupModule?: string[];
49
- antennaGroupModule?: string[];
50
- action?: string[];
51
- userFullName?: number[];
52
- modifiedBy?: number[];
53
- isActive?: string[];
54
- field?: string[];
55
- };
56
- export type HardwareDetailFilterQuery = Partial<Record<keyof HardwareDetailFilterRaw, string>>;
10
+ group?: string[];
11
+ reportedBy?: string[];
12
+ reportedAt?: number[];
13
+ }
14
+ export interface HandheldOptions {
15
+ deviceNameOptions?: boolean;
16
+ skuOptions?: boolean;
17
+ reportedByOptions?: boolean;
18
+ }
57
19
  export type DetailTableFilterParams = {
58
20
  createdAt?: string;
59
21
  activity?: string;
@@ -68,9 +30,42 @@ export type DetailTableFilterParams = {
68
30
  group?: string;
69
31
  tag?: string;
70
32
  };
71
- 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
+ }
72
67
  export interface PutEditAliasName {
73
- aliasName: string;
68
+ aliasName: string | null;
74
69
  }
75
70
  export interface PostActivateHardware {
76
71
  serialNumber: string;
@@ -86,6 +81,34 @@ export interface PutEditReaderGroup {
86
81
  receivingFixedAssetGroup?: string[];
87
82
  receivingSupplyAssetGroup?: string[];
88
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
+ }
89
112
  export interface PutEditAntennaGroup {
90
113
  group: Omit<PutEditReaderGroup, 'receivingFixedAssetGroup' | 'receivingSupplyAssetGroup'>[];
91
114
  }
@@ -98,28 +121,22 @@ export interface PutEditPortStatus {
98
121
  port: number;
99
122
  }[];
100
123
  }
101
- export interface PutPingReadersBody {
124
+ export interface PostPingReadersBody {
102
125
  ids: string[];
103
126
  }
104
127
  export interface PutHardwareStatusBody {
105
128
  status: 'Missing' | 'Damaged' | 'Available';
106
- ids?: string[];
107
129
  }
108
130
  export type HardwareFormType = PutEditAliasName | PutEditAntennaGroup | PutEditAntennaPower | PutHardwareStatusBody | PutEditReaderGroup;
109
- export type GetAllTAGParams = {
110
- page?: number;
111
- limit?: number;
112
- search?: string;
131
+ export interface GetAllTAGParams extends TableParams {
113
132
  sortBy?: string;
114
- sortOrder?: number;
115
- column?: string[];
116
133
  tagType?: string[];
117
134
  rfidSku?: string[];
118
135
  nfcSku?: string[];
119
136
  type?: string[];
120
137
  status?: string[];
121
138
  lastScanned?: string[];
122
- };
139
+ }
123
140
  export type GetAllTAGOptionsQuery = {
124
141
  tagTypeOptions?: boolean;
125
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[];
@@ -1,15 +1,18 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { BooleanOptions } from '../dto/dataTable.dto';
3
- import { DeleteHardware, 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<HardwareFetchResponse>>;
7
- getHandheldReaderDetail: (handheldId?: string) => Promise<AxiosResponse<HardwareFetchDetailResponse>>;
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,80 +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 {
4
+ export interface HardwareDetailDataType {
11
5
  _id: string;
12
- imageSmall?: string;
13
- imageBig?: string;
14
- name: string;
6
+ image?: string;
7
+ deviceName: string;
15
8
  sku: string;
9
+ serialNumber: string;
16
10
  aliasName?: string;
17
- brand?: string;
18
- model?: string;
11
+ }
12
+ export interface HandheldDataType extends HandheldDetailDataType {
13
+ reportedBy?: string;
14
+ reportedAt?: Date;
15
+ }
16
+ export interface HandheldDetailDataType extends HardwareDetailDataType {
19
17
  type: string;
20
- networkStatus?: 'Online' | 'Offline';
21
18
  status: string;
22
- createdAt?: string;
23
- updatedAt?: string;
24
- group?: ModuleGroup[];
25
- antennaGroup?: {
26
- port?: number;
27
- groups?: ModuleGroup[];
28
- }[];
29
- activePort?: string;
19
+ group: {
20
+ fixedAsset?: string;
21
+ supplyAsset?: string;
22
+ admin?: string;
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;
30
37
  reportedBy?: string;
31
- lastReportDate?: string;
32
- action?: string;
33
- userFullName?: string;
34
- readerName?: string;
38
+ reportedAt?: string;
35
39
  }
36
- 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
- };
40
+ export interface IotDetailDataType extends HardwareDetailDataType {
41
+ activePort: string;
42
+ networkStatus: string;
43
+ brand: string;
44
+ model: string;
66
45
  type: string;
67
- status: string;
68
- key: number;
46
+ readerGroup: IotGroup;
47
+ rssi: string;
48
+ }
49
+ export interface IotPort {
50
+ _id: string;
51
+ isActive: boolean;
52
+ port: string;
53
+ portGroup: IotGroupList;
54
+ antennaPower: string;
55
+ }
56
+ export interface IotTablet {
57
+ _id: string;
58
+ deviceName: string;
59
+ deviceId: string;
69
60
  }
70
61
  export interface AntennaPortDetail {
71
62
  _id: number;
72
63
  isActive: boolean;
73
64
  port: string;
74
- group: ModuleGroup[];
65
+ portGroup: IotGroup;
75
66
  antennaPower: string;
76
- powerInt: number;
77
- invalid?: boolean;
67
+ }
68
+ export interface PingIot {
69
+ _id: string;
70
+ isOnline: boolean;
78
71
  }
79
72
  export interface HardwareDetailUserActivity {
80
73
  _id: string;