@devgateway/dvz-ui-react 1.5.3 → 1.5.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../conf/index.js"),y=require("../../api/commons.js");function f(t){return JSON.parse(JSON.stringify(t))}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../conf/index.js"),y=require("../../api/commons.js");function f(t){return JSON.parse(JSON.stringify(t))}const l=process.env.VITE_REACT_APP_API_ROOT||S.Config.REACT_APP_API_ROOT||null,A=typeof window<"u"?window.location.origin:"",p={},g={},$=3*60*1e3;function C(t){return Object.keys(t).map(n=>encodeURIComponent(n)+"="+encodeURIComponent(t[n])).join("&")}function O(t,n=!1){const e=t,r=Date.now();if(g[e]&&r-g[e].timestamp<$)return Promise.resolve(f(g[e].data));if(p[e])return p[e].then(f);const c=y.get(t,{}).then(a=>(g[e]={data:a,timestamp:Date.now()},n?{data:f(a),meta:g[e].meta}:f(a))).finally(()=>{delete p[e]});return p[e]=c,c}const q=({app:t,params:n})=>{const e=`${l||A}/api/${t}/categories${n?"?"+C(n):""}`;return O(e)},I=({source:t,app:n,params:e})=>{const r=`${l||A}/api/${n}/stats/${t}${e?"?"+C(e):""}`;return O(r)},E=({postType:t,taxonomy:n,category:e,taxonomyFilters:r,before:c,perPage:a,page:T,locale:_,after:m})=>{const h=`${S.Config.REACT_APP_WP_API}/wp/v2/${t}`,i=new URLSearchParams,d=new Map,w=(s,o)=>{if(!s||o==null)return;const u=d.get(s)||[];Array.isArray(o)?o.forEach(P=>{P!=null&&u.push(String(P))}):u.push(String(o)),d.set(s,u)};r&&r instanceof Map&&r.forEach((s,o)=>{w(o,s)}),d.forEach((s,o)=>{const u=Array.from(new Set(s));i.set(o,u.join(","))}),c&&i.append("before",c.toISOString()),a&&i.append("per_page",a.toString()),i.append("page",T.toString()),i.append("locale",_),m&&i.append("after",m.toISOString());const R=i.toString().replace(/%2C/g,",");return y.get(`${h}?${R}`,{})};exports.getCategories=q;exports.getCustomPosts=E;exports.getData=I;
|
|
@@ -3,7 +3,7 @@ import { get as y } from "../../api/commons.js";
|
|
|
3
3
|
function p(n) {
|
|
4
4
|
return JSON.parse(JSON.stringify(n));
|
|
5
5
|
}
|
|
6
|
-
const g = process.env.VITE_REACT_APP_API_ROOT || S.REACT_APP_API_ROOT || null, A = typeof window < "u" ? window.location.origin :
|
|
6
|
+
const g = process.env.VITE_REACT_APP_API_ROOT || S.REACT_APP_API_ROOT || null, A = typeof window < "u" ? window.location.origin : "", l = {}, f = {}, C = 3 * 60 * 1e3;
|
|
7
7
|
function O(n) {
|
|
8
8
|
return Object.keys(n).map((t) => encodeURIComponent(t) + "=" + encodeURIComponent(n[t])).join("&");
|
|
9
9
|
}
|