@bentonow/bento-node-sdk 0.2.0 → 0.2.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.
- package/README.md +19 -17
- package/dist/bento-node-sdk.cjs.development.js +948 -1820
- package/dist/bento-node-sdk.cjs.development.js.map +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js.map +1 -1
- package/dist/bento-node-sdk.esm.js +948 -1820
- package/dist/bento-node-sdk.esm.js.map +1 -1
- package/dist/sdk/batch/events.d.ts +12 -12
- package/dist/sdk/batch/types.d.ts +7 -7
- package/dist/sdk/client/types.d.ts +1 -1
- package/dist/sdk/commands/types.d.ts +7 -7
- package/dist/sdk/experimental/types.d.ts +8 -8
- package/dist/sdk/fields/types.d.ts +3 -3
- package/dist/sdk/forms/types.d.ts +3 -3
- package/dist/sdk/subscribers/types.d.ts +4 -4
- package/dist/sdk/tags/types.d.ts +3 -3
- package/dist/sdk/types.d.ts +5 -5
- package/dist/versions/v1/types.d.ts +6 -6
- package/package.json +3 -3
- package/src/sdk/client/index.ts +7 -7
|
@@ -2,19 +2,19 @@ import type { LocationData } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Experimental Method Parameter Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type ValidateEmailParameters = {
|
|
6
6
|
email: string;
|
|
7
7
|
ip?: string;
|
|
8
8
|
name?: string;
|
|
9
9
|
userAgent?: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type GuessGenderParameters = {
|
|
12
12
|
name: string;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type GeolocateParameters = {
|
|
15
15
|
ip: string;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type BlacklistParameters = {
|
|
18
18
|
domain: string;
|
|
19
19
|
ip?: never;
|
|
20
20
|
} | {
|
|
@@ -24,15 +24,15 @@ export declare type BlacklistParameters = {
|
|
|
24
24
|
/**
|
|
25
25
|
* Experimental Method Response Types
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export type ValidateEmailResponse = {
|
|
28
28
|
valid: boolean;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type GuessGenderResponse = {
|
|
31
31
|
confidence: number | null;
|
|
32
32
|
gender: string | null;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
export
|
|
34
|
+
export type GeolocateResponse = Partial<LocationData>;
|
|
35
|
+
export type BlacklistResponse = {
|
|
36
36
|
description: string;
|
|
37
37
|
query: string;
|
|
38
38
|
results: {
|
|
@@ -2,16 +2,16 @@ import type { BaseEntity } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Field Method Parameter Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type CreateFieldParameters = {
|
|
6
6
|
key: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Core Field Types
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type FieldAttributes = {
|
|
12
12
|
created_at: string;
|
|
13
13
|
key: string;
|
|
14
14
|
name: string;
|
|
15
15
|
whitelisted: boolean | null;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type Field = BaseEntity<FieldAttributes>;
|
|
@@ -2,7 +2,7 @@ import type { BaseEntity, BrowserData, IdentityData, LocationData, PageData } fr
|
|
|
2
2
|
/**
|
|
3
3
|
* Core Form Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type FormResponseData = {
|
|
6
6
|
browser: BrowserData;
|
|
7
7
|
date: string;
|
|
8
8
|
details: {
|
|
@@ -21,8 +21,8 @@ export declare type FormResponseData = {
|
|
|
21
21
|
visit: string;
|
|
22
22
|
visitor: string;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type FormResponseAttributes = {
|
|
25
25
|
data: FormResponseData;
|
|
26
26
|
uuid: string;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type FormResponse = BaseEntity<FormResponseAttributes>;
|
|
@@ -2,24 +2,24 @@ import type { BaseEntity } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Subscriber Method Parameter Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type GetSubscribersParameters = {
|
|
6
6
|
email?: never;
|
|
7
7
|
uuid: string;
|
|
8
8
|
} | {
|
|
9
9
|
email: string;
|
|
10
10
|
uuid?: never;
|
|
11
11
|
} | never;
|
|
12
|
-
export
|
|
12
|
+
export type CreateSubscriberParameters = {
|
|
13
13
|
email: string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Core Subscriber Types
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type SubscriberAttributes<S> = {
|
|
19
19
|
cached_tag_ids: string[];
|
|
20
20
|
email: string;
|
|
21
21
|
fields: S | null;
|
|
22
22
|
unsubscribed_at: string | null;
|
|
23
23
|
uuid: string;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type Subscriber<S> = BaseEntity<SubscriberAttributes<S>>;
|
package/dist/sdk/tags/types.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import type { BaseEntity } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Tag Method Parameter Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type CreateTagParameters = {
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Core Tag Types
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type TagAttributes = {
|
|
12
12
|
created_at: string;
|
|
13
13
|
discarded_at: string | null;
|
|
14
14
|
name: string | null;
|
|
15
15
|
site_id: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type Tag = BaseEntity<TagAttributes>;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Core Types
|
|
3
3
|
*/
|
|
4
4
|
import type { EntityType } from "./enums";
|
|
5
|
-
export
|
|
5
|
+
export type BaseEntity<T> = {
|
|
6
6
|
attributes: T;
|
|
7
7
|
id: string;
|
|
8
8
|
type: EntityType;
|
|
@@ -10,15 +10,15 @@ export declare type BaseEntity<T> = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Utility Types
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type BrowserData = {
|
|
14
14
|
height: string;
|
|
15
15
|
user_agent: string;
|
|
16
16
|
width: string;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type IdentityData = {
|
|
19
19
|
email: string;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type LocationData = {
|
|
22
22
|
city_name: string;
|
|
23
23
|
continent_code: string;
|
|
24
24
|
country_code2: string;
|
|
@@ -32,7 +32,7 @@ export declare type LocationData = {
|
|
|
32
32
|
region_name: string;
|
|
33
33
|
request: string;
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type PageData = {
|
|
36
36
|
host: string;
|
|
37
37
|
path: string;
|
|
38
38
|
protocol: string;
|
|
@@ -2,30 +2,30 @@ import type { BaseEvent, PurchaseDetails } from '../../sdk/batch/events';
|
|
|
2
2
|
/**
|
|
3
3
|
* API Method Parameter Types
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type TagSubscriberParameters = {
|
|
6
6
|
date?: Date;
|
|
7
7
|
email: string;
|
|
8
8
|
tagName: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type AddSubscriberParameters<S> = {
|
|
11
11
|
date?: Date;
|
|
12
12
|
email: string;
|
|
13
13
|
fields?: Partial<S>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type RemoveSubscriberParameters = {
|
|
16
16
|
date?: Date;
|
|
17
17
|
email: string;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type TrackPurchaseParameters = {
|
|
20
20
|
date?: Date;
|
|
21
21
|
email: string;
|
|
22
22
|
purchaseDetails: PurchaseDetails;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type UpdateFieldsParameters<S> = {
|
|
25
25
|
date?: Date;
|
|
26
26
|
email: string;
|
|
27
27
|
fields: Partial<S>;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type TrackParameters<S, E extends string> = BaseEvent<E> & {
|
|
30
30
|
fields: Partial<S>;
|
|
31
31
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"typescript": "^4.3.5"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"
|
|
66
|
+
"cross-fetch": "^4.0.0"
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
}
|
package/src/sdk/client/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fetch from '
|
|
1
|
+
import fetch from 'cross-fetch';
|
|
2
2
|
import type { AnalyticsOptions, AuthenticationOptions } from '../interfaces';
|
|
3
3
|
import { NotAuthorizedError, RateLimitedError } from './errors';
|
|
4
4
|
|
|
@@ -34,15 +34,15 @@ export class BentoClient {
|
|
|
34
34
|
method: 'GET',
|
|
35
35
|
headers: this._headers,
|
|
36
36
|
})
|
|
37
|
-
.then(async
|
|
37
|
+
.then(async result => {
|
|
38
38
|
if (this._isSuccessfulStatus(result.status)) {
|
|
39
39
|
return result.json();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
throw await this._getErrorForResponse(result);
|
|
43
43
|
})
|
|
44
|
-
.then(
|
|
45
|
-
.catch(
|
|
44
|
+
.then(data => resolve(data))
|
|
45
|
+
.catch(error => reject(error));
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -69,15 +69,15 @@ export class BentoClient {
|
|
|
69
69
|
},
|
|
70
70
|
body,
|
|
71
71
|
})
|
|
72
|
-
.then(async
|
|
72
|
+
.then(async result => {
|
|
73
73
|
if (this._isSuccessfulStatus(result.status)) {
|
|
74
74
|
return result.json();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
throw await this._getErrorForResponse(result);
|
|
78
78
|
})
|
|
79
|
-
.then(
|
|
80
|
-
.catch(
|
|
79
|
+
.then(data => resolve(data))
|
|
80
|
+
.catch(error => reject(error));
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
|