@fuul/sdk 0.16.3 → 0.16.5
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/lib/cjs/index.js +48 -33
- package/lib/cjs/types/index.d.ts +10 -1
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/infrastructure/conversions/dtos.d.ts +13 -7
- package/lib/cjs/types/infrastructure/conversions/dtos.d.ts.map +1 -1
- package/lib/{esm/types/types/types.d.ts → cjs/types/types/index.d.ts} +6 -1
- package/lib/{esm/types/types/types.d.ts.map → cjs/types/types/index.d.ts.map} +1 -1
- package/lib/esm/index.mjs +48 -33
- package/lib/esm/types/index.d.ts +10 -1
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/infrastructure/conversions/dtos.d.ts +13 -7
- package/lib/esm/types/infrastructure/conversions/dtos.d.ts.map +1 -1
- package/lib/{cjs/types/types/types.d.ts → esm/types/types/index.d.ts} +6 -1
- package/lib/{cjs/types/types/types.d.ts.map → esm/types/types/index.d.ts.map} +1 -1
- package/package.json +1 -1
- /package/lib/cjs/types/{types.js → index.js} +0 -0
- /package/lib/esm/types/{types.js → index.js} +0 -0
package/lib/cjs/index.js
CHANGED
|
@@ -69,45 +69,48 @@ const saveTrackingId = () => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
const saveUrlParams = () => {
|
|
72
|
-
var _a, _b, _c;
|
|
72
|
+
var _a, _b, _c, _d, _e;
|
|
73
73
|
if (isBrowserUndefined) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const queryParams = new URLSearchParams(window.location.search);
|
|
77
|
-
|
|
78
|
-
localStorage.setItem(constants_js_1.
|
|
79
|
-
localStorage.setItem(constants_js_1.
|
|
80
|
-
localStorage.setItem(constants_js_1.
|
|
77
|
+
localStorage.setItem(constants_js_1.REFERRER_ID_KEY, (_a = queryParams.get("referrer")) !== null && _a !== void 0 ? _a : "");
|
|
78
|
+
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, (_b = queryParams.get("source")) !== null && _b !== void 0 ? _b : "");
|
|
79
|
+
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, (_c = queryParams.get("category")) !== null && _c !== void 0 ? _c : "");
|
|
80
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, (_d = queryParams.get("title")) !== null && _d !== void 0 ? _d : "");
|
|
81
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TAG_KEY, (_e = queryParams.get("tag")) !== null && _e !== void 0 ? _e : "");
|
|
82
|
+
saveTrafficSource();
|
|
81
83
|
};
|
|
82
|
-
const saveTrafficSource = (
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "affiliate");
|
|
88
|
-
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, "affiliate");
|
|
89
|
-
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, referrerParam);
|
|
90
|
-
localStorage.setItem(constants_js_1.REFERRER_ID_KEY, referrerParam);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
// if traffic source is defined
|
|
94
|
-
if (trafficSourceParam) {
|
|
95
|
-
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, trafficSourceParam);
|
|
84
|
+
const saveTrafficSource = () => {
|
|
85
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
86
|
+
const source = queryParams.get("source");
|
|
87
|
+
const referrer = queryParams.get("referrer");
|
|
88
|
+
if (source) {
|
|
96
89
|
return;
|
|
97
90
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// if traffic source is a search engine
|
|
103
|
-
if (constants_js_1.SEARCH_ENGINE_URLS.includes(originURL)) {
|
|
104
|
-
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "organic");
|
|
91
|
+
if (referrer) {
|
|
92
|
+
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "affiliate");
|
|
93
|
+
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, "affiliate");
|
|
94
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, referrer);
|
|
105
95
|
}
|
|
106
96
|
else {
|
|
107
|
-
// if traffic source is
|
|
108
|
-
|
|
97
|
+
// if traffic source is not defined
|
|
98
|
+
const originURL = document.referrer;
|
|
99
|
+
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, originURL);
|
|
100
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, originURL);
|
|
101
|
+
// if traffic source is a search engine
|
|
102
|
+
if (constants_js_1.SEARCH_ENGINE_URLS.includes(originURL)) {
|
|
103
|
+
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "organic");
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// if traffic source is direct
|
|
107
|
+
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "direct");
|
|
108
|
+
}
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
const buildTrackingLinkQueryParams = (referrer, projectId) => {
|
|
112
|
+
return `p=${projectId}&source=fuul&referrer=${referrer}`;
|
|
113
|
+
};
|
|
111
114
|
class Fuul {
|
|
112
115
|
constructor(apiKey, settings = {}) {
|
|
113
116
|
this.BASE_API_URL = "https://api.fuul.xyz/api/v1/";
|
|
@@ -126,10 +129,10 @@ class Fuul {
|
|
|
126
129
|
}
|
|
127
130
|
init() {
|
|
128
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
yield this.sendEvent("pageview");
|
|
132
|
+
if (isBrowserUndefined) {
|
|
133
|
+
return;
|
|
132
134
|
}
|
|
135
|
+
yield this.sendEvent("pageview");
|
|
133
136
|
});
|
|
134
137
|
}
|
|
135
138
|
checkApiKey() {
|
|
@@ -212,9 +215,21 @@ class Fuul {
|
|
|
212
215
|
});
|
|
213
216
|
}
|
|
214
217
|
verifyConnection() {
|
|
215
|
-
if (
|
|
216
|
-
|
|
218
|
+
if (isBrowserUndefined) {
|
|
219
|
+
throw new Error('Fuul SDK is not supported in this environment. Please use "typeof window !== undefined" to check if you are in the browser environment.');
|
|
217
220
|
}
|
|
221
|
+
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Generates a tracking link for a referrer
|
|
225
|
+
* @param {Object} trackingLinkParams - Tracking link parameters
|
|
226
|
+
* @param {string} trackingLinkParams.address - Referrer wallet address.
|
|
227
|
+
* @param {string} trackingLinkParams.projectId - Project ID.
|
|
228
|
+
* @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
|
|
229
|
+
* @returns {string} tracking link
|
|
230
|
+
**/
|
|
231
|
+
generateTrackingLink({ address, projectId, baseUrl, }) {
|
|
232
|
+
return `${baseUrl !== null && baseUrl !== void 0 ? baseUrl : window.location.href}?${buildTrackingLinkQueryParams(address, projectId)}`;
|
|
218
233
|
}
|
|
219
234
|
getAllConversions() {
|
|
220
235
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventArgsType, EventType, FuulSettings } from "./types/
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings, IGenerateTrackingLink } from "./types/index.js";
|
|
2
2
|
import { ConversionDTO } from "./infrastructure/conversions/dtos.js";
|
|
3
3
|
export declare class Fuul {
|
|
4
4
|
private readonly apiKey;
|
|
@@ -29,6 +29,15 @@ export declare class Fuul {
|
|
|
29
29
|
*/
|
|
30
30
|
sendEvent(name: EventType, args?: EventArgsType, signature?: string, signature_message?: string): Promise<any>;
|
|
31
31
|
verifyConnection(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Generates a tracking link for a referrer
|
|
34
|
+
* @param {Object} trackingLinkParams - Tracking link parameters
|
|
35
|
+
* @param {string} trackingLinkParams.address - Referrer wallet address.
|
|
36
|
+
* @param {string} trackingLinkParams.projectId - Project ID.
|
|
37
|
+
* @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
|
|
38
|
+
* @returns {string} tracking link
|
|
39
|
+
**/
|
|
40
|
+
generateTrackingLink({ address, projectId, baseUrl, }: IGenerateTrackingLink): string;
|
|
32
41
|
getAllConversions(): Promise<ConversionDTO[]>;
|
|
33
42
|
}
|
|
34
43
|
declare const _default: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AA6HrE,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0C;IACvE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC,OAAO,CAAC,iBAAiB,CAAoB;gBAEjC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAiB;IAwBjD,IAAI;IAQV,WAAW,IAAI,IAAI;IAMnB;;;;;;;;;;;;;;;;;OAiBG;IACG,SAAS,CACb,IAAI,EAAE,SAAS,EACf,IAAI,CAAC,EAAE,aAAa,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,GAAG,CAAC;IAiFf,gBAAgB,IAAI,IAAI;IAUxB;;;;;;;QAOI;IACJ,oBAAoB,CAAC,EACnB,OAAO,EACP,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,GAAG,MAAM;IAO3B,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGpD;;;;AAED,wBAEE"}
|
|
@@ -3,15 +3,21 @@ export interface Project {
|
|
|
3
3
|
name: string;
|
|
4
4
|
thumbnail_url: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
payment_currency: string;
|
|
10
|
-
conversion_window: number;
|
|
6
|
+
interface ConversionPaymentActionArgs {
|
|
11
7
|
payment_type: string;
|
|
12
|
-
|
|
13
|
-
referrer_amount: number;
|
|
8
|
+
payment_currency: string;
|
|
14
9
|
referral_amount: number;
|
|
10
|
+
referrer_amount: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ConversionDTO {
|
|
13
|
+
action_args?: ConversionPaymentActionArgs;
|
|
14
|
+
action_type?: string;
|
|
15
15
|
attribution_type: string;
|
|
16
|
+
conversion_window: number;
|
|
17
|
+
created_at: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
project: Project;
|
|
16
21
|
}
|
|
22
|
+
export {};
|
|
17
23
|
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/dtos.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,
|
|
1
|
+
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/dtos.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,2BAA2B;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -19,4 +19,9 @@ export interface SentEventParams {
|
|
|
19
19
|
title?: string | null;
|
|
20
20
|
tag?: string | null;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
export interface IGenerateTrackingLink {
|
|
23
|
+
address: string;
|
|
24
|
+
projectId: string;
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -66,45 +66,48 @@ const saveTrackingId = () => {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
const saveUrlParams = () => {
|
|
69
|
-
var _a, _b, _c;
|
|
69
|
+
var _a, _b, _c, _d, _e;
|
|
70
70
|
if (isBrowserUndefined) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
const queryParams = new URLSearchParams(window.location.search);
|
|
74
|
-
|
|
75
|
-
localStorage.setItem(
|
|
76
|
-
localStorage.setItem(
|
|
77
|
-
localStorage.setItem(
|
|
74
|
+
localStorage.setItem(REFERRER_ID_KEY, (_a = queryParams.get("referrer")) !== null && _a !== void 0 ? _a : "");
|
|
75
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, (_b = queryParams.get("source")) !== null && _b !== void 0 ? _b : "");
|
|
76
|
+
localStorage.setItem(TRAFFIC_CATEGORY_KEY, (_c = queryParams.get("category")) !== null && _c !== void 0 ? _c : "");
|
|
77
|
+
localStorage.setItem(TRAFFIC_TITLE_KEY, (_d = queryParams.get("title")) !== null && _d !== void 0 ? _d : "");
|
|
78
|
+
localStorage.setItem(TRAFFIC_TAG_KEY, (_e = queryParams.get("tag")) !== null && _e !== void 0 ? _e : "");
|
|
79
|
+
saveTrafficSource();
|
|
78
80
|
};
|
|
79
|
-
const saveTrafficSource = (
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
localStorage.setItem(TRAFFIC_SOURCE_KEY, "affiliate");
|
|
85
|
-
localStorage.setItem(TRAFFIC_CATEGORY_KEY, "affiliate");
|
|
86
|
-
localStorage.setItem(TRAFFIC_TITLE_KEY, referrerParam);
|
|
87
|
-
localStorage.setItem(REFERRER_ID_KEY, referrerParam);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
// if traffic source is defined
|
|
91
|
-
if (trafficSourceParam) {
|
|
92
|
-
localStorage.setItem(TRAFFIC_SOURCE_KEY, trafficSourceParam);
|
|
81
|
+
const saveTrafficSource = () => {
|
|
82
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
83
|
+
const source = queryParams.get("source");
|
|
84
|
+
const referrer = queryParams.get("referrer");
|
|
85
|
+
if (source) {
|
|
93
86
|
return;
|
|
94
87
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// if traffic source is a search engine
|
|
100
|
-
if (SEARCH_ENGINE_URLS.includes(originURL)) {
|
|
101
|
-
localStorage.setItem(TRAFFIC_SOURCE_KEY, "organic");
|
|
88
|
+
if (referrer) {
|
|
89
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, "affiliate");
|
|
90
|
+
localStorage.setItem(TRAFFIC_CATEGORY_KEY, "affiliate");
|
|
91
|
+
localStorage.setItem(TRAFFIC_TITLE_KEY, referrer);
|
|
102
92
|
}
|
|
103
93
|
else {
|
|
104
|
-
// if traffic source is
|
|
105
|
-
|
|
94
|
+
// if traffic source is not defined
|
|
95
|
+
const originURL = document.referrer;
|
|
96
|
+
localStorage.setItem(TRAFFIC_CATEGORY_KEY, originURL);
|
|
97
|
+
localStorage.setItem(TRAFFIC_TITLE_KEY, originURL);
|
|
98
|
+
// if traffic source is a search engine
|
|
99
|
+
if (SEARCH_ENGINE_URLS.includes(originURL)) {
|
|
100
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, "organic");
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// if traffic source is direct
|
|
104
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, "direct");
|
|
105
|
+
}
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
+
const buildTrackingLinkQueryParams = (referrer, projectId) => {
|
|
109
|
+
return `p=${projectId}&source=fuul&referrer=${referrer}`;
|
|
110
|
+
};
|
|
108
111
|
export class Fuul {
|
|
109
112
|
constructor(apiKey, settings = {}) {
|
|
110
113
|
this.BASE_API_URL = "https://api.fuul.xyz/api/v1/";
|
|
@@ -123,10 +126,10 @@ export class Fuul {
|
|
|
123
126
|
}
|
|
124
127
|
init() {
|
|
125
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
yield this.sendEvent("pageview");
|
|
129
|
+
if (isBrowserUndefined) {
|
|
130
|
+
return;
|
|
129
131
|
}
|
|
132
|
+
yield this.sendEvent("pageview");
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
checkApiKey() {
|
|
@@ -209,9 +212,21 @@ export class Fuul {
|
|
|
209
212
|
});
|
|
210
213
|
}
|
|
211
214
|
verifyConnection() {
|
|
212
|
-
if (
|
|
213
|
-
|
|
215
|
+
if (isBrowserUndefined) {
|
|
216
|
+
throw new Error('Fuul SDK is not supported in this environment. Please use "typeof window !== undefined" to check if you are in the browser environment.');
|
|
214
217
|
}
|
|
218
|
+
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Generates a tracking link for a referrer
|
|
222
|
+
* @param {Object} trackingLinkParams - Tracking link parameters
|
|
223
|
+
* @param {string} trackingLinkParams.address - Referrer wallet address.
|
|
224
|
+
* @param {string} trackingLinkParams.projectId - Project ID.
|
|
225
|
+
* @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
|
|
226
|
+
* @returns {string} tracking link
|
|
227
|
+
**/
|
|
228
|
+
generateTrackingLink({ address, projectId, baseUrl, }) {
|
|
229
|
+
return `${baseUrl !== null && baseUrl !== void 0 ? baseUrl : window.location.href}?${buildTrackingLinkQueryParams(address, projectId)}`;
|
|
215
230
|
}
|
|
216
231
|
getAllConversions() {
|
|
217
232
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventArgsType, EventType, FuulSettings } from "./types/
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings, IGenerateTrackingLink } from "./types/index.js";
|
|
2
2
|
import { ConversionDTO } from "./infrastructure/conversions/dtos.js";
|
|
3
3
|
export declare class Fuul {
|
|
4
4
|
private readonly apiKey;
|
|
@@ -29,6 +29,15 @@ export declare class Fuul {
|
|
|
29
29
|
*/
|
|
30
30
|
sendEvent(name: EventType, args?: EventArgsType, signature?: string, signature_message?: string): Promise<any>;
|
|
31
31
|
verifyConnection(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Generates a tracking link for a referrer
|
|
34
|
+
* @param {Object} trackingLinkParams - Tracking link parameters
|
|
35
|
+
* @param {string} trackingLinkParams.address - Referrer wallet address.
|
|
36
|
+
* @param {string} trackingLinkParams.projectId - Project ID.
|
|
37
|
+
* @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
|
|
38
|
+
* @returns {string} tracking link
|
|
39
|
+
**/
|
|
40
|
+
generateTrackingLink({ address, projectId, baseUrl, }: IGenerateTrackingLink): string;
|
|
32
41
|
getAllConversions(): Promise<ConversionDTO[]>;
|
|
33
42
|
}
|
|
34
43
|
declare const _default: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AA6HrE,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0C;IACvE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC,OAAO,CAAC,iBAAiB,CAAoB;gBAEjC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAiB;IAwBjD,IAAI;IAQV,WAAW,IAAI,IAAI;IAMnB;;;;;;;;;;;;;;;;;OAiBG;IACG,SAAS,CACb,IAAI,EAAE,SAAS,EACf,IAAI,CAAC,EAAE,aAAa,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,GAAG,CAAC;IAiFf,gBAAgB,IAAI,IAAI;IAUxB;;;;;;;QAOI;IACJ,oBAAoB,CAAC,EACnB,OAAO,EACP,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,GAAG,MAAM;IAO3B,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGpD;;;;AAED,wBAEE"}
|
|
@@ -3,15 +3,21 @@ export interface Project {
|
|
|
3
3
|
name: string;
|
|
4
4
|
thumbnail_url: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
payment_currency: string;
|
|
10
|
-
conversion_window: number;
|
|
6
|
+
interface ConversionPaymentActionArgs {
|
|
11
7
|
payment_type: string;
|
|
12
|
-
|
|
13
|
-
referrer_amount: number;
|
|
8
|
+
payment_currency: string;
|
|
14
9
|
referral_amount: number;
|
|
10
|
+
referrer_amount: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ConversionDTO {
|
|
13
|
+
action_args?: ConversionPaymentActionArgs;
|
|
14
|
+
action_type?: string;
|
|
15
15
|
attribution_type: string;
|
|
16
|
+
conversion_window: number;
|
|
17
|
+
created_at: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
project: Project;
|
|
16
21
|
}
|
|
22
|
+
export {};
|
|
17
23
|
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/dtos.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,
|
|
1
|
+
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/dtos.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,2BAA2B;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -19,4 +19,9 @@ export interface SentEventParams {
|
|
|
19
19
|
title?: string | null;
|
|
20
20
|
tag?: string | null;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
export interface IGenerateTrackingLink {
|
|
23
|
+
address: string;
|
|
24
|
+
projectId: string;
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|