@basis-theory/basis-theory-js 1.54.0 → 1.56.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 +2 -2
- package/package.json +1 -1
- package/tokens/BasisTheoryTokens.d.ts +1 -1
- package/tokens/BasisTheoryTokens.js +3 -1
- package/types/elements/elements.d.ts +15 -5
- package/types/elements/options.d.ts +5 -5
- package/types/elements/services/tokens.d.ts +1 -1
- package/types/models/applications.d.ts +10 -2
- package/types/models/tokens.d.ts +1 -1
- package/types/sdk/services/tokens.d.ts +1 -1
package/BasisTheory.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
14
14
|
private _reactors?;
|
|
15
15
|
private _permissions?;
|
|
16
16
|
private _proxies?;
|
|
17
|
-
init(apiKey: string, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
|
|
18
|
-
init(apiKey: string, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
17
|
+
init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
|
|
18
|
+
init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
19
19
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
20
20
|
createElement(type: 'text', options: CreateTextElementOptions): TextElement;
|
|
21
21
|
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): CardNumberElement;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import type { Token, CreateToken, UpdateToken } from '../types/models';
|
|
|
3
3
|
import type { PaginatedList, RequestOptions, ListTokensQuery, SearchTokensRequest } from '../types/sdk';
|
|
4
4
|
export declare const BasisTheoryTokens: {
|
|
5
5
|
new (options: BasisTheoryServiceOptions): {
|
|
6
|
-
retrieve(id: string, options?: RequestOptions): Promise<Token
|
|
6
|
+
retrieve(id: string, options?: RequestOptions): Promise<Token<any>>;
|
|
7
7
|
update(id: string, model: UpdateToken, options?: RequestOptions): Promise<Token>;
|
|
8
8
|
createAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
9
9
|
deleteAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
@@ -23,7 +23,9 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
23
23
|
super(_options);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
retrieve(id, options = {}
|
|
26
|
+
retrieve(id, options = {} // avoid casting when accessing token data props
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
) {
|
|
27
29
|
const url = `/${id}`;
|
|
28
30
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
29
31
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ElementEventListener, EventType, Subscription, TextElementEvents, CardElementEvents, CardNumberElementEvents, CardExpirationDateElementEvents, CardVerificationCodeElementEvents } from './events';
|
|
2
|
-
import type { CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions } from './options';
|
|
2
|
+
import type { CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions, CardElementValue, CardExpirationDateValue } from './options';
|
|
3
3
|
import type { Tokenize, Tokens } from './services';
|
|
4
|
+
import { DataElementReference } from './shared';
|
|
4
5
|
interface BaseElement<UpdateOptions, ElementEvents> {
|
|
5
6
|
readonly mounted: boolean;
|
|
6
7
|
mount(selector: string): Promise<void>;
|
|
@@ -11,14 +12,23 @@ interface BaseElement<UpdateOptions, ElementEvents> {
|
|
|
11
12
|
unmount(): void;
|
|
12
13
|
on<T extends EventType>(eventType: T, listener: ElementEventListener<ElementEvents, T>): Subscription;
|
|
13
14
|
}
|
|
14
|
-
declare type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
declare type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents> & {
|
|
16
|
+
setValue(value: CardElementValue<'reference'>): void;
|
|
17
|
+
};
|
|
18
|
+
declare type TextElement = BaseElement<UpdateTextElementOptions, TextElementEvents> & {
|
|
19
|
+
setValue(value: DataElementReference): void;
|
|
20
|
+
};
|
|
21
|
+
declare type CardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents> & {
|
|
22
|
+
setValue(value: DataElementReference): void;
|
|
23
|
+
};
|
|
17
24
|
declare type CardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
|
|
18
25
|
month(): ElementWrapper<CardExpirationDateElement>;
|
|
19
26
|
year(): ElementWrapper<CardExpirationDateElement>;
|
|
27
|
+
setValue(value: CardExpirationDateValue<'reference'>): void;
|
|
28
|
+
};
|
|
29
|
+
declare type CardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents> & {
|
|
30
|
+
setValue(value: DataElementReference): void;
|
|
20
31
|
};
|
|
21
|
-
declare type CardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents>;
|
|
22
32
|
declare type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
|
|
23
33
|
element: T;
|
|
24
34
|
method?: string;
|
|
@@ -34,13 +34,13 @@ declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabl
|
|
|
34
34
|
declare type ElementValueType = 'static' | 'reference';
|
|
35
35
|
interface CardElementValue<T extends ElementValueType> {
|
|
36
36
|
number?: T extends 'reference' ? DataElementReference : string;
|
|
37
|
-
expiration_month?: T extends 'reference' ? DataElementReference :
|
|
38
|
-
expiration_year?: T extends 'reference' ? DataElementReference :
|
|
37
|
+
expiration_month?: T extends 'reference' ? DataElementReference : number;
|
|
38
|
+
expiration_year?: T extends 'reference' ? DataElementReference : number;
|
|
39
39
|
cvc?: T extends 'reference' ? DataElementReference : string;
|
|
40
40
|
}
|
|
41
41
|
interface CardExpirationDateValue<T extends ElementValueType> {
|
|
42
|
-
month: T extends 'reference' ? DataElementReference :
|
|
43
|
-
year: T extends 'reference' ? DataElementReference :
|
|
42
|
+
month: T extends 'reference' ? DataElementReference : number;
|
|
43
|
+
year: T extends 'reference' ? DataElementReference : number;
|
|
44
44
|
}
|
|
45
45
|
declare type CreateCardElementOptions = CustomizableElementOptions & {
|
|
46
46
|
value?: CardElementValue<'static'>;
|
|
@@ -58,7 +58,7 @@ declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<
|
|
|
58
58
|
declare type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId'>;
|
|
59
59
|
declare type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
60
60
|
'aria-label'?: string;
|
|
61
|
-
value?: CardExpirationDateValue<'static'
|
|
61
|
+
value?: CardExpirationDateValue<'static'> | string;
|
|
62
62
|
};
|
|
63
63
|
declare type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId'>;
|
|
64
64
|
declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
@@ -3,5 +3,5 @@ import type { CreateToken as CreateTokenModel, UpdateToken as UpdateTokenModel,
|
|
|
3
3
|
import type { Create, Retrieve, Update } from '../../../types/sdk';
|
|
4
4
|
declare type CreateToken = CreateTokenModel<ElementValue>;
|
|
5
5
|
declare type UpdateToken = UpdateTokenModel<ElementValue>;
|
|
6
|
-
declare type Tokens = Create<Token, CreateToken> & Retrieve<Token
|
|
6
|
+
declare type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken>;
|
|
7
7
|
export type { Tokens, CreateToken, UpdateToken };
|
|
@@ -6,19 +6,27 @@ declare type TransformType = typeof TRANSFORM_TYPES[number];
|
|
|
6
6
|
interface Application extends Auditable {
|
|
7
7
|
id: string;
|
|
8
8
|
tenantId: string;
|
|
9
|
-
name
|
|
9
|
+
name?: string;
|
|
10
10
|
key?: string;
|
|
11
11
|
type: ApplicationType;
|
|
12
12
|
permissions?: string[];
|
|
13
13
|
rules?: AccessRule[];
|
|
14
|
+
canCreateExpiringApplications?: boolean;
|
|
15
|
+
expiresAt?: string;
|
|
14
16
|
}
|
|
15
17
|
interface AccessRule {
|
|
16
18
|
description: string;
|
|
17
19
|
priority: number;
|
|
18
|
-
container
|
|
20
|
+
container?: string;
|
|
19
21
|
transform: TransformType;
|
|
20
22
|
permissions: string[];
|
|
23
|
+
conditions?: Condition[];
|
|
21
24
|
}
|
|
25
|
+
declare type Condition = {
|
|
26
|
+
attribute: string;
|
|
27
|
+
operator: string;
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
22
30
|
declare type CreateApplication = Pick<Application, 'name' | 'type'> & Partial<Pick<Application, 'permissions' | 'rules'>>;
|
|
23
31
|
declare type UpdateApplication = Partial<Pick<Application, 'name' | 'permissions' | 'rules'>>;
|
|
24
32
|
export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
|
package/types/models/tokens.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' |
|
|
|
42
42
|
deduplicateToken?: boolean;
|
|
43
43
|
id?: string;
|
|
44
44
|
};
|
|
45
|
-
declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
|
|
45
|
+
declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
46
46
|
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
47
47
|
deduplicateToken: boolean;
|
|
48
48
|
}>;
|
|
@@ -10,7 +10,7 @@ interface SearchTokensRequest {
|
|
|
10
10
|
page?: number;
|
|
11
11
|
size?: number;
|
|
12
12
|
}
|
|
13
|
-
interface Tokens extends Create<Token, CreateToken>, Update<Token, UpdateToken>, Retrieve<Token
|
|
13
|
+
interface Tokens extends Create<Token, CreateToken>, Update<Token, UpdateToken>, Retrieve<Token<any>>, Delete, List<Token, ListTokensQuery> {
|
|
14
14
|
createAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
15
15
|
deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
16
16
|
createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
|