@basis-theory/basis-theory-js 2.2.0 → 2.3.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/BasisTheory.d.ts CHANGED
@@ -33,6 +33,10 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
33
33
  get client(): HttpClient | undefined;
34
34
  get tenants(): Tenants;
35
35
  get logs(): Logs;
36
+ /**
37
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
38
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
39
+ */
36
40
  get reactorFormulas(): ReactorFormulas;
37
41
  get reactors(): Reactors;
38
42
  get permissions(): Permissions;
package/BasisTheory.js CHANGED
@@ -166,7 +166,8 @@ class BasisTheory {
166
166
  }
167
167
 
168
168
  const elements = await (0, _elements.loadElements)(this.initOptions.elementsClientUrl);
169
- await elements.init(apiKey, elementsBaseUrl.toString().replace(/\/$/u, ''));
169
+ const elementsUseNgApi = this.initOptions.elementsUseNgApi || false;
170
+ await elements.init(apiKey, elementsBaseUrl.toString().replace(/\/$/u, ''), elementsUseNgApi);
170
171
  this.elements = elements;
171
172
  } // these should be set by the init call only.
172
173
 
@@ -204,6 +205,11 @@ class BasisTheory {
204
205
  get logs() {
205
206
  return (0, _common.assertInit)(this._logs);
206
207
  }
208
+ /**
209
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
210
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
211
+ */
212
+
207
213
 
208
214
  get reactorFormulas() {
209
215
  return (0, _common.assertInit)(this._reactorFormulas);
package/README.md CHANGED
@@ -31,7 +31,7 @@ For a complete list of endpoints and examples, please refer to our [API docs](ht
31
31
  ```javascript
32
32
  import { BasisTheory } from '@basis-theory/basis-theory-js';
33
33
 
34
- const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED'); // replace with your application key
34
+ const bt = await new BasisTheory().init('<API Key>'); // replace with your application key
35
35
  ```
36
36
 
37
37
  ### Per-request configuration
@@ -45,7 +45,7 @@ import { v4 as uuid } from 'uuid';
45
45
  await bt.applications.list(
46
46
  {},
47
47
  {
48
- apiKey: 'key_N88mVGsp3sCXkykyN2EFED',
48
+ apiKey: '<Management API Key>',
49
49
  correlationId: 'aa5d3379-6385-4ef4-9fdb-ca1341572153',
50
50
  idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
51
51
  }
@@ -57,7 +57,7 @@ await bt.tokens.create(
57
57
  data: "Sensitive Value",
58
58
  },
59
59
  {
60
- apiKey: 'key_N88mVGsp3sCXkykyN2EFED',
60
+ apiKey: '<API Key>',
61
61
  correlationId: 'aa5d3379-6385-4ef4-9fdb-ca1341572153',
62
62
  idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
63
63
  transactionId: 'cc5d3379-3921-4ef4-9fdb-ca1341572169',
@@ -72,7 +72,7 @@ You can set a custom API Url to be used across all clients when creating a new S
72
72
  ```javascript
73
73
  import { BasisTheory } from '@basis-theory/basis-theory-js';
74
74
 
75
- const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED', {
75
+ const bt = await new BasisTheory().init('<API Key>', {
76
76
  apiBaseUrl: 'https://api.somedomain.com',
77
77
  }); // replace with your application key and api base URL.
78
78
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -35,7 +35,8 @@
35
35
  "tar": "^4.4.19",
36
36
  "minimist": "^1.2.6",
37
37
  "json-schema": "^0.4.0",
38
- "terser": "^5.14.2"
38
+ "terser": "^5.14.2",
39
+ "word-wrap": "^1.2.5"
39
40
  },
40
41
  "engines": {
41
42
  "node": ">=10.12.0"
@@ -53,7 +53,7 @@ interface BasisTheoryElements extends Tokenize {
53
53
  createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
54
54
  }
55
55
  interface BasisTheoryElementsInternal extends BasisTheoryElements {
56
- init: (apiKey: string | undefined, elementsBaseUrl: string) => Promise<BasisTheoryElements>;
56
+ init: (apiKey: string | undefined, elementsBaseUrl: string, elementsUseNgApi: boolean | undefined) => Promise<BasisTheoryElements>;
57
57
  hasElement: (payload: unknown) => boolean;
58
58
  client: HttpClient;
59
59
  }
@@ -6,6 +6,7 @@ interface ElementInternalOptions {
6
6
  apiKey: string | undefined;
7
7
  baseUrl: string;
8
8
  type: ElementType;
9
+ useNgApi: boolean | undefined;
9
10
  }
10
11
  declare enum InputMode {
11
12
  DECIMAL = "decimal",
@@ -1,6 +1,10 @@
1
1
  import type { Auditable } from './shared';
2
2
  type FormulaType = 'official' | 'private';
3
3
  type DataType = 'string' | 'boolean' | 'number';
4
+ /**
5
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
6
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
7
+ */
4
8
  interface ReactorFormula extends Auditable {
5
9
  id: string;
6
10
  name: string;
@@ -22,5 +26,9 @@ interface ReactorFormulaRequestParam {
22
26
  type: DataType;
23
27
  optional?: boolean;
24
28
  }
29
+ /**
30
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
31
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
32
+ */
25
33
  type CreateReactorFormula = Omit<ReactorFormula, 'id' | 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;
26
34
  export type { FormulaType, DataType, ReactorFormula, ReactorFormulaConfig, ReactorFormulaRequestParam, CreateReactorFormula, };
@@ -6,15 +6,20 @@ interface Reactor extends Auditable {
6
6
  id: string;
7
7
  tenantId: string;
8
8
  name: string;
9
- formula: ReactorFormula;
10
9
  application?: Application;
10
+ code?: string;
11
11
  configuration?: Record<string, string>;
12
+ /**
13
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
14
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
15
+ */
16
+ formula?: ReactorFormula;
12
17
  }
13
18
  type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
14
- formula: Pick<ReactorFormula, 'id'>;
19
+ code?: string;
15
20
  application?: Pick<Application, 'id'>;
16
21
  };
17
- type UpdateReactor = Pick<Reactor, 'name' | 'configuration'> & {
22
+ type UpdateReactor = Pick<Reactor, 'name' | 'configuration' | 'code'> & {
18
23
  application?: Pick<Application, 'id'>;
19
24
  };
20
25
  type PatchReactor = Omit<Partial<UpdateReactor>, 'configuration'> & {
@@ -17,6 +17,7 @@ interface BasisTheoryInitOptionsWithElements extends BasisTheoryInitOptions {
17
17
  elements: true;
18
18
  elementsBaseUrl?: string;
19
19
  elementsClientUrl?: string;
20
+ elementsUseNgApi?: boolean;
20
21
  }
21
22
  interface BasisTheoryInit {
22
23
  init(apiKey: string, options?: BasisTheoryInitOptionsWithoutElements): Promise<BasisTheory>;
@@ -1,8 +1,16 @@
1
1
  import type { CreateReactorFormula, ReactorFormula } from '../../../types/models';
2
2
  import type { Create, Delete, List, PaginatedQuery, Retrieve, Update } from './shared';
3
+ /**
4
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
5
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
6
+ */
3
7
  interface ListReactorFormulaQuery extends PaginatedQuery {
4
8
  name?: string;
5
9
  }
10
+ /**
11
+ * @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
12
+ * @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
13
+ */
6
14
  interface ReactorFormulas extends Create<ReactorFormula, CreateReactorFormula>, Retrieve<ReactorFormula>, Update<ReactorFormula, CreateReactorFormula>, Delete, List<ReactorFormula, ListReactorFormulaQuery> {
7
15
  }
8
16
  export type { ListReactorFormulaQuery, ReactorFormulas };