@basis-theory/basis-theory-js 1.30.0 → 1.31.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,4 +1,4 @@
|
|
|
1
|
-
import type { AtomicBanks as ElementsAtomicBanks, AtomicCards as ElementsAtomicCards, BasisTheoryElements, CardElement, CardExpirationDateElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from '@/types/elements';
|
|
1
|
+
import type { AtomicBanks as ElementsAtomicBanks, AtomicCards as ElementsAtomicCards, BasisTheoryElements, CardElement, CardNumberElement, CardExpirationDateElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardNumberElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from '@/types/elements';
|
|
2
2
|
import type { TokenizeData } from '@/types/models';
|
|
3
3
|
import type { Applications, AtomicBanks, AtomicCards, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, RequestOptions, Tenants, Tokens, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements } from '@/types/sdk';
|
|
4
4
|
export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
|
|
@@ -19,6 +19,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
19
19
|
init(apiKey: string, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
20
20
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
21
21
|
createElement(type: 'text', options: CreateTextElementOptions): TextElement;
|
|
22
|
+
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): CardNumberElement;
|
|
22
23
|
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): CardExpirationDateElement;
|
|
23
24
|
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
|
|
24
25
|
tokenize(tokens: TokenizeData & ElementsTokenizeData, options?: RequestOptions): Promise<TokenizeData>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ElementEventListener, EventType, Subscription, TextElementEvents, CardElementEvents, CardExpirationDateElementEvents, CardVerificationCodeElementEvents } from './events';
|
|
2
|
-
import type { CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions } from './options';
|
|
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';
|
|
3
3
|
import type { AtomicBanks, AtomicCards, Tokenize, Tokens } from './services';
|
|
4
4
|
interface BaseElement<UpdateOptions, ElementEvents> {
|
|
5
5
|
readonly mounted: boolean;
|
|
@@ -11,6 +11,7 @@ interface BaseElement<UpdateOptions, ElementEvents> {
|
|
|
11
11
|
}
|
|
12
12
|
declare type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents>;
|
|
13
13
|
declare type TextElement = BaseElement<UpdateTextElementOptions, TextElementEvents>;
|
|
14
|
+
declare type CardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents>;
|
|
14
15
|
declare type CardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
|
|
15
16
|
month(): ElementWrapper<CardExpirationDateElement>;
|
|
16
17
|
year(): ElementWrapper<CardExpirationDateElement>;
|
|
@@ -20,7 +21,7 @@ declare type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, a
|
|
|
20
21
|
element: T;
|
|
21
22
|
method?: string;
|
|
22
23
|
};
|
|
23
|
-
declare type ElementValue = TextElement | CardElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
|
|
24
|
+
declare type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
|
|
24
25
|
interface BasisTheoryElements extends Tokenize {
|
|
25
26
|
/**
|
|
26
27
|
* @deprecated use {@link tokens} or {@link tokenize}
|
|
@@ -33,6 +34,7 @@ interface BasisTheoryElements extends Tokenize {
|
|
|
33
34
|
tokens: Tokens;
|
|
34
35
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
35
36
|
createElement(type: 'text', options: CreateTextElementOptions): TextElement;
|
|
37
|
+
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): CardNumberElement;
|
|
36
38
|
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): CardExpirationDateElement;
|
|
37
39
|
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
|
|
38
40
|
}
|
|
@@ -45,4 +47,4 @@ declare global {
|
|
|
45
47
|
BasisTheoryElements?: BasisTheoryElementsInternal;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
export type { BaseElement, CardElement, TextElement, CardExpirationDateElement, CardVerificationCodeElement, ElementWrapper, ElementValue, BasisTheoryElements, BasisTheoryElementsInternal, };
|
|
50
|
+
export type { BaseElement, CardElement, TextElement, CardNumberElement, CardExpirationDateElement, CardVerificationCodeElement, ElementWrapper, ElementValue, BasisTheoryElements, BasisTheoryElementsInternal, };
|
|
@@ -20,6 +20,7 @@ declare type InputKeydownEvent = BaseEvent<'keydown'> & Targeted & {
|
|
|
20
20
|
declare type BaseElementEvents = ReadyEvent | InputFocusEvent | InputBlurEvent | InputKeydownEvent;
|
|
21
21
|
declare type TextElementEvents = BaseElementEvents | ChangeEvent;
|
|
22
22
|
declare type CardElementEvents = BaseElementEvents | CardChangeEvent;
|
|
23
|
+
declare type CardNumberElementEvents = BaseElementEvents | CardChangeEvent;
|
|
23
24
|
declare type CardExpirationDateElementEvents = BaseElementEvents | ChangeEvent;
|
|
24
25
|
declare type CardVerificationCodeElementEvents = BaseElementEvents | ChangeEvent;
|
|
25
26
|
/**
|
|
@@ -32,4 +33,4 @@ declare type ElementEventListener<Events, Type> = (event: FindByType<Events, Typ
|
|
|
32
33
|
interface Subscription {
|
|
33
34
|
unsubscribe(): void;
|
|
34
35
|
}
|
|
35
|
-
export type { EventType, BaseEvent, ReadyEvent, ChangeEvent, CardChangeEvent, InputFocusEvent, InputBlurEvent, InputKeydownEvent, BaseElementEvents, TextElementEvents, CardElementEvents, CardExpirationDateElementEvents, CardVerificationCodeElementEvents, ElementEventListener, Subscription, };
|
|
36
|
+
export type { EventType, BaseEvent, ReadyEvent, ChangeEvent, CardChangeEvent, InputFocusEvent, InputBlurEvent, InputKeydownEvent, BaseElementEvents, TextElementEvents, CardElementEvents, CardNumberElementEvents, CardExpirationDateElementEvents, CardVerificationCodeElementEvents, ElementEventListener, Subscription, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementStyle } from './styles';
|
|
2
|
-
declare const ELEMENTS_TYPES: readonly ["card", "text", "cardExpirationDate", "cardVerificationCode"];
|
|
2
|
+
declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode"];
|
|
3
3
|
declare type ElementType = typeof ELEMENTS_TYPES[number];
|
|
4
4
|
interface ElementInternalOptions {
|
|
5
5
|
apiKey: string;
|
|
@@ -16,6 +16,7 @@ interface SanitizedElementOptions {
|
|
|
16
16
|
transform?: [RegExp, string] | null;
|
|
17
17
|
ariaDescription?: string;
|
|
18
18
|
ariaLabel?: string;
|
|
19
|
+
iconPosition?: 'left' | 'right' | 'none';
|
|
19
20
|
cardBrand?: string;
|
|
20
21
|
}
|
|
21
22
|
declare type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
|
|
@@ -30,6 +31,10 @@ declare type CreateTextElementOptions = CustomizableElementOptions & Pick<Elemen
|
|
|
30
31
|
'aria-label'?: string;
|
|
31
32
|
};
|
|
32
33
|
declare type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask'>;
|
|
34
|
+
declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
35
|
+
'aria-label'?: string;
|
|
36
|
+
};
|
|
37
|
+
declare type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId'>;
|
|
33
38
|
declare type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
34
39
|
'aria-label'?: string;
|
|
35
40
|
};
|
|
@@ -38,5 +43,5 @@ declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptio
|
|
|
38
43
|
'aria-label'?: string;
|
|
39
44
|
};
|
|
40
45
|
declare type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId'>;
|
|
41
|
-
export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, };
|
|
46
|
+
export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, };
|
|
42
47
|
export { ELEMENTS_TYPES };
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ELEMENTS_TYPES = void 0;
|
|
7
|
-
const ELEMENTS_TYPES = ['card', 'text', 'cardExpirationDate', 'cardVerificationCode'];
|
|
7
|
+
const ELEMENTS_TYPES = ['card', 'text', 'cardNumber', 'cardExpirationDate', 'cardVerificationCode'];
|
|
8
8
|
exports.ELEMENTS_TYPES = ELEMENTS_TYPES;
|