@basis-theory/basis-theory-js 1.22.1 → 1.24.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.
@@ -1,11 +1,11 @@
1
- import type { AtomicBank, ReactRequest, ReactResponse, UpdateAtomicBank } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { AtomicBank, AtomicReactRequest, ReactResponse, UpdateAtomicBank } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicBanks: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicBank, options?: RequestOptions | undefined): Promise<AtomicBank>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicBank>;
8
- react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
+ react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
11
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<AtomicBank>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<AtomicBank, PaginatedQuery>);
@@ -30,8 +30,8 @@ const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
30
30
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
31
31
  }
32
32
 
33
- react(id, request, options) {
34
- return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
33
+ react(tokenId, request, options) {
34
+ return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
35
35
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
36
36
  transformResponse: _common.proxyRaw
37
37
  })).then(_common.dataExtractor);
@@ -1,11 +1,11 @@
1
- import type { AtomicCard, ReactRequest, ReactResponse, UpdateAtomicCard } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { AtomicCard, AtomicReactRequest, ReactResponse, UpdateAtomicCard } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicCards: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicCard, options?: RequestOptions | undefined): Promise<AtomicCard>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicCard>;
8
- react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
+ react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
11
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<AtomicCard>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<AtomicCard, PaginatedQuery>);
@@ -32,8 +32,8 @@ const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
32
32
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
33
33
  }
34
34
 
35
- react(id, request, options) {
36
- return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
35
+ react(tokenId, request, options) {
36
+ return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
37
37
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
38
38
  transformResponse: _common.proxyRaw
39
39
  })).then(_common.dataExtractor);
package/common/utils.d.ts CHANGED
@@ -17,7 +17,7 @@ declare const concatRequestTransformerWithDefault: (requestTransformer: AxiosTra
17
17
  declare const concatResponseTransformermWithDefault: (responseTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
18
18
  declare const createRequestConfig: (options?: RequestOptions | undefined, transformers?: Pick<AxiosRequestConfig, "transformRequest" | "transformResponse"> | undefined) => AxiosRequestConfig | undefined;
19
19
  declare const errorInterceptor: (error: any) => void;
20
- declare const getQueryParams: <Q>(query: Q) => string;
20
+ declare const getQueryParams: <Q>(query?: Q) => string;
21
21
  declare const buildUserAgentString: (appInfo?: ApplicationInfo | undefined) => string;
22
22
  declare const getBrowser: () => string;
23
23
  declare const getOSVersion: () => string;
package/common/utils.js CHANGED
@@ -242,7 +242,7 @@ const errorInterceptor = error => {
242
242
 
243
243
  exports.errorInterceptor = errorInterceptor;
244
244
 
245
- const getQueryParams = query => {
245
+ const getQueryParams = (query = {}) => {
246
246
  const keys = Object.keys(query);
247
247
 
248
248
  if (keys.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.22.1",
3
+ "version": "1.24.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -15,7 +15,7 @@
15
15
  "!*.bundle.js"
16
16
  ],
17
17
  "dependencies": {
18
- "@basis-theory/basis-theory-elements-interfaces": "^3.4.0",
18
+ "@basis-theory/basis-theory-elements-interfaces": "^3.6.0",
19
19
  "axios": "^0.21.2",
20
20
  "camelcase-keys": "^6.2.2",
21
21
  "os": "^0.1.2",
@@ -4,5 +4,5 @@ export declare const BasisTheoryReactorFormulas: {
4
4
  new (options: import("../service/types").BasisTheoryServiceOptions): {
5
5
  readonly client: import("axios").AxiosInstance;
6
6
  };
7
- } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "sourceTokenType" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<ReactorFormula>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "sourceTokenType" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<ReactorFormula, ListReactorFormulaQuery>);
7
+ } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<ReactorFormula>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<ReactorFormula, ListReactorFormulaQuery>);
8
8
  export declare type BasisTheoryReactorFormulas = InstanceType<typeof BasisTheoryReactorFormulas>;
@@ -1,8 +1,9 @@
1
- import type { Reactor, CreateReactor } from '@basis-theory/basis-theory-elements-interfaces/models';
2
- import type { ListReactorQuery } from '@basis-theory/basis-theory-elements-interfaces/sdk';
1
+ import type { Reactor, CreateReactor, ReactResponse } from '@basis-theory/basis-theory-elements-interfaces/models';
2
+ import type { ListReactorQuery, ReactRequest, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../service';
4
4
  export declare const BasisTheoryReactors: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
+ react(reactorId: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
6
7
  readonly client: import("axios").AxiosInstance;
7
8
  };
8
9
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<Reactor, CreateReactor>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<Reactor>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<Reactor, Pick<Reactor, "name" | "configuration">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<Reactor, ListReactorQuery>);
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BasisTheoryReactors = void 0;
7
7
 
8
+ var _common = require("../common");
9
+
8
10
  var _utils = require("../common/utils");
9
11
 
10
12
  var _service = require("../service");
@@ -22,5 +24,12 @@ const BasisTheoryReactors = new _CrudBuilder.CrudBuilder(class BasisTheoryReacto
22
24
  super(_options);
23
25
  }
24
26
 
27
+ react(reactorId, request, options) {
28
+ return this.client.post(`/${reactorId}/react`, request, (0, _common.createRequestConfig)(options, {
29
+ transformRequest: _common.proxyRaw,
30
+ transformResponse: _common.proxyRaw
31
+ })).then(_common.dataExtractor);
32
+ }
33
+
25
34
  }).create().retrieve().update().delete().list().build();
26
35
  exports.BasisTheoryReactors = BasisTheoryReactors;
@@ -24,8 +24,10 @@ class BasisTheoryService {
24
24
  baseURL,
25
25
  headers: {
26
26
  [_common.API_KEY_HEADER]: apiKey,
27
- [_common.USER_AGENT_HEADER]: (0, _common.buildUserAgentString)(appInfo),
28
- [_common.CLIENT_USER_AGENT_HEADER]: (0, _common.buildClientUserAgentString)(appInfo)
27
+ [_common.CLIENT_USER_AGENT_HEADER]: (0, _common.buildClientUserAgentString)(appInfo),
28
+ ...(typeof window === 'undefined' && {
29
+ [_common.USER_AGENT_HEADER]: (0, _common.buildUserAgentString)(appInfo)
30
+ })
29
31
  },
30
32
 
31
33
  /* eslint-disable unicorn/prefer-spread */
@@ -1,11 +1,20 @@
1
- import type { Tenant, TenantUsageReport, UpdateTenant } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { Tenant, TenantUsageReport, UpdateTenant, CreateTenantInvitation, TenantInvitation, TenantMember } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk/services';
3
+ import type { PaginatedList } from '@basis-theory/basis-theory-elements-interfaces/sdk/services/shared';
4
+ import type { ListTenantInvitationsQuery, ListTenantMembersQuery } from '@basis-theory/basis-theory-elements-interfaces/sdk/services/tenants';
3
5
  export declare const BasisTheoryTenants: {
4
6
  new (options: import("../service/types").BasisTheoryServiceOptions): {
5
7
  retrieve(options?: RequestOptions | undefined): Promise<Tenant>;
6
8
  update(model: UpdateTenant, options?: RequestOptions | undefined): Promise<Tenant>;
7
9
  delete(options?: RequestOptions | undefined): Promise<void>;
8
10
  retrieveUsageReport(options?: RequestOptions | undefined): Promise<TenantUsageReport>;
11
+ createInvitation(model: CreateTenantInvitation, options?: RequestOptions | undefined): Promise<TenantInvitation>;
12
+ resendInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<TenantInvitation>;
13
+ listInvitations(query?: ListTenantInvitationsQuery | undefined, options?: RequestOptions | undefined): Promise<PaginatedList<TenantInvitation>>;
14
+ retrieveInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<TenantInvitation>;
15
+ deleteInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<void>;
16
+ listMembers(query?: ListTenantMembersQuery | undefined, options?: RequestOptions | undefined): Promise<PaginatedList<TenantMember>>;
17
+ deleteMember(memberId: string, options?: RequestOptions | undefined): Promise<void>;
9
18
  readonly client: import("axios").AxiosInstance;
10
19
  };
11
20
  };
@@ -28,5 +28,35 @@ const BasisTheoryTenants = new _CrudBuilder.CrudBuilder(class BasisTheoryTenants
28
28
  return this.client.get('/reports/usage', (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
29
29
  }
30
30
 
31
+ createInvitation(model, options) {
32
+ return this.client.post('/invitations', model, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
33
+ }
34
+
35
+ resendInvitation(invitationId, options) {
36
+ return this.client.post(`/invitations/${invitationId}/resend`, {}, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
37
+ }
38
+
39
+ listInvitations(query, options) {
40
+ const url = `/invitations${(0, _common.getQueryParams)(query)}`;
41
+ return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
42
+ }
43
+
44
+ retrieveInvitation(invitationId, options) {
45
+ return this.client.get(`/invitations/${invitationId}`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
46
+ }
47
+
48
+ async deleteInvitation(invitationId, options) {
49
+ await this.client.delete(`/invitations/${invitationId}`, (0, _common.createRequestConfig)(options));
50
+ }
51
+
52
+ listMembers(query, options) {
53
+ const url = `/members${(0, _common.getQueryParams)(query)}`;
54
+ return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
55
+ }
56
+
57
+ async deleteMember(memberId, options) {
58
+ await this.client.delete(`/members/${memberId}`, (0, _common.createRequestConfig)(options));
59
+ }
60
+
31
61
  }).build();
32
62
  exports.BasisTheoryTenants = BasisTheoryTenants;