@fuul/sdk 7.24.0 → 7.26.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.map +1 -1
- package/dist/core.d.ts +42 -8
- 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 +429 -410
- package/dist/index.umd.js +6 -6
- package/dist/payouts/PayoutService.d.ts +2 -1
- package/dist/payouts/PayoutService.d.ts.map +1 -1
- package/dist/types/api.d.ts +143 -8
- package/dist/types/api.d.ts.map +1 -1
- package/package.json +3 -3
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 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},
|
|
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
|
-
`+o.map(
|
|
5
|
-
`):" "+
|
|
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"})}));
|
|
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 Ms=Object.defineProperty;var Hs=(R,T,Q)=>T in R?Ms(R,T,{enumerable:!0,configurable:!0,writable:!0,value:Q}):R[T]=Q;var b=(R,T,Q)=>Hs(R,typeof T!="symbol"?T+"":T,Q);const T="/affiliate-portal";class Q{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 Ye(t,e){return function(){return t.apply(e,arguments)}}const{toString:Qt}=Object.prototype,{getPrototypeOf:Oe}=Object,{iterator:le,toStringTag:Ge}=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:X}=Array,Y=fe("undefined");function re(t){return t!==null&&!Y(t)&&t.constructor!==null&&!Y(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ze=F("ArrayBuffer");function Xt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ze(t.buffer),e}const Yt=fe("string"),P=fe("function"),et=fe("number"),ne=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)&&!(Ge in t)&&!(le in t)},Zt=t=>{if(!ne(t)||re(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=>ne(t)&&P(t.pipe);function ar(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const tt=ar(),rt=typeof tt.FormData<"u"?tt.FormData:void 0,cr=t=>{let e;return t&&(rt&&t instanceof rt||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 se(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),X(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(re(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 nt(t,e){if(re(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,st=t=>!Y(t)&&t!==M;function Ne(){const{caseless:t,skipUndefined:e}=st(this)&&this||{},r={},n=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=t&&nt(r,i)||i;he(r[o])&&he(s)?r[o]=Ne(r[o],s):he(s)?r[o]=Ne({},s):X(s)?r[o]=s.slice():(!e||!Y(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&se(arguments[s],n);return r}const yr=(t,e,r,{allOwnKeys:n}={})=>(se(e,(s,i)=>{r&&P(s)?Object.defineProperty(t,i,{value:Ye(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),gr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),mr=(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(X(t))return t;let e=t.length;if(!et(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}),it=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ar=F("RegExp"),ot=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};se(r,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(n[i]=o||s)}),Object.defineProperties(t,n)},Pr=t=>{ot(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 X(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[Ge]==="FormData"&&t[le])}const Dr=t=>{const e=new Array(10),r=(n,s)=>{if(ne(n)){if(e.indexOf(n)>=0)return;if(re(n))return n;if(!("toJSON"in n)){e[s]=n;const i=X(n)?[]:{};return se(n,(o,c)=>{const f=r(o,s+1);!Y(f)&&(i[c]=f)}),e[s]=void 0,i}}return n};return r(t,0)},Lr=F("AsyncFunction"),Fr=t=>t&&(ne(t)||P(t))&&P(t.then)&&P(t.catch),at=((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)),vr=typeof queueMicrotask<"u"?queueMicrotask.bind(M):typeof process<"u"&&process.nextTick||at,a={isArray:X,isArrayBuffer:Ze,isBuffer:re,isFormData:cr,isArrayBufferView:Xt,isString:Yt,isNumber:et,isBoolean:Gt,isObject:ne,isPlainObject:he,isEmptyObject:Zt,isReadableStream:lr,isRequest:dr,isResponse:fr,isHeaders:hr,isUndefined:Y,isDate:er,isFile:tr,isReactNativeBlob:rr,isReactNative:nr,isBlob:sr,isRegExp:Ar,isFunction:P,isStream:or,isURLSearchParams:ur,isTypedArray:Cr,isFileList:ir,forEach:se,merge:Ne,extend:yr,trim:pr,stripBOM:gr,inherits:mr,toFlatObject:wr,kindOf:de,kindOfTest:F,endsWith:br,toArray:_r,forEachEntry:Er,matchAll:Rr,isHTMLForm:Sr,hasOwnProperty:it,hasOwnProp:it,reduceDescriptors:ot,freezeMethods:Pr,toObjectSet:Or,toCamelCase:Tr,noop:Nr,toFiniteNumber:Ur,findKey:nt,global:M,isContextDefined:st,isSpecCompliantForm:xr,toJSONObject:Dr,isAsyncFn:Lr,isThenable:Fr,setImmediate:at,asap:vr,isIterable:t=>t!=null&&P(t[le])};let g=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}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const kr=null;function Ue(t){return a.isPlainObject(t)||a.isArray(t)}function ct(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=ct(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 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 g("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=ct(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=[],m=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,m))===!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 ut(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 lt=De.prototype;lt.append=function(e,r){this._pairs.push([e,r])},lt.toString=function(e){const r=e?function(n){return e.call(this,n,ut)}:ut;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 dt(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 ft{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",ve=typeof navigator=="object"&&navigator||void 0,jr=Fe&&(!ve||["ReactNative","NativeScript","NS"].indexOf(ve.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:ve,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 ht(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 ie={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(ht(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||ie.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"?g.from(c,g.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=>{ie.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},pt=Symbol("internals");function oe(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 ke(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=oe(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=oe(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=oe(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||ke(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function i(o){if(o=oe(o),o){const c=a.findKey(n,o);c&&(!r||ke(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||ke(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[pt]=this[pt]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=oe(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||ie,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 yt(t){return!!(t&&t.__CANCEL__)}let ae=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function gt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.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,m=0;for(;h!==s;)m+=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(m*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 ge=(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]]},wt=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 bt(t,e,r){let n=!on(e);return t&&(n||r==!1)?an(t,e):e}const _t=t=>t instanceof O?{...t}:t;function H(t,e){e=e||{};const r={};function n(l,u,h,m){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:m},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,h,m){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,h,m)}else return n(l,u,h,m)}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(_t(l),_t(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,m=h(t[u],e[u],u);a.isUndefined(m)&&h!==c||(r[u]=m)}),r}const Ct=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=dt(bt(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=Ct(t);let i=s.data;const o=O.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,u,h,m,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()),k={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:t,request:p};gt(function(L){r(L),y()},function(L){n(L),y()},k),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 g("Request aborted",g.ECONNABORTED,t,p)),p=null)},p.onerror=function(N){const k=N&&N.message?N.message:"Network Error",J=new g(k,g.ERR_NETWORK,t,p);J.event=N||null,n(J),p=null},p.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const k=s.transitional||Le;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),n(new g(N,k.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(N,k){p.setRequestHeader(k,N)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),c&&c!=="json"&&(p.responseType=s.responseType),l&&([m,d]=ge(l,!0),p.addEventListener("progress",m)),f&&p.upload&&([h,E]=ge(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=S=>{p&&(n(!S||S.type?new ae(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 g("Unsupported protocol "+D+":",g.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 g?u:new ae(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new g(`timeout of ${e}ms exceeded`,g.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()}},Et=(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 m=i+=h;r(m)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Rt=64*1024,{isFunction:me}=a,hn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:St,TextEncoder:Tt}=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(St),f=s&&(typeof Tt=="function"?(d=>y=>d.encode(y))(new Tt):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=i&&c&&At(()=>{let d=!1;const y=new r(A.origin,{body:new St,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 g(`Response type '${d}' is not supported`,g.ERR_NOT_SUPPORT,p)})});const m=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??m(y)};return async d=>{let{url:y,method:p,data:C,signal:D,cancelToken:S,timeout:N,onDownloadProgress:k,onUploadProgress:J,responseType:L,headers:Qe,withCredentials:Te="same-origin",fetchOptions:jt}=Ct(d),Mt=e||fetch;L=L?(L+"").toLowerCase():"text";let Ae=un([D,S&&S.toAbortSignal()],N),ue=null;const W=Ae&&Ae.unsubscribe&&(()=>{Ae.unsubscribe()});let Ht;try{if(J&&l&&p!=="get"&&p!=="head"&&(Ht=await E(Qe,C))!==0){let j=new r(y,{method:"POST",body:C,duplex:"half"}),te;if(a.isFormData(C)&&(te=j.headers.get("content-type"))&&Qe.setContentType(te),j.body){const[Xe,Pe]=mt(Ht,ge(wt(J)));C=Et(j.body,Rt,Xe,Pe)}}a.isString(Te)||(Te=Te?"include":"omit");const U=i&&"credentials"in r.prototype,Vt={...jt,signal:Ae,method:p.toUpperCase(),headers:Qe.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&&(k||Kt&&W)){const j={};["status","statusText","headers"].forEach(zt=>{j[zt]=$[zt]});const te=a.toFiniteNumber($.headers.get("content-length")),[Xe,Pe]=k&&mt(te,ge(wt(k),!0))||[];$=new n(Et($.body,Rt,Xe,()=>{Pe&&Pe(),W&&W()}),j)}L=L||"text";let js=await h[a.findKey(h,L)||"text"]($,d);return!Kt&&W&&W(),await new Promise((j,te)=>{gt(j,te,{data:js,headers:O.from($.headers),status:$.status,statusText:$.statusText,config:d,request:ue})})}catch(U){throw W&&W(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,d,ue,U&&U.response),{cause:U.cause||U}):g.from(U,U&&U.code,d,ue,U&&U.response)}}},yn=new Map,Pt=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};Pt();const Be={http:kr,xhr:cn,fetch:{get:Pt}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ot=t=>`- ${t}`,gn=t=>a.isFunction(t)||t===null||t===!1;function mn(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,!gn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`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
|
+
`+o.map(Ot).join(`
|
|
5
|
+
`):" "+Ot(o[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Nt={getAdapter:mn,adapters:Be};function qe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ae(null,t)}function Ut(t){return qe(t),t.headers=O.from(t.headers),t.data=Ie.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Nt.getAdapter(t.adapter||ie.adapter,t)(t).then(function(n){return qe(t),n.data=Ie.call(t,t.transformResponse,n),n.headers=O.from(n.headers),n},function(n){return yt(n)||(qe(t),n&&n.response&&(n.response.data=Ie.call(t,t.transformResponse,n.response),n.response.headers=O.from(n.response.headers))),Promise.reject(n)})}const xt="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 Dt={};we.transitional=function(e,r,n){function s(i,o){return"[Axios v"+xt+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new g(s(o," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!Dt[o]&&(Dt[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 g("options must be an object",g.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 g("option "+i+" must be "+f,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+i,g.ERR_BAD_OPTION)}}const be={assertOptions:wn,validators:we},x=be.validators;let V=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ft,response:new ft}}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,m;if(!f){const d=[Ut.bind(this),void 0];for(d.unshift(...c),d.push(...l),m=d.length,u=Promise.resolve(r);h<m;)u=u.then(d[h++],d[h++]);return u}m=c.length;let E=r;for(;h<m;){const d=c[h++],y=c[h++];try{E=d(E)}catch(p){y.call(this,p);break}}try{u=Ut.call(this,E)}catch(d){return Promise.reject(d)}for(h=0,m=l.length;h<m;)u=u.then(l[h++],l[h++]);return u}getUri(e){e=H(this.defaults,e);const r=bt(e.baseURL,e.url,e.allowAbsoluteUrls);return dt(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 ae(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 Lt(t){const e=new V(t),r=Ye(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 Lt(H(t,s))},r}const _=Lt(ie);_.Axios=V,_.CanceledError=ae,_.CancelToken=bn,_.isCancel=yt,_.VERSION=xt,_.toFormData=pe,_.AxiosError=g,_.Cancel=_.CanceledError,_.all=function(e){return Promise.all(e)},_.spread=_n,_.isAxiosError=Cn,_.mergeConfig=H,_.AxiosHeaders=O,_.formToJSON=t=>ht(a.isHTMLForm(t)?new FormData(t):t),_.getAdapter=Nt.getAdapter,_.HttpStatusCode=$e,_.default=_;const{Axios:Xs,AxiosError:_e,CanceledError:Ys,isCancel:Gs,CancelToken:Zs,VERSION:ei,all:ti,Cancel:ri,isAxiosError:ni,spread:si,toFormData:ii,AxiosHeaders:oi,HttpStatusCode:ai,formToJSON:ci,getAdapter:ui,mergeConfig:li}=_;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 m=h.message.toLowerCase();throw m=="invalid signature"?new Ee:new Error(m)}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 Ft="fuul.sent",Pn=60,On="connect_wallet",vt=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,m,E;const r=`${Ft}_${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)&&((m=s.user)==null?void 0:m.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=`${Ft}_${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 m=[...u,h];m.length>vt&&m.splice(0,m.length-vt),localStorage.setItem(n,JSON.stringify(m))}}}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 G="/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:G,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsByConversion(e){return(await this.httpClient.get({path:G,queryParams:{...e,type:"point"}})).data}async getUserPayoutMovements(e){return(await this.httpClient.get({path:`${G}/movements`,queryParams:{...e,type:"onchain-currency"}})).data}async getUserPointsMovements(e){return(await this.httpClient.get({path:`${G}/movements`,queryParams:{...e,type:"point"}})).data}async getPayoutsByReferrer(e){return(await this.httpClient.get({path:`${G}/by-referrer`,queryParams:{user_identifier:e.user_identifier,user_identifier_type:e.user_identifier_type}})).data}async getIncentivesByTier(e){const r=e!=null&&e.tier_ids&&e.tier_ids.length>0?{tier_ids:e.tier_ids.join(",")}:void 0;return(await this.httpClient.get({path:`${G}/terms-by-tier`,queryParams:r})).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 vn="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let kn=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=vn[r[t]&63];return e};const In="fuul.tracking_id",He=()=>Hn(In,()=>kn()),kt=()=>Z("af")||Z("referrer"),Bn=()=>document.referrer,qn=()=>Vn(),$n=()=>Z("category"),jn=()=>Z("title"),Mn=()=>Z("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}},Z=t=>new URLSearchParams(window.location.search).get(t),Vn=()=>{const t=Z("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,v,ze,It,B,ee,Se,K,Bt,z,q,ce;function Wn(t){I=!!t.debug,!Ve&&(Ke=t.apiKey,Bs(),v=qs(t.baseApiUrl??Jn,t.defaultQueryParams??{}),ze=new An({httpClient:v,debug:I}),Se=new Nn({httpClient:v,debug:I}),B=new En({httpClient:v,debug:I}),ee=new Q({httpClient:v}),K=new Ln({httpClient:v,debug:I}),It=new zn({httpClient:v}),Bt=new Sn({httpClient:v,debug:I}),z=new Dn({httpClient:v}),q=new Fn({httpClient:v,debug:I}),ce=new Tn({httpClient:v,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(),Je(),We();const r={name:t,args:e??{},metadata:{tracking_id:He()}};await Se.sendEvent(r)}async function Xn(t,e){w(),Je(),We();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:$n()??void 0,title:jn()??void 0,tag:Mn()??void 0}};await Se.sendEvent(r,e)}async function Yn(t,e){w(),Je(),We();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,e){return w(),await B.getCode(t,e)}async function ns(t){return w(),await B.isCodeFree(t)}async function ss(t){return w(),await B.isCodeAvailable(t)}async function is(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 os(t){return z.getPayoutsLeaderboard(t)}function as(t){return z.getPointsLeaderboard(t)}function cs(t){return z.getReferredUsersLeaderboard(t)}function us(t){return w(),z.getReferredVolume(t)}function ls(t){return w(),z.getVolumeLeaderboard(t)}function ds(t){return w(),z.getRevenueLeaderboard(t)}function fs(t){return K.getUserPayoutsByConversion(t)}function hs(t){return K.getUserPointsByConversion(t)}function ps(t){return K.getUserPayoutMovements(t)}function ys(t){return K.getUserPointsMovements(t)}function gs(t){return w(),K.getPayoutsByReferrer(t)}async function ms(t){return w(),K.getIncentivesByTier(t)}async function ws(){return w(),ze.getAll()}async function bs(t){return w(),ze.getAll(t)}async function _s(t){return w(),It.getUserReferrer(t)}async function Cs(t){return w(),Bt.getUserAudiences(t)}async function Es(t){return w(),q.listUserReferralCodes(t)}async function Rs(t){return w(),q.generateReferralCodes(t)}async function Ss(t){return w(),q.getReferralStatus(t)}async function Ts(t){return w(),q.getReferralCode(t)}async function As(t){return w(),q.useReferralCode(t)}async function Ps(t){return w(),q.updateReferralCode(t)}async function Os(t){return w(),q.deleteReferral(t)}async function Ns(t){return w(),ee.getAffiliateStats(t)}async function Us(t){return w(),ee.getAffiliateNewTraders(t)}async function xs(t){return w(),ee.getAffiliateTotalStats(t)}async function Ds(t){return w(),ee.getReferralTree(t)}async function Ls(t){return w(),ee.getStatsBreakdown(t)}async function Fs(t){return w(),ce.getClaimChecks(t)}async function vs(t){return w(),ce.closeClaimChecks(t)}async function ks(t){return w(),ce.getClaimableChecks(t)}async function Is(t){return w(),ce.getClaimCheckTotals(t)}function Je(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function We(){if(navigator.webdriver)throw new Error("Fuul SDK: Error")}function Bs(){if(!Ke)throw new Error("Fuul SDK: Invalid API key")}function qs(t,e){return new xn({baseURL:t,timeout:3e4,apiKey:Ke,queryParams:e})}const $s={init:Wn,sendEvent:Qn,sendPageview:Xn,identifyUser:Yn,generateTrackingLink:is,getConversions:bs,getIncentives:ws,getIncentivesByTier:ms,createAffiliateCode:Gn,updateAffiliateCode:Zn,updateRebateRate:es,getAffiliateCode:rs,getAffiliateInfo:ts,isAffiliateCodeFree:ns,isAffiliateCodeAvailable:ss,getPayoutsLeaderboard:os,getPointsLeaderboard:as,getReferredUsersLeaderboard:cs,getReferredVolume:us,getUserAudiences:Cs,getUserPayoutsByConversion:fs,getUserPointsByConversion:hs,getUserPointsMovements:ys,getUserPayoutMovements:ps,getPayoutsByReferrer:gs,getUserReferrer:_s,getVolumeLeaderboard:ls,getRevenueLeaderboard:ds,listUserReferralCodes:Es,generateReferralCodes:Rs,getReferralStatus:Ss,getReferralCode:Ts,useReferralCode:As,updateReferralCode:Ps,deleteReferral:Os,getAffiliateStats:Ns,getAffiliateNewTraders:Us,getAffiliateTotalStats:xs,getReferralTree:Ds,getStatsBreakdown:Ls,getClaimChecks:Fs,closeClaimChecks:vs,getClaimableChecks:ks,getClaimCheckTotals:Is};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=$s,R.InvalidSignatureError=Ee,R.UserIdentifierType=$t,R.ValidationError=Ce,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '../HttpClient';
|
|
2
|
-
import { GetPayoutsByReferrerParams, GetUserPayoutMovementsParams, GetUserPayoutsByConversionParams, GetUserPointsByConversionParams, GetUserPointsMovementsParams, PayoutsByReferrerResponse, UserPayoutMovementsResponse, UserPayoutsByConversionResponse, UserPointsByConversionResponse, UserPointsMovementsResponse } from '../types/api';
|
|
2
|
+
import { GetIncentivesByTierParams, GetIncentivesByTierResponse, GetPayoutsByReferrerParams, GetUserPayoutMovementsParams, GetUserPayoutsByConversionParams, GetUserPointsByConversionParams, GetUserPointsMovementsParams, PayoutsByReferrerResponse, UserPayoutMovementsResponse, UserPayoutsByConversionResponse, UserPointsByConversionResponse, UserPointsMovementsResponse } from '../types/api';
|
|
3
3
|
export type PayoutServiceSettings = {
|
|
4
4
|
httpClient: HttpClient;
|
|
5
5
|
debug?: boolean;
|
|
@@ -13,5 +13,6 @@ export declare class PayoutService {
|
|
|
13
13
|
getUserPayoutMovements(params: GetUserPayoutMovementsParams): Promise<UserPayoutMovementsResponse>;
|
|
14
14
|
getUserPointsMovements(params: GetUserPointsMovementsParams): Promise<UserPointsMovementsResponse>;
|
|
15
15
|
getPayoutsByReferrer(params: GetPayoutsByReferrerParams): Promise<PayoutsByReferrerResponse>;
|
|
16
|
+
getIncentivesByTier(params?: GetIncentivesByTierParams): Promise<GetIncentivesByTierResponse>;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=PayoutService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoutService.d.ts","sourceRoot":"","sources":["../../src/payouts/PayoutService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,QAAQ,EAAE,qBAAqB;IAK9B,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAQ9G,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAQ3G,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQlG,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQlG,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"PayoutService.d.ts","sourceRoot":"","sources":["../../src/payouts/PayoutService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,QAAQ,EAAE,qBAAqB;IAK9B,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAQ9G,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAQ3G,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQlG,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQlG,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAW5F,mBAAmB,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAQ3G"}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -75,6 +75,12 @@ type ProjectTeamMember = {
|
|
|
75
75
|
role: string;
|
|
76
76
|
enabled: boolean;
|
|
77
77
|
};
|
|
78
|
+
export interface CurrentTier {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
slug: string;
|
|
82
|
+
rank: number;
|
|
83
|
+
}
|
|
78
84
|
export type Affiliate = {
|
|
79
85
|
id: string;
|
|
80
86
|
name: string;
|
|
@@ -86,14 +92,18 @@ export type Affiliate = {
|
|
|
86
92
|
uses: number;
|
|
87
93
|
clicks: number;
|
|
88
94
|
total_users: number;
|
|
95
|
+
/** USD. */
|
|
89
96
|
total_earnings: number;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
rebate_rate: number | null;
|
|
98
|
+
/** @deprecated No longer returned by the server. Use `rebate_rate`. */
|
|
99
|
+
user_rebate_rate?: number | null;
|
|
100
|
+
/** @deprecated No longer returned by the server. Use `rebate_rate`. */
|
|
101
|
+
rebate_rates?: {
|
|
93
102
|
project_id: string;
|
|
94
103
|
rebate_rate: number | null;
|
|
95
104
|
}[];
|
|
96
105
|
region: string;
|
|
106
|
+
current_tier: CurrentTier | null;
|
|
97
107
|
};
|
|
98
108
|
export type CreateAffiliateResponse = {
|
|
99
109
|
id: string;
|
|
@@ -143,19 +153,19 @@ interface ProjectOtherLink {
|
|
|
143
153
|
name: string;
|
|
144
154
|
url: string;
|
|
145
155
|
}
|
|
146
|
-
interface
|
|
156
|
+
interface DeprecatedPayoutTermTriggerArgument {
|
|
147
157
|
trigger_id: string;
|
|
148
158
|
amount_argument: string;
|
|
149
159
|
currency_argument: string;
|
|
150
160
|
}
|
|
151
|
-
interface
|
|
161
|
+
interface DeprecatedPayoutTermPayoutGroup {
|
|
152
162
|
id: string;
|
|
153
163
|
affiliate_amount?: string;
|
|
154
164
|
end_user_amount?: string;
|
|
155
165
|
affiliate_amount_percentage?: number;
|
|
156
166
|
end_user_amount_percentage?: number;
|
|
157
167
|
}
|
|
158
|
-
interface
|
|
168
|
+
interface DeprecatedPayoutTermResponse {
|
|
159
169
|
/**
|
|
160
170
|
* @deprecated This parameter will be removed after front-end migration
|
|
161
171
|
*/
|
|
@@ -172,19 +182,106 @@ interface PayoutTermResponse {
|
|
|
172
182
|
* @deprecated This parameter will be removed after front-end migration
|
|
173
183
|
*/
|
|
174
184
|
payment_argument?: string | null;
|
|
175
|
-
trigger_arguments?:
|
|
185
|
+
trigger_arguments?: DeprecatedPayoutTermTriggerArgument[];
|
|
186
|
+
payout_groups: DeprecatedPayoutTermPayoutGroup[];
|
|
187
|
+
}
|
|
188
|
+
export type PayoutScheme = 'pay-per-attribution' | 'pool' | 'rank';
|
|
189
|
+
export type TierType = 'audience' | 'event';
|
|
190
|
+
export type PayoutType = 'point' | 'onchain-currency';
|
|
191
|
+
export type PayoutCalculationStrategy = 'fixed' | 'variable';
|
|
192
|
+
export type TriggerAmountSource = 'volume' | 'revenue';
|
|
193
|
+
export type BaseCurrency = 'usd' | 'eth' | 'btc' | 'none';
|
|
194
|
+
export type AmountSource = 'volume' | 'revenue' | 'attribution-count';
|
|
195
|
+
export type PayeeType = 'affiliate' | 'end-user' | 'both';
|
|
196
|
+
export type PoolDistributionMode = 'linear' | 'square_root';
|
|
197
|
+
export interface RankPayoutSchemeConfig {
|
|
198
|
+
ranks: Record<number, {
|
|
199
|
+
prizeAmount: string;
|
|
200
|
+
}>;
|
|
201
|
+
}
|
|
202
|
+
export interface PayoutTermPayoutGroup {
|
|
203
|
+
id: string;
|
|
204
|
+
name?: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
affiliate_amount?: string;
|
|
207
|
+
end_user_amount?: string;
|
|
208
|
+
affiliate_amount_percentage?: number;
|
|
209
|
+
end_user_amount_percentage?: number;
|
|
210
|
+
affiliate2_amount?: string | null;
|
|
211
|
+
affiliate3_amount?: string | null;
|
|
212
|
+
affiliate4_amount?: string | null;
|
|
213
|
+
affiliate2_amount_percentage?: number | null;
|
|
214
|
+
affiliate3_amount_percentage?: number | null;
|
|
215
|
+
affiliate4_amount_percentage?: number | null;
|
|
216
|
+
audience?: {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
} | null;
|
|
220
|
+
project_tier?: {
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
slug: string;
|
|
224
|
+
rank: number;
|
|
225
|
+
description: string | null;
|
|
226
|
+
} | null;
|
|
227
|
+
payout_cap_enabled?: boolean;
|
|
228
|
+
enduser_cap_enabled?: boolean;
|
|
229
|
+
wallet_cap_enabled?: boolean;
|
|
230
|
+
dynamic_referral_cap_enabled?: boolean;
|
|
231
|
+
}
|
|
232
|
+
export interface PayoutTermResponse {
|
|
233
|
+
id: string;
|
|
234
|
+
scheme: PayoutScheme;
|
|
235
|
+
tier_type: TierType;
|
|
236
|
+
conversion_id: string;
|
|
237
|
+
type: PayoutType;
|
|
238
|
+
calculation_strategy: PayoutCalculationStrategy | null;
|
|
239
|
+
trigger_amount_source: TriggerAmountSource | null;
|
|
240
|
+
base_currency: BaseCurrency | null;
|
|
241
|
+
payout_currency_address: string | null;
|
|
242
|
+
payout_currency_chain_id: number | null;
|
|
243
|
+
require_affiliate: boolean;
|
|
244
|
+
require_approval: boolean;
|
|
245
|
+
referral_amount?: string;
|
|
246
|
+
referrer_amount?: string;
|
|
247
|
+
referrer2_amount?: string;
|
|
248
|
+
referrer3_amount?: string;
|
|
249
|
+
referrer4_amount?: string;
|
|
250
|
+
max_payout_amount?: string | null;
|
|
251
|
+
end_user_cap_amount?: string | null;
|
|
252
|
+
end_user_cap_window_days?: number | null;
|
|
253
|
+
wallet_cap_amount?: string | null;
|
|
254
|
+
wallet_cap_window_days?: number | null;
|
|
255
|
+
dynamic_referral_cap_multiplier?: number | null;
|
|
176
256
|
payout_groups: PayoutTermPayoutGroup[];
|
|
257
|
+
amount_source?: AmountSource;
|
|
258
|
+
payee_type?: PayeeType;
|
|
259
|
+
pool_amount?: string | null;
|
|
260
|
+
pool_calculation_day_cron?: string;
|
|
261
|
+
pool_duration?: number;
|
|
262
|
+
pool_start_date?: string;
|
|
263
|
+
pool_end_date?: string | null;
|
|
264
|
+
pool_distribution_mode?: PoolDistributionMode | null;
|
|
265
|
+
rank_scheme_config?: RankPayoutSchemeConfig | null;
|
|
266
|
+
payout_condition_expression?: string | null;
|
|
267
|
+
}
|
|
268
|
+
export interface ConversionMetrics {
|
|
269
|
+
tvl: number;
|
|
270
|
+
apr: number;
|
|
177
271
|
}
|
|
178
272
|
export interface Conversion {
|
|
179
273
|
id: string;
|
|
180
274
|
external_id: number;
|
|
181
275
|
name: string;
|
|
182
276
|
slug: string;
|
|
277
|
+
enabled?: boolean;
|
|
183
278
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
184
279
|
conversion_window?: number;
|
|
185
280
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
186
281
|
attribution_type?: string;
|
|
187
282
|
triggers: Trigger[];
|
|
283
|
+
payout_terms?: PayoutTermResponse[];
|
|
284
|
+
metrics?: ConversionMetrics;
|
|
188
285
|
created_at: Date;
|
|
189
286
|
updated_at: Date;
|
|
190
287
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
@@ -206,13 +303,15 @@ export interface Conversion {
|
|
|
206
303
|
assets_url?: string;
|
|
207
304
|
documentation_url?: string;
|
|
208
305
|
other_links?: ProjectOtherLink[];
|
|
306
|
+
description?: string;
|
|
307
|
+
twitter_handle?: string;
|
|
209
308
|
};
|
|
210
309
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
211
310
|
action_id?: string;
|
|
212
311
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
213
312
|
action_type?: string;
|
|
214
313
|
/** @deprecated No longer returned by the server. Will be removed in the next major version. */
|
|
215
|
-
action_args?:
|
|
314
|
+
action_args?: DeprecatedPayoutTermResponse;
|
|
216
315
|
conversion_rate?: number;
|
|
217
316
|
total_converted?: number;
|
|
218
317
|
total_payout?: {
|
|
@@ -461,8 +560,44 @@ export interface UserPointsMovement {
|
|
|
461
560
|
payout_status: string;
|
|
462
561
|
payout_status_details: string | null;
|
|
463
562
|
}
|
|
563
|
+
export interface GetIncentivesByTierParams {
|
|
564
|
+
/**
|
|
565
|
+
* Filter to specific tiers. Each entry is either a tier UUID or the literal string `'null'`
|
|
566
|
+
* to include the default (no-tier) bucket. Omit to return all tiers plus the default bucket.
|
|
567
|
+
*/
|
|
568
|
+
tier_ids?: string[];
|
|
569
|
+
}
|
|
570
|
+
export interface PayoutTermRate {
|
|
571
|
+
amount: string | null;
|
|
572
|
+
currency: string | null;
|
|
573
|
+
unit: string;
|
|
574
|
+
}
|
|
575
|
+
export interface PayoutTermByTier {
|
|
576
|
+
conversion_name: string;
|
|
577
|
+
payout_type: 'variable' | 'fixed';
|
|
578
|
+
payee_type: 'affiliate' | 'end-user' | 'both';
|
|
579
|
+
is_multi_level: boolean;
|
|
580
|
+
affiliate_rate: PayoutTermRate;
|
|
581
|
+
affiliate2_rate: PayoutTermRate;
|
|
582
|
+
affiliate3_rate: PayoutTermRate;
|
|
583
|
+
affiliate4_rate: PayoutTermRate;
|
|
584
|
+
end_user_rate: PayoutTermRate;
|
|
585
|
+
}
|
|
586
|
+
export interface TierPayoutTerms {
|
|
587
|
+
tier_id: string | null;
|
|
588
|
+
tier_name: string | null;
|
|
589
|
+
tier_description: string | null;
|
|
590
|
+
tier_slug: string | null;
|
|
591
|
+
tier_rank: number | null;
|
|
592
|
+
payout_terms: PayoutTermByTier[];
|
|
593
|
+
}
|
|
594
|
+
export interface GetIncentivesByTierResponse {
|
|
595
|
+
tiers: TierPayoutTerms[];
|
|
596
|
+
}
|
|
464
597
|
export interface GetConversionsParams {
|
|
598
|
+
/** @deprecated The server does not accept this parameter. Will be removed in the next major version. */
|
|
465
599
|
user_identifier?: string;
|
|
600
|
+
/** @deprecated The server does not accept this parameter. Will be removed in the next major version. */
|
|
466
601
|
identifier_type?: UserIdentifierType;
|
|
467
602
|
}
|
|
468
603
|
export interface GetUserAudiencesParams {
|