@akad/sdk 1.0.9 → 1.0.10
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/main.d.ts +1 -1
- package/package.json +1 -1
- package/subscriber/index.d.ts +2 -1
- package/ts-lib.js +7 -9
- package/ts-lib.umd.cjs +1 -1
package/main.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ export default function sdkInitialize(config: Config): {
|
|
|
36
36
|
getReportStream: (data: import('./report/types').certificateReportType) => Promise<import('./report/types').certificateReportType>;
|
|
37
37
|
};
|
|
38
38
|
subscriber: {
|
|
39
|
-
getSubscriber: (cnpj: string) =>
|
|
39
|
+
getSubscriber: (cnpj: string) => Promise<import('./subscriber/types').getSubscriberType>;
|
|
40
40
|
};
|
|
41
41
|
};
|
package/package.json
CHANGED
package/subscriber/index.d.ts
CHANGED
package/ts-lib.js
CHANGED
|
@@ -1821,15 +1821,13 @@ const Ce = "auth", Cn = (e) => {
|
|
|
1821
1821
|
}, jn = "SubscriberData", In = (e) => {
|
|
1822
1822
|
const t = P(e);
|
|
1823
1823
|
return {
|
|
1824
|
-
getSubscriber: (r) =>
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
);
|
|
1832
|
-
}
|
|
1824
|
+
getSubscriber: (r) => t.request(
|
|
1825
|
+
`/${jn}/get-subscriber-data?cnpj=${r}`,
|
|
1826
|
+
{
|
|
1827
|
+
method: "GET",
|
|
1828
|
+
data: ""
|
|
1829
|
+
}
|
|
1830
|
+
)
|
|
1833
1831
|
};
|
|
1834
1832
|
};
|
|
1835
1833
|
function $n(e) {
|
package/ts-lib.umd.cjs
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
`)}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(s=>r.set(s)),r}static accessor(t){const r=(this[De]=this[De]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=H(i);r[c]||(Zt(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}}R.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(R.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(R);function oe(e,t){const n=this||I,r=t||n,s=R.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ue(e){return!!(e&&e.__CANCEL__)}function k(e,t,n){h.call(this,e??"canceled",h.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(k,h,{__CANCEL__:!0});function qe(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new h("Request failed with status code "+n.status,[h.ERR_BAD_REQUEST,h.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Yt(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function en(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=r[o];i||(i=l),n[s]=f,r[s]=l;let d=o,b=0;for(;d!==s;)b+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),l-i<t)return;const y=u&&l-u;return y?Math.round(b*1e3/y):void 0}}function tn(e,t){let n=0;const r=1e3/t;let s=null;return function(){const i=this===!0,c=Date.now();if(i||c-n>r)return s&&(clearTimeout(s),s=null),n=c,e.apply(null,arguments);s||(s=setTimeout(()=>(s=null,n=Date.now(),e.apply(null,arguments)),r-(c-n)))}}const v=(e,t,n=3)=>{let r=0;const s=en(50,250);return tn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-r,l=s(f),u=i<=c;r=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-i)/l:void 0,event:o,lengthComputable:c!=null};d[t?"download":"upload"]=!0,e(d)},n)},nn=A.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const c=a.isString(i)?s(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}(),rn=A.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(r)&&i.push("path="+r),a.isString(s)&&i.push("domain="+s),o===!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 sn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function on(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function je(e,t){return e&&!sn(t)?on(e,t):t}const $e=e=>e instanceof R?{...e}:e;function B(e,t){t=t||{};const n={};function r(l,u,d){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:d},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,d){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l,d)}else return r(l,u,d)}function o(l,u){if(!a.isUndefined(u))return r(void 0,u)}function i(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function c(l,u,d){if(d in t)return r(l,u);if(d in e)return r(void 0,l)}const f={url:o,method:o,data:o,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:c,headers:(l,u)=>s($e(l),$e(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=f[u]||s,b=d(e[u],t[u],u);a.isUndefined(b)&&d!==c||(n[u]=b)}),n}const Ie=e=>{const t=B({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;t.headers=i=R.from(i),t.url=Fe(je(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(a.isFormData(n)){if(A.hasStandardBrowserEnv||A.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[l,...u]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([l||"multipart/form-data",...u].join("; "))}}if(A.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&nn(t.url))){const l=s&&o&&rn.read(o);l&&i.set(s,l)}return t},an=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=Ie(e);let o=s.data;const i=R.from(s.headers).normalize();let{responseType:c}=s,f;function l(){s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let u=new XMLHttpRequest;u.open(s.method.toUpperCase(),s.url,!0),u.timeout=s.timeout;function d(){if(!u)return;const y=R.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!c||c==="text"||c==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:y,config:e,request:u};qe(function(g){n(g),l()},function(g){r(g),l()},m),u=null}"onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(d)},u.onabort=function(){u&&(r(new h("Request aborted",h.ECONNABORTED,s,u)),u=null)},u.onerror=function(){r(new h("Network Error",h.ERR_NETWORK,s,u)),u=null},u.ontimeout=function(){let p=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const m=s.transitional||_e;s.timeoutErrorMessage&&(p=s.timeoutErrorMessage),r(new h(p,m.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,s,u)),u=null},o===void 0&&i.setContentType(null),"setRequestHeader"in u&&a.forEach(i.toJSON(),function(p,m){u.setRequestHeader(m,p)}),a.isUndefined(s.withCredentials)||(u.withCredentials=!!s.withCredentials),c&&c!=="json"&&(u.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&u.addEventListener("progress",v(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",v(s.onUploadProgress)),(s.cancelToken||s.signal)&&(f=y=>{u&&(r(!y||y.type?new k(null,e,u):y),u.abort(),u=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const b=Yt(s.url);if(b&&A.protocols.indexOf(b)===-1){r(new h("Unsupported protocol "+b+":",h.ERR_BAD_REQUEST,e));return}u.send(o||null)})},cn=(e,t)=>{let n=new AbortController,r;const s=function(f){if(!r){r=!0,i();const l=f instanceof Error?f:this.reason;n.abort(l instanceof h?l:new k(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{s(new h(`timeout ${t} of ms exceeded`,h.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(f=>{f&&(f.removeEventListener?f.removeEventListener("abort",s):f.unsubscribe(s))}),e=null)};e.forEach(f=>f&&f.addEventListener&&f.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=i,[c,()=>{o&&clearTimeout(o),o=null}]},un=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},ln=async function*(e,t,n){for await(const r of e)yield*un(ArrayBuffer.isView(r)?r:await n(String(r)),t)},He=(e,t,n,r,s)=>{const o=ln(e,t,s);let i=0;return new ReadableStream({type:"bytes",async pull(c){const{done:f,value:l}=await o.next();if(f){c.close(),r();return}let u=l.byteLength;n&&n(i+=u),c.enqueue(new Uint8Array(l))},cancel(c){return r(c),o.return()}},{highWaterMark:2})},Me=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},Q=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Je=Q&&typeof ReadableStream=="function",ie=Q&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),fn=Je&&(()=>{let e=!1;const t=new Request(A.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),ze=64*1024,ae=Je&&!!(()=>{try{return a.isReadableStream(new Response("").body)}catch{}})(),X={stream:ae&&(e=>e.body)};Q&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!X[t]&&(X[t]=a.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new h(`Response type '${t}' is not supported`,h.ERR_NOT_SUPPORT,r)})})})(new Response);const dn=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(a.isArrayBufferView(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await ie(e)).byteLength},pn=async(e,t)=>{const n=a.toFiniteNumber(e.getContentLength());return n??dn(t)},ce={http:Dt,xhr:an,fetch:Q&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:b}=Ie(e);l=l?(l+"").toLowerCase():"text";let[y,p]=s||o||i?cn([s,o],i):[],m,E;const g=()=>{!m&&setTimeout(()=>{y&&y.unsubscribe()}),m=!0};let P;try{if(f&&fn&&n!=="get"&&n!=="head"&&(P=await pn(u,r))!==0){let x=new Request(t,{method:"POST",body:r,duplex:"half"}),U;a.isFormData(r)&&(U=x.headers.get("content-type"))&&u.setContentType(U),x.body&&(r=He(x.body,ze,Me(P,v(f)),null,ie))}a.isString(d)||(d=d?"cors":"omit"),E=new Request(t,{...b,signal:y,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",withCredentials:d});let w=await fetch(E);const M=ae&&(l==="stream"||l==="response");if(ae&&(c||M)){const x={};["status","statusText","headers"].forEach(Ze=>{x[Ze]=w[Ze]});const U=a.toFiniteNumber(w.headers.get("content-length"));w=new Response(He(w.body,ze,c&&Me(U,v(c,!0)),M&&g,ie),x)}l=l||"text";let _n=await X[a.findKey(X,l)||"text"](w,e);return!M&&g(),p&&p(),await new Promise((x,U)=>{qe(x,U,{data:_n,headers:R.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:E})})}catch(w){throw g(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new h("Network Error",h.ERR_NETWORK,e,E),{cause:w.cause||w}):h.from(w,w&&w.code,e,E)}})};a.forEach(ce,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ve=e=>`- ${e}`,hn=e=>a.isFunction(e)||e===null||e===!1,Ke={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o<t;o++){n=e[o];let i;if(r=n,!hn(n)&&(r=ce[(i=String(n)).toLowerCase()],r===void 0))throw new h(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since :
|
|
4
4
|
`+o.map(Ve).join(`
|
|
5
5
|
`):" "+Ve(o[0]):"as no adapter specified";throw new h("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:ce};function ue(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new k(null,e)}function Ge(e){return ue(e),e.headers=R.from(e.headers),e.data=oe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ke.getAdapter(e.adapter||I.adapter)(e).then(function(r){return ue(e),r.data=oe.call(e,e.transformResponse,r),r.headers=R.from(r.headers),r},function(r){return Ue(r)||(ue(e),r&&r.response&&(r.response.data=oe.call(e,e.transformResponse,r.response),r.response.headers=R.from(r.response.headers))),Promise.reject(r)})}const We="1.7.2",le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{le[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ve={};le.transitional=function(t,n,r){function s(o,i){return"[Axios v"+We+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new h(s(i," has been removed"+(n?" in "+n:"")),h.ERR_DEPRECATED);return n&&!ve[i]&&(ve[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};function mn(e,t,n){if(typeof e!="object")throw new h("options must be an object",h.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new h("option "+o+" must be "+f,h.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new h("Unknown option "+o,h.ERR_BAD_OPTION)}}const fe={assertOptions:mn,validators:le},C=fe.validators;class F{constructor(t){this.defaults=t,this.interceptors={request:new Le,response:new Le}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
-
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=B(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:C.transitional(C.boolean),forcedJSONParsing:C.transitional(C.boolean),clarifyTimeoutError:C.transitional(C.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:C.function,serialize:C.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=R.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,d=0,b;if(!f){const p=[Ge.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,l),b=p.length,u=Promise.resolve(n);d<b;)u=u.then(p[d++],p[d++]);return u}b=c.length;let y=n;for(d=0;d<b;){const p=c[d++],m=c[d++];try{y=p(y)}catch(E){m.call(this,E);break}}try{u=Ge.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,b=l.length;d<b;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=B(this.defaults,t);const n=je(t.baseURL,t.url);return Fe(n,t.params,t.paramsSerializer)}}a.forEach(["delete","get","head","options"],function(t){F.prototype[t]=function(n,r){return this.request(B(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(B(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}F.prototype[t]=n(),F.prototype[t+"Form"]=n(!0)});class de{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new k(o,i,c),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)}static source(){let t;return{token:new de(function(s){t=s}),cancel:t}}}function yn(e){return function(n){return e.apply(null,n)}}function bn(e){return a.isObject(e)&&e.isAxiosError===!0}const pe={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(pe).forEach(([e,t])=>{pe[t]=e});function Qe(e){const t=new F(e),n=L(F.prototype.request,t);return a.extend(n,F.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Qe(B(e,s))},n}const S=Qe(I);S.Axios=F,S.CanceledError=k,S.CancelToken=de,S.isCancel=Ue,S.VERSION=We,S.toFormData=G,S.AxiosError=h,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=yn,S.isAxiosError=bn,S.mergeConfig=B,S.AxiosHeaders=R,S.formToJSON=e=>ke(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=Ke.getAdapter,S.HttpStatusCode=pe,S.default=S;const N=e=>{var i,c;const t=S.create(),n=e.apiVersion,r=e.productCode,s=e.baseUrl;return e.responseInterceptor&&t.interceptors.response.use((i=e.responseInterceptor)==null?void 0:i.onFulfilled,(c=e.responseInterceptor)==null?void 0:c.onReject),{request:async(f,l)=>{const u=`${s}/${r}/${n}${f}`,d={"Content-Type":(l==null?void 0:l.contentType)||"application/json",apiVersion:n,Authorization:""};localStorage.getItem("accessToken")&&(d.Authorization="Bearer "+localStorage.getItem("accessToken"));const b={method:(l==null?void 0:l.method)||"GET",headers:d,url:u,data:l==null?void 0:l.data,responseType:l==null?void 0:l.responseType};return await t.request(b)}}},wn="cep";function Sn(e){const t=N(e);function n(r){return t.request(`/${wn}`,{method:"POST",data:JSON.stringify(r)})}return{getAddress:n}}const Xe="auth",En=e=>{const t=N(e);return{postLogin:async s=>{var i;const o=await t.request(`/${Xe}/login`,{method:"POST",data:JSON.stringify(s)});return o.status===200&&((i=o.data)!=null&&i.accessToken)&&localStorage.setItem("accessToken",o.data.accessToken),o},getToken:async s=>await t.request(`/${Xe}?code=${s}`,{method:"GET",data:""})}},gn="digital",Rn=e=>{const t=N(e);return{getBroker:()=>t.request(`/${gn}/getBroker`,{method:"GET",data:""})}},Tn="data",On=e=>{const t=N(e);return{postData:async r=>await t.request(`/${Tn}`,{method:"POST",data:JSON.stringify(r)})}},he="payment",An=e=>{const t=N(e);return{postPayment:o=>t.request(`/${he}`,{method:"POST",data:JSON.stringify(o)}),getPaymentStatus:o=>t.request(`/${he}/status?policyId=${o.policyId}`,{method:"GET",data:""}),getPaymentSummary:o=>t.request(`/${he}/summary?policyId=${o.policyId}`,{method:"GET",data:""})}},me="product/action",Nn=e=>{const t=N(e);return{getCnpjStatus:o=>t.request(`/${me}/Custom/CnpjCheck?cnpj=${o}`,{method:"GET",data:""}),getKeyNumber:()=>t.request(`/${me}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:o=>t.request(`/${me}/Custom/GetProposalNoByKeyNumber?keyNumber=${o.keyNumber}`,{method:"GET",data:""})}},D="quotation",Pn=e=>{const t=N(e);return{postQuickQuote:f=>t.request(`/${D}/QuickQuote`,{method:"POST",data:JSON.stringify(f)}),postFullQuote:f=>t.request(`/${D}/FullQuote`,{method:"POST",data:JSON.stringify(f)}),postBind:f=>t.request(`/${D}/Bind`,{method:"POST",data:JSON.stringify(f)}),getQuotation:f=>t.request(`/${D}?id=${f.policyId}`,{method:"GET",data:""}),getVersions:f=>t.request(`/${D}/versions?policyId=${f.policyId}`,{method:"GET",data:""}),switchSelectedVersion:f=>t.request(`/${D}/switchSelectedVersion?policyId=${f.policyId}"ationVersionId=${f.quotationVersionId}`,{method:"POST",data:JSON.stringify(f)})}},Cn="report",xn=e=>{const t=N(e);return{getReportStream:r=>{const s=new URLSearchParams({policyId:r.policyId,documentType:r.documentType||"certificate",...r.additionalParams});return t.request(`/${Cn}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},Bn="SubscriberData",Fn=e=>{const t=N(e);return{getSubscriber:r=>
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=B(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:C.transitional(C.boolean),forcedJSONParsing:C.transitional(C.boolean),clarifyTimeoutError:C.transitional(C.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:C.function,serialize:C.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=R.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,d=0,b;if(!f){const p=[Ge.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,l),b=p.length,u=Promise.resolve(n);d<b;)u=u.then(p[d++],p[d++]);return u}b=c.length;let y=n;for(d=0;d<b;){const p=c[d++],m=c[d++];try{y=p(y)}catch(E){m.call(this,E);break}}try{u=Ge.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,b=l.length;d<b;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=B(this.defaults,t);const n=je(t.baseURL,t.url);return Fe(n,t.params,t.paramsSerializer)}}a.forEach(["delete","get","head","options"],function(t){F.prototype[t]=function(n,r){return this.request(B(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(B(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}F.prototype[t]=n(),F.prototype[t+"Form"]=n(!0)});class de{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new k(o,i,c),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)}static source(){let t;return{token:new de(function(s){t=s}),cancel:t}}}function yn(e){return function(n){return e.apply(null,n)}}function bn(e){return a.isObject(e)&&e.isAxiosError===!0}const pe={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(pe).forEach(([e,t])=>{pe[t]=e});function Qe(e){const t=new F(e),n=L(F.prototype.request,t);return a.extend(n,F.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Qe(B(e,s))},n}const S=Qe(I);S.Axios=F,S.CanceledError=k,S.CancelToken=de,S.isCancel=Ue,S.VERSION=We,S.toFormData=G,S.AxiosError=h,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=yn,S.isAxiosError=bn,S.mergeConfig=B,S.AxiosHeaders=R,S.formToJSON=e=>ke(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=Ke.getAdapter,S.HttpStatusCode=pe,S.default=S;const N=e=>{var i,c;const t=S.create(),n=e.apiVersion,r=e.productCode,s=e.baseUrl;return e.responseInterceptor&&t.interceptors.response.use((i=e.responseInterceptor)==null?void 0:i.onFulfilled,(c=e.responseInterceptor)==null?void 0:c.onReject),{request:async(f,l)=>{const u=`${s}/${r}/${n}${f}`,d={"Content-Type":(l==null?void 0:l.contentType)||"application/json",apiVersion:n,Authorization:""};localStorage.getItem("accessToken")&&(d.Authorization="Bearer "+localStorage.getItem("accessToken"));const b={method:(l==null?void 0:l.method)||"GET",headers:d,url:u,data:l==null?void 0:l.data,responseType:l==null?void 0:l.responseType};return await t.request(b)}}},wn="cep";function Sn(e){const t=N(e);function n(r){return t.request(`/${wn}`,{method:"POST",data:JSON.stringify(r)})}return{getAddress:n}}const Xe="auth",En=e=>{const t=N(e);return{postLogin:async s=>{var i;const o=await t.request(`/${Xe}/login`,{method:"POST",data:JSON.stringify(s)});return o.status===200&&((i=o.data)!=null&&i.accessToken)&&localStorage.setItem("accessToken",o.data.accessToken),o},getToken:async s=>await t.request(`/${Xe}?code=${s}`,{method:"GET",data:""})}},gn="digital",Rn=e=>{const t=N(e);return{getBroker:()=>t.request(`/${gn}/getBroker`,{method:"GET",data:""})}},Tn="data",On=e=>{const t=N(e);return{postData:async r=>await t.request(`/${Tn}`,{method:"POST",data:JSON.stringify(r)})}},he="payment",An=e=>{const t=N(e);return{postPayment:o=>t.request(`/${he}`,{method:"POST",data:JSON.stringify(o)}),getPaymentStatus:o=>t.request(`/${he}/status?policyId=${o.policyId}`,{method:"GET",data:""}),getPaymentSummary:o=>t.request(`/${he}/summary?policyId=${o.policyId}`,{method:"GET",data:""})}},me="product/action",Nn=e=>{const t=N(e);return{getCnpjStatus:o=>t.request(`/${me}/Custom/CnpjCheck?cnpj=${o}`,{method:"GET",data:""}),getKeyNumber:()=>t.request(`/${me}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:o=>t.request(`/${me}/Custom/GetProposalNoByKeyNumber?keyNumber=${o.keyNumber}`,{method:"GET",data:""})}},D="quotation",Pn=e=>{const t=N(e);return{postQuickQuote:f=>t.request(`/${D}/QuickQuote`,{method:"POST",data:JSON.stringify(f)}),postFullQuote:f=>t.request(`/${D}/FullQuote`,{method:"POST",data:JSON.stringify(f)}),postBind:f=>t.request(`/${D}/Bind`,{method:"POST",data:JSON.stringify(f)}),getQuotation:f=>t.request(`/${D}?id=${f.policyId}`,{method:"GET",data:""}),getVersions:f=>t.request(`/${D}/versions?policyId=${f.policyId}`,{method:"GET",data:""}),switchSelectedVersion:f=>t.request(`/${D}/switchSelectedVersion?policyId=${f.policyId}"ationVersionId=${f.quotationVersionId}`,{method:"POST",data:JSON.stringify(f)})}},Cn="report",xn=e=>{const t=N(e);return{getReportStream:r=>{const s=new URLSearchParams({policyId:r.policyId,documentType:r.documentType||"certificate",...r.additionalParams});return t.request(`/${Cn}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},Bn="SubscriberData",Fn=e=>{const t=N(e);return{getSubscriber:r=>t.request(`/${Bn}/get-subscriber-data?cnpj=${r}`,{method:"GET",data:""})}};function Ln(e){const t=En(e),n=On(e),r=Pn(e),s=An(e),o=Sn(e),i=Rn(e),c=Nn(e),f=xn(e),l=Fn(e);return{auth:t,data:n,quotation:r,payment:s,address:o,broker:i,plugin:c,report:f,subscriber:l}}return Ln});
|