@tagsamurai/gsts-api-services 1.0.2-alpha.5 → 1.0.2-alpha.7

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: "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") => E["VITE_" + t], a = (t = {}, e = !1) => {
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) => {
3
3
  const {
4
4
  env: r = "APP_GLOBAL_SETTINGS_API",
5
5
  prefix: s = "",
6
6
  headers: i = {},
7
- ...p
7
+ ...c
8
8
  } = t, y = "".concat(T(r)).concat(s), A = _.create({
9
- ...p,
9
+ ...c,
10
10
  baseURL: y,
11
11
  headers: e ? i : {
12
12
  "Content-Type": "application/json",
@@ -18,43 +18,43 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
18
18
  const P = JSON.parse((f = localStorage.getItem("user")) != null ? f : "{}"), O = (S = ($ = P.jwt) != null ? $ : P.token) != null ? S : "";
19
19
  return v.headers.Authorization = "Bearer ".concat(O), v;
20
20
  }), A;
21
- }, u = a({
21
+ }, g = a({
22
22
  prefix: "/v1/global-settings/auth"
23
- }), b = (t) => {
23
+ }), E = (t) => {
24
24
  var e, r, s, i;
25
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
26
  }, x = {
27
27
  login: (t) => {
28
28
  const e = { ...t, isMobile: !1 };
29
- return u.post("/login", e);
29
+ return g.post("/login", e);
30
30
  },
31
- reLogin: (t) => (u.interceptors.response.use((e) => e, b), u.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
- return u.post("/request-otp", e);
34
+ return g.post("/request-otp", e);
35
35
  },
36
36
  requestResetPassLink: (t) => {
37
37
  const e = { email: t };
38
- return u.post("/request-reset-link", e);
38
+ return g.post("/request-reset-link", e);
39
39
  },
40
- setPassword: (t) => u.post("/set-password", t),
41
- verifyToken: (t) => u.get("/verify-token/".concat(t)),
40
+ setPassword: (t) => g.post("/set-password", t),
41
+ verifyToken: (t) => g.get("/verify-token/".concat(t)),
42
42
  confirmEmailChange: (t) => {
43
43
  const e = { token: t };
44
- return u.put("/confirm-email-change/confirm", e);
44
+ return g.put("/confirm-email-change/confirm", e);
45
45
  },
46
- postLogout: () => u.post("/logout"),
46
+ postLogout: () => g.post("/logout"),
47
47
  /**
48
48
  *
49
49
  * @deprecated use postLogout instead
50
50
  */
51
- logout: () => u.post("/logout")
51
+ logout: () => g.post("/logout")
52
52
  }, h = (t, e, r) => {
53
53
  const s = new URL(T("APP_TAGSAMURAI_API") || "").origin;
54
54
  let i = t.startsWith("http") ? t : "".concat(s, "/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,34 +95,38 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
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
- }, g = a({
118
+ }, u = a({
115
119
  prefix: "/v1/global-settings"
116
120
  }), j = {
117
- getTAGAllPaired: (t, e) => g.get("/".concat(t), { params: e }),
118
- getTAGAllPairedOptions: (t, e) => g.get("/".concat(t, "/options"), { params: e }),
119
- getTAGNotPaired: (t, e) => g.get("/".concat(t, "/not-paired"), { params: e }),
120
- getTAGNotPairedOptions: (t, e) => g.get("/".concat(t, "/not-paired/options"), { params: e }),
121
- getScanTAG: (t, e) => g.get("/".concat(t, "/scan"), { params: e }),
122
- putDetailAuditTAG: (t, e) => g.put("/".concat(t, "/audit-detail"), e),
123
- putAuditTAG: (t, e) => g.put("/".concat(t, "/audit"), e),
124
- putAllocateTAG: (t, e) => g.put("/".concat(t, "/allocate"), e),
125
- putCombineTAG: (t) => g.put("/combine", t)
121
+ getTAGAllPaired: (t, e) => u.get("/".concat(t), { params: e }),
122
+ getTAGAllPairedOptions: (t, e) => u.get("/".concat(t, "/options"), { params: e }),
123
+ getTAGNotPaired: (t, e) => u.get("/".concat(t, "/not-paired"), { params: e }),
124
+ getTAGNotPairedOptions: (t, e) => u.get("/".concat(t, "/not-paired/options"), { params: e }),
125
+ getScanTAG: (t, e) => u.get("/".concat(t, "/scan"), { params: e }),
126
+ putDetailAuditTAG: (t, e) => u.put("/".concat(t, "/audit-detail"), e),
127
+ putAuditTAG: (t, e) => u.put("/".concat(t, "/audit"), e),
128
+ putAllocateTAG: (t, e) => u.put("/".concat(t, "/allocate"), e),
129
+ putCombineTAG: (t) => u.put("/combine", t)
126
130
  }, n = a({
127
131
  prefix: "/v1/global-settings"
128
132
  }), M = {
@@ -157,11 +161,11 @@ const E = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
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: "production", PROD: !0, SSR: !1, VITE_
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-alpha.5",
3
+ "version": "1.0.2-alpha.7",
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;