@tagsamurai/gsts-api-services 2.0.1-alpha.23 → 2.0.1-alpha.24

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.
@@ -2,11 +2,11 @@ import R from "axios";
2
2
  const U = { 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") => U["VITE_" + t], p = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
- prefix: n = "",
5
+ prefix: o = "",
6
6
  headers: a = {},
7
- ...c
8
- } = t, w = "".concat(I(r)).concat(n), A = R.create({
9
- ...c,
7
+ ...l
8
+ } = t, w = "".concat(I(r)).concat(o), A = R.create({
9
+ ...l,
10
10
  baseURL: w,
11
11
  headers: e ? a : {
12
12
  "Content-Type": "application/json",
@@ -18,49 +18,49 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
18
18
  const P = JSON.parse((S = localStorage.getItem("user")) != null ? S : "{}"), O = ($ = (y = P.jwt) != null ? y : P.token) != null ? $ : "";
19
19
  return h.headers.Authorization = "Bearer ".concat(O), h;
20
20
  }), A;
21
- }, l = p({
21
+ }, c = p({
22
22
  prefix: "/v1/global-settings/auth"
23
23
  }), E = (t) => {
24
- var e, r, n, a;
25
- return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (n = t.response) == null ? void 0 : n.data) == null ? void 0 : a.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, o, a;
25
+ return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (o = t.response) == null ? void 0 : o.data) == null ? void 0 : a.message) === "jwt malformed" ? (window.onblur = null, window.onfocus = null, window.sessionExpired = !0, window.dispatchEvent(new CustomEvent("user:expired"))) : Promise.reject(t);
26
26
  }, k = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
29
- return l.post("/login", e);
29
+ return c.post("/login", e);
30
30
  },
31
- reLogin: (t) => (l.interceptors.response.use((e) => e, E), l.post("/login", t)),
31
+ reLogin: (t) => (c.interceptors.response.use((e) => e, E), c.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
- return l.post("/request-otp", e);
34
+ return c.post("/request-otp", e);
35
35
  },
36
36
  requestResetPassLink: (t) => {
37
37
  const e = { email: t };
38
- return l.post("/request-reset-link", e);
38
+ return c.post("/request-reset-link", e);
39
39
  },
40
- setPassword: (t) => l.post("/set-password", t),
41
- verifyToken: (t) => l.get("/verify-token/".concat(t)),
40
+ setPassword: (t) => c.post("/set-password", t),
41
+ verifyToken: (t) => c.get("/verify-token/".concat(t)),
42
42
  confirmEmailChange: (t) => {
43
43
  const e = { token: t };
44
- return l.put("/confirm-email-change/confirm", e);
44
+ return c.put("/confirm-email-change/confirm", e);
45
45
  },
46
- postLogout: () => l.post("/logout"),
46
+ postLogout: () => c.post("/logout"),
47
47
  /**
48
48
  *
49
49
  * @deprecated use postLogout instead
50
50
  */
51
- logout: () => l.post("/logout")
51
+ logout: () => c.post("/logout")
52
52
  }, L = (t, e, r) => {
53
- const n = new URL(I("APP_TAGSAMURAI_API") || "").origin;
54
- let a = t.startsWith("http") ? t : "".concat(n, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
53
+ const o = new URL(I("APP_TAGSAMURAI_API") || "").origin;
54
+ let a = t.startsWith("http") ? t : "".concat(o, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
56
- const c = new URLSearchParams();
57
- e && (c.set("width", e.toString()), c.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(c.toString());
56
+ const l = new URLSearchParams();
57
+ e && (l.set("width", e.toString()), l.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(l.toString());
58
58
  }
59
59
  return a;
60
60
  }, _ = () => {
61
- var e, r, n;
61
+ var e, r, o;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
- return (n = (r = t.jwt) != null ? r : t.token) != null ? n : "";
63
+ return (o = (r = t.jwt) != null ? r : t.token) != null ? o : "";
64
64
  }, x = async (t, e) => {
65
65
  const r = await fetch(t, {
66
66
  headers: {
@@ -69,8 +69,8 @@ const U = { 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 n = await r.arrayBuffer();
73
- return new Blob([n], {
72
+ const o = await r.arrayBuffer();
73
+ return new Blob([o], {
74
74
  type: r.headers.get("Content-Type") || "image/webp"
75
75
  });
76
76
  }, C = async (t) => {
@@ -80,10 +80,10 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, H = async (t, e, r, n) => {
83
+ }, H = async (t, e, r, o) => {
84
84
  if (!t) return;
85
85
  const a = L(t, e, r);
86
- return n ? a : C(a);
86
+ return o ? a : C(a);
87
87
  }, J = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
@@ -109,14 +109,14 @@ const U = { 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 n = t[r];
113
- e[r] = G(n) ? JSON.parse(n.trim()) : n;
112
+ const o = t[r];
113
+ e[r] = G(o) ? JSON.parse(o.trim()) : o;
114
114
  }), e;
115
- }, D = p({
115
+ }, T = p({
116
116
  prefix: "/v1/global-settings/change-log"
117
117
  }), j = {
118
- getChangelogs: (t) => D.get("", { params: t }),
119
- getChangelogOptions: (t) => D.get("/options", { params: t })
118
+ getChangelogs: (t) => T.get("", { params: t }),
119
+ getChangelogOptions: (t) => T.get("/options", { params: t })
120
120
  }, m = p({
121
121
  prefix: "/v1/global-settings/division"
122
122
  }), B = {
@@ -128,88 +128,89 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
128
128
  const e = { id: JSON.stringify(t) };
129
129
  return m.delete("", { params: e });
130
130
  }
131
- }, d = p({
131
+ }, g = p({
132
132
  prefix: "/v2/hardware-tagging"
133
133
  }), q = {
134
134
  getAllTAG: (t) => {
135
135
  const e = u(t);
136
- return d.post("/all-tag/list", e);
136
+ return g.post("/all-tag/list", e);
137
137
  },
138
138
  getAllTAGOptions: (t) => {
139
139
  const e = u(t);
140
- return d.post("all-tag/options", e);
140
+ return g.post("all-tag/options", e);
141
141
  },
142
- getNotPairedYetCounts: () => d.get("/not-paired-yet/tag-count"),
142
+ getNotPairedYetCounts: () => g.get("/not-paired-yet/tag-count"),
143
143
  getNotPairedYetList: (t) => {
144
144
  const e = u(t);
145
- return d.post("/not-paired-yet/list", e);
145
+ return g.post("/not-paired-yet/list", e);
146
146
  },
147
147
  getNotPairedYetOptions: (t) => {
148
148
  const e = u(t);
149
- return d.post("/not-paired-yet/options", e);
149
+ return g.post("/not-paired-yet/options", e);
150
150
  },
151
- getAuditTAGDetail: (t) => d.post("/audit/detail", t),
152
- submitAuditTAG: (t) => d.post("/audit/submit", t),
153
- submitCombineTAG: (t) => d.post("/combine-tag/combine", t),
154
- submitSeparateTAG: (t) => d.post("/combine-tag/separate", t),
151
+ getAuditTAGDetail: (t) => g.post("/audit/detail", t),
152
+ submitAuditTAG: (t) => g.post("/audit/submit", t),
153
+ submitCombineTAG: (t) => g.post("/combine-tag/combine", t),
154
+ submitSeparateTAG: (t) => g.post("/combine-tag/separate", t),
155
155
  getPairedList: (t) => {
156
156
  const e = u(t);
157
- return d.post("/paired/list", e);
157
+ return g.post("/paired/list", e);
158
158
  },
159
159
  getPairedOptions: (t) => {
160
160
  const e = u(t);
161
- return d.post("/paired/options", e);
162
- }
163
- }, o = p({
161
+ return g.post("/paired/options", e);
162
+ },
163
+ getScanTag: (t) => g.get("/scan-tag", { params: { tag: t } })
164
+ }, n = p({
164
165
  prefix: "/v2/hardware-tagging"
165
166
  }), V = {
166
167
  getHandheldReader: (t) => {
167
168
  const e = u(t);
168
- return o.post("/handheld-reader/list", e);
169
- },
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"), {
169
+ return n.post("/handheld-reader/list", e);
170
+ },
171
+ getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
172
+ getHandheldReaderOptions: (t) => n.post("/handheld-reader/options", t),
173
+ putMarkHandheldStatus: (t, e, r) => n.patch("/".concat(t, "/status"), r, { params: e }),
174
+ postPingReaders: (t) => n.post("/iot-reader/ping", t),
175
+ putMarkIOTStatus: (t, e) => n.put("/".concat(e, "/mark-status"), t),
176
+ putEditReaderGroup: (t, e, r) => n.patch("/".concat(t, "-reader/").concat(r, "/group"), e),
177
+ putEditAntennaGroup: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-group"), t),
178
+ putEditPortStatus: (t, e) => n.put("/iot-reader/".concat(e, "/set-port-status"), t),
179
+ putEditAliasName: (t, e, r) => n.patch("/".concat(t, "-reader/").concat(r, "/alias-name"), e),
180
+ postActivateHardware: (t, e) => n.post("/".concat(t, "-reader/activate"), e),
181
+ deleteHardware: (t, e) => n.delete("/".concat(t, "-reader"), {
181
182
  params: e
182
183
  }),
183
- putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
184
+ putAntennaPower: (t, e) => n.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
184
185
  getIotReader: (t) => {
185
186
  const e = u({ ...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"), {
187
+ return n.post("/iot-reader", e);
188
+ },
189
+ getIotReaderDetail: (t) => n.get("/iot-reader/".concat(t)),
190
+ getIotReaderOptions: (t) => n.post("/iot-reader/options", t),
191
+ getIotReaderPort: (t, e) => n.post("/iot-reader/".concat(t, "/port/list"), { params: e }),
192
+ getIotReaderTablet: (t, e) => n.post("/iot-reader/".concat(t, "/tablet/list"), { params: e }),
193
+ getIotReaderTabletOptions: (t, e) => n.post("/iot-reader/".concat(t, "/tablet/options"), e),
194
+ putEditIotReader: (t, e) => n.patch("/iot-reader/".concat(t), e),
195
+ disconnectIotTablet: (t, e) => n.delete("/iot-reader/".concat(t, "/tablet"), {
195
196
  data: e
196
197
  }),
197
198
  // 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")
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")
203
204
  }, N = p({
204
205
  env: "APP_LOGS_NOTIFICATION_API",
205
206
  prefix: "/v2"
206
207
  }), Y = {
207
208
  getSessionLogList: (t) => N.get("/session-log", { params: t })
208
- }, T = p({
209
+ }, D = p({
209
210
  prefix: "/v1/global-settings/option"
210
211
  }), z = {
211
- getPositions: () => T.get("/position"),
212
- getDivisions: () => T.get("/division")
212
+ getPositions: () => D.get("/position"),
213
+ getDivisions: () => D.get("/division")
213
214
  }, f = p({
214
215
  prefix: "/v1/global-settings/position"
215
216
  }), X = {
@@ -238,36 +239,36 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
238
239
  return b.post("/tag-event-log/options", e);
239
240
  },
240
241
  getDetailTAGEventlog: (t) => b.get("/tag-event-log/".concat(t))
241
- }, g = p({
242
+ }, d = p({
242
243
  prefix: "/v1/global-settings/user"
243
244
  }), Q = {
244
- getUsers: (t) => g.get("", { params: t }),
245
- getUserDetail: (t) => g.get("/".concat(t)),
246
- getUserSystemLogs: (t, e) => g.get("/".concat(t, "/system-logs"), { params: e }),
245
+ getUsers: (t) => d.get("", { params: t }),
246
+ getUserDetail: (t) => d.get("/".concat(t)),
247
+ getUserSystemLogs: (t, e) => d.get("/".concat(t, "/system-logs"), { params: e }),
247
248
  getUserSystemLogOptions: (t, e) => {
248
249
  const r = {};
249
- return r[e] = !0, g.get("/".concat(t, "/system-logs/options"), { params: r });
250
+ return r[e] = !0, d.get("/".concat(t, "/system-logs/options"), { params: r });
250
251
  },
251
252
  postCreateUser: (t) => {
252
253
  const e = { "Content-Type": "multipart/form-data" };
253
- return g.post("", t, { headers: e });
254
+ return d.post("", t, { headers: e });
254
255
  },
255
256
  putEditUser: (t, e) => {
256
257
  const r = { "Content-Type": "multipart/form-data" };
257
- return g.put("/".concat(t), e, { headers: r });
258
+ return d.put("/".concat(t), e, { headers: r });
258
259
  },
259
260
  deleteUsers: (t) => {
260
261
  const e = { id: JSON.stringify(t) };
261
- return g.delete("", { params: e });
262
+ return d.delete("", { params: e });
262
263
  },
263
- putToggleStatusUsers: (t) => g.put("/active-status", t),
264
+ putToggleStatusUsers: (t) => d.put("/active-status", t),
264
265
  getUserOptions: (t) => {
265
266
  const e = {};
266
- return e[t] = !0, g.get("/options", { params: e });
267
+ return e[t] = !0, d.get("/options", { params: e });
267
268
  },
268
- deleteCancelEmailChange: (t) => g.delete("/cancel-email-change/".concat(t)),
269
- postResendEmail: (t) => g.post("/resend-email", t),
270
- putChangePassword: (t, e) => g.put("/change-password/".concat(t), e)
269
+ deleteCancelEmailChange: (t) => d.delete("/cancel-email-change/".concat(t)),
270
+ postResendEmail: (t) => d.post("/resend-email", t),
271
+ putChangePassword: (t, e) => d.put("/change-password/".concat(t), e)
271
272
  }, v = p({
272
273
  prefix: "/v2/hardware-tagging"
273
274
  }), Z = {
@@ -311,8 +312,8 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
311
312
  },
312
313
  createUsers: (t) => {
313
314
  const e = new FormData();
314
- return Object.entries(t).forEach(([r, n]) => {
315
- n != null && e.append(r, n);
315
+ return Object.entries(t).forEach(([r, o]) => {
316
+ o != null && e.append(r, o);
316
317
  }), s.post("/users", e, {
317
318
  headers: { "Content-Type": "multipart/form-data" }
318
319
  });
@@ -332,8 +333,8 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
332
333
  },
333
334
  editUsers: (t, e) => {
334
335
  const r = new FormData();
335
- return Object.entries(e).forEach(([n, a]) => {
336
- a != null && r.append(n, a);
336
+ return Object.entries(e).forEach(([o, a]) => {
337
+ a != null && r.append(o, a);
337
338
  }), s.patch("/users/".concat(t), r, {
338
339
  headers: { "Content-Type": "multipart/form-data" }
339
340
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.23",
3
+ "version": "2.0.1-alpha.24",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -17,6 +17,16 @@ export type TAGDetailAuditResponse = {
17
17
  detail: TAGDetailCount[];
18
18
  };
19
19
  };
20
+ export type ScanResponse = {
21
+ _id: string;
22
+ rfidCode: string | null;
23
+ nfcCode: string | null;
24
+ qrCode: string | null;
25
+ tagType: string;
26
+ rfidSku: string | null;
27
+ nfcSku: string | null;
28
+ status: string;
29
+ };
20
30
  export interface TAGFilterRaw {
21
31
  rfidCode?: ('Yes' | 'No')[];
22
32
  qrCode?: ('Yes' | 'No')[];
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { GetAllTAGOptionsQuery, GetAllTAGParams, GetAuditTAGDetailParams, GetNotPairedYetListParams, GetNotPairedYetOptions, SubmitAuditTAGBody, SubmitCombineTAGBody, SubmitSeparateTAGBody } from '../dto/hardware.dto';
3
- import { TAGFetchOptionResponse } from '../dto/tag.dto';
3
+ import { ScanResponse, TAGFetchOptionResponse } from '../dto/tag.dto';
4
4
  import { FetchListResponse } from '../types/fetchResponse.type';
5
5
  import { AuditTAGDetailResponse, NotPairedYetCountsResponse, TAGResponseType } from '../types/hardware.type';
6
6
  declare const GlobalTagServices: {
@@ -21,5 +21,6 @@ declare const GlobalTagServices: {
21
21
  getPairedOptions: (params?: GetAllTAGParams) => Promise<AxiosResponse<{
22
22
  data: TAGFetchOptionResponse;
23
23
  }>>;
24
+ getScanTag: (tag: string) => Promise<AxiosResponse<FetchListResponse<ScanResponse>>>;
24
25
  };
25
26
  export default GlobalTagServices;