@basis-theory/basis-theory-js 1.17.0 → 1.18.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/BasisTheory.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { AtomicBanks as ElementsAtomicBanks, AtomicCards as ElementsAtomicCards, BasisTheoryElements, CardElement, CustomizableElementOptions, ElementType, TextElement, Tokenize as ElementsTokenize, Tokens as ElementsTokens } from '@basis-theory/basis-theory-elements-interfaces/elements';
2
- import type { Applications, AtomicBanks, AtomicCards, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, Tenants, Tokenize, Tokens } from '@basis-theory/basis-theory-elements-interfaces/sdk';
1
+ import type { AtomicBanks as ElementsAtomicBanks, AtomicCards as ElementsAtomicCards, BasisTheoryElements, CardElement, CustomizableElementOptions, ElementType, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from '@basis-theory/basis-theory-elements-interfaces/elements';
2
+ import type { TokenizeData } from '@basis-theory/basis-theory-elements-interfaces/models';
3
+ import type { Applications, AtomicBanks, AtomicCards, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, RequestOptions, Tenants, Tokens } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
4
  import { BasisTheoryEncryptionAdapters } from './encryption/BasisTheoryEncryptionAdapters';
4
5
  import type { BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements } from './types';
5
6
  export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
@@ -20,10 +21,10 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
20
21
  init(apiKey: string, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
21
22
  init(apiKey: string, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
22
23
  createElement(type: ElementType, options: CustomizableElementOptions): CardElement | TextElement;
24
+ tokenize(tokens: TokenizeData & ElementsTokenizeData, options?: RequestOptions): Promise<TokenizeData>;
23
25
  private loadElements;
24
26
  get initOptions(): Required<BasisTheoryInitOptions>;
25
27
  get tokens(): Tokens & ElementsTokens;
26
- get tokenize(): Tokenize & ElementsTokenize;
27
28
  /**
28
29
  * @deprecated
29
30
  */
package/BasisTheory.js CHANGED
@@ -131,6 +131,10 @@ class BasisTheory {
131
131
  return this._elements.createElement(type, options);
132
132
  }
133
133
 
134
+ tokenize(tokens, options) {
135
+ return (0, _common.assertInit)(this._tokenize).tokenize(tokens, options);
136
+ }
137
+
134
138
  async loadElements(apiKey) {
135
139
  let elementsBaseUrl;
136
140
 
@@ -155,10 +159,6 @@ class BasisTheory {
155
159
  get tokens() {
156
160
  return (0, _common.assertInit)(this._tokens);
157
161
  }
158
-
159
- get tokenize() {
160
- return (0, _common.assertInit)(this._tokenize);
161
- }
162
162
  /**
163
163
  * @deprecated
164
164
  */
@@ -10,7 +10,7 @@ var _tokenize = require("../../tokenize");
10
10
  const delegateTokenize = elements => class BasisTheoryTokenizesElementsDelegate extends _tokenize.BasisTheoryTokenize {
11
11
  tokenize(payload, requestOptions) {
12
12
  if (elements !== null && elements !== void 0 && elements.hasElement(payload)) {
13
- return elements.tokenize.tokenize(payload, requestOptions);
13
+ return elements.tokenize(payload, requestOptions);
14
14
  }
15
15
 
16
16
  return super.tokenize(payload, requestOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.17.0",
3
+ "version": "1.18.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": "^2.2.0",
18
+ "@basis-theory/basis-theory-elements-interfaces": "^3.0.0",
19
19
  "axios": "^0.21.2",
20
20
  "camelcase-keys": "^6.2.2",
21
21
  "snake-case": "^3.0.4",
@@ -7,16 +7,14 @@ exports.BasisTheoryTokenize = void 0;
7
7
 
8
8
  var _common = require("../common");
9
9
 
10
- var _utils = require("../common/utils");
11
-
12
10
  var _service = require("../service");
13
11
 
14
12
  class BasisTheoryTokenize extends _service.BasisTheoryService {
15
13
  tokenize(tokens, options = {}) {
16
14
  return this.client.post('/', tokens, (0, _common.createRequestConfig)(options, {
17
- transformRequest: _utils.proxyRaw,
18
- transformResponse: _utils.proxyRaw
19
- })).then(_utils.dataExtractor);
15
+ transformRequest: _common.proxyRaw,
16
+ transformResponse: _common.proxyRaw
17
+ })).then(_common.dataExtractor);
20
18
  }
21
19
 
22
20
  }