@tagsamurai/gsts-api-services 1.0.2-beta.2 → 1.0.2-beta.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,12 +1,12 @@
1
1
  import _ from "axios";
2
- const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://staging-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://staging-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://staging-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://staging-api.tagsamurai.com" }, T = (t = "APP_TAGSAMURAI_API") => E["VITE_" + t], a = (t = {}, e = !1) => {
2
+ const b = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP_GLOBAL_SETTINGS_API: "https://staging-api.global-settings.tagsamurai.com", VITE_APP_IMAGE_BASE_URL: "https://staging-api.tagsamurai.com/fam/utility/v2/files", VITE_APP_LOGS_NOTIFICATION_API: "https://staging-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://staging-api.tagsamurai.com" }, T = (t = "APP_TAGSAMURAI_API") => b["VITE_" + t], a = (t = {}, e = !1) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: n = "",
6
6
  headers: i = {},
7
- ...p
7
+ ...c
8
8
  } = t, y = "".concat(T(r)).concat(n), A = _.create({
9
- ...p,
9
+ ...c,
10
10
  baseURL: y,
11
11
  headers: e ? i : {
12
12
  "Content-Type": "application/json",
@@ -20,7 +20,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
20
20
  }), A;
21
21
  }, g = a({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), b = (t) => {
23
+ }), E = (t) => {
24
24
  var e, r, n, i;
25
25
  return ((e = t.response) == null ? void 0 : e.status) === 401 || ((r = t.response) == null ? void 0 : r.status) === 500 || ((i = (n = t.response) == null ? void 0 : n.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
  }, x = {
@@ -28,7 +28,7 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
28
28
  const e = { ...t, isMobile: !1 };
29
29
  return g.post("/login", e);
30
30
  },
31
- reLogin: (t) => (g.interceptors.response.use((e) => e, b), g.post("/login", t)),
31
+ reLogin: (t) => (g.interceptors.response.use((e) => e, E), g.post("/login", t)),
32
32
  requestOTP: (t) => {
33
33
  const e = { email: t };
34
34
  return g.post("/request-otp", e);
@@ -53,8 +53,8 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
53
53
  const n = new URL(T("APP_TAGSAMURAI_API") || "").origin;
54
54
  let i = t.startsWith("http") ? t : "".concat(n, "/file-storage/api/file/").concat(t.replace(/^\/+/, ""));
55
55
  if (e || r) {
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());
56
+ const c = new URLSearchParams();
57
+ e && (c.set("width", e.toString()), c.set("height", (r == null ? void 0 : r.toString()) || e.toString())), i += "?".concat(c.toString());
58
58
  }
59
59
  return i;
60
60
  }, L = () => {
@@ -95,21 +95,25 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
95
95
  [r]: t[r]
96
96
  });
97
97
  }), e;
98
- }, I = a({
98
+ }, m = a({
99
99
  prefix: "/v1/global-settings/change-log"
100
100
  }), k = {
101
- getChangelogs: (t) => I.get("", { params: t }),
102
- getChangelogOptions: (t) => I.get("/options", { params: t })
103
- }, c = a({
101
+ getChangelogs: (t) => m.get("", { params: t }),
102
+ getChangelogOptions: (t) => m.get("/options", { params: t })
103
+ }, p = a({
104
104
  prefix: "/v1/global-settings/division"
105
105
  }), B = {
106
- getDivisions: (t) => c.get("", { params: t }),
107
- getDivisionDetail: (t) => c.get("/".concat(t)),
108
- postCreateDivision: (t) => c.post("/", t),
109
- putEditDivision: (t, e) => c.put("/".concat(t), e),
106
+ getDivisions: (t) => p.get("", { params: t }),
107
+ getDivisionDetail: (t) => p.get("/".concat(t)),
108
+ postCreateDivision: (t) => p.post("/", t),
109
+ putEditDivision: (t, e) => p.put("/".concat(t), e),
110
110
  deleteDivisions: (t) => {
111
111
  const e = { id: JSON.stringify(t) };
112
- return c.delete("", { params: e });
112
+ return p.delete("", { params: e });
113
+ },
114
+ getAvailableDivision: (t) => {
115
+ const e = { name: t };
116
+ return p.get("/available", { params: e });
113
117
  }
114
118
  }, u = a({
115
119
  prefix: "/v1/global-settings"
@@ -157,11 +161,11 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
157
161
  prefix: "/v2"
158
162
  }), q = {
159
163
  getSessionLogList: (t) => G.get("/session-log", { params: t })
160
- }, m = a({
164
+ }, I = a({
161
165
  prefix: "/v1/global-settings/option"
162
166
  }), J = {
163
- getPositions: () => m.get("/position"),
164
- getDivisions: () => m.get("/division")
167
+ getPositions: () => I.get("/position"),
168
+ getDivisions: () => I.get("/division")
165
169
  }, l = a({
166
170
  prefix: "/v1/global-settings/position"
167
171
  }), V = {
@@ -172,6 +176,10 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "staging", PROD: !0, SSR: !1, VITE_APP
172
176
  deletePositions: (t) => {
173
177
  const e = { id: JSON.stringify(t) };
174
178
  return l.delete("", { params: e });
179
+ },
180
+ getAvailablePosition: (t) => {
181
+ const e = { name: t };
182
+ return l.get("/available", { params: e });
175
183
  }
176
184
  }, U = a({
177
185
  env: "APP_TAGSAMURAI_API",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/gsts-api-services",
3
- "version": "1.0.2-beta.2",
3
+ "version": "1.0.2-beta.4",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Global Settings Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -9,5 +9,6 @@ declare const DivisionServices: {
9
9
  postCreateDivision: (body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
10
10
  putEditDivision: (id: string, body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
11
11
  deleteDivisions: (ids: string[]) => Promise<AxiosResponse>;
12
+ getAvailableDivision: (name: string) => Promise<AxiosResponse>;
12
13
  };
13
14
  export default DivisionServices;
@@ -9,5 +9,6 @@ declare const PositionServices: {
9
9
  postCreatePosition: (body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
10
10
  putEditPosition: (id: string, body: CreateEditMasterDataBody) => Promise<AxiosResponse>;
11
11
  deletePositions: (ids: string[]) => Promise<AxiosResponse>;
12
+ getAvailablePosition: (name: string) => Promise<AxiosResponse>;
12
13
  };
13
14
  export default PositionServices;