@tagsamurai/gsts-api-services 2.0.1-alpha.11 → 2.0.1-alpha.13

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,13 +1,13 @@
1
1
  import E from "axios";
2
- const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://dev-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://dev-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, I = (t = "APP_TAGSAMURAI_API") => D["VITE_" + t], a = (t = {}, e = !1) => {
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) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: o = "",
6
6
  headers: i = {},
7
7
  ...l
8
- } = t, O = "".concat(I(r)).concat(o), A = E.create({
8
+ } = t, I = "".concat(O(r)).concat(o), A = E.create({
9
9
  ...l,
10
- baseURL: O,
10
+ baseURL: I,
11
11
  headers: e ? i : {
12
12
  "Content-Type": "application/json",
13
13
  ...i
@@ -18,46 +18,46 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
18
18
  const b = JSON.parse((P = localStorage.getItem("user")) != null ? P : "{}"), w = (S = (y = b.jwt) != null ? y : b.token) != null ? S : "";
19
19
  return m.headers.Authorization = "Bearer ".concat(w), m;
20
20
  }), A;
21
- }, g = a({
21
+ }, c = u({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), U = (t) => {
23
+ }), L = (t) => {
24
24
  var e, r, o, i;
25
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);
26
26
  }, j = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
29
- return g.post("/login", e);
29
+ return c.post("/login", e);
30
30
  },
31
- reLogin: (t) => (g.interceptors.response.use((e) => e, U), g.post("/login", t)),
31
+ reLogin: (t) => (c.interceptors.response.use((e) => e, L), c.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
- return g.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 g.post("/request-reset-link", e);
38
+ return c.post("/request-reset-link", e);
39
39
  },
40
- setPassword: (t) => g.post("/set-password", t),
41
- verifyToken: (t) => g.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 g.put("/confirm-email-change/confirm", e);
44
+ return c.put("/confirm-email-change/confirm", e);
45
45
  },
46
- postLogout: () => g.post("/logout"),
46
+ postLogout: () => c.post("/logout"),
47
47
  /**
48
48
  *
49
49
  * @deprecated use postLogout instead
50
50
  */
51
- logout: () => g.post("/logout")
52
- }, _ = (t, e, r) => {
53
- const o = new URL(I("APP_TAGSAMURAI_API") || "").origin;
51
+ logout: () => c.post("/logout")
52
+ }, U = (t, e, r) => {
53
+ const o = new URL(O("APP_TAGSAMURAI_API") || "").origin;
54
54
  let i = t.startsWith("http") ? t : "".concat(o, "/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
- }, L = () => {
60
+ }, _ = () => {
61
61
  var e, r, o;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
63
  return (o = (r = t.jwt) != null ? r : t.token) != null ? o : "";
@@ -75,14 +75,14 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
75
75
  });
76
76
  }, G = async (t) => {
77
77
  try {
78
- const e = L(), r = await R(t, e);
78
+ const e = _(), r = await R(t, e);
79
79
  return URL.createObjectURL(r);
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
83
  }, B = async (t, e, r, o) => {
84
84
  if (!t) return;
85
- const i = _(t, e, r);
85
+ const i = U(t, e, r);
86
86
  return o ? i : G(i);
87
87
  }, J = (t) => {
88
88
  if (!t || typeof t == "string")
@@ -104,7 +104,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
104
104
  } catch (r) {
105
105
  return !1;
106
106
  }
107
- }, p = (t) => {
107
+ }, a = (t) => {
108
108
  if (!t)
109
109
  return {};
110
110
  const e = {};
@@ -112,12 +112,12 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
112
112
  const o = t[r];
113
113
  e[r] = x(o) ? JSON.parse(o.trim()) : o;
114
114
  }), e;
115
- }, T = a({
115
+ }, T = u({
116
116
  prefix: "/v1/global-settings/change-log"
117
117
  }), M = {
118
118
  getChangelogs: (t) => T.get("", { params: t }),
119
119
  getChangelogOptions: (t) => T.get("/options", { params: t })
120
- }, d = a({
120
+ }, d = u({
121
121
  prefix: "/v1/global-settings/division"
122
122
  }), q = {
123
123
  getDivisions: (t) => d.get("", { params: t }),
@@ -128,40 +128,48 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
128
128
  const e = { id: JSON.stringify(t) };
129
129
  return d.delete("", { params: e });
130
130
  }
131
- }, c = a({
131
+ }, g = u({
132
132
  prefix: "/v2/hardware-tagging"
133
133
  }), F = {
134
134
  getAllTAG: (t, e) => {
135
- const r = p(e);
136
- return c.post("/".concat(t), r);
135
+ const r = a(e);
136
+ return g.post("/".concat(t), r);
137
137
  },
138
138
  getAllTAGOptions: (t, e) => {
139
- const r = p(e);
140
- return c.post("/".concat(t, "/options"), r);
139
+ const r = a(e);
140
+ return g.post("/".concat(t, "/options"), r);
141
141
  },
142
- getNotPairedYetCounts: () => c.get("/not-paired-yet/tag-count"),
142
+ getNotPairedYetCounts: () => g.get("/not-paired-yet/tag-count"),
143
143
  getNotPairedYetList: (t) => {
144
- const e = p(t);
145
- return c.post("/not-paired-yet/list", e);
144
+ const e = a(t);
145
+ return g.post("/not-paired-yet/list", e);
146
146
  },
147
147
  getNotPairedYetOptions: (t) => {
148
- const e = p(t);
149
- return c.post("/not-paired-yet/options", e);
148
+ const e = a(t);
149
+ return g.post("/not-paired-yet/options", e);
150
150
  },
151
- getAuditTAGDetail: (t) => c.post("/audit/detail", t),
152
- submitAuditTAG: (t) => c.post("/audit/submit", t),
153
- submitCombineTAG: (t) => c.post("/combine-tag/combine", t),
154
- submitSeparateTAG: (t) => c.post("/combine-tag/separate", t)
155
- }, n = a({
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
+ getPairedList: (t) => {
156
+ const e = a(t);
157
+ return g.post("/paired/list", e);
158
+ },
159
+ getPairedOptions: (t) => {
160
+ const e = a(t);
161
+ return g.post("/paired/options", e);
162
+ }
163
+ }, n = u({
156
164
  prefix: "/v2/hardware-tagging"
157
165
  }), H = {
158
166
  getHandheldReader: (t) => {
159
- const e = p(t);
167
+ const e = a(t);
160
168
  return n.post("/handheld-reader/list", e);
161
169
  },
162
170
  getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
163
171
  getHandheldReaderOptions: (t) => {
164
- const e = p(t);
172
+ const e = a(t);
165
173
  return n.post("/handheld-reader/options", e);
166
174
  },
167
175
  putMarkHandheldStatus: (t) => n.patch("/handheld-reader/status", t),
@@ -194,17 +202,17 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
194
202
  getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
195
203
  getExistingAliasNames: () => n.get("/reader/alias-names"),
196
204
  getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
197
- }, C = a({
205
+ }, C = u({
198
206
  env: "APP_LOGS_NOTIFICATION_API",
199
207
  prefix: "/v2"
200
208
  }), V = {
201
209
  getSessionLogList: (t) => C.get("/session-log", { params: t })
202
- }, $ = a({
210
+ }, $ = u({
203
211
  prefix: "/v1/global-settings/option"
204
212
  }), Y = {
205
213
  getPositions: () => $.get("/position"),
206
214
  getDivisions: () => $.get("/division")
207
- }, v = a({
215
+ }, v = u({
208
216
  prefix: "/v1/global-settings/position"
209
217
  }), z = {
210
218
  getPositions: (t) => v.get("", { params: t }),
@@ -215,54 +223,54 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
215
223
  const e = { id: JSON.stringify(t) };
216
224
  return v.delete("", { params: e });
217
225
  }
218
- }, N = a({
226
+ }, N = u({
219
227
  env: "APP_TAGSAMURAI_API",
220
228
  prefix: "/tag/v2"
221
229
  }), X = {
222
230
  getTagInfo: (t) => N.get("/rfid-qr/scan", { params: t })
223
- }, f = a({
231
+ }, f = u({
224
232
  prefix: "/v2/hardware-tagging"
225
233
  }), W = {
226
234
  getTAGEventlog: (t) => {
227
- const e = p(t);
235
+ const e = a(t);
228
236
  return f.post("/tag-event-log/list", e);
229
237
  },
230
238
  getTAGEventlogOptions: (t) => {
231
- const e = p(t);
239
+ const e = a(t);
232
240
  return f.post("/tag-event-log/options", e);
233
241
  },
234
242
  getDetailTAGEventlog: (t) => f.get("/tag-event-log/".concat(t))
235
- }, u = a({
243
+ }, p = u({
236
244
  prefix: "/v1/global-settings/user"
237
245
  }), K = {
238
- getUsers: (t) => u.get("", { params: t }),
239
- getUserDetail: (t) => u.get("/".concat(t)),
240
- getUserSystemLogs: (t, e) => u.get("/".concat(t, "/system-logs"), { params: e }),
246
+ getUsers: (t) => p.get("", { params: t }),
247
+ getUserDetail: (t) => p.get("/".concat(t)),
248
+ getUserSystemLogs: (t, e) => p.get("/".concat(t, "/system-logs"), { params: e }),
241
249
  getUserSystemLogOptions: (t, e) => {
242
250
  const r = {};
243
- return r[e] = !0, u.get("/".concat(t, "/system-logs/options"), { params: r });
251
+ return r[e] = !0, p.get("/".concat(t, "/system-logs/options"), { params: r });
244
252
  },
245
253
  postCreateUser: (t) => {
246
254
  const e = { "Content-Type": "multipart/form-data" };
247
- return u.post("", t, { headers: e });
255
+ return p.post("", t, { headers: e });
248
256
  },
249
257
  putEditUser: (t, e) => {
250
258
  const r = { "Content-Type": "multipart/form-data" };
251
- return u.put("/".concat(t), e, { headers: r });
259
+ return p.put("/".concat(t), e, { headers: r });
252
260
  },
253
261
  deleteUsers: (t) => {
254
262
  const e = { id: JSON.stringify(t) };
255
- return u.delete("", { params: e });
263
+ return p.delete("", { params: e });
256
264
  },
257
- putToggleStatusUsers: (t) => u.put("/active-status", t),
265
+ putToggleStatusUsers: (t) => p.put("/active-status", t),
258
266
  getUserOptions: (t) => {
259
267
  const e = {};
260
- return e[t] = !0, u.get("/options", { params: e });
268
+ return e[t] = !0, p.get("/options", { params: e });
261
269
  },
262
- deleteCancelEmailChange: (t) => u.delete("/cancel-email-change/".concat(t)),
263
- postResendEmail: (t) => u.post("/resend-email", t),
264
- putChangePassword: (t, e) => u.put("/change-password/".concat(t), e)
265
- }, h = a({
270
+ deleteCancelEmailChange: (t) => p.delete("/cancel-email-change/".concat(t)),
271
+ postResendEmail: (t) => p.post("/resend-email", t),
272
+ putChangePassword: (t, e) => p.put("/change-password/".concat(t), e)
273
+ }, h = u({
266
274
  prefix: "/v2/hardware-tagging"
267
275
  }), Q = {
268
276
  getTabletList: (t) => h.post("/tablet/list", t),
@@ -270,7 +278,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
270
278
  updateTabletStatus: (t, e) => h.patch("/tablet/status", e, { params: { ids: t } }),
271
279
  disconnectTablet: (t) => h.patch("/tablet/disconnect-reader", { params: { ids: t } }),
272
280
  deleteTablet: (t) => h.delete("/tablet", { params: { ids: t } })
273
- }, s = a({
281
+ }, s = u({
274
282
  prefix: "/v2/iam"
275
283
  }), Z = {
276
284
  login: (t) => s.post("/auth/login", t),
@@ -282,7 +290,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
282
290
  confirmEmailChange: (t) => s.post("/auth/confirm-email-change", { token: t }),
283
291
  cancelEmailChange: (t) => s.delete("/auth/cancel-email-change/".concat(t)),
284
292
  getPositionList: (t) => {
285
- const e = p(t);
293
+ const e = a(t);
286
294
  return s.post("/position/list", e);
287
295
  },
288
296
  getPositionDetail: (t) => s.get("/position/".concat(t)),
@@ -293,7 +301,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
293
301
  return s.delete("/position", { params: e });
294
302
  },
295
303
  getDivisionList: (t) => {
296
- const e = p(t);
304
+ const e = a(t);
297
305
  return s.post("/division/list", e);
298
306
  },
299
307
  getDivisionDetail: (t) => s.get("/division/".concat(t)),
@@ -312,11 +320,11 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
312
320
  });
313
321
  },
314
322
  getGlobalUserList: (t) => {
315
- const e = p(t);
323
+ const e = a(t);
316
324
  return s.post("/users/list", e);
317
325
  },
318
326
  getGlobalUserOptions: (t) => {
319
- const e = p(t);
327
+ const e = a(t);
320
328
  return s.post("/users/options", e);
321
329
  },
322
330
  getGlobalUserDetail: (t) => s.get("/users/".concat(t)),
@@ -369,7 +377,7 @@ export {
369
377
  W as TagEventlogServices,
370
378
  X as TagServices,
371
379
  K as UserServices,
372
- I as getBaseURL,
380
+ O as getBaseURL,
373
381
  B as getImageURL,
374
382
  J as queryParamsStringfy
375
383
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.11",
3
+ "version": "2.0.1-alpha.13",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -18,5 +18,9 @@ declare const GlobalTagServices: {
18
18
  submitAuditTAG: (body: SubmitAuditTAGBody) => Promise<AxiosResponse>;
19
19
  submitCombineTAG: (body: SubmitCombineTAGBody) => Promise<AxiosResponse>;
20
20
  submitSeparateTAG: (body: SubmitSeparateTAGBody) => Promise<AxiosResponse>;
21
+ getPairedList: (params?: GetAllTAGParams) => Promise<AxiosResponse<FetchDetailResponse<TAGResponseType>>>;
22
+ getPairedOptions: (params?: GetAllTAGParams) => Promise<AxiosResponse<{
23
+ data: TAGFetchOptionResponse;
24
+ }>>;
21
25
  };
22
26
  export default GlobalTagServices;
@@ -1,8 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { DropdownOption } from '../types/options.type';
3
2
  import { FetchDetailResponse, FetchListResponse } from '../types/fetchResponse.type';
4
3
  import { CreateEditDivisionPayload, CreateEditPositionPayload, GetDivisionListParams, GetPositionListParams, LoginPayload, SetPasswordPayload, CreateUserPayload, GetGlobalUserListParams, GetGlobalUserOptionsParams, SetActiveGlobalUserPayload, EditUserPayload, EditUserFcmTokenPayload, ResendActivationEmailPayload, ChangePasswordPayload, ModuleAuthPayload, GetConcurrentUsersParams, LogoutSessionPayload } from '../dto/iam.dto';
5
- import { PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse } from '../types/iam.type';
4
+ import { PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse, Position, Division } from '../types/iam.type';
6
5
  declare const IamServices: {
7
6
  login: (payload: LoginPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginResponse>>>;
8
7
  logout: () => Promise<AxiosResponse>;
@@ -36,8 +35,8 @@ declare const IamServices: {
36
35
  loginModule: (payload: ModuleAuthPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginModuleResponse>>>;
37
36
  getConcurrentUsers: (params: GetConcurrentUsersParams, moduleId?: string) => Promise<AxiosResponse<FetchDetailResponse<ConcurrentUserList>>>;
38
37
  logoutSession: (payload: LogoutSessionPayload, moduleId?: string) => Promise<AxiosResponse>;
39
- getPositionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
40
- getDivisionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
38
+ getPositionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<Position[]>>>;
39
+ getDivisionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<Division[]>>>;
41
40
  exportPositionTable: () => Promise<AxiosResponse<Blob>>;
42
41
  exportDivisionTable: () => Promise<AxiosResponse<Blob>>;
43
42
  exportUserTable: () => Promise<AxiosResponse<Blob>>;
@@ -141,4 +141,12 @@ export interface ConcurrentUserList {
141
141
  activeSessions: ConcurrentUser[];
142
142
  count: number;
143
143
  }
144
+ interface DropdownOption {
145
+ _id: string;
146
+ name: string;
147
+ }
148
+ export interface Position extends DropdownOption {
149
+ }
150
+ export interface Division extends DropdownOption {
151
+ }
144
152
  export {};