@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.
@@ -2,19 +2,19 @@ import type { LocationData } from '../types';
2
2
  /**
3
3
  * Experimental Method Parameter Types
4
4
  */
5
- export declare type ValidateEmailParameters = {
5
+ export type ValidateEmailParameters = {
6
6
  email: string;
7
7
  ip?: string;
8
8
  name?: string;
9
9
  userAgent?: string;
10
10
  };
11
- export declare type GuessGenderParameters = {
11
+ export type GuessGenderParameters = {
12
12
  name: string;
13
13
  };
14
- export declare type GeolocateParameters = {
14
+ export type GeolocateParameters = {
15
15
  ip: string;
16
16
  };
17
- export declare type BlacklistParameters = {
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 declare type ValidateEmailResponse = {
27
+ export type ValidateEmailResponse = {
28
28
  valid: boolean;
29
29
  };
30
- export declare type GuessGenderResponse = {
30
+ export type GuessGenderResponse = {
31
31
  confidence: number | null;
32
32
  gender: string | null;
33
33
  };
34
- export declare type GeolocateResponse = Partial<LocationData>;
35
- export declare type BlacklistResponse = {
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 declare type CreateFieldParameters = {
5
+ export type CreateFieldParameters = {
6
6
  key: string;
7
7
  };
8
8
  /**
9
9
  * Core Field Types
10
10
  */
11
- export declare type FieldAttributes = {
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 declare type Field = BaseEntity<FieldAttributes>;
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 declare type FormResponseData = {
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 declare type FormResponseAttributes = {
24
+ export type FormResponseAttributes = {
25
25
  data: FormResponseData;
26
26
  uuid: string;
27
27
  };
28
- export declare type FormResponse = BaseEntity<FormResponseAttributes>;
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 declare type GetSubscribersParameters = {
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 declare type CreateSubscriberParameters = {
12
+ export type CreateSubscriberParameters = {
13
13
  email: string;
14
14
  };
15
15
  /**
16
16
  * Core Subscriber Types
17
17
  */
18
- export declare type SubscriberAttributes<S> = {
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 declare type Subscriber<S> = BaseEntity<SubscriberAttributes<S>>;
25
+ export type Subscriber<S> = BaseEntity<SubscriberAttributes<S>>;
@@ -2,16 +2,16 @@ import type { BaseEntity } from '../types';
2
2
  /**
3
3
  * Tag Method Parameter Types
4
4
  */
5
- export declare type CreateTagParameters = {
5
+ export type CreateTagParameters = {
6
6
  name: string;
7
7
  };
8
8
  /**
9
9
  * Core Tag Types
10
10
  */
11
- export declare type TagAttributes = {
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 declare type Tag = BaseEntity<TagAttributes>;
17
+ export type Tag = BaseEntity<TagAttributes>;
@@ -2,7 +2,7 @@
2
2
  * Core Types
3
3
  */
4
4
  import type { EntityType } from "./enums";
5
- export declare type BaseEntity<T> = {
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 declare type BrowserData = {
13
+ export type BrowserData = {
14
14
  height: string;
15
15
  user_agent: string;
16
16
  width: string;
17
17
  };
18
- export declare type IdentityData = {
18
+ export type IdentityData = {
19
19
  email: string;
20
20
  };
21
- export declare type LocationData = {
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 declare type PageData = {
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 declare type TagSubscriberParameters = {
5
+ export type TagSubscriberParameters = {
6
6
  date?: Date;
7
7
  email: string;
8
8
  tagName: string;
9
9
  };
10
- export declare type AddSubscriberParameters<S> = {
10
+ export type AddSubscriberParameters<S> = {
11
11
  date?: Date;
12
12
  email: string;
13
13
  fields?: Partial<S>;
14
14
  };
15
- export declare type RemoveSubscriberParameters = {
15
+ export type RemoveSubscriberParameters = {
16
16
  date?: Date;
17
17
  email: string;
18
18
  };
19
- export declare type TrackPurchaseParameters = {
19
+ export type TrackPurchaseParameters = {
20
20
  date?: Date;
21
21
  email: string;
22
22
  purchaseDetails: PurchaseDetails;
23
23
  };
24
- export declare type UpdateFieldsParameters<S> = {
24
+ export type UpdateFieldsParameters<S> = {
25
25
  date?: Date;
26
26
  email: string;
27
27
  fields: Partial<S>;
28
28
  };
29
- export declare type TrackParameters<S, E extends string> = BaseEvent<E> & {
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.00",
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
- "isomorphic-fetch": "^3.0.0"
66
+ "cross-fetch": "^4.0.0"
67
67
  }
68
- }
68
+ }
@@ -1,4 +1,4 @@
1
- import fetch from 'isomorphic-fetch';
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 (result) => {
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((data) => resolve(data))
45
- .catch((error) => reject(error));
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 (result) => {
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((data) => resolve(data))
80
- .catch((error) => reject(error));
79
+ .then(data => resolve(data))
80
+ .catch(error => reject(error));
81
81
  });
82
82
  }
83
83