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

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,34 +1,34 @@
1
1
  import _ from "axios";
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) => {
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" }, b = (t = "APP_TAGSAMURAI_API") => E["VITE_" + t], i = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: s = "",
6
- headers: i = {},
6
+ headers: a = {},
7
7
  ...p
8
- } = t, y = "".concat(T(r)).concat(s), A = _.create({
8
+ } = t, y = "".concat(b(r)).concat(s), f = _.create({
9
9
  ...p,
10
10
  baseURL: y,
11
- headers: e ? i : {
11
+ headers: e ? a : {
12
12
  "Content-Type": "application/json",
13
- ...i
13
+ ...a
14
14
  }
15
15
  });
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
- }), A;
21
- }, u = a({
16
+ return f.interceptors.request.use((v) => {
17
+ var h, S, $;
18
+ const P = JSON.parse((h = localStorage.getItem("user")) != null ? h : "{}"), O = ($ = (S = P.jwt) != null ? S : P.token) != null ? $ : "";
19
+ return v.headers.Authorization = "Bearer ".concat(O), v;
20
+ }), f;
21
+ }, u = i({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), E = (t) => {
24
- var e, r, s, i;
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
- }, N = {
23
+ }), w = (t) => {
24
+ var e, r, s, a;
25
+ return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((a = (s = t.response) == null ? void 0 : s.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
+ }, B = {
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, E), u.post("/login", t)),
31
+ reLogin: (t) => (u.interceptors.response.use((e) => e, w), u.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
34
  return u.post("/request-otp", e);
@@ -49,19 +49,19 @@ const b = { 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
- }, w = (t, e, r) => {
53
- const s = new URL(T("APP_TAGSAMURAI_API") || "").origin;
54
- let i = t.startsWith("http") ? t : "".concat(s, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
52
+ }, L = (t, e, r) => {
53
+ const s = new URL(b("APP_TAGSAMURAI_API") || "").origin;
54
+ let a = t.startsWith("http") ? t : "".concat(s, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
56
56
  const p = new URLSearchParams();
57
- e && (p.set("width", e.toString()), p.set("height", (r == null ? void 0 : r.toString()) || e.toString())), i += "?".concat(p.toString());
57
+ e && (p.set("width", e.toString()), p.set("height", (r == null ? void 0 : r.toString()) || e.toString())), a += "?".concat(p.toString());
58
58
  }
59
- return i;
60
- }, L = () => {
59
+ return a;
60
+ }, R = () => {
61
61
  var e, r, s;
62
62
  const t = JSON.parse((e = localStorage.getItem("user")) != null ? e : "{}");
63
63
  return (s = (r = t.jwt) != null ? r : t.token) != null ? s : "";
64
- }, R = async (t, e) => {
64
+ }, G = async (t, e) => {
65
65
  const r = await fetch(t, {
66
66
  headers: {
67
67
  Authorization: "Bearer ".concat(e)
@@ -73,18 +73,18 @@ const b = { 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
- }, G = async (t) => {
76
+ }, U = async (t) => {
77
77
  try {
78
- const e = L(), r = await R(t, e);
78
+ const e = R(), r = await G(t, e);
79
79
  return URL.createObjectURL(r);
80
80
  } catch (e) {
81
81
  return;
82
82
  }
83
- }, B = async (t, e, r, s) => {
83
+ }, k = async (t, e, r, s) => {
84
84
  if (!t) return;
85
- const i = w(t, e, r);
86
- return s ? i : G(i);
87
- }, k = (t) => {
85
+ const a = L(t, e, r);
86
+ return s ? a : U(a);
87
+ }, j = (t) => {
88
88
  if (!t || typeof t == "string")
89
89
  return;
90
90
  const e = {};
@@ -95,7 +95,7 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
95
95
  [r]: t[r]
96
96
  });
97
97
  }), e;
98
- }, U = (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,33 +104,33 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
104
104
  } catch (r) {
105
105
  return !1;
106
106
  }
107
- }, S = (t) => {
107
+ }, T = (t) => {
108
108
  if (!t)
109
109
  return {};
110
110
  const e = {};
111
111
  return Object.keys(t).forEach((r) => {
112
112
  const s = t[r];
113
- e[r] = U(s) ? JSON.parse(s.trim()) : s;
113
+ e[r] = x(s) ? JSON.parse(s.trim()) : s;
114
114
  }), e;
115
- }, I = a({
115
+ }, m = i({
116
116
  prefix: "/v1/global-settings/change-log"
117
- }), j = {
118
- getChangelogs: (t) => I.get("", { params: t }),
119
- getChangelogOptions: (t) => I.get("/options", { params: t })
120
- }, c = a({
121
- prefix: "/v1/global-settings/division"
122
117
  }), J = {
123
- getDivisions: (t) => c.get("", { params: t }),
124
- getDivisionDetail: (t) => c.get("/".concat(t)),
125
- postCreateDivision: (t) => c.post("/", t),
126
- putEditDivision: (t, e) => c.put("/".concat(t), e),
118
+ getChangelogs: (t) => m.get("", { params: t }),
119
+ getChangelogOptions: (t) => m.get("/options", { params: t })
120
+ }, l = i({
121
+ prefix: "/v1/global-settings/division"
122
+ }), M = {
123
+ getDivisions: (t) => l.get("", { params: t }),
124
+ getDivisionDetail: (t) => l.get("/".concat(t)),
125
+ postCreateDivision: (t) => l.post("/", t),
126
+ putEditDivision: (t, e) => l.put("/".concat(t), e),
127
127
  deleteDivisions: (t) => {
128
128
  const e = { id: JSON.stringify(t) };
129
- return c.delete("", { params: e });
129
+ return l.delete("", { params: e });
130
130
  }
131
- }, g = a({
131
+ }, g = i({
132
132
  prefix: "/v1/global-settings"
133
- }), M = {
133
+ }), H = {
134
134
  getTAGAllPaired: (t, e) => g.get("/".concat(t), { params: e }),
135
135
  getTAGAllPairedOptions: (t, e) => g.get("/".concat(t, "/options"), { params: e }),
136
136
  getTAGNotPaired: (t, e) => g.get("/".concat(t, "/not-paired"), { params: e }),
@@ -140,16 +140,16 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
140
140
  putAuditTAG: (t, e) => g.put("/".concat(t, "/audit"), e),
141
141
  putAllocateTAG: (t, e) => g.put("/".concat(t, "/allocate"), e),
142
142
  putCombineTAG: (t) => g.put("/combine", t)
143
- }, n = a({
143
+ }, n = i({
144
144
  prefix: "/v2/hardware-tagging"
145
- }), H = {
145
+ }), V = {
146
146
  getHandheldReader: (t) => {
147
- const e = S(t);
147
+ const e = T(t);
148
148
  return n.post("/handheld-reader/list", e);
149
149
  },
150
150
  getHandheldReaderDetail: (t) => n.get("/handheld-reader/".concat(t)),
151
151
  getHandheldReaderOptions: (t) => {
152
- const e = S(t);
152
+ const e = T(t);
153
153
  return n.post("/handheld-reader/options", e);
154
154
  },
155
155
  putMarkHandheldStatus: (t) => n.patch("/handheld-reader/status", t),
@@ -182,41 +182,41 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
182
182
  getDetailActivityLogOptions: (t) => n.get("/activity-log/options", { params: t }),
183
183
  getExistingAliasNames: () => n.get("/reader/alias-names"),
184
184
  getIotReaderPort: (t, e) => n.get("/iot-reader/".concat(t, "/ports"), { params: e })
185
- }, D = a({
185
+ }, D = i({
186
186
  env: "APP_LOGS_NOTIFICATION_API",
187
187
  prefix: "/v2"
188
- }), V = {
188
+ }), q = {
189
189
  getSessionLogList: (t) => D.get("/session-log", { params: t })
190
- }, m = a({
190
+ }, I = i({
191
191
  prefix: "/v1/global-settings/option"
192
- }), q = {
193
- getPositions: () => m.get("/position"),
194
- getDivisions: () => m.get("/division")
195
- }, l = a({
196
- prefix: "/v1/global-settings/position"
197
192
  }), F = {
198
- getPositions: (t) => l.get("", { params: t }),
199
- getPositionDetail: (t) => l.get("/".concat(t)),
200
- postCreatePosition: (t) => l.post("/", t),
201
- putEditPosition: (t, e) => l.put("/".concat(t), e),
193
+ getPositions: () => I.get("/position"),
194
+ getDivisions: () => I.get("/division")
195
+ }, c = i({
196
+ prefix: "/v1/global-settings/position"
197
+ }), z = {
198
+ getPositions: (t) => c.get("", { params: t }),
199
+ getPositionDetail: (t) => c.get("/".concat(t)),
200
+ postCreatePosition: (t) => c.post("/", t),
201
+ putEditPosition: (t, e) => c.put("/".concat(t), e),
202
202
  deletePositions: (t) => {
203
203
  const e = { id: JSON.stringify(t) };
204
- return l.delete("", { params: e });
204
+ return c.delete("", { params: e });
205
205
  }
206
- }, x = a({
206
+ }, C = i({
207
207
  env: "APP_TAGSAMURAI_API",
208
208
  prefix: "/tag/v2"
209
- }), z = {
210
- getTagInfo: (t) => x.get("/rfid-qr/scan", { params: t })
211
- }, d = a({
212
- prefix: "/v1/global-settings/change-log"
213
209
  }), W = {
214
- getTAGEventlog: (t) => d.get("/tag-event-log", { params: t }),
215
- getTAGEventlogOptions: (t) => d.get("/tag-event-log/options", { params: t }),
216
- getDetailTAGEventlog: (t) => d.get("/tag-event-log/".concat(t))
217
- }, o = a({
218
- prefix: "/v1/global-settings/user"
210
+ getTagInfo: (t) => C.get("/rfid-qr/scan", { params: t })
211
+ }, A = i({
212
+ prefix: "/v1/global-settings/change-log"
219
213
  }), K = {
214
+ getTAGEventlog: (t) => A.get("/tag-event-log", { params: t }),
215
+ getTAGEventlogOptions: (t) => A.get("/tag-event-log/options", { params: t }),
216
+ getDetailTAGEventlog: (t) => A.get("/tag-event-log/".concat(t))
217
+ }, o = i({
218
+ prefix: "/v1/global-settings/user"
219
+ }), Q = {
220
220
  getUsers: (t) => o.get("", { params: t }),
221
221
  getUserDetail: (t) => o.get("/".concat(t)),
222
222
  getUserSystemLogs: (t, e) => o.get("/".concat(t, "/system-logs"), { params: e }),
@@ -244,20 +244,29 @@ const b = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
244
244
  deleteCancelEmailChange: (t) => o.delete("/cancel-email-change/".concat(t)),
245
245
  postResendEmail: (t) => o.post("/resend-email", t),
246
246
  putChangePassword: (t, e) => o.put("/change-password/".concat(t), e)
247
+ }, d = i({
248
+ prefix: "/v2/hardware-tagging"
249
+ }), X = {
250
+ getTabletList: (t) => d.post("/tablet/list", t),
251
+ getTabletOption: (t) => d.post("/tablet/options", t),
252
+ updateTabletStatus: (t, e) => d.patch("/tablet/status", e, { params: { ids: t } }),
253
+ disconnectTablet: (t) => d.patch("/tablet/disconnect-reader", { params: { ids: t } }),
254
+ deleteTablet: (t) => d.delete("/tablet", { params: { ids: t } })
247
255
  };
248
256
  export {
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,
260
- T as getBaseURL,
261
- B as getImageURL,
262
- k as queryParamsStringfy
257
+ B as AuthServices,
258
+ J as ChangelogServices,
259
+ M as DivisionServices,
260
+ H as GlobalTagServices,
261
+ V as HardwareServices,
262
+ q as LogServices,
263
+ F as OptionServices,
264
+ z as PositionServices,
265
+ X as TabletServices,
266
+ K as TagEventlogServices,
267
+ W as TagServices,
268
+ Q as UserServices,
269
+ b as getBaseURL,
270
+ k as getImageURL,
271
+ j as queryParamsStringfy
263
272
  };
package/main.d.ts CHANGED
@@ -9,4 +9,5 @@ export { default as PositionServices } from './src/services/position.service';
9
9
  export { default as TagServices } from './src/services/tag.service';
10
10
  export { default as TagEventlogServices } from './src/services/tagEventlog.service';
11
11
  export { default as UserServices } from './src/services/user.service';
12
+ export { default as TabletServices } from './src/services/tablet.service';
12
13
  export { getBaseURL, getImageURL, queryParamsStringfy } from './src/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "2.0.1-alpha.2",
3
+ "version": "2.0.1-alpha.4",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -0,0 +1,85 @@
1
+ import { QueryParams } from '../types/fetchResponse.type';
2
+ import { ModuleAccess } from '../types/iam.type';
3
+ export interface LoginPayload {
4
+ email: string;
5
+ password: string | null;
6
+ overrideSession: boolean;
7
+ isMobile: boolean;
8
+ otp: string | null;
9
+ captcha: string;
10
+ agreePolicy: boolean;
11
+ }
12
+ export interface SetPasswordPayload {
13
+ type: 'confirm' | 'reset';
14
+ token: string;
15
+ password: string;
16
+ }
17
+ export interface BaseParams extends QueryParams {
18
+ page?: number;
19
+ limit?: number;
20
+ search?: string;
21
+ sortBy?: string;
22
+ sortOrder?: number;
23
+ column?: string[];
24
+ }
25
+ export interface GetPositionListParams extends BaseParams {
26
+ }
27
+ export interface CreateEditPositionPayload {
28
+ name: string;
29
+ }
30
+ export interface GetDivisionListParams extends BaseParams {
31
+ }
32
+ export interface CreateEditDivisionPayload {
33
+ name: string;
34
+ }
35
+ export interface CreateUserPayload {
36
+ profilePicture?: File | string;
37
+ firstName: string;
38
+ lastName: string;
39
+ positionId?: string;
40
+ divisionId: string;
41
+ employeeId?: string;
42
+ email: string;
43
+ access: string;
44
+ expiryDate?: string;
45
+ tag?: string;
46
+ }
47
+ export interface GetGlobalUserListParams extends BaseParams {
48
+ isActive?: boolean[];
49
+ position?: string[];
50
+ division?: string[];
51
+ modifiedBy?: string[];
52
+ updatedAt?: string[];
53
+ }
54
+ export interface GetGlobalUserOptionsParams {
55
+ isActiveOptions?: boolean;
56
+ positionOptions?: boolean;
57
+ divisionOptions?: boolean;
58
+ modifiedByOptions?: boolean;
59
+ }
60
+ export interface SetActiveGlobalUserPayload {
61
+ isActive: boolean;
62
+ }
63
+ export interface EditUserPayload extends CreateUserPayload {
64
+ }
65
+ export interface EditUserFcmTokenPayload {
66
+ data: {
67
+ userId: string;
68
+ token: string;
69
+ }[];
70
+ }
71
+ export interface ResendActivationEmailPayload {
72
+ ids: string[];
73
+ }
74
+ export interface ChangePasswordPayload {
75
+ oldPassword: string;
76
+ newPassword: string;
77
+ }
78
+ export interface ModuleAuthPayload {
79
+ module: ModuleAccess;
80
+ }
81
+ export interface GetConcurrentUsersParams extends BaseParams {
82
+ }
83
+ export interface LogoutSessionPayload {
84
+ sessionId: string;
85
+ }
@@ -0,0 +1,38 @@
1
+ import { FetchDetailResponse, FetchResponse } from '../types/fetchResponse.type';
2
+ import { MultiSelectOption } from '../types/options.type';
3
+ import { Tab, Tablet } from '../types/tablet.type';
4
+ export interface GetTabletListQuery {
5
+ tab?: Tab;
6
+ page?: number;
7
+ limit?: number;
8
+ sortBy?: string;
9
+ sortOrder?: number;
10
+ search?: string;
11
+ column?: string[];
12
+ deviceName?: string[];
13
+ status?: string[];
14
+ group?: string[];
15
+ reader?: string[];
16
+ registeredAt?: number[];
17
+ reportedBy?: string[];
18
+ reportedAt?: number[];
19
+ }
20
+ export type GetTabletListResponse = FetchDetailResponse<Tablet>;
21
+ export interface GetTabletOptionsQuery {
22
+ tab?: Tab;
23
+ statusOptions?: boolean;
24
+ deviceNameOptions?: boolean;
25
+ readerOptions?: boolean;
26
+ reportedByOptions?: boolean;
27
+ }
28
+ export type GetTabletOptionsResponse = FetchResponse & {
29
+ data: {
30
+ deviceNameOptions: MultiSelectOption[];
31
+ readerOptions: MultiSelectOption[];
32
+ statusOptions: MultiSelectOption[];
33
+ reportedByOptions: MultiSelectOption[];
34
+ };
35
+ };
36
+ export interface UpdateTabletStatusBody {
37
+ status?: Tab;
38
+ }
@@ -0,0 +1,45 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { DropdownOption } from '../types/options.type';
3
+ import { FetchDetailResponse, FetchListResponse } from '../types/fetchResponse.type';
4
+ 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';
6
+ declare const IamServices: {
7
+ login: (payload: LoginPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginResponse>>>;
8
+ logout: () => Promise<AxiosResponse>;
9
+ verifyToken: (token: string) => Promise<AxiosResponse<FetchDetailResponse<VerifyTokenResponse>>>;
10
+ requestOtp: (email: string) => Promise<AxiosResponse<RequestOtpResponse>>;
11
+ requestResetLink: (email: string) => Promise<AxiosResponse<RequestResetLinkResponse>>;
12
+ setPassword: (payload: SetPasswordPayload) => Promise<AxiosResponse>;
13
+ confirmEmailChange: (token: string) => Promise<AxiosResponse>;
14
+ cancelEmailChange: (token: string) => Promise<AxiosResponse>;
15
+ getPositionList: (params: GetPositionListParams) => Promise<AxiosResponse<FetchListResponse<PositionList>>>;
16
+ getPositionDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<PositionDetail>>>;
17
+ createPosition: (payload: CreateEditPositionPayload) => Promise<AxiosResponse>;
18
+ editPosition: (id: string, payload: CreateEditPositionPayload) => Promise<AxiosResponse>;
19
+ deletePosition: (ids: string[]) => Promise<AxiosResponse>;
20
+ getDivisionList: (params: GetDivisionListParams) => Promise<AxiosResponse<FetchListResponse<DivisionList>>>;
21
+ getDivisionDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<DivisionListDetail>>>;
22
+ createDivision: (payload: CreateEditDivisionPayload) => Promise<AxiosResponse>;
23
+ editDivision: (id: string, payload: CreateEditDivisionPayload) => Promise<AxiosResponse>;
24
+ deleteDivision: (ids: string[]) => Promise<AxiosResponse>;
25
+ createUsers: (payload: CreateUserPayload) => Promise<AxiosResponse>;
26
+ getGlobalUserList: (params: GetGlobalUserListParams) => Promise<AxiosResponse<FetchListResponse<GlobalUserList>>>;
27
+ getGlobalUserOptions: (params: GetGlobalUserOptionsParams) => Promise<AxiosResponse<FetchDetailResponse<GlobalUserOptions>>>;
28
+ getGlobalUserDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<GlobalUserDetail>>>;
29
+ setActiveGlobalUser: (ids: string[], payload: SetActiveGlobalUserPayload) => Promise<AxiosResponse>;
30
+ editUsers: (id: string, payload: EditUserPayload) => Promise<AxiosResponse>;
31
+ editUsersFcmToken: (payload: EditUserFcmTokenPayload) => Promise<AxiosResponse>;
32
+ resendActivationEmail: (payload: ResendActivationEmailPayload) => Promise<AxiosResponse>;
33
+ changePassword: (id: string, payload: ChangePasswordPayload) => Promise<AxiosResponse<ChangePasswordResponse>>;
34
+ deleteUsers: (ids: string[]) => Promise<AxiosResponse>;
35
+ logoutModule: (payload: ModuleAuthPayload) => Promise<AxiosResponse>;
36
+ loginModule: (payload: ModuleAuthPayload) => Promise<AxiosResponse<FetchDetailResponse<LoginModuleResponse>>>;
37
+ getConcurrentUsers: (params: GetConcurrentUsersParams, moduleId?: string) => Promise<AxiosResponse<FetchDetailResponse<ConcurrentUserList>>>;
38
+ logoutSession: (payload: LogoutSessionPayload, moduleId?: string) => Promise<AxiosResponse>;
39
+ getPositionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
40
+ getDivisionDropdown: () => Promise<AxiosResponse<FetchDetailResponse<DropdownOption[]>>>;
41
+ exportPositionTable: () => Promise<AxiosResponse<Blob>>;
42
+ exportDivisionTable: () => Promise<AxiosResponse<Blob>>;
43
+ exportUserTable: () => Promise<AxiosResponse<Blob>>;
44
+ };
45
+ export default IamServices;
@@ -0,0 +1,10 @@
1
+ import { GetTabletListQuery, GetTabletListResponse, GetTabletOptionsQuery, GetTabletOptionsResponse, UpdateTabletStatusBody } from '../dto/tablet.dto';
2
+ import { AxiosResponse } from 'axios';
3
+ declare const TabletServices: {
4
+ getTabletList: (body: GetTabletListQuery) => Promise<AxiosResponse<GetTabletListResponse>>;
5
+ getTabletOption: (body: GetTabletOptionsQuery) => Promise<AxiosResponse<GetTabletOptionsResponse>>;
6
+ updateTabletStatus: (ids: string, body: UpdateTabletStatusBody) => Promise<AxiosResponse>;
7
+ disconnectTablet: (ids: string) => Promise<AxiosResponse>;
8
+ deleteTablet: (ids: string) => Promise<AxiosResponse>;
9
+ };
10
+ export default TabletServices;
@@ -0,0 +1,143 @@
1
+ import { MultiSelectOption } from './options.type';
2
+ export interface LoginResponse {
3
+ _id: string;
4
+ companyName: string;
5
+ companyCode: string;
6
+ fullName: string;
7
+ profilePicture: string;
8
+ email: string;
9
+ isDefault: boolean;
10
+ access: string[];
11
+ generalSetting: {
12
+ dateFormat: string;
13
+ timeFormat: string;
14
+ timezone: string;
15
+ currency: {
16
+ currency: string;
17
+ symbol: string;
18
+ locale: string;
19
+ label: string;
20
+ };
21
+ };
22
+ }
23
+ type BaseMessage = string & {};
24
+ export interface VerifyTokenResponse {
25
+ message: 'Token Verified!' | 'Token not found' | 'Internal server error' | BaseMessage;
26
+ data: boolean;
27
+ }
28
+ interface BaseResponse<TMessage> {
29
+ status: number;
30
+ message: TMessage;
31
+ data?: boolean;
32
+ }
33
+ export type RequestResetLinkMessage = 'EMAIL_NOT_REGISTERED' | BaseMessage;
34
+ export type RequestOtpMessage = 'Successfully requested otp' | 'EMAIL_NOT_REGISTERED' | 'INACTIVE_USER' | BaseMessage;
35
+ export interface RequestResetLinkResponse extends BaseResponse<RequestResetLinkMessage> {
36
+ }
37
+ export interface RequestOtpResponse extends BaseResponse<RequestOtpMessage> {
38
+ }
39
+ interface BasePosition {
40
+ _id: string;
41
+ name: string;
42
+ }
43
+ export interface PositionList extends BasePosition {
44
+ inUse: boolean;
45
+ }
46
+ export interface PositionDetail extends BasePosition {
47
+ }
48
+ interface BaseDivision {
49
+ _id: string;
50
+ name: string;
51
+ }
52
+ export interface DivisionList extends BaseDivision {
53
+ inUse: boolean;
54
+ }
55
+ export interface DivisionListDetail extends BaseDivision {
56
+ }
57
+ export interface ChangePasswordResponse {
58
+ status?: number;
59
+ message?: 'INCORRECT_PASSWORD' | BaseMessage;
60
+ }
61
+ export interface GlobalUserList {
62
+ _id: string;
63
+ isActive: boolean;
64
+ isDefault: boolean;
65
+ profilePicture: string | null;
66
+ fullName: string;
67
+ email: string;
68
+ position: string | null;
69
+ division: string;
70
+ employeeId: string | null;
71
+ modifiedBy: string;
72
+ updatedAt: string;
73
+ pendingApproval: number;
74
+ assignedAssets: number;
75
+ borrowedAssets: number;
76
+ isEmailConfirmed: boolean;
77
+ }
78
+ export interface GlobalUserOptions {
79
+ isActiveOptions: {
80
+ label: string;
81
+ value: boolean;
82
+ }[];
83
+ positionOptions: MultiSelectOption[];
84
+ divisionOptions: MultiSelectOption[];
85
+ modifiedByOptions: MultiSelectOption[];
86
+ }
87
+ export type ModuleAccess = 'Global Settings' | 'Fixed Asset' | 'Supply Asset' | 'Admin Console';
88
+ export interface GlobalUserDetail {
89
+ _id: string;
90
+ isActive: boolean;
91
+ isDefault: boolean;
92
+ isEmailConfirmed: boolean;
93
+ profilePicture: string | null;
94
+ userTag: string | null;
95
+ userType: string;
96
+ firstName: string;
97
+ lastName: string;
98
+ fullName: string;
99
+ email: string;
100
+ pendingEmailChange: string | null;
101
+ position: string | null;
102
+ division: string;
103
+ employeeId: string | null;
104
+ expiryDate: string | null;
105
+ access: (ModuleAccess | BaseMessage)[];
106
+ }
107
+ export interface LoginModuleResponse extends LoginResponse {
108
+ isTotalControl: boolean;
109
+ isReadOnly: boolean;
110
+ plan: string;
111
+ addOn: Record<string, boolean>;
112
+ systemRoles: Record<string, {
113
+ create: boolean;
114
+ view: boolean;
115
+ update: boolean;
116
+ delete: boolean;
117
+ }>;
118
+ transactionRoles: Record<string, {
119
+ manager: boolean;
120
+ monitoringReport: boolean;
121
+ approver: boolean;
122
+ staff: boolean;
123
+ }>;
124
+ generalSetting: LoginResponse['generalSetting'] & {
125
+ geolocation: boolean;
126
+ };
127
+ }
128
+ export interface ConcurrentUser {
129
+ _id: string;
130
+ profilePicture: string;
131
+ name: string;
132
+ email: string;
133
+ userType: string;
134
+ position: string;
135
+ division: string;
136
+ lastLogin: string;
137
+ }
138
+ export interface ConcurrentUserList {
139
+ moduleId: string;
140
+ activeSessions: ConcurrentUser[];
141
+ count: number;
142
+ }
143
+ export {};
@@ -0,0 +1,16 @@
1
+ export type Tab = 'Available' | 'Damaged/Missing';
2
+ export interface Tablet {
3
+ _id: string;
4
+ deviceName: string;
5
+ deviceId: string;
6
+ status: string;
7
+ group: {
8
+ fixedAsset: string | null;
9
+ supplyAsset: string | null;
10
+ };
11
+ reader: string | null;
12
+ aliasName: string | null;
13
+ registeredAt: string;
14
+ reportedBy: string | null;
15
+ reportedAt: string | null;
16
+ }