@basis-theory/basis-theory-js 4.8.0 → 4.9.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 +4 -2
- package/BasisTheory.js +9 -0
- package/common/constants.js +2 -1
- package/elements/services/index.d.ts +1 -0
- package/elements/services/index.js +13 -0
- package/elements/services/token-intents.d.ts +5 -0
- package/elements/services/token-intents.js +21 -0
- package/package.json +1 -1
- package/token-intents/BasisTheoryTokenIntents.d.ts +7 -0
- package/token-intents/BasisTheoryTokenIntents.js +13 -0
- package/token-intents/index.d.ts +1 -0
- package/token-intents/index.js +13 -0
- package/types/elements/elements.d.ts +2 -1
- package/types/elements/services/index.d.ts +1 -0
- package/types/elements/services/index.js +13 -0
- package/types/elements/services/token-intents.d.ts +6 -0
- package/types/elements/services/token-intents.js +1 -0
- package/types/models/index.d.ts +1 -0
- package/types/models/index.js +13 -0
- package/types/models/token-intents.d.ts +22 -0
- package/types/models/token-intents.js +1 -0
- package/types/sdk/sdk.d.ts +2 -1
- package/types/sdk/services/index.d.ts +1 -0
- package/types/sdk/services/index.js +13 -0
- package/types/sdk/services/token-intents.d.ts +5 -0
- package/types/sdk/services/token-intents.js +1 -0
package/BasisTheory.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BasisTheoryElements, CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from './types/elements';
|
|
1
|
+
import type { BasisTheoryElements, CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens, TokenIntents as ElementsTokenIntents } from './types/elements';
|
|
2
2
|
import type { TokenizeData } from './types/models';
|
|
3
|
-
import type { ApplicationKeys, Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, ThreeDS, Tokens } from './types/sdk';
|
|
3
|
+
import type { ApplicationKeys, Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, ThreeDS, TokenIntents, Tokens } from './types/sdk';
|
|
4
4
|
export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
|
|
5
5
|
private _initStatus;
|
|
6
6
|
private _applicationKeys?;
|
|
@@ -19,6 +19,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
19
19
|
private _threeds?;
|
|
20
20
|
private _tokenize?;
|
|
21
21
|
private _tokens?;
|
|
22
|
+
private _tokenIntents?;
|
|
22
23
|
init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
|
|
23
24
|
init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
24
25
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
@@ -47,6 +48,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
47
48
|
get proxy(): Proxy;
|
|
48
49
|
get sessions(): Sessions;
|
|
49
50
|
get threeds(): ThreeDS;
|
|
51
|
+
get tokenIntents(): TokenIntents & ElementsTokenIntents;
|
|
50
52
|
/**
|
|
51
53
|
* @deprecated
|
|
52
54
|
*/
|
package/BasisTheory.js
CHANGED
|
@@ -149,6 +149,11 @@ class BasisTheory {
|
|
|
149
149
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.threeds, baseUrl).toString(),
|
|
150
150
|
appInfo
|
|
151
151
|
});
|
|
152
|
+
this._tokenIntents = new ((0, _elements.delegateTokenIntents)(this._elements))({
|
|
153
|
+
apiKey,
|
|
154
|
+
baseURL: new URL(_common.CLIENT_BASE_PATHS.tokenIntents, baseUrl).toString(),
|
|
155
|
+
appInfo
|
|
156
|
+
});
|
|
152
157
|
this._initStatus = 'done';
|
|
153
158
|
} catch (error) {
|
|
154
159
|
this._initStatus = 'error';
|
|
@@ -260,6 +265,10 @@ class BasisTheory {
|
|
|
260
265
|
get threeds() {
|
|
261
266
|
return (0, _common.assertInit)(this._threeds);
|
|
262
267
|
}
|
|
268
|
+
|
|
269
|
+
get tokenIntents() {
|
|
270
|
+
return (0, _common.assertInit)(this._tokenIntents);
|
|
271
|
+
}
|
|
263
272
|
/* eslint-enable accessor-pairs */
|
|
264
273
|
|
|
265
274
|
/**
|
package/common/constants.js
CHANGED
|
@@ -41,4 +41,17 @@ Object.keys(_proxy).forEach(function (key) {
|
|
|
41
41
|
return _proxy[key];
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _tokenIntents = require("./token-intents");
|
|
47
|
+
|
|
48
|
+
Object.keys(_tokenIntents).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _tokenIntents[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _tokenIntents[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
44
57
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BasisTheoryTokenIntents } from '../../token-intents';
|
|
2
|
+
import type { TokenIntents as ElementsTokenIntents, BasisTheoryElementsInternal } from '../../types/elements';
|
|
3
|
+
import type { TokenIntents } from '../../types/sdk';
|
|
4
|
+
declare const delegateTokenIntents: (elements?: BasisTheoryElementsInternal) => new (options: import("../../service/types").BasisTheoryServiceOptions) => ElementsTokenIntents & TokenIntents;
|
|
5
|
+
export { delegateTokenIntents };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.delegateTokenIntents = void 0;
|
|
7
|
+
|
|
8
|
+
var _tokenIntents = require("./../../token-intents");
|
|
9
|
+
|
|
10
|
+
const delegateTokenIntents = elements => class BasisTheoryTokenIntentsElementsDelegate extends _tokenIntents.BasisTheoryTokenIntents {
|
|
11
|
+
create(payload, requestOptions) {
|
|
12
|
+
if (elements !== null && elements !== void 0 && elements.hasElement(payload)) {
|
|
13
|
+
return elements.tokenIntents.create(payload, requestOptions);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return super.create(payload, requestOptions);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.delegateTokenIntents = delegateTokenIntents;
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TokenIntent, CreateTokenIntent } from '../types/models';
|
|
2
|
+
export declare const BasisTheoryTokenIntents: {
|
|
3
|
+
new (options: import("../service/types").BasisTheoryServiceOptions): {
|
|
4
|
+
readonly client: import("axios").AxiosInstance;
|
|
5
|
+
};
|
|
6
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<TokenIntent<import("../types/models/tokens").DataObject>, CreateTokenIntent>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete);
|
|
7
|
+
export type BasisTheoryTokenIntents = InstanceType<typeof BasisTheoryTokenIntents>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BasisTheoryTokenIntents = void 0;
|
|
7
|
+
|
|
8
|
+
var _service = require("./../service");
|
|
9
|
+
|
|
10
|
+
var _CrudBuilder = require("./../service/CrudBuilder");
|
|
11
|
+
|
|
12
|
+
const BasisTheoryTokenIntents = new _CrudBuilder.CrudBuilder(class BasisTheoryTokenIntents extends _service.BasisTheoryService {}).create().delete().build();
|
|
13
|
+
exports.BasisTheoryTokenIntents = BasisTheoryTokenIntents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BasisTheoryTokenIntents } from './BasisTheoryTokenIntents';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BasisTheoryTokenIntents", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BasisTheoryTokenIntents.BasisTheoryTokenIntents;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _BasisTheoryTokenIntents = require("./BasisTheoryTokenIntents");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HttpClient } from '../../types/sdk';
|
|
2
2
|
import type { CardElementEvents, CardExpirationDateElementEvents, CardNumberElementEvents, CardVerificationCodeElementEvents, ElementEventListener, EventType, Subscription, TextElementEvents } from './events';
|
|
3
3
|
import type { CardElementValue, CardExpirationDateValue, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardNumberElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions } from './options';
|
|
4
|
-
import type { Proxy, Tokenize, Tokens } from './services';
|
|
4
|
+
import type { Proxy, Tokenize, Tokens, TokenIntents } from './services';
|
|
5
5
|
import type { CardMetadata, DataElementReference, ElementMetadata } from './shared';
|
|
6
6
|
interface BaseElement<UpdateOptions, ElementEvents> {
|
|
7
7
|
readonly mounted: boolean;
|
|
@@ -50,6 +50,7 @@ type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirati
|
|
|
50
50
|
interface BasisTheoryElements extends Tokenize {
|
|
51
51
|
tokens: Tokens;
|
|
52
52
|
proxy: Proxy;
|
|
53
|
+
tokenIntents: TokenIntents;
|
|
53
54
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
54
55
|
createElement(type: 'text', options: CreateTextElementOptions): TextElement;
|
|
55
56
|
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): CardNumberElement;
|
|
@@ -41,4 +41,17 @@ Object.keys(_proxy).forEach(function (key) {
|
|
|
41
41
|
return _proxy[key];
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _tokenIntents = require("./token-intents");
|
|
47
|
+
|
|
48
|
+
Object.keys(_tokenIntents).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _tokenIntents[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _tokenIntents[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
44
57
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ElementValue } from '../../../types/elements';
|
|
2
|
+
import type { CreateTokenIntent as CreateTokenIntentModel, TokenIntent } from '../../../types/models';
|
|
3
|
+
import type { Create } from '../../../types/sdk';
|
|
4
|
+
type CreateTokenIntent = CreateTokenIntentModel<ElementValue>;
|
|
5
|
+
type TokenIntents = Create<TokenIntent, CreateTokenIntent>;
|
|
6
|
+
export type { TokenIntents, CreateTokenIntent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/types/models/index.d.ts
CHANGED
package/types/models/index.js
CHANGED
|
@@ -184,4 +184,17 @@ Object.keys(_util).forEach(function (key) {
|
|
|
184
184
|
return _util[key];
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
var _tokenIntents = require("./token-intents");
|
|
190
|
+
|
|
191
|
+
Object.keys(_tokenIntents).forEach(function (key) {
|
|
192
|
+
if (key === "default" || key === "__esModule") return;
|
|
193
|
+
if (key in exports && exports[key] === _tokenIntents[key]) return;
|
|
194
|
+
Object.defineProperty(exports, key, {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () {
|
|
197
|
+
return _tokenIntents[key];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
187
200
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DataObject, TokenData, Auditable, TokenType } from '../../types/models';
|
|
2
|
+
interface TokenIntentCardDetails {
|
|
3
|
+
cardDetails: {
|
|
4
|
+
bin: string;
|
|
5
|
+
last4: string;
|
|
6
|
+
brand: string;
|
|
7
|
+
type: string;
|
|
8
|
+
expirationMonth: string;
|
|
9
|
+
expirationYear: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface TokenIntent<DataType = DataObject> extends Omit<Auditable, 'modifiedAt' | 'modifiedBy'> {
|
|
13
|
+
data: TokenData<DataType>;
|
|
14
|
+
type: TokenType;
|
|
15
|
+
enrichments?: TokenIntentCardDetails;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
}
|
|
19
|
+
type CreateTokenIntent<DataType = DataObject> = Pick<TokenIntent<DataType>, 'type' | 'data'> & {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
export type { TokenIntent, CreateTokenIntent, TokenIntentCardDetails };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/types/sdk/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from '../../types/elements';
|
|
2
|
-
import type { Applications, ApplicationTemplates, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, Sessions, Tenants, Tokenize, Tokens, ThreeDS } from './services';
|
|
2
|
+
import type { Applications, ApplicationTemplates, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, Sessions, Tenants, Tokenize, Tokens, ThreeDS, TokenIntents } from './services';
|
|
3
3
|
import { ApplicationKeys } from './services/applicationKeys';
|
|
4
4
|
interface ApplicationInfo {
|
|
5
5
|
name?: string;
|
|
@@ -43,6 +43,7 @@ interface BasisTheory extends Tokenize {
|
|
|
43
43
|
tenants: Tenants;
|
|
44
44
|
tokens: Tokens;
|
|
45
45
|
threeds: ThreeDS;
|
|
46
|
+
tokenIntents: TokenIntents;
|
|
46
47
|
}
|
|
47
48
|
interface ClientUserAgent {
|
|
48
49
|
client: string;
|
|
@@ -210,4 +210,17 @@ Object.keys(_threeds).forEach(function (key) {
|
|
|
210
210
|
return _threeds[key];
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
var _tokenIntents = require("./token-intents");
|
|
216
|
+
|
|
217
|
+
Object.keys(_tokenIntents).forEach(function (key) {
|
|
218
|
+
if (key === "default" || key === "__esModule") return;
|
|
219
|
+
if (key in exports && exports[key] === _tokenIntents[key]) return;
|
|
220
|
+
Object.defineProperty(exports, key, {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () {
|
|
223
|
+
return _tokenIntents[key];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
213
226
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|