@basis-theory/basis-theory-js 1.49.1 → 1.51.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.
|
@@ -24,6 +24,14 @@ const delegateTokens = elements => class BasisTheoryTokensElementsDelegate exten
|
|
|
24
24
|
return super.update(id, payload, requestOptions);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
retrieve(id, requestOptions) {
|
|
28
|
+
if (elements !== undefined) {
|
|
29
|
+
return elements.tokens.retrieve(id, requestOptions);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return super.retrieve(id, requestOptions);
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
exports.delegateTokens = delegateTokens;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AutoCompleteValue } from './shared';
|
|
1
|
+
import { AutoCompleteValue, DataElementReference } from './shared';
|
|
2
2
|
import type { ElementStyle } from './styles';
|
|
3
|
-
declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode"];
|
|
3
|
+
declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode", "data"];
|
|
4
4
|
declare type ElementType = typeof ELEMENTS_TYPES[number];
|
|
5
5
|
interface ElementInternalOptions {
|
|
6
6
|
apiKey: string;
|
|
@@ -20,6 +20,7 @@ interface SanitizedElementOptions {
|
|
|
20
20
|
iconPosition?: string;
|
|
21
21
|
cardBrand?: string;
|
|
22
22
|
autoComplete?: string;
|
|
23
|
+
value?: string;
|
|
23
24
|
}
|
|
24
25
|
declare type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
|
|
25
26
|
declare type Transform = RegExp | [RegExp, string?] | null;
|
|
@@ -30,23 +31,36 @@ interface AutoCompleteOption {
|
|
|
30
31
|
autoComplete?: AutoCompleteValue;
|
|
31
32
|
}
|
|
32
33
|
declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled'> & AutoCompleteOption;
|
|
33
|
-
|
|
34
|
+
interface CardElementValue {
|
|
35
|
+
number?: DataElementReference;
|
|
36
|
+
expiration_month?: DataElementReference;
|
|
37
|
+
expiration_year?: DataElementReference;
|
|
38
|
+
cvc?: DataElementReference;
|
|
39
|
+
}
|
|
40
|
+
interface CardExpirationDateValue {
|
|
41
|
+
month: DataElementReference;
|
|
42
|
+
year: DataElementReference;
|
|
43
|
+
}
|
|
44
|
+
declare type CreateCardElementOptions = CustomizableElementOptions & {
|
|
45
|
+
value?: CardElementValue;
|
|
46
|
+
};
|
|
34
47
|
declare type UpdateCardElementOptions = CreateCardElementOptions;
|
|
35
|
-
declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
48
|
+
declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password' | 'value'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
36
49
|
'aria-label'?: string;
|
|
37
50
|
};
|
|
38
51
|
declare type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask'>;
|
|
39
|
-
declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
52
|
+
declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition' | 'value'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
40
53
|
'aria-label'?: string;
|
|
41
54
|
};
|
|
42
55
|
declare type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId'>;
|
|
43
56
|
declare type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
44
57
|
'aria-label'?: string;
|
|
58
|
+
value?: CardExpirationDateValue;
|
|
45
59
|
};
|
|
46
60
|
declare type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId'>;
|
|
47
|
-
declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
61
|
+
declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand' | 'value'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
48
62
|
'aria-label'?: string;
|
|
49
63
|
};
|
|
50
64
|
declare type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId'>;
|
|
51
|
-
export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, };
|
|
65
|
+
export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, CardElementValue, CardExpirationDateValue, };
|
|
52
66
|
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', 'cardNumber', 'cardExpirationDate', 'cardVerificationCode'];
|
|
7
|
+
const ELEMENTS_TYPES = ['card', 'text', 'cardNumber', 'cardExpirationDate', 'cardVerificationCode', 'data'];
|
|
8
8
|
exports.ELEMENTS_TYPES = ELEMENTS_TYPES;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementValue } from '../../../types/elements';
|
|
2
2
|
import type { CreateToken as CreateTokenModel, UpdateToken as UpdateTokenModel, Token } from '../../../types/models';
|
|
3
|
-
import type { Create, Update } from '../../../types/sdk';
|
|
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> & Update<Token, UpdateToken>;
|
|
6
|
+
declare type Tokens = Create<Token, CreateToken> & Retrieve<Token> & Update<Token, UpdateToken>;
|
|
7
7
|
export type { Tokens, CreateToken, UpdateToken };
|
|
@@ -28,4 +28,12 @@ declare type CardIconPosition = typeof CARD_ICON_POSITIONS[number];
|
|
|
28
28
|
* Values for the element input autocomplete attribute
|
|
29
29
|
*/
|
|
30
30
|
declare type AutoCompleteValue = typeof AUTOCOMPLETE_VALUES[number];
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Type used for detokenization responses stored on Data Elements
|
|
33
|
+
*/
|
|
34
|
+
declare type DataElementReference = {
|
|
35
|
+
correlationId: string;
|
|
36
|
+
elementId: string;
|
|
37
|
+
path: string;
|
|
38
|
+
};
|
|
39
|
+
export type { FieldErrorType, ConfigErrorType, ConfigError, Targeted, ListenableKey, FieldError, PropertyError, Brand, CardIconPosition, AutoCompleteValue, DataElementReference, };
|