@basis-theory/basis-theory-js 1.79.2 → 1.79.3
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 +7 -8
- package/common/BasisTheoryClient.d.ts +4 -6
- package/package.json +1 -1
- package/types/elements/elements.d.ts +6 -13
- package/types/sdk/sdk.d.ts +3 -3
- package/types/sdk/services/http.d.ts +11 -0
- package/types/sdk/services/http.js +1 -0
- package/types/sdk/services/index.d.ts +1 -0
- package/types/sdk/services/index.js +13 -0
package/BasisTheory.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BasisTheoryElements, CardElement, CardNumberElement, CardExpirationDateElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardNumberElementOptions, CreateCardExpirationDateElementOptions, 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 } from './types/elements';
|
|
3
2
|
import type { TokenizeData } from './types/models';
|
|
4
|
-
import type { Applications, BasisTheory as IBasisTheory, BasisTheoryInit,
|
|
3
|
+
import type { Applications, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestConfig, RequestOptions, Sessions, Tenants, Tokens } from './types/sdk';
|
|
5
4
|
import { Transactions } from './types/sdk/services/transactions';
|
|
6
5
|
export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
|
|
7
6
|
private _initStatus;
|
|
@@ -27,11 +26,11 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
27
26
|
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): CardExpirationDateElement;
|
|
28
27
|
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
|
|
29
28
|
tokenize(tokens: TokenizeData & ElementsTokenizeData, options?: RequestOptions): Promise<TokenizeData>;
|
|
30
|
-
post(url: string, payload: unknown, config?:
|
|
31
|
-
put(url: string, payload: unknown, config?:
|
|
32
|
-
patch(url: string, payload: unknown, config?:
|
|
33
|
-
get(url: string, config?:
|
|
34
|
-
delete(url: string, config?:
|
|
29
|
+
post(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
30
|
+
put(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
31
|
+
patch(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
32
|
+
get(url: string, config?: RequestConfig): Promise<unknown>;
|
|
33
|
+
delete(url: string, config?: RequestConfig): Promise<unknown>;
|
|
35
34
|
private loadElements;
|
|
36
35
|
get initOptions(): Required<BasisTheoryInitOptions>;
|
|
37
36
|
get tokens(): Tokens & ElementsTokens;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { BasisTheoryElementsInternal } from '../types/elements';
|
|
2
|
-
type
|
|
3
|
-
headers?: Record<string, string>;
|
|
4
|
-
};
|
|
2
|
+
import type { RequestConfig } from '../types/sdk';
|
|
5
3
|
type MethodWithPayloads = 'post' | 'put' | 'patch';
|
|
6
4
|
type MethodWithoutPayloads = 'get' | 'delete';
|
|
7
|
-
declare const makeRequestWithElementsPayloadCheck: (elements: BasisTheoryElementsInternal | undefined, method: MethodWithPayloads, url: string, payload: unknown, config?:
|
|
8
|
-
declare const makeRequestWithoutElementsPayloadCheck: (elements: BasisTheoryElementsInternal | undefined, method: MethodWithoutPayloads, url: string, config?:
|
|
9
|
-
export {
|
|
5
|
+
declare const makeRequestWithElementsPayloadCheck: (elements: BasisTheoryElementsInternal | undefined, method: MethodWithPayloads, url: string, payload: unknown, config?: RequestConfig) => Promise<unknown>;
|
|
6
|
+
declare const makeRequestWithoutElementsPayloadCheck: (elements: BasisTheoryElementsInternal | undefined, method: MethodWithoutPayloads, url: string, config?: RequestConfig) => Promise<unknown>;
|
|
7
|
+
export { makeRequestWithElementsPayloadCheck, makeRequestWithoutElementsPayloadCheck, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions,
|
|
4
|
-
import type { Tokenize, Tokens
|
|
1
|
+
import type { HttpClient } from '../../types/sdk';
|
|
2
|
+
import type { CardElementEvents, CardExpirationDateElementEvents, CardNumberElementEvents, CardVerificationCodeElementEvents, ElementEventListener, EventType, Subscription, TextElementEvents } from './events';
|
|
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';
|
|
5
5
|
import type { CardMetadata, DataElementReference, ElementMetadata } from './shared';
|
|
6
6
|
interface BaseElement<UpdateOptions, ElementEvents> {
|
|
7
7
|
readonly mounted: boolean;
|
|
@@ -43,7 +43,7 @@ type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
|
|
46
|
-
interface BasisTheoryElements extends Tokenize {
|
|
46
|
+
interface BasisTheoryElements extends Tokenize, HttpClient {
|
|
47
47
|
tokens: Tokens;
|
|
48
48
|
proxy: Proxy;
|
|
49
49
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
@@ -52,17 +52,10 @@ interface BasisTheoryElements extends Tokenize {
|
|
|
52
52
|
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): CardExpirationDateElement;
|
|
53
53
|
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
|
|
54
54
|
}
|
|
55
|
-
interface ElementClient {
|
|
56
|
-
post(url: string, payload: unknown, config?: Config): Promise<unknown>;
|
|
57
|
-
put(url: string, payload: unknown, config?: Config): Promise<unknown>;
|
|
58
|
-
patch(url: string, payload: unknown, config?: Config): Promise<unknown>;
|
|
59
|
-
get(url: string, config?: Config): Promise<unknown>;
|
|
60
|
-
delete(url: string, config?: Config): Promise<unknown>;
|
|
61
|
-
}
|
|
62
55
|
interface BasisTheoryElementsInternal extends BasisTheoryElements {
|
|
63
56
|
init: (apiKey: string | undefined, elementsBaseUrl: string) => Promise<BasisTheoryElements>;
|
|
64
57
|
hasElement: (payload: unknown) => boolean;
|
|
65
|
-
client:
|
|
58
|
+
client: HttpClient;
|
|
66
59
|
}
|
|
67
60
|
declare global {
|
|
68
61
|
interface Window {
|
package/types/sdk/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from '../../types/elements';
|
|
2
2
|
import { Transactions } from '../../types/sdk/services/transactions';
|
|
3
|
-
import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy, Sessions } from './services';
|
|
3
|
+
import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy, Sessions, HttpClient } from './services';
|
|
4
4
|
interface ApplicationInfo {
|
|
5
5
|
name?: string;
|
|
6
6
|
version?: string;
|
|
@@ -22,7 +22,7 @@ interface BasisTheoryInit {
|
|
|
22
22
|
init(apiKey: string, options?: BasisTheoryInitOptionsWithoutElements): Promise<BasisTheory>;
|
|
23
23
|
init(apiKey: string, options: BasisTheoryInitOptionsWithElements): Promise<BasisTheory & BasisTheoryElements>;
|
|
24
24
|
}
|
|
25
|
-
interface BasisTheory extends Tokenize {
|
|
25
|
+
interface BasisTheory extends Tokenize, HttpClient {
|
|
26
26
|
tokens: Tokens;
|
|
27
27
|
applications: Applications;
|
|
28
28
|
tenants: Tenants;
|
|
@@ -42,7 +42,7 @@ interface ClientUserAgent {
|
|
|
42
42
|
runtimeVersion: string;
|
|
43
43
|
application?: ApplicationInfo;
|
|
44
44
|
}
|
|
45
|
-
type BasisTheoryServices = keyof BasisTheory
|
|
45
|
+
type BasisTheoryServices = keyof Omit<BasisTheory, keyof HttpClient>;
|
|
46
46
|
type BasisTheoryServicesBasePathMap = {
|
|
47
47
|
[key in BasisTheoryServices]: string;
|
|
48
48
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface RequestConfig {
|
|
2
|
+
headers?: Record<string, string>;
|
|
3
|
+
}
|
|
4
|
+
interface HttpClient {
|
|
5
|
+
post(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
6
|
+
put(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
7
|
+
patch(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
8
|
+
get(url: string, config?: RequestConfig): Promise<unknown>;
|
|
9
|
+
delete(url: string, config?: RequestConfig): Promise<unknown>;
|
|
10
|
+
}
|
|
11
|
+
export type { HttpClient, RequestConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -171,4 +171,17 @@ Object.keys(_transactions).forEach(function (key) {
|
|
|
171
171
|
return _transactions[key];
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
var _http = require("./http");
|
|
177
|
+
|
|
178
|
+
Object.keys(_http).forEach(function (key) {
|
|
179
|
+
if (key === "default" || key === "__esModule") return;
|
|
180
|
+
if (key in exports && exports[key] === _http[key]) return;
|
|
181
|
+
Object.defineProperty(exports, key, {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () {
|
|
184
|
+
return _http[key];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
174
187
|
});
|