@fuul/sdk 6.1.1 → 7.0.0-beta.2
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/README.md +7 -7
- package/dist/EventService.d.ts.map +1 -1
- package/dist/affiliates/AffiliateService.d.ts +4 -4
- package/dist/affiliates/AffiliateService.d.ts.map +1 -1
- package/dist/core.d.ts +34 -34
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +155 -141
- package/dist/index.umd.js +3 -3
- package/dist/release.json.d.ts +1 -1
- package/dist/types/api.d.ts +21 -10
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +6 -6
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/user.d.ts +6 -0
- package/dist/types/user.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -331,12 +331,12 @@ function ae(e, t, n) {
|
|
|
331
331
|
return a.isArrayBuffer(h) || a.isTypedArray(h) ? f && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
|
|
332
332
|
}
|
|
333
333
|
function l(h, y, p) {
|
|
334
|
-
let
|
|
334
|
+
let b = h;
|
|
335
335
|
if (h && !p && typeof h == "object") {
|
|
336
336
|
if (a.endsWith(y, "{}"))
|
|
337
337
|
y = r ? y : y.slice(0, -2), h = JSON.stringify(h);
|
|
338
|
-
else if (a.isArray(h) && hn(h) || (a.isFileList(h) || a.endsWith(y, "[]")) && (
|
|
339
|
-
return y = it(y),
|
|
338
|
+
else if (a.isArray(h) && hn(h) || (a.isFileList(h) || a.endsWith(y, "[]")) && (b = a.toArray(h)))
|
|
339
|
+
return y = it(y), b.forEach(function(C, U) {
|
|
340
340
|
!(a.isUndefined(C) || C === null) && t.append(
|
|
341
341
|
// eslint-disable-next-line no-nested-ternary
|
|
342
342
|
i === !0 ? Ue([y], U, o) : i === null ? y : y + "[]",
|
|
@@ -351,24 +351,24 @@ function ae(e, t, n) {
|
|
|
351
351
|
convertValue: u,
|
|
352
352
|
isVisitable: ye
|
|
353
353
|
});
|
|
354
|
-
function
|
|
354
|
+
function w(h, y) {
|
|
355
355
|
if (!a.isUndefined(h)) {
|
|
356
356
|
if (d.indexOf(h) !== -1)
|
|
357
357
|
throw Error("Circular reference detected in " + y.join("."));
|
|
358
|
-
d.push(h), a.forEach(h, function(
|
|
359
|
-
(!(a.isUndefined(
|
|
358
|
+
d.push(h), a.forEach(h, function(b, S) {
|
|
359
|
+
(!(a.isUndefined(b) || b === null) && s.call(
|
|
360
360
|
t,
|
|
361
|
-
|
|
361
|
+
b,
|
|
362
362
|
a.isString(S) ? S.trim() : S,
|
|
363
363
|
y,
|
|
364
364
|
g
|
|
365
|
-
)) === !0 &&
|
|
365
|
+
)) === !0 && w(b, y ? y.concat(S) : [S]);
|
|
366
366
|
}), d.pop();
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
if (!a.isObject(e))
|
|
370
370
|
throw new TypeError("data must be an object");
|
|
371
|
-
return
|
|
371
|
+
return w(e), t;
|
|
372
372
|
}
|
|
373
373
|
function Le(e) {
|
|
374
374
|
const t = {
|
|
@@ -852,8 +852,8 @@ function kn(e, t) {
|
|
|
852
852
|
g += n[d++], d = d % e;
|
|
853
853
|
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
|
|
854
854
|
return;
|
|
855
|
-
const
|
|
856
|
-
return
|
|
855
|
+
const w = l && u - l;
|
|
856
|
+
return w ? Math.round(g * 1e3 / w) : void 0;
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
859
|
function Bn(e, t) {
|
|
@@ -1025,13 +1025,13 @@ const pt = (e) => {
|
|
|
1025
1025
|
const s = pt(e);
|
|
1026
1026
|
let o = s.data;
|
|
1027
1027
|
const i = O.from(s.headers).normalize();
|
|
1028
|
-
let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, d, g,
|
|
1028
|
+
let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, d, g, w, h;
|
|
1029
1029
|
function y() {
|
|
1030
|
-
|
|
1030
|
+
w && w(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
|
|
1031
1031
|
}
|
|
1032
1032
|
let p = new XMLHttpRequest();
|
|
1033
1033
|
p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
|
|
1034
|
-
function
|
|
1034
|
+
function b() {
|
|
1035
1035
|
if (!p)
|
|
1036
1036
|
return;
|
|
1037
1037
|
const C = O.from(
|
|
@@ -1050,8 +1050,8 @@ const pt = (e) => {
|
|
|
1050
1050
|
r(D), y();
|
|
1051
1051
|
}, A), p = null;
|
|
1052
1052
|
}
|
|
1053
|
-
"onloadend" in p ? p.onloadend =
|
|
1054
|
-
!p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(
|
|
1053
|
+
"onloadend" in p ? p.onloadend = b : p.onreadystatechange = function() {
|
|
1054
|
+
!p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(b);
|
|
1055
1055
|
}, p.onabort = function() {
|
|
1056
1056
|
p && (r(new m("Request aborted", m.ECONNABORTED, e, p)), p = null);
|
|
1057
1057
|
}, p.onerror = function() {
|
|
@@ -1067,7 +1067,7 @@ const pt = (e) => {
|
|
|
1067
1067
|
)), p = null;
|
|
1068
1068
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in p && a.forEach(i.toJSON(), function(U, A) {
|
|
1069
1069
|
p.setRequestHeader(A, U);
|
|
1070
|
-
}), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([g, h] = ne(u, !0), p.addEventListener("progress", g)), f && p.upload && ([d,
|
|
1070
|
+
}), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([g, h] = ne(u, !0), p.addEventListener("progress", g)), f && p.upload && ([d, w] = ne(f), p.upload.addEventListener("progress", d), p.upload.addEventListener("loadend", w)), (s.cancelToken || s.signal) && (l = (C) => {
|
|
1071
1071
|
p && (r(!C || C.type ? new M(null, e, p) : C), p.abort(), p = null);
|
|
1072
1072
|
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
|
|
1073
1073
|
const S = Dn(s.url);
|
|
@@ -1216,9 +1216,9 @@ const Qn = async (e) => {
|
|
|
1216
1216
|
fetchOptions: g
|
|
1217
1217
|
} = pt(e);
|
|
1218
1218
|
u = u ? (u + "").toLowerCase() : "text";
|
|
1219
|
-
let
|
|
1220
|
-
const y =
|
|
1221
|
-
|
|
1219
|
+
let w = Hn([s, o && o.toAbortSignal()], i), h;
|
|
1220
|
+
const y = w && w.unsubscribe && (() => {
|
|
1221
|
+
w.unsubscribe();
|
|
1222
1222
|
});
|
|
1223
1223
|
let p;
|
|
1224
1224
|
try {
|
|
@@ -1237,15 +1237,15 @@ const Qn = async (e) => {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
1239
|
a.isString(d) || (d = d ? "include" : "omit");
|
|
1240
|
-
const
|
|
1240
|
+
const b = "credentials" in Request.prototype;
|
|
1241
1241
|
h = new Request(t, {
|
|
1242
1242
|
...g,
|
|
1243
|
-
signal:
|
|
1243
|
+
signal: w,
|
|
1244
1244
|
method: n.toUpperCase(),
|
|
1245
1245
|
headers: l.normalize().toJSON(),
|
|
1246
1246
|
body: r,
|
|
1247
1247
|
duplex: "half",
|
|
1248
|
-
credentials:
|
|
1248
|
+
credentials: b ? d : void 0
|
|
1249
1249
|
});
|
|
1250
1250
|
let S = await fetch(h, g);
|
|
1251
1251
|
const C = we && (u === "stream" || u === "response");
|
|
@@ -1277,13 +1277,13 @@ const Qn = async (e) => {
|
|
|
1277
1277
|
request: h
|
|
1278
1278
|
});
|
|
1279
1279
|
});
|
|
1280
|
-
} catch (
|
|
1281
|
-
throw y && y(),
|
|
1280
|
+
} catch (b) {
|
|
1281
|
+
throw y && y(), b && b.name === "TypeError" && /Load failed|fetch/i.test(b.message) ? Object.assign(
|
|
1282
1282
|
new m("Network Error", m.ERR_NETWORK, e, h),
|
|
1283
1283
|
{
|
|
1284
|
-
cause:
|
|
1284
|
+
cause: b.cause || b
|
|
1285
1285
|
}
|
|
1286
|
-
) : m.from(
|
|
1286
|
+
) : m.from(b, b && b.code, e, h);
|
|
1287
1287
|
}
|
|
1288
1288
|
}), be = {
|
|
1289
1289
|
http: dn,
|
|
@@ -1476,18 +1476,18 @@ let q = class {
|
|
|
1476
1476
|
return l;
|
|
1477
1477
|
}
|
|
1478
1478
|
g = c.length;
|
|
1479
|
-
let
|
|
1479
|
+
let w = n;
|
|
1480
1480
|
for (d = 0; d < g; ) {
|
|
1481
1481
|
const h = c[d++], y = c[d++];
|
|
1482
1482
|
try {
|
|
1483
|
-
|
|
1483
|
+
w = h(w);
|
|
1484
1484
|
} catch (p) {
|
|
1485
1485
|
y.call(this, p);
|
|
1486
1486
|
break;
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
1489
|
try {
|
|
1490
|
-
l = Me.call(this,
|
|
1490
|
+
l = Me.call(this, w);
|
|
1491
1491
|
} catch (h) {
|
|
1492
1492
|
return Promise.reject(h);
|
|
1493
1493
|
}
|
|
@@ -1680,44 +1680,44 @@ function Et(e) {
|
|
|
1680
1680
|
return Et(I(e, s));
|
|
1681
1681
|
}, n;
|
|
1682
1682
|
}
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1683
|
+
const E = Et(X);
|
|
1684
|
+
E.Axios = q;
|
|
1685
|
+
E.CanceledError = M;
|
|
1686
|
+
E.CancelToken = er;
|
|
1687
|
+
E.isCancel = ft;
|
|
1688
|
+
E.VERSION = wt;
|
|
1689
|
+
E.toFormData = ae;
|
|
1690
|
+
E.AxiosError = m;
|
|
1691
|
+
E.Cancel = E.CanceledError;
|
|
1692
|
+
E.all = function(t) {
|
|
1693
1693
|
return Promise.all(t);
|
|
1694
1694
|
};
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1695
|
+
E.spread = tr;
|
|
1696
|
+
E.isAxiosError = nr;
|
|
1697
|
+
E.mergeConfig = I;
|
|
1698
|
+
E.AxiosHeaders = O;
|
|
1699
|
+
E.formToJSON = (e) => lt(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1700
|
+
E.getAdapter = gt.getAdapter;
|
|
1701
|
+
E.HttpStatusCode = Ee;
|
|
1702
|
+
E.default = E;
|
|
1703
1703
|
const {
|
|
1704
|
-
Axios:
|
|
1704
|
+
Axios: es,
|
|
1705
1705
|
AxiosError: G,
|
|
1706
|
-
CanceledError:
|
|
1707
|
-
isCancel:
|
|
1708
|
-
CancelToken:
|
|
1709
|
-
VERSION:
|
|
1710
|
-
all:
|
|
1711
|
-
Cancel:
|
|
1712
|
-
isAxiosError:
|
|
1713
|
-
spread:
|
|
1714
|
-
toFormData:
|
|
1715
|
-
AxiosHeaders:
|
|
1716
|
-
HttpStatusCode:
|
|
1717
|
-
formToJSON:
|
|
1718
|
-
getAdapter:
|
|
1719
|
-
mergeConfig:
|
|
1720
|
-
} =
|
|
1706
|
+
CanceledError: ts,
|
|
1707
|
+
isCancel: ns,
|
|
1708
|
+
CancelToken: rs,
|
|
1709
|
+
VERSION: ss,
|
|
1710
|
+
all: os,
|
|
1711
|
+
Cancel: is,
|
|
1712
|
+
isAxiosError: as,
|
|
1713
|
+
spread: cs,
|
|
1714
|
+
toFormData: us,
|
|
1715
|
+
AxiosHeaders: ls,
|
|
1716
|
+
HttpStatusCode: fs,
|
|
1717
|
+
formToJSON: ds,
|
|
1718
|
+
getAdapter: hs,
|
|
1719
|
+
mergeConfig: ps
|
|
1720
|
+
} = E;
|
|
1721
1721
|
class He extends Error {
|
|
1722
1722
|
constructor(n) {
|
|
1723
1723
|
super(n.join(", "));
|
|
@@ -1757,7 +1757,7 @@ class rr {
|
|
|
1757
1757
|
path: "/affiliates",
|
|
1758
1758
|
postData: {
|
|
1759
1759
|
address: t,
|
|
1760
|
-
|
|
1760
|
+
identifier_type: n,
|
|
1761
1761
|
name: r,
|
|
1762
1762
|
code: r,
|
|
1763
1763
|
signature: s,
|
|
@@ -1783,8 +1783,8 @@ class rr {
|
|
|
1783
1783
|
path: `/affiliates/${t}`,
|
|
1784
1784
|
postData: {
|
|
1785
1785
|
code: r,
|
|
1786
|
-
|
|
1787
|
-
|
|
1786
|
+
user_identifier: t,
|
|
1787
|
+
identifier_type: n,
|
|
1788
1788
|
signature: s,
|
|
1789
1789
|
account_chain_id: o
|
|
1790
1790
|
}
|
|
@@ -1814,7 +1814,7 @@ class rr {
|
|
|
1814
1814
|
async getCode(t, n) {
|
|
1815
1815
|
var r;
|
|
1816
1816
|
try {
|
|
1817
|
-
return (await this.httpClient.get({ path: `/affiliates/${t}`, queryParams: {
|
|
1817
|
+
return (await this.httpClient.get({ path: `/affiliates/${t}`, queryParams: { identifier_type: n } })).data.code;
|
|
1818
1818
|
} catch (s) {
|
|
1819
1819
|
if (s instanceof G && ((r = s.response) == null ? void 0 : r.status) === 404)
|
|
1820
1820
|
return null;
|
|
@@ -1868,6 +1868,7 @@ class ur {
|
|
|
1868
1868
|
this.debug && console.debug(`Fuul SDK: Sent '${t.name}' event`), this.saveSentEvent(t);
|
|
1869
1869
|
}
|
|
1870
1870
|
isDuplicate(t) {
|
|
1871
|
+
var l, d, g, w;
|
|
1871
1872
|
const n = `${Je}_${t.name}`, r = localStorage.getItem(n);
|
|
1872
1873
|
if (!r)
|
|
1873
1874
|
return !1;
|
|
@@ -1875,7 +1876,7 @@ class ur {
|
|
|
1875
1876
|
if (this.getCurrentTimestamp() - s.timestamp > ar)
|
|
1876
1877
|
return !1;
|
|
1877
1878
|
let f = !1;
|
|
1878
|
-
t.metadata && (f = s.metadata.tracking_id === t.metadata.tracking_id && s.metadata.project_id === t.metadata.project_id && s.metadata.referrer === t.metadata.referrer && s.metadata.source === t.metadata.source && s.metadata.category === t.metadata.category && s.metadata.title === t.metadata.title && s.metadata.tag === t.metadata.tag && s.user_address === t.user_address && s.signature === t.signature && s.signature_message === t.signature_message);
|
|
1879
|
+
t.metadata && (f = s.metadata.tracking_id === t.metadata.tracking_id && s.metadata.project_id === t.metadata.project_id && s.metadata.referrer === t.metadata.referrer && s.metadata.source === t.metadata.source && s.metadata.category === t.metadata.category && s.metadata.title === t.metadata.title && s.metadata.tag === t.metadata.tag && s.user_address === t.user_address && ((l = s.user) == null ? void 0 : l.identifier) === ((d = t.user) == null ? void 0 : d.identifier) && ((g = s.user) == null ? void 0 : g.identifier_type) === ((w = t.user) == null ? void 0 : w.identifier_type) && s.signature === t.signature && s.signature_message === t.signature_message);
|
|
1879
1880
|
let u = !1;
|
|
1880
1881
|
return t.args && s.args && (u = s.args.page === t.args.page), u && f;
|
|
1881
1882
|
}
|
|
@@ -1883,27 +1884,32 @@ class ur {
|
|
|
1883
1884
|
return Date.now() / 1e3;
|
|
1884
1885
|
}
|
|
1885
1886
|
saveSentEvent(t) {
|
|
1886
|
-
var i, c;
|
|
1887
|
+
var i, c, f, u;
|
|
1887
1888
|
const n = `${Je}_${t.name}`, r = `${n}_all`, s = this.getCurrentTimestamp(), o = { ...t, timestamp: s };
|
|
1888
1889
|
if (localStorage.setItem(n, JSON.stringify(o)), t.name === cr) {
|
|
1889
|
-
const
|
|
1890
|
+
const l = JSON.parse(localStorage.getItem(r) || "[]"), d = {
|
|
1890
1891
|
name: t.name,
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1892
|
+
user: {
|
|
1893
|
+
identifier: (i = t.user) == null ? void 0 : i.identifier,
|
|
1894
|
+
identifier_type: (c = t.user) == null ? void 0 : c.identifier_type
|
|
1895
|
+
},
|
|
1896
|
+
tracking_id: (f = t.metadata) == null ? void 0 : f.tracking_id,
|
|
1897
|
+
page: (u = t.args) == null ? void 0 : u.page
|
|
1898
|
+
};
|
|
1899
|
+
"user_address" in t && (d.user_address = t.user_address);
|
|
1900
|
+
const g = [...l, d];
|
|
1901
|
+
g.length > We && g.splice(0, g.length - We), localStorage.setItem(r, JSON.stringify(g));
|
|
1896
1902
|
}
|
|
1897
1903
|
}
|
|
1898
1904
|
}
|
|
1899
|
-
const lr = "
|
|
1905
|
+
const lr = "7.0.0-beta.2", fr = {
|
|
1900
1906
|
version: lr
|
|
1901
1907
|
};
|
|
1902
1908
|
class dr {
|
|
1903
1909
|
constructor(t) {
|
|
1904
1910
|
R(this, "client");
|
|
1905
1911
|
R(this, "defaultQueryParams");
|
|
1906
|
-
this.client =
|
|
1912
|
+
this.client = E.create({
|
|
1907
1913
|
...t,
|
|
1908
1914
|
headers: {
|
|
1909
1915
|
Authorization: `Bearer ${t.apiKey}`,
|
|
@@ -2007,8 +2013,14 @@ class pr {
|
|
|
2007
2013
|
})).data;
|
|
2008
2014
|
}
|
|
2009
2015
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2016
|
+
const mr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2017
|
+
let yr = (e = 21) => {
|
|
2018
|
+
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
2019
|
+
for (; e--; )
|
|
2020
|
+
t += mr[n[e] & 63];
|
|
2021
|
+
return t;
|
|
2022
|
+
};
|
|
2023
|
+
const gr = "fuul.tracking_id", Ae = () => Rr(gr, () => yr()), Qe = () => v("af") || v("referrer"), wr = () => document.referrer, br = () => Tr(), Er = () => v("category"), Sr = () => v("title"), Cr = () => v("tag"), Rr = (e, t) => {
|
|
2012
2024
|
const n = localStorage.getItem(e);
|
|
2013
2025
|
if (n)
|
|
2014
2026
|
return n;
|
|
@@ -2016,30 +2028,30 @@ const yr = "fuul.tracking_id", Ae = () => Cr(yr, () => mr()), Qe = () => v("af")
|
|
|
2016
2028
|
const r = t();
|
|
2017
2029
|
return r ? localStorage.setItem(e, r) : localStorage.removeItem(e), r;
|
|
2018
2030
|
}
|
|
2019
|
-
}, v = (e) => new URLSearchParams(window.location.search).get(e),
|
|
2031
|
+
}, v = (e) => new URLSearchParams(window.location.search).get(e), Tr = () => {
|
|
2020
2032
|
const e = v("source");
|
|
2021
2033
|
if (e)
|
|
2022
2034
|
return e;
|
|
2023
|
-
},
|
|
2024
|
-
class
|
|
2035
|
+
}, Ar = "/user";
|
|
2036
|
+
class _r {
|
|
2025
2037
|
constructor(t) {
|
|
2026
2038
|
R(this, "httpClient");
|
|
2027
2039
|
this.httpClient = t.httpClient;
|
|
2028
2040
|
}
|
|
2029
2041
|
async getUserAffiliates(t) {
|
|
2030
|
-
return (await this.httpClient.get({ path:
|
|
2042
|
+
return (await this.httpClient.get({ path: Ar, queryParams: { ...t } })).data.affiliates;
|
|
2031
2043
|
}
|
|
2032
2044
|
}
|
|
2033
|
-
const
|
|
2045
|
+
const Or = "https://api.fuul.xyz/api/v1/";
|
|
2034
2046
|
let k = !1, Se = !1, _e, F, St, Ct, $, le, H, Rt, fe;
|
|
2035
|
-
function
|
|
2036
|
-
k = !!e.debug, !Se && (_e = e.apiKey,
|
|
2047
|
+
function Pr(e) {
|
|
2048
|
+
k = !!e.debug, !Se && (_e = e.apiKey, Wr(), F = Qr(e.baseApiUrl ?? Or, e.defaultQueryParams ?? {}), St = new ir({ httpClient: F, debug: k }), le = new ur({ httpClient: F, debug: k }), $ = new rr({ httpClient: F, debug: k }), H = new pr({ httpClient: F, debug: k }), Ct = new _r({ httpClient: F }), Rt = new or({ httpClient: F, debug: k }), fe = new hr({ httpClient: F }), Se = !0, k && console.debug("Fuul SDK: init() complete"));
|
|
2037
2049
|
}
|
|
2038
2050
|
function N() {
|
|
2039
2051
|
if (!Se)
|
|
2040
2052
|
throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods");
|
|
2041
2053
|
}
|
|
2042
|
-
async function
|
|
2054
|
+
async function Nr(e, t) {
|
|
2043
2055
|
N(), Oe(), Pe();
|
|
2044
2056
|
const n = {
|
|
2045
2057
|
name: e,
|
|
@@ -2050,7 +2062,7 @@ async function Pr(e, t) {
|
|
|
2050
2062
|
};
|
|
2051
2063
|
await le.sendEvent(n);
|
|
2052
2064
|
}
|
|
2053
|
-
async function
|
|
2065
|
+
async function xr(e, t) {
|
|
2054
2066
|
N(), Oe(), Pe();
|
|
2055
2067
|
const n = {
|
|
2056
2068
|
name: "pageview",
|
|
@@ -2060,23 +2072,25 @@ async function Nr(e, t) {
|
|
|
2060
2072
|
},
|
|
2061
2073
|
metadata: {
|
|
2062
2074
|
tracking_id: Ae(),
|
|
2063
|
-
referrer_url:
|
|
2064
|
-
source:
|
|
2075
|
+
referrer_url: wr(),
|
|
2076
|
+
source: br(),
|
|
2065
2077
|
affiliate_id: Qe() ?? void 0,
|
|
2066
2078
|
referrer: Qe() ?? void 0,
|
|
2067
|
-
category:
|
|
2068
|
-
title:
|
|
2069
|
-
tag:
|
|
2079
|
+
category: Er() ?? void 0,
|
|
2080
|
+
title: Sr() ?? void 0,
|
|
2081
|
+
tag: Cr() ?? void 0
|
|
2070
2082
|
}
|
|
2071
2083
|
};
|
|
2072
2084
|
await le.sendEvent(n, t);
|
|
2073
2085
|
}
|
|
2074
|
-
async function
|
|
2086
|
+
async function Ur(e, t) {
|
|
2075
2087
|
N(), Oe(), Pe();
|
|
2076
2088
|
const n = {
|
|
2077
2089
|
name: "connect_wallet",
|
|
2078
|
-
|
|
2079
|
-
|
|
2090
|
+
user: {
|
|
2091
|
+
identifier: e.identifier,
|
|
2092
|
+
identifier_type: e.identifierType
|
|
2093
|
+
},
|
|
2080
2094
|
args: {
|
|
2081
2095
|
page: document.location.pathname,
|
|
2082
2096
|
locationOrigin: document.location.origin
|
|
@@ -2087,56 +2101,56 @@ async function xr(e, t) {
|
|
|
2087
2101
|
};
|
|
2088
2102
|
e != null && e.signature && (n.signature = e == null ? void 0 : e.signature, n.signature_message = e == null ? void 0 : e.message), e != null && e.accountChainId && (n.account_chain_id = e.accountChainId), await le.sendEvent(n, t);
|
|
2089
2103
|
}
|
|
2090
|
-
async function Ur(e) {
|
|
2091
|
-
N(), await $.create(e.address, e.blockchain, e.code, e.signature, e.accountChainId);
|
|
2092
|
-
}
|
|
2093
2104
|
async function Lr(e) {
|
|
2094
|
-
N(), await $.
|
|
2105
|
+
N(), await $.create(e.userIdentifier, e.identifierType, e.code, e.signature, e.accountChainId);
|
|
2095
2106
|
}
|
|
2096
|
-
async function Fr(e
|
|
2107
|
+
async function Fr(e) {
|
|
2108
|
+
N(), await $.update(e.userIdentifier, e.identifierType, e.code, e.signature, e.accountChainId);
|
|
2109
|
+
}
|
|
2110
|
+
async function Dr(e, t) {
|
|
2097
2111
|
return N(), await $.getCode(e, t);
|
|
2098
2112
|
}
|
|
2099
|
-
async function
|
|
2113
|
+
async function kr(e) {
|
|
2100
2114
|
return N(), await $.isCodeFree(e);
|
|
2101
2115
|
}
|
|
2102
|
-
async function
|
|
2116
|
+
async function Br(e, t, n, r) {
|
|
2103
2117
|
N();
|
|
2104
2118
|
const s = await $.getCode(t, n), o = new URLSearchParams({
|
|
2105
2119
|
af: s ?? t
|
|
2106
2120
|
});
|
|
2107
2121
|
return r != null && r.title && o.append("af_title", r.title), r != null && r.format && o.append("af_format", r.format), r != null && r.place && o.append("af_place", r.place), `${e}?${o.toString()}`;
|
|
2108
2122
|
}
|
|
2109
|
-
function
|
|
2123
|
+
function qr(e) {
|
|
2110
2124
|
return fe.getPayoutsLeaderboard(e);
|
|
2111
2125
|
}
|
|
2112
|
-
function
|
|
2126
|
+
function Ir(e) {
|
|
2113
2127
|
return fe.getPointsLeaderboard(e);
|
|
2114
2128
|
}
|
|
2115
|
-
function
|
|
2129
|
+
function vr(e) {
|
|
2116
2130
|
return fe.getReferredUsersLeaderboard(e);
|
|
2117
2131
|
}
|
|
2118
|
-
function
|
|
2132
|
+
function jr(e) {
|
|
2119
2133
|
return H.getVolumeLeaderboard(e);
|
|
2120
2134
|
}
|
|
2121
|
-
function
|
|
2135
|
+
function Mr(e) {
|
|
2122
2136
|
return H.getUserPayoutsByConversion(e);
|
|
2123
2137
|
}
|
|
2124
|
-
function
|
|
2138
|
+
function $r(e) {
|
|
2125
2139
|
return H.getUserPointsByConversion(e);
|
|
2126
2140
|
}
|
|
2127
|
-
function
|
|
2141
|
+
function Hr(e) {
|
|
2128
2142
|
return H.getUserPayoutMovements(e);
|
|
2129
2143
|
}
|
|
2130
|
-
function
|
|
2144
|
+
function Vr(e) {
|
|
2131
2145
|
return H.getUserPointsMovements(e);
|
|
2132
2146
|
}
|
|
2133
|
-
async function
|
|
2147
|
+
async function Kr(e) {
|
|
2134
2148
|
return N(), St.getAll(e);
|
|
2135
2149
|
}
|
|
2136
|
-
async function
|
|
2150
|
+
async function zr(e) {
|
|
2137
2151
|
return N(), Ct.getUserAffiliates(e);
|
|
2138
2152
|
}
|
|
2139
|
-
async function
|
|
2153
|
+
async function Jr(e) {
|
|
2140
2154
|
return N(), Rt.getUserAudiences(e);
|
|
2141
2155
|
}
|
|
2142
2156
|
function Oe() {
|
|
@@ -2147,11 +2161,11 @@ function Pe() {
|
|
|
2147
2161
|
if (navigator.webdriver)
|
|
2148
2162
|
throw new Error("Fuul SDK: You are using a browser automation tool");
|
|
2149
2163
|
}
|
|
2150
|
-
function
|
|
2164
|
+
function Wr() {
|
|
2151
2165
|
if (!_e)
|
|
2152
2166
|
throw new Error("Fuul SDK: Invalid API key");
|
|
2153
2167
|
}
|
|
2154
|
-
function
|
|
2168
|
+
function Qr(e, t) {
|
|
2155
2169
|
return new dr({
|
|
2156
2170
|
baseURL: e,
|
|
2157
2171
|
timeout: 3e4,
|
|
@@ -2159,34 +2173,34 @@ function Wr(e, t) {
|
|
|
2159
2173
|
queryParams: t
|
|
2160
2174
|
});
|
|
2161
2175
|
}
|
|
2162
|
-
const
|
|
2163
|
-
init:
|
|
2164
|
-
sendEvent:
|
|
2165
|
-
sendPageview:
|
|
2166
|
-
|
|
2167
|
-
generateTrackingLink:
|
|
2168
|
-
getConversions:
|
|
2169
|
-
createAffiliateCode:
|
|
2170
|
-
updateAffiliateCode:
|
|
2171
|
-
getAffiliateCode:
|
|
2172
|
-
isAffiliateCodeFree:
|
|
2173
|
-
getPayoutsLeaderboard:
|
|
2174
|
-
getPointsLeaderboard:
|
|
2175
|
-
getReferredUsersLeaderboard:
|
|
2176
|
-
getUserAudiences:
|
|
2177
|
-
getUserPayoutsByConversion:
|
|
2178
|
-
getUserPointsByConversion:
|
|
2179
|
-
getUserPointsMovements:
|
|
2180
|
-
getUserPayoutMovements:
|
|
2181
|
-
getUserAffiliates:
|
|
2182
|
-
getVolumeLeaderboard:
|
|
2176
|
+
const ms = {
|
|
2177
|
+
init: Pr,
|
|
2178
|
+
sendEvent: Nr,
|
|
2179
|
+
sendPageview: xr,
|
|
2180
|
+
identifyUser: Ur,
|
|
2181
|
+
generateTrackingLink: Br,
|
|
2182
|
+
getConversions: Kr,
|
|
2183
|
+
createAffiliateCode: Lr,
|
|
2184
|
+
updateAffiliateCode: Fr,
|
|
2185
|
+
getAffiliateCode: Dr,
|
|
2186
|
+
isAffiliateCodeFree: kr,
|
|
2187
|
+
getPayoutsLeaderboard: qr,
|
|
2188
|
+
getPointsLeaderboard: Ir,
|
|
2189
|
+
getReferredUsersLeaderboard: vr,
|
|
2190
|
+
getUserAudiences: Jr,
|
|
2191
|
+
getUserPayoutsByConversion: Mr,
|
|
2192
|
+
getUserPointsByConversion: $r,
|
|
2193
|
+
getUserPointsMovements: Vr,
|
|
2194
|
+
getUserPayoutMovements: Hr,
|
|
2195
|
+
getUserAffiliates: zr,
|
|
2196
|
+
getVolumeLeaderboard: jr
|
|
2183
2197
|
};
|
|
2184
|
-
var
|
|
2198
|
+
var Xr = /* @__PURE__ */ ((e) => (e.EvmAddress = "evm_address", e.SolanaAddress = "solana_address", e.Email = "email", e))(Xr || {});
|
|
2185
2199
|
export {
|
|
2186
2200
|
Ve as AddressInUseError,
|
|
2187
|
-
Qr as BlockchainType,
|
|
2188
2201
|
Ke as CodeInUseError,
|
|
2189
|
-
|
|
2202
|
+
ms as Fuul,
|
|
2190
2203
|
ze as InvalidSignatureError,
|
|
2204
|
+
Xr as UserIdentifierType,
|
|
2191
2205
|
He as ValidationError
|
|
2192
2206
|
};
|