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

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,5 +1,5 @@
1
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) => {
2
+ const b = { 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") => b["VITE_" + t], a = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: s = "",
@@ -13,22 +13,22 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
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;
16
+ return A.interceptors.request.use((f) => {
17
+ var P, h, $;
18
+ const v = JSON.parse((P = localStorage.getItem("user")) != null ? P : "{}"), O = ($ = (h = v.jwt) != null ? h : v.token) != null ? $ : "";
19
+ return f.headers.Authorization = "Bearer ".concat(O), f;
20
20
  }), A;
21
21
  }, u = a({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), b = (t) => {
23
+ }), E = (t) => {
24
24
  var e, r, s, i;
25
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 = {
26
+ }, N = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
29
29
  return u.post("/login", e);
30
30
  },
31
- reLogin: (t) => (u.interceptors.response.use((e) => e, b), u.post("/login", t)),
31
+ reLogin: (t) => (u.interceptors.response.use((e) => e, E), u.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
34
  return u.post("/request-otp", e);
@@ -49,7 +49,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
49
49
  * @deprecated use postLogout instead
50
50
  */
51
51
  logout: () => u.post("/logout")
52
- }, h = (t, e, r) => {
52
+ }, w = (t, e, r) => {
53
53
  const s = new URL(T("APP_TAGSAMURAI_API") || "").origin;
54
54
  let i = t.startsWith("http") ? t : "".concat(s, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
@@ -73,18 +73,18 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
73
73
  return new Blob([s], {
74
74
  type: r.headers.get("Content-Type") || "image/webp"
75
75
  });
76
- }, w = async (t) => {
76
+ }, G = async (t) => {
77
77
  try {
78
78
  const e = L(), r = await R(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, s) => {
84
84
  if (!t) return;
85
- const i = h(t, e, r);
86
- return s ? i : w(i);
87
- }, N = (t) => {
85
+ const i = w(t, e, r);
86
+ return s ? i : G(i);
87
+ }, k = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
90
90
  const e = {};
@@ -95,14 +95,31 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
95
95
  [r]: t[r]
96
96
  });
97
97
  }), e;
98
+ }, U = (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
+ }, S = (t) => {
108
+ if (!t)
109
+ return {};
110
+ const e = {};
111
+ return Object.keys(t).forEach((r) => {
112
+ const s = t[r];
113
+ e[r] = U(s) ? JSON.parse(s.trim()) : s;
114
+ }), e;
98
115
  }, I = a({
99
116
  prefix: "/v1/global-settings/change-log"
100
- }), k = {
117
+ }), j = {
101
118
  getChangelogs: (t) => I.get("", { params: t }),
102
119
  getChangelogOptions: (t) => I.get("/options", { params: t })
103
120
  }, c = a({
104
121
  prefix: "/v1/global-settings/division"
105
- }), B = {
122
+ }), J = {
106
123
  getDivisions: (t) => c.get("", { params: t }),
107
124
  getDivisionDetail: (t) => c.get("/".concat(t)),
108
125
  postCreateDivision: (t) => c.post("/", t),
@@ -113,7 +130,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
113
130
  }
114
131
  }, g = a({
115
132
  prefix: "/v1/global-settings"
116
- }), j = {
133
+ }), M = {
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 }),
@@ -124,24 +141,37 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
124
141
  putAllocateTAG: (t, e) => g.put("/".concat(t, "/allocate"), e),
125
142
  putCombineTAG: (t) => g.put("/combine", t)
126
143
  }, 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),
144
+ prefix: "/v2/hardware-tagging"
145
+ }), H = {
146
+ getHandheldReader: (t) => {
147
+ const e = S(t);
148
+ return n.post("/handheld-reader/list", e);
149
+ },
150
+ getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
151
+ getHandheldReaderOptions: (t) => {
152
+ const e = S(t);
153
+ return n.post("/handheld-reader/options", e);
154
+ },
155
+ putMarkHandheldStatus: (t) => n.patch("/handheld-reader/status", t),
133
156
  putPingReaders: (t) => n.put("/iot-reader/ping", t),
134
157
  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"),
158
+ putEditReaderGroup: (t, e, r) => n.patch(
159
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/group"),
137
160
  e
138
161
  ),
139
162
  putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
140
163
  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"),
164
+ putEditAliasName: (t, e, r) => n.patch(
165
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/").concat(r, "/alias-name"),
166
+ e
167
+ ),
168
+ postActivateHardware: (t, e) => n.post(
169
+ "/".concat(t === "iot" ? "iot-" : "handheld-", "reader/activate"),
143
170
  e
144
171
  ),
172
+ deleteHardware: (t, e) => n.delete("/".concat(t === "iot" ? "iot-" : "handheld-", "-reader"), {
173
+ params: e
174
+ }),
145
175
  putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
146
176
  getIOTReaderOrAntenna: (t, e) => n.get("/".concat(t), { params: e }),
147
177
  getIOTReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
@@ -152,19 +182,19 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
152
182
  getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
153
183
  getExistingAliasNames: () => n.get("/reader/alias-names"),
154
184
  getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
155
- }, G = a({
185
+ }, D = a({
156
186
  env: "APP_LOGS_NOTIFICATION_API",
157
187
  prefix: "/v2"
158
- }), q = {
159
- getSessionLogList: (t) => G.get("/session-log", { params: t })
188
+ }), V = {
189
+ getSessionLogList: (t) => D.get("/session-log", { params: t })
160
190
  }, m = a({
161
191
  prefix: "/v1/global-settings/option"
162
- }), J = {
192
+ }), q = {
163
193
  getPositions: () => m.get("/position"),
164
194
  getDivisions: () => m.get("/division")
165
195
  }, l = a({
166
196
  prefix: "/v1/global-settings/position"
167
- }), V = {
197
+ }), F = {
168
198
  getPositions: (t) => l.get("", { params: t }),
169
199
  getPositionDetail: (t) => l.get("/".concat(t)),
170
200
  postCreatePosition: (t) => l.post("/", t),
@@ -173,20 +203,20 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
173
203
  const e = { id: JSON.stringify(t) };
174
204
  return l.delete("", { params: e });
175
205
  }
176
- }, U = a({
206
+ }, x = a({
177
207
  env: "APP_TAGSAMURAI_API",
178
208
  prefix: "/tag/v2"
179
- }), H = {
180
- getTagInfo: (t) => U.get("/rfid-qr/scan", { params: t })
209
+ }), z = {
210
+ getTagInfo: (t) => x.get("/rfid-qr/scan", { params: t })
181
211
  }, d = a({
182
212
  prefix: "/v1/global-settings/change-log"
183
- }), F = {
213
+ }), W = {
184
214
  getTAGEventlog: (t) => d.get("/tag-event-log", { params: t }),
185
215
  getTAGEventlogOptions: (t) => d.get("/tag-event-log/options", { params: t }),
186
216
  getDetailTAGEventlog: (t) => d.get("/tag-event-log/".concat(t))
187
217
  }, o = a({
188
218
  prefix: "/v1/global-settings/user"
189
- }), z = {
219
+ }), K = {
190
220
  getUsers: (t) => o.get("", { params: t }),
191
221
  getUserDetail: (t) => o.get("/".concat(t)),
192
222
  getUserSystemLogs: (t, e) => o.get("/".concat(t, "/system-logs"), { params: e }),
@@ -216,18 +246,18 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
216
246
  putChangePassword: (t, e) => o.put("/change-password/".concat(t), e)
217
247
  };
218
248
  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,
249
+ N as AuthServices,
250
+ j as ChangelogServices,
251
+ J as DivisionServices,
252
+ M as GlobalTagServices,
253
+ H as HardwareServices,
254
+ V as LogServices,
255
+ q as OptionServices,
256
+ F as PositionServices,
257
+ W as TagEventlogServices,
258
+ z as TagServices,
259
+ K as UserServices,
230
260
  T as getBaseURL,
231
- C as getImageURL,
232
- N as queryParamsStringfy
261
+ B as getImageURL,
262
+ k as queryParamsStringfy
233
263
  };
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.2",
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;
@@ -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,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';