@fuul/sdk 4.10.1 → 4.11.0
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/affiliates/AffiliateService.d.ts +2 -2
- package/dist/affiliates/AffiliateService.d.ts.map +1 -1
- package/dist/core.d.ts +24 -12
- package/dist/core.d.ts.map +1 -1
- package/dist/index.mjs +325 -323
- package/dist/index.umd.js +5 -5
- package/dist/payouts/PayoutService.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +6 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(E,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(E=typeof globalThis<"u"?globalThis:E||self,C(E.Fuul={}))})(this,function(E){"use strict";var dr=Object.defineProperty;var pr=(E,C,L)=>C in E?dr(E,C,{enumerable:!0,configurable:!0,writable:!0,value:L}):E[C]=L;var b=(E,C,L)=>(pr(E,typeof C!="symbol"?C+"":C,L),L);function C(e,t){return function(){return e.apply(t,arguments)}}const{toString:L}=Object.prototype,{getPrototypeOf:re}=Object,K=(e=>t=>{const n=L.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),T=e=>(e=e.toLowerCase(),t=>K(t)===e),J=e=>t=>typeof t===e,{isArray:B}=Array,$=J("undefined");function lt(e){return e!==null&&!$(e)&&e.constructor!==null&&!$(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Te=T("ArrayBuffer");function ft(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Te(e.buffer),t}const dt=J("string"),A=J("function"),Pe=J("number"),M=e=>e!==null&&typeof e=="object",pt=e=>e===!0||e===!1,W=e=>{if(K(e)!=="object")return!1;const t=re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ht=T("Date"),mt=T("File"),yt=T("Blob"),gt=T("FileList"),wt=e=>M(e)&&A(e.pipe),bt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=K(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},Et=T("URLSearchParams"),St=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function q(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),B(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function _e(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Ne=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),xe=e=>!$(e)&&e!==Ne;function se(){const{caseless:e}=xe(this)&&this||{},t={},n=(r,s)=>{const i=e&&_e(t,s)||s;W(t[i])&&W(r)?t[i]=se(t[i],r):W(r)?t[i]=se({},r):B(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&q(arguments[r],n);return t}const Ct=(e,t,n,{allOwnKeys:r}={})=>(q(t,(s,i)=>{n&&A(s)?e[i]=C(s,n):e[i]=s},{allOwnKeys:r}),e),At=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Rt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Ot=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&re(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Pt=e=>{if(!e)return null;if(B(e))return e;let t=e.length;if(!Pe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},_t=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&re(Uint8Array)),Nt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},xt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ut=T("HTMLFormElement"),Ft=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ue=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Lt=T("RegExp"),Fe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};q(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Dt=e=>{Fe(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(A(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Bt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return B(e)?r(e):r(String(e).split(t)),n},It=()=>{},vt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),oe="abcdefghijklmnopqrstuvwxyz",Le="0123456789",De={DIGIT:Le,ALPHA:oe,ALPHA_DIGIT:oe+oe.toUpperCase()+Le},jt=(e=16,t=De.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function kt(e){return!!(e&&A(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const $t=e=>{const t=new Array(10),n=(r,s)=>{if(M(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=B(r)?[]:{};return q(r,(o,c)=>{const p=n(o,s+1);!$(p)&&(i[c]=p)}),t[s]=void 0,i}}return r};return n(e,0)},qt=T("AsyncFunction"),a={isArray:B,isArrayBuffer:Te,isBuffer:lt,isFormData:bt,isArrayBufferView:ft,isString:dt,isNumber:Pe,isBoolean:pt,isObject:M,isPlainObject:W,isUndefined:$,isDate:ht,isFile:mt,isBlob:yt,isRegExp:Lt,isFunction:A,isStream:wt,isURLSearchParams:Et,isTypedArray:_t,isFileList:gt,forEach:q,merge:se,extend:Ct,trim:St,stripBOM:At,inherits:Rt,toFlatObject:Ot,kindOf:K,kindOfTest:T,endsWith:Tt,toArray:Pt,forEachEntry:Nt,matchAll:xt,isHTMLForm:Ut,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:Fe,freezeMethods:Dt,toObjectSet:Bt,toCamelCase:Ft,noop:It,toFiniteNumber:vt,findKey:_e,global:Ne,isContextDefined:xe,ALPHABET:De,generateString:jt,isSpecCompliantForm:kt,toJSONObject:$t,isAsyncFn:qt,isThenable:e=>e&&(M(e)||A(e))&&A(e.then)&&A(e.catch)};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Be=m.prototype,Ie={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ie[e]={value:e}}),Object.defineProperties(m,Ie),Object.defineProperty(Be,"isAxiosError",{value:!0}),m.from=(e,t,n,r,s,i)=>{const o=Object.create(Be);return a.toFlatObject(e,o,function(p){return p!==Error.prototype},c=>c!=="isAxiosError"),m.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const Ht=null;function ie(e){return a.isPlainObject(e)||a.isArray(e)}function ve(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function je(e,t,n){return e?e.concat(t).map(function(s,i){return s=ve(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Vt(e){return a.isArray(e)&&!e.some(ie)}const zt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function X(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,w){return!a.isUndefined(w[d])});const r=n.metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function h(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(!p&&a.isBlob(f))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,d,w){let S=f;if(f&&!w&&typeof f=="object"){if(a.endsWith(d,"{}"))d=r?d:d.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Vt(f)||(a.isFileList(f)||a.endsWith(d,"[]"))&&(S=a.toArray(f)))return d=ve(d),S.forEach(function(F,fr){!(a.isUndefined(F)||F===null)&&t.append(o===!0?je([d],fr,i):o===null?d:d+"[]",h(F))}),!1}return ie(f)?!0:(t.append(je(w,d,i),h(f)),!1)}const u=[],g=Object.assign(zt,{defaultVisitor:l,convertValue:h,isVisitable:ie});function R(f,d){if(!a.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(f),a.forEach(f,function(S,U){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(U)?U.trim():U,d,g))===!0&&R(S,d?d.concat(U):[U])}),u.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return R(e),t}function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ae(e,t){this._pairs=[],e&&X(e,this,t)}const $e=ae.prototype;$e.append=function(t,n){this._pairs.push([t,n])},$e.toString=function(t){const n=t?function(r){return t.call(this,r,ke)}:ke;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Kt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qe(e,t,n){if(!t)return e;const r=n&&n.encode||Kt,s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new ae(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Jt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const He=Jt,Ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ae,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ze=typeof window<"u"&&typeof document<"u",Wt=(e=>ze&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Xt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),P={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ze,hasStandardBrowserEnv:Wt,hasStandardBrowserWebWorkerEnv:Xt},Symbol.toStringTag,{value:"Module"})),...Mt};function Gt(e,t){return X(e,new P.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return P.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Yt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qt(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Ke(e){function t(n,r,s,i){let o=n[i++];const c=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Qt(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Yt(r),s,n,0)}),n}return null}function Zt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ce={transitional:Ve,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(Ke(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return X(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Zt(t)):t}],transformResponse:[function(t){const n=this.transitional||ce.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ce.headers[e]={}});const ue=ce,en=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(
|
|
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[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function i
|
|
4
|
-
`+
|
|
5
|
-
`):" "+Ge(i[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:de};function pe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new V(null,e)}function Qe(e){return pe(e),e.headers=_.from(e.headers),e.data=fe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ye.getAdapter(e.adapter||ue.adapter)(e).then(function(r){return pe(e),r.data=fe.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return Me(r)||(pe(e),r&&r.response&&(r.response.data=fe.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const Ze=e=>e instanceof _?e.toJSON():e;function I(e,t){t=t||{};const n={};function r(h,l,u){return a.isPlainObject(h)&&a.isPlainObject(l)?a.merge.call({caseless:u},h,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(h,l,u){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h,u)}else return r(h,l,u)}function i(h,l){if(!a.isUndefined(l))return r(void 0,l)}function o(h,l){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h)}else return r(void 0,l)}function c(h,l,u){if(u in t)return r(h,l);if(u in e)return r(void 0,h)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(h,l)=>s(Ze(h),Ze(l),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(l){const u=p[l]||s,g=u(e[l],t[l],l);a.isUndefined(g)&&u!==c||(n[l]=g)}),n}const et="1.6.3",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const tt={};he.transitional=function(t,n,r){function s(i,o){return"[Axios v"+et+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new m(s(o," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!tt[o]&&(tt[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}};function mn(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],p=c===void 0||o(c,i,e);if(p!==!0)throw new m("option "+i+" must be "+p,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const me={assertOptions:mn,validators:he},N=me.validators;let Q=class{constructor(t){this.defaults=t,this.interceptors={request:new He,response:new He}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=I(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&me.assertOptions(r,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:me.assertOptions(s,{encode:N.function,serialize:N.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=_.concat(o,i);const c=[];let p=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(p=p&&d.synchronous,c.unshift(d.fulfilled,d.rejected))});const h=[];this.interceptors.response.forEach(function(d){h.push(d.fulfilled,d.rejected)});let l,u=0,g;if(!p){const f=[Qe.bind(this),void 0];for(f.unshift.apply(f,c),f.push.apply(f,h),g=f.length,l=Promise.resolve(n);u<g;)l=l.then(f[u++],f[u++]);return l}g=c.length;let R=n;for(u=0;u<g;){const f=c[u++],d=c[u++];try{R=f(R)}catch(w){d.call(this,w);break}}try{l=Qe.call(this,R)}catch(f){return Promise.reject(f)}for(u=0,g=h.length;u<g;)l=l.then(h[u++],h[u++]);return l}getUri(t){t=I(this.defaults,t);const n=We(t.baseURL,t.url);return qe(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){Q.prototype[t]=function(n,r){return this.request(I(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(I(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Q.prototype[t]=n(),Q.prototype[t+"Form"]=n(!0)});const Z=Q,yn=class ut{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new V(i,o,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 ut(function(s){t=s}),cancel:t}}};function gn(e){return function(n){return e.apply(null,n)}}function wn(e){return a.isObject(e)&&e.isAxiosError===!0}const ye={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(ye).forEach(([e,t])=>{ye[t]=e});const bn=ye;function nt(e){const t=new Z(e),n=C(Z.prototype.request,t);return a.extend(n,Z.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return nt(I(e,s))},n}const y=nt(ue);y.Axios=Z,y.CanceledError=V,y.CancelToken=yn,y.isCancel=Me,y.VERSION=et,y.toFormData=X,y.AxiosError=m,y.Cancel=y.CanceledError,y.all=function(t){return Promise.all(t)},y.spread=gn,y.isAxiosError=wn,y.mergeConfig=I,y.AxiosHeaders=_,y.formToJSON=e=>Ke(a.isHTMLForm(e)?new FormData(e):e),y.getAdapter=Ye.getAdapter,y.HttpStatusCode=bn,y.default=y;const rt=y,{Axios:Cr,AxiosError:ee,CanceledError:Ar,isCancel:Rr,CancelToken:Or,VERSION:Tr,all:Pr,Cancel:_r,isAxiosError:Nr,spread:xr,toFormData:Ur,AxiosHeaders:Fr,HttpStatusCode:Lr,formToJSON:Dr,getAdapter:Br,mergeConfig:Ir}=rt;class ge extends Error{constructor(n){super(n.join(", "));b(this,"errors");this.name="ValidationError",this.errors=n}}class we extends Error{constructor(n){super("Address already registered.");b(this,"address");this.name="AddressInUseError",this.address=n}}class be extends Error{constructor(n){super("Code already registered.");b(this,"code");this.name="CodeInUseError",this.code=n}}class Ee extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class En{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async create(t,n,r){var s;try{await this.httpClient.post("/affiliates",{address:t,name:n,code:n,signature:r})}catch(i){if(i instanceof ee){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new Ee:c=="address in use"?new we(t):c=="code in use"?new be(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new ge(o.message)}throw i}}async update(t,n,r){var s;try{await this.httpClient.post(`/affiliates/${t}`,{code:n,address:t,signature:r})}catch(i){if(i instanceof ee){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new Ee:c=="address in use"?new we(t):c=="code in use"?new be(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new ge(o.message)}throw i}}async isCodeFree(t){var n;try{return await this.httpClient.get(`/affiliates/codes/${t}`),!1}catch(r){if(r instanceof ee&&((n=r.response)==null?void 0:n.status)===404)return!0;throw console.error("Fuul SDK: Could not check affiliate code",r),r}}async getCode(t){var n;try{return(await this.httpClient.get(`/affiliates/${t}`)).data.code}catch(r){if(r instanceof ee&&((n=r.response)==null?void 0:n.status)===404)return null;throw console.error("Fuul SDK: Could not get affiliate code",r),r}}}const Sn="/audiences";class Cn{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getUserAudiences(t){return(await this.httpClient.get(`${Sn}/user`,t)).data}}class An{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getAll(t){const{data:n}=await this.httpClient.get("conversions",t);return n}}const st="fuul.sent",Rn=60;class On{constructor(t){b(this,"debug");b(this,"httpClient");this.httpClient=t.httpClient,this.debug=!!t.debug}async sendEvent(t){if(this.isDuplicate(t)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}await this.httpClient.post("events",t),this.debug&&console.debug(`Fuul SDK: Sent '${t.name}' event`),this.saveSentEvent(t)}isDuplicate(t){const n=`${st}_${t.name}`,r=localStorage.getItem(n);if(!r)return!1;const s=JSON.parse(r);if(this.getCurrentTimestamp()-s.timestamp>Rn)return!1;let p=!1;t.metadata&&(p=s.metadata.tracking_id===t.metadata.tracking_id&&s.metadata.project_id===t.metadata.project_id&&s.metadata.referrer===t.metadata.referrer&&s.metadata.source===t.metadata.source&&s.metadata.category===t.metadata.category&&s.metadata.title===t.metadata.title&&s.metadata.tag===t.metadata.tag&&s.user_address===t.user_address&&s.signature===t.signature&&s.signature_message===t.signature_message);let h=!1;return t.args&&s.args&&(h=s.args.page===t.args.page),h&&p}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(t){const n=`${st}_${t.name}`,r=this.getCurrentTimestamp(),s={...t,timestamp:r};localStorage.setItem(n,JSON.stringify(s))}}const Tn={version:"4.10.1"};class Pn{constructor(t){b(this,"client");b(this,"queryParams");this.client=rt.create({...t,headers:{Authorization:`Bearer ${t.apiKey}`,"X-Fuul-Sdk-Version":Tn.version}}),this.queryParams=t.queryParams?this.buildQueryParams(t.queryParams):""}buildQueryParams(t){let n="";return Object.keys(t).forEach(r=>{n=n===""?n+`?${r}=${t[r]}`:n+`&${r}=${t[r]}`}),n}async get(t,n){return this.client.get(t+this.queryParams,{params:n})}async post(t,n){return this.client.post(t+this.queryParams,n)}async put(t,n){return this.client.put(t+this.queryParams,n)}async delete(t){return this.client.delete(t+this.queryParams)}}class _n{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getPayoutsLeaderboard(t){return(await this.httpClient.get("/payouts/leaderboard/payouts",t)).data}async getPointsLeaderboard(t){return(await this.httpClient.get("/payouts/leaderboard/points",t)).data}async getReferredUsersLeaderboard(t){return(await this.httpClient.get("/leaderboard/referred",t)).data}}const z="/payouts";class Nn{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getUserPayoutsByConversion(t){return(await this.httpClient.get(z,{...t,type:"onchain-currency"})).data}async getUserPointsByConversion(t){return(await this.httpClient.get(z,{...t,type:"point"})).data}async getUserPayoutMovements(t){return(await this.httpClient.get(`${z}/movements`,{...t,type:"onchain-currency"})).data}async getUserPointsMovements(t){return(await this.httpClient.get(`${z}/movements`,{...t,type:"point"})).data}async getVolumeLeaderboard(t){return(await this.httpClient.get(`${z}/leaderboard/volume`,t)).data}}let xn=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const Un="fuul.tracking_id",Se=()=>vn(Un,()=>xn()),ot=()=>v("af")||v("referrer"),Fn=()=>document.referrer,Ln=()=>jn(),Dn=()=>v("category"),Bn=()=>v("title"),In=()=>v("tag"),vn=(e,t)=>{const n=localStorage.getItem(e);if(n)return n;{const r=t();return r?localStorage.setItem(e,r):localStorage.removeItem(e),r}},v=e=>new URLSearchParams(window.location.search).get(e),jn=()=>{const e=v("source");if(e)return e},kn="/user";class $n{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getUserAffiliates(t){return(await this.httpClient.get(kn,t)).data.affiliates}}const qn="https://api.fuul.xyz/api/v1/";let D=!1,Ce=!1,Ae,x,it,at,j,te,k,ct,ne;function Hn(e){D=!!e.debug,!Ce&&(Ae=e.apiKey,cr(),x=ur(e.baseApiUrl??qn,e.defaultQueryParams??{}),it=new An({httpClient:x,debug:D}),te=new On({httpClient:x,debug:D}),j=new En({httpClient:x,debug:D}),k=new Nn({httpClient:x,debug:D}),at=new $n({httpClient:x}),ct=new Cn({httpClient:x,debug:D}),ne=new _n({httpClient:x}),Ce=!0,D&&console.debug("Fuul SDK: init() complete"))}function O(){if(!Ce)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function Vn(e,t){O(),Re(),Oe();const n={name:e,args:t??{},metadata:{tracking_id:Se()}};await te.sendEvent(n)}async function zn(e){O(),Re(),Oe();const t={name:"pageview",args:{page:e??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:Se(),referrer_url:Fn(),source:Ln(),affiliate_id:ot()??void 0,referrer:ot()??void 0,category:Dn()??void 0,title:Bn()??void 0,tag:In()??void 0}};await te.sendEvent(t)}async function Kn(e){O(),Re(),Oe();const t={name:"connect_wallet",args:{page:document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:Se()}};e!=null&&e.address&&(t.user_address=e.address),e!=null&&e.signature&&(t.signature=e==null?void 0:e.signature,t.signature_message=e==null?void 0:e.message),e!=null&&e.accountChainId&&(t.account_chain_id=e.accountChainId),await te.sendEvent(t)}async function Jn(e,t,n){O(),await j.create(e,t,n)}async function Mn(e,t,n){O(),await j.update(e,t,n)}async function Wn(e){return O(),await j.getCode(e)}async function Xn(e){return O(),await j.isCodeFree(e)}async function Gn(e,t,n){O();const r=await j.getCode(t),s=new URLSearchParams({af:r??t});return n!=null&&n.title&&s.append("af_title",n.title),n!=null&&n.format&&s.append("af_format",n.format),n!=null&&n.place&&s.append("af_place",n.place),`${e}?${s.toString()}`}function Yn(e){return ne.getPayoutsLeaderboard(e)}function Qn(e){return ne.getPointsLeaderboard(e)}function Zn(e){return ne.getReferredUsersLeaderboard(e)}function er(e){return k.getVolumeLeaderboard(e)}function tr(e){return k.getUserPayoutsByConversion(e)}function nr(e){return k.getUserPointsByConversion(e)}function rr(e){return k.getUserPayoutMovements(e)}function sr(e){return k.getUserPointsMovements(e)}async function or(e){return O(),it.getAll(e)}async function ir(e){return O(),at.getUserAffiliates(e)}async function ar(e){return O(),ct.getUserAudiences(e)}function Re(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Oe(){if(navigator.webdriver)throw new Error("Fuul SDK: You are using a browser automation tool")}function cr(){if(!Ae)throw new Error("Fuul SDK: Invalid API key")}function ur(e,t){return new Pn({baseURL:e,timeout:1e4,apiKey:Ae,queryParams:t})}const lr={init:Hn,sendEvent:Vn,sendPageview:zn,sendConnectWallet:Kn,generateTrackingLink:Gn,getConversions:or,createAffiliateCode:Jn,updateAffiliateCode:Mn,getAffiliateCode:Wn,isAffiliateCodeFree:Xn,getPayoutsLeaderboard:Yn,getPointsLeaderboard:Qn,getReferredUsersLeaderboard:Zn,getUserAudiences:ar,getUserPayoutsByConversion:tr,getUserPointsByConversion:nr,getUserPointsMovements:sr,getUserPayoutMovements:rr,getUserAffiliates:ir,getVolumeLeaderboard:er};E.AddressInUseError=we,E.CodeInUseError=be,E.Fuul=lr,E.InvalidSignatureError=Ee,E.ValidationError=ge,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(E,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(E=typeof globalThis<"u"?globalThis:E||self,C(E.Fuul={}))})(this,function(E){"use strict";var dr=Object.defineProperty;var hr=(E,C,L)=>C in E?dr(E,C,{enumerable:!0,configurable:!0,writable:!0,value:L}):E[C]=L;var b=(E,C,L)=>(hr(E,typeof C!="symbol"?C+"":C,L),L);function C(e,t){return function(){return e.apply(t,arguments)}}const{toString:L}=Object.prototype,{getPrototypeOf:re}=Object,K=(e=>t=>{const n=L.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),T=e=>(e=e.toLowerCase(),t=>K(t)===e),J=e=>t=>typeof t===e,{isArray:B}=Array,$=J("undefined");function lt(e){return e!==null&&!$(e)&&e.constructor!==null&&!$(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Te=T("ArrayBuffer");function ft(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Te(e.buffer),t}const dt=J("string"),A=J("function"),Pe=J("number"),M=e=>e!==null&&typeof e=="object",ht=e=>e===!0||e===!1,W=e=>{if(K(e)!=="object")return!1;const t=re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},pt=T("Date"),mt=T("File"),yt=T("Blob"),gt=T("FileList"),wt=e=>M(e)&&A(e.pipe),bt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=K(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},Et=T("URLSearchParams"),St=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function q(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),B(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function _e(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Ne=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),xe=e=>!$(e)&&e!==Ne;function se(){const{caseless:e}=xe(this)&&this||{},t={},n=(r,s)=>{const o=e&&_e(t,s)||s;W(t[o])&&W(r)?t[o]=se(t[o],r):W(r)?t[o]=se({},r):B(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&q(arguments[r],n);return t}const Ct=(e,t,n,{allOwnKeys:r}={})=>(q(t,(s,o)=>{n&&A(s)?e[o]=C(s,n):e[o]=s},{allOwnKeys:r}),e),At=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Rt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Ot=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&re(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Pt=e=>{if(!e)return null;if(B(e))return e;let t=e.length;if(!Pe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},_t=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&re(Uint8Array)),Nt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},xt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ut=T("HTMLFormElement"),Ft=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ue=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Lt=T("RegExp"),Fe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};q(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Dt=e=>{Fe(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(A(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Bt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return B(e)?r(e):r(String(e).split(t)),n},It=()=>{},vt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),oe="abcdefghijklmnopqrstuvwxyz",Le="0123456789",De={DIGIT:Le,ALPHA:oe,ALPHA_DIGIT:oe+oe.toUpperCase()+Le},jt=(e=16,t=De.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function kt(e){return!!(e&&A(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const $t=e=>{const t=new Array(10),n=(r,s)=>{if(M(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const o=B(r)?[]:{};return q(r,(i,c)=>{const l=n(i,s+1);!$(l)&&(o[c]=l)}),t[s]=void 0,o}}return r};return n(e,0)},qt=T("AsyncFunction"),a={isArray:B,isArrayBuffer:Te,isBuffer:lt,isFormData:bt,isArrayBufferView:ft,isString:dt,isNumber:Pe,isBoolean:ht,isObject:M,isPlainObject:W,isUndefined:$,isDate:pt,isFile:mt,isBlob:yt,isRegExp:Lt,isFunction:A,isStream:wt,isURLSearchParams:Et,isTypedArray:_t,isFileList:gt,forEach:q,merge:se,extend:Ct,trim:St,stripBOM:At,inherits:Rt,toFlatObject:Ot,kindOf:K,kindOfTest:T,endsWith:Tt,toArray:Pt,forEachEntry:Nt,matchAll:xt,isHTMLForm:Ut,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:Fe,freezeMethods:Dt,toObjectSet:Bt,toCamelCase:Ft,noop:It,toFiniteNumber:vt,findKey:_e,global:Ne,isContextDefined:xe,ALPHABET:De,generateString:jt,isSpecCompliantForm:kt,toJSONObject:$t,isAsyncFn:qt,isThenable:e=>e&&(M(e)||A(e))&&A(e.then)&&A(e.catch)};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Be=m.prototype,Ie={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ie[e]={value:e}}),Object.defineProperties(m,Ie),Object.defineProperty(Be,"isAxiosError",{value:!0}),m.from=(e,t,n,r,s,o)=>{const i=Object.create(Be);return a.toFlatObject(e,i,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),m.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const Ht=null;function ie(e){return a.isPlainObject(e)||a.isArray(e)}function ve(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function je(e,t,n){return e?e.concat(t).map(function(s,o){return s=ve(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Vt(e){return a.isArray(e)&&!e.some(ie)}const zt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function X(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,w){return!a.isUndefined(w[h])});const r=n.metaTokens,s=n.visitor||f,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(!l&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?l&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function f(d,h,w){let S=d;if(d&&!w&&typeof d=="object"){if(a.endsWith(h,"{}"))h=r?h:h.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Vt(d)||(a.isFileList(d)||a.endsWith(h,"[]"))&&(S=a.toArray(d)))return h=ve(h),S.forEach(function(F,fr){!(a.isUndefined(F)||F===null)&&t.append(i===!0?je([h],fr,o):i===null?h:h+"[]",p(F))}),!1}return ie(d)?!0:(t.append(je(w,h,o),p(d)),!1)}const u=[],g=Object.assign(zt,{defaultVisitor:f,convertValue:p,isVisitable:ie});function R(d,h){if(!a.isUndefined(d)){if(u.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));u.push(d),a.forEach(d,function(S,U){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(U)?U.trim():U,h,g))===!0&&R(S,h?h.concat(U):[U])}),u.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return R(e),t}function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ae(e,t){this._pairs=[],e&&X(e,this,t)}const $e=ae.prototype;$e.append=function(t,n){this._pairs.push([t,n])},$e.toString=function(t){const n=t?function(r){return t.call(this,r,ke)}:ke;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Kt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qe(e,t,n){if(!t)return e;const r=n&&n.encode||Kt,s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new ae(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Jt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const He=Jt,Ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ae,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ze=typeof window<"u"&&typeof document<"u",Wt=(e=>ze&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Xt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),P={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ze,hasStandardBrowserEnv:Wt,hasStandardBrowserWebWorkerEnv:Xt},Symbol.toStringTag,{value:"Module"})),...Mt};function Gt(e,t){return X(e,new P.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return P.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Yt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qt(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Ke(e){function t(n,r,s,o){let i=n[o++];const c=Number.isFinite(+i),l=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,l?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=Qt(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Yt(r),s,n,0)}),n}return null}function Zt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ce={transitional:Ve,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(Ke(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return X(c?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Zt(t)):t}],transformResponse:[function(t){const n=this.transitional||ce.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ce.headers[e]={}});const ue=ce,en=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&en[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Je=Symbol("internals");function H(e){return e&&String(e).trim().toLowerCase()}function G(e){return e===!1||e==null?e:a.isArray(e)?e.map(G):String(e)}function nn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const rn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function le(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function sn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function on(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let Y=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,l,p){const f=H(l);if(!f)throw new Error("header name must be a non-empty string");const u=a.findKey(s,f);(!u||s[u]===void 0||p===!0||p===void 0&&s[u]!==!1)&&(s[u||l]=G(c))}const i=(c,l)=>a.forEach(c,(p,f)=>o(p,f,l));return a.isPlainObject(t)||t instanceof this.constructor?i(t,n):a.isString(t)&&(t=t.trim())&&!rn(t)?i(tn(t),n):t!=null&&o(n,t,r),this}get(t,n){if(t=H(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return nn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=H(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||le(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=H(i),i){const c=a.findKey(r,i);c&&(!n||le(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||le(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=G(s),delete n[o];return}const c=t?sn(o):String(o).trim();c!==o&&delete n[o],n[c]=G(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
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[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=H(i);r[c]||(on(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};Y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(Y.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(Y);const _=Y;function fe(e,t){const n=this||ue,r=t||n,s=_.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 Me(e){return!!(e&&e.__CANCEL__)}function V(e,t,n){m.call(this,e??"canceled",m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(V,m,{__CANCEL__:!0});function an(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const cn=P.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 un(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ln(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function We(e,t){return e&&!un(t)?ln(e,t):t}const fn=P.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}}();function dn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function hn(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(l){const p=Date.now(),f=r[o];i||(i=p),n[s]=l,r[s]=p;let u=o,g=0;for(;u!==s;)g+=n[u++],u=u%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),p-i<t)return;const R=f&&p-f;return R?Math.round(g*1e3/R):void 0}}function Xe(e,t){let n=0;const r=hn(50,250);return s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,c=o-n,l=r(c),p=o<=i;n=o;const f={loaded:o,total:i,progress:i?o/i:void 0,bytes:c,rate:l||void 0,estimated:l&&i&&p?(i-o)/l:void 0,event:s};f[t?"download":"upload"]=!0,e(f)}}const de={http:Ht,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let s=e.data;const o=_.from(e.headers).normalize();let{responseType:i,withXSRFToken:c}=e,l;function p(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}let f;if(a.isFormData(s)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((f=o.getContentType())!==!1){const[h,...w]=f?f.split(";").map(S=>S.trim()).filter(Boolean):[];o.setContentType([h||"multipart/form-data",...w].join("; "))}}let u=new XMLHttpRequest;if(e.auth){const h=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(h+":"+w))}const g=We(e.baseURL,e.url);u.open(e.method.toUpperCase(),qe(g,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function R(){if(!u)return;const h=_.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),S={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:h,config:e,request:u};an(function(F){n(F),p()},function(F){r(F),p()},S),u=null}if("onloadend"in u?u.onloadend=R:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(R)},u.onabort=function(){u&&(r(new m("Request aborted",m.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new m("Network Error",m.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const S=e.transitional||Ve;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),r(new m(w,S.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,u)),u=null},P.hasStandardBrowserEnv&&(c&&a.isFunction(c)&&(c=c(e)),c||c!==!1&&fn(g))){const h=e.xsrfHeaderName&&e.xsrfCookieName&&cn.read(e.xsrfCookieName);h&&o.set(e.xsrfHeaderName,h)}s===void 0&&o.setContentType(null),"setRequestHeader"in u&&a.forEach(o.toJSON(),function(w,S){u.setRequestHeader(S,w)}),a.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Xe(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Xe(e.onUploadProgress)),(e.cancelToken||e.signal)&&(l=h=>{u&&(r(!h||h.type?new V(null,e,u):h),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l)));const d=dn(g);if(d&&P.protocols.indexOf(d)===-1){r(new m("Unsupported protocol "+d+":",m.ERR_BAD_REQUEST,e));return}u.send(s||null)})}};a.forEach(de,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ge=e=>`- ${e}`,pn=e=>a.isFunction(e)||e===null||e===!1,Ye={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,!pn(n)&&(r=de[(i=String(n)).toLowerCase()],r===void 0))throw new m(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since :
|
|
4
|
+
`+o.map(Ge).join(`
|
|
5
|
+
`):" "+Ge(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:de};function he(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new V(null,e)}function Qe(e){return he(e),e.headers=_.from(e.headers),e.data=fe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ye.getAdapter(e.adapter||ue.adapter)(e).then(function(r){return he(e),r.data=fe.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return Me(r)||(he(e),r&&r.response&&(r.response.data=fe.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const Ze=e=>e instanceof _?e.toJSON():e;function I(e,t){t=t||{};const n={};function r(p,f,u){return a.isPlainObject(p)&&a.isPlainObject(f)?a.merge.call({caseless:u},p,f):a.isPlainObject(f)?a.merge({},f):a.isArray(f)?f.slice():f}function s(p,f,u){if(a.isUndefined(f)){if(!a.isUndefined(p))return r(void 0,p,u)}else return r(p,f,u)}function o(p,f){if(!a.isUndefined(f))return r(void 0,f)}function i(p,f){if(a.isUndefined(f)){if(!a.isUndefined(p))return r(void 0,p)}else return r(void 0,f)}function c(p,f,u){if(u in t)return r(p,f);if(u in e)return r(void 0,p)}const l={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:(p,f)=>s(Ze(p),Ze(f),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(f){const u=l[f]||s,g=u(e[f],t[f],f);a.isUndefined(g)&&u!==c||(n[f]=g)}),n}const et="1.6.3",pe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const tt={};pe.transitional=function(t,n,r){function s(o,i){return"[Axios v"+et+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new m(s(i," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!tt[i]&&(tt[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 m("options must be an object",m.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],l=c===void 0||i(c,o,e);if(l!==!0)throw new m("option "+o+" must be "+l,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}const me={assertOptions:mn,validators:pe},N=me.validators;let Q=class{constructor(t){this.defaults=t,this.interceptors={request:new He,response:new He}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=I(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&me.assertOptions(r,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:me.assertOptions(s,{encode:N.function,serialize:N.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"],d=>{delete o[d]}),n.headers=_.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(l=l&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});const p=[];this.interceptors.response.forEach(function(h){p.push(h.fulfilled,h.rejected)});let f,u=0,g;if(!l){const d=[Qe.bind(this),void 0];for(d.unshift.apply(d,c),d.push.apply(d,p),g=d.length,f=Promise.resolve(n);u<g;)f=f.then(d[u++],d[u++]);return f}g=c.length;let R=n;for(u=0;u<g;){const d=c[u++],h=c[u++];try{R=d(R)}catch(w){h.call(this,w);break}}try{f=Qe.call(this,R)}catch(d){return Promise.reject(d)}for(u=0,g=p.length;u<g;)f=f.then(p[u++],p[u++]);return f}getUri(t){t=I(this.defaults,t);const n=We(t.baseURL,t.url);return qe(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){Q.prototype[t]=function(n,r){return this.request(I(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(I(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Q.prototype[t]=n(),Q.prototype[t+"Form"]=n(!0)});const Z=Q,yn=class ut{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 V(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 ut(function(s){t=s}),cancel:t}}};function gn(e){return function(n){return e.apply(null,n)}}function wn(e){return a.isObject(e)&&e.isAxiosError===!0}const ye={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(ye).forEach(([e,t])=>{ye[t]=e});const bn=ye;function nt(e){const t=new Z(e),n=C(Z.prototype.request,t);return a.extend(n,Z.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return nt(I(e,s))},n}const y=nt(ue);y.Axios=Z,y.CanceledError=V,y.CancelToken=yn,y.isCancel=Me,y.VERSION=et,y.toFormData=X,y.AxiosError=m,y.Cancel=y.CanceledError,y.all=function(t){return Promise.all(t)},y.spread=gn,y.isAxiosError=wn,y.mergeConfig=I,y.AxiosHeaders=_,y.formToJSON=e=>Ke(a.isHTMLForm(e)?new FormData(e):e),y.getAdapter=Ye.getAdapter,y.HttpStatusCode=bn,y.default=y;const rt=y,{Axios:Cr,AxiosError:ee,CanceledError:Ar,isCancel:Rr,CancelToken:Or,VERSION:Tr,all:Pr,Cancel:_r,isAxiosError:Nr,spread:xr,toFormData:Ur,AxiosHeaders:Fr,HttpStatusCode:Lr,formToJSON:Dr,getAdapter:Br,mergeConfig:Ir}=rt;class ge extends Error{constructor(n){super(n.join(", "));b(this,"errors");this.name="ValidationError",this.errors=n}}class we extends Error{constructor(n){super("Address already registered.");b(this,"address");this.name="AddressInUseError",this.address=n}}class be extends Error{constructor(n){super("Code already registered.");b(this,"code");this.name="CodeInUseError",this.code=n}}class Ee extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class En{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async create(t,n,r,s){var o;try{await this.httpClient.post("/affiliates",{address:t,name:n,code:n,signature:r,account_chain_id:s})}catch(i){if(i instanceof ee){const c=(o=i.response)==null?void 0:o.data;if(typeof(c==null?void 0:c.message)=="string"){const l=c.message.toLowerCase();throw l=="invalid signature"?new Ee:l=="address in use"?new we(t):l=="code in use"?new be(n):new Error(l)}else if((c==null?void 0:c.message)instanceof Array)throw new ge(c.message)}throw i}}async update(t,n,r,s){var o;try{await this.httpClient.post(`/affiliates/${t}`,{code:n,address:t,signature:r,account_chain_id:s})}catch(i){if(i instanceof ee){const c=(o=i.response)==null?void 0:o.data;if(typeof(c==null?void 0:c.message)=="string"){const l=c.message.toLowerCase();throw l=="invalid signature"?new Ee:l=="address in use"?new we(t):l=="code in use"?new be(n):new Error(l)}else if((c==null?void 0:c.message)instanceof Array)throw new ge(c.message)}throw i}}async isCodeFree(t){var n;try{return await this.httpClient.get(`/affiliates/codes/${t}`),!1}catch(r){if(r instanceof ee&&((n=r.response)==null?void 0:n.status)===404)return!0;throw console.error("Fuul SDK: Could not check affiliate code",r),r}}async getCode(t){var n;try{return(await this.httpClient.get(`/affiliates/${t}`)).data.code}catch(r){if(r instanceof ee&&((n=r.response)==null?void 0:n.status)===404)return null;throw console.error("Fuul SDK: Could not get affiliate code",r),r}}}const Sn="/audiences";class Cn{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getUserAudiences(t){return(await this.httpClient.get(`${Sn}/user`,t)).data}}class An{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getAll(t){const{data:n}=await this.httpClient.get("conversions",t);return n}}const st="fuul.sent",Rn=60;class On{constructor(t){b(this,"debug");b(this,"httpClient");this.httpClient=t.httpClient,this.debug=!!t.debug}async sendEvent(t){if(this.isDuplicate(t)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}await this.httpClient.post("events",t),this.debug&&console.debug(`Fuul SDK: Sent '${t.name}' event`),this.saveSentEvent(t)}isDuplicate(t){const n=`${st}_${t.name}`,r=localStorage.getItem(n);if(!r)return!1;const s=JSON.parse(r);if(this.getCurrentTimestamp()-s.timestamp>Rn)return!1;let l=!1;t.metadata&&(l=s.metadata.tracking_id===t.metadata.tracking_id&&s.metadata.project_id===t.metadata.project_id&&s.metadata.referrer===t.metadata.referrer&&s.metadata.source===t.metadata.source&&s.metadata.category===t.metadata.category&&s.metadata.title===t.metadata.title&&s.metadata.tag===t.metadata.tag&&s.user_address===t.user_address&&s.signature===t.signature&&s.signature_message===t.signature_message);let p=!1;return t.args&&s.args&&(p=s.args.page===t.args.page),p&&l}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(t){const n=`${st}_${t.name}`,r=this.getCurrentTimestamp(),s={...t,timestamp:r};localStorage.setItem(n,JSON.stringify(s))}}const Tn={version:"4.11.0"};class Pn{constructor(t){b(this,"client");b(this,"queryParams");this.client=rt.create({...t,headers:{Authorization:`Bearer ${t.apiKey}`,"X-Fuul-Sdk-Version":Tn.version}}),this.queryParams=t.queryParams?this.buildQueryParams(t.queryParams):""}buildQueryParams(t){let n="";return Object.keys(t).forEach(r=>{n=n===""?n+`?${r}=${t[r]}`:n+`&${r}=${t[r]}`}),n}async get(t,n){return this.client.get(t+this.queryParams,{params:n})}async post(t,n){return this.client.post(t+this.queryParams,n)}async put(t,n){return this.client.put(t+this.queryParams,n)}async delete(t){return this.client.delete(t+this.queryParams)}}class _n{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getPayoutsLeaderboard(t){return(await this.httpClient.get("/payouts/leaderboard/payouts",t)).data}async getPointsLeaderboard(t){return(await this.httpClient.get("/payouts/leaderboard/points",t)).data}async getReferredUsersLeaderboard(t){return(await this.httpClient.get("/leaderboard/referred",t)).data}}const z="/payouts";class Nn{constructor(t){b(this,"httpClient");b(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getUserPayoutsByConversion(t){return(await this.httpClient.get(z,{...t,type:"onchain-currency"})).data}async getUserPointsByConversion(t){return(await this.httpClient.get(z,{...t,type:"point"})).data}async getUserPayoutMovements(t){return(await this.httpClient.get(`${z}/movements`,{...t,type:"onchain-currency"})).data}async getUserPointsMovements(t){return(await this.httpClient.get(`${z}/movements`,{...t,type:"point"})).data}async getVolumeLeaderboard(t){return(await this.httpClient.get(`${z}/leaderboard/volume`,t)).data}}let xn=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const Un="fuul.tracking_id",Se=()=>vn(Un,()=>xn()),ot=()=>v("af")||v("referrer"),Fn=()=>document.referrer,Ln=()=>jn(),Dn=()=>v("category"),Bn=()=>v("title"),In=()=>v("tag"),vn=(e,t)=>{const n=localStorage.getItem(e);if(n)return n;{const r=t();return r?localStorage.setItem(e,r):localStorage.removeItem(e),r}},v=e=>new URLSearchParams(window.location.search).get(e),jn=()=>{const e=v("source");if(e)return e},kn="/user";class $n{constructor(t){b(this,"httpClient");this.httpClient=t.httpClient}async getUserAffiliates(t){return(await this.httpClient.get(kn,t)).data.affiliates}}const qn="https://api.fuul.xyz/api/v1/";let D=!1,Ce=!1,Ae,x,it,at,j,te,k,ct,ne;function Hn(e){D=!!e.debug,!Ce&&(Ae=e.apiKey,cr(),x=ur(e.baseApiUrl??qn,e.defaultQueryParams??{}),it=new An({httpClient:x,debug:D}),te=new On({httpClient:x,debug:D}),j=new En({httpClient:x,debug:D}),k=new Nn({httpClient:x,debug:D}),at=new $n({httpClient:x}),ct=new Cn({httpClient:x,debug:D}),ne=new _n({httpClient:x}),Ce=!0,D&&console.debug("Fuul SDK: init() complete"))}function O(){if(!Ce)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function Vn(e,t){O(),Re(),Oe();const n={name:e,args:t??{},metadata:{tracking_id:Se()}};await te.sendEvent(n)}async function zn(e){O(),Re(),Oe();const t={name:"pageview",args:{page:e??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:Se(),referrer_url:Fn(),source:Ln(),affiliate_id:ot()??void 0,referrer:ot()??void 0,category:Dn()??void 0,title:Bn()??void 0,tag:In()??void 0}};await te.sendEvent(t)}async function Kn(e){O(),Re(),Oe();const t={name:"connect_wallet",args:{page:document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:Se()}};e!=null&&e.address&&(t.user_address=e.address),e!=null&&e.signature&&(t.signature=e==null?void 0:e.signature,t.signature_message=e==null?void 0:e.message),e!=null&&e.accountChainId&&(t.account_chain_id=e.accountChainId),await te.sendEvent(t)}async function Jn(e){O(),await j.create(e.address,e.code,e.signature,e.accountChainId)}async function Mn(e){O(),await j.update(e.address,e.code,e.signature,e.accountChainId)}async function Wn(e){return O(),await j.getCode(e)}async function Xn(e){return O(),await j.isCodeFree(e)}async function Gn(e,t,n){O();const r=await j.getCode(t),s=new URLSearchParams({af:r??t});return n!=null&&n.title&&s.append("af_title",n.title),n!=null&&n.format&&s.append("af_format",n.format),n!=null&&n.place&&s.append("af_place",n.place),`${e}?${s.toString()}`}function Yn(e){return ne.getPayoutsLeaderboard(e)}function Qn(e){return ne.getPointsLeaderboard(e)}function Zn(e){return ne.getReferredUsersLeaderboard(e)}function er(e){return k.getVolumeLeaderboard(e)}function tr(e){return k.getUserPayoutsByConversion(e)}function nr(e){return k.getUserPointsByConversion(e)}function rr(e){return k.getUserPayoutMovements(e)}function sr(e){return k.getUserPointsMovements(e)}async function or(e){return O(),it.getAll(e)}async function ir(e){return O(),at.getUserAffiliates(e)}async function ar(e){return O(),ct.getUserAudiences(e)}function Re(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Oe(){if(navigator.webdriver)throw new Error("Fuul SDK: You are using a browser automation tool")}function cr(){if(!Ae)throw new Error("Fuul SDK: Invalid API key")}function ur(e,t){return new Pn({baseURL:e,timeout:1e4,apiKey:Ae,queryParams:t})}const lr={init:Hn,sendEvent:Vn,sendPageview:zn,sendConnectWallet:Kn,generateTrackingLink:Gn,getConversions:or,createAffiliateCode:Jn,updateAffiliateCode:Mn,getAffiliateCode:Wn,isAffiliateCodeFree:Xn,getPayoutsLeaderboard:Yn,getPointsLeaderboard:Qn,getReferredUsersLeaderboard:Zn,getUserAudiences:ar,getUserPayoutsByConversion:tr,getUserPointsByConversion:nr,getUserPointsMovements:sr,getUserPayoutMovements:rr,getUserAffiliates:ir,getVolumeLeaderboard:er};E.AddressInUseError=we,E.CodeInUseError=be,E.Fuul=lr,E.InvalidSignatureError=Ee,E.ValidationError=ge,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoutService.d.ts","sourceRoot":"","sources":["../../../src/payouts/PayoutService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"PayoutService.d.ts","sourceRoot":"","sources":["../../../src/payouts/PayoutService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,EAC9B,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,QAAQ,EAAE,qBAAqB;IAK9B,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAK9G,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAK3G,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAKlG,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAKlG,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;CAIvH"}
|
package/dist/types/sdk.d.ts
CHANGED
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
|