@fuul/sdk 7.21.0 → 7.23.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/affiliate-portal/AffiliatePortalService.d.ts +3 -1
- package/dist/affiliate-portal/AffiliatePortalService.d.ts.map +1 -1
- package/dist/affiliate-portal/types/index.d.ts +50 -2
- package/dist/affiliate-portal/types/index.d.ts.map +1 -1
- package/dist/core.d.ts +29 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +279 -247
- package/dist/index.umd.js +5 -5
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(R,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(R=typeof globalThis<"u"?globalThis:R||self,T(R.Fuul={}))})(this,(function(R){"use strict";var Is=Object.defineProperty;var Bs=(R,T,W)=>T in R?Is(R,T,{enumerable:!0,configurable:!0,writable:!0,value:W}):R[T]=W;var b=(R,T,W)=>Bs(R,typeof T!="symbol"?T+"":T,W);const T="/affiliate-portal";class W{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getAffiliateStats(e){return(await this.httpClient.get({path:`${T}/stats`,queryParams:{user_identifier:e.user_identifier,from:e.from,to:e.to,this_month:e.this_month,conversion_id:e.conversion_id,conversion_name:e.conversion_name}})).data}async getAffiliateTotalStats(e){return(await this.httpClient.get({path:`${T}/total-stats`,queryParams:{statuses:e.statuses,regions:e.regions,audiences:e.audiences}})).data}async getAffiliateNewTraders(e){return(await this.httpClient.get({path:`${T}/new-traders`,queryParams:{user_identifier:e.user_identifier,from:e.from,to:e.to,this_month:e.this_month}})).data}}function Xe(t,e){return function(){return t.apply(e,arguments)}}const{toString:Qt}=Object.prototype,{getPrototypeOf:Oe}=Object,{iterator:ue,toStringTag:Ye}=Symbol,le=(t=>e=>{const r=Qt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),F=t=>(t=t.toLowerCase(),e=>le(e)===t),de=t=>e=>typeof e===t,{isArray:Q}=Array,X=de("undefined");function ee(t){return t!==null&&!X(t)&&t.constructor!==null&&!X(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=F("ArrayBuffer");function Xt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Yt=de("string"),P=de("function"),Ze=de("number"),te=t=>t!==null&&typeof t=="object",Gt=t=>t===!0||t===!1,fe=t=>{if(le(t)!=="object")return!1;const e=Oe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ye in t)&&!(ue in t)},Zt=t=>{if(!te(t)||ee(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},er=F("Date"),tr=F("File"),rr=t=>!!(t&&typeof t.uri<"u"),nr=t=>t&&typeof t.getParts<"u",sr=F("Blob"),ir=F("FileList"),or=t=>te(t)&&P(t.pipe);function ar(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const et=ar(),tt=typeof et.FormData<"u"?et.FormData:void 0,cr=t=>{let e;return t&&(tt&&t instanceof tt||P(t.append)&&((e=le(t))==="formdata"||e==="object"&&P(t.toString)&&t.toString()==="[object FormData]"))},ur=F("URLSearchParams"),[lr,dr,fr,hr]=["ReadableStream","Request","Response","Headers"].map(F),pr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function re(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Q(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ee(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let c;for(n=0;n<o;n++)c=i[n],e.call(null,t[c],c,t)}}function rt(t,e){if(ee(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const M=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nt=t=>!X(t)&&t!==M;function Ne(){const{caseless:t,skipUndefined:e}=nt(this)&&this||{},r={},n=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=t&&rt(r,i)||i;fe(r[o])&&fe(s)?r[o]=Ne(r[o],s):fe(s)?r[o]=Ne({},s):Q(s)?r[o]=s.slice():(!e||!X(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&re(arguments[s],n);return r}const yr=(t,e,r,{allOwnKeys:n}={})=>(re(e,(s,i)=>{r&&P(s)?Object.defineProperty(t,i,{value:Xe(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),mr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),gr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},wr=(t,e,r,n)=>{let s,i,o;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!n||n(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=r!==!1&&Oe(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},br=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},_r=t=>{if(!t)return null;if(Q(t))return t;let e=t.length;if(!Ze(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Oe(Uint8Array)),Er=(t,e)=>{const n=(t&&t[ue]).call(t);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Rr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Sr=F("HTMLFormElement"),Ar=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),st=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Tr=F("RegExp"),it=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};re(r,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(n[i]=o||s)}),Object.defineProperties(t,n)},Pr=t=>{it(t,(e,r)=>{if(P(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(P(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Or=(t,e)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Q(t)?n(t):n(String(t).split(e)),r},Nr=()=>{},Ur=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xr(t){return!!(t&&P(t.append)&&t[Ye]==="FormData"&&t[ue])}const Dr=t=>{const e=new Array(10),r=(n,s)=>{if(te(n)){if(e.indexOf(n)>=0)return;if(ee(n))return n;if(!("toJSON"in n)){e[s]=n;const i=Q(n)?[]:{};return re(n,(o,c)=>{const f=r(o,s+1);!X(f)&&(i[c]=f)}),e[s]=void 0,i}}return n};return r(t,0)},Lr=F("AsyncFunction"),Fr=t=>t&&(te(t)||P(t))&&P(t.then)&&P(t.catch),ot=((t,e)=>t?setImmediate:e?((r,n)=>(M.addEventListener("message",({source:s,data:i})=>{s===M&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),M.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",P(M.postMessage)),kr=typeof queueMicrotask<"u"?queueMicrotask.bind(M):typeof process<"u"&&process.nextTick||ot,a={isArray:Q,isArrayBuffer:Ge,isBuffer:ee,isFormData:cr,isArrayBufferView:Xt,isString:Yt,isNumber:Ze,isBoolean:Gt,isObject:te,isPlainObject:fe,isEmptyObject:Zt,isReadableStream:lr,isRequest:dr,isResponse:fr,isHeaders:hr,isUndefined:X,isDate:er,isFile:tr,isReactNativeBlob:rr,isReactNative:nr,isBlob:sr,isRegExp:Tr,isFunction:P,isStream:or,isURLSearchParams:ur,isTypedArray:Cr,isFileList:ir,forEach:re,merge:Ne,extend:yr,trim:pr,stripBOM:mr,inherits:gr,toFlatObject:wr,kindOf:le,kindOfTest:F,endsWith:br,toArray:_r,forEachEntry:Er,matchAll:Rr,isHTMLForm:Sr,hasOwnProperty:st,hasOwnProp:st,reduceDescriptors:it,freezeMethods:Pr,toObjectSet:Or,toCamelCase:Ar,noop:Nr,toFiniteNumber:Ur,findKey:rt,global:M,isContextDefined:nt,isSpecCompliantForm:xr,toJSONObject:Dr,isAsyncFn:Lr,isThenable:Fr,setImmediate:ot,asap:kr,isIterable:t=>t!=null&&P(t[ue])};let m=class Jt extends Error{static from(e,r,n,s,i,o){const c=new Jt(e.message,r||e.code,n,s,i);return c.cause=e,c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),o&&Object.assign(c,o),c}constructor(e,r,n,s,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){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.status}}};m.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",m.ERR_BAD_OPTION="ERR_BAD_OPTION",m.ECONNABORTED="ECONNABORTED",m.ETIMEDOUT="ETIMEDOUT",m.ERR_NETWORK="ERR_NETWORK",m.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",m.ERR_DEPRECATED="ERR_DEPRECATED",m.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",m.ERR_BAD_REQUEST="ERR_BAD_REQUEST",m.ERR_CANCELED="ERR_CANCELED",m.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",m.ERR_INVALID_URL="ERR_INVALID_URL";const vr=null;function Ue(t){return a.isPlainObject(t)||a.isArray(t)}function at(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function xe(t,e,r){return t?t.concat(e).map(function(s,i){return s=at(s),!r&&i?"["+s+"]":s}).join(r?".":""):e}function Ir(t){return a.isArray(t)&&!t.some(Ue)}const Br=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function he(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,p){return!a.isUndefined(p[y])});const n=r.metaTokens,s=r.visitor||u,i=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,y,p){let C=d;if(a.isReactNative(e)&&a.isReactNativeBlob(d))return e.append(xe(p,y,i),l(d)),!1;if(d&&!p&&typeof d=="object"){if(a.endsWith(y,"{}"))y=n?y:y.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Ir(d)||(a.isFileList(d)||a.endsWith(y,"[]"))&&(C=a.toArray(d)))return y=at(y),C.forEach(function(S,N){!(a.isUndefined(S)||S===null)&&e.append(o===!0?xe([y],N,i):o===null?y:y+"[]",l(S))}),!1}return Ue(d)?!0:(e.append(xe(p,y,i),l(d)),!1)}const h=[],g=Object.assign(Br,{defaultVisitor:u,convertValue:l,isVisitable:Ue});function E(d,y){if(!a.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(d),a.forEach(d,function(C,D){(!(a.isUndefined(C)||C===null)&&s.call(e,C,a.isString(D)?D.trim():D,y,g))===!0&&E(C,y?y.concat(D):[D])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return E(t),e}function ct(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function De(t,e){this._pairs=[],t&&he(t,this,e)}const ut=De.prototype;ut.append=function(e,r){this._pairs.push([e,r])},ut.toString=function(e){const r=e?function(n){return e.call(this,n,ct)}:ct;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function qr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function lt(t,e,r){if(!e)return t;const n=r&&r.encode||qr,s=a.isFunction(r)?{serialize:r}:r,i=s&&s.serialize;let o;if(i?o=i(e,s):o=a.isURLSearchParams(e)?e.toString():new De(e,s).toString(n),o){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class dt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Le={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},jr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:De,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Fe=typeof window<"u"&&typeof document<"u",ke=typeof navigator=="object"&&navigator||void 0,$r=Fe&&(!ke||["ReactNative","NativeScript","NS"].indexOf(ke.product)<0),Mr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hr=Fe&&window.location.href||"http://localhost",A={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fe,hasStandardBrowserEnv:$r,hasStandardBrowserWebWorkerEnv:Mr,navigator:ke,origin:Hr},Symbol.toStringTag,{value:"Module"})),...jr};function Vr(t,e){return he(t,new A.classes.URLSearchParams,{visitor:function(r,n,s,i){return A.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Kr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zr(t){const e={},r=Object.keys(t);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],e[i]=t[i];return e}function ft(t){function e(r,n,s,i){let o=r[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),f=i>=r.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),e(r,n,s[o],i)&&a.isArray(s[o])&&(s[o]=zr(s[o])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(Kr(n),s,r,0)}),r}return null}function Jr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const ne={transitional:Le,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=a.isObject(e);if(i&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ft(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return he(c?{"files[]":e}:e,f&&new f,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),Jr(e)):e}],transformResponse:[function(e){const r=this.transitional||ne.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:A.classes.FormData,Blob:A.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{ne.headers[t]={}});const Wr=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"]),Qr=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
2
|
-
`).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||e[r]&&Wr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ht=Symbol("internals");function
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ht]=this[ht]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=se(o);n[c]||(Zr(s,o),n[c]=!0)}return a.isArray(e)?e.forEach(i):i(e),this}};O.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(O.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(O);function Ie(t,e){const r=this||ne,n=e||r,s=O.from(n.headers);let i=n.data;return a.forEach(t,function(c){i=c.call(r,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function pt(t){return!!(t&&t.__CANCEL__)}let ie=class extends m{constructor(e,r,n){super(e??"canceled",m.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function yt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function en(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function tn(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(f){const l=Date.now(),u=n[i];o||(o=l),r[s]=f,n[s]=l;let h=i,g=0;for(;h!==s;)g+=r[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),l-o<e)return;const E=u&&l-u;return E?Math.round(g*1e3/E):void 0}}function rn(t,e){let r=0,n=1e3/e,s,i;const o=(l,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),t(...l)};return[(...l)=>{const u=Date.now(),h=u-r;h>=n?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const ye=(t,e,r=3)=>{let n=0;const s=tn(50,250);return rn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-n,l=s(f),u=o<=c;n=o;const h={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-o)/l:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(h)},r)},mt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},gt=t=>(...e)=>a.asap(()=>t(...e)),nn=A.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,A.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(A.origin),A.navigator&&/(msie|trident)/i.test(A.navigator.userAgent)):()=>!0,sn=A.hasStandardBrowserEnv?{write(t,e,r,n,s,i,o){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function on(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function an(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wt(t,e,r){let n=!on(e);return t&&(n||r==!1)?an(t,e):e}const bt=t=>t instanceof O?{...t}:t;function H(t,e){e=e||{};const r={};function n(l,u,h,g){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:g},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,h,g){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,h,g)}else return n(l,u,h,g)}function i(l,u){if(!a.isUndefined(u))return n(void 0,u)}function o(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function c(l,u,h){if(h in e)return n(l,u);if(h in t)return n(void 0,l)}const f={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:(l,u,h)=>s(bt(l),bt(u),h,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=a.hasOwnProp(f,u)?f[u]:s,g=h(t[u],e[u],u);a.isUndefined(g)&&h!==c||(r[u]=g)}),r}const _t=t=>{const e=H({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;if(e.headers=o=O.from(o),e.url=lt(wt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(A.hasStandardBrowserEnv||A.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const f=r.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([u,h])=>{l.includes(u.toLowerCase())&&o.set(u,h)})}}if(A.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&nn(e.url))){const f=s&&i&&sn.read(i);f&&o.set(s,f)}return e},cn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=_t(t);let i=s.data;const o=O.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,u,h,g,E,d;function y(){E&&E(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function C(){if(!p)return;const S=O.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),v={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:t,request:p};yt(function(L){r(L),y()},function(L){n(L),y()},v),p=null}"onloadend"in p?p.onloadend=C:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(C)},p.onabort=function(){p&&(n(new m("Request aborted",m.ECONNABORTED,t,p)),p=null)},p.onerror=function(N){const v=N&&N.message?N.message:"Network Error",z=new m(v,m.ERR_NETWORK,t,p);z.event=N||null,n(z),p=null},p.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||Le;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),n(new m(N,v.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(N,v){p.setRequestHeader(v,N)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),c&&c!=="json"&&(p.responseType=s.responseType),l&&([g,d]=ye(l,!0),p.addEventListener("progress",g)),f&&p.upload&&([h,E]=ye(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=S=>{p&&(n(!S||S.type?new ie(null,t,p):S),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const D=en(s.url);if(D&&A.protocols.indexOf(D)===-1){n(new m("Unsupported protocol "+D+":",m.ERR_BAD_REQUEST,t));return}p.send(i||null)})},un=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const i=function(l){if(!s){s=!0,c();const u=l instanceof Error?l:this.reason;n.abort(u instanceof m?u:new ie(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new m(`timeout of ${e}ms exceeded`,m.ETIMEDOUT))},e);const c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),t=null)};t.forEach(l=>l.addEventListener("abort",i));const{signal:f}=n;return f.unsubscribe=()=>a.asap(c),f}},ln=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},dn=async function*(t,e){for await(const r of fn(t))yield*ln(r,e)},fn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Ct=(t,e,r,n)=>{const s=dn(t,e);let i=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await s.next();if(l){c(),f.close();return}let h=u.byteLength;if(r){let g=i+=h;r(g)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Et=64*1024,{isFunction:me}=a,hn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,At=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pn=t=>{t=a.merge.call({skipUndefined:!0},hn,t);const{fetch:e,Request:r,Response:n}=t,s=e?me(e):typeof fetch=="function",i=me(r),o=me(n);if(!s)return!1;const c=s&&me(Rt),f=s&&(typeof St=="function"?(d=>y=>d.encode(y))(new St):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=i&&c&&At(()=>{let d=!1;const y=new r(A.origin,{body:new Rt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!y}),u=o&&c&&At(()=>a.isReadableStream(new n("").body)),h={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!h[d]&&(h[d]=(y,p)=>{let C=y&&y[d];if(C)return C.call(y);throw new m(`Response type '${d}' is not supported`,m.ERR_NOT_SUPPORT,p)})});const g=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new r(A.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},E=async(d,y)=>{const p=a.toFiniteNumber(d.getContentLength());return p??g(y)};return async d=>{let{url:y,method:p,data:C,signal:D,cancelToken:S,timeout:N,onDownloadProgress:v,onUploadProgress:z,responseType:L,headers:We,withCredentials:Ae="same-origin",fetchOptions:$t}=_t(d),Mt=e||fetch;L=L?(L+"").toLowerCase():"text";let Te=un([D,S&&S.toAbortSignal()],N),ce=null;const J=Te&&Te.unsubscribe&&(()=>{Te.unsubscribe()});let Ht;try{if(z&&l&&p!=="get"&&p!=="head"&&(Ht=await E(We,C))!==0){let $=new r(y,{method:"POST",body:C,duplex:"half"}),Z;if(a.isFormData(C)&&(Z=$.headers.get("content-type"))&&We.setContentType(Z),$.body){const[Qe,Pe]=mt(Ht,ye(gt(z)));C=Ct($.body,Et,Qe,Pe)}}a.isString(Ae)||(Ae=Ae?"include":"omit");const U=i&&"credentials"in r.prototype,Vt={...$t,signal:Te,method:p.toUpperCase(),headers:We.normalize().toJSON(),body:C,duplex:"half",credentials:U?Ae:void 0};ce=i&&new r(y,Vt);let j=await(i?Mt(ce,$t):Mt(y,Vt));const Kt=u&&(L==="stream"||L==="response");if(u&&(v||Kt&&J)){const $={};["status","statusText","headers"].forEach(zt=>{$[zt]=j[zt]});const Z=a.toFiniteNumber(j.headers.get("content-length")),[Qe,Pe]=v&&mt(Z,ye(gt(v),!0))||[];j=new n(Ct(j.body,Et,Qe,()=>{Pe&&Pe(),J&&J()}),$)}L=L||"text";let vs=await h[a.findKey(h,L)||"text"](j,d);return!Kt&&J&&J(),await new Promise(($,Z)=>{yt($,Z,{data:vs,headers:O.from(j.headers),status:j.status,statusText:j.statusText,config:d,request:ce})})}catch(U){throw J&&J(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,d,ce,U&&U.response),{cause:U.cause||U}):m.from(U,U&&U.code,d,ce,U&&U.response)}}},yn=new Map,Tt=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,i=[n,s,r];let o=i.length,c=o,f,l,u=yn;for(;c--;)f=i[c],l=u.get(f),l===void 0&&u.set(f,l=c?new Map:pn(e)),u=l;return l};Tt();const Be={http:vr,xhr:cn,fetch:{get:Tt}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Pt=t=>`- ${t}`,mn=t=>a.isFunction(t)||t===null||t===!1;function gn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const i={};for(let o=0;o<r;o++){n=t[o];let c;if(s=n,!mn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new m(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=r?o.length>1?`since :
|
|
1
|
+
(function(R,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(R=typeof globalThis<"u"?globalThis:R||self,T(R.Fuul={}))})(this,(function(R){"use strict";var qs=Object.defineProperty;var $s=(R,T,W)=>T in R?qs(R,T,{enumerable:!0,configurable:!0,writable:!0,value:W}):R[T]=W;var b=(R,T,W)=>$s(R,typeof T!="symbol"?T+"":T,W);const T="/affiliate-portal";class W{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getAffiliateStats(e){return(await this.httpClient.get({path:`${T}/stats`,queryParams:{user_identifier:e.user_identifier,from:e.from,to:e.to,this_month:e.this_month,conversion_id:e.conversion_id,conversion_external_id:e.conversion_external_id,conversion_name:e.conversion_name}})).data}async getAffiliateTotalStats(e){return(await this.httpClient.get({path:`${T}/total-stats`,queryParams:{statuses:e.statuses,regions:e.regions,audiences:e.audiences}})).data}async getReferralTree(e){return(await this.httpClient.get({path:`${T}/referral-tree`,queryParams:{user_identifier:e.user_identifier}})).data}async getStatsBreakdown(e){return(await this.httpClient.get({path:`${T}/stats-breakdown`,queryParams:{user_identifier:e.user_identifier,group_by:e.group_by,date_range:e.date_range,from:e.from,to:e.to,conversion_external_id:e.conversion_external_id,conversion_name:e.conversion_name,currency_id:e.currency_id}})).data}async getAffiliateNewTraders(e){return(await this.httpClient.get({path:`${T}/new-traders`,queryParams:{user_identifier:e.user_identifier,from:e.from,to:e.to,this_month:e.this_month}})).data}}function Xe(t,e){return function(){return t.apply(e,arguments)}}const{toString:Qt}=Object.prototype,{getPrototypeOf:Oe}=Object,{iterator:le,toStringTag:Ye}=Symbol,de=(t=>e=>{const r=Qt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),F=t=>(t=t.toLowerCase(),e=>de(e)===t),fe=t=>e=>typeof e===t,{isArray:Q}=Array,X=fe("undefined");function te(t){return t!==null&&!X(t)&&t.constructor!==null&&!X(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=F("ArrayBuffer");function Xt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Yt=fe("string"),P=fe("function"),Ze=fe("number"),re=t=>t!==null&&typeof t=="object",Gt=t=>t===!0||t===!1,he=t=>{if(de(t)!=="object")return!1;const e=Oe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ye in t)&&!(le in t)},Zt=t=>{if(!re(t)||te(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},er=F("Date"),tr=F("File"),rr=t=>!!(t&&typeof t.uri<"u"),nr=t=>t&&typeof t.getParts<"u",sr=F("Blob"),ir=F("FileList"),or=t=>re(t)&&P(t.pipe);function ar(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const et=ar(),tt=typeof et.FormData<"u"?et.FormData:void 0,cr=t=>{let e;return t&&(tt&&t instanceof tt||P(t.append)&&((e=de(t))==="formdata"||e==="object"&&P(t.toString)&&t.toString()==="[object FormData]"))},ur=F("URLSearchParams"),[lr,dr,fr,hr]=["ReadableStream","Request","Response","Headers"].map(F),pr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ne(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Q(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(te(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let c;for(n=0;n<o;n++)c=i[n],e.call(null,t[c],c,t)}}function rt(t,e){if(te(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const M=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nt=t=>!X(t)&&t!==M;function Ne(){const{caseless:t,skipUndefined:e}=nt(this)&&this||{},r={},n=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=t&&rt(r,i)||i;he(r[o])&&he(s)?r[o]=Ne(r[o],s):he(s)?r[o]=Ne({},s):Q(s)?r[o]=s.slice():(!e||!X(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ne(arguments[s],n);return r}const yr=(t,e,r,{allOwnKeys:n}={})=>(ne(e,(s,i)=>{r&&P(s)?Object.defineProperty(t,i,{value:Xe(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),mr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),gr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},wr=(t,e,r,n)=>{let s,i,o;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!n||n(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=r!==!1&&Oe(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},br=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},_r=t=>{if(!t)return null;if(Q(t))return t;let e=t.length;if(!Ze(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Oe(Uint8Array)),Er=(t,e)=>{const n=(t&&t[le]).call(t);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Rr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Sr=F("HTMLFormElement"),Tr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),st=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ar=F("RegExp"),it=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ne(r,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(n[i]=o||s)}),Object.defineProperties(t,n)},Pr=t=>{it(t,(e,r)=>{if(P(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(P(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Or=(t,e)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Q(t)?n(t):n(String(t).split(e)),r},Nr=()=>{},Ur=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xr(t){return!!(t&&P(t.append)&&t[Ye]==="FormData"&&t[le])}const Dr=t=>{const e=new Array(10),r=(n,s)=>{if(re(n)){if(e.indexOf(n)>=0)return;if(te(n))return n;if(!("toJSON"in n)){e[s]=n;const i=Q(n)?[]:{};return ne(n,(o,c)=>{const f=r(o,s+1);!X(f)&&(i[c]=f)}),e[s]=void 0,i}}return n};return r(t,0)},Lr=F("AsyncFunction"),Fr=t=>t&&(re(t)||P(t))&&P(t.then)&&P(t.catch),ot=((t,e)=>t?setImmediate:e?((r,n)=>(M.addEventListener("message",({source:s,data:i})=>{s===M&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),M.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",P(M.postMessage)),kr=typeof queueMicrotask<"u"?queueMicrotask.bind(M):typeof process<"u"&&process.nextTick||ot,a={isArray:Q,isArrayBuffer:Ge,isBuffer:te,isFormData:cr,isArrayBufferView:Xt,isString:Yt,isNumber:Ze,isBoolean:Gt,isObject:re,isPlainObject:he,isEmptyObject:Zt,isReadableStream:lr,isRequest:dr,isResponse:fr,isHeaders:hr,isUndefined:X,isDate:er,isFile:tr,isReactNativeBlob:rr,isReactNative:nr,isBlob:sr,isRegExp:Ar,isFunction:P,isStream:or,isURLSearchParams:ur,isTypedArray:Cr,isFileList:ir,forEach:ne,merge:Ne,extend:yr,trim:pr,stripBOM:mr,inherits:gr,toFlatObject:wr,kindOf:de,kindOfTest:F,endsWith:br,toArray:_r,forEachEntry:Er,matchAll:Rr,isHTMLForm:Sr,hasOwnProperty:st,hasOwnProp:st,reduceDescriptors:it,freezeMethods:Pr,toObjectSet:Or,toCamelCase:Tr,noop:Nr,toFiniteNumber:Ur,findKey:rt,global:M,isContextDefined:nt,isSpecCompliantForm:xr,toJSONObject:Dr,isAsyncFn:Lr,isThenable:Fr,setImmediate:ot,asap:kr,isIterable:t=>t!=null&&P(t[le])};let m=class Jt extends Error{static from(e,r,n,s,i,o){const c=new Jt(e.message,r||e.code,n,s,i);return c.cause=e,c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),o&&Object.assign(c,o),c}constructor(e,r,n,s,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){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.status}}};m.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",m.ERR_BAD_OPTION="ERR_BAD_OPTION",m.ECONNABORTED="ECONNABORTED",m.ETIMEDOUT="ETIMEDOUT",m.ERR_NETWORK="ERR_NETWORK",m.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",m.ERR_DEPRECATED="ERR_DEPRECATED",m.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",m.ERR_BAD_REQUEST="ERR_BAD_REQUEST",m.ERR_CANCELED="ERR_CANCELED",m.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",m.ERR_INVALID_URL="ERR_INVALID_URL";const vr=null;function Ue(t){return a.isPlainObject(t)||a.isArray(t)}function at(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function xe(t,e,r){return t?t.concat(e).map(function(s,i){return s=at(s),!r&&i?"["+s+"]":s}).join(r?".":""):e}function Br(t){return a.isArray(t)&&!t.some(Ue)}const Ir=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function pe(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,p){return!a.isUndefined(p[y])});const n=r.metaTokens,s=r.visitor||u,i=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,y,p){let C=d;if(a.isReactNative(e)&&a.isReactNativeBlob(d))return e.append(xe(p,y,i),l(d)),!1;if(d&&!p&&typeof d=="object"){if(a.endsWith(y,"{}"))y=n?y:y.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Br(d)||(a.isFileList(d)||a.endsWith(y,"[]"))&&(C=a.toArray(d)))return y=at(y),C.forEach(function(S,N){!(a.isUndefined(S)||S===null)&&e.append(o===!0?xe([y],N,i):o===null?y:y+"[]",l(S))}),!1}return Ue(d)?!0:(e.append(xe(p,y,i),l(d)),!1)}const h=[],g=Object.assign(Ir,{defaultVisitor:u,convertValue:l,isVisitable:Ue});function E(d,y){if(!a.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(d),a.forEach(d,function(C,D){(!(a.isUndefined(C)||C===null)&&s.call(e,C,a.isString(D)?D.trim():D,y,g))===!0&&E(C,y?y.concat(D):[D])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return E(t),e}function ct(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function De(t,e){this._pairs=[],t&&pe(t,this,e)}const ut=De.prototype;ut.append=function(e,r){this._pairs.push([e,r])},ut.toString=function(e){const r=e?function(n){return e.call(this,n,ct)}:ct;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function qr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function lt(t,e,r){if(!e)return t;const n=r&&r.encode||qr,s=a.isFunction(r)?{serialize:r}:r,i=s&&s.serialize;let o;if(i?o=i(e,s):o=a.isURLSearchParams(e)?e.toString():new De(e,s).toString(n),o){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class dt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Le={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},$r={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:De,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Fe=typeof window<"u"&&typeof document<"u",ke=typeof navigator=="object"&&navigator||void 0,jr=Fe&&(!ke||["ReactNative","NativeScript","NS"].indexOf(ke.product)<0),Mr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hr=Fe&&window.location.href||"http://localhost",A={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fe,hasStandardBrowserEnv:jr,hasStandardBrowserWebWorkerEnv:Mr,navigator:ke,origin:Hr},Symbol.toStringTag,{value:"Module"})),...$r};function Vr(t,e){return pe(t,new A.classes.URLSearchParams,{visitor:function(r,n,s,i){return A.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Kr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zr(t){const e={},r=Object.keys(t);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],e[i]=t[i];return e}function ft(t){function e(r,n,s,i){let o=r[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),f=i>=r.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),e(r,n,s[o],i)&&a.isArray(s[o])&&(s[o]=zr(s[o])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(Kr(n),s,r,0)}),r}return null}function Jr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const se={transitional:Le,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=a.isObject(e);if(i&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ft(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return pe(c?{"files[]":e}:e,f&&new f,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),Jr(e)):e}],transformResponse:[function(e){const r=this.transitional||se.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:A.classes.FormData,Blob:A.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{se.headers[t]={}});const Wr=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"]),Qr=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
2
|
+
`).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||e[r]&&Wr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ht=Symbol("internals");function ie(t){return t&&String(t).trim().toLowerCase()}function ye(t){return t===!1||t==null?t:a.isArray(t)?t.map(ye):String(t)}function Xr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Yr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ve(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Gr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Zr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let O=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function i(c,f,l){const u=ie(f);if(!u)throw new Error("header name must be a non-empty string");const h=a.findKey(s,u);(!h||s[h]===void 0||l===!0||l===void 0&&s[h]!==!1)&&(s[h||f]=ye(c))}const o=(c,f)=>a.forEach(c,(l,u)=>i(l,u,f));if(a.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(a.isString(e)&&(e=e.trim())&&!Yr(e))o(Qr(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},f,l;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[l=u[0]]=(f=c[l])?a.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(c,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=ie(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Xr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ie(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||ve(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function i(o){if(o=ie(o),o){const c=a.findKey(n,o);c&&(!r||ve(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(i):i(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!e||ve(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,i)=>{const o=a.findKey(n,i);if(o){r[o]=ye(s),delete r[i];return}const c=e?Gr(i):String(i).trim();c!==i&&delete r[i],r[c]=ye(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ht]=this[ht]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=ie(o);n[c]||(Zr(s,o),n[c]=!0)}return a.isArray(e)?e.forEach(i):i(e),this}};O.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(O.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(O);function Be(t,e){const r=this||se,n=e||r,s=O.from(n.headers);let i=n.data;return a.forEach(t,function(c){i=c.call(r,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function pt(t){return!!(t&&t.__CANCEL__)}let oe=class extends m{constructor(e,r,n){super(e??"canceled",m.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function yt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function en(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function tn(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(f){const l=Date.now(),u=n[i];o||(o=l),r[s]=f,n[s]=l;let h=i,g=0;for(;h!==s;)g+=r[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),l-o<e)return;const E=u&&l-u;return E?Math.round(g*1e3/E):void 0}}function rn(t,e){let r=0,n=1e3/e,s,i;const o=(l,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),t(...l)};return[(...l)=>{const u=Date.now(),h=u-r;h>=n?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const me=(t,e,r=3)=>{let n=0;const s=tn(50,250);return rn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-n,l=s(f),u=o<=c;n=o;const h={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-o)/l:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(h)},r)},mt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},gt=t=>(...e)=>a.asap(()=>t(...e)),nn=A.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,A.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(A.origin),A.navigator&&/(msie|trident)/i.test(A.navigator.userAgent)):()=>!0,sn=A.hasStandardBrowserEnv?{write(t,e,r,n,s,i,o){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function on(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function an(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wt(t,e,r){let n=!on(e);return t&&(n||r==!1)?an(t,e):e}const bt=t=>t instanceof O?{...t}:t;function H(t,e){e=e||{};const r={};function n(l,u,h,g){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:g},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,h,g){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,h,g)}else return n(l,u,h,g)}function i(l,u){if(!a.isUndefined(u))return n(void 0,u)}function o(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function c(l,u,h){if(h in e)return n(l,u);if(h in t)return n(void 0,l)}const f={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:(l,u,h)=>s(bt(l),bt(u),h,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=a.hasOwnProp(f,u)?f[u]:s,g=h(t[u],e[u],u);a.isUndefined(g)&&h!==c||(r[u]=g)}),r}const _t=t=>{const e=H({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;if(e.headers=o=O.from(o),e.url=lt(wt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(A.hasStandardBrowserEnv||A.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const f=r.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([u,h])=>{l.includes(u.toLowerCase())&&o.set(u,h)})}}if(A.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&nn(e.url))){const f=s&&i&&sn.read(i);f&&o.set(s,f)}return e},cn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=_t(t);let i=s.data;const o=O.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,u,h,g,E,d;function y(){E&&E(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function C(){if(!p)return;const S=O.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),v={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:t,request:p};yt(function(L){r(L),y()},function(L){n(L),y()},v),p=null}"onloadend"in p?p.onloadend=C:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(C)},p.onabort=function(){p&&(n(new m("Request aborted",m.ECONNABORTED,t,p)),p=null)},p.onerror=function(N){const v=N&&N.message?N.message:"Network Error",z=new m(v,m.ERR_NETWORK,t,p);z.event=N||null,n(z),p=null},p.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||Le;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),n(new m(N,v.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(N,v){p.setRequestHeader(v,N)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),c&&c!=="json"&&(p.responseType=s.responseType),l&&([g,d]=me(l,!0),p.addEventListener("progress",g)),f&&p.upload&&([h,E]=me(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=S=>{p&&(n(!S||S.type?new oe(null,t,p):S),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const D=en(s.url);if(D&&A.protocols.indexOf(D)===-1){n(new m("Unsupported protocol "+D+":",m.ERR_BAD_REQUEST,t));return}p.send(i||null)})},un=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const i=function(l){if(!s){s=!0,c();const u=l instanceof Error?l:this.reason;n.abort(u instanceof m?u:new oe(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new m(`timeout of ${e}ms exceeded`,m.ETIMEDOUT))},e);const c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),t=null)};t.forEach(l=>l.addEventListener("abort",i));const{signal:f}=n;return f.unsubscribe=()=>a.asap(c),f}},ln=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},dn=async function*(t,e){for await(const r of fn(t))yield*ln(r,e)},fn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Ct=(t,e,r,n)=>{const s=dn(t,e);let i=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await s.next();if(l){c(),f.close();return}let h=u.byteLength;if(r){let g=i+=h;r(g)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Et=64*1024,{isFunction:ge}=a,hn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,Tt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pn=t=>{t=a.merge.call({skipUndefined:!0},hn,t);const{fetch:e,Request:r,Response:n}=t,s=e?ge(e):typeof fetch=="function",i=ge(r),o=ge(n);if(!s)return!1;const c=s&&ge(Rt),f=s&&(typeof St=="function"?(d=>y=>d.encode(y))(new St):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=i&&c&&Tt(()=>{let d=!1;const y=new r(A.origin,{body:new Rt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!y}),u=o&&c&&Tt(()=>a.isReadableStream(new n("").body)),h={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!h[d]&&(h[d]=(y,p)=>{let C=y&&y[d];if(C)return C.call(y);throw new m(`Response type '${d}' is not supported`,m.ERR_NOT_SUPPORT,p)})});const g=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new r(A.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},E=async(d,y)=>{const p=a.toFiniteNumber(d.getContentLength());return p??g(y)};return async d=>{let{url:y,method:p,data:C,signal:D,cancelToken:S,timeout:N,onDownloadProgress:v,onUploadProgress:z,responseType:L,headers:We,withCredentials:Te="same-origin",fetchOptions:jt}=_t(d),Mt=e||fetch;L=L?(L+"").toLowerCase():"text";let Ae=un([D,S&&S.toAbortSignal()],N),ue=null;const J=Ae&&Ae.unsubscribe&&(()=>{Ae.unsubscribe()});let Ht;try{if(z&&l&&p!=="get"&&p!=="head"&&(Ht=await E(We,C))!==0){let j=new r(y,{method:"POST",body:C,duplex:"half"}),ee;if(a.isFormData(C)&&(ee=j.headers.get("content-type"))&&We.setContentType(ee),j.body){const[Qe,Pe]=mt(Ht,me(gt(z)));C=Ct(j.body,Et,Qe,Pe)}}a.isString(Te)||(Te=Te?"include":"omit");const U=i&&"credentials"in r.prototype,Vt={...jt,signal:Ae,method:p.toUpperCase(),headers:We.normalize().toJSON(),body:C,duplex:"half",credentials:U?Te:void 0};ue=i&&new r(y,Vt);let $=await(i?Mt(ue,jt):Mt(y,Vt));const Kt=u&&(L==="stream"||L==="response");if(u&&(v||Kt&&J)){const j={};["status","statusText","headers"].forEach(zt=>{j[zt]=$[zt]});const ee=a.toFiniteNumber($.headers.get("content-length")),[Qe,Pe]=v&&mt(ee,me(gt(v),!0))||[];$=new n(Ct($.body,Et,Qe,()=>{Pe&&Pe(),J&&J()}),j)}L=L||"text";let Is=await h[a.findKey(h,L)||"text"]($,d);return!Kt&&J&&J(),await new Promise((j,ee)=>{yt(j,ee,{data:Is,headers:O.from($.headers),status:$.status,statusText:$.statusText,config:d,request:ue})})}catch(U){throw J&&J(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,d,ue,U&&U.response),{cause:U.cause||U}):m.from(U,U&&U.code,d,ue,U&&U.response)}}},yn=new Map,At=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,i=[n,s,r];let o=i.length,c=o,f,l,u=yn;for(;c--;)f=i[c],l=u.get(f),l===void 0&&u.set(f,l=c?new Map:pn(e)),u=l;return l};At();const Ie={http:vr,xhr:cn,fetch:{get:At}};a.forEach(Ie,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Pt=t=>`- ${t}`,mn=t=>a.isFunction(t)||t===null||t===!1;function gn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const i={};for(let o=0;o<r;o++){n=t[o];let c;if(s=n,!mn(n)&&(s=Ie[(c=String(n)).toLowerCase()],s===void 0))throw new m(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=r?o.length>1?`since :
|
|
4
4
|
`+o.map(Pt).join(`
|
|
5
|
-
`):" "+Pt(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Ot={getAdapter:gn,adapters:
|
|
6
|
-
`+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=H(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&we.assertOptions(n,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean),legacyInterceptorReqResOrdering:x.transitional(x.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:we.assertOptions(s,{encode:x.function,serialize:x.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),we.assertOptions(r,{baseUrl:x.spelling("baseURL"),withXsrfToken:x.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[r.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=O.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(r)===!1)return;f=f&&y.synchronous;const p=r.transitional||Le;p&&p.legacyInterceptorReqResOrdering?c.unshift(y.fulfilled,y.rejected):c.push(y.fulfilled,y.rejected)});const l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let u,h=0,g;if(!f){const d=[Nt.bind(this),void 0];for(d.unshift(...c),d.push(...l),g=d.length,u=Promise.resolve(r);h<g;)u=u.then(d[h++],d[h++]);return u}g=c.length;let E=r;for(;h<g;){const d=c[h++],y=c[h++];try{E=d(E)}catch(p){y.call(this,p);break}}try{u=Nt.call(this,E)}catch(d){return Promise.reject(d)}for(h=0,g=l.length;h<g;)u=u.then(l[h++],l[h++]);return u}getUri(e){e=H(this.defaults,e);const r=wt(e.baseURL,e.url,e.allowAbsoluteUrls);return lt(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){V.prototype[e]=function(r,n){return this.request(H(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(i,o,c){return this.request(H(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}V.prototype[e]=r(),V.prototype[e+"Form"]=r(!0)});let bn=class Wt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new ie(i,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Wt(function(s){e=s}),cancel:e}}};function _n(t){return function(r){return t.apply(null,r)}}function Cn(t){return a.isObject(t)&&t.isAxiosError===!0}const je={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(je).forEach(([t,e])=>{je[e]=t});function Dt(t){const e=new V(t),r=Xe(V.prototype.request,e);return a.extend(r,V.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Dt(H(t,s))},r}const _=Dt(ne);_.Axios=V,_.CanceledError=ie,_.CancelToken=bn,_.isCancel=pt,_.VERSION=Ut,_.toFormData=he,_.AxiosError=m,_.Cancel=_.CanceledError,_.all=function(e){return Promise.all(e)},_.spread=_n,_.isAxiosError=Cn,_.mergeConfig=H,_.AxiosHeaders=O,_.formToJSON=t=>ft(a.isHTMLForm(t)?new FormData(t):t),_.getAdapter=Ot.getAdapter,_.HttpStatusCode=je,_.default=_;const{Axios:Ks,AxiosError:be,CanceledError:zs,isCancel:Js,CancelToken:Ws,VERSION:Qs,all:Xs,Cancel:Ys,isAxiosError:Gs,spread:Zs,toFormData:ei,AxiosHeaders:ti,HttpStatusCode:ri,formToJSON:ni,getAdapter:si,mergeConfig:ii}=_;class _e extends Error{constructor(r){super(r.join(", "));b(this,"errors");this.name="ValidationError",this.errors=r}}class $e extends Error{constructor(r){super("Address already registered.");b(this,"address");this.name="AddressInUseError",this.address=r}}class Me extends Error{constructor(r){super("Code already registered.");b(this,"code");this.name="CodeInUseError",this.code=r}}class Ce extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class En{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async create(e,r,n,s,i,o,c){var f;try{return(await this.httpClient.post({path:"/affiliates",postData:{address:e,identifier_type:r,name:n,code:n,signature:s,signature_public_key:i,account_chain_id:o,user_rebate_rate:c}})).data}catch(l){if(l instanceof be){const u=(f=l.response)==null?void 0:f.data;if(typeof(u==null?void 0:u.message)=="string"){const h=u.message.toLowerCase();throw h=="invalid signature"?new Ce:h=="address in use"?new $e(e):h=="code in use"?new Me(n):new Error(h)}else if((u==null?void 0:u.message)instanceof Array)throw new _e(u.message)}throw l}}async update(e,r,n,s,i,o){var c;try{await this.httpClient.post({path:`/affiliates/${e}`,postData:{code:n,user_identifier:e,identifier_type:r,signature:s,signature_public_key:i,account_chain_id:o}})}catch(f){if(f instanceof be){const l=(c=f.response)==null?void 0:c.data;if(typeof(l==null?void 0:l.message)=="string"){const u=l.message.toLowerCase();throw u=="invalid signature"?new Ce:u=="address in use"?new $e(e):u=="code in use"?new Me(n):new Error(u)}else if((l==null?void 0:l.message)instanceof Array)throw new _e(l.message)}throw f}}async updateRebateRate(e,r,n,s,i,o,c,f){var l;try{await this.httpClient.post({path:`/affiliates/${e}/rebate-rate`,postData:{identifier_type:r,code:n,signature:s,signature_public_key:o,account_chain_id:c,source_project_id:f,rebate_rate:i}})}catch(u){if(u instanceof be){const h=(l=u.response)==null?void 0:l.data;if(typeof(h==null?void 0:h.message)=="string"){const g=h.message.toLowerCase();throw g=="invalid signature"?new Ce:new Error(g)}else if((h==null?void 0:h.message)instanceof Array)throw new _e(h.message)}throw u}}async isCodeFree(e){try{return(await this.httpClient.get({path:`/affiliates/codes/${e}`})).data.free}catch(r){throw console.error("Fuul SDK: Could not check affiliate code",r),r}}async isCodeAvailable(e){try{return(await this.httpClient.get({path:`/affiliates/codes/${e}/availability`})).data.available}catch(r){throw console.error("Fuul SDK: Could not check affiliate code availability",r),r}}async getCode(e,r){var n;try{return(await this.httpClient.get({path:`/affiliates/${e}`,queryParams:{identifier_type:r}})).data}catch(s){if(s instanceof be&&((n=s.response)==null?void 0:n.status)===404)return null;throw console.error("Fuul SDK: Could not get affiliate code",s),s}}}const Rn="/audiences";class Sn{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getUserAudiences(e){return(await this.httpClient.get({path:`${Rn}/audience-segments/user`,queryParams:{...e}})).data}}const Ee="/claim-checks";class An{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getClaimChecks(e){const r={user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type};return e.status&&(r.status=e.status),(await this.httpClient.get({path:Ee,queryParams:r})).data}async closeClaimChecks(e){return(await this.httpClient.post({path:`${Ee}/close`,postData:{userIdentifier:e.user_identifier,userIdentifierType:e.user_identifier_type,claim_check_ids:e.claim_check_ids}})).data}async getClaimableChecks(e){return(await this.httpClient.post({path:`${Ee}/claim`,postData:{userIdentifier:e.user_identifier,userIdentifierType:e.user_identifier_type}})).data}async getClaimCheckTotals(e){return(await this.httpClient.get({path:`${Ee}/totals`,queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}}class Tn{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getAll(e){const{data:r}=await this.httpClient.get({path:"conversions",queryParams:{...e}});return r}}const Lt="fuul.sent",Pn=60,On="connect_wallet",Ft=10;class Nn{constructor(e){b(this,"debug");b(this,"httpClient");this.httpClient=e.httpClient,this.debug=!!e.debug}async sendEvent(e,r){if(this.isDuplicate(e)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}if(!r||!Array.isArray(r)||r.length===0)await this.httpClient.post({path:"events",postData:e});else for(const n of r){const s=structuredClone({...e,project_id:n});s.metadata.project_id=n,await this.httpClient.post({path:"events",postData:s,queryParams:{project_id:n}})}this.debug&&console.debug(`Fuul SDK: Sent '${e.name}' event`),this.saveSentEvent(e)}isDuplicate(e){var u,h,g,E;const r=`${Lt}_${e.name}`,n=localStorage.getItem(r);if(!n)return!1;const s=JSON.parse(n);if(this.getCurrentTimestamp()-s.timestamp>Pn)return!1;let f=!1;e.metadata&&(f=s.metadata.tracking_id===e.metadata.tracking_id&&s.metadata.project_id===e.metadata.project_id&&s.metadata.referrer===e.metadata.referrer&&s.metadata.source===e.metadata.source&&s.metadata.category===e.metadata.category&&s.metadata.title===e.metadata.title&&s.metadata.tag===e.metadata.tag&&s.user_address===e.user_address&&((u=s.user)==null?void 0:u.identifier)===((h=e.user)==null?void 0:h.identifier)&&((g=s.user)==null?void 0:g.identifier_type)===((E=e.user)==null?void 0:E.identifier_type)&&s.signature===e.signature&&s.signature_message===e.signature_message);let l=!1;return e.args&&s.args&&(l=s.args.page===e.args.page),l&&f}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(e){var o,c,f,l;const r=`${Lt}_${e.name}`,n=`${r}_all`,s=this.getCurrentTimestamp(),i={...e,timestamp:s};if(localStorage.setItem(r,JSON.stringify(i)),e.name===On){const u=JSON.parse(localStorage.getItem(n)||"[]"),h={name:e.name,user:{identifier:(o=e.user)==null?void 0:o.identifier,identifier_type:(c=e.user)==null?void 0:c.identifier_type},tracking_id:(f=e.metadata)==null?void 0:f.tracking_id,page:(l=e.args)==null?void 0:l.page};"user_address"in e&&(h.user_address=e.user_address);const g=[...u,h];g.length>Ft&&g.splice(0,g.length-Ft),localStorage.setItem(n,JSON.stringify(g))}}}const Un={version:"0.0.0"};class xn{constructor(e){b(this,"client");b(this,"defaultQueryParams");this.client=_.create({...e,headers:{Authorization:`Bearer ${e.apiKey}`,"X-Fuul-Sdk-Version":Un.version}}),this.defaultQueryParams=e.queryParams||{}}makeQueryParams(e){return Object.assign({},this.defaultQueryParams||{},e||{})}async get(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),method:"GET"})}async post(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"POST"})}async put(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"PUT"})}async patch(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"PATCH"})}async delete(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"DELETE"})}}class Dn{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getPayoutsLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,user_identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/payouts",queryParams:i})).data}async getPointsLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,user_identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/points",queryParams:i})).data}async getVolumeLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/volume",queryParams:i})).data}async getReferredUsersLeaderboard(e){return(await this.httpClient.get({path:"/leaderboard/referred",queryParams:{...e}})).data}async getReferredVolume(e){const{user_identifiers:r,...n}=e;return(await this.httpClient.get({path:"/payouts/leaderboard/referred-volume",queryParams:{...n,user_identifiers:r.join(",")}})).data}async getRevenueLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/revenue",queryParams:i})).data}}const oe="/payouts";class Ln{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getUserPayoutsByConversion(e){return(await this.httpClient.get({path:oe,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsByConversion(e){return(await this.httpClient.get({path:oe,queryParams:{...e,type:"point"}})).data}async getUserPayoutMovements(e){return(await this.httpClient.get({path:`${oe}/movements`,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsMovements(e){return(await this.httpClient.get({path:`${oe}/movements`,queryParams:{...e,type:"point"}})).data}async getPayoutsByReferrer(e){return(await this.httpClient.get({path:`${oe}/by-referrer`,queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}}class Fn{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async listUserReferralCodes(e){return(await this.httpClient.get({path:"/referral_codes",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type,page:e.page,page_size:e.page_size}})).data}async generateReferralCodes(e){return(await this.httpClient.post({path:"/referral_codes",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type,quantity:e.quantity,max_uses:e.max_uses}})).data}async getReferralStatus(e){return(await this.httpClient.get({path:"/referral_codes/status",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}async getReferralCode(e){return(await this.httpClient.get({path:`/referral_codes/${e.code}`})).data}async useReferralCode(e){const{code:r,user_identifier:n,user_identifier_type:s,signature:i,signature_message:o,chain_id:c}=e;await this.httpClient.patch({path:`/referral_codes/${r}/use`,queryParams:{user_identifier:n,user_identifier_type:s},postData:{signature:i,signature_message:o,chain_id:c}})}async updateReferralCode(e){await this.httpClient.patch({path:`/referral_codes/${e.code}`,postData:{max_uses:e.max_uses}})}async deleteReferral(e){const{code:r,user_identifier:n,user_identifier_type:s,referrer_identifier:i,referrer_identifier_type:o,signature:c,signature_message:f,chain_id:l}=e;await this.httpClient.delete({path:`/referral_codes/${r}/referrals`,queryParams:{user_identifier:n,user_identifier_type:s,referrer_identifier:i,referrer_identifier_type:o},postData:{signature:c,signature_message:f,chain_id:l}})}}const kn="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let vn=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=kn[r[t]&63];return e};const In="fuul.tracking_id",He=()=>Hn(In,()=>vn()),kt=()=>Y("af")||Y("referrer"),Bn=()=>document.referrer,qn=()=>Vn(),jn=()=>Y("category"),$n=()=>Y("title"),Mn=()=>Y("tag"),Hn=(t,e)=>{const r=localStorage.getItem(t);if(r)return r;{const n=e();return n?localStorage.setItem(t,n):localStorage.removeItem(t),n}},Y=t=>new URLSearchParams(window.location.search).get(t),Vn=()=>{const t=Y("source");if(t)return t},Kn="/user";class zn{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getUserReferrer(e){return(await this.httpClient.get({path:`${Kn}/referrer`,queryParams:{...e}})).data}}const Jn="https://api.fuul.xyz/api/v1/";let I=!1,Ve=!1,Ke,k,vt,It,B,Re,Se,G,Bt,K,q,ae;function Wn(t){I=!!t.debug,!Ve&&(Ke=t.apiKey,Ls(),k=Fs(t.baseApiUrl??Jn,t.defaultQueryParams??{}),vt=new Tn({httpClient:k,debug:I}),Se=new Nn({httpClient:k,debug:I}),B=new En({httpClient:k,debug:I}),Re=new W({httpClient:k}),G=new Ln({httpClient:k,debug:I}),It=new zn({httpClient:k}),Bt=new Sn({httpClient:k,debug:I}),K=new Dn({httpClient:k}),q=new Fn({httpClient:k,debug:I}),ae=new An({httpClient:k,debug:I}),Ve=!0,I&&console.debug("Fuul SDK: init() complete"))}function w(){if(!Ve)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function Qn(t,e){w(),ze(),Je();const r={name:t,args:e??{},metadata:{tracking_id:He()}};await Se.sendEvent(r)}async function Xn(t,e){w(),ze(),Je();const r={name:"pageview",args:{page:t??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:He(),referrer_url:Bn(),source:qn(),affiliate_id:kt()??void 0,referrer:kt()??void 0,category:jn()??void 0,title:$n()??void 0,tag:Mn()??void 0}};await Se.sendEvent(r,e)}async function Yn(t,e){w(),ze(),Je();const r={name:"connect_wallet",user:{identifier:t.identifier,identifier_type:t.identifierType},args:{page:document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:He()}};t!=null&&t.signature&&(r.signature=t==null?void 0:t.signature,r.signature_message=t==null?void 0:t.message),t!=null&&t.signaturePublicKey&&(r.signature_public_key=t.signaturePublicKey),t!=null&&t.accountChainId&&(r.account_chain_id=t.accountChainId),await Se.sendEvent(r,e)}async function Gn(t){return w(),B.create(t.userIdentifier,t.identifierType,t.code,t.signature,t.signaturePublicKey,t.accountChainId,t.userRebateRate)}async function Zn(t){w(),await B.update(t.userIdentifier,t.identifierType,t.code,t.signature,t.signaturePublicKey,t.accountChainId)}async function es(t){w(),await B.updateRebateRate(t.userIdentifier,t.identifierType,t.code,t.signature,t.rebateRate,t.signaturePublicKey,t.accountChainId,t.sourceProjectId)}async function ts(t,e){return w(),await B.getCode(t,e)}async function rs(t){return w(),await B.isCodeFree(t)}async function ns(t){return w(),await B.isCodeAvailable(t)}async function ss(t,e,r,n){w();const s=await B.getCode(e,r),i=new URLSearchParams({af:(s==null?void 0:s.code)??e});return n!=null&&n.title&&i.append("af_title",n.title),n!=null&&n.format&&i.append("af_format",n.format),n!=null&&n.place&&i.append("af_place",n.place),`${t}?${i.toString()}`}function is(t){return K.getPayoutsLeaderboard(t)}function os(t){return K.getPointsLeaderboard(t)}function as(t){return K.getReferredUsersLeaderboard(t)}function cs(t){return w(),K.getReferredVolume(t)}function us(t){return w(),K.getVolumeLeaderboard(t)}function ls(t){return w(),K.getRevenueLeaderboard(t)}function ds(t){return G.getUserPayoutsByConversion(t)}function fs(t){return G.getUserPointsByConversion(t)}function hs(t){return G.getUserPayoutMovements(t)}function ps(t){return G.getUserPointsMovements(t)}function ys(t){return w(),G.getPayoutsByReferrer(t)}async function ms(t){return w(),vt.getAll(t)}async function gs(t){return w(),It.getUserReferrer(t)}async function ws(t){return w(),Bt.getUserAudiences(t)}async function bs(t){return w(),q.listUserReferralCodes(t)}async function _s(t){return w(),q.generateReferralCodes(t)}async function Cs(t){return w(),q.getReferralStatus(t)}async function Es(t){return w(),q.getReferralCode(t)}async function Rs(t){return w(),q.useReferralCode(t)}async function Ss(t){return w(),q.updateReferralCode(t)}async function As(t){return w(),q.deleteReferral(t)}async function Ts(t){return w(),Re.getAffiliateStats(t)}async function Ps(t){return w(),Re.getAffiliateNewTraders(t)}async function Os(t){return w(),Re.getAffiliateTotalStats(t)}async function Ns(t){return w(),ae.getClaimChecks(t)}async function Us(t){return w(),ae.closeClaimChecks(t)}async function xs(t){return w(),ae.getClaimableChecks(t)}async function Ds(t){return w(),ae.getClaimCheckTotals(t)}function ze(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Je(){if(navigator.webdriver)throw new Error("Fuul SDK: Error")}function Ls(){if(!Ke)throw new Error("Fuul SDK: Invalid API key")}function Fs(t,e){return new xn({baseURL:t,timeout:3e4,apiKey:Ke,queryParams:e})}const ks={init:Wn,sendEvent:Qn,sendPageview:Xn,identifyUser:Yn,generateTrackingLink:ss,getConversions:ms,createAffiliateCode:Gn,updateAffiliateCode:Zn,updateRebateRate:es,getAffiliateCode:ts,isAffiliateCodeFree:rs,isAffiliateCodeAvailable:ns,getPayoutsLeaderboard:is,getPointsLeaderboard:os,getReferredUsersLeaderboard:as,getReferredVolume:cs,getUserAudiences:ws,getUserPayoutsByConversion:ds,getUserPointsByConversion:fs,getUserPointsMovements:ps,getUserPayoutMovements:hs,getPayoutsByReferrer:ys,getUserReferrer:gs,getVolumeLeaderboard:us,getRevenueLeaderboard:ls,listUserReferralCodes:bs,generateReferralCodes:_s,getReferralStatus:Cs,getReferralCode:Es,useReferralCode:Rs,updateReferralCode:Ss,deleteReferral:As,getAffiliateStats:Ts,getAffiliateNewTraders:Ps,getAffiliateTotalStats:Os,getClaimChecks:Ns,closeClaimChecks:Us,getClaimableChecks:xs,getClaimCheckTotals:Ds};var qt=(t=>(t.Open="open",t.Unclaimed="unclaimed",t.Claimed="claimed",t))(qt||{}),jt=(t=>(t.EvmAddress="evm_address",t.SolanaAddress="solana_address",t.XRPLAddress="xrpl_address",t.SuiAddress="sui_address",t.Email="email",t))(jt||{});R.AddressInUseError=$e,R.ClaimCheckStatus=qt,R.CodeInUseError=Me,R.Fuul=ks,R.InvalidSignatureError=Ce,R.UserIdentifierType=jt,R.ValidationError=_e,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
5
|
+
`):" "+Pt(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Ot={getAdapter:gn,adapters:Ie};function qe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new oe(null,t)}function Nt(t){return qe(t),t.headers=O.from(t.headers),t.data=Be.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Ot.getAdapter(t.adapter||se.adapter,t)(t).then(function(n){return qe(t),n.data=Be.call(t,t.transformResponse,n),n.headers=O.from(n.headers),n},function(n){return pt(n)||(qe(t),n&&n.response&&(n.response.data=Be.call(t,t.transformResponse,n.response),n.response.headers=O.from(n.response.headers))),Promise.reject(n)})}const Ut="1.13.6",we={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{we[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const xt={};we.transitional=function(e,r,n){function s(i,o){return"[Axios v"+Ut+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new m(s(o," has been removed"+(r?" in "+r:"")),m.ERR_DEPRECATED);return r&&!xt[o]&&(xt[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,o,c):!0}},we.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function wn(t,e,r){if(typeof t!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const i=n[s],o=e[i];if(o){const c=t[i],f=c===void 0||o(c,i,t);if(f!==!0)throw new m("option "+i+" must be "+f,m.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const be={assertOptions:wn,validators:we},x=be.validators;let V=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dt,response:new dt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
+
`+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=H(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&be.assertOptions(n,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean),legacyInterceptorReqResOrdering:x.transitional(x.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:be.assertOptions(s,{encode:x.function,serialize:x.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),be.assertOptions(r,{baseUrl:x.spelling("baseURL"),withXsrfToken:x.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[r.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=O.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(r)===!1)return;f=f&&y.synchronous;const p=r.transitional||Le;p&&p.legacyInterceptorReqResOrdering?c.unshift(y.fulfilled,y.rejected):c.push(y.fulfilled,y.rejected)});const l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let u,h=0,g;if(!f){const d=[Nt.bind(this),void 0];for(d.unshift(...c),d.push(...l),g=d.length,u=Promise.resolve(r);h<g;)u=u.then(d[h++],d[h++]);return u}g=c.length;let E=r;for(;h<g;){const d=c[h++],y=c[h++];try{E=d(E)}catch(p){y.call(this,p);break}}try{u=Nt.call(this,E)}catch(d){return Promise.reject(d)}for(h=0,g=l.length;h<g;)u=u.then(l[h++],l[h++]);return u}getUri(e){e=H(this.defaults,e);const r=wt(e.baseURL,e.url,e.allowAbsoluteUrls);return lt(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){V.prototype[e]=function(r,n){return this.request(H(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(i,o,c){return this.request(H(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}V.prototype[e]=r(),V.prototype[e+"Form"]=r(!0)});let bn=class Wt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new oe(i,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Wt(function(s){e=s}),cancel:e}}};function _n(t){return function(r){return t.apply(null,r)}}function Cn(t){return a.isObject(t)&&t.isAxiosError===!0}const $e={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries($e).forEach(([t,e])=>{$e[e]=t});function Dt(t){const e=new V(t),r=Xe(V.prototype.request,e);return a.extend(r,V.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Dt(H(t,s))},r}const _=Dt(se);_.Axios=V,_.CanceledError=oe,_.CancelToken=bn,_.isCancel=pt,_.VERSION=Ut,_.toFormData=pe,_.AxiosError=m,_.Cancel=_.CanceledError,_.all=function(e){return Promise.all(e)},_.spread=_n,_.isAxiosError=Cn,_.mergeConfig=H,_.AxiosHeaders=O,_.formToJSON=t=>ft(a.isHTMLForm(t)?new FormData(t):t),_.getAdapter=Ot.getAdapter,_.HttpStatusCode=$e,_.default=_;const{Axios:Js,AxiosError:_e,CanceledError:Ws,isCancel:Qs,CancelToken:Xs,VERSION:Ys,all:Gs,Cancel:Zs,isAxiosError:ei,spread:ti,toFormData:ri,AxiosHeaders:ni,HttpStatusCode:si,formToJSON:ii,getAdapter:oi,mergeConfig:ai}=_;class Ce extends Error{constructor(r){super(r.join(", "));b(this,"errors");this.name="ValidationError",this.errors=r}}class je extends Error{constructor(r){super("Address already registered.");b(this,"address");this.name="AddressInUseError",this.address=r}}class Me extends Error{constructor(r){super("Code already registered.");b(this,"code");this.name="CodeInUseError",this.code=r}}class Ee extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class En{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async create(e,r,n,s,i,o,c){var f;try{return(await this.httpClient.post({path:"/affiliates",postData:{address:e,identifier_type:r,name:n,code:n,signature:s,signature_public_key:i,account_chain_id:o,user_rebate_rate:c}})).data}catch(l){if(l instanceof _e){const u=(f=l.response)==null?void 0:f.data;if(typeof(u==null?void 0:u.message)=="string"){const h=u.message.toLowerCase();throw h=="invalid signature"?new Ee:h=="address in use"?new je(e):h=="code in use"?new Me(n):new Error(h)}else if((u==null?void 0:u.message)instanceof Array)throw new Ce(u.message)}throw l}}async update(e,r,n,s,i,o){var c;try{await this.httpClient.post({path:`/affiliates/${e}`,postData:{code:n,user_identifier:e,identifier_type:r,signature:s,signature_public_key:i,account_chain_id:o}})}catch(f){if(f instanceof _e){const l=(c=f.response)==null?void 0:c.data;if(typeof(l==null?void 0:l.message)=="string"){const u=l.message.toLowerCase();throw u=="invalid signature"?new Ee:u=="address in use"?new je(e):u=="code in use"?new Me(n):new Error(u)}else if((l==null?void 0:l.message)instanceof Array)throw new Ce(l.message)}throw f}}async updateRebateRate(e,r,n,s,i,o,c,f){var l;try{await this.httpClient.post({path:`/affiliates/${e}/rebate-rate`,postData:{identifier_type:r,code:n,signature:s,signature_public_key:o,account_chain_id:c,source_project_id:f,rebate_rate:i}})}catch(u){if(u instanceof _e){const h=(l=u.response)==null?void 0:l.data;if(typeof(h==null?void 0:h.message)=="string"){const g=h.message.toLowerCase();throw g=="invalid signature"?new Ee:new Error(g)}else if((h==null?void 0:h.message)instanceof Array)throw new Ce(h.message)}throw u}}async isCodeFree(e){try{return(await this.httpClient.get({path:`/affiliates/codes/${e}`})).data.free}catch(r){throw console.error("Fuul SDK: Could not check affiliate code",r),r}}async isCodeAvailable(e){try{return(await this.httpClient.get({path:`/affiliates/codes/${e}/availability`})).data.available}catch(r){throw console.error("Fuul SDK: Could not check affiliate code availability",r),r}}async getCode(e,r){var n;try{return(await this.httpClient.get({path:`/affiliates/${e}`,queryParams:{identifier_type:r}})).data}catch(s){if(s instanceof _e&&((n=s.response)==null?void 0:n.status)===404)return null;throw console.error("Fuul SDK: Could not get affiliate code",s),s}}}const Rn="/audiences";class Sn{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getUserAudiences(e){return(await this.httpClient.get({path:`${Rn}/audience-segments/user`,queryParams:{...e}})).data}}const Re="/claim-checks";class Tn{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getClaimChecks(e){const r={user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type};return e.status&&(r.status=e.status),(await this.httpClient.get({path:Re,queryParams:r})).data}async closeClaimChecks(e){return(await this.httpClient.post({path:`${Re}/close`,postData:{userIdentifier:e.user_identifier,userIdentifierType:e.user_identifier_type,claim_check_ids:e.claim_check_ids}})).data}async getClaimableChecks(e){return(await this.httpClient.post({path:`${Re}/claim`,postData:{userIdentifier:e.user_identifier,userIdentifierType:e.user_identifier_type}})).data}async getClaimCheckTotals(e){return(await this.httpClient.get({path:`${Re}/totals`,queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}}class An{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getAll(e){const{data:r}=await this.httpClient.get({path:"conversions",queryParams:{...e}});return r}}const Lt="fuul.sent",Pn=60,On="connect_wallet",Ft=10;class Nn{constructor(e){b(this,"debug");b(this,"httpClient");this.httpClient=e.httpClient,this.debug=!!e.debug}async sendEvent(e,r){if(this.isDuplicate(e)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}if(!r||!Array.isArray(r)||r.length===0)await this.httpClient.post({path:"events",postData:e});else for(const n of r){const s=structuredClone({...e,project_id:n});s.metadata.project_id=n,await this.httpClient.post({path:"events",postData:s,queryParams:{project_id:n}})}this.debug&&console.debug(`Fuul SDK: Sent '${e.name}' event`),this.saveSentEvent(e)}isDuplicate(e){var u,h,g,E;const r=`${Lt}_${e.name}`,n=localStorage.getItem(r);if(!n)return!1;const s=JSON.parse(n);if(this.getCurrentTimestamp()-s.timestamp>Pn)return!1;let f=!1;e.metadata&&(f=s.metadata.tracking_id===e.metadata.tracking_id&&s.metadata.project_id===e.metadata.project_id&&s.metadata.referrer===e.metadata.referrer&&s.metadata.source===e.metadata.source&&s.metadata.category===e.metadata.category&&s.metadata.title===e.metadata.title&&s.metadata.tag===e.metadata.tag&&s.user_address===e.user_address&&((u=s.user)==null?void 0:u.identifier)===((h=e.user)==null?void 0:h.identifier)&&((g=s.user)==null?void 0:g.identifier_type)===((E=e.user)==null?void 0:E.identifier_type)&&s.signature===e.signature&&s.signature_message===e.signature_message);let l=!1;return e.args&&s.args&&(l=s.args.page===e.args.page),l&&f}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(e){var o,c,f,l;const r=`${Lt}_${e.name}`,n=`${r}_all`,s=this.getCurrentTimestamp(),i={...e,timestamp:s};if(localStorage.setItem(r,JSON.stringify(i)),e.name===On){const u=JSON.parse(localStorage.getItem(n)||"[]"),h={name:e.name,user:{identifier:(o=e.user)==null?void 0:o.identifier,identifier_type:(c=e.user)==null?void 0:c.identifier_type},tracking_id:(f=e.metadata)==null?void 0:f.tracking_id,page:(l=e.args)==null?void 0:l.page};"user_address"in e&&(h.user_address=e.user_address);const g=[...u,h];g.length>Ft&&g.splice(0,g.length-Ft),localStorage.setItem(n,JSON.stringify(g))}}}const Un={version:"0.0.0"};class xn{constructor(e){b(this,"client");b(this,"defaultQueryParams");this.client=_.create({...e,headers:{Authorization:`Bearer ${e.apiKey}`,"X-Fuul-Sdk-Version":Un.version}}),this.defaultQueryParams=e.queryParams||{}}makeQueryParams(e){return Object.assign({},this.defaultQueryParams||{},e||{})}async get(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),method:"GET"})}async post(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"POST"})}async put(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"PUT"})}async patch(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"PATCH"})}async delete(e){return this.client.request({url:e.path,params:this.makeQueryParams(e.queryParams),data:e.postData,method:"DELETE"})}}class Dn{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getPayoutsLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,user_identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/payouts",queryParams:i})).data}async getPointsLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,user_identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/points",queryParams:i})).data}async getVolumeLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/volume",queryParams:i})).data}async getReferredUsersLeaderboard(e){return(await this.httpClient.get({path:"/leaderboard/referred",queryParams:{...e}})).data}async getReferredVolume(e){const{user_identifiers:r,...n}=e;return(await this.httpClient.get({path:"/payouts/leaderboard/referred-volume",queryParams:{...n,user_identifiers:r.join(",")}})).data}async getRevenueLeaderboard(e){const{identifier_type:r,user_identifier_type:n,...s}=e,i={...s,identifier_type:r??n};return(await this.httpClient.get({path:"/payouts/leaderboard/revenue",queryParams:i})).data}}const ae="/payouts";class Ln{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async getUserPayoutsByConversion(e){return(await this.httpClient.get({path:ae,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsByConversion(e){return(await this.httpClient.get({path:ae,queryParams:{...e,type:"point"}})).data}async getUserPayoutMovements(e){return(await this.httpClient.get({path:`${ae}/movements`,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsMovements(e){return(await this.httpClient.get({path:`${ae}/movements`,queryParams:{...e,type:"point"}})).data}async getPayoutsByReferrer(e){return(await this.httpClient.get({path:`${ae}/by-referrer`,queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}}class Fn{constructor(e){b(this,"httpClient");b(this,"_debug");this.httpClient=e.httpClient,this._debug=e.debug}async listUserReferralCodes(e){return(await this.httpClient.get({path:"/referral_codes",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type,page:e.page,page_size:e.page_size}})).data}async generateReferralCodes(e){return(await this.httpClient.post({path:"/referral_codes",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type,quantity:e.quantity,max_uses:e.max_uses}})).data}async getReferralStatus(e){return(await this.httpClient.get({path:"/referral_codes/status",queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}async getReferralCode(e){return(await this.httpClient.get({path:`/referral_codes/${e.code}`})).data}async useReferralCode(e){const{code:r,user_identifier:n,user_identifier_type:s,signature:i,signature_message:o,chain_id:c}=e;await this.httpClient.patch({path:`/referral_codes/${r}/use`,queryParams:{user_identifier:n,user_identifier_type:s},postData:{signature:i,signature_message:o,chain_id:c}})}async updateReferralCode(e){await this.httpClient.patch({path:`/referral_codes/${e.code}`,postData:{max_uses:e.max_uses}})}async deleteReferral(e){const{code:r,user_identifier:n,user_identifier_type:s,referrer_identifier:i,referrer_identifier_type:o,signature:c,signature_message:f,chain_id:l}=e;await this.httpClient.delete({path:`/referral_codes/${r}/referrals`,queryParams:{user_identifier:n,user_identifier_type:s,referrer_identifier:i,referrer_identifier_type:o},postData:{signature:c,signature_message:f,chain_id:l}})}}const kn="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let vn=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=kn[r[t]&63];return e};const Bn="fuul.tracking_id",He=()=>Hn(Bn,()=>vn()),kt=()=>Y("af")||Y("referrer"),In=()=>document.referrer,qn=()=>Vn(),$n=()=>Y("category"),jn=()=>Y("title"),Mn=()=>Y("tag"),Hn=(t,e)=>{const r=localStorage.getItem(t);if(r)return r;{const n=e();return n?localStorage.setItem(t,n):localStorage.removeItem(t),n}},Y=t=>new URLSearchParams(window.location.search).get(t),Vn=()=>{const t=Y("source");if(t)return t},Kn="/user";class zn{constructor(e){b(this,"httpClient");this.httpClient=e.httpClient}async getUserReferrer(e){return(await this.httpClient.get({path:`${Kn}/referrer`,queryParams:{...e}})).data}}const Jn="https://api.fuul.xyz/api/v1/";let B=!1,Ve=!1,Ke,k,vt,Bt,I,G,Se,Z,It,K,q,ce;function Wn(t){B=!!t.debug,!Ve&&(Ke=t.apiKey,ks(),k=vs(t.baseApiUrl??Jn,t.defaultQueryParams??{}),vt=new An({httpClient:k,debug:B}),Se=new Nn({httpClient:k,debug:B}),I=new En({httpClient:k,debug:B}),G=new W({httpClient:k}),Z=new Ln({httpClient:k,debug:B}),Bt=new zn({httpClient:k}),It=new Sn({httpClient:k,debug:B}),K=new Dn({httpClient:k}),q=new Fn({httpClient:k,debug:B}),ce=new Tn({httpClient:k,debug:B}),Ve=!0,B&&console.debug("Fuul SDK: init() complete"))}function w(){if(!Ve)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function Qn(t,e){w(),ze(),Je();const r={name:t,args:e??{},metadata:{tracking_id:He()}};await Se.sendEvent(r)}async function Xn(t,e){w(),ze(),Je();const r={name:"pageview",args:{page:t??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:He(),referrer_url:In(),source:qn(),affiliate_id:kt()??void 0,referrer:kt()??void 0,category:$n()??void 0,title:jn()??void 0,tag:Mn()??void 0}};await Se.sendEvent(r,e)}async function Yn(t,e){w(),ze(),Je();const r={name:"connect_wallet",user:{identifier:t.identifier,identifier_type:t.identifierType},args:{page:document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:He()}};t!=null&&t.signature&&(r.signature=t==null?void 0:t.signature,r.signature_message=t==null?void 0:t.message),t!=null&&t.signaturePublicKey&&(r.signature_public_key=t.signaturePublicKey),t!=null&&t.accountChainId&&(r.account_chain_id=t.accountChainId),await Se.sendEvent(r,e)}async function Gn(t){return w(),I.create(t.userIdentifier,t.identifierType,t.code,t.signature,t.signaturePublicKey,t.accountChainId,t.userRebateRate)}async function Zn(t){w(),await I.update(t.userIdentifier,t.identifierType,t.code,t.signature,t.signaturePublicKey,t.accountChainId)}async function es(t){w(),await I.updateRebateRate(t.userIdentifier,t.identifierType,t.code,t.signature,t.rebateRate,t.signaturePublicKey,t.accountChainId,t.sourceProjectId)}async function ts(t,e){return w(),await I.getCode(t,e)}async function rs(t){return w(),await I.isCodeFree(t)}async function ns(t){return w(),await I.isCodeAvailable(t)}async function ss(t,e,r,n){w();const s=await I.getCode(e,r),i=new URLSearchParams({af:(s==null?void 0:s.code)??e});return n!=null&&n.title&&i.append("af_title",n.title),n!=null&&n.format&&i.append("af_format",n.format),n!=null&&n.place&&i.append("af_place",n.place),`${t}?${i.toString()}`}function is(t){return K.getPayoutsLeaderboard(t)}function os(t){return K.getPointsLeaderboard(t)}function as(t){return K.getReferredUsersLeaderboard(t)}function cs(t){return w(),K.getReferredVolume(t)}function us(t){return w(),K.getVolumeLeaderboard(t)}function ls(t){return w(),K.getRevenueLeaderboard(t)}function ds(t){return Z.getUserPayoutsByConversion(t)}function fs(t){return Z.getUserPointsByConversion(t)}function hs(t){return Z.getUserPayoutMovements(t)}function ps(t){return Z.getUserPointsMovements(t)}function ys(t){return w(),Z.getPayoutsByReferrer(t)}async function ms(t){return w(),vt.getAll(t)}async function gs(t){return w(),Bt.getUserReferrer(t)}async function ws(t){return w(),It.getUserAudiences(t)}async function bs(t){return w(),q.listUserReferralCodes(t)}async function _s(t){return w(),q.generateReferralCodes(t)}async function Cs(t){return w(),q.getReferralStatus(t)}async function Es(t){return w(),q.getReferralCode(t)}async function Rs(t){return w(),q.useReferralCode(t)}async function Ss(t){return w(),q.updateReferralCode(t)}async function Ts(t){return w(),q.deleteReferral(t)}async function As(t){return w(),G.getAffiliateStats(t)}async function Ps(t){return w(),G.getAffiliateNewTraders(t)}async function Os(t){return w(),G.getAffiliateTotalStats(t)}async function Ns(t){return w(),G.getReferralTree(t)}async function Us(t){return w(),G.getStatsBreakdown(t)}async function xs(t){return w(),ce.getClaimChecks(t)}async function Ds(t){return w(),ce.closeClaimChecks(t)}async function Ls(t){return w(),ce.getClaimableChecks(t)}async function Fs(t){return w(),ce.getClaimCheckTotals(t)}function ze(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Je(){if(navigator.webdriver)throw new Error("Fuul SDK: Error")}function ks(){if(!Ke)throw new Error("Fuul SDK: Invalid API key")}function vs(t,e){return new xn({baseURL:t,timeout:3e4,apiKey:Ke,queryParams:e})}const Bs={init:Wn,sendEvent:Qn,sendPageview:Xn,identifyUser:Yn,generateTrackingLink:ss,getConversions:ms,createAffiliateCode:Gn,updateAffiliateCode:Zn,updateRebateRate:es,getAffiliateCode:ts,isAffiliateCodeFree:rs,isAffiliateCodeAvailable:ns,getPayoutsLeaderboard:is,getPointsLeaderboard:os,getReferredUsersLeaderboard:as,getReferredVolume:cs,getUserAudiences:ws,getUserPayoutsByConversion:ds,getUserPointsByConversion:fs,getUserPointsMovements:ps,getUserPayoutMovements:hs,getPayoutsByReferrer:ys,getUserReferrer:gs,getVolumeLeaderboard:us,getRevenueLeaderboard:ls,listUserReferralCodes:bs,generateReferralCodes:_s,getReferralStatus:Cs,getReferralCode:Es,useReferralCode:Rs,updateReferralCode:Ss,deleteReferral:Ts,getAffiliateStats:As,getAffiliateNewTraders:Ps,getAffiliateTotalStats:Os,getReferralTree:Ns,getStatsBreakdown:Us,getClaimChecks:xs,closeClaimChecks:Ds,getClaimableChecks:Ls,getClaimCheckTotals:Fs};var qt=(t=>(t.Open="open",t.Unclaimed="unclaimed",t.Claimed="claimed",t))(qt||{}),$t=(t=>(t.EvmAddress="evm_address",t.SolanaAddress="solana_address",t.XRPLAddress="xrpl_address",t.SuiAddress="sui_address",t.Email="email",t))($t||{});R.AddressInUseError=je,R.ClaimCheckStatus=qt,R.CodeInUseError=Me,R.Fuul=Bs,R.InvalidSignatureError=Ee,R.UserIdentifierType=$t,R.ValidationError=Ce,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|