best-unit 2.0.17 → 2.0.25
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/dist/best-unit.cjs +1 -1
- package/dist/best-unit.js +1 -1
- package/dist/types/global.d.ts +4 -4
- package/package.json +1 -1
- package/src/demo/App.tsx +1 -1
- package/src/types/global.d.ts +4 -4
- package/src/utils/business/index.ts +3 -3
package/dist/best-unit.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[Pt]=this[Pt]={accessors:{}}).accessors,o=this.prototype;function a(i){const s=pe(i);r[s]||(bo(o,i),r[s]=!0)}return g.isArray(t)?t.forEach(a):a(t),this}};q.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);g.reduceDescriptors(q.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});g.freezeMethods(q);function Ye(e,t){const n=this||_e,r=t||n,o=q.from(r.headers);let a=r.data;return g.forEach(e,function(s){a=s.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Mn(e){return!!(e&&e.__CANCEL__)}function ce(e,t,n){C.call(this,e??"canceled",C.ERR_CANCELED,t,n),this.name="CanceledError"}g.inherits(ce,C,{__CANCEL__:!0});function Bn(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new C("Request failed with status code "+n.status,[C.ERR_BAD_REQUEST,C.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function yo(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function xo(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(f){const c=Date.now(),p=r[a];i||(i=c),n[o]=f,r[o]=c;let u=a,x=0;for(;u!==o;)x+=n[u++],u=u%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),c-i<t)return;const m=p&&c-p;return m?Math.round(x*1e3/m):void 0}}function _o(e,t){let n=0,r=1e3/t,o,a;const i=(c,p=Date.now())=>{n=p,o=null,a&&(clearTimeout(a),a=null),e.apply(null,c)};return[(...c)=>{const p=Date.now(),u=p-n;u>=r?i(c,p):(o=c,a||(a=setTimeout(()=>{a=null,i(o)},r-u)))},()=>o&&i(o)]}const Re=(e,t,n=3)=>{let r=0;const o=xo(50,250);return _o(a=>{const i=a.loaded,s=a.lengthComputable?a.total:void 0,f=i-r,c=o(f),p=i<=s;r=i;const u={loaded:i,total:s,progress:s?i/s:void 0,bytes:f,rate:c||void 0,estimated:c&&s&&p?(s-i)/c:void 0,event:a,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(u)},n)},Nt=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ut=e=>(...t)=>g.asap(()=>e(...t)),So=$.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($.origin),$.navigator&&/(msie|trident)/i.test($.navigator.userAgent)):()=>!0,Lo=$.hasStandardBrowserEnv?{write(e,t,n,r,o,a){const i=[e+"="+encodeURIComponent(t)];g.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),g.isString(r)&&i.push("path="+r),g.isString(o)&&i.push("domain="+o),a===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function wo(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ao(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Rn(e,t,n){let r=!wo(t);return e&&(r||n==!1)?Ao(e,t):t}const Wt=e=>e instanceof q?{...e}:e;function te(e,t){t=t||{};const n={};function r(c,p,u,x){return g.isPlainObject(c)&&g.isPlainObject(p)?g.merge.call({caseless:x},c,p):g.isPlainObject(p)?g.merge({},p):g.isArray(p)?p.slice():p}function o(c,p,u,x){if(g.isUndefined(p)){if(!g.isUndefined(c))return r(void 0,c,u,x)}else return r(c,p,u,x)}function a(c,p){if(!g.isUndefined(p))return r(void 0,p)}function i(c,p){if(g.isUndefined(p)){if(!g.isUndefined(c))return r(void 0,c)}else return r(void 0,p)}function s(c,p,u){if(u in t)return r(c,p);if(u in e)return r(void 0,c)}const f={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(c,p,u)=>o(Wt(c),Wt(p),u,!0)};return g.forEach(Object.keys(Object.assign({},e,t)),function(p){const u=f[p]||o,x=u(e[p],t[p],p);g.isUndefined(x)&&u!==s||(n[p]=x)}),n}const Fn=e=>{const t=te({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:s}=t;t.headers=i=q.from(i),t.url=Cn(Rn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let f;if(g.isFormData(n)){if($.hasStandardBrowserEnv||$.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[c,...p]=f?f.split(";").map(u=>u.trim()).filter(Boolean):[];i.setContentType([c||"multipart/form-data",...p].join("; "))}}if($.hasStandardBrowserEnv&&(r&&g.isFunction(r)&&(r=r(t)),r||r!==!1&&So(t.url))){const c=o&&a&&Lo.read(a);c&&i.set(o,c)}return t},ko=typeof XMLHttpRequest<"u",Eo=ko&&function(e){return new Promise(function(n,r){const o=Fn(e);let a=o.data;const i=q.from(o.headers).normalize();let{responseType:s,onUploadProgress:f,onDownloadProgress:c}=o,p,u,x,m,h;function _(){m&&m(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(p),o.signal&&o.signal.removeEventListener("abort",p)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function S(){if(!b)return;const M=q.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),T={data:!s||s==="text"||s==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:M,config:e,request:b};Bn(function(P){n(P),_()},function(P){r(P),_()},T),b=null}"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(S)},b.onabort=function(){b&&(r(new C("Request aborted",C.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new C("Network Error",C.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let A=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const T=o.transitional||vn;o.timeoutErrorMessage&&(A=o.timeoutErrorMessage),r(new C(A,T.clarifyTimeoutError?C.ETIMEDOUT:C.ECONNABORTED,e,b)),b=null},a===void 0&&i.setContentType(null),"setRequestHeader"in b&&g.forEach(i.toJSON(),function(A,T){b.setRequestHeader(T,A)}),g.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),s&&s!=="json"&&(b.responseType=o.responseType),c&&([x,h]=Re(c,!0),b.addEventListener("progress",x)),f&&b.upload&&([u,m]=Re(f),b.upload.addEventListener("progress",u),b.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(p=M=>{b&&(r(!M||M.type?new ce(null,e,b):M),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(p),o.signal&&(o.signal.aborted?p():o.signal.addEventListener("abort",p)));const L=yo(o.url);if(L&&$.protocols.indexOf(L)===-1){r(new C("Unsupported protocol "+L+":",C.ERR_BAD_REQUEST,e));return}b.send(a||null)})},Co=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const a=function(c){if(!o){o=!0,s();const p=c instanceof Error?c:this.reason;r.abort(p instanceof C?p:new ce(p instanceof Error?p.message:p))}};let i=t&&setTimeout(()=>{i=null,a(new C(`timeout ${t} of ms exceeded`,C.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>c.addEventListener("abort",a));const{signal:f}=r;return f.unsubscribe=()=>g.asap(s),f}},vo=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},To=async function*(e,t){for await(const n of Mo(e))yield*vo(n,t)},Mo=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},$t=(e,t,n,r)=>{const o=To(e,t);let a=0,i,s=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:c,value:p}=await o.next();if(c){s(),f.close();return}let u=p.byteLength;if(n){let x=a+=u;n(x)}f.enqueue(new Uint8Array(p))}catch(c){throw s(c),c}},cancel(f){return s(f),o.return()}},{highWaterMark:2})},He=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",In=He&&typeof ReadableStream=="function",Bo=He&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Dn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ro=In&&Dn(()=>{let e=!1;const t=new Request($.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ht=64*1024,nt=In&&Dn(()=>g.isReadableStream(new Response("").body)),Fe={stream:nt&&(e=>e.body)};He&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Fe[t]&&(Fe[t]=g.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new C(`Response type '${t}' is not supported`,C.ERR_NOT_SUPPORT,r)})})})(new Response);const Fo=async e=>{if(e==null)return 0;if(g.isBlob(e))return e.size;if(g.isSpecCompliantForm(e))return(await new Request($.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(g.isArrayBufferView(e)||g.isArrayBuffer(e))return e.byteLength;if(g.isURLSearchParams(e)&&(e=e+""),g.isString(e))return(await Bo(e)).byteLength},Io=async(e,t)=>{const n=g.toFiniteNumber(e.getContentLength());return n??Fo(t)},Do=He&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:a,timeout:i,onDownloadProgress:s,onUploadProgress:f,responseType:c,headers:p,withCredentials:u="same-origin",fetchOptions:x}=Fn(e);c=c?(c+"").toLowerCase():"text";let m=Co([o,a&&a.toAbortSignal()],i),h;const _=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let b;try{if(f&&Ro&&n!=="get"&&n!=="head"&&(b=await Io(p,r))!==0){let T=new Request(t,{method:"POST",body:r,duplex:"half"}),R;if(g.isFormData(r)&&(R=T.headers.get("content-type"))&&p.setContentType(R),T.body){const[P,w]=Nt(b,Re(Ut(f)));r=$t(T.body,Ht,P,w)}}g.isString(u)||(u=u?"include":"omit");const S="credentials"in Request.prototype;h=new Request(t,{...x,signal:m,method:n.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:S?u:void 0});let L=await fetch(h,x);const M=nt&&(c==="stream"||c==="response");if(nt&&(s||M&&_)){const T={};["status","statusText","headers"].forEach(F=>{T[F]=L[F]});const R=g.toFiniteNumber(L.headers.get("content-length")),[P,w]=s&&Nt(R,Re(Ut(s),!0))||[];L=new Response($t(L.body,Ht,P,()=>{w&&w(),_&&_()}),T)}c=c||"text";let A=await Fe[g.findKey(Fe,c)||"text"](L,e);return!M&&_&&_(),await new Promise((T,R)=>{Bn(T,R,{data:A,headers:q.from(L.headers),status:L.status,statusText:L.statusText,config:e,request:h})})}catch(S){throw _&&_(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new C("Network Error",C.ERR_NETWORK,e,h),{cause:S.cause||S}):C.from(S,S&&S.code,e,h)}}),rt={http:Gr,xhr:Eo,fetch:Do};g.forEach(rt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const jt=e=>`- ${e}`,zo=e=>g.isFunction(e)||e===null||e===!1,zn={getAdapter:e=>{e=g.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let a=0;a<t;a++){n=e[a];let i;if(r=n,!zo(n)&&(r=rt[(i=String(n)).toLowerCase()],r===void 0))throw new C(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+a]=r}if(!r){const a=Object.entries(o).map(([s,f])=>`adapter ${s} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?a.length>1?`since :
|
|
4
4
|
`+a.map(jt).join(`
|
|
5
5
|
`):" "+jt(a[0]):"as no adapter specified";throw new C("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:rt};function Ge(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ce(null,e)}function qt(e){return Ge(e),e.headers=q.from(e.headers),e.data=Ye.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),zn.getAdapter(e.adapter||_e.adapter)(e).then(function(r){return Ge(e),r.data=Ye.call(e,e.transformResponse,r),r.headers=q.from(r.headers),r},function(r){return Mn(r)||(Ge(e),r&&r.response&&(r.response.data=Ye.call(e,e.transformResponse,r.response),r.response.headers=q.from(r.response.headers))),Promise.reject(r)})}const On="1.10.0",je={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{je[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Jt={};je.transitional=function(t,n,r){function o(a,i){return"[Axios v"+On+"] Transitional option '"+a+"'"+i+(r?". "+r:"")}return(a,i,s)=>{if(t===!1)throw new C(o(i," has been removed"+(n?" in "+n:"")),C.ERR_DEPRECATED);return n&&!Jt[i]&&(Jt[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,s):!0}};je.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Oo(e,t,n){if(typeof e!="object")throw new C("options must be an object",C.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],i=t[a];if(i){const s=e[a],f=s===void 0||i(s,a,e);if(f!==!0)throw new C("option "+a+" must be "+f,C.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new C("Unknown option "+a,C.ERR_BAD_OPTION)}}const ve={assertOptions:Oo,validators:je},G=ve.validators;let ee=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ot,response:new Ot}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
-
`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=te(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&ve.assertOptions(r,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),o!=null&&(g.isFunction(o)?n.paramsSerializer={serialize:o}:ve.assertOptions(o,{encode:G.function,serialize:G.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ve.assertOptions(n,{baseUrl:G.spelling("baseURL"),withXsrfToken:G.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&g.merge(a.common,a[n.method]);a&&g.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),n.headers=q.concat(i,a);const s=[];let f=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(f=f&&_.synchronous,s.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let p,u=0,x;if(!f){const h=[qt.bind(this),void 0];for(h.unshift.apply(h,s),h.push.apply(h,c),x=h.length,p=Promise.resolve(n);u<x;)p=p.then(h[u++],h[u++]);return p}x=s.length;let m=n;for(u=0;u<x;){const h=s[u++],_=s[u++];try{m=h(m)}catch(b){_.call(this,b);break}}try{p=qt.call(this,m)}catch(h){return Promise.reject(h)}for(u=0,x=c.length;u<x;)p=p.then(c[u++],c[u++]);return p}getUri(t){t=te(this.defaults,t);const n=Rn(t.baseURL,t.url,t.allowAbsoluteUrls);return Cn(n,t.params,t.paramsSerializer)}};g.forEach(["delete","get","head","options"],function(t){ee.prototype[t]=function(n,r){return this.request(te(r||{},{method:t,url:n,data:(r||{}).data}))}});g.forEach(["post","put","patch"],function(t){function n(r){return function(a,i,s){return this.request(te(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}ee.prototype[t]=n(),ee.prototype[t+"Form"]=n(!0)});let Po=class Pn{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new ce(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Pn(function(o){t=o}),cancel:t}}};function No(e){return function(n){return e.apply(null,n)}}function Uo(e){return g.isObject(e)&&e.isAxiosError===!0}const ot={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ot).forEach(([e,t])=>{ot[t]=e});function Nn(e){const t=new ee(e),n=mn(ee.prototype.request,t);return g.extend(n,ee.prototype,t,{allOwnKeys:!0}),g.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Nn(te(e,o))},n}const z=Nn(_e);z.Axios=ee;z.CanceledError=ce;z.CancelToken=Po;z.isCancel=Mn;z.VERSION=On;z.toFormData=$e;z.AxiosError=C;z.Cancel=z.CanceledError;z.all=function(t){return Promise.all(t)};z.spread=No;z.isAxiosError=Uo;z.mergeConfig=te;z.AxiosHeaders=q;z.formToJSON=e=>Tn(g.isHTMLForm(e)?new FormData(e):e);z.getAdapter=zn.getAdapter;z.HttpStatusCode=ot;z.default=z;const{Axios:da,AxiosError:ua,CanceledError:fa,isCancel:pa,CancelToken:ha,VERSION:ma,all:ga,Cancel:ba,isAxiosError:ya,spread:xa,toFormData:_a,AxiosHeaders:Sa,HttpStatusCode:La,formToJSON:wa,getAdapter:Aa,mergeConfig:ka}=z;function Wo(e={}){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log("fundUnitParams",t);const{env:n}=t;let r;switch(n){case oe.DEV:case oe.DEVELOPMENT:r="/api";break;case oe.TEST:r="https://fund.bestfulfill.tech/api/sdk";break;case oe.PROD:case oe.PRODUCTION:default:r="https://fund.bestfulfill.com/api/sdk";break}const{baseURL:o=r,timeout:a=1e4,onError:i}=e,s=z.create({baseURL:o,timeout:a});return s.interceptors.request.use(f=>{const{token:c,locale:p}=t;return f.headers={...f.headers,Authorization:c,"x-locale":p===Oe.ZH?"zh-CN":"en-US"},f}),s.interceptors.response.use(f=>{if(f.data&&f.data.code===0)return f.data;const c=f.data?.msg||f.data?.message||"未知错误";return Ie.error(c),i&&i(c,f),Promise.reject(f.data||{message:"未知错误"})},f=>{const c=f.response?.data?.msg||f.response?.data?.message||f.message||"网络请求失败";return Ie.error(c),i&&i(c,f),Promise.reject(f)}),s}let Te=null;function X(){return Te||(Te=Wo()),Te}function $o(){Te=null}function Un(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data,r={fundBalanceId:n.fund_balance_id,merchantId:n.merchant_id,bizType:n.biz_type,currency:n.currency,totalAmount:n.total_amount,frozenAmount:n.frozen_amount,creditLimit:n.credit_config?.credit_limit,creditUsed:n.credit_used,isCredit:!!n.credit_config,availableAmount:n.available_amount,currBalance:n.curr_balance,pendingAmount:n.pending_amount,status:n.status,createdAt:n.created_at};return sessionStorage.setItem("balanceData",JSON.stringify(r)),r})}const Ho=async()=>X().get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),jo=async()=>{const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/currency",{params:{biz_type:e.bizType}}).then(t=>t.data.currency.map(n=>({value:n.value,label:n.label}))||[])},qo=async(e,t)=>X().post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),Wn=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,transfer_no:e.transferNo,transfer_date:e.transferDate,transfer_channel:e.transferChannel,payer_name:e.payerName,submit_amount:e.submitAmount,submit_currency:e.submitCurrency,voucher_urls:e.voucherUrls,metadata:t.bizType==="ad"?{transaction_reason:"OfflineRecharge"}:void 0};return X().post("/offline/recharge/create",n,{})},$n=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href,metadata:t.bizType==="ad"?{transaction_reason:"OnlineRecharge"}:void 0};return X().post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},Hn=async e=>X().get("/calc-payment-amount",{params:e}).then(t=>{const n=t.data;return{paymentAmount:n.payment_amount,fee:n.fee,currency:n.currency}}),jn=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/channel/info",{params:{code:e.code,biz_type:t.bizType}}).then(n=>n.data?.detail||[])},Jo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/offline/channel/map",{params:{currency:e.currency,biz_type:t.bizType}}).then(n=>({onlineChannel:n.data?.online_channels.map(r=>({value:r.value,label:r.label,icon:r.icon}))||[],offlineChannel:n.data?.offline_channels.map(r=>({value:r.value,label:r.label,icon:r.icon}))||[]}))},Vo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().post("/business_exchange_rate/calculate",{fund_balance_id:t.fundBalanceId,merchant_id:t.merchantId,biz_type:t.bizType,amount:e.amount,payment_currency:e.currency}).then(n=>({amount:n.data.amount,exchangeRate:n.data.exchange_rate,currency:n.data.currency,consistent:n.data.consistent}))};async function Yo(){return await Un()}function Go(e){const{merchant_id:t,biz_type:n,fund_balance_id:r,user_id:o,theme:a=N.WHITE,locale:i=Oe.ZH,env:s,size:f,themeConfig:c}=e;console.log(e,"InitParams1111");const p="Bearer "+e.token;return sessionStorage.setItem("fund_unit_params",JSON.stringify({merchantId:t,bizType:n,fundBalanceId:r,userId:o,token:p,theme:a,locale:i,env:s,size:f,themeConfig:c})),$o(),Ho(),{token:p,merchantId:t,bizType:n,fundBalanceId:r,userId:o,theme:a,locale:i,env:s,size:f}}function E(e){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");if(!e)return t;if(Array.isArray(e)){const n={};return e.forEach(r=>{n[r]=t[r]}),n}return t[e]}function qn(){const e=new CustomEvent("refresh-balance",{detail:{},bubbles:!0,composed:!0});window.dispatchEvent(e)}const Vt={white:{background:"#fff",border:"#d9d9d9",color:"#222",boxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeColor:"#999"},dark:{background:"#23262F",border:"#444C5C",color:"#F5F6FA",boxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeColor:"#B5B8BE"}};function Ko(){return E("theme")===N.WHITE?Vt.white:Vt.dark}class Xo{parseArg(t){return typeof t=="string"?{content:t}:t}show(t,n){const{content:r,duration:o,closable:a}=this.parseArg(n),i=Ko(),s=document.createElement("div");if(s.style.cssText=`
|
|
6
|
+
`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=te(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&ve.assertOptions(r,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),o!=null&&(g.isFunction(o)?n.paramsSerializer={serialize:o}:ve.assertOptions(o,{encode:G.function,serialize:G.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ve.assertOptions(n,{baseUrl:G.spelling("baseURL"),withXsrfToken:G.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&g.merge(a.common,a[n.method]);a&&g.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),n.headers=q.concat(i,a);const s=[];let f=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(f=f&&_.synchronous,s.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let p,u=0,x;if(!f){const h=[qt.bind(this),void 0];for(h.unshift.apply(h,s),h.push.apply(h,c),x=h.length,p=Promise.resolve(n);u<x;)p=p.then(h[u++],h[u++]);return p}x=s.length;let m=n;for(u=0;u<x;){const h=s[u++],_=s[u++];try{m=h(m)}catch(b){_.call(this,b);break}}try{p=qt.call(this,m)}catch(h){return Promise.reject(h)}for(u=0,x=c.length;u<x;)p=p.then(c[u++],c[u++]);return p}getUri(t){t=te(this.defaults,t);const n=Rn(t.baseURL,t.url,t.allowAbsoluteUrls);return Cn(n,t.params,t.paramsSerializer)}};g.forEach(["delete","get","head","options"],function(t){ee.prototype[t]=function(n,r){return this.request(te(r||{},{method:t,url:n,data:(r||{}).data}))}});g.forEach(["post","put","patch"],function(t){function n(r){return function(a,i,s){return this.request(te(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}ee.prototype[t]=n(),ee.prototype[t+"Form"]=n(!0)});let Po=class Pn{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new ce(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Pn(function(o){t=o}),cancel:t}}};function No(e){return function(n){return e.apply(null,n)}}function Uo(e){return g.isObject(e)&&e.isAxiosError===!0}const ot={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ot).forEach(([e,t])=>{ot[t]=e});function Nn(e){const t=new ee(e),n=mn(ee.prototype.request,t);return g.extend(n,ee.prototype,t,{allOwnKeys:!0}),g.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Nn(te(e,o))},n}const z=Nn(_e);z.Axios=ee;z.CanceledError=ce;z.CancelToken=Po;z.isCancel=Mn;z.VERSION=On;z.toFormData=$e;z.AxiosError=C;z.Cancel=z.CanceledError;z.all=function(t){return Promise.all(t)};z.spread=No;z.isAxiosError=Uo;z.mergeConfig=te;z.AxiosHeaders=q;z.formToJSON=e=>Tn(g.isHTMLForm(e)?new FormData(e):e);z.getAdapter=zn.getAdapter;z.HttpStatusCode=ot;z.default=z;const{Axios:da,AxiosError:ua,CanceledError:fa,isCancel:pa,CancelToken:ha,VERSION:ma,all:ga,Cancel:ba,isAxiosError:ya,spread:xa,toFormData:_a,AxiosHeaders:Sa,HttpStatusCode:La,formToJSON:wa,getAdapter:Aa,mergeConfig:ka}=z;function Wo(e={}){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log("fundUnitParams",t);const{env:n}=t;let r;switch(n){case oe.DEV:case oe.DEVELOPMENT:r="/api";break;case oe.TEST:r="https://fund.bestfulfill.tech/api/sdk";break;case oe.PROD:case oe.PRODUCTION:default:r="https://fund.bestfulfill.com/api/sdk";break}const{baseURL:o=r,timeout:a=1e4,onError:i}=e,s=z.create({baseURL:o,timeout:a});return s.interceptors.request.use(f=>{const{token:c,locale:p}=t;return f.headers={...f.headers,Authorization:c,"x-locale":p===Oe.ZH?"zh-CN":"en-US"},f}),s.interceptors.response.use(f=>{if(f.data&&f.data.code===0)return f.data;const c=f.data?.msg||f.data?.message||"未知错误";return Ie.error(c),i&&i(c,f),Promise.reject(f.data||{message:"未知错误"})},f=>{const c=f.response?.data?.msg||f.response?.data?.message||f.message||"网络请求失败";return Ie.error(c),i&&i(c,f),Promise.reject(f)}),s}let Te=null;function X(){return Te||(Te=Wo()),Te}function $o(){Te=null}function Un(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data,r={fundBalanceId:n.fund_balance_id,merchantId:n.merchant_id,bizType:n.biz_type,currency:n.currency,totalAmount:n.total_amount,frozenAmount:n.frozen_amount,creditLimit:n.credit_config?.credit_limit,creditUsed:n.credit_used,isCredit:!!n.credit_config,availableAmount:n.available_amount,currBalance:n.curr_balance,pendingAmount:n.pending_amount,status:n.status,createdAt:n.created_at};return sessionStorage.setItem("balanceData",JSON.stringify(r)),r})}const Ho=async()=>X().get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),jo=async()=>{const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/currency",{params:{biz_type:e.bizType}}).then(t=>t.data.currency.map(n=>({value:n.value,label:n.label}))||[])},qo=async(e,t)=>X().post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),Wn=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,transfer_no:e.transferNo,transfer_date:e.transferDate,transfer_channel:e.transferChannel,payer_name:e.payerName,submit_amount:e.submitAmount,submit_currency:e.submitCurrency,voucher_urls:e.voucherUrls,metadata:t.bizType==="ad"?{transaction_reason:"OfflineRecharge"}:void 0};return X().post("/offline/recharge/create",n,{})},$n=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href,metadata:t.bizType==="ad"?{transaction_reason:"OnlineRecharge"}:void 0};return X().post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},Hn=async e=>X().get("/calc-payment-amount",{params:e}).then(t=>{const n=t.data;return{paymentAmount:n.payment_amount,fee:n.fee,currency:n.currency}}),jn=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/channel/info",{params:{code:e.code,biz_type:t.bizType}}).then(n=>n.data?.detail||[])},Jo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/offline/channel/map",{params:{currency:e.currency,biz_type:t.bizType}}).then(n=>({onlineChannel:n.data?.online_channels.map(r=>({value:r.value,label:r.label,icon:r.icon}))||[],offlineChannel:n.data?.offline_channels.map(r=>({value:r.value,label:r.label,icon:r.icon}))||[]}))},Vo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().post("/business_exchange_rate/calculate",{fund_balance_id:t.fundBalanceId,merchant_id:t.merchantId,biz_type:t.bizType,amount:e.amount,payment_currency:e.currency}).then(n=>({amount:n.data.amount,exchangeRate:n.data.exchange_rate,currency:n.data.currency,consistent:n.data.consistent}))};async function Yo(){return await Un()}function Go(e){const{merchant_id:t,biz_type:n,fund_balance_id:r,user_id:o,theme:a=N.WHITE,locale:i=Oe.ZH,env:s,size:f,theme_config:c}=e;console.log(e,"InitParams1111");const p="Bearer "+e.token;return sessionStorage.setItem("fund_unit_params",JSON.stringify({merchantId:t,bizType:n,fundBalanceId:r,userId:o,token:p,theme:a,locale:i,env:s,size:f,themeConfig:c})),$o(),Ho(),{token:p,merchantId:t,bizType:n,fundBalanceId:r,userId:o,theme:a,locale:i,env:s,size:f}}function E(e){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");if(!e)return t;if(Array.isArray(e)){const n={};return e.forEach(r=>{n[r]=t[r]}),n}return t[e]}function qn(){const e=new CustomEvent("refresh-balance",{detail:{},bubbles:!0,composed:!0});window.dispatchEvent(e)}const Vt={white:{background:"#fff",border:"#d9d9d9",color:"#222",boxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeColor:"#999"},dark:{background:"#23262F",border:"#444C5C",color:"#F5F6FA",boxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeColor:"#B5B8BE"}};function Ko(){return E("theme")===N.WHITE?Vt.white:Vt.dark}class Xo{parseArg(t){return typeof t=="string"?{content:t}:t}show(t,n){const{content:r,duration:o,closable:a}=this.parseArg(n),i=Ko(),s=document.createElement("div");if(s.style.cssText=`
|
|
7
7
|
position: fixed;
|
|
8
8
|
top: 20px;
|
|
9
9
|
left: 50%;
|
package/dist/best-unit.js
CHANGED
package/dist/types/global.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface InitParams {
|
|
|
49
49
|
locale?: Locale;
|
|
50
50
|
env: Env;
|
|
51
51
|
size?: Size;
|
|
52
|
-
|
|
52
|
+
theme_config?: ThemeConfig;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface ThemeConfig {
|
|
@@ -81,7 +81,7 @@ export declare function initFundUnit(params: {
|
|
|
81
81
|
locale?: Locale;
|
|
82
82
|
env: Env;
|
|
83
83
|
size?: Size;
|
|
84
|
-
|
|
84
|
+
theme_config?: ThemeConfig;
|
|
85
85
|
}): {
|
|
86
86
|
token: string;
|
|
87
87
|
merchantId?: string;
|
|
@@ -91,7 +91,7 @@ export declare function initFundUnit(params: {
|
|
|
91
91
|
locale: Locale;
|
|
92
92
|
env: Env;
|
|
93
93
|
size?: Size;
|
|
94
|
-
|
|
94
|
+
theme_config?: ThemeConfig;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export declare function getBalanceData(): Promise<BalanceData>;
|
|
@@ -120,7 +120,7 @@ declare global {
|
|
|
120
120
|
locale?: "zh" | "en";
|
|
121
121
|
theme?: Theme;
|
|
122
122
|
size?: Size;
|
|
123
|
-
|
|
123
|
+
theme_config?: ThemeConfig;
|
|
124
124
|
env: Env;
|
|
125
125
|
}) => void;
|
|
126
126
|
getBalanceData: () => any;
|
package/package.json
CHANGED
package/src/demo/App.tsx
CHANGED
package/src/types/global.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface InitParams {
|
|
|
49
49
|
locale?: Locale;
|
|
50
50
|
env: Env;
|
|
51
51
|
size?: Size;
|
|
52
|
-
|
|
52
|
+
theme_config?: ThemeConfig;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface ThemeConfig {
|
|
@@ -81,7 +81,7 @@ export declare function initFundUnit(params: {
|
|
|
81
81
|
locale?: Locale;
|
|
82
82
|
env: Env;
|
|
83
83
|
size?: Size;
|
|
84
|
-
|
|
84
|
+
theme_config?: ThemeConfig;
|
|
85
85
|
}): {
|
|
86
86
|
token: string;
|
|
87
87
|
merchantId?: string;
|
|
@@ -91,7 +91,7 @@ export declare function initFundUnit(params: {
|
|
|
91
91
|
locale: Locale;
|
|
92
92
|
env: Env;
|
|
93
93
|
size?: Size;
|
|
94
|
-
|
|
94
|
+
theme_config?: ThemeConfig;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export declare function getBalanceData(): Promise<BalanceData>;
|
|
@@ -120,7 +120,7 @@ declare global {
|
|
|
120
120
|
locale?: "zh" | "en";
|
|
121
121
|
theme?: Theme;
|
|
122
122
|
size?: Size;
|
|
123
|
-
|
|
123
|
+
theme_config?: ThemeConfig;
|
|
124
124
|
env: Env;
|
|
125
125
|
}) => void;
|
|
126
126
|
getBalanceData: () => any;
|
|
@@ -38,7 +38,7 @@ export interface InitParams {
|
|
|
38
38
|
locale?: Locale;
|
|
39
39
|
env: Env;
|
|
40
40
|
size?: Size;
|
|
41
|
-
|
|
41
|
+
theme_config?: ThemeConfig;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// 获取余额数据并暴露给外部系统
|
|
@@ -61,7 +61,7 @@ export function initFundUnit(params: InitParams) {
|
|
|
61
61
|
locale = Locale.ZH,
|
|
62
62
|
env,
|
|
63
63
|
size,
|
|
64
|
-
|
|
64
|
+
theme_config,
|
|
65
65
|
} = params;
|
|
66
66
|
console.log(params, "InitParams1111");
|
|
67
67
|
const token = "Bearer " + params.token;
|
|
@@ -77,7 +77,7 @@ export function initFundUnit(params: InitParams) {
|
|
|
77
77
|
locale,
|
|
78
78
|
env,
|
|
79
79
|
size,
|
|
80
|
-
themeConfig,
|
|
80
|
+
themeConfig: theme_config,
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
83
|
// 重置 axios 实例,确保使用新的配置
|