@fuul/sdk 3.2.2 → 3.3.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/README.md +1 -1
- package/dist/HttpClient.d.ts.map +1 -1
- package/dist/affiliates/AffiliateService.d.ts +15 -0
- package/dist/affiliates/AffiliateService.d.ts.map +1 -0
- package/dist/affiliates/errors.d.ts +16 -0
- package/dist/affiliates/errors.d.ts.map +1 -0
- package/dist/core.d.ts +42 -8
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +614 -577
- package/dist/index.umd.js +3 -3
- package/package.json +2 -2
- package/dist/AffiliateService.d.ts +0 -28
- package/dist/AffiliateService.d.ts.map +0 -1
package/README.md
CHANGED
package/dist/HttpClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/HttpClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/HttpClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,aAAa,EAAE,MAAM,OAAO,CAAC;AAE5D,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;IAWtC,OAAO,CAAC,gBAAgB;IAWlB,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;CAGzD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpClient } from '../HttpClient';
|
|
2
|
+
export type AffiliateServiceSettings = {
|
|
3
|
+
httpClient: HttpClient;
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare class AffiliateService {
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
private readonly _debug;
|
|
9
|
+
constructor(settings: AffiliateServiceSettings);
|
|
10
|
+
create(address: string, code: string, signature: string): Promise<void>;
|
|
11
|
+
update(address: string, code: string, signature: string): Promise<void>;
|
|
12
|
+
isCodeFree(code: string): Promise<boolean>;
|
|
13
|
+
getCode(address: string): Promise<string | null>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AffiliateService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AffiliateService.d.ts","sourceRoot":"","sources":["../../../src/affiliates/AffiliateService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,QAAQ,EAAE,wBAAwB;IAKjC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCvE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BvE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe1C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAS9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class ValidationError extends Error {
|
|
2
|
+
readonly errors: string[];
|
|
3
|
+
constructor(errors: string[]);
|
|
4
|
+
}
|
|
5
|
+
export declare class AddressInUseError extends Error {
|
|
6
|
+
readonly address: string;
|
|
7
|
+
constructor(address: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class CodeInUseError extends Error {
|
|
10
|
+
readonly code: string;
|
|
11
|
+
constructor(code: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class InvalidSignatureError extends Error {
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/affiliates/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBAErB,MAAM,EAAE,MAAM,EAAE;CAK7B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,IAAI,EAAE,MAAM;CAKzB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;;CAK/C"}
|
package/dist/core.d.ts
CHANGED
|
@@ -38,21 +38,54 @@ export declare function sendPageview(pageName?: string): Promise<void>;
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function sendConnectWallet(userMetadata: UserMetadata): Promise<void>;
|
|
40
40
|
/**
|
|
41
|
-
* Creates
|
|
42
|
-
* @param {string} address
|
|
43
|
-
* @param {string} code
|
|
44
|
-
* @param {string} signature
|
|
41
|
+
* Creates a code registered to an affiliate address
|
|
42
|
+
* @param {string} address Affiliate wallet address
|
|
43
|
+
* @param {string} code Affiliate code to map address to
|
|
44
|
+
* @param {string} signature Signed message authenticating address ownership. Message to be signed: `I confirm that I am creating the ${code} code on Fuul`
|
|
45
45
|
* @example
|
|
46
46
|
* ```typescript
|
|
47
47
|
* await Fuul.createAffiliateCode('0x12345', 'my-cool-code', '<signature>')
|
|
48
48
|
* ```
|
|
49
49
|
**/
|
|
50
50
|
export declare function createAffiliateCode(address: string, code: string, signature: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Updates the code registered to an affiliate address
|
|
53
|
+
* @param {string} address Affiliate wallet address
|
|
54
|
+
* @param {string} code New affiliate code
|
|
55
|
+
* @param {string} signature Signed message authenticating code update. Message to be signed: `I confirm that I am updating my code to ${code} on Fuul`
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* await Fuul.updateAffiliateCode('0x12345', 'my-new-cool-code', '<signature>')
|
|
59
|
+
* ```
|
|
60
|
+
**/
|
|
61
|
+
export declare function updateAffiliateCode(address: string, code: string, signature: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the code registered to an affiliate address
|
|
64
|
+
* @param {string} address Affiliate wallet address
|
|
65
|
+
* @returns {string} Affiliate code
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const code = await Fuul.getAffiliateCode('0x12345');
|
|
69
|
+
* ```
|
|
70
|
+
**/
|
|
71
|
+
export declare function getAffiliateCode(address: string): Promise<string | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if an affiliate code is free to use
|
|
74
|
+
* @param {string} code Affiliate code to check
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* if (await Fuul.isAffiliateCodeFree('my-cool-code')) {
|
|
79
|
+
* // Code is free to use
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
**/
|
|
83
|
+
export declare function isAffiliateCodeFree(code: string): Promise<boolean>;
|
|
51
84
|
/**
|
|
52
85
|
* Generates a tracking link for an affiliate
|
|
53
|
-
* @param {string} baseUrl
|
|
54
|
-
* @param {string} affiliateAddress
|
|
55
|
-
* @param {AffiliateLinkParams} params
|
|
86
|
+
* @param {string} baseUrl Base url of the project
|
|
87
|
+
* @param {string} affiliateAddress Affiliate wallet address
|
|
88
|
+
* @param {AffiliateLinkParams} params Optional tracking parameters
|
|
56
89
|
* @returns {string} Tracking link
|
|
57
90
|
* @example
|
|
58
91
|
* ```typescript
|
|
@@ -62,7 +95,6 @@ export declare function createAffiliateCode(address: string, code: string, signa
|
|
|
62
95
|
* @see https://docs.fuul.xyz/technical-guide-for-projects/creating-partners-tracking-links-using-the-fuul-sdk
|
|
63
96
|
**/
|
|
64
97
|
export declare function generateTrackingLink(baseUrl: string, affiliateAddress: string, params?: AffiliateLinkParams): Promise<string>;
|
|
65
|
-
export declare function getAffiliateCode(affiliateAddress: string): Promise<string | null>;
|
|
66
98
|
export declare function getConversions(): Promise<Conversion[]>;
|
|
67
99
|
declare const _default: {
|
|
68
100
|
init: typeof init;
|
|
@@ -72,7 +104,9 @@ declare const _default: {
|
|
|
72
104
|
generateTrackingLink: typeof generateTrackingLink;
|
|
73
105
|
getConversions: typeof getConversions;
|
|
74
106
|
createAffiliateCode: typeof createAffiliateCode;
|
|
107
|
+
updateAffiliateCode: typeof updateAffiliateCode;
|
|
75
108
|
getAffiliateCode: typeof getAffiliateCode;
|
|
109
|
+
isAffiliateCodeFree: typeof isAffiliateCodeFree;
|
|
76
110
|
};
|
|
77
111
|
export default _default;
|
|
78
112
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAYzF,wBAAgB,IAAI,CAAC,QAAQ,EAAE,YAAY,QAqB1C;AAQD;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD1G;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;AAED;;;;;;;;;IASI;AACJ,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":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AAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAG5D;;;;;;;;;;;;;AAuBD,wBAWE"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzE,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC"}
|