@tagsamurai/fats-api-services 1.0.0-alpha.3 → 1.0.0-alpha.5
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.
- package/api-services.es.js +38 -66
- package/api-services.system.js +1 -1
- package/main.d.ts +1 -2
- package/package.json +1 -1
package/api-services.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const { env: r = "APP_API", prefix:
|
|
4
|
-
return
|
|
5
|
-
...
|
|
6
|
-
baseURL:
|
|
7
|
-
headers: e ?
|
|
1
|
+
import P from "axios";
|
|
2
|
+
const _ = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_API: "https://dev-api.tagsamurai.com", VITE_APP_COUNTRY_STATE_API: "https://api.countrystatecity.in", VITE_APP_COUNTRY_STATE_API_KEY: "ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, i = (t = "APP_API") => _["VITE_" + t], c = (t = {}, e = !1) => {
|
|
3
|
+
const { env: r = "APP_API", prefix: n = "", headers: s = {}, ...a } = t, u = `${i(r)}${n}`, g = JSON.parse(localStorage.getItem("user") ?? "{}"), A = g.jwt ?? g.token ?? "";
|
|
4
|
+
return P.create({
|
|
5
|
+
...a,
|
|
6
|
+
baseURL: u,
|
|
7
|
+
headers: e ? s : {
|
|
8
8
|
"Content-Type": "application/json",
|
|
9
|
-
Authorization: `Bearer ${
|
|
10
|
-
...
|
|
9
|
+
Authorization: `Bearer ${A}`,
|
|
10
|
+
...s
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
}, f = (t) => {
|
|
@@ -21,94 +21,66 @@ const I = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
|
|
|
21
21
|
[r]: t[r]
|
|
22
22
|
});
|
|
23
23
|
}), e;
|
|
24
|
-
},
|
|
24
|
+
}, T = (t, e, r) => {
|
|
25
25
|
if (!t) return;
|
|
26
|
-
const
|
|
26
|
+
const n = i("APP_API"), s = t.startsWith("http") ? t : `${n}/utility/v2/files/${t.replace(/^\/+/, "")}`;
|
|
27
27
|
if (e || r) {
|
|
28
|
-
const
|
|
29
|
-
return e && (
|
|
28
|
+
const a = new URLSearchParams();
|
|
29
|
+
return e && (a.set("width", e.toString()), a.set("height", r ? r == null ? void 0 : r.toString() : e.toString())), `${s}?${a.toString()}`;
|
|
30
30
|
}
|
|
31
|
-
return
|
|
32
|
-
},
|
|
31
|
+
return s;
|
|
32
|
+
}, S = (t) => {
|
|
33
33
|
if (!t) return;
|
|
34
34
|
const e = i("APP_TAGSAMURAI_API");
|
|
35
35
|
return t.startsWith("http") ? t : `${e}/file-manager/v2/files/${t}`;
|
|
36
|
-
},
|
|
37
|
-
prefix: "/settings-attribute/v2"
|
|
38
|
-
}), y = {
|
|
39
|
-
getGroupCategory: (t) => {
|
|
40
|
-
const e = t === "category" ? t : "groups";
|
|
41
|
-
return n.get(`/${e}/tree`);
|
|
42
|
-
},
|
|
43
|
-
getGroupCategoryList: (t, e) => {
|
|
44
|
-
const r = t === "category" ? t : "groups";
|
|
45
|
-
return n.get(`/${r}/${e}`);
|
|
46
|
-
},
|
|
47
|
-
getNames: (t) => {
|
|
48
|
-
const e = t === "category" ? t : "groups";
|
|
49
|
-
return n.get(`/${e}/names`);
|
|
50
|
-
},
|
|
51
|
-
postCreateGroupCategory: (t, e) => {
|
|
52
|
-
const r = t === "category" ? t : "groups";
|
|
53
|
-
return n.post(`/${r}`, e);
|
|
54
|
-
},
|
|
55
|
-
putEditGroupCategory: (t, e, r) => {
|
|
56
|
-
const o = t === "category" ? t : "groups";
|
|
57
|
-
return n.put(`/${o}/${r}`, e);
|
|
58
|
-
},
|
|
59
|
-
deleteGroupCategory: (t, e, r) => {
|
|
60
|
-
const o = t === "category" ? t : "groups";
|
|
61
|
-
return n.delete(`/${o}/${r}`, { data: e });
|
|
62
|
-
}
|
|
63
|
-
}, s = c({
|
|
36
|
+
}, o = c({
|
|
64
37
|
prefix: "/settings-attribute/v2",
|
|
65
|
-
|
|
38
|
+
env: "APP_TAGSAMURAI_API"
|
|
66
39
|
}), v = {
|
|
67
40
|
getGroupCategory: (t) => {
|
|
68
41
|
const e = t === "category" ? t : "groups";
|
|
69
|
-
return
|
|
42
|
+
return o.get(`/${e}/tree`);
|
|
70
43
|
},
|
|
71
44
|
getGroupCategoryList: (t, e) => {
|
|
72
45
|
const r = t === "category" ? t : "groups";
|
|
73
|
-
return
|
|
46
|
+
return o.get(`/${r}/${e}`);
|
|
74
47
|
},
|
|
75
48
|
getNames: (t) => {
|
|
76
49
|
const e = t === "category" ? t : "groups";
|
|
77
|
-
return
|
|
50
|
+
return o.get(`/${e}/names`);
|
|
78
51
|
},
|
|
79
52
|
postCreateGroupCategory: (t, e) => {
|
|
80
53
|
const r = t === "category" ? t : "groups";
|
|
81
|
-
return
|
|
54
|
+
return o.post(`/${r}`, e);
|
|
82
55
|
},
|
|
83
56
|
putEditGroupCategory: (t, e, r) => {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
57
|
+
const n = t === "category" ? t : "groups";
|
|
58
|
+
return o.put(`/${n}/${r}`, e);
|
|
86
59
|
},
|
|
87
|
-
putMoveGroup: (t, e) =>
|
|
88
|
-
putEditBulkGroups: async (t) =>
|
|
60
|
+
putMoveGroup: (t, e) => o.put(`/groups/${e}/move-group`, t),
|
|
61
|
+
putEditBulkGroups: async (t) => o.put("/bulk", t),
|
|
89
62
|
deleteGroupCategory: (t, e, r) => {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
63
|
+
const n = t === "category" ? t : "groups";
|
|
64
|
+
return o.delete(`/${n}/${r}`, { data: e });
|
|
92
65
|
}
|
|
93
|
-
},
|
|
66
|
+
}, I = c({
|
|
94
67
|
prefix: "/v2",
|
|
95
|
-
|
|
96
|
-
}),
|
|
97
|
-
getTotalApprovals: () =>
|
|
68
|
+
env: "APP_LOGS_NOTIFICATION_API"
|
|
69
|
+
}), $ = {
|
|
70
|
+
getTotalApprovals: () => I.get("/approval/count")
|
|
98
71
|
}, p = c({
|
|
99
72
|
prefix: "/v2",
|
|
100
|
-
|
|
101
|
-
}),
|
|
73
|
+
env: "APP_LOGS_NOTIFICATION_API"
|
|
74
|
+
}), O = {
|
|
102
75
|
getActionLog: (t) => p.get("/change-log", { params: t }),
|
|
103
76
|
getActionLogOption: (t) => p.get("/change-log/options", { params: t })
|
|
104
77
|
};
|
|
105
78
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
v as OldGroupCategoryServices,
|
|
79
|
+
O as ChangelogServices,
|
|
80
|
+
v as GroupCategoryServices,
|
|
81
|
+
$ as NotificationApprovalServices,
|
|
110
82
|
i as getBaseURL,
|
|
111
|
-
|
|
112
|
-
|
|
83
|
+
T as getImageURL,
|
|
84
|
+
S as oldGetImageURL,
|
|
113
85
|
f as queryParamsStringfy
|
|
114
86
|
};
|
package/api-services.system.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["axios"],function(n,
|
|
1
|
+
System.register(["axios"],function(n,f){"use strict";var A;return{setters:[c=>{A=c.default}],execute:function(){const c={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_API:"https://dev-api.tagsamurai.com",VITE_APP_COUNTRY_STATE_API:"https://api.countrystatecity.in",VITE_APP_COUNTRY_STATE_API_KEY:"ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==",VITE_APP_LOGS_NOTIFICATION_API:"https://dev-api-logs-notification.tagsamurai.com",VITE_APP_TAGSAMURAI_API:"https://dev-api.tagsamurai.com"},g=n("getBaseURL",(t="APP_API")=>c["VITE_"+t]),u=(t={},e=!1)=>{const{env:r="APP_API",prefix:s="",headers:a={},...i}=t,I=`${g(r)}${s}`,P=JSON.parse(localStorage.getItem("user")??"{}"),l=P.jwt??P.token??"";return A.create({...i,baseURL:I,headers:e?a:{"Content-Type":"application/json",Authorization:`Bearer ${l}`,...a}})},S=n("queryParamsStringfy",t=>{if(!t||typeof t=="string")return;const e={};return Object.keys(t).forEach(r=>{Array.isArray(t[r])?t[r].length>0&&Object.assign(e,{[r]:JSON.stringify(t[r])}):t[r]!==void 0&&Object.assign(e,{[r]:t[r]})}),e}),T=n("getImageURL",(t,e,r)=>{if(!t)return;const s=g("APP_API"),a=t.startsWith("http")?t:`${s}/utility/v2/files/${t.replace(/^\/+/,"")}`;if(e||r){const i=new URLSearchParams;return e&&(i.set("width",e.toString()),i.set("height",r?r==null?void 0:r.toString():e.toString())),`${a}?${i.toString()}`}return a}),v=n("oldGetImageURL",t=>{if(!t)return;const e=g("APP_TAGSAMURAI_API");return t.startsWith("http")?t:`${e}/file-manager/v2/files/${t}`}),o=u({prefix:"/settings-attribute/v2",env:"APP_TAGSAMURAI_API"}),y=n("GroupCategoryServices",{getGroupCategory:t=>{const e=t==="category"?t:"groups";return o.get(`/${e}/tree`)},getGroupCategoryList:(t,e)=>{const r=t==="category"?t:"groups";return o.get(`/${r}/${e}`)},getNames:t=>{const e=t==="category"?t:"groups";return o.get(`/${e}/names`)},postCreateGroupCategory:(t,e)=>{const r=t==="category"?t:"groups";return o.post(`/${r}`,e)},putEditGroupCategory:(t,e,r)=>{const s=t==="category"?t:"groups";return o.put(`/${s}/${r}`,e)},putMoveGroup:(t,e)=>o.put(`/groups/${e}/move-group`,t),putEditBulkGroups:async t=>o.put("/bulk",t),deleteGroupCategory:(t,e,r)=>{const s=t==="category"?t:"groups";return o.delete(`/${s}/${r}`,{data:e})}}),_=u({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),$=n("NotificationApprovalServices",{getTotalApprovals:()=>_.get("/approval/count")}),p=u({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),O=n("ChangelogServices",{getActionLog:t=>p.get("/change-log",{params:t}),getActionLogOption:t=>p.get("/change-log/options",{params:t})})}}});
|
package/main.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default as GroupCategoryServices } from './src/services/
|
|
2
|
-
export { default as OldGroupCategoryServices } from './src/services/oldGroupCategory.service';
|
|
1
|
+
export { default as GroupCategoryServices } from './src/services/oldGroupCategory.service';
|
|
3
2
|
export { default as NotificationApprovalServices } from './src/services/oldNotificationApproval.service';
|
|
4
3
|
export { default as ChangelogServices } from './src/services/oldChangelog.service';
|
|
5
4
|
export { getImageURL, oldGetImageURL, getBaseURL, queryParamsStringfy, } from './src/utils';
|