@tagsamurai/gsts-api-services 2.0.1-alpha.28 → 2.0.1-alpha.29

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.
@@ -3,14 +3,14 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: n = "",
6
- headers: a = {},
6
+ headers: u = {},
7
7
  ...l
8
8
  } = t, w = "".concat(I(r)).concat(n), h = R.create({
9
9
  ...l,
10
10
  baseURL: w,
11
- headers: e ? a : {
11
+ headers: e ? u : {
12
12
  "Content-Type": "application/json",
13
- ...a
13
+ ...u
14
14
  }
15
15
  });
16
16
  return h.interceptors.request.use((A) => {
@@ -20,15 +20,15 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
20
20
  }), h;
21
21
  }, c = p({
22
22
  prefix: "/v1/global-settings/auth"
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);
23
+ }), L = (t) => {
24
+ var e, r, n, u;
25
+ return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((u = (n = t.response) == null ? void 0 : n.data) == null ? void 0 : u.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
29
  return c.post("/login", e);
30
30
  },
31
- reLogin: (t) => (c.interceptors.response.use((e) => e, E), c.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
34
  return c.post("/request-otp", e);
@@ -49,19 +49,19 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
49
49
  * @deprecated use postLogout instead
50
50
  */
51
51
  logout: () => c.post("/logout")
52
- }, L = (t, e, r) => {
52
+ }, E = (t, e, r) => {
53
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(/^\/+/, ""));
54
+ let u = 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
- e && (l.set("width", e.toString()), l.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(l.toString());
57
+ e && (l.set("width", e.toString()), l.set("height", (r == null ? void 0 : r.toString()) || e.toString())), u += "?".concat(l.toString());
58
58
  }
59
- return a;
59
+ return u;
60
60
  }, _ = () => {
61
61
  var e, r, n;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
63
  return (n = (r = t.jwt) != null ? r : t.token) != null ? n : "";
64
- }, x = async (t, e) => {
64
+ }, C = async (t, e) => {
65
65
  const r = await fetch(t, {
66
66
  headers: {
67
67
  Authorization: "Bearer ".concat(e)
@@ -73,18 +73,18 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
73
73
  return new Blob([n], {
74
74
  type: r.headers.get("Content-Type") || "image/webp"
75
75
  });
76
- }, C = async (t) => {
76
+ }, N = async (t) => {
77
77
  try {
78
- const e = _(), r = await x(t, e);
78
+ const e = _(), r = await C(t, e);
79
79
  return URL.createObjectURL(r);
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, H = async (t, e, r, n) => {
83
+ }, J = async (t, e, r, n) => {
84
84
  if (!t) return;
85
- const a = L(t, e, r);
86
- return n ? a : C(a);
87
- }, J = (t) => {
85
+ const u = E(t, e, r);
86
+ return n ? u : N(u);
87
+ }, H = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
90
90
  const e = {};
@@ -95,7 +95,7 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
95
95
  [r]: t[r]
96
96
  });
97
97
  }), e;
98
- }, G = (t) => {
98
+ }, x = (t) => {
99
99
  if (typeof t != "string") return !1;
100
100
  const e = t.trim();
101
101
  if (!e) return !1;
@@ -104,19 +104,19 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
104
104
  } catch (r) {
105
105
  return !1;
106
106
  }
107
- }, u = (t) => {
107
+ }, a = (t) => {
108
108
  if (!t)
109
109
  return {};
110
110
  const e = {};
111
111
  return Object.keys(t).forEach((r) => {
112
112
  const n = t[r];
113
- e[r] = G(n) ? JSON.parse(n.trim()) : n;
113
+ e[r] = x(n) ? JSON.parse(n.trim()) : n;
114
114
  }), e;
115
115
  }, T = p({
116
116
  prefix: "v2/analytics-reporting"
117
117
  }), j = {
118
118
  getChangelogs: (t) => {
119
- const e = u(t);
119
+ const e = a(t);
120
120
  return T.post("/change-log/list", e);
121
121
  },
122
122
  getChangelogOptions: (t) => T.post("/change-log/options", t)
@@ -131,44 +131,44 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
131
131
  const e = { id: JSON.stringify(t) };
132
132
  return m.delete("", { params: e });
133
133
  }
134
- }, g = p({
134
+ }, d = p({
135
135
  prefix: "/v2/hardware-tagging"
136
136
  }), q = {
137
137
  getAllTAG: (t) => {
138
- const e = u(t);
139
- return g.post("/all-tag/list", e);
138
+ const e = a(t);
139
+ return d.post("/all-tag/list", e);
140
140
  },
141
141
  getAllTAGOptions: (t) => {
142
- const e = u(t);
143
- return g.post("all-tag/options", e);
142
+ const e = a(t);
143
+ return d.post("all-tag/options", e);
144
144
  },
145
- getNotPairedYetCounts: () => g.get("/not-paired-yet/tag-count"),
145
+ getNotPairedYetCounts: () => d.get("/not-paired-yet/tag-count"),
146
146
  getNotPairedYetList: (t) => {
147
- const e = u(t);
148
- return g.post("/not-paired-yet/list", e);
147
+ const e = a(t);
148
+ return d.post("/not-paired-yet/list", e);
149
149
  },
150
150
  getNotPairedYetOptions: (t) => {
151
- const e = u(t);
152
- return g.post("/not-paired-yet/options", e);
151
+ const e = a(t);
152
+ return d.post("/not-paired-yet/options", e);
153
153
  },
154
- getAuditTAGDetail: (t) => g.post("/audit/detail", t),
155
- submitAuditTAG: (t) => g.post("/audit/submit", t),
156
- submitCombineTAG: (t) => g.post("/combine-tag/combine", t),
157
- submitSeparateTAG: (t) => g.post("/combine-tag/separate", t),
154
+ getAuditTAGDetail: (t) => d.post("/audit/detail", t),
155
+ submitAuditTAG: (t) => d.post("/audit/submit", t),
156
+ submitCombineTAG: (t) => d.post("/combine-tag/combine", t),
157
+ submitSeparateTAG: (t) => d.post("/combine-tag/separate", t),
158
158
  getPairedList: (t) => {
159
- const e = u(t);
160
- return g.post("/paired/list", e);
159
+ const e = a(t);
160
+ return d.post("/paired/list", e);
161
161
  },
162
162
  getPairedOptions: (t) => {
163
- const e = u(t);
164
- return g.post("/paired/options", e);
163
+ const e = a(t);
164
+ return d.post("/paired/options", e);
165
165
  },
166
- getScanTag: (t) => g.get("/scan-tag", { params: { tag: t } })
166
+ getScanTag: (t) => d.get("/scan-tag", { params: { tag: t } })
167
167
  }, o = p({
168
168
  prefix: "/v2/hardware-tagging"
169
169
  }), V = {
170
170
  getHandheldReader: (t) => {
171
- const e = u(t);
171
+ const e = a(t);
172
172
  return o.post("/handheld-reader/list", e);
173
173
  },
174
174
  getHandheldReaderDetail: (t) => o.get("/handheld-reader/".concat(t)),
@@ -186,7 +186,7 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
186
186
  }),
187
187
  putAntennaPower: (t, e) => o.put("/iot-reader/".concat(e, "/set-antenna-power"), t),
188
188
  getIotReader: (t) => {
189
- const e = u({ ...t });
189
+ const e = a({ ...t });
190
190
  return o.post("/iot-reader", e);
191
191
  },
192
192
  getIotReaderDetail: (t) => o.get("/iot-reader/".concat(t)),
@@ -204,11 +204,11 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
204
204
  getDetailActivityLog: (t) => o.get("/activity-log", { params: t }),
205
205
  getDetailActivityLogOptions: (t) => o.get("/activity-log/options", { params: t }),
206
206
  getExistingAliasNames: () => o.get("/reader/alias-names")
207
- }, N = p({
207
+ }, F = p({
208
208
  env: "APP_LOGS_NOTIFICATION_API",
209
209
  prefix: "/v2"
210
210
  }), Y = {
211
- getSessionLogList: (t) => N.get("/session-log", { params: t })
211
+ getSessionLogList: (t) => F.get("/session-log", { params: t })
212
212
  }, D = p({
213
213
  prefix: "/v1/global-settings/option"
214
214
  }), z = {
@@ -225,53 +225,53 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
225
225
  const e = { id: JSON.stringify(t) };
226
226
  return f.delete("", { params: e });
227
227
  }
228
- }, F = p({
228
+ }, G = p({
229
229
  env: "APP_TAGSAMURAI_API",
230
230
  prefix: "/tag/v2"
231
231
  }), W = {
232
- getTagInfo: (t) => F.get("/rfid-qr/scan", { params: t })
232
+ getTagInfo: (t) => G.get("/rfid-qr/scan", { params: t })
233
233
  }, b = p({
234
234
  prefix: "/v2/hardware-tagging"
235
235
  }), K = {
236
236
  getTAGEventlog: (t) => {
237
- const e = u(t);
237
+ const e = a(t);
238
238
  return b.post("/tag-event-log/list", e);
239
239
  },
240
240
  getTAGEventlogOptions: (t) => {
241
- const e = u(t);
241
+ const e = a(t);
242
242
  return b.post("/tag-event-log/options", e);
243
243
  },
244
244
  getDetailTAGEventlog: (t) => b.get("/tag-event-log/".concat(t))
245
- }, d = p({
245
+ }, g = p({
246
246
  prefix: "/v1/global-settings/user"
247
247
  }), Q = {
248
- getUsers: (t) => d.get("", { params: t }),
249
- getUserDetail: (t) => d.get("/".concat(t)),
250
- getUserSystemLogs: (t, e) => d.get("/".concat(t, "/system-logs"), { params: e }),
248
+ getUsers: (t) => g.get("", { params: t }),
249
+ getUserDetail: (t) => g.get("/".concat(t)),
250
+ getUserSystemLogs: (t, e) => g.get("/".concat(t, "/system-logs"), { params: e }),
251
251
  getUserSystemLogOptions: (t, e) => {
252
252
  const r = {};
253
- return r[e] = !0, d.get("/".concat(t, "/system-logs/options"), { params: r });
253
+ return r[e] = !0, g.get("/".concat(t, "/system-logs/options"), { params: r });
254
254
  },
255
255
  postCreateUser: (t) => {
256
256
  const e = { "Content-Type": "multipart/form-data" };
257
- return d.post("", t, { headers: e });
257
+ return g.post("", t, { headers: e });
258
258
  },
259
259
  putEditUser: (t, e) => {
260
260
  const r = { "Content-Type": "multipart/form-data" };
261
- return d.put("/".concat(t), e, { headers: r });
261
+ return g.put("/".concat(t), e, { headers: r });
262
262
  },
263
263
  deleteUsers: (t) => {
264
264
  const e = { id: JSON.stringify(t) };
265
- return d.delete("", { params: e });
265
+ return g.delete("", { params: e });
266
266
  },
267
- putToggleStatusUsers: (t) => d.put("/active-status", t),
267
+ putToggleStatusUsers: (t) => g.put("/active-status", t),
268
268
  getUserOptions: (t) => {
269
269
  const e = {};
270
- return e[t] = !0, d.get("/options", { params: e });
270
+ return e[t] = !0, g.get("/options", { params: e });
271
271
  },
272
- deleteCancelEmailChange: (t) => d.delete("/cancel-email-change/".concat(t)),
273
- postResendEmail: (t) => d.post("/resend-email", t),
274
- putChangePassword: (t, e) => d.put("/change-password/".concat(t), e)
272
+ deleteCancelEmailChange: (t) => g.delete("/cancel-email-change/".concat(t)),
273
+ postResendEmail: (t) => g.post("/resend-email", t),
274
+ putChangePassword: (t, e) => g.put("/change-password/".concat(t), e)
275
275
  }, v = p({
276
276
  prefix: "/v2/hardware-tagging"
277
277
  }), Z = {
@@ -292,7 +292,7 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
292
292
  confirmEmailChange: (t) => s.post("/auth/confirm-email-change", { token: t }),
293
293
  cancelEmailChange: (t) => s.delete("/auth/cancel-email-change/".concat(t)),
294
294
  getPositionList: (t) => {
295
- const e = u(t);
295
+ const e = a(t);
296
296
  return s.post("/position/list", e);
297
297
  },
298
298
  getPositionDetail: (t) => s.get("/position/".concat(t)),
@@ -303,7 +303,7 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
303
303
  return s.delete("/position", { params: e });
304
304
  },
305
305
  getDivisionList: (t) => {
306
- const e = u(t);
306
+ const e = a(t);
307
307
  return s.post("/division/list", e);
308
308
  },
309
309
  getDivisionDetail: (t) => s.get("/division/".concat(t)),
@@ -322,11 +322,11 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
322
322
  });
323
323
  },
324
324
  getGlobalUserList: (t) => {
325
- const e = u(t);
325
+ const e = a(t);
326
326
  return s.post("/users/list", e);
327
327
  },
328
328
  getGlobalUserOptions: (t) => {
329
- const e = u(t);
329
+ const e = a(t);
330
330
  return s.post("/users/options", e);
331
331
  },
332
332
  getGlobalUserDetail: (t) => s.get("/users/".concat(t)),
@@ -336,8 +336,8 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
336
336
  },
337
337
  editUsers: (t, e) => {
338
338
  const r = new FormData();
339
- return Object.entries(e).forEach(([n, a]) => {
340
- a != null && r.append(n, a);
339
+ return Object.entries(e).forEach(([n, u]) => {
340
+ u != null && r.append(n, u);
341
341
  }), s.patch("/users/".concat(t), r, {
342
342
  headers: { "Content-Type": "multipart/form-data" }
343
343
  });
@@ -363,7 +363,22 @@ const U = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
363
363
  getDivisionDropdown: () => s.get("/division/dropdown"),
364
364
  exportPositionTable: () => s.post("/position/list/export", {}, { responseType: "blob" }),
365
365
  exportDivisionTable: () => s.post("/division/list/export", {}, { responseType: "blob" }),
366
- exportUserTable: () => s.post("/users/list/export", {}, { responseType: "blob" })
366
+ exportUserTable: () => s.post("/users/list/export", {}, { responseType: "blob" }),
367
+ getCustomFieldList: (t) => {
368
+ const e = a(t);
369
+ return s.post("/custom-field/list", e);
370
+ },
371
+ getCustomFieldOptions: (t) => s.post("/custom-field/options", t),
372
+ createCustomField: (t) => s.post("/custom-field", t),
373
+ editCustomField: (t, e) => s.patch("/custom-field/".concat(t), e),
374
+ setActiveCustomField: (t, e) => {
375
+ const r = { ids: JSON.stringify(t) };
376
+ return s.patch("/custom-field/set-active", e, { params: r });
377
+ },
378
+ deleteCustomField: (t) => {
379
+ const e = { ids: JSON.stringify(t) };
380
+ return s.delete("/custom-field", { params: e });
381
+ }
367
382
  }, i = p({
368
383
  prefix: "/v2/import"
369
384
  }), et = {
@@ -429,6 +444,6 @@ export {
429
444
  W as TagServices,
430
445
  Q as UserServices,
431
446
  I as getBaseURL,
432
- H as getImageURL,
433
- J as queryParamsStringfy
447
+ J as getImageURL,
448
+ H as queryParamsStringfy
434
449
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.28",
3
+ "version": "2.0.1-alpha.29",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -70,3 +70,20 @@ export interface GetConcurrentUsersParams extends TableParams {
70
70
  export interface LogoutSessionPayload {
71
71
  sessionId: string;
72
72
  }
73
+ export interface GetCustomFieldListParams extends TableParams {
74
+ isActive?: boolean[];
75
+ dataType?: string[];
76
+ isRequired?: boolean[];
77
+ }
78
+ export type GetCustomFieldOptionsParams = Partial<{
79
+ dataTypeOptions: boolean;
80
+ }>;
81
+ export interface CreateEditCustomFieldPayload {
82
+ isRequired: boolean;
83
+ name: string;
84
+ dataType: string;
85
+ optionValue: string[];
86
+ }
87
+ export interface SetActiveCustomFieldPayload {
88
+ isActive: boolean;
89
+ }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { FetchDetailResponse, FetchListResponse } from '../types/fetchResponse.type';
3
- import { CreateEditDivisionPayload, CreateEditPositionPayload, GetDivisionListParams, GetPositionListParams, LoginPayload, SetPasswordPayload, CreateUserPayload, GetGlobalUserListParams, GetGlobalUserOptionsParams, SetActiveGlobalUserPayload, EditUserPayload, EditUserFcmTokenPayload, ResendActivationEmailPayload, ChangePasswordPayload, ModuleAuthPayload, GetConcurrentUsersParams, LogoutSessionPayload } from '../dto/iam.dto';
4
- import { PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse, Position, Division } from '../types/iam.type';
3
+ import { Division, CustomField, CustomFieldOptions, PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse, Position } from '../types/iam.type';
4
+ import { CreateEditDivisionPayload, CreateEditPositionPayload, GetDivisionListParams, GetPositionListParams, LoginPayload, SetPasswordPayload, CreateUserPayload, GetGlobalUserListParams, GetGlobalUserOptionsParams, SetActiveGlobalUserPayload, EditUserPayload, EditUserFcmTokenPayload, ResendActivationEmailPayload, ChangePasswordPayload, ModuleAuthPayload, GetConcurrentUsersParams, LogoutSessionPayload, GetCustomFieldListParams, GetCustomFieldOptionsParams, CreateEditCustomFieldPayload, SetActiveCustomFieldPayload } from '../dto/iam.dto';
5
5
  declare const IamServices: {
6
6
  login: (payload: LoginPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginResponse>>>;
7
7
  logout: () => Promise<AxiosResponse>;
@@ -40,5 +40,11 @@ declare const IamServices: {
40
40
  exportPositionTable: () => Promise<AxiosResponse<Blob>>;
41
41
  exportDivisionTable: () => Promise<AxiosResponse<Blob>>;
42
42
  exportUserTable: () => Promise<AxiosResponse<Blob>>;
43
+ getCustomFieldList: (params: GetCustomFieldListParams) => Promise<AxiosResponse<FetchListResponse<CustomField>>>;
44
+ getCustomFieldOptions: (params: GetCustomFieldOptionsParams) => Promise<AxiosResponse<FetchDetailResponse<CustomFieldOptions>>>;
45
+ createCustomField: (payload: CreateEditCustomFieldPayload) => Promise<AxiosResponse>;
46
+ editCustomField: (id: string, payload: CreateEditCustomFieldPayload) => Promise<AxiosResponse>;
47
+ setActiveCustomField: (ids: string[], payload: SetActiveCustomFieldPayload) => Promise<AxiosResponse>;
48
+ deleteCustomField: (ids: string[]) => Promise<AxiosResponse>;
43
49
  };
44
50
  export default IamServices;
@@ -149,4 +149,24 @@ export interface Position extends DropdownOption {
149
149
  }
150
150
  export interface Division extends DropdownOption {
151
151
  }
152
+ export interface CustomField {
153
+ _id: string;
154
+ name: string;
155
+ dataType: string;
156
+ optionValue: string[];
157
+ isActive: boolean;
158
+ isRequired: 'Yes' | 'No' | BaseMessage;
159
+ createdAt: string;
160
+ updatedAt: string;
161
+ }
162
+ export interface CustomFieldList {
163
+ totalRecords: number;
164
+ data: CustomField[];
165
+ }
166
+ export interface CustomFieldOptions {
167
+ dataTypeOptions: {
168
+ label: string;
169
+ value: string;
170
+ }[];
171
+ }
152
172
  export {};