@fuul/sdk 0.13.1 → 0.16.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/lib/cjs/constants.js +6 -1
- package/lib/cjs/index.js +83 -37
- package/lib/cjs/infrastructure/{campaigns/campaignsService.js → conversions/conversionService.js} +5 -5
- package/lib/cjs/types/constants.d.ts +5 -0
- package/lib/cjs/types/constants.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +7 -13
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/infrastructure/conversions/conversionService.d.ts +8 -0
- package/lib/cjs/types/infrastructure/conversions/conversionService.d.ts.map +1 -0
- package/lib/cjs/types/infrastructure/conversions/dtos.d.ts +16 -0
- package/lib/cjs/types/infrastructure/conversions/dtos.d.ts.map +1 -0
- package/lib/cjs/types/types/types.d.ts +6 -7
- package/lib/cjs/types/types/types.d.ts.map +1 -1
- package/lib/cjs/types/utils/localStorage.d.ts +4 -0
- package/lib/cjs/types/utils/localStorage.d.ts.map +1 -1
- package/lib/cjs/utils/localStorage.js +9 -1
- package/lib/esm/constants.js +5 -0
- package/lib/esm/index.mjs +85 -39
- package/lib/esm/infrastructure/{campaigns/campaignsService.js → conversions/conversionService.js} +3 -3
- package/lib/esm/types/constants.d.ts +5 -0
- package/lib/esm/types/constants.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +7 -13
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/infrastructure/conversions/conversionService.d.ts +8 -0
- package/lib/esm/types/infrastructure/conversions/conversionService.d.ts.map +1 -0
- package/lib/esm/types/infrastructure/conversions/dtos.d.ts +16 -0
- package/lib/esm/types/infrastructure/conversions/dtos.d.ts.map +1 -0
- package/lib/esm/types/types/types.d.ts +6 -7
- package/lib/esm/types/types/types.d.ts.map +1 -1
- package/lib/esm/types/utils/localStorage.d.ts +4 -0
- package/lib/esm/types/utils/localStorage.d.ts.map +1 -1
- package/lib/esm/utils/localStorage.js +5 -1
- package/package.json +1 -1
- package/lib/cjs/types/infrastructure/campaigns/campaignsService.d.ts +0 -8
- package/lib/cjs/types/infrastructure/campaigns/campaignsService.d.ts.map +0 -1
- package/lib/cjs/types/infrastructure/campaigns/dtos.d.ts +0 -32
- package/lib/cjs/types/infrastructure/campaigns/dtos.d.ts.map +0 -1
- package/lib/esm/types/infrastructure/campaigns/campaignsService.d.ts +0 -8
- package/lib/esm/types/infrastructure/campaigns/campaignsService.d.ts.map +0 -1
- package/lib/esm/types/infrastructure/campaigns/dtos.d.ts +0 -32
- package/lib/esm/types/infrastructure/campaigns/dtos.d.ts.map +0 -1
- /package/lib/cjs/infrastructure/{campaigns → conversions}/dtos.js +0 -0
- /package/lib/esm/infrastructure/{campaigns → conversions}/dtos.js +0 -0
package/lib/cjs/constants.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SENT_EVENT_VALIDITY_PERIOD_MS = exports.SENT_EVENT_ID_KEY = exports.REFERRER_ID_KEY = exports.PROJECT_ID_KEY = exports.TRACKING_ID_KEY = exports.SESSION_ID_KEY = void 0;
|
|
3
|
+
exports.SEARCH_ENGINE_URLS = exports.SENT_EVENT_VALIDITY_PERIOD_MS = exports.SENT_EVENT_ID_KEY = exports.TRAFFIC_TAG_KEY = exports.TRAFFIC_TITLE_KEY = exports.TRAFFIC_CATEGORY_KEY = exports.TRAFFIC_SOURCE_KEY = exports.REFERRER_ID_KEY = exports.PROJECT_ID_KEY = exports.TRACKING_ID_KEY = exports.SESSION_ID_KEY = void 0;
|
|
4
4
|
exports.SESSION_ID_KEY = "fuul.session_id";
|
|
5
5
|
exports.TRACKING_ID_KEY = "fuul.tracking_id";
|
|
6
6
|
exports.PROJECT_ID_KEY = "fuul.project_id";
|
|
7
7
|
exports.REFERRER_ID_KEY = "fuul.referrer_id";
|
|
8
|
+
exports.TRAFFIC_SOURCE_KEY = "fuul.traffic_source";
|
|
9
|
+
exports.TRAFFIC_CATEGORY_KEY = "fuul.traffic_category";
|
|
10
|
+
exports.TRAFFIC_TITLE_KEY = "fuul.traffic_title";
|
|
11
|
+
exports.TRAFFIC_TAG_KEY = "fuul.traffic_tag";
|
|
8
12
|
exports.SENT_EVENT_ID_KEY = "fuul.sent";
|
|
9
13
|
exports.SENT_EVENT_VALIDITY_PERIOD_MS = 60000;
|
|
14
|
+
exports.SEARCH_ENGINE_URLS = ["google.com", "bing.com", "yahoo.com"];
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const nanoid_1 = require("nanoid");
|
|
|
14
14
|
const localStorage_js_1 = require("./utils/localStorage.js");
|
|
15
15
|
const constants_js_1 = require("./constants.js");
|
|
16
16
|
const HttpClient_js_1 = require("./infrastructure/http/HttpClient.js");
|
|
17
|
-
const
|
|
17
|
+
const conversionService_js_1 = require("./infrastructure/conversions/conversionService.js");
|
|
18
18
|
const saveSentEvent = (eventName, params) => {
|
|
19
19
|
const timestamp = Date.now();
|
|
20
20
|
const SENT_EVENT_KEY = `${constants_js_1.SENT_EVENT_ID_KEY}_${eventName}`;
|
|
@@ -36,41 +36,77 @@ const shouldEventBeSent = (eventName, params) => {
|
|
|
36
36
|
}
|
|
37
37
|
let eventArgsMatch = false;
|
|
38
38
|
if (eventName === "connect_wallet") {
|
|
39
|
-
eventArgsMatch =
|
|
40
|
-
parsedEvent["
|
|
39
|
+
eventArgsMatch =
|
|
40
|
+
parsedEvent["tracking_id"] === params.tracking_id &&
|
|
41
|
+
parsedEvent["address"] === params.address;
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
eventArgsMatch =
|
|
44
|
-
parsedEvent["
|
|
45
|
-
|
|
44
|
+
eventArgsMatch =
|
|
45
|
+
parsedEvent["tracking_id"] === params.tracking_id &&
|
|
46
|
+
parsedEvent["project_id"] === params.project_id &&
|
|
47
|
+
parsedEvent["referrer_id"] === params.referrer_id &&
|
|
48
|
+
parsedEvent["source"] === params.source &&
|
|
49
|
+
parsedEvent["category"] === params.category &&
|
|
50
|
+
parsedEvent["title"] === params.title &&
|
|
51
|
+
parsedEvent["tag"] === params.tag;
|
|
46
52
|
}
|
|
47
53
|
return !eventArgsMatch;
|
|
48
54
|
};
|
|
49
55
|
const generateRandomId = () => (0, nanoid_1.nanoid)();
|
|
56
|
+
const isBrowserUndefined = typeof window === "undefined" || typeof document === "undefined";
|
|
50
57
|
const saveSessionId = () => {
|
|
51
|
-
if (
|
|
58
|
+
if (isBrowserUndefined) {
|
|
52
59
|
return;
|
|
60
|
+
}
|
|
53
61
|
localStorage.setItem(constants_js_1.SESSION_ID_KEY, generateRandomId());
|
|
54
62
|
};
|
|
55
63
|
const saveTrackingId = () => {
|
|
56
|
-
|
|
57
|
-
if (typeof window === "undefined" || typeof document === "undefined")
|
|
58
|
-
return;
|
|
59
|
-
const queryParams = new URLSearchParams(window.location.search);
|
|
60
|
-
if (!queryParams.has("p") ||
|
|
61
|
-
!queryParams.has("origin") ||
|
|
62
|
-
!queryParams.has("r"))
|
|
63
|
-
return;
|
|
64
|
-
const isFuulOrigin = queryParams.get("origin") === "fuul";
|
|
65
|
-
if (!isFuulOrigin)
|
|
64
|
+
if (isBrowserUndefined) {
|
|
66
65
|
return;
|
|
66
|
+
}
|
|
67
67
|
if (!(0, localStorage_js_1.getTrackingId)()) {
|
|
68
68
|
localStorage.setItem(constants_js_1.TRACKING_ID_KEY, generateRandomId());
|
|
69
69
|
}
|
|
70
|
-
localStorage.setItem(constants_js_1.REFERRER_ID_KEY, (_a = queryParams.get("r")) !== null && _a !== void 0 ? _a : "");
|
|
71
70
|
};
|
|
72
|
-
const
|
|
73
|
-
|
|
71
|
+
const saveUrlParams = () => {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
if (isBrowserUndefined) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
77
|
+
saveTrafficSource(queryParams);
|
|
78
|
+
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, (_a = queryParams.get("category")) !== null && _a !== void 0 ? _a : "");
|
|
79
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, (_b = queryParams.get("title")) !== null && _b !== void 0 ? _b : "");
|
|
80
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TAG_KEY, (_c = queryParams.get("tag")) !== null && _c !== void 0 ? _c : "");
|
|
81
|
+
};
|
|
82
|
+
const saveTrafficSource = (queryParams) => {
|
|
83
|
+
const trafficSourceParam = queryParams.get("source");
|
|
84
|
+
const referrerParam = queryParams.get("r");
|
|
85
|
+
// if is an affiliate link
|
|
86
|
+
if (referrerParam) {
|
|
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);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// if traffic source is not defined
|
|
99
|
+
const originURL = document.referrer;
|
|
100
|
+
localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, originURL);
|
|
101
|
+
localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, originURL);
|
|
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");
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// if traffic source is direct
|
|
108
|
+
localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "direct");
|
|
109
|
+
}
|
|
74
110
|
};
|
|
75
111
|
class Fuul {
|
|
76
112
|
constructor(apiKey, settings = {}) {
|
|
@@ -80,11 +116,12 @@ class Fuul {
|
|
|
80
116
|
this.checkApiKey();
|
|
81
117
|
saveSessionId();
|
|
82
118
|
saveTrackingId();
|
|
119
|
+
saveUrlParams();
|
|
83
120
|
this.httpClient = new HttpClient_js_1.HttpClient(Object.assign({ baseURL: this.BASE_API_URL, timeout: 10000, apiKey: this.apiKey }, (this.settings.defaultQueryParams &&
|
|
84
121
|
typeof this.settings.defaultQueryParams !== "string" && {
|
|
85
122
|
queryParams: this.settings.defaultQueryParams,
|
|
86
123
|
})));
|
|
87
|
-
this.
|
|
124
|
+
this.conversionService = new conversionService_js_1.ConversionService(this.httpClient);
|
|
88
125
|
this.init();
|
|
89
126
|
}
|
|
90
127
|
init() {
|
|
@@ -103,6 +140,8 @@ class Fuul {
|
|
|
103
140
|
/**
|
|
104
141
|
* @param {EventType} name Event name.
|
|
105
142
|
* @param {EventArgsType} args Event additional arguments.
|
|
143
|
+
* @param {String} signature Event signature.
|
|
144
|
+
* @param {String} signature_message Event signature message.
|
|
106
145
|
* ```js
|
|
107
146
|
* import { Fuul } from 'fuul-sdk'
|
|
108
147
|
*
|
|
@@ -116,7 +155,7 @@ class Fuul {
|
|
|
116
155
|
* })
|
|
117
156
|
* ```
|
|
118
157
|
*/
|
|
119
|
-
sendEvent(name, args) {
|
|
158
|
+
sendEvent(name, args, signature, signature_message) {
|
|
120
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
160
|
const session_id = (0, localStorage_js_1.getSessionId)();
|
|
122
161
|
const tracking_id = (0, localStorage_js_1.getTrackingId)();
|
|
@@ -132,19 +171,36 @@ class Fuul {
|
|
|
132
171
|
reqBody = {
|
|
133
172
|
name,
|
|
134
173
|
session_id,
|
|
135
|
-
event_args: Object.assign(Object.assign({}, args), { tracking_id })
|
|
174
|
+
event_args: Object.assign(Object.assign({}, args), { tracking_id }),
|
|
136
175
|
};
|
|
137
176
|
}
|
|
138
177
|
else {
|
|
178
|
+
const source = (0, localStorage_js_1.getTrafficSource)();
|
|
179
|
+
const category = (0, localStorage_js_1.getTrafficCategory)();
|
|
180
|
+
const title = (0, localStorage_js_1.getTrafficTitle)();
|
|
181
|
+
const tag = (0, localStorage_js_1.getTrafficTag)();
|
|
139
182
|
if (!referrer_id)
|
|
140
183
|
return;
|
|
141
|
-
params = Object.assign(Object.assign({}, params), {
|
|
184
|
+
params = Object.assign(Object.assign({}, params), { project_id: args === null || args === void 0 ? void 0 : args.project_id, referrer_id,
|
|
185
|
+
source,
|
|
186
|
+
category,
|
|
187
|
+
title,
|
|
188
|
+
tag });
|
|
142
189
|
reqBody = {
|
|
143
190
|
name,
|
|
144
191
|
session_id,
|
|
145
|
-
event_args: Object.assign(Object.assign({}, args), { referrer: referrer_id, tracking_id
|
|
192
|
+
event_args: Object.assign(Object.assign({}, args), { referrer: referrer_id, tracking_id,
|
|
193
|
+
source,
|
|
194
|
+
category,
|
|
195
|
+
title,
|
|
196
|
+
tag }),
|
|
146
197
|
};
|
|
147
198
|
}
|
|
199
|
+
reqBody = Object.assign(Object.assign(Object.assign({}, reqBody), (signature && {
|
|
200
|
+
signature,
|
|
201
|
+
})), (signature_message && {
|
|
202
|
+
signature_message,
|
|
203
|
+
}));
|
|
148
204
|
if (!shouldEventBeSent(name, params)) {
|
|
149
205
|
return;
|
|
150
206
|
}
|
|
@@ -162,19 +218,9 @@ class Fuul {
|
|
|
162
218
|
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
163
219
|
}
|
|
164
220
|
}
|
|
165
|
-
|
|
166
|
-
* Generates a tracking link for a referrer
|
|
167
|
-
* @param {string} address referrer address
|
|
168
|
-
* @param {string} pid project id you want to refer the user
|
|
169
|
-
* @param {string} baseUrl base url of your app
|
|
170
|
-
* @returns {string} tracking link
|
|
171
|
-
*/
|
|
172
|
-
generateTrackingLink({ address, pid, baseUrl, }) {
|
|
173
|
-
return `${baseUrl !== null && baseUrl !== void 0 ? baseUrl : window.location.href}?${buildTrackingLinkQueryParams(address, pid)}`;
|
|
174
|
-
}
|
|
175
|
-
getAllCampaigns() {
|
|
221
|
+
getAllConversions() {
|
|
176
222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
return this.
|
|
223
|
+
return this.conversionService.getAll();
|
|
178
224
|
});
|
|
179
225
|
}
|
|
180
226
|
}
|
package/lib/cjs/infrastructure/{campaigns/campaignsService.js → conversions/conversionService.js}
RENAMED
|
@@ -9,16 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
class
|
|
12
|
+
exports.ConversionService = void 0;
|
|
13
|
+
class ConversionService {
|
|
14
14
|
constructor(httpClient) {
|
|
15
15
|
this.httpClient = httpClient;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
getAll() {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const { data } = yield this.httpClient.get("
|
|
19
|
+
const { data } = yield this.httpClient.get("conversions");
|
|
20
20
|
return data;
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.
|
|
24
|
+
exports.ConversionService = ConversionService;
|
|
@@ -2,6 +2,11 @@ export declare const SESSION_ID_KEY = "fuul.session_id";
|
|
|
2
2
|
export declare const TRACKING_ID_KEY = "fuul.tracking_id";
|
|
3
3
|
export declare const PROJECT_ID_KEY = "fuul.project_id";
|
|
4
4
|
export declare const REFERRER_ID_KEY = "fuul.referrer_id";
|
|
5
|
+
export declare const TRAFFIC_SOURCE_KEY = "fuul.traffic_source";
|
|
6
|
+
export declare const TRAFFIC_CATEGORY_KEY = "fuul.traffic_category";
|
|
7
|
+
export declare const TRAFFIC_TITLE_KEY = "fuul.traffic_title";
|
|
8
|
+
export declare const TRAFFIC_TAG_KEY = "fuul.traffic_tag";
|
|
5
9
|
export declare const SENT_EVENT_ID_KEY = "fuul.sent";
|
|
6
10
|
export declare const SENT_EVENT_VALIDITY_PERIOD_MS = 60000;
|
|
11
|
+
export declare const SEARCH_ENGINE_URLS: string[];
|
|
7
12
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,6BAA6B,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AACtD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,6BAA6B,QAAQ,CAAC;AAEnD,eAAO,MAAM,kBAAkB,UAA0C,CAAC"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { EventArgsType, EventType, FuulSettings
|
|
2
|
-
import {
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings } from "./types/types.js";
|
|
2
|
+
import { ConversionDTO } from "./infrastructure/conversions/dtos.js";
|
|
3
3
|
export declare class Fuul {
|
|
4
4
|
private readonly apiKey;
|
|
5
5
|
private readonly BASE_API_URL;
|
|
6
6
|
private readonly httpClient;
|
|
7
7
|
private readonly settings;
|
|
8
|
-
private
|
|
8
|
+
private conversionService;
|
|
9
9
|
constructor(apiKey: string, settings?: FuulSettings);
|
|
10
10
|
init(): Promise<void>;
|
|
11
11
|
checkApiKey(): void;
|
|
12
12
|
/**
|
|
13
13
|
* @param {EventType} name Event name.
|
|
14
14
|
* @param {EventArgsType} args Event additional arguments.
|
|
15
|
+
* @param {String} signature Event signature.
|
|
16
|
+
* @param {String} signature_message Event signature message.
|
|
15
17
|
* ```js
|
|
16
18
|
* import { Fuul } from 'fuul-sdk'
|
|
17
19
|
*
|
|
@@ -25,17 +27,9 @@ export declare class Fuul {
|
|
|
25
27
|
* })
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
|
-
sendEvent(name: EventType, args?: EventArgsType): Promise<any>;
|
|
30
|
+
sendEvent(name: EventType, args?: EventArgsType, signature?: string, signature_message?: string): Promise<any>;
|
|
29
31
|
verifyConnection(): void;
|
|
30
|
-
|
|
31
|
-
* Generates a tracking link for a referrer
|
|
32
|
-
* @param {string} address referrer address
|
|
33
|
-
* @param {string} pid project id you want to refer the user
|
|
34
|
-
* @param {string} baseUrl base url of your app
|
|
35
|
-
* @returns {string} tracking link
|
|
36
|
-
*/
|
|
37
|
-
generateTrackingLink({ address, pid, baseUrl, }: IGenerateTrackingLink): string;
|
|
38
|
-
getAllCampaigns(): Promise<CampaignDTO[]>;
|
|
32
|
+
getAllConversions(): Promise<ConversionDTO[]>;
|
|
39
33
|
}
|
|
40
34
|
declare const _default: {
|
|
41
35
|
Fuul: typeof Fuul;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EAEb,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AA2HrE,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;IAmFf,gBAAgB,IAAI,IAAI;IAMlB,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGpD;;;;AAOD,wBAEE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpClient } from "../http/HttpClient.js";
|
|
2
|
+
import { ConversionDTO } from "./dtos.js";
|
|
3
|
+
export declare class ConversionService {
|
|
4
|
+
private httpClient;
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
getAll(): Promise<ConversionDTO[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=conversionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversionService.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/conversionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAI5B,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAKzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Project {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
thumbnail_url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ConversionDTO {
|
|
7
|
+
id: string;
|
|
8
|
+
payment_currency: string;
|
|
9
|
+
conversion_window: number;
|
|
10
|
+
payment_type: string;
|
|
11
|
+
payment_argument: string;
|
|
12
|
+
referrer_amount: number;
|
|
13
|
+
referral_amount: number;
|
|
14
|
+
attribution_type: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -0,0 +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,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -12,12 +12,11 @@ export type EventType = "connect_wallet" | "pageview";
|
|
|
12
12
|
export interface SentEventParams {
|
|
13
13
|
tracking_id: string;
|
|
14
14
|
project_id?: string;
|
|
15
|
-
referrer_id?: string;
|
|
16
|
-
address?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
baseUrl?: string;
|
|
15
|
+
referrer_id?: string | null;
|
|
16
|
+
address?: string | null;
|
|
17
|
+
source?: string | null;
|
|
18
|
+
category?: string | null;
|
|
19
|
+
title?: string | null;
|
|
20
|
+
tag?: string | null;
|
|
22
21
|
}
|
|
23
22
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.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,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.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"}
|
|
@@ -2,4 +2,8 @@ export declare const getSessionId: () => string | null;
|
|
|
2
2
|
export declare const getTrackingId: () => string | null;
|
|
3
3
|
export declare const getProjectId: () => string | null;
|
|
4
4
|
export declare const getReferrerId: () => string | null;
|
|
5
|
+
export declare const getTrafficSource: () => string | null;
|
|
6
|
+
export declare const getTrafficCategory: () => string | null;
|
|
7
|
+
export declare const getTrafficTitle: () => string | null;
|
|
8
|
+
export declare const getTrafficTag: () => string | null;
|
|
5
9
|
//# sourceMappingURL=localStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../../../src/utils/localStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../../../src/utils/localStorage.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,YAAY,qBAA6C,CAAC;AACvE,eAAO,MAAM,aAAa,qBAA8C,CAAC;AACzE,eAAO,MAAM,YAAY,qBAA6C,CAAC;AACvE,eAAO,MAAM,aAAa,qBAA8C,CAAC;AACzE,eAAO,MAAM,gBAAgB,qBAAiD,CAAC;AAC/E,eAAO,MAAM,kBAAkB,qBACa,CAAC;AAC7C,eAAO,MAAM,eAAe,qBAAgD,CAAC;AAC7E,eAAO,MAAM,aAAa,qBAA8C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReferrerId = exports.getProjectId = exports.getTrackingId = exports.getSessionId = void 0;
|
|
3
|
+
exports.getTrafficTag = exports.getTrafficTitle = exports.getTrafficCategory = exports.getTrafficSource = exports.getReferrerId = exports.getProjectId = exports.getTrackingId = exports.getSessionId = void 0;
|
|
4
4
|
const constants_js_1 = require("../constants.js");
|
|
5
5
|
const getSessionId = () => localStorage.getItem(constants_js_1.SESSION_ID_KEY);
|
|
6
6
|
exports.getSessionId = getSessionId;
|
|
@@ -10,3 +10,11 @@ const getProjectId = () => localStorage.getItem(constants_js_1.PROJECT_ID_KEY);
|
|
|
10
10
|
exports.getProjectId = getProjectId;
|
|
11
11
|
const getReferrerId = () => localStorage.getItem(constants_js_1.REFERRER_ID_KEY);
|
|
12
12
|
exports.getReferrerId = getReferrerId;
|
|
13
|
+
const getTrafficSource = () => localStorage.getItem(constants_js_1.TRAFFIC_SOURCE_KEY);
|
|
14
|
+
exports.getTrafficSource = getTrafficSource;
|
|
15
|
+
const getTrafficCategory = () => localStorage.getItem(constants_js_1.TRAFFIC_CATEGORY_KEY);
|
|
16
|
+
exports.getTrafficCategory = getTrafficCategory;
|
|
17
|
+
const getTrafficTitle = () => localStorage.getItem(constants_js_1.TRAFFIC_TITLE_KEY);
|
|
18
|
+
exports.getTrafficTitle = getTrafficTitle;
|
|
19
|
+
const getTrafficTag = () => localStorage.getItem(constants_js_1.TRAFFIC_TAG_KEY);
|
|
20
|
+
exports.getTrafficTag = getTrafficTag;
|
package/lib/esm/constants.js
CHANGED
|
@@ -2,5 +2,10 @@ export const SESSION_ID_KEY = "fuul.session_id";
|
|
|
2
2
|
export const TRACKING_ID_KEY = "fuul.tracking_id";
|
|
3
3
|
export const PROJECT_ID_KEY = "fuul.project_id";
|
|
4
4
|
export const REFERRER_ID_KEY = "fuul.referrer_id";
|
|
5
|
+
export const TRAFFIC_SOURCE_KEY = "fuul.traffic_source";
|
|
6
|
+
export const TRAFFIC_CATEGORY_KEY = "fuul.traffic_category";
|
|
7
|
+
export const TRAFFIC_TITLE_KEY = "fuul.traffic_title";
|
|
8
|
+
export const TRAFFIC_TAG_KEY = "fuul.traffic_tag";
|
|
5
9
|
export const SENT_EVENT_ID_KEY = "fuul.sent";
|
|
6
10
|
export const SENT_EVENT_VALIDITY_PERIOD_MS = 60000;
|
|
11
|
+
export const SEARCH_ENGINE_URLS = ["google.com", "bing.com", "yahoo.com"];
|
package/lib/esm/index.mjs
CHANGED
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { nanoid } from "nanoid";
|
|
11
|
-
import { getReferrerId, getSessionId, getTrackingId, } from "./utils/localStorage.js";
|
|
12
|
-
import { REFERRER_ID_KEY, SENT_EVENT_ID_KEY, SESSION_ID_KEY, TRACKING_ID_KEY, SENT_EVENT_VALIDITY_PERIOD_MS } from "./constants.js";
|
|
11
|
+
import { getReferrerId, getSessionId, getTrackingId, getTrafficCategory, getTrafficSource, getTrafficTag, getTrafficTitle, } from "./utils/localStorage.js";
|
|
12
|
+
import { REFERRER_ID_KEY, SENT_EVENT_ID_KEY, SESSION_ID_KEY, TRACKING_ID_KEY, SENT_EVENT_VALIDITY_PERIOD_MS, TRAFFIC_SOURCE_KEY, TRAFFIC_CATEGORY_KEY, TRAFFIC_TITLE_KEY, TRAFFIC_TAG_KEY, SEARCH_ENGINE_URLS, } from "./constants.js";
|
|
13
13
|
import { HttpClient } from "./infrastructure/http/HttpClient.js";
|
|
14
|
-
import {
|
|
14
|
+
import { ConversionService } from "./infrastructure/conversions/conversionService.js";
|
|
15
15
|
const saveSentEvent = (eventName, params) => {
|
|
16
16
|
const timestamp = Date.now();
|
|
17
17
|
const SENT_EVENT_KEY = `${SENT_EVENT_ID_KEY}_${eventName}`;
|
|
@@ -33,41 +33,77 @@ const shouldEventBeSent = (eventName, params) => {
|
|
|
33
33
|
}
|
|
34
34
|
let eventArgsMatch = false;
|
|
35
35
|
if (eventName === "connect_wallet") {
|
|
36
|
-
eventArgsMatch =
|
|
37
|
-
parsedEvent["
|
|
36
|
+
eventArgsMatch =
|
|
37
|
+
parsedEvent["tracking_id"] === params.tracking_id &&
|
|
38
|
+
parsedEvent["address"] === params.address;
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
|
-
eventArgsMatch =
|
|
41
|
-
parsedEvent["
|
|
42
|
-
|
|
41
|
+
eventArgsMatch =
|
|
42
|
+
parsedEvent["tracking_id"] === params.tracking_id &&
|
|
43
|
+
parsedEvent["project_id"] === params.project_id &&
|
|
44
|
+
parsedEvent["referrer_id"] === params.referrer_id &&
|
|
45
|
+
parsedEvent["source"] === params.source &&
|
|
46
|
+
parsedEvent["category"] === params.category &&
|
|
47
|
+
parsedEvent["title"] === params.title &&
|
|
48
|
+
parsedEvent["tag"] === params.tag;
|
|
43
49
|
}
|
|
44
50
|
return !eventArgsMatch;
|
|
45
51
|
};
|
|
46
52
|
const generateRandomId = () => nanoid();
|
|
53
|
+
const isBrowserUndefined = typeof window === "undefined" || typeof document === "undefined";
|
|
47
54
|
const saveSessionId = () => {
|
|
48
|
-
if (
|
|
55
|
+
if (isBrowserUndefined) {
|
|
49
56
|
return;
|
|
57
|
+
}
|
|
50
58
|
localStorage.setItem(SESSION_ID_KEY, generateRandomId());
|
|
51
59
|
};
|
|
52
60
|
const saveTrackingId = () => {
|
|
53
|
-
|
|
54
|
-
if (typeof window === "undefined" || typeof document === "undefined")
|
|
55
|
-
return;
|
|
56
|
-
const queryParams = new URLSearchParams(window.location.search);
|
|
57
|
-
if (!queryParams.has("p") ||
|
|
58
|
-
!queryParams.has("origin") ||
|
|
59
|
-
!queryParams.has("r"))
|
|
60
|
-
return;
|
|
61
|
-
const isFuulOrigin = queryParams.get("origin") === "fuul";
|
|
62
|
-
if (!isFuulOrigin)
|
|
61
|
+
if (isBrowserUndefined) {
|
|
63
62
|
return;
|
|
63
|
+
}
|
|
64
64
|
if (!getTrackingId()) {
|
|
65
65
|
localStorage.setItem(TRACKING_ID_KEY, generateRandomId());
|
|
66
66
|
}
|
|
67
|
-
localStorage.setItem(REFERRER_ID_KEY, (_a = queryParams.get("r")) !== null && _a !== void 0 ? _a : "");
|
|
68
67
|
};
|
|
69
|
-
const
|
|
70
|
-
|
|
68
|
+
const saveUrlParams = () => {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
if (isBrowserUndefined) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
74
|
+
saveTrafficSource(queryParams);
|
|
75
|
+
localStorage.setItem(TRAFFIC_CATEGORY_KEY, (_a = queryParams.get("category")) !== null && _a !== void 0 ? _a : "");
|
|
76
|
+
localStorage.setItem(TRAFFIC_TITLE_KEY, (_b = queryParams.get("title")) !== null && _b !== void 0 ? _b : "");
|
|
77
|
+
localStorage.setItem(TRAFFIC_TAG_KEY, (_c = queryParams.get("tag")) !== null && _c !== void 0 ? _c : "");
|
|
78
|
+
};
|
|
79
|
+
const saveTrafficSource = (queryParams) => {
|
|
80
|
+
const trafficSourceParam = queryParams.get("source");
|
|
81
|
+
const referrerParam = queryParams.get("r");
|
|
82
|
+
// if is an affiliate link
|
|
83
|
+
if (referrerParam) {
|
|
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);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// if traffic source is not defined
|
|
96
|
+
const originURL = document.referrer;
|
|
97
|
+
localStorage.setItem(TRAFFIC_CATEGORY_KEY, originURL);
|
|
98
|
+
localStorage.setItem(TRAFFIC_TITLE_KEY, originURL);
|
|
99
|
+
// if traffic source is a search engine
|
|
100
|
+
if (SEARCH_ENGINE_URLS.includes(originURL)) {
|
|
101
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, "organic");
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// if traffic source is direct
|
|
105
|
+
localStorage.setItem(TRAFFIC_SOURCE_KEY, "direct");
|
|
106
|
+
}
|
|
71
107
|
};
|
|
72
108
|
export class Fuul {
|
|
73
109
|
constructor(apiKey, settings = {}) {
|
|
@@ -77,11 +113,12 @@ export class Fuul {
|
|
|
77
113
|
this.checkApiKey();
|
|
78
114
|
saveSessionId();
|
|
79
115
|
saveTrackingId();
|
|
116
|
+
saveUrlParams();
|
|
80
117
|
this.httpClient = new HttpClient(Object.assign({ baseURL: this.BASE_API_URL, timeout: 10000, apiKey: this.apiKey }, (this.settings.defaultQueryParams &&
|
|
81
118
|
typeof this.settings.defaultQueryParams !== "string" && {
|
|
82
119
|
queryParams: this.settings.defaultQueryParams,
|
|
83
120
|
})));
|
|
84
|
-
this.
|
|
121
|
+
this.conversionService = new ConversionService(this.httpClient);
|
|
85
122
|
this.init();
|
|
86
123
|
}
|
|
87
124
|
init() {
|
|
@@ -100,6 +137,8 @@ export class Fuul {
|
|
|
100
137
|
/**
|
|
101
138
|
* @param {EventType} name Event name.
|
|
102
139
|
* @param {EventArgsType} args Event additional arguments.
|
|
140
|
+
* @param {String} signature Event signature.
|
|
141
|
+
* @param {String} signature_message Event signature message.
|
|
103
142
|
* ```js
|
|
104
143
|
* import { Fuul } from 'fuul-sdk'
|
|
105
144
|
*
|
|
@@ -113,7 +152,7 @@ export class Fuul {
|
|
|
113
152
|
* })
|
|
114
153
|
* ```
|
|
115
154
|
*/
|
|
116
|
-
sendEvent(name, args) {
|
|
155
|
+
sendEvent(name, args, signature, signature_message) {
|
|
117
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
157
|
const session_id = getSessionId();
|
|
119
158
|
const tracking_id = getTrackingId();
|
|
@@ -129,19 +168,36 @@ export class Fuul {
|
|
|
129
168
|
reqBody = {
|
|
130
169
|
name,
|
|
131
170
|
session_id,
|
|
132
|
-
event_args: Object.assign(Object.assign({}, args), { tracking_id })
|
|
171
|
+
event_args: Object.assign(Object.assign({}, args), { tracking_id }),
|
|
133
172
|
};
|
|
134
173
|
}
|
|
135
174
|
else {
|
|
175
|
+
const source = getTrafficSource();
|
|
176
|
+
const category = getTrafficCategory();
|
|
177
|
+
const title = getTrafficTitle();
|
|
178
|
+
const tag = getTrafficTag();
|
|
136
179
|
if (!referrer_id)
|
|
137
180
|
return;
|
|
138
|
-
params = Object.assign(Object.assign({}, params), {
|
|
181
|
+
params = Object.assign(Object.assign({}, params), { project_id: args === null || args === void 0 ? void 0 : args.project_id, referrer_id,
|
|
182
|
+
source,
|
|
183
|
+
category,
|
|
184
|
+
title,
|
|
185
|
+
tag });
|
|
139
186
|
reqBody = {
|
|
140
187
|
name,
|
|
141
188
|
session_id,
|
|
142
|
-
event_args: Object.assign(Object.assign({}, args), { referrer: referrer_id, tracking_id
|
|
189
|
+
event_args: Object.assign(Object.assign({}, args), { referrer: referrer_id, tracking_id,
|
|
190
|
+
source,
|
|
191
|
+
category,
|
|
192
|
+
title,
|
|
193
|
+
tag }),
|
|
143
194
|
};
|
|
144
195
|
}
|
|
196
|
+
reqBody = Object.assign(Object.assign(Object.assign({}, reqBody), (signature && {
|
|
197
|
+
signature,
|
|
198
|
+
})), (signature_message && {
|
|
199
|
+
signature_message,
|
|
200
|
+
}));
|
|
145
201
|
if (!shouldEventBeSent(name, params)) {
|
|
146
202
|
return;
|
|
147
203
|
}
|
|
@@ -159,19 +215,9 @@ export class Fuul {
|
|
|
159
215
|
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
160
216
|
}
|
|
161
217
|
}
|
|
162
|
-
|
|
163
|
-
* Generates a tracking link for a referrer
|
|
164
|
-
* @param {string} address referrer address
|
|
165
|
-
* @param {string} pid project id you want to refer the user
|
|
166
|
-
* @param {string} baseUrl base url of your app
|
|
167
|
-
* @returns {string} tracking link
|
|
168
|
-
*/
|
|
169
|
-
generateTrackingLink({ address, pid, baseUrl, }) {
|
|
170
|
-
return `${baseUrl !== null && baseUrl !== void 0 ? baseUrl : window.location.href}?${buildTrackingLinkQueryParams(address, pid)}`;
|
|
171
|
-
}
|
|
172
|
-
getAllCampaigns() {
|
|
218
|
+
getAllConversions() {
|
|
173
219
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
return this.
|
|
220
|
+
return this.conversionService.getAll();
|
|
175
221
|
});
|
|
176
222
|
}
|
|
177
223
|
}
|
package/lib/esm/infrastructure/{campaigns/campaignsService.js → conversions/conversionService.js}
RENAMED
|
@@ -7,13 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
export class
|
|
10
|
+
export class ConversionService {
|
|
11
11
|
constructor(httpClient) {
|
|
12
12
|
this.httpClient = httpClient;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
getAll() {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const { data } = yield this.httpClient.get("
|
|
16
|
+
const { data } = yield this.httpClient.get("conversions");
|
|
17
17
|
return data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -2,6 +2,11 @@ export declare const SESSION_ID_KEY = "fuul.session_id";
|
|
|
2
2
|
export declare const TRACKING_ID_KEY = "fuul.tracking_id";
|
|
3
3
|
export declare const PROJECT_ID_KEY = "fuul.project_id";
|
|
4
4
|
export declare const REFERRER_ID_KEY = "fuul.referrer_id";
|
|
5
|
+
export declare const TRAFFIC_SOURCE_KEY = "fuul.traffic_source";
|
|
6
|
+
export declare const TRAFFIC_CATEGORY_KEY = "fuul.traffic_category";
|
|
7
|
+
export declare const TRAFFIC_TITLE_KEY = "fuul.traffic_title";
|
|
8
|
+
export declare const TRAFFIC_TAG_KEY = "fuul.traffic_tag";
|
|
5
9
|
export declare const SENT_EVENT_ID_KEY = "fuul.sent";
|
|
6
10
|
export declare const SENT_EVENT_VALIDITY_PERIOD_MS = 60000;
|
|
11
|
+
export declare const SEARCH_ENGINE_URLS: string[];
|
|
7
12
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,6BAA6B,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAChD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AACtD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,6BAA6B,QAAQ,CAAC;AAEnD,eAAO,MAAM,kBAAkB,UAA0C,CAAC"}
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { EventArgsType, EventType, FuulSettings
|
|
2
|
-
import {
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings } from "./types/types.js";
|
|
2
|
+
import { ConversionDTO } from "./infrastructure/conversions/dtos.js";
|
|
3
3
|
export declare class Fuul {
|
|
4
4
|
private readonly apiKey;
|
|
5
5
|
private readonly BASE_API_URL;
|
|
6
6
|
private readonly httpClient;
|
|
7
7
|
private readonly settings;
|
|
8
|
-
private
|
|
8
|
+
private conversionService;
|
|
9
9
|
constructor(apiKey: string, settings?: FuulSettings);
|
|
10
10
|
init(): Promise<void>;
|
|
11
11
|
checkApiKey(): void;
|
|
12
12
|
/**
|
|
13
13
|
* @param {EventType} name Event name.
|
|
14
14
|
* @param {EventArgsType} args Event additional arguments.
|
|
15
|
+
* @param {String} signature Event signature.
|
|
16
|
+
* @param {String} signature_message Event signature message.
|
|
15
17
|
* ```js
|
|
16
18
|
* import { Fuul } from 'fuul-sdk'
|
|
17
19
|
*
|
|
@@ -25,17 +27,9 @@ export declare class Fuul {
|
|
|
25
27
|
* })
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
|
-
sendEvent(name: EventType, args?: EventArgsType): Promise<any>;
|
|
30
|
+
sendEvent(name: EventType, args?: EventArgsType, signature?: string, signature_message?: string): Promise<any>;
|
|
29
31
|
verifyConnection(): void;
|
|
30
|
-
|
|
31
|
-
* Generates a tracking link for a referrer
|
|
32
|
-
* @param {string} address referrer address
|
|
33
|
-
* @param {string} pid project id you want to refer the user
|
|
34
|
-
* @param {string} baseUrl base url of your app
|
|
35
|
-
* @returns {string} tracking link
|
|
36
|
-
*/
|
|
37
|
-
generateTrackingLink({ address, pid, baseUrl, }: IGenerateTrackingLink): string;
|
|
38
|
-
getAllCampaigns(): Promise<CampaignDTO[]>;
|
|
32
|
+
getAllConversions(): Promise<ConversionDTO[]>;
|
|
39
33
|
}
|
|
40
34
|
declare const _default: {
|
|
41
35
|
Fuul: typeof Fuul;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EAEb,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AA2HrE,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;IAmFf,gBAAgB,IAAI,IAAI;IAMlB,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGpD;;;;AAOD,wBAEE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpClient } from "../http/HttpClient.js";
|
|
2
|
+
import { ConversionDTO } from "./dtos.js";
|
|
3
|
+
export declare class ConversionService {
|
|
4
|
+
private httpClient;
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
getAll(): Promise<ConversionDTO[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=conversionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversionService.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/conversions/conversionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAI5B,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAKzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Project {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
thumbnail_url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ConversionDTO {
|
|
7
|
+
id: string;
|
|
8
|
+
payment_currency: string;
|
|
9
|
+
conversion_window: number;
|
|
10
|
+
payment_type: string;
|
|
11
|
+
payment_argument: string;
|
|
12
|
+
referrer_amount: number;
|
|
13
|
+
referral_amount: number;
|
|
14
|
+
attribution_type: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -0,0 +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,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -12,12 +12,11 @@ export type EventType = "connect_wallet" | "pageview";
|
|
|
12
12
|
export interface SentEventParams {
|
|
13
13
|
tracking_id: string;
|
|
14
14
|
project_id?: string;
|
|
15
|
-
referrer_id?: string;
|
|
16
|
-
address?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
baseUrl?: string;
|
|
15
|
+
referrer_id?: string | null;
|
|
16
|
+
address?: string | null;
|
|
17
|
+
source?: string | null;
|
|
18
|
+
category?: string | null;
|
|
19
|
+
title?: string | null;
|
|
20
|
+
tag?: string | null;
|
|
22
21
|
}
|
|
23
22
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.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,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.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"}
|
|
@@ -2,4 +2,8 @@ export declare const getSessionId: () => string | null;
|
|
|
2
2
|
export declare const getTrackingId: () => string | null;
|
|
3
3
|
export declare const getProjectId: () => string | null;
|
|
4
4
|
export declare const getReferrerId: () => string | null;
|
|
5
|
+
export declare const getTrafficSource: () => string | null;
|
|
6
|
+
export declare const getTrafficCategory: () => string | null;
|
|
7
|
+
export declare const getTrafficTitle: () => string | null;
|
|
8
|
+
export declare const getTrafficTag: () => string | null;
|
|
5
9
|
//# sourceMappingURL=localStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../../../src/utils/localStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../../../src/utils/localStorage.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,YAAY,qBAA6C,CAAC;AACvE,eAAO,MAAM,aAAa,qBAA8C,CAAC;AACzE,eAAO,MAAM,YAAY,qBAA6C,CAAC;AACvE,eAAO,MAAM,aAAa,qBAA8C,CAAC;AACzE,eAAO,MAAM,gBAAgB,qBAAiD,CAAC;AAC/E,eAAO,MAAM,kBAAkB,qBACa,CAAC;AAC7C,eAAO,MAAM,eAAe,qBAAgD,CAAC;AAC7E,eAAO,MAAM,aAAa,qBAA8C,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { PROJECT_ID_KEY, REFERRER_ID_KEY, SESSION_ID_KEY, TRACKING_ID_KEY, } from "../constants.js";
|
|
1
|
+
import { PROJECT_ID_KEY, REFERRER_ID_KEY, SESSION_ID_KEY, TRACKING_ID_KEY, TRAFFIC_CATEGORY_KEY, TRAFFIC_SOURCE_KEY, TRAFFIC_TAG_KEY, TRAFFIC_TITLE_KEY, } from "../constants.js";
|
|
2
2
|
export const getSessionId = () => localStorage.getItem(SESSION_ID_KEY);
|
|
3
3
|
export const getTrackingId = () => localStorage.getItem(TRACKING_ID_KEY);
|
|
4
4
|
export const getProjectId = () => localStorage.getItem(PROJECT_ID_KEY);
|
|
5
5
|
export const getReferrerId = () => localStorage.getItem(REFERRER_ID_KEY);
|
|
6
|
+
export const getTrafficSource = () => localStorage.getItem(TRAFFIC_SOURCE_KEY);
|
|
7
|
+
export const getTrafficCategory = () => localStorage.getItem(TRAFFIC_CATEGORY_KEY);
|
|
8
|
+
export const getTrafficTitle = () => localStorage.getItem(TRAFFIC_TITLE_KEY);
|
|
9
|
+
export const getTrafficTag = () => localStorage.getItem(TRAFFIC_TAG_KEY);
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "../http/HttpClient.js";
|
|
2
|
-
import { CampaignDTO } from "./dtos.js";
|
|
3
|
-
export declare class CampaignsService {
|
|
4
|
-
private httpClient;
|
|
5
|
-
constructor(httpClient: HttpClient);
|
|
6
|
-
getAllCampaignsByProjectId(): Promise<CampaignDTO[]>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=campaignsService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"campaignsService.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/campaigns/campaignsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAI5B,0BAA0B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAK3D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface Project {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
thumbnail_url: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ConversionDTO {
|
|
7
|
-
id: string;
|
|
8
|
-
payment_type: string;
|
|
9
|
-
referrer_amount: number;
|
|
10
|
-
referral_amount: number;
|
|
11
|
-
payment_currency: string;
|
|
12
|
-
triggers?: TriggerDTO[];
|
|
13
|
-
}
|
|
14
|
-
export interface TriggerDTO {
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
contracts?: ContractDTO[];
|
|
18
|
-
}
|
|
19
|
-
export interface ContractDTO {
|
|
20
|
-
address: string;
|
|
21
|
-
network: string;
|
|
22
|
-
}
|
|
23
|
-
export interface CampaignDTO {
|
|
24
|
-
conversions?: ConversionDTO[];
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
project: Project;
|
|
28
|
-
referrer_excerpt?: string;
|
|
29
|
-
url: string;
|
|
30
|
-
user_excerpt?: string;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/campaigns/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,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "../http/HttpClient.js";
|
|
2
|
-
import { CampaignDTO } from "./dtos.js";
|
|
3
|
-
export declare class CampaignsService {
|
|
4
|
-
private httpClient;
|
|
5
|
-
constructor(httpClient: HttpClient);
|
|
6
|
-
getAllCampaignsByProjectId(): Promise<CampaignDTO[]>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=campaignsService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"campaignsService.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/campaigns/campaignsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAI5B,0BAA0B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAK3D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface Project {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
thumbnail_url: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ConversionDTO {
|
|
7
|
-
id: string;
|
|
8
|
-
payment_type: string;
|
|
9
|
-
referrer_amount: number;
|
|
10
|
-
referral_amount: number;
|
|
11
|
-
payment_currency: string;
|
|
12
|
-
triggers?: TriggerDTO[];
|
|
13
|
-
}
|
|
14
|
-
export interface TriggerDTO {
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
contracts?: ContractDTO[];
|
|
18
|
-
}
|
|
19
|
-
export interface ContractDTO {
|
|
20
|
-
address: string;
|
|
21
|
-
network: string;
|
|
22
|
-
}
|
|
23
|
-
export interface CampaignDTO {
|
|
24
|
-
conversions?: ConversionDTO[];
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
project: Project;
|
|
28
|
-
referrer_excerpt?: string;
|
|
29
|
-
url: string;
|
|
30
|
-
user_excerpt?: string;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/campaigns/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,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
File without changes
|
|
File without changes
|