@fuul/sdk 0.9.0 → 0.11.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/index.js +10 -3
- package/lib/cjs/types/index.d.ts +4 -3
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/types/types.d.ts +3 -0
- package/lib/cjs/types/types/types.d.ts.map +1 -1
- package/lib/esm/index.mjs +10 -3
- package/lib/esm/types/index.d.ts +4 -3
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/types/types.d.ts +3 -0
- package/lib/esm/types/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -66,10 +66,11 @@ const buildTrackingLinkQueryParams = (r, p) => {
|
|
|
66
66
|
return `p=${p}&origin=fuul&r=${r}`;
|
|
67
67
|
};
|
|
68
68
|
class Fuul {
|
|
69
|
-
constructor(apiKey) {
|
|
69
|
+
constructor(apiKey, settings) {
|
|
70
70
|
this.BASE_API_URL = "https://api.fuul.xyz/api/v1/";
|
|
71
71
|
this.apiKey = apiKey;
|
|
72
72
|
this.checkApiKey();
|
|
73
|
+
this.settings = settings;
|
|
73
74
|
saveSessionId();
|
|
74
75
|
saveTrackingId();
|
|
75
76
|
this.httpClient = new HttpClient_js_1.HttpClient({
|
|
@@ -81,7 +82,13 @@ class Fuul {
|
|
|
81
82
|
this.init();
|
|
82
83
|
}
|
|
83
84
|
init() {
|
|
84
|
-
|
|
85
|
+
var _a;
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
globalThis.Fuul = this;
|
|
88
|
+
if (typeof window !== "undefined" && ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.autoPageview)) {
|
|
89
|
+
yield this.sendEvent("pageview");
|
|
90
|
+
}
|
|
91
|
+
});
|
|
85
92
|
}
|
|
86
93
|
checkApiKey() {
|
|
87
94
|
if (!this.apiKey) {
|
|
@@ -147,7 +154,7 @@ class Fuul {
|
|
|
147
154
|
});
|
|
148
155
|
}
|
|
149
156
|
verifyConnection() {
|
|
150
|
-
if (window !== undefined && globalThis.Fuul) {
|
|
157
|
+
if (typeof window !== undefined && globalThis.Fuul) {
|
|
151
158
|
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
152
159
|
}
|
|
153
160
|
}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { EventArgsType, EventType, IGenerateTrackingLink } from "./types/types.js";
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings, IGenerateTrackingLink } from "./types/types.js";
|
|
2
2
|
import { CampaignDTO } from "./infrastructure/campaigns/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
|
+
private readonly settings?;
|
|
7
8
|
private campaignsService;
|
|
8
|
-
constructor(apiKey: string);
|
|
9
|
-
init(): void
|
|
9
|
+
constructor(apiKey: string, settings?: FuulSettings);
|
|
10
|
+
init(): Promise<void>;
|
|
10
11
|
checkApiKey(): void;
|
|
11
12
|
/**
|
|
12
13
|
* @param {EventType} name Event name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA0EjE,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,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA0EjE,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,CAAC,CAAe;IACzC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,YAAY;IAkB7C,IAAI;IAQV,WAAW,IAAI,IAAI;IAMnB;;;;;;;;;;;;;;;OAeG;IACG,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC;IAwDpE,gBAAgB,IAAI,IAAI;IAMxB;;;;;;OAMG;IACH,oBAAoB,CAAC,EACnB,OAAO,EACP,GAAG,EACH,OAAO,GACR,EAAE,qBAAqB,GAAG,MAAM;IAO3B,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAG7E;;;;AAMD,wBAEE"}
|
|
@@ -5,6 +5,9 @@ export interface SendEventParams {
|
|
|
5
5
|
export type EventArgsType = {
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
};
|
|
8
|
+
export type FuulSettings = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
8
11
|
export type EventType = "connect_wallet" | "pageview";
|
|
9
12
|
export interface SentEventParams {
|
|
10
13
|
tracking_id: string;
|
|
@@ -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,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;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
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,CAAC;CACvB,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;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -63,10 +63,11 @@ const buildTrackingLinkQueryParams = (r, p) => {
|
|
|
63
63
|
return `p=${p}&origin=fuul&r=${r}`;
|
|
64
64
|
};
|
|
65
65
|
export class Fuul {
|
|
66
|
-
constructor(apiKey) {
|
|
66
|
+
constructor(apiKey, settings) {
|
|
67
67
|
this.BASE_API_URL = "https://api.fuul.xyz/api/v1/";
|
|
68
68
|
this.apiKey = apiKey;
|
|
69
69
|
this.checkApiKey();
|
|
70
|
+
this.settings = settings;
|
|
70
71
|
saveSessionId();
|
|
71
72
|
saveTrackingId();
|
|
72
73
|
this.httpClient = new HttpClient({
|
|
@@ -78,7 +79,13 @@ export class Fuul {
|
|
|
78
79
|
this.init();
|
|
79
80
|
}
|
|
80
81
|
init() {
|
|
81
|
-
|
|
82
|
+
var _a;
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
globalThis.Fuul = this;
|
|
85
|
+
if (typeof window !== "undefined" && ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.autoPageview)) {
|
|
86
|
+
yield this.sendEvent("pageview");
|
|
87
|
+
}
|
|
88
|
+
});
|
|
82
89
|
}
|
|
83
90
|
checkApiKey() {
|
|
84
91
|
if (!this.apiKey) {
|
|
@@ -144,7 +151,7 @@ export class Fuul {
|
|
|
144
151
|
});
|
|
145
152
|
}
|
|
146
153
|
verifyConnection() {
|
|
147
|
-
if (window !== undefined && globalThis.Fuul) {
|
|
154
|
+
if (typeof window !== undefined && globalThis.Fuul) {
|
|
148
155
|
window.alert("You are successfully connected to Fuul SDK! ✅");
|
|
149
156
|
}
|
|
150
157
|
}
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { EventArgsType, EventType, IGenerateTrackingLink } from "./types/types.js";
|
|
1
|
+
import { EventArgsType, EventType, FuulSettings, IGenerateTrackingLink } from "./types/types.js";
|
|
2
2
|
import { CampaignDTO } from "./infrastructure/campaigns/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
|
+
private readonly settings?;
|
|
7
8
|
private campaignsService;
|
|
8
|
-
constructor(apiKey: string);
|
|
9
|
-
init(): void
|
|
9
|
+
constructor(apiKey: string, settings?: FuulSettings);
|
|
10
|
+
init(): Promise<void>;
|
|
10
11
|
checkApiKey(): void;
|
|
11
12
|
/**
|
|
12
13
|
* @param {EventType} name Event name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA0EjE,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,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA0EjE,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,CAAC,CAAe;IACzC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,YAAY;IAkB7C,IAAI;IAQV,WAAW,IAAI,IAAI;IAMnB;;;;;;;;;;;;;;;OAeG;IACG,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC;IAwDpE,gBAAgB,IAAI,IAAI;IAMxB;;;;;;OAMG;IACH,oBAAoB,CAAC,EACnB,OAAO,EACP,GAAG,EACH,OAAO,GACR,EAAE,qBAAqB,GAAG,MAAM;IAO3B,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAG7E;;;;AAMD,wBAEE"}
|
|
@@ -5,6 +5,9 @@ export interface SendEventParams {
|
|
|
5
5
|
export type EventArgsType = {
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
};
|
|
8
|
+
export type FuulSettings = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
8
11
|
export type EventType = "connect_wallet" | "pageview";
|
|
9
12
|
export interface SentEventParams {
|
|
10
13
|
tracking_id: string;
|
|
@@ -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,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;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
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,CAAC;CACvB,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;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|