@basis-theory/basis-theory-js 1.13.1 → 1.17.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.
Files changed (88) hide show
  1. package/BasisTheory.d.ts +23 -27
  2. package/BasisTheory.js +33 -30
  3. package/README.md +5 -1
  4. package/applications/BasisTheoryApplications.d.ts +3 -3
  5. package/applications/index.d.ts +0 -1
  6. package/applications/index.js +0 -17
  7. package/atomic/banks/BasisTheoryAtomicBanks.d.ts +5 -5
  8. package/atomic/banks/index.d.ts +0 -1
  9. package/atomic/banks/index.js +0 -17
  10. package/atomic/cards/BasisTheoryAtomicCards.d.ts +5 -5
  11. package/atomic/cards/index.d.ts +0 -1
  12. package/atomic/cards/index.js +0 -17
  13. package/atomic/index.d.ts +2 -2
  14. package/atomic/index.js +8 -8
  15. package/common/constants.d.ts +1 -1
  16. package/common/constants.js +1 -2
  17. package/common/index.d.ts +0 -1
  18. package/common/index.js +0 -13
  19. package/common/utils.d.ts +1 -1
  20. package/common/utils.js +0 -6
  21. package/elements/constants.d.ts +5 -0
  22. package/elements/constants.js +14 -0
  23. package/elements/index.d.ts +3 -6
  24. package/elements/index.js +44 -1
  25. package/elements/load.d.ts +3 -0
  26. package/{common/elements.js → elements/load.js} +5 -3
  27. package/{common → elements}/script.d.ts +0 -0
  28. package/{common → elements}/script.js +0 -0
  29. package/elements/services/banks.d.ts +5 -0
  30. package/elements/services/banks.js +21 -0
  31. package/elements/services/cards.d.ts +5 -0
  32. package/elements/services/cards.js +21 -0
  33. package/elements/services/index.d.ts +4 -0
  34. package/elements/services/index.js +57 -0
  35. package/elements/services/tokenize.d.ts +5 -0
  36. package/elements/services/tokenize.js +21 -0
  37. package/elements/services/tokens.d.ts +5 -0
  38. package/elements/services/tokens.js +21 -0
  39. package/index.d.ts +2 -2
  40. package/logs/BasisTheoryLogs.d.ts +3 -2
  41. package/logs/index.d.ts +0 -1
  42. package/logs/index.js +0 -17
  43. package/package.json +2 -1
  44. package/permissions/BasisTheoryPermissions.d.ts +3 -2
  45. package/permissions/index.d.ts +0 -1
  46. package/permissions/index.js +1 -18
  47. package/reactor-formulas/BasisTheoryReactorFormulas.d.ts +3 -2
  48. package/reactor-formulas/index.d.ts +0 -1
  49. package/reactor-formulas/index.js +0 -17
  50. package/reactors/BasisTheoryReactors.d.ts +3 -2
  51. package/reactors/index.d.ts +0 -1
  52. package/reactors/index.js +0 -17
  53. package/service/CrudBuilder.d.ts +2 -17
  54. package/service/types.d.ts +1 -21
  55. package/tenants/BasisTheoryTenants.d.ts +3 -3
  56. package/tenants/index.d.ts +0 -1
  57. package/tenants/index.js +0 -17
  58. package/tokenize/BasisTheoryTokenize.d.ts +3 -3
  59. package/tokenize/BasisTheoryTokenize.js +0 -9
  60. package/tokens/BasisTheoryTokens.d.ts +6 -5
  61. package/tokens/index.d.ts +0 -1
  62. package/tokens/index.js +1 -18
  63. package/types.d.ts +10 -11
  64. package/applications/types.d.ts +0 -18
  65. package/applications/types.js +0 -8
  66. package/atomic/BasisTheoryAtomic.d.ts +0 -16
  67. package/atomic/BasisTheoryAtomic.js +0 -33
  68. package/atomic/banks/types.d.ts +0 -13
  69. package/atomic/banks/types.js +0 -1
  70. package/atomic/cards/types.d.ts +0 -15
  71. package/atomic/cards/types.js +0 -1
  72. package/atomic/types.d.ts +0 -18
  73. package/atomic/types.js +0 -1
  74. package/common/elements.d.ts +0 -2
  75. package/logs/types.d.ts +0 -18
  76. package/logs/types.js +0 -1
  77. package/permissions/types.d.ts +0 -10
  78. package/permissions/types.js +0 -8
  79. package/reactor-formulas/types.d.ts +0 -33
  80. package/reactor-formulas/types.js +0 -1
  81. package/reactors/types.d.ts +0 -21
  82. package/reactors/types.js +0 -1
  83. package/tenants/types.d.ts +0 -20
  84. package/tenants/types.js +0 -1
  85. package/tokenize/types.d.ts +0 -7
  86. package/tokenize/types.js +0 -1
  87. package/tokens/types.d.ts +0 -36
  88. package/tokens/types.js +0 -1
package/BasisTheory.d.ts CHANGED
@@ -1,23 +1,12 @@
1
- import { BasisTheoryApplications } from './applications';
2
- import { BasisTheoryAtomic } from './atomic';
3
- import { BasisTheoryAtomicBanks } from './atomic/banks';
4
- import { BasisTheoryAtomicCards } from './atomic/cards';
5
- import type { BasisTheoryElements } from './elements';
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';
6
3
  import { BasisTheoryEncryptionAdapters } from './encryption/BasisTheoryEncryptionAdapters';
7
- import { BasisTheoryLogs } from './logs';
8
- import { BasisTheoryPermissions } from './permissions';
9
- import { BasisTheoryReactorFormulas } from './reactor-formulas';
10
- import { BasisTheoryReactors } from './reactors';
11
- import { BasisTheoryTenants } from './tenants';
12
- import { BasisTheoryTokenize } from './tokenize';
13
- import { BasisTheoryTokens } from './tokens';
14
- import type { BasisTheoryInitOptions } from './types';
15
- export declare class BasisTheory {
4
+ import type { BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements } from './types';
5
+ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
16
6
  private _initStatus;
17
7
  private _initOptions?;
18
8
  private _tokens?;
19
9
  private _tokenize?;
20
- private _atomic?;
21
10
  private _encryption?;
22
11
  private _elements?;
23
12
  private _applications?;
@@ -28,21 +17,28 @@ export declare class BasisTheory {
28
17
  private _atomicBanks?;
29
18
  private _atomicCards?;
30
19
  private _permissions?;
31
- init(apiKey: string, options?: BasisTheoryInitOptions): Promise<BasisTheory>;
20
+ init(apiKey: string, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
21
+ init(apiKey: string, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
22
+ createElement(type: ElementType, options: CustomizableElementOptions): CardElement | TextElement;
32
23
  private loadElements;
33
24
  get initOptions(): Required<BasisTheoryInitOptions>;
34
- get tokens(): BasisTheoryTokens;
35
- get tokenize(): BasisTheoryTokenize;
36
- get atomic(): BasisTheoryAtomic;
25
+ get tokens(): Tokens & ElementsTokens;
26
+ get tokenize(): Tokenize & ElementsTokenize;
27
+ /**
28
+ * @deprecated
29
+ */
37
30
  get encryption(): BasisTheoryEncryptionAdapters;
38
- get applications(): BasisTheoryApplications;
39
- get tenants(): BasisTheoryTenants;
40
- get logs(): BasisTheoryLogs;
41
- get reactorFormulas(): BasisTheoryReactorFormulas;
42
- get reactors(): BasisTheoryReactors;
43
- get atomicBanks(): BasisTheoryAtomicBanks;
44
- get atomicCards(): BasisTheoryAtomicCards;
45
- get permissions(): BasisTheoryPermissions;
31
+ get applications(): Applications;
32
+ get tenants(): Tenants;
33
+ get logs(): Logs;
34
+ get reactorFormulas(): ReactorFormulas;
35
+ get reactors(): Reactors;
36
+ get atomicBanks(): AtomicBanks & ElementsAtomicBanks;
37
+ get atomicCards(): AtomicCards & ElementsAtomicCards;
38
+ get permissions(): Permissions;
39
+ /**
40
+ * @deprecated
41
+ */
46
42
  get elements(): BasisTheoryElements;
47
43
  set elements(elements: BasisTheoryElements);
48
44
  }
package/BasisTheory.js CHANGED
@@ -7,16 +7,14 @@ exports.BasisTheory = void 0;
7
7
 
8
8
  var _applications = require("./applications");
9
9
 
10
- var _atomic = require("./atomic");
11
-
12
- var _banks = require("./atomic/banks");
13
-
14
- var _cards = require("./atomic/cards");
15
-
16
10
  var _common = require("./common");
17
11
 
18
12
  var _constants = require("./common/constants");
19
13
 
14
+ var _elements = require("./elements");
15
+
16
+ var _constants2 = require("./elements/constants");
17
+
20
18
  var _BasisTheoryEncryptionAdapters = require("./encryption/BasisTheoryEncryptionAdapters");
21
19
 
22
20
  var _logs = require("./logs");
@@ -29,16 +27,11 @@ var _reactors = require("./reactors");
29
27
 
30
28
  var _tenants = require("./tenants");
31
29
 
32
- var _tokenize = require("./tokenize");
33
-
34
- var _tokens = require("./tokens");
35
-
36
30
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
31
 
38
32
  const defaultInitOptions = {
39
33
  apiBaseUrl: _constants.DEFAULT_BASE_URL,
40
- elements: false,
41
- elementsBaseUrl: _constants.DEFAULT_ELEMENTS_BASE_URL
34
+ elements: false
42
35
  };
43
36
 
44
37
  class BasisTheory {
@@ -73,18 +66,18 @@ class BasisTheory {
73
66
  throw new Error('Invalid format for the given API base url.');
74
67
  }
75
68
 
76
- this._tokens = new _tokens.BasisTheoryTokens({
69
+ if (this._initOptions.elements) {
70
+ await this.loadElements(apiKey);
71
+ }
72
+
73
+ this._tokens = new ((0, _elements.delegateTokens)(this._elements))({
77
74
  apiKey,
78
75
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.tokens, baseUrl).toString()
79
76
  });
80
- this._tokenize = new _tokenize.BasisTheoryTokenize({
77
+ this._tokenize = new ((0, _elements.delegateTokenize)(this._elements))({
81
78
  apiKey,
82
79
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.tokenize, baseUrl).toString()
83
80
  });
84
- this._atomic = new _atomic.BasisTheoryAtomic({
85
- apiKey,
86
- baseURL: new URL(_constants.CLIENT_BASE_PATHS.atomic, baseUrl).toString()
87
- });
88
81
  this._applications = new _applications.BasisTheoryApplications({
89
82
  apiKey,
90
83
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.applications, baseUrl).toString()
@@ -105,11 +98,11 @@ class BasisTheory {
105
98
  apiKey,
106
99
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.reactors, baseUrl).toString()
107
100
  });
108
- this._atomicBanks = new _banks.BasisTheoryAtomicBanks({
101
+ this._atomicBanks = new ((0, _elements.delegateAtomicBanks)(this._elements))({
109
102
  apiKey,
110
103
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.atomicBanks, baseUrl).toString()
111
104
  });
112
- this._atomicCards = new _cards.BasisTheoryAtomicCards({
105
+ this._atomicCards = new ((0, _elements.delegateAtomicCards)(this._elements))({
113
106
  apiKey,
114
107
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.atomicCards, baseUrl).toString()
115
108
  });
@@ -118,11 +111,6 @@ class BasisTheory {
118
111
  baseURL: new URL(_constants.CLIENT_BASE_PATHS.permissions, baseUrl).toString()
119
112
  });
120
113
  this._encryption = new _BasisTheoryEncryptionAdapters.BasisTheoryEncryptionAdapters();
121
-
122
- if (this._initOptions.elements) {
123
- await this.loadElements(apiKey);
124
- }
125
-
126
114
  this._initStatus = 'done';
127
115
  } catch (error) {
128
116
  this._initStatus = 'error';
@@ -132,16 +120,27 @@ class BasisTheory {
132
120
  return this;
133
121
  }
134
122
 
123
+ createElement(type, options) {
124
+ if (!this._elements) {
125
+ throw new Error(_constants2.ELEMENTS_INIT_ERROR_MESSAGE);
126
+ } // the cast below is to avoid unnecessary conditional calls to elements
127
+ // the underlying elements function called will be the same, no matter the
128
+ // element type
129
+
130
+
131
+ return this._elements.createElement(type, options);
132
+ }
133
+
135
134
  async loadElements(apiKey) {
136
135
  let elementsBaseUrl;
137
136
 
138
137
  try {
139
- elementsBaseUrl = new URL(this.initOptions.elementsBaseUrl);
138
+ elementsBaseUrl = new URL(this.initOptions.elementsBaseUrl || _constants.DEFAULT_ELEMENTS_BASE_URL);
140
139
  } catch {
141
140
  throw new Error('Invalid format for the given Elements base url.');
142
141
  }
143
142
 
144
- const elements = await (0, _common.loadElements)();
143
+ const elements = await (0, _elements.loadElements)();
145
144
  await elements.init(apiKey, elementsBaseUrl.toString().replace(/\/$/u, ''));
146
145
  this.elements = elements;
147
146
  } // these should be set by the init call only.
@@ -160,10 +159,10 @@ class BasisTheory {
160
159
  get tokenize() {
161
160
  return (0, _common.assertInit)(this._tokenize);
162
161
  }
162
+ /**
163
+ * @deprecated
164
+ */
163
165
 
164
- get atomic() {
165
- return (0, _common.assertInit)(this._atomic);
166
- }
167
166
 
168
167
  get encryption() {
169
168
  return (0, _common.assertInit)(this._encryption);
@@ -202,6 +201,10 @@ class BasisTheory {
202
201
  }
203
202
  /* eslint-enable accessor-pairs */
204
203
 
204
+ /**
205
+ * @deprecated
206
+ */
207
+
205
208
 
206
209
  get elements() {
207
210
  return (0, _common.assertInit)(this._elements);
package/README.md CHANGED
@@ -35,7 +35,7 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED'); // replac
35
35
 
36
36
  ### Per-request configuration
37
37
 
38
- All of the service methods accept an optional `RequestOptions` object. This is used if you want to set a correlation ID or if you want to set a per-request X-API-KEY
38
+ All of the service methods accept an optional `RequestOptions` object. This is used if you want to set a correlation ID or if you want to set a per-request `BT-API-KEY`
39
39
 
40
40
  ```javascript
41
41
  import { v4 as uuid } from 'uuid';
@@ -61,6 +61,10 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED', {
61
61
  }); // replace with your application key and api base URL.
62
62
  ```
63
63
 
64
+ ### Elements
65
+
66
+ Please, refer to the [Elements Documentation](https://docs.basistheory.com/elements) on how to use it.
67
+
64
68
  ## Development
65
69
 
66
70
  The provided scripts with the SDK will check for all dependencies, start docker, build the solution, and run all tests.
@@ -1,5 +1,5 @@
1
- import { RequestOptions } from '../service';
2
- import type { Application, ApplicationQuery, CreateApplicationModel } from './types';
1
+ import type { Application, CreateApplication } from '@basis-theory/basis-theory-elements-interfaces/models';
2
+ import type { ListApplicationsQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  export declare const BasisTheoryApplications: {
4
4
  new (options: import("../service/types").BasisTheoryServiceOptions): {
5
5
  /**
@@ -10,5 +10,5 @@ export declare const BasisTheoryApplications: {
10
10
  regenerateKey(id: string, options?: RequestOptions | undefined): Promise<Application>;
11
11
  readonly client: import("axios").AxiosInstance;
12
12
  };
13
- } & (new (...args: any[]) => import("../service/CrudBuilder").ICreate<Application, CreateApplicationModel>) & (new (...args: any[]) => import("../service/CrudBuilder").IRetrieve<Application>) & (new (...args: any[]) => import("../service/CrudBuilder").IUpdate<Application, Partial<Pick<Application, "permissions" | "name">>>) & (new (...args: any[]) => import("../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../service/CrudBuilder").IList<Application, ApplicationQuery>);
13
+ } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<Application, CreateApplication>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<Application>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<Application, Partial<Pick<Application, "permissions" | "name">>>) & (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<Application, ListApplicationsQuery>);
14
14
  export declare type BasisTheoryApplications = InstanceType<typeof BasisTheoryApplications>;
@@ -1,2 +1 @@
1
- export * from './types';
2
1
  export { BasisTheoryApplications } from './BasisTheoryApplications';
@@ -3,9 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- BasisTheoryApplications: true
8
- };
9
6
  Object.defineProperty(exports, "BasisTheoryApplications", {
10
7
  enumerable: true,
11
8
  get: function () {
@@ -13,18 +10,4 @@ Object.defineProperty(exports, "BasisTheoryApplications", {
13
10
  }
14
11
  });
15
12
 
16
- var _types = require("./types");
17
-
18
- Object.keys(_types).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
- if (key in exports && exports[key] === _types[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _types[key];
26
- }
27
- });
28
- });
29
-
30
13
  var _BasisTheoryApplications = require("./BasisTheoryApplications");
@@ -1,12 +1,12 @@
1
- import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
2
- import type { ReactRequest, ReactResponse } from '../types';
3
- import type { AtomicBank, UpdateAtomicBankModel } from './types';
1
+ import type { AtomicBank, ReactRequest, ReactResponse, UpdateAtomicBank } from '@basis-theory/basis-theory-elements-interfaces/models';
2
+ import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
+ import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicBanks: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
- update(id: string, request: UpdateAtomicBankModel, options?: RequestOptions | undefined): Promise<AtomicBank>;
6
+ update(id: string, request: UpdateAtomicBank, options?: RequestOptions | undefined): Promise<AtomicBank>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicBank>;
8
8
  react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
- } & (new (...args: any[]) => import("../../service/CrudBuilder").ICreate<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("../../service/CrudBuilder").IRetrieve<AtomicBank>) & (new (...args: any[]) => import("../../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../../service/CrudBuilder").IList<AtomicBank, PaginatedQuery>);
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>);
12
12
  export declare type BasisTheoryAtomicBanks = InstanceType<typeof BasisTheoryAtomicBanks>;
@@ -1,2 +1 @@
1
- export * from './types';
2
1
  export { BasisTheoryAtomicBanks } from './BasisTheoryAtomicBanks';
@@ -3,9 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- BasisTheoryAtomicBanks: true
8
- };
9
6
  Object.defineProperty(exports, "BasisTheoryAtomicBanks", {
10
7
  enumerable: true,
11
8
  get: function () {
@@ -13,18 +10,4 @@ Object.defineProperty(exports, "BasisTheoryAtomicBanks", {
13
10
  }
14
11
  });
15
12
 
16
- var _types = require("./types");
17
-
18
- Object.keys(_types).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
- if (key in exports && exports[key] === _types[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _types[key];
26
- }
27
- });
28
- });
29
-
30
13
  var _BasisTheoryAtomicBanks = require("./BasisTheoryAtomicBanks");
@@ -1,12 +1,12 @@
1
- import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
2
- import type { ReactRequest, ReactResponse } from '../types';
3
- import type { AtomicCard, UpdateAtomicCardModel } from './types';
1
+ import type { AtomicCard, ReactRequest, ReactResponse, UpdateAtomicCard } from '@basis-theory/basis-theory-elements-interfaces/models';
2
+ import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
+ import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicCards: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
- update(id: string, request: UpdateAtomicCardModel, options?: RequestOptions | undefined): Promise<AtomicCard>;
6
+ update(id: string, request: UpdateAtomicCard, options?: RequestOptions | undefined): Promise<AtomicCard>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicCard>;
8
8
  react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
- } & (new (...args: any[]) => import("../../service/CrudBuilder").ICreate<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("../../service/CrudBuilder").IRetrieve<AtomicCard>) & (new (...args: any[]) => import("../../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../../service/CrudBuilder").IList<AtomicCard, PaginatedQuery>);
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>);
12
12
  export declare type BasisTheoryAtomicCards = InstanceType<typeof BasisTheoryAtomicCards>;
@@ -1,2 +1 @@
1
- export * from './types';
2
1
  export { BasisTheoryAtomicCards } from './BasisTheoryAtomicCards';
@@ -3,9 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- BasisTheoryAtomicCards: true
8
- };
9
6
  Object.defineProperty(exports, "BasisTheoryAtomicCards", {
10
7
  enumerable: true,
11
8
  get: function () {
@@ -13,18 +10,4 @@ Object.defineProperty(exports, "BasisTheoryAtomicCards", {
13
10
  }
14
11
  });
15
12
 
16
- var _types = require("./types");
17
-
18
- Object.keys(_types).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
- if (key in exports && exports[key] === _types[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _types[key];
26
- }
27
- });
28
- });
29
-
30
13
  var _BasisTheoryAtomicCards = require("./BasisTheoryAtomicCards");
package/atomic/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './BasisTheoryAtomic';
2
- export * from './types';
1
+ export * from './banks';
2
+ export * from './cards';
package/atomic/index.js CHANGED
@@ -4,28 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var _BasisTheoryAtomic = require("./BasisTheoryAtomic");
7
+ var _banks = require("./banks");
8
8
 
9
- Object.keys(_BasisTheoryAtomic).forEach(function (key) {
9
+ Object.keys(_banks).forEach(function (key) {
10
10
  if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _BasisTheoryAtomic[key]) return;
11
+ if (key in exports && exports[key] === _banks[key]) return;
12
12
  Object.defineProperty(exports, key, {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _BasisTheoryAtomic[key];
15
+ return _banks[key];
16
16
  }
17
17
  });
18
18
  });
19
19
 
20
- var _types = require("./types");
20
+ var _cards = require("./cards");
21
21
 
22
- Object.keys(_types).forEach(function (key) {
22
+ Object.keys(_cards).forEach(function (key) {
23
23
  if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _types[key]) return;
24
+ if (key in exports && exports[key] === _cards[key]) return;
25
25
  Object.defineProperty(exports, key, {
26
26
  enumerable: true,
27
27
  get: function () {
28
- return _types[key];
28
+ return _cards[key];
29
29
  }
30
30
  });
31
31
  });
@@ -1,5 +1,5 @@
1
1
  import type { ClientsBasePathMap } from '../types';
2
- declare const API_KEY_HEADER = "X-API-KEY";
2
+ declare const API_KEY_HEADER = "BT-API-KEY";
3
3
  declare const BT_TRACE_ID_HEADER = "bt-trace-id";
4
4
  declare const DEFAULT_BASE_URL: string;
5
5
  declare const DEFAULT_ELEMENTS_BASE_URL: string;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_ELEMENTS_BASE_URL = exports.DEFAULT_BASE_URL = exports.CLIENT_BASE_PATHS = exports.BT_TRACE_ID_HEADER = exports.API_KEY_HEADER = void 0;
7
- const API_KEY_HEADER = 'X-API-KEY';
7
+ const API_KEY_HEADER = 'BT-API-KEY';
8
8
  exports.API_KEY_HEADER = API_KEY_HEADER;
9
9
  const BT_TRACE_ID_HEADER = 'bt-trace-id';
10
10
  exports.BT_TRACE_ID_HEADER = BT_TRACE_ID_HEADER;
@@ -15,7 +15,6 @@ exports.DEFAULT_ELEMENTS_BASE_URL = DEFAULT_ELEMENTS_BASE_URL;
15
15
  const CLIENT_BASE_PATHS = {
16
16
  tokens: 'tokens',
17
17
  tokenize: 'tokenize',
18
- atomic: 'atomic',
19
18
  applications: 'applications',
20
19
  tenants: 'tenants/self',
21
20
  logs: 'logs',
package/common/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './utils';
3
- export * from './elements';
4
3
  export * from './BasisTheoryApiError';
package/common/index.js CHANGED
@@ -30,19 +30,6 @@ Object.keys(_utils).forEach(function (key) {
30
30
  });
31
31
  });
32
32
 
33
- var _elements = require("./elements");
34
-
35
- Object.keys(_elements).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _elements[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _elements[key];
42
- }
43
- });
44
- });
45
-
46
33
  var _BasisTheoryApiError = require("./BasisTheoryApiError");
47
34
 
48
35
  Object.keys(_BasisTheoryApiError).forEach(function (key) {
package/common/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import type { RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk/services';
1
2
  import type { AxiosRequestConfig, AxiosResponse, AxiosTransformer } from 'axios';
2
- import type { RequestOptions } from '../service';
3
3
  declare const assertInit: <T>(prop: T) => NonNullable<T>;
4
4
  declare const transformRequestSnakeCase: AxiosTransformer;
5
5
  declare const proxyRaw: AxiosTransformer;
package/common/utils.js CHANGED
@@ -89,9 +89,6 @@ const transformTokenRequestSnakeCase = token => {
89
89
  ...(token.data !== undefined ? {
90
90
  data: token.data
91
91
  } : {}),
92
- ...(token.mask !== undefined ? {
93
- mask: token.mask
94
- } : {}),
95
92
  ...(token.metadata !== undefined ? {
96
93
  metadata: token.metadata
97
94
  } : {})
@@ -128,9 +125,6 @@ const transformTokenResponseCamelCase = token => {
128
125
  ...(token.data !== undefined ? {
129
126
  data: token.data
130
127
  } : {}),
131
- ...(token.mask !== undefined ? {
132
- mask: token.mask
133
- } : {}),
134
128
  ...(token.metadata !== undefined ? {
135
129
  metadata: token.metadata
136
130
  } : {})
@@ -0,0 +1,5 @@
1
+ declare const ELEMENTS_INIT_ERROR_MESSAGE = "BasisTheory Elements was not properly initialized.";
2
+ declare const ELEMENTS_NOM_DOM_ERROR_MESSAGE = "Tried to load BasisTheoryElements in a non-DOM environment.";
3
+ declare const ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = "BasisTheoryElements did not load properly.";
4
+ declare const ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = "There was an unknown error when loading BasisTheoryElements";
5
+ export { ELEMENTS_INIT_ERROR_MESSAGE, ELEMENTS_NOM_DOM_ERROR_MESSAGE, ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE, ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE, };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = exports.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = exports.ELEMENTS_NOM_DOM_ERROR_MESSAGE = exports.ELEMENTS_INIT_ERROR_MESSAGE = void 0;
7
+ const ELEMENTS_INIT_ERROR_MESSAGE = 'BasisTheory Elements was not properly initialized.';
8
+ exports.ELEMENTS_INIT_ERROR_MESSAGE = ELEMENTS_INIT_ERROR_MESSAGE;
9
+ const ELEMENTS_NOM_DOM_ERROR_MESSAGE = 'Tried to load BasisTheoryElements in a non-DOM environment.';
10
+ exports.ELEMENTS_NOM_DOM_ERROR_MESSAGE = ELEMENTS_NOM_DOM_ERROR_MESSAGE;
11
+ const ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = 'BasisTheoryElements did not load properly.';
12
+ exports.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE;
13
+ const ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = 'There was an unknown error when loading BasisTheoryElements';
14
+ exports.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE;
@@ -1,6 +1,3 @@
1
- interface BasisTheoryElements {
2
- }
3
- interface BasisTheoryElementsInit extends BasisTheoryElements {
4
- init: (apiKey: string, elementsBaseUrl: string) => Promise<BasisTheoryElements>;
5
- }
6
- export type { BasisTheoryElements, BasisTheoryElementsInit };
1
+ export * from './services';
2
+ export * from './script';
3
+ export * from './load';
package/elements/index.js CHANGED
@@ -1 +1,44 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _services = require("./services");
8
+
9
+ Object.keys(_services).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _services[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _services[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _script = require("./script");
21
+
22
+ Object.keys(_script).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _script[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _script[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _load = require("./load");
34
+
35
+ Object.keys(_load).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _load[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _load[key];
42
+ }
43
+ });
44
+ });
@@ -0,0 +1,3 @@
1
+ import { BasisTheoryElements } from '@basis-theory/basis-theory-elements-interfaces/elements';
2
+ declare const loadElements: () => Promise<BasisTheoryElements>;
3
+ export { loadElements };
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.loadElements = void 0;
7
7
 
8
+ var _constants = require("./constants");
9
+
8
10
  var _script = require("./script");
9
11
 
10
12
  let elementsPromise;
@@ -13,7 +15,7 @@ const loadElements = () => {
13
15
  if (!elementsPromise) {
14
16
  elementsPromise = new Promise((resolve, reject) => {
15
17
  if (typeof window !== 'object') {
16
- reject(new Error('Tried to load BasisTheoryElements in a non-DOM environment.'));
18
+ reject(new Error(_constants.ELEMENTS_NOM_DOM_ERROR_MESSAGE));
17
19
  return;
18
20
  }
19
21
 
@@ -34,11 +36,11 @@ const loadElements = () => {
34
36
  if (window.BasisTheoryElements) {
35
37
  resolve(window.BasisTheoryElements);
36
38
  } else {
37
- reject(new Error('BasisTheoryElements did not load properly.'));
39
+ reject(new Error(_constants.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE));
38
40
  }
39
41
  });
40
42
  script.addEventListener('error', event => {
41
- reject((event === null || event === void 0 ? void 0 : event.error) || new Error('There was an unknown error when loading BasisTheoryElements'));
43
+ reject((event === null || event === void 0 ? void 0 : event.error) || new Error(_constants.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE));
42
44
  });
43
45
  } catch (error) {
44
46
  reject(error);
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ import type { AtomicBanks as ElementsAtomicBanks, BasisTheoryElementsInternal } from '@basis-theory/basis-theory-elements-interfaces/elements';
2
+ import type { AtomicBanks } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
+ import { BasisTheoryAtomicBanks } from '../../atomic';
4
+ declare const delegateAtomicBanks: (elements?: BasisTheoryElementsInternal | undefined) => new (options: import("../../service/types").BasisTheoryServiceOptions) => ElementsAtomicBanks & AtomicBanks;
5
+ export { delegateAtomicBanks };