@akad/sdk 1.0.13 → 1.0.14
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/base.d.ts +1 -0
- package/package.json +1 -1
- package/ts-lib.js +47 -46
- package/ts-lib.umd.cjs +1 -1
package/base.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type Config = {
|
|
|
4
4
|
apiVersion: string;
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
productCode: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
7
8
|
responseInterceptor?: {
|
|
8
9
|
onFulfilled: (value: AxiosResponse) => AxiosResponse | Promise<typeof value>;
|
|
9
10
|
onReject: (error: AxiosError) => Promise<typeof error> | Promise<never>;
|
package/package.json
CHANGED
package/ts-lib.js
CHANGED
|
@@ -64,7 +64,7 @@ const yt = (e, t, n, { allOwnKeys: r } = {}) => (I(t, (s, o) => {
|
|
|
64
64
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
65
65
|
value: t.prototype
|
|
66
66
|
}), n && Object.assign(e.prototype, n);
|
|
67
|
-
},
|
|
67
|
+
}, St = (e, t, n, r) => {
|
|
68
68
|
let s, o, i;
|
|
69
69
|
const u = {};
|
|
70
70
|
if (t = t || {}, e == null)
|
|
@@ -75,7 +75,7 @@ const yt = (e, t, n, { allOwnKeys: r } = {}) => (I(t, (s, o) => {
|
|
|
75
75
|
e = n !== !1 && ue(e);
|
|
76
76
|
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
77
77
|
return t;
|
|
78
|
-
},
|
|
78
|
+
}, gt = (e, t, n) => {
|
|
79
79
|
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
80
80
|
const r = e.indexOf(t, n);
|
|
81
81
|
return r !== -1 && r === n;
|
|
@@ -200,10 +200,10 @@ const kt = (e) => {
|
|
|
200
200
|
trim: mt,
|
|
201
201
|
stripBOM: bt,
|
|
202
202
|
inherits: wt,
|
|
203
|
-
toFlatObject:
|
|
203
|
+
toFlatObject: St,
|
|
204
204
|
kindOf: G,
|
|
205
205
|
kindOfTest: A,
|
|
206
|
-
endsWith:
|
|
206
|
+
endsWith: gt,
|
|
207
207
|
toArray: Et,
|
|
208
208
|
forEachEntry: Tt,
|
|
209
209
|
matchAll: Ot,
|
|
@@ -302,8 +302,8 @@ function Q(e, t, n) {
|
|
|
302
302
|
metaTokens: !0,
|
|
303
303
|
dots: !1,
|
|
304
304
|
indexes: !1
|
|
305
|
-
}, !1, function(m,
|
|
306
|
-
return !a.isUndefined(
|
|
305
|
+
}, !1, function(m, g) {
|
|
306
|
+
return !a.isUndefined(g[m]);
|
|
307
307
|
});
|
|
308
308
|
const r = n.metaTokens, s = n.visitor || c, o = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
|
|
309
309
|
if (!a.isFunction(s))
|
|
@@ -317,9 +317,9 @@ function Q(e, t, n) {
|
|
|
317
317
|
throw new h("Blob is not supported. Use a Buffer instead.");
|
|
318
318
|
return a.isArrayBuffer(p) || a.isTypedArray(p) ? f && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
|
|
319
319
|
}
|
|
320
|
-
function c(p, m,
|
|
320
|
+
function c(p, m, g) {
|
|
321
321
|
let E = p;
|
|
322
|
-
if (p && !
|
|
322
|
+
if (p && !g && typeof p == "object") {
|
|
323
323
|
if (a.endsWith(m, "{}"))
|
|
324
324
|
m = r ? m : m.slice(0, -2), p = JSON.stringify(p);
|
|
325
325
|
else if (a.isArray(p) && jt(p) || (a.isFileList(p) || a.endsWith(m, "[]")) && (E = a.toArray(p)))
|
|
@@ -331,7 +331,7 @@ function Q(e, t, n) {
|
|
|
331
331
|
);
|
|
332
332
|
}), !1;
|
|
333
333
|
}
|
|
334
|
-
return re(p) ? !0 : (t.append(be(
|
|
334
|
+
return re(p) ? !0 : (t.append(be(g, m, o), l(p)), !1);
|
|
335
335
|
}
|
|
336
336
|
const d = [], b = Object.assign(It, {
|
|
337
337
|
defaultVisitor: c,
|
|
@@ -400,7 +400,7 @@ function He(e, t, n) {
|
|
|
400
400
|
}
|
|
401
401
|
return e;
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class Se {
|
|
404
404
|
constructor() {
|
|
405
405
|
this.handlers = [];
|
|
406
406
|
}
|
|
@@ -616,7 +616,7 @@ const Yt = a.toObjectSet([
|
|
|
616
616
|
`).forEach(function(i) {
|
|
617
617
|
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Yt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
618
618
|
}), t;
|
|
619
|
-
},
|
|
619
|
+
}, ge = Symbol("internals");
|
|
620
620
|
function U(e) {
|
|
621
621
|
return e && String(e).trim().toLowerCase();
|
|
622
622
|
}
|
|
@@ -763,7 +763,7 @@ class R {
|
|
|
763
763
|
return n.forEach((s) => r.set(s)), r;
|
|
764
764
|
}
|
|
765
765
|
static accessor(t) {
|
|
766
|
-
const r = (this[
|
|
766
|
+
const r = (this[ge] = this[ge] = {
|
|
767
767
|
accessors: {}
|
|
768
768
|
}).accessors, s = this.prototype;
|
|
769
769
|
function o(i) {
|
|
@@ -1157,7 +1157,7 @@ v && ((e) => {
|
|
|
1157
1157
|
});
|
|
1158
1158
|
});
|
|
1159
1159
|
})(new Response());
|
|
1160
|
-
const
|
|
1160
|
+
const Sn = async (e) => {
|
|
1161
1161
|
if (e == null)
|
|
1162
1162
|
return 0;
|
|
1163
1163
|
if (a.isBlob(e))
|
|
@@ -1168,9 +1168,9 @@ const gn = async (e) => {
|
|
|
1168
1168
|
return e.byteLength;
|
|
1169
1169
|
if (a.isURLSearchParams(e) && (e = e + ""), a.isString(e))
|
|
1170
1170
|
return (await se(e)).byteLength;
|
|
1171
|
-
},
|
|
1171
|
+
}, gn = async (e, t) => {
|
|
1172
1172
|
const n = a.toFiniteNumber(e.getContentLength());
|
|
1173
|
-
return n ??
|
|
1173
|
+
return n ?? Sn(t);
|
|
1174
1174
|
}, En = v && (async (e) => {
|
|
1175
1175
|
let {
|
|
1176
1176
|
url: t,
|
|
@@ -1187,7 +1187,7 @@ const gn = async (e) => {
|
|
|
1187
1187
|
fetchOptions: b
|
|
1188
1188
|
} = Ke(e);
|
|
1189
1189
|
l = l ? (l + "").toLowerCase() : "text";
|
|
1190
|
-
let [y, p] = s || o || i ? mn([s, o], i) : [], m,
|
|
1190
|
+
let [y, p] = s || o || i ? mn([s, o], i) : [], m, g;
|
|
1191
1191
|
const E = () => {
|
|
1192
1192
|
!m && setTimeout(() => {
|
|
1193
1193
|
y && y.unsubscribe();
|
|
@@ -1195,7 +1195,7 @@ const gn = async (e) => {
|
|
|
1195
1195
|
};
|
|
1196
1196
|
let P;
|
|
1197
1197
|
try {
|
|
1198
|
-
if (f && wn && n !== "get" && n !== "head" && (P = await
|
|
1198
|
+
if (f && wn && n !== "get" && n !== "head" && (P = await gn(c, r)) !== 0) {
|
|
1199
1199
|
let C = new Request(t, {
|
|
1200
1200
|
method: "POST",
|
|
1201
1201
|
body: r,
|
|
@@ -1206,7 +1206,7 @@ const gn = async (e) => {
|
|
|
1206
1206
|
z(f)
|
|
1207
1207
|
), null, se));
|
|
1208
1208
|
}
|
|
1209
|
-
a.isString(d) || (d = d ? "cors" : "omit"),
|
|
1209
|
+
a.isString(d) || (d = d ? "cors" : "omit"), g = new Request(t, {
|
|
1210
1210
|
...b,
|
|
1211
1211
|
signal: y,
|
|
1212
1212
|
method: n.toUpperCase(),
|
|
@@ -1215,7 +1215,7 @@ const gn = async (e) => {
|
|
|
1215
1215
|
duplex: "half",
|
|
1216
1216
|
withCredentials: d
|
|
1217
1217
|
});
|
|
1218
|
-
let w = await fetch(
|
|
1218
|
+
let w = await fetch(g);
|
|
1219
1219
|
const D = oe && (l === "stream" || l === "response");
|
|
1220
1220
|
if (oe && (u || D)) {
|
|
1221
1221
|
const C = {};
|
|
@@ -1240,16 +1240,16 @@ const gn = async (e) => {
|
|
|
1240
1240
|
status: w.status,
|
|
1241
1241
|
statusText: w.statusText,
|
|
1242
1242
|
config: e,
|
|
1243
|
-
request:
|
|
1243
|
+
request: g
|
|
1244
1244
|
});
|
|
1245
1245
|
});
|
|
1246
1246
|
} catch (w) {
|
|
1247
1247
|
throw E(), w && w.name === "TypeError" && /fetch/i.test(w.message) ? Object.assign(
|
|
1248
|
-
new h("Network Error", h.ERR_NETWORK, e,
|
|
1248
|
+
new h("Network Error", h.ERR_NETWORK, e, g),
|
|
1249
1249
|
{
|
|
1250
1250
|
cause: w.cause || w
|
|
1251
1251
|
}
|
|
1252
|
-
) : h.from(w, w && w.code, e,
|
|
1252
|
+
) : h.from(w, w && w.code, e, g);
|
|
1253
1253
|
}
|
|
1254
1254
|
}), ie = {
|
|
1255
1255
|
http: Ut,
|
|
@@ -1367,8 +1367,8 @@ const ae = {
|
|
|
1367
1367
|
class F {
|
|
1368
1368
|
constructor(t) {
|
|
1369
1369
|
this.defaults = t, this.interceptors = {
|
|
1370
|
-
request: new
|
|
1371
|
-
response: new
|
|
1370
|
+
request: new Se(),
|
|
1371
|
+
response: new Se()
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
/**
|
|
@@ -1441,8 +1441,8 @@ class F {
|
|
|
1441
1441
|
const p = u[d++], m = u[d++];
|
|
1442
1442
|
try {
|
|
1443
1443
|
y = p(y);
|
|
1444
|
-
} catch (
|
|
1445
|
-
m.call(this,
|
|
1444
|
+
} catch (g) {
|
|
1445
|
+
m.call(this, g);
|
|
1446
1446
|
break;
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
@@ -1635,29 +1635,29 @@ function Xe(e) {
|
|
|
1635
1635
|
return Xe(L(e, s));
|
|
1636
1636
|
}, n;
|
|
1637
1637
|
}
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1638
|
+
const S = Xe($);
|
|
1639
|
+
S.Axios = F;
|
|
1640
|
+
S.CanceledError = _;
|
|
1641
|
+
S.CancelToken = pe;
|
|
1642
|
+
S.isCancel = ze;
|
|
1643
|
+
S.VERSION = ve;
|
|
1644
|
+
S.toFormData = Q;
|
|
1645
|
+
S.AxiosError = h;
|
|
1646
|
+
S.Cancel = S.CanceledError;
|
|
1647
|
+
S.all = function(t) {
|
|
1648
1648
|
return Promise.all(t);
|
|
1649
1649
|
};
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1650
|
+
S.spread = On;
|
|
1651
|
+
S.isAxiosError = An;
|
|
1652
|
+
S.mergeConfig = L;
|
|
1653
|
+
S.AxiosHeaders = R;
|
|
1654
|
+
S.formToJSON = (e) => Me(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1655
|
+
S.getAdapter = Qe.getAdapter;
|
|
1656
|
+
S.HttpStatusCode = ce;
|
|
1657
|
+
S.default = S;
|
|
1658
1658
|
const N = (e) => {
|
|
1659
1659
|
var i, u;
|
|
1660
|
-
const t =
|
|
1660
|
+
const t = S.create(), n = e.apiVersion, r = e.productCode, s = e.baseUrl;
|
|
1661
1661
|
return e.responseInterceptor && t.interceptors.response.use(
|
|
1662
1662
|
(i = e.responseInterceptor) == null ? void 0 : i.onFulfilled,
|
|
1663
1663
|
(u = e.responseInterceptor) == null ? void 0 : u.onReject
|
|
@@ -1666,7 +1666,8 @@ const N = (e) => {
|
|
|
1666
1666
|
const c = `${s}/${r}/${n}${f}`, d = {
|
|
1667
1667
|
"Content-Type": (l == null ? void 0 : l.contentType) || "application/json",
|
|
1668
1668
|
apiVersion: n,
|
|
1669
|
-
Authorization: ""
|
|
1669
|
+
Authorization: "",
|
|
1670
|
+
...e.headers ?? {}
|
|
1670
1671
|
};
|
|
1671
1672
|
localStorage.getItem("accessToken") && (d.Authorization = "Bearer " + localStorage.getItem("accessToken"));
|
|
1672
1673
|
const b = {
|
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[_e]=this[_e]={accessors:{}}).accessors,s=this.prototype;function o(i){const u=H(i);r[u]||(Zt(s,i),r[u]=!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 ie(e,t){const n=this||I,r=t||n,s=R.from(r.headers);let o=r.data;return a.forEach(e,function(u){o=u.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function De(e){return!!(e&&e.__CANCEL__)}function _(e,t,n){h.call(this,e??"canceled",h.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(_,h,{__CANCEL__:!0});function Ue(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(),c=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=c&&l-c;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,u=Date.now();if(i||u-n>r)return s&&(clearTimeout(s),s=null),n=u,e.apply(null,arguments);s||(s=setTimeout(()=>(s=null,n=Date.now(),e.apply(null,arguments)),r-(u-n)))}}const Q=(e,t,n=3)=>{let r=0;const s=en(50,250);return tn(o=>{const i=o.loaded,u=o.lengthComputable?o.total:void 0,f=i-r,l=s(f),c=i<=u;r=i;const d={loaded:i,total:u,progress:u?i/u:void 0,bytes:f,rate:l||void 0,estimated:l&&u&&c?(u-i)/l:void 0,event:o,lengthComputable:u!=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 u=a.isString(i)?s(i):i;return u.protocol===r.protocol&&u.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 F(e,t){t=t||{};const n={};function r(l,c,d){return a.isPlainObject(l)&&a.isPlainObject(c)?a.merge.call({caseless:d},l,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(l,c,d){if(a.isUndefined(c)){if(!a.isUndefined(l))return r(void 0,l,d)}else return r(l,c,d)}function o(l,c){if(!a.isUndefined(c))return r(void 0,c)}function i(l,c){if(a.isUndefined(c)){if(!a.isUndefined(l))return r(void 0,l)}else return r(void 0,c)}function u(l,c,d){if(d in t)return r(l,c);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:u,headers:(l,c)=>s($e(l),$e(c),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(c){const d=f[c]||s,b=d(e[c],t[c],c);a.isUndefined(b)&&d!==u||(n[c]=b)}),n}const Ie=e=>{const t=F({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:u}=t;t.headers=i=R.from(i),t.url=Fe(je(t.baseURL,t.url),e.params,e.paramsSerializer),u&&i.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):"")));let f;if(a.isFormData(n)){if(A.hasStandardBrowserEnv||A.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[l,...c]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([l||"multipart/form-data",...c].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:u}=s,f;function l(){s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let c=new XMLHttpRequest;c.open(s.method.toUpperCase(),s.url,!0),c.timeout=s.timeout;function d(){if(!c)return;const y=R.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),m={data:!u||u==="text"||u==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:y,config:e,request:c};Ue(function(E){n(E),l()},function(E){r(E),l()},m),c=null}"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){c&&(r(new h("Request aborted",h.ECONNABORTED,s,c)),c=null)},c.onerror=function(){r(new h("Network Error",h.ERR_NETWORK,s,c)),c=null},c.ontimeout=function(){let p=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const m=s.transitional||qe;s.timeoutErrorMessage&&(p=s.timeoutErrorMessage),r(new h(p,m.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,s,c)),c=null},o===void 0&&i.setContentType(null),"setRequestHeader"in c&&a.forEach(i.toJSON(),function(p,m){c.setRequestHeader(m,p)}),a.isUndefined(s.withCredentials)||(c.withCredentials=!!s.withCredentials),u&&u!=="json"&&(c.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&c.addEventListener("progress",Q(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",Q(s.onUploadProgress)),(s.cancelToken||s.signal)&&(f=y=>{c&&(r(!y||y.type?new _(null,e,c):y),c.abort(),c=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}c.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 _(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:u}=n;return u.unsubscribe=i,[u,()=>{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(u){const{done:f,value:l}=await o.next();if(f){u.close(),r();return}let c=l.byteLength;n&&n(i+=c),u.enqueue(new Uint8Array(l))},cancel(u){return r(u),o.return()}},{highWaterMark:2})},Je=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},v=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Me=v&&typeof ReadableStream=="function",ae=v&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),fn=Me&&(()=>{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,ce=Me&&!!(()=>{try{return a.isReadableStream(new Response("").body)}catch{}})(),X={stream:ce&&(e=>e.body)};v&&(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 ae(e)).byteLength},pn=async(e,t)=>{const n=a.toFiniteNumber(e.getContentLength());return n??dn(t)},ue={http:_t,xhr:an,fetch:v&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:u,onUploadProgress:f,responseType:l,headers:c,withCredentials:d="same-origin",fetchOptions:b}=Ie(e);l=l?(l+"").toLowerCase():"text";let[y,p]=s||o||i?cn([s,o],i):[],m,g;const E=()=>{!m&&setTimeout(()=>{y&&y.unsubscribe()}),m=!0};let P;try{if(f&&fn&&n!=="get"&&n!=="head"&&(P=await pn(c,r))!==0){let B=new Request(t,{method:"POST",body:r,duplex:"half"}),D;a.isFormData(r)&&(D=B.headers.get("content-type"))&&c.setContentType(D),B.body&&(r=He(B.body,ze,Je(P,Q(f)),null,ae))}a.isString(d)||(d=d?"cors":"omit"),g=new Request(t,{...b,signal:y,method:n.toUpperCase(),headers:c.normalize().toJSON(),body:r,duplex:"half",withCredentials:d});let w=await fetch(g);const J=ce&&(l==="stream"||l==="response");if(ce&&(u||J)){const B={};["status","statusText","headers"].forEach(Ze=>{B[Ze]=w[Ze]});const D=a.toFiniteNumber(w.headers.get("content-length"));w=new Response(He(w.body,ze,u&&Je(D,Q(u,!0)),J&&E,ae),B)}l=l||"text";let kn=await X[a.findKey(X,l)||"text"](w,e);return!J&&E(),p&&p(),await new Promise((B,D)=>{Ue(B,D,{data:kn,headers:R.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:g})})}catch(w){throw E(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new h("Network Error",h.ERR_NETWORK,e,g),{cause:w.cause||w}):h.from(w,w&&w.code,e,g)}})};a.forEach(ue,(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,Ge={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=ue[(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(([u,f])=>`adapter ${u} `+(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:ue};function le(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _(null,e)}function Ke(e){return le(e),e.headers=R.from(e.headers),e.data=ie.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ge.getAdapter(e.adapter||I.adapter)(e).then(function(r){return le(e),r.data=ie.call(e,e.transformResponse,r),r.headers=R.from(r.headers),r},function(r){return De(r)||(le(e),r&&r.response&&(r.response.data=ie.call(e,e.transformResponse,r.response),r.response.headers=R.from(r.response.headers))),Promise.reject(r)})}const We="1.7.2",fe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Qe={};fe.transitional=function(t,n,r){function s(o,i){return"[Axios v"+We+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,u)=>{if(t===!1)throw new h(s(i," has been removed"+(n?" in "+n:"")),h.ERR_DEPRECATED);return n&&!Qe[i]&&(Qe[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,u):!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 u=e[o],f=u===void 0||i(u,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 de={assertOptions:mn,validators:fe},C=de.validators;class L{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=F(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&de.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}:de.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 u=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,u.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let c,d=0,b;if(!f){const p=[Ke.bind(this),void 0];for(p.unshift.apply(p,u),p.push.apply(p,l),b=p.length,c=Promise.resolve(n);d<b;)c=c.then(p[d++],p[d++]);return c}b=u.length;let y=n;for(d=0;d<b;){const p=u[d++],m=u[d++];try{y=p(y)}catch(g){m.call(this,g);break}}try{c=Ke.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,b=l.length;d<b;)c=c.then(l[d++],l[d++]);return c}getUri(t){t=F(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){L.prototype[t]=function(n,r){return this.request(F(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,u){return this.request(F(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}L.prototype[t]=n(),L.prototype[t+"Form"]=n(!0)});class pe{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(u=>{r.subscribe(u),o=u}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,u){r.reason||(r.reason=new _(o,i,u),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 pe(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 he={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(he).forEach(([e,t])=>{he[t]=e});function ve(e){const t=new L(e),n=q(L.prototype.request,t);return a.extend(n,L.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ve(F(e,s))},n}const S=ve(I);S.Axios=L,S.CanceledError=_,S.CancelToken=pe,S.isCancel=De,S.VERSION=We,S.toFormData=K,S.AxiosError=h,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=yn,S.isAxiosError=bn,S.mergeConfig=F,S.AxiosHeaders=R,S.formToJSON=e=>ke(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=Ge.getAdapter,S.HttpStatusCode=he,S.default=S;const N=e=>{var i,u;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,(u=e.responseInterceptor)==null?void 0:u.onReject),{request:async(f,l)=>{const c=`${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:c,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",gn=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:""})}},En=e=>{const t=N(e);return{signUp:async o=>await t.request("/sign-up",{method:"POST",data:JSON.stringify(o)}),signIn:async o=>{const i=await t.request("/sign-in",{method:"POST",data:JSON.stringify(o)});return i.data.accessToken&&localStorage.setItem("accessToken",i.data.accessToken),i},getProfile:async()=>await t.request("/me",{method:"GET",data:""})}},Rn="digital",Tn=e=>{const t=N(e);return{getBroker:()=>t.request(`/${Rn}/getBroker`,{method:"GET",data:""})}},On="data",An=e=>{const t=N(e);return{postData:async r=>await t.request(`/${On}`,{method:"POST",data:JSON.stringify(r)})}},me="payment",Nn=e=>{const t=N(e);return{postPayment:o=>t.request(`/${me}`,{method:"POST",data:JSON.stringify(o)}),getPaymentStatus:o=>t.request(`/${me}/status?policyId=${o.policyId}`,{method:"GET",data:""}),getPaymentSummary:o=>t.request(`/${me}/summary?policyId=${o.policyId}`,{method:"GET",data:""})}},Z="product/action",Pn=e=>{const t=N(e);return{getCnpjStatus:i=>t.request(`/${Z}/Custom/CnpjCheck?cnpj=${i}`,{method:"GET",data:""}),getKeyNumber:()=>t.request(`/${Z}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:i=>t.request(`/${Z}/Custom/GetProposalNoByKeyNumber?keyNumber=${i.keyNumber}`,{method:"GET",data:""}),postCoveragesAndClausesRules:i=>t.request(`/${Z}/Custom/LoadRules`,{method:"POST",data:JSON.stringify(i)})}},x="quotation",Cn=e=>{const t=N(e);return{getQuotations:c=>{const d=new URLSearchParams({...c});return t.request(`/${x}/query?${d.toString()}`,{method:"GET",data:""})},getQuotationDetail:c=>{const d=new URLSearchParams({id:c.policyId});return t.request(`/${x}?${d.toString()}`,{method:"GET",data:""})},postQuickQuote:c=>t.request(`/${x}/QuickQuote`,{method:"POST",data:JSON.stringify(c)}),postFullQuote:c=>t.request(`/${x}/FullQuote`,{method:"POST",data:JSON.stringify(c)}),postBind:c=>t.request(`/${x}/Bind`,{method:"POST",data:JSON.stringify(c)}),getQuotation:c=>t.request(`/${x}?id=${c.policyId}`,{method:"GET",data:""}),getVersions:c=>t.request(`/${x}/versions?policyId=${c.policyId}`,{method:"GET",data:""}),switchSelectedVersion:c=>t.request(`/${x}/switchSelectedVersion?policyId=${c.policyId}"ationVersionId=${c.quotationVersionId}`,{method:"POST",data:JSON.stringify(c)})}},xn="report",Bn=e=>{const t=N(e);return{getReportStream:r=>{const s=new URLSearchParams({policyId:r.policyId,documentType:r.documentType||"certificate",...r.additionalParams});return t.request(`/${xn}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},Fn="SubscriberData",Ln=e=>{const t=N(e);return{getSubscriber:r=>t.request(`/${Fn}/get-subscriber-data?cnpj=${r}`,{method:"GET",data:""})}};function qn(e){const t=gn(e),n=En(e),r=An(e),s=Cn(e),o=Nn(e),i=Sn(e),u=Tn(e),f=Pn(e),l=Bn(e),c=Ln(e);return{auth:t,authAkad:n,data:r,quotation:s,payment:o,address:i,broker:u,plugin:f,report:l,subscriber:c}}return qn});
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=F(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&de.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}:de.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 u=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,u.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let c,d=0,b;if(!f){const p=[Ke.bind(this),void 0];for(p.unshift.apply(p,u),p.push.apply(p,l),b=p.length,c=Promise.resolve(n);d<b;)c=c.then(p[d++],p[d++]);return c}b=u.length;let y=n;for(d=0;d<b;){const p=u[d++],m=u[d++];try{y=p(y)}catch(g){m.call(this,g);break}}try{c=Ke.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,b=l.length;d<b;)c=c.then(l[d++],l[d++]);return c}getUri(t){t=F(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){L.prototype[t]=function(n,r){return this.request(F(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,u){return this.request(F(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}L.prototype[t]=n(),L.prototype[t+"Form"]=n(!0)});class pe{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(u=>{r.subscribe(u),o=u}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,u){r.reason||(r.reason=new _(o,i,u),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 pe(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 he={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(he).forEach(([e,t])=>{he[t]=e});function ve(e){const t=new L(e),n=q(L.prototype.request,t);return a.extend(n,L.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ve(F(e,s))},n}const S=ve(I);S.Axios=L,S.CanceledError=_,S.CancelToken=pe,S.isCancel=De,S.VERSION=We,S.toFormData=K,S.AxiosError=h,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=yn,S.isAxiosError=bn,S.mergeConfig=F,S.AxiosHeaders=R,S.formToJSON=e=>ke(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=Ge.getAdapter,S.HttpStatusCode=he,S.default=S;const N=e=>{var i,u;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,(u=e.responseInterceptor)==null?void 0:u.onReject),{request:async(f,l)=>{const c=`${s}/${r}/${n}${f}`,d={"Content-Type":(l==null?void 0:l.contentType)||"application/json",apiVersion:n,Authorization:"",...e.headers??{}};localStorage.getItem("accessToken")&&(d.Authorization="Bearer "+localStorage.getItem("accessToken"));const b={method:(l==null?void 0:l.method)||"GET",headers:d,url:c,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",gn=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:""})}},En=e=>{const t=N(e);return{signUp:async o=>await t.request("/sign-up",{method:"POST",data:JSON.stringify(o)}),signIn:async o=>{const i=await t.request("/sign-in",{method:"POST",data:JSON.stringify(o)});return i.data.accessToken&&localStorage.setItem("accessToken",i.data.accessToken),i},getProfile:async()=>await t.request("/me",{method:"GET",data:""})}},Rn="digital",Tn=e=>{const t=N(e);return{getBroker:()=>t.request(`/${Rn}/getBroker`,{method:"GET",data:""})}},On="data",An=e=>{const t=N(e);return{postData:async r=>await t.request(`/${On}`,{method:"POST",data:JSON.stringify(r)})}},me="payment",Nn=e=>{const t=N(e);return{postPayment:o=>t.request(`/${me}`,{method:"POST",data:JSON.stringify(o)}),getPaymentStatus:o=>t.request(`/${me}/status?policyId=${o.policyId}`,{method:"GET",data:""}),getPaymentSummary:o=>t.request(`/${me}/summary?policyId=${o.policyId}`,{method:"GET",data:""})}},Z="product/action",Pn=e=>{const t=N(e);return{getCnpjStatus:i=>t.request(`/${Z}/Custom/CnpjCheck?cnpj=${i}`,{method:"GET",data:""}),getKeyNumber:()=>t.request(`/${Z}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:i=>t.request(`/${Z}/Custom/GetProposalNoByKeyNumber?keyNumber=${i.keyNumber}`,{method:"GET",data:""}),postCoveragesAndClausesRules:i=>t.request(`/${Z}/Custom/LoadRules`,{method:"POST",data:JSON.stringify(i)})}},x="quotation",Cn=e=>{const t=N(e);return{getQuotations:c=>{const d=new URLSearchParams({...c});return t.request(`/${x}/query?${d.toString()}`,{method:"GET",data:""})},getQuotationDetail:c=>{const d=new URLSearchParams({id:c.policyId});return t.request(`/${x}?${d.toString()}`,{method:"GET",data:""})},postQuickQuote:c=>t.request(`/${x}/QuickQuote`,{method:"POST",data:JSON.stringify(c)}),postFullQuote:c=>t.request(`/${x}/FullQuote`,{method:"POST",data:JSON.stringify(c)}),postBind:c=>t.request(`/${x}/Bind`,{method:"POST",data:JSON.stringify(c)}),getQuotation:c=>t.request(`/${x}?id=${c.policyId}`,{method:"GET",data:""}),getVersions:c=>t.request(`/${x}/versions?policyId=${c.policyId}`,{method:"GET",data:""}),switchSelectedVersion:c=>t.request(`/${x}/switchSelectedVersion?policyId=${c.policyId}"ationVersionId=${c.quotationVersionId}`,{method:"POST",data:JSON.stringify(c)})}},xn="report",Bn=e=>{const t=N(e);return{getReportStream:r=>{const s=new URLSearchParams({policyId:r.policyId,documentType:r.documentType||"certificate",...r.additionalParams});return t.request(`/${xn}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},Fn="SubscriberData",Ln=e=>{const t=N(e);return{getSubscriber:r=>t.request(`/${Fn}/get-subscriber-data?cnpj=${r}`,{method:"GET",data:""})}};function qn(e){const t=gn(e),n=En(e),r=An(e),s=Cn(e),o=Nn(e),i=Sn(e),u=Tn(e),f=Pn(e),l=Bn(e),c=Ln(e);return{auth:t,authAkad:n,data:r,quotation:s,payment:o,address:i,broker:u,plugin:f,report:l,subscriber:c}}return qn});
|