@fuul/sdk 0.18.0 → 1.0.1

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.
Files changed (65) hide show
  1. package/README.md +21 -26
  2. package/dist/constants.d.ts.map +1 -0
  3. package/dist/fuul-sdk.mjs +1569 -0
  4. package/dist/fuul-sdk.umd.js +3 -0
  5. package/dist/index.d.ts +36 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/{lib/cjs/types → dist}/infrastructure/conversions/conversionService.d.ts +2 -2
  8. package/dist/infrastructure/conversions/conversionService.d.ts.map +1 -0
  9. package/dist/infrastructure/conversions/dtos.d.ts +77 -0
  10. package/dist/infrastructure/conversions/dtos.d.ts.map +1 -0
  11. package/{lib/cjs/types → dist}/infrastructure/http/HttpClient.d.ts +1 -1
  12. package/dist/infrastructure/http/HttpClient.d.ts.map +1 -0
  13. package/dist/types/index.d.ts +37 -0
  14. package/dist/types/index.d.ts.map +1 -0
  15. package/dist/utils/events.d.ts +4 -0
  16. package/dist/utils/events.d.ts.map +1 -0
  17. package/{lib/cjs/types → dist}/utils/localStorage.d.ts +5 -0
  18. package/dist/utils/localStorage.d.ts.map +1 -0
  19. package/dist/utils/queryParams.d.ts.map +1 -0
  20. package/package.json +55 -17
  21. package/lib/cjs/constants.js +0 -15
  22. package/lib/cjs/index.js +0 -247
  23. package/lib/cjs/infrastructure/conversions/conversionService.js +0 -24
  24. package/lib/cjs/infrastructure/conversions/dtos.js +0 -2
  25. package/lib/cjs/infrastructure/http/HttpClient.js +0 -51
  26. package/lib/cjs/types/constants.d.ts.map +0 -1
  27. package/lib/cjs/types/index.d.ts +0 -46
  28. package/lib/cjs/types/index.d.ts.map +0 -1
  29. package/lib/cjs/types/index.js +0 -2
  30. package/lib/cjs/types/infrastructure/conversions/conversionService.d.ts.map +0 -1
  31. package/lib/cjs/types/infrastructure/conversions/dtos.d.ts +0 -37
  32. package/lib/cjs/types/infrastructure/conversions/dtos.d.ts.map +0 -1
  33. package/lib/cjs/types/infrastructure/http/HttpClient.d.ts.map +0 -1
  34. package/lib/cjs/types/types/index.d.ts +0 -27
  35. package/lib/cjs/types/types/index.d.ts.map +0 -1
  36. package/lib/cjs/types/utils/localStorage.d.ts.map +0 -1
  37. package/lib/cjs/types/utils/queryParams.d.ts.map +0 -1
  38. package/lib/cjs/utils/localStorage.js +0 -20
  39. package/lib/cjs/utils/queryParams.js +0 -14
  40. package/lib/esm/constants.js +0 -12
  41. package/lib/esm/index.mjs +0 -243
  42. package/lib/esm/infrastructure/conversions/conversionService.js +0 -20
  43. package/lib/esm/infrastructure/conversions/dtos.js +0 -1
  44. package/lib/esm/infrastructure/http/HttpClient.js +0 -44
  45. package/lib/esm/types/constants.d.ts +0 -13
  46. package/lib/esm/types/constants.d.ts.map +0 -1
  47. package/lib/esm/types/index.d.ts +0 -46
  48. package/lib/esm/types/index.d.ts.map +0 -1
  49. package/lib/esm/types/index.js +0 -1
  50. package/lib/esm/types/infrastructure/conversions/conversionService.d.ts +0 -8
  51. package/lib/esm/types/infrastructure/conversions/conversionService.d.ts.map +0 -1
  52. package/lib/esm/types/infrastructure/conversions/dtos.d.ts +0 -37
  53. package/lib/esm/types/infrastructure/conversions/dtos.d.ts.map +0 -1
  54. package/lib/esm/types/infrastructure/http/HttpClient.d.ts +0 -27
  55. package/lib/esm/types/infrastructure/http/HttpClient.d.ts.map +0 -1
  56. package/lib/esm/types/types/index.d.ts +0 -27
  57. package/lib/esm/types/types/index.d.ts.map +0 -1
  58. package/lib/esm/types/utils/localStorage.d.ts +0 -9
  59. package/lib/esm/types/utils/localStorage.d.ts.map +0 -1
  60. package/lib/esm/types/utils/queryParams.d.ts +0 -2
  61. package/lib/esm/types/utils/queryParams.d.ts.map +0 -1
  62. package/lib/esm/utils/localStorage.js +0 -9
  63. package/lib/esm/utils/queryParams.js +0 -10
  64. /package/{lib/cjs/types → dist}/constants.d.ts +0 -0
  65. /package/{lib/cjs/types → dist}/utils/queryParams.d.ts +0 -0
package/lib/cjs/index.js DELETED
@@ -1,247 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Fuul = void 0;
13
- const nanoid_1 = require("nanoid");
14
- const localStorage_js_1 = require("./utils/localStorage.js");
15
- const constants_js_1 = require("./constants.js");
16
- const HttpClient_js_1 = require("./infrastructure/http/HttpClient.js");
17
- const conversionService_js_1 = require("./infrastructure/conversions/conversionService.js");
18
- const saveSentEvent = (eventName, params) => {
19
- const timestamp = Date.now();
20
- const SENT_EVENT_KEY = `${constants_js_1.SENT_EVENT_ID_KEY}_${eventName}`;
21
- const eventParams = Object.assign(Object.assign({}, params), { timestamp });
22
- localStorage.setItem(SENT_EVENT_KEY, JSON.stringify(eventParams));
23
- };
24
- const shouldEventBeSent = (eventName, params) => {
25
- const SENT_EVENT_KEY = `${constants_js_1.SENT_EVENT_ID_KEY}_${eventName}`;
26
- const sentEvent = localStorage.getItem(SENT_EVENT_KEY);
27
- if (!sentEvent) {
28
- return true;
29
- }
30
- const parsedEvent = JSON.parse(sentEvent);
31
- const nowTimestamp = Date.now();
32
- const timespanMillis = nowTimestamp - parsedEvent.timestamp;
33
- const sentEventExpired = timespanMillis > constants_js_1.SENT_EVENT_VALIDITY_PERIOD_MS;
34
- if (sentEventExpired) {
35
- return true;
36
- }
37
- let eventArgsMatch = false;
38
- if (eventName === "connect_wallet") {
39
- eventArgsMatch =
40
- parsedEvent["tracking_id"] === params.tracking_id &&
41
- parsedEvent["address"] === params.address;
42
- }
43
- else {
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;
52
- }
53
- return !eventArgsMatch;
54
- };
55
- const generateRandomId = () => (0, nanoid_1.nanoid)();
56
- const isBrowserUndefined = typeof window === "undefined" || typeof document === "undefined";
57
- const saveSessionId = () => {
58
- if (isBrowserUndefined) {
59
- return;
60
- }
61
- localStorage.setItem(constants_js_1.SESSION_ID_KEY, generateRandomId());
62
- };
63
- const saveTrackingId = () => {
64
- if (isBrowserUndefined) {
65
- return;
66
- }
67
- if (!(0, localStorage_js_1.getTrackingId)()) {
68
- localStorage.setItem(constants_js_1.TRACKING_ID_KEY, generateRandomId());
69
- }
70
- };
71
- const saveUrlParams = () => {
72
- var _a, _b, _c, _d, _e, _f;
73
- if (isBrowserUndefined) {
74
- return;
75
- }
76
- const queryParams = new URLSearchParams(window.location.search);
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
- localStorage.setItem(constants_js_1.TRAFFIC_ORIGIN_URL, (_f = document.referrer) !== null && _f !== void 0 ? _f : "");
83
- saveTrafficSource();
84
- };
85
- const saveTrafficSource = () => {
86
- const queryParams = new URLSearchParams(window.location.search);
87
- const source = queryParams.get("source");
88
- const referrer = queryParams.get("referrer");
89
- if (source) {
90
- return;
91
- }
92
- if (referrer) {
93
- localStorage.setItem(constants_js_1.TRAFFIC_SOURCE_KEY, "affiliate");
94
- localStorage.setItem(constants_js_1.TRAFFIC_CATEGORY_KEY, "affiliate");
95
- localStorage.setItem(constants_js_1.TRAFFIC_TITLE_KEY, referrer);
96
- }
97
- else {
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
- }
110
- }
111
- };
112
- const buildTrackingLinkQueryParams = (referrer, projectId) => {
113
- return `p=${projectId}&source=fuul&referrer=${referrer}`;
114
- };
115
- class Fuul {
116
- constructor(apiKey, settings = {}) {
117
- this.BASE_API_URL = "https://api.fuul.xyz/api/v1/";
118
- this.apiKey = apiKey;
119
- this.settings = settings;
120
- this.checkApiKey();
121
- saveSessionId();
122
- saveTrackingId();
123
- saveUrlParams();
124
- this.httpClient = new HttpClient_js_1.HttpClient(Object.assign({ baseURL: this.BASE_API_URL, timeout: 10000, apiKey: this.apiKey }, (this.settings.defaultQueryParams &&
125
- typeof this.settings.defaultQueryParams !== "string" && {
126
- queryParams: this.settings.defaultQueryParams,
127
- })));
128
- this.conversionService = new conversionService_js_1.ConversionService(this.httpClient);
129
- this.init();
130
- }
131
- init() {
132
- return __awaiter(this, void 0, void 0, function* () {
133
- if (isBrowserUndefined) {
134
- return;
135
- }
136
- yield this.sendEvent("pageview");
137
- });
138
- }
139
- checkApiKey() {
140
- if (!this.apiKey) {
141
- throw new Error("Fuul API key is required");
142
- }
143
- }
144
- /**
145
- * @param {EventType} name Event name.
146
- * @param {EventArgsType} args Event additional arguments.
147
- * @param {String} signature Event signature.
148
- * @param {String} signature_message Event signature message.
149
- * ```js
150
- * import { Fuul } from 'fuul-sdk'
151
- *
152
- * // Initialize Fuul in your app root file
153
- * new Fuul('your-api-key')
154
- *
155
- * // Then you can send an event as follows:
156
- * fuul.sendEvent('connect_wallet', {
157
- * address,
158
- * })
159
- * ```
160
- */
161
- sendEvent(name, args, signature, signature_message) {
162
- return __awaiter(this, void 0, void 0, function* () {
163
- const session_id = (0, localStorage_js_1.getSessionId)();
164
- const tracking_id = (0, localStorage_js_1.getTrackingId)();
165
- const referrer_id = (0, localStorage_js_1.getReferrerId)();
166
- const source = (0, localStorage_js_1.getTrafficSource)();
167
- const category = (0, localStorage_js_1.getTrafficCategory)();
168
- const title = (0, localStorage_js_1.getTrafficTitle)();
169
- const tag = (0, localStorage_js_1.getTrafficTag)();
170
- if (!tracking_id)
171
- return;
172
- let params = {
173
- tracking_id,
174
- source,
175
- category,
176
- title,
177
- tag,
178
- };
179
- let reqBody = {};
180
- if (name === "connect_wallet") {
181
- params = Object.assign(Object.assign({}, params), { address: args === null || args === void 0 ? void 0 : args.address });
182
- reqBody = {
183
- name,
184
- session_id,
185
- event_args: Object.assign(Object.assign({}, args), { tracking_id,
186
- source,
187
- category,
188
- title,
189
- tag }),
190
- };
191
- }
192
- else {
193
- params = Object.assign(Object.assign({}, params), { project_id: args === null || args === void 0 ? void 0 : args.project_id, referrer_id });
194
- reqBody = {
195
- name,
196
- session_id,
197
- event_args: Object.assign(Object.assign({}, args), { referrer: referrer_id, tracking_id,
198
- source,
199
- category,
200
- title,
201
- tag }),
202
- };
203
- }
204
- reqBody = Object.assign(Object.assign(Object.assign({}, reqBody), (signature && {
205
- signature,
206
- })), (signature_message && {
207
- signature_message,
208
- }));
209
- if (!shouldEventBeSent(name, params)) {
210
- return;
211
- }
212
- try {
213
- yield this.httpClient.post("events", reqBody);
214
- saveSentEvent(name, params);
215
- }
216
- catch (error) {
217
- return error;
218
- }
219
- });
220
- }
221
- verifyConnection() {
222
- if (isBrowserUndefined) {
223
- 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.');
224
- }
225
- window.alert("You are successfully connected to Fuul SDK! ✅");
226
- }
227
- /**
228
- * Generates a tracking link for a referrer
229
- * @param {Object} trackingLinkParams - Tracking link parameters
230
- * @param {string} trackingLinkParams.address - Referrer wallet address.
231
- * @param {string} trackingLinkParams.projectId - Project ID.
232
- * @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
233
- * @returns {string} tracking link
234
- **/
235
- generateTrackingLink({ address, projectId, baseUrl, }) {
236
- return `${baseUrl !== null && baseUrl !== void 0 ? baseUrl : window.location.href}?${buildTrackingLinkQueryParams(address, projectId)}`;
237
- }
238
- getAllConversions() {
239
- return __awaiter(this, void 0, void 0, function* () {
240
- return this.conversionService.getAll();
241
- });
242
- }
243
- }
244
- exports.Fuul = Fuul;
245
- exports.default = {
246
- Fuul,
247
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ConversionService = void 0;
13
- class ConversionService {
14
- constructor(httpClient) {
15
- this.httpClient = httpClient;
16
- }
17
- getAll() {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const { data } = yield this.httpClient.get("conversions");
20
- return data;
21
- });
22
- }
23
- }
24
- exports.ConversionService = ConversionService;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.HttpClient = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- const queryParams_js_1 = require("../../utils/queryParams.js");
18
- class HttpClient {
19
- constructor(options) {
20
- this.client = axios_1.default.create(Object.assign(Object.assign({}, options), { headers: options.apiKey ? this._getHeaders(options.apiKey) : {} }));
21
- this.queryParams = options.queryParams
22
- ? (0, queryParams_js_1.buildQueryParams)(options.queryParams)
23
- : "";
24
- }
25
- get(path, params) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return this.client.get(path + this.queryParams, { params });
28
- });
29
- }
30
- post(path, data) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- return this.client.post(path + this.queryParams, data);
33
- });
34
- }
35
- put(path, data) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- return this.client.put(path + this.queryParams, data);
38
- });
39
- }
40
- delete(path) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- return this.client.delete(path + this.queryParams);
43
- });
44
- }
45
- _getHeaders(apiKey) {
46
- const headers = {};
47
- headers.Authorization = `Bearer ${apiKey}`;
48
- return headers;
49
- }
50
- }
51
- exports.HttpClient = HttpClient;
@@ -1 +0,0 @@
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,kBAAkB,4BAA4B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,6BAA6B,QAAQ,CAAC;AAEnD,eAAO,MAAM,kBAAkB,UAA0C,CAAC"}
@@ -1,46 +0,0 @@
1
- import { EventArgsType, EventType, FuulSettings, IGenerateTrackingLink } from "./types/index.js";
2
- import { ConversionDTO } from "./infrastructure/conversions/dtos.js";
3
- export declare class Fuul {
4
- private readonly apiKey;
5
- private readonly BASE_API_URL;
6
- private readonly httpClient;
7
- private readonly settings;
8
- private conversionService;
9
- constructor(apiKey: string, settings?: FuulSettings);
10
- init(): Promise<void>;
11
- checkApiKey(): void;
12
- /**
13
- * @param {EventType} name Event name.
14
- * @param {EventArgsType} args Event additional arguments.
15
- * @param {String} signature Event signature.
16
- * @param {String} signature_message Event signature message.
17
- * ```js
18
- * import { Fuul } from 'fuul-sdk'
19
- *
20
- * // Initialize Fuul in your app root file
21
- * new Fuul('your-api-key')
22
- *
23
- * // Then you can send an event as follows:
24
- * fuul.sendEvent('connect_wallet', {
25
- * address,
26
- * })
27
- * ```
28
- */
29
- sendEvent(name: EventType, args?: EventArgsType, signature?: string, signature_message?: string): Promise<any>;
30
- verifyConnection(): void;
31
- /**
32
- * Generates a tracking link for a referrer
33
- * @param {Object} trackingLinkParams - Tracking link parameters
34
- * @param {string} trackingLinkParams.address - Referrer wallet address.
35
- * @param {string} trackingLinkParams.projectId - Project ID.
36
- * @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
37
- * @returns {string} tracking link
38
- **/
39
- generateTrackingLink({ address, projectId, baseUrl, }: IGenerateTrackingLink): string;
40
- getAllConversions(): Promise<ConversionDTO[]>;
41
- }
42
- declare const _default: {
43
- Fuul: typeof Fuul;
44
- };
45
- export default _default;
46
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AA0BA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AA8HrE,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;;;;;;;;;;;;;;;;OAgBG;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;IAoFf,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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
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"}
@@ -1,37 +0,0 @@
1
- export interface Project {
2
- id: string;
3
- name: string;
4
- thumbnail_url: string;
5
- integration_type: string;
6
- user_landing_page_url?: string;
7
- partner_landing_page_url?: string;
8
- user_onboarding_page_url?: string;
9
- }
10
- interface ConversionPaymentActionArgs {
11
- payment_type: string;
12
- payment_currency: string;
13
- referral_amount: number;
14
- referrer_amount: number;
15
- }
16
- interface ContractDTO {
17
- address: string;
18
- network: string;
19
- }
20
- interface TriggerDTO {
21
- name: string;
22
- description: string;
23
- contracts: ContractDTO[];
24
- }
25
- export interface ConversionDTO {
26
- action_args?: ConversionPaymentActionArgs;
27
- action_type?: string;
28
- attribution_type: string;
29
- conversion_window: number;
30
- created_at: string;
31
- id: string;
32
- name: string;
33
- project: Project;
34
- triggers: TriggerDTO[];
35
- }
36
- export {};
37
- //# sourceMappingURL=dtos.d.ts.map
@@ -1 +0,0 @@
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;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;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,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;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;IACjB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/http/HttpClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,aAAa,EACb,sBAAsB,EACvB,MAAM,OAAO,CAAC;AAGf,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,OAAO,EAAE,iBAAiB;IAUhC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAI7D,IAAI,CAAC,CAAC,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GACA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAItB,GAAG,CAAC,CAAC,EACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GACA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAItB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAIxD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB;CAOpD"}
@@ -1,27 +0,0 @@
1
- export interface SendEventParams {
2
- name: EventType;
3
- args?: EventArgsType;
4
- }
5
- export type EventArgsType = {
6
- [key: string]: string;
7
- };
8
- export type FuulSettings = {
9
- [key: string]: string | Record<string, string>;
10
- };
11
- export type EventType = "connect_wallet" | "pageview";
12
- export interface SentEventParams {
13
- tracking_id: string;
14
- project_id?: 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;
21
- }
22
- export interface IGenerateTrackingLink {
23
- address: string;
24
- projectId: string;
25
- baseUrl?: string;
26
- }
27
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"queryParams.d.ts","sourceRoot":"","sources":["../../../../src/utils/queryParams.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,SAAU,OAAO,MAAM,EAAE,MAAM,CAAC,WAW5D,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTrafficTag = exports.getTrafficTitle = exports.getTrafficCategory = exports.getTrafficSource = exports.getReferrerId = exports.getProjectId = exports.getTrackingId = exports.getSessionId = void 0;
4
- const constants_js_1 = require("../constants.js");
5
- const getSessionId = () => localStorage.getItem(constants_js_1.SESSION_ID_KEY);
6
- exports.getSessionId = getSessionId;
7
- const getTrackingId = () => localStorage.getItem(constants_js_1.TRACKING_ID_KEY);
8
- exports.getTrackingId = getTrackingId;
9
- const getProjectId = () => localStorage.getItem(constants_js_1.PROJECT_ID_KEY);
10
- exports.getProjectId = getProjectId;
11
- const getReferrerId = () => localStorage.getItem(constants_js_1.REFERRER_ID_KEY);
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;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildQueryParams = void 0;
4
- const buildQueryParams = (args) => {
5
- let queryParams = "";
6
- Object.keys(args).forEach((key) => {
7
- queryParams =
8
- queryParams === ""
9
- ? queryParams + `?${key}=${args[key]}`
10
- : queryParams + "&" + `${key}=${args[key]}`;
11
- });
12
- return queryParams;
13
- };
14
- exports.buildQueryParams = buildQueryParams;
@@ -1,12 +0,0 @@
1
- export const SESSION_ID_KEY = "fuul.session_id";
2
- export const TRACKING_ID_KEY = "fuul.tracking_id";
3
- export const PROJECT_ID_KEY = "fuul.project_id";
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";
9
- export const TRAFFIC_ORIGIN_URL = "fuul.traffic_origin_url";
10
- export const SENT_EVENT_ID_KEY = "fuul.sent";
11
- export const SENT_EVENT_VALIDITY_PERIOD_MS = 60000;
12
- export const SEARCH_ENGINE_URLS = ["google.com", "bing.com", "yahoo.com"];