@tagsamurai/gsts-api-services 2.0.1-alpha.44 → 2.0.1-alpha.45

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.
@@ -18,38 +18,38 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
18
18
  const S = JSON.parse((T = localStorage.getItem("user")) != null ? T : "{}"), L = (D = ($ = S.jwt) != null ? $ : S.token) != null ? D : "";
19
19
  return y.headers.Authorization = "Bearer ".concat(L), y;
20
20
  }), P;
21
- }, l = u({
21
+ }, d = u({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), _ = (t) => {
23
+ }), C = (t) => {
24
24
  var e, r, i, p;
25
25
  return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((p = (i = t.response) == null ? void 0 : i.data) == null ? void 0 : p.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 l.post("/login", e);
29
+ return d.post("/login", e);
30
30
  },
31
- reLogin: (t) => (l.interceptors.response.use((e) => e, _), l.post("/login", t)),
31
+ reLogin: (t) => (d.interceptors.response.use((e) => e, C), d.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
- return l.post("/request-otp", e);
34
+ return d.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 d.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) => d.post("/set-password", t),
41
+ verifyToken: (t) => d.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 d.put("/confirm-email-change/confirm", e);
45
45
  },
46
- postLogout: () => l.post("/logout"),
46
+ postLogout: () => d.post("/logout"),
47
47
  /**
48
48
  *
49
49
  * @deprecated use postLogout instead
50
50
  */
51
- logout: () => l.post("/logout")
52
- }, C = (t, e, r) => {
51
+ logout: () => d.post("/logout")
52
+ }, _ = (t, e, r) => {
53
53
  const i = new URL(O("APP_TAGSAMURAI_API") || "").origin;
54
54
  let p = t.startsWith("http") ? t : "".concat(i, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
@@ -82,7 +82,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
82
82
  }
83
83
  }, j = async (t, e, r, i) => {
84
84
  if (!t) return;
85
- const p = C(t, e, r);
85
+ const p = _(t, e, r);
86
86
  return i ? p : G(p);
87
87
  }, B = (t) => {
88
88
  if (!t || typeof t == "string")
@@ -262,36 +262,36 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
262
262
  return A.post("/tag-event-log/options", e);
263
263
  },
264
264
  getDetailTAGEventlog: (t) => A.get("/tag-event-log/".concat(t))
265
- }, d = u({
265
+ }, l = u({
266
266
  prefix: "/v1/global-settings/user"
267
267
  }), tt = {
268
- getUsers: (t) => d.get("", { params: t }),
269
- getUserDetail: (t) => d.get("/".concat(t)),
270
- getUserSystemLogs: (t, e) => d.get("/".concat(t, "/system-logs"), { params: e }),
268
+ getUsers: (t) => l.get("", { params: t }),
269
+ getUserDetail: (t) => l.get("/".concat(t)),
270
+ getUserSystemLogs: (t, e) => l.get("/".concat(t, "/system-logs"), { params: e }),
271
271
  getUserSystemLogOptions: (t, e) => {
272
272
  const r = {};
273
- return r[e] = !0, d.get("/".concat(t, "/system-logs/options"), { params: r });
273
+ return r[e] = !0, l.get("/".concat(t, "/system-logs/options"), { params: r });
274
274
  },
275
275
  postCreateUser: (t) => {
276
276
  const e = { "Content-Type": "multipart/form-data" };
277
- return d.post("", t, { headers: e });
277
+ return l.post("", t, { headers: e });
278
278
  },
279
279
  putEditUser: (t, e) => {
280
280
  const r = { "Content-Type": "multipart/form-data" };
281
- return d.put("/".concat(t), e, { headers: r });
281
+ return l.put("/".concat(t), e, { headers: r });
282
282
  },
283
283
  deleteUsers: (t) => {
284
284
  const e = { id: JSON.stringify(t) };
285
- return d.delete("", { params: e });
285
+ return l.delete("", { params: e });
286
286
  },
287
- putToggleStatusUsers: (t) => d.put("/active-status", t),
287
+ putToggleStatusUsers: (t) => l.put("/active-status", t),
288
288
  getUserOptions: (t) => {
289
289
  const e = {};
290
- return e[t] = !0, d.get("/options", { params: e });
290
+ return e[t] = !0, l.get("/options", { params: e });
291
291
  },
292
- deleteCancelEmailChange: (t) => d.delete("/cancel-email-change/".concat(t)),
293
- postResendEmail: (t) => d.post("/resend-email", t),
294
- putChangePassword: (t, e) => d.put("/change-password/".concat(t), e)
292
+ deleteCancelEmailChange: (t) => l.delete("/cancel-email-change/".concat(t)),
293
+ postResendEmail: (t) => l.post("/resend-email", t),
294
+ putChangePassword: (t, e) => l.put("/change-password/".concat(t), e)
295
295
  }, h = u({
296
296
  prefix: "/v2/hardware-tagging"
297
297
  }), et = {
@@ -386,18 +386,23 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
386
386
  exportUserTable: () => s.post("/users/list/export", {}, { responseType: "blob" }),
387
387
  getCustomFieldList: (t) => {
388
388
  const e = n(t);
389
- return s.post("/custom-field/list", e);
389
+ return s.post("/custom-fields/list", e);
390
390
  },
391
- getCustomFieldOptions: (t) => s.post("/custom-field/options", t),
392
- createCustomField: (t) => s.post("/custom-field", t),
393
- editCustomField: (t, e) => s.patch("/custom-field/".concat(t), e),
391
+ getCustomFieldOptions: (t) => s.post("/custom-fields/options", t),
392
+ createCustomField: (t) => s.post("/custom-fields", t),
393
+ editCustomField: (t, e) => s.patch("/custom-fields/".concat(t), e),
394
394
  setActiveCustomField: (t, e) => {
395
395
  const r = { ids: JSON.stringify(t) };
396
- return s.patch("/custom-field/set-active", e, { params: r });
396
+ return s.patch("/custom-fields/set-active", e, { params: r });
397
397
  },
398
398
  deleteCustomField: (t) => {
399
399
  const e = { ids: JSON.stringify(t) };
400
- return s.delete("/custom-field", { params: e });
400
+ return s.delete("/custom-fields", { params: e });
401
+ },
402
+ getActiveCustomField: () => s.get("/custom-fields/active"),
403
+ getAvailableCustomField: (t) => {
404
+ const e = { name: t };
405
+ return s.get("/custom-fields", { params: e });
401
406
  }
402
407
  }, a = u({
403
408
  prefix: "/v2/import"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.44",
3
+ "version": "2.0.1-alpha.45",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -74,6 +74,7 @@ export interface GetCustomFieldListParams extends TableParams {
74
74
  isActive?: boolean[];
75
75
  dataType?: DataType[];
76
76
  isRequired?: boolean[];
77
+ updatedAt?: number[];
77
78
  }
78
79
  export type GetCustomFieldOptionsParams = Partial<{
79
80
  dataTypeOptions: boolean;
@@ -82,7 +83,8 @@ export interface CreateEditCustomFieldPayload {
82
83
  isRequired: boolean;
83
84
  name: string;
84
85
  dataType: DataType;
85
- optionValue: string[];
86
+ optionValue?: string[];
87
+ decimalPlaces?: number;
86
88
  }
87
89
  export interface SetActiveCustomFieldPayload {
88
90
  isActive: boolean;
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { FetchDetailResponse, FetchListResponse } from '../types/fetchResponse.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';
3
+ import { Division, CustomField, CustomFieldOptions, PositionList, LoginResponse, RequestOtpResponse, RequestResetLinkResponse, DivisionList, DivisionListDetail, GlobalUserList, GlobalUserOptions, GlobalUserDetail, LoginModuleResponse, ConcurrentUserList, VerifyTokenResponse, PositionDetail, ChangePasswordResponse, Position, ActiveCustomField } from '../types/iam.type';
4
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>>>;
@@ -46,5 +46,7 @@ declare const IamServices: {
46
46
  editCustomField: (id: string, payload: CreateEditCustomFieldPayload) => Promise<AxiosResponse>;
47
47
  setActiveCustomField: (ids: string[], payload: SetActiveCustomFieldPayload) => Promise<AxiosResponse>;
48
48
  deleteCustomField: (ids: string[]) => Promise<AxiosResponse>;
49
+ getActiveCustomField: () => Promise<AxiosResponse<FetchListResponse<ActiveCustomField>>>;
50
+ getAvailableCustomField: (name: string) => Promise<AxiosResponse>;
49
51
  };
50
52
  export default IamServices;
@@ -170,6 +170,15 @@ export interface CustomField {
170
170
  isRequired: 'Yes' | 'No' | BaseString;
171
171
  createdAt: string;
172
172
  updatedAt: string;
173
+ decimalPlaces?: number;
174
+ }
175
+ export interface ActiveCustomField {
176
+ _id: string;
177
+ name: string;
178
+ dataType: DataType;
179
+ optionValue: string[];
180
+ isRequired: 'Yes' | 'No' | BaseString;
181
+ decimalPlaces?: number;
173
182
  }
174
183
  export interface CustomFieldList {
175
184
  totalRecords: number;