@basis-theory/react-elements 1.11.3 → 1.11.5
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/main/index.js +6 -17
- package/module/module.js +6 -3
- package/package.json +4 -5
- package/types/index.d.ts +682 -4
- package/types/core/BasisTheoryProvider.d.ts +0 -11
- package/types/core/index.d.ts +0 -2
- package/types/core/useBasisTheory.d.ts +0 -9
- package/types/elements/CardElement.d.ts +0 -25
- package/types/elements/CardExpirationDateElement.d.ts +0 -25
- package/types/elements/CardNumberElement.d.ts +0 -28
- package/types/elements/CardVerificationCodeElement.d.ts +0 -26
- package/types/elements/TextElement.d.ts +0 -34
- package/types/elements/index.d.ts +0 -10
- package/types/elements/useBasisTheoryValue.d.ts +0 -10
- package/types/elements/useElement.d.ts +0 -15
- package/types/elements/useListener.d.ts +0 -3
- package/types/types.d.ts +0 -1
package/main/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $6ZdRe$basistheorywebelements = require("@basis-theory/web-elements");
|
|
2
1
|
var $6ZdRe$react = require("react");
|
|
2
|
+
var $6ZdRe$basistheorywebelements = require("@basis-theory/web-elements");
|
|
3
3
|
var $6ZdRe$reactjsxruntime = require("react/jsx-runtime");
|
|
4
4
|
|
|
5
5
|
|
|
@@ -27,21 +27,6 @@ function $parcel$export(e, n, v, s) {
|
|
|
27
27
|
function $parcel$interopDefault(a) {
|
|
28
28
|
return a && a.__esModule ? a.default : a;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
$parcel$export(module.exports, "AMERICAN_EXPRESS", () => $6ZdRe$basistheorywebelements.AMERICAN_EXPRESS);
|
|
32
|
-
$parcel$export(module.exports, "DEFAULT_CARD_TYPES", () => $6ZdRe$basistheorywebelements.DEFAULT_CARD_TYPES);
|
|
33
|
-
$parcel$export(module.exports, "DINERS_CLUB", () => $6ZdRe$basistheorywebelements.DINERS_CLUB);
|
|
34
|
-
$parcel$export(module.exports, "DISCOVER", () => $6ZdRe$basistheorywebelements.DISCOVER);
|
|
35
|
-
$parcel$export(module.exports, "ELO", () => $6ZdRe$basistheorywebelements.ELO);
|
|
36
|
-
$parcel$export(module.exports, "HIPER", () => $6ZdRe$basistheorywebelements.HIPER);
|
|
37
|
-
$parcel$export(module.exports, "HIPERCARD", () => $6ZdRe$basistheorywebelements.HIPERCARD);
|
|
38
|
-
$parcel$export(module.exports, "JCB", () => $6ZdRe$basistheorywebelements.JCB);
|
|
39
|
-
$parcel$export(module.exports, "MAESTRO", () => $6ZdRe$basistheorywebelements.MAESTRO);
|
|
40
|
-
$parcel$export(module.exports, "MASTERCARD", () => $6ZdRe$basistheorywebelements.MASTERCARD);
|
|
41
|
-
$parcel$export(module.exports, "MIR", () => $6ZdRe$basistheorywebelements.MIR);
|
|
42
|
-
$parcel$export(module.exports, "UNION_PAY", () => $6ZdRe$basistheorywebelements.UNION_PAY);
|
|
43
|
-
$parcel$export(module.exports, "VISA", () => $6ZdRe$basistheorywebelements.VISA);
|
|
44
|
-
$parcel$export(module.exports, "CARD_BRANDS", () => $6ZdRe$basistheorywebelements.CARD_BRANDS);
|
|
45
30
|
var $a6b9dd675f852902$exports = {};
|
|
46
31
|
|
|
47
32
|
$parcel$export($a6b9dd675f852902$exports, "useBasisTheory", () => $311cac811dba7e3c$export$8855c0c49ada8fa3);
|
|
@@ -254,7 +239,7 @@ function CardElement(props, ref) {
|
|
|
254
239
|
|
|
255
240
|
|
|
256
241
|
|
|
257
|
-
const $5056c1f1f96da4b6$var$TextElementC = ({ 'aria-label': ariaLabel, autoComplete: autoComplete, bt: bt, disabled: disabled, elementRef: elementRef, id: id, inputMode: inputMode, mask: mask, maxLength: maxLength, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onReady: onReady, password: password, placeholder: placeholder, readOnly: readOnly, style: style, transform: transform, validation: validation, value: value, valueRef: valueRef })=>{
|
|
242
|
+
const $5056c1f1f96da4b6$var$TextElementC = ({ 'aria-label': ariaLabel, autoComplete: autoComplete, bt: bt, disabled: disabled, elementRef: elementRef, id: id, inputMode: inputMode, mask: mask, maxLength: maxLength, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onReady: onReady, password: password, placeholder: placeholder, readOnly: readOnly, style: style, transform: transform, validateOnChange: validateOnChange, validation: validation, value: value, valueRef: valueRef })=>{
|
|
258
243
|
const wrapperRef = (0, $6ZdRe$react.useRef)(null);
|
|
259
244
|
const element = (0, $515e46363124517b$export$93e1bc7222cfbdc8)(id, 'text', wrapperRef, {
|
|
260
245
|
'aria-label': ariaLabel,
|
|
@@ -269,6 +254,7 @@ const $5056c1f1f96da4b6$var$TextElementC = ({ 'aria-label': ariaLabel, autoCompl
|
|
|
269
254
|
style: style,
|
|
270
255
|
targetId: id,
|
|
271
256
|
transform: transform,
|
|
257
|
+
validateOnChange: validateOnChange,
|
|
272
258
|
validation: validation,
|
|
273
259
|
value: value
|
|
274
260
|
}, bt, elementRef, valueRef);
|
|
@@ -411,8 +397,11 @@ const $9bb5cbc1cc445953$export$36d668a024913c87 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
411
397
|
|
|
412
398
|
|
|
413
399
|
|
|
400
|
+
var $155b7e20af39b8bd$exports = {};
|
|
401
|
+
|
|
414
402
|
|
|
415
403
|
$parcel$exportWildcard(module.exports, $a6b9dd675f852902$exports);
|
|
416
404
|
$parcel$exportWildcard(module.exports, $09db7b15c2691edc$exports);
|
|
405
|
+
$parcel$exportWildcard(module.exports, $155b7e20af39b8bd$exports);
|
|
417
406
|
|
|
418
407
|
|
package/module/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {AMERICAN_EXPRESS as $8fc858ffa1007a27$re_export$AMERICAN_EXPRESS, DEFAULT_CARD_TYPES as $8fc858ffa1007a27$re_export$DEFAULT_CARD_TYPES, DINERS_CLUB as $8fc858ffa1007a27$re_export$DINERS_CLUB, DISCOVER as $8fc858ffa1007a27$re_export$DISCOVER, ELO as $8fc858ffa1007a27$re_export$ELO, HIPER as $8fc858ffa1007a27$re_export$HIPER, HIPERCARD as $8fc858ffa1007a27$re_export$HIPERCARD, JCB as $8fc858ffa1007a27$re_export$JCB, MAESTRO as $8fc858ffa1007a27$re_export$MAESTRO, MASTERCARD as $8fc858ffa1007a27$re_export$MASTERCARD, MIR as $8fc858ffa1007a27$re_export$MIR, UNION_PAY as $8fc858ffa1007a27$re_export$UNION_PAY, VISA as $8fc858ffa1007a27$re_export$VISA, CARD_BRANDS as $8fc858ffa1007a27$re_export$CARD_BRANDS, basistheory as $gb0K4$basistheory} from "@basis-theory/web-elements";
|
|
2
1
|
import $gb0K4$react, {useState as $gb0K4$useState, useRef as $gb0K4$useRef, useEffect as $gb0K4$useEffect, createContext as $gb0K4$createContext, useMemo as $gb0K4$useMemo, useContext as $gb0K4$useContext} from "react";
|
|
2
|
+
import {basistheory as $gb0K4$basistheory} from "@basis-theory/web-elements";
|
|
3
3
|
import {jsx as $gb0K4$jsx} from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -218,7 +218,7 @@ function CardElement(props, ref) {
|
|
|
218
218
|
|
|
219
219
|
|
|
220
220
|
|
|
221
|
-
const $098244fc1ecf3b22$var$TextElementC = ({ 'aria-label': ariaLabel, autoComplete: autoComplete, bt: bt, disabled: disabled, elementRef: elementRef, id: id, inputMode: inputMode, mask: mask, maxLength: maxLength, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onReady: onReady, password: password, placeholder: placeholder, readOnly: readOnly, style: style, transform: transform, validation: validation, value: value, valueRef: valueRef })=>{
|
|
221
|
+
const $098244fc1ecf3b22$var$TextElementC = ({ 'aria-label': ariaLabel, autoComplete: autoComplete, bt: bt, disabled: disabled, elementRef: elementRef, id: id, inputMode: inputMode, mask: mask, maxLength: maxLength, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onReady: onReady, password: password, placeholder: placeholder, readOnly: readOnly, style: style, transform: transform, validateOnChange: validateOnChange, validation: validation, value: value, valueRef: valueRef })=>{
|
|
222
222
|
const wrapperRef = (0, $gb0K4$useRef)(null);
|
|
223
223
|
const element = (0, $001f9ef7a572da43$export$93e1bc7222cfbdc8)(id, 'text', wrapperRef, {
|
|
224
224
|
'aria-label': ariaLabel,
|
|
@@ -233,6 +233,7 @@ const $098244fc1ecf3b22$var$TextElementC = ({ 'aria-label': ariaLabel, autoCompl
|
|
|
233
233
|
style: style,
|
|
234
234
|
targetId: id,
|
|
235
235
|
transform: transform,
|
|
236
|
+
validateOnChange: validateOnChange,
|
|
236
237
|
validation: validation,
|
|
237
238
|
value: value
|
|
238
239
|
}, bt, elementRef, valueRef);
|
|
@@ -375,7 +376,9 @@ const $6f922196262b492d$export$36d668a024913c87 = /*#__PURE__*/ (0, $gb0K4$react
|
|
|
375
376
|
|
|
376
377
|
|
|
377
378
|
|
|
379
|
+
var $17e03523eeef3efb$exports = {};
|
|
380
|
+
|
|
378
381
|
|
|
379
382
|
|
|
380
383
|
|
|
381
|
-
export {$
|
|
384
|
+
export {$af3ff746464f54fa$export$8855c0c49ada8fa3 as useBasisTheory, $45f18da36523d589$export$e61fbf0ee83adc05 as BasisTheoryProvider, $22a85849b67e3ab0$export$642653cabb64aed9 as CardElement, $098244fc1ecf3b22$export$764077542c4bf9bd as TextElement, $c9d0638264a6246e$export$a2311b18160d2f3f as CardNumberElement, $b04bbbda03b8923f$export$d5128efc3cebc889 as CardExpirationDateElement, $6f922196262b492d$export$36d668a024913c87 as CardVerificationCodeElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basis-theory/react-elements",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.5",
|
|
4
4
|
"repository": "https://github.com/basis-theory/react-elements",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
"!/bundle"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build:dev": "yarn clean && parcel build &&
|
|
19
|
-
"build": "node ../scripts/react-elements/prepare.js && parcel build --no-cache
|
|
18
|
+
"build:dev": "yarn clean && parcel build && npx size-limit",
|
|
19
|
+
"build": "node ../scripts/react-elements/prepare.js && parcel build --no-cache",
|
|
20
20
|
"clean": "rimraf dist .parcel-cache",
|
|
21
|
-
"generateTypes": "tsc --emitDeclarationOnly",
|
|
22
21
|
"lint-staged": "lint-staged",
|
|
23
22
|
"lint:fix": "eslint --fix",
|
|
24
23
|
"lint": "eslint",
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
"tag": "latest"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@basis-theory/web-elements": "1.11.
|
|
33
|
+
"@basis-theory/web-elements": "1.11.5"
|
|
35
34
|
},
|
|
36
35
|
"peerDependencies": {
|
|
37
36
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,682 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Properties } from "csstype";
|
|
2
|
+
import React, { PropsWithChildren, MutableRefObject } from "react";
|
|
3
|
+
type CardBrandId = 'american-express' | 'diners-club' | 'discover' | 'elo' | 'hiper' | 'hipercard' | 'jcb' | 'maestro' | 'mastercard' | 'mir' | 'unionpay' | 'visa';
|
|
4
|
+
type CardBrandNiceType = 'American Express' | 'Diners Club' | 'Discover' | 'Elo' | 'Hiper' | 'Hipercard' | 'JCB' | 'Maestro' | 'Mastercard' | 'Mir' | 'UnionPay' | 'Visa';
|
|
5
|
+
type SecurityCodeLabel = 'CVV' | 'CVC' | 'CID' | 'CVN' | 'CVE' | 'CVP2';
|
|
6
|
+
export type CreditCardType = {
|
|
7
|
+
code: {
|
|
8
|
+
size: number;
|
|
9
|
+
name: SecurityCodeLabel | string;
|
|
10
|
+
};
|
|
11
|
+
gaps: number[];
|
|
12
|
+
lengths: number[];
|
|
13
|
+
niceType: CardBrandNiceType | string;
|
|
14
|
+
patterns: (number | [number, number])[];
|
|
15
|
+
type: CardBrandId | string;
|
|
16
|
+
};
|
|
17
|
+
export const VISA: CreditCardType;
|
|
18
|
+
export const MASTERCARD: CreditCardType;
|
|
19
|
+
export const AMERICAN_EXPRESS: CreditCardType;
|
|
20
|
+
export const DINERS_CLUB: CreditCardType;
|
|
21
|
+
export const DISCOVER: CreditCardType;
|
|
22
|
+
export const JCB: CreditCardType;
|
|
23
|
+
export const UNION_PAY: CreditCardType;
|
|
24
|
+
export const MAESTRO: CreditCardType;
|
|
25
|
+
export const ELO: CreditCardType;
|
|
26
|
+
export const MIR: CreditCardType;
|
|
27
|
+
export const HIPER: CreditCardType;
|
|
28
|
+
export const HIPERCARD: CreditCardType;
|
|
29
|
+
export const DEFAULT_CARD_TYPES: CreditCardType[];
|
|
30
|
+
export interface RequestConfig {
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
}
|
|
33
|
+
export interface HttpClient {
|
|
34
|
+
post(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
35
|
+
put(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
36
|
+
patch(url: string, payload: unknown, config?: RequestConfig): Promise<unknown>;
|
|
37
|
+
get(url: string, config?: RequestConfig): Promise<unknown>;
|
|
38
|
+
delete(url: string, config?: RequestConfig): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
export const CARD_BRANDS: readonly ["visa", "mastercard", "american-express", "discover", "diners-club", "jcb", "unionpay", "maestro", "elo", "hiper", "hipercard", "mir", "unknown"];
|
|
41
|
+
declare const CARD_ICON_POSITIONS: readonly ["left", "right", "none"];
|
|
42
|
+
declare const AUTOCOMPLETE_VALUES: readonly ["additional-name", "address-level1", "address-level2", "address-level3", "address-level4", "address-line1", "address-line2", "address-line3", "bday-day", "bday-month", "bday-year", "bday", "billing", "cc-additional-name", "cc-csc", "cc-exp-month", "cc-exp-year", "cc-exp", "cc-family-name", "cc-given-name", "cc-name", "cc-number", "cc-type", "country-name", "country", "current-password", "email", "family-name", "fax", "given-name", "home", "honorific-prefix", "honorific-suffix", "language", "mobile", "name", "new-password", "nickname", "off", "on", "one-time-code", "organization-title", "organization", "page", "postal-code", "sex", "shipping", "street-address", "tel-area-code", "tel-country-code", "tel-extension", "tel-local-prefix", "tel-local-suffix", "tel-local", "tel-national", "tel", "transaction-amount", "transaction-currency", "url", "username", "work"];
|
|
43
|
+
export type FieldErrorType = 'incomplete' | 'invalid';
|
|
44
|
+
export type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
|
|
45
|
+
export interface ConfigError {
|
|
46
|
+
type: ConfigErrorType;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
export interface Targeted {
|
|
50
|
+
targetId: string;
|
|
51
|
+
}
|
|
52
|
+
export type ListenableKey = 'Escape' | 'Enter';
|
|
53
|
+
export interface FieldError {
|
|
54
|
+
targetId: string;
|
|
55
|
+
type: FieldErrorType;
|
|
56
|
+
}
|
|
57
|
+
export interface PropertyError {
|
|
58
|
+
type: FieldErrorType;
|
|
59
|
+
}
|
|
60
|
+
export interface ElementMetadata {
|
|
61
|
+
complete: boolean;
|
|
62
|
+
valid: boolean;
|
|
63
|
+
maskSatisfied?: boolean;
|
|
64
|
+
empty: boolean;
|
|
65
|
+
errors?: FieldError[] | Omit<FieldError, 'targetId'>[];
|
|
66
|
+
}
|
|
67
|
+
export interface CardMetadata {
|
|
68
|
+
cardBrand: Brand;
|
|
69
|
+
cardLast4?: string;
|
|
70
|
+
cardBin?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Card brands type
|
|
74
|
+
*/
|
|
75
|
+
export type Brand = (typeof CARD_BRANDS)[number];
|
|
76
|
+
/**
|
|
77
|
+
* Icon position for card number element
|
|
78
|
+
*/
|
|
79
|
+
export type CardIconPosition = (typeof CARD_ICON_POSITIONS)[number];
|
|
80
|
+
/**
|
|
81
|
+
* Values for the element input autocomplete attribute
|
|
82
|
+
*/
|
|
83
|
+
export type AutoCompleteValue = (typeof AUTOCOMPLETE_VALUES)[number];
|
|
84
|
+
/**
|
|
85
|
+
* Type used for detokenization responses stored on Data Elements
|
|
86
|
+
*/
|
|
87
|
+
export type DataElementReference = {
|
|
88
|
+
correlationId: string;
|
|
89
|
+
elementId: string;
|
|
90
|
+
path: string;
|
|
91
|
+
};
|
|
92
|
+
export type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown';
|
|
93
|
+
export interface BaseEvent<T extends EventType> {
|
|
94
|
+
type: T;
|
|
95
|
+
}
|
|
96
|
+
export type ReadyEvent = BaseEvent<'ready'>;
|
|
97
|
+
export type ChangeEvent = BaseEvent<'change'> & {
|
|
98
|
+
empty: boolean;
|
|
99
|
+
complete: boolean;
|
|
100
|
+
valid?: boolean;
|
|
101
|
+
maskSatisfied?: boolean;
|
|
102
|
+
errors?: FieldError[];
|
|
103
|
+
};
|
|
104
|
+
export type CardChangeEvent = ChangeEvent & {
|
|
105
|
+
cardBrand: Brand;
|
|
106
|
+
cardLast4?: string;
|
|
107
|
+
cardBin?: string;
|
|
108
|
+
};
|
|
109
|
+
export type InputFocusEvent = BaseEvent<'focus'> & Targeted;
|
|
110
|
+
export type InputBlurEvent = BaseEvent<'blur'> & Targeted;
|
|
111
|
+
export type InputKeydownEvent = BaseEvent<'keydown'> & Targeted & {
|
|
112
|
+
key: ListenableKey;
|
|
113
|
+
} & Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'shiftKey' | 'metaKey'>;
|
|
114
|
+
export type BaseElementEvents = ReadyEvent | InputFocusEvent | InputBlurEvent | InputKeydownEvent;
|
|
115
|
+
export type TextElementEvents = BaseElementEvents | ChangeEvent;
|
|
116
|
+
export type CardElementEvents = BaseElementEvents | CardChangeEvent;
|
|
117
|
+
export type CardNumberElementEvents = BaseElementEvents | CardChangeEvent;
|
|
118
|
+
export type CardExpirationDateElementEvents = BaseElementEvents | ChangeEvent;
|
|
119
|
+
export type CardVerificationCodeElementEvents = BaseElementEvents | ChangeEvent;
|
|
120
|
+
/**
|
|
121
|
+
* Utility type that helps find a Union type based on a `type` property
|
|
122
|
+
*/
|
|
123
|
+
type FindByType<Union, Type> = Union extends {
|
|
124
|
+
type: Type;
|
|
125
|
+
} ? Union : never;
|
|
126
|
+
export type ElementEventListener<Events, Type> = (event: FindByType<Events, Type>) => void;
|
|
127
|
+
export interface Subscription {
|
|
128
|
+
unsubscribe(): void;
|
|
129
|
+
}
|
|
130
|
+
export const SAFE_CSS_PROPERTIES: readonly ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "padding", "textDecoration", "textShadow", "textTransform"];
|
|
131
|
+
export type SafeCSSProperty = (typeof SAFE_CSS_PROPERTIES)[number];
|
|
132
|
+
export const SAFE_CSS_PROPERTIES_ALTERNATES: Partial<Record<SafeCSSProperty, string[]>>;
|
|
133
|
+
export const SAFE_CSS_PROPERTIES_WITH_ALTERNATES: string[];
|
|
134
|
+
export type SafeStyle = Pick<Properties, SafeCSSProperty>;
|
|
135
|
+
export const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", ":read-only", "::placeholder", "::selection", ":disabled"];
|
|
136
|
+
export type CardElementStyleVariantSelector = (typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS)[number];
|
|
137
|
+
export type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
|
|
138
|
+
export const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "complete", "invalid", "empty"];
|
|
139
|
+
export const CARD_ELEMENT_STYLE_FONTS_ATTR: "fonts";
|
|
140
|
+
export type CardElementStyleVariant = (typeof CARD_ELEMENT_STYLE_VARIANTS)[number];
|
|
141
|
+
type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
|
|
142
|
+
type FontSource = string;
|
|
143
|
+
export type FontSources = FontSource[];
|
|
144
|
+
export type Fonts = Record<CardElementStyleFontAttr, FontSources>;
|
|
145
|
+
export type CardElementStyle = Partial<Record<CardElementStyleVariant, CardElementStyleVariantStyle> & Fonts>;
|
|
146
|
+
export type ElementStyle = CardElementStyle;
|
|
147
|
+
export type CopyIconStyles = {
|
|
148
|
+
size?: string;
|
|
149
|
+
color?: string;
|
|
150
|
+
successColor?: string;
|
|
151
|
+
};
|
|
152
|
+
export const ELEMENTS_TYPES: readonly ["card", "cardExpirationDate", "cardNumber", "cardVerificationCode", "data", "text"];
|
|
153
|
+
export type ElementType = (typeof ELEMENTS_TYPES)[number];
|
|
154
|
+
export interface ElementInternalOptions {
|
|
155
|
+
apiKey: string | undefined;
|
|
156
|
+
baseUrl: string;
|
|
157
|
+
type: ElementType;
|
|
158
|
+
useNgApi: boolean | undefined;
|
|
159
|
+
useSameOriginApi: boolean | undefined;
|
|
160
|
+
}
|
|
161
|
+
export enum InputMode {
|
|
162
|
+
DECIMAL = "decimal",
|
|
163
|
+
EMAIL = "email",
|
|
164
|
+
NONE = "none",
|
|
165
|
+
NUMERIC = "numeric",
|
|
166
|
+
SEARCH = "search",
|
|
167
|
+
TEL = "tel",
|
|
168
|
+
TEXT = "text",
|
|
169
|
+
URL = "url"
|
|
170
|
+
}
|
|
171
|
+
export interface SanitizedElementOptions {
|
|
172
|
+
ariaDescription?: string;
|
|
173
|
+
ariaLabel?: string;
|
|
174
|
+
autoComplete?: AutoCompleteValue;
|
|
175
|
+
cardBrand?: string;
|
|
176
|
+
cardTypes?: CreditCardType[];
|
|
177
|
+
copyIconStyles?: CopyIconStyles;
|
|
178
|
+
disabled?: boolean;
|
|
179
|
+
enableCopy?: boolean;
|
|
180
|
+
iconPosition?: string;
|
|
181
|
+
inputMode?: `${InputMode}`;
|
|
182
|
+
mask?: (RegExp | string)[];
|
|
183
|
+
maxLength?: HTMLInputElement['maxLength'];
|
|
184
|
+
password?: boolean;
|
|
185
|
+
placeholder?: string;
|
|
186
|
+
readOnly?: boolean;
|
|
187
|
+
skipLuhnValidation?: boolean;
|
|
188
|
+
style?: ElementStyle;
|
|
189
|
+
targetId?: string;
|
|
190
|
+
transform?: [RegExp, string] | null;
|
|
191
|
+
validateOnChange?: boolean;
|
|
192
|
+
validation?: RegExp;
|
|
193
|
+
value?: CardElementValue<'static'> | CardExpirationDateValue<'static'> | string;
|
|
194
|
+
}
|
|
195
|
+
export type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
|
|
196
|
+
export type Transform = RegExp | [RegExp, string?] | null;
|
|
197
|
+
interface TransformOption {
|
|
198
|
+
transform?: Transform;
|
|
199
|
+
}
|
|
200
|
+
interface AutoCompleteOption {
|
|
201
|
+
autoComplete?: AutoCompleteValue;
|
|
202
|
+
}
|
|
203
|
+
export type CustomizableElementOptions = Pick<ElementOptions, 'cardTypes' | 'copyIconStyles' | 'disabled' | 'enableCopy' | 'inputMode' | 'readOnly' | 'skipLuhnValidation' | 'style' | 'validateOnChange'> & AutoCompleteOption;
|
|
204
|
+
type ElementValueType = 'static' | 'reference';
|
|
205
|
+
export interface CardElementValue<T extends ElementValueType> {
|
|
206
|
+
cvc?: T extends 'reference' ? DataElementReference : string;
|
|
207
|
+
expiration_month?: T extends 'reference' ? DataElementReference : number;
|
|
208
|
+
expiration_year?: T extends 'reference' ? DataElementReference : number;
|
|
209
|
+
number?: T extends 'reference' ? DataElementReference : string;
|
|
210
|
+
}
|
|
211
|
+
export interface CardElementPlaceholder {
|
|
212
|
+
cardNumber?: string;
|
|
213
|
+
cardExpirationDate?: string;
|
|
214
|
+
cardSecurityCode?: string;
|
|
215
|
+
}
|
|
216
|
+
export interface CardExpirationDateValue<T extends ElementValueType> {
|
|
217
|
+
month: T extends 'reference' ? DataElementReference : number;
|
|
218
|
+
year: T extends 'reference' ? DataElementReference : number;
|
|
219
|
+
}
|
|
220
|
+
export type CreateCardElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'cardTypes' | 'skipLuhnValidation'> & {
|
|
221
|
+
placeholder?: CardElementPlaceholder;
|
|
222
|
+
value?: CardElementValue<'static'>;
|
|
223
|
+
};
|
|
224
|
+
export type UpdateCardElementOptions = Omit<CreateCardElementOptions, 'validateOnChange' | 'enableCopy'>;
|
|
225
|
+
export type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'maxLength' | 'password' | 'validation'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
226
|
+
'aria-label'?: string;
|
|
227
|
+
value?: string;
|
|
228
|
+
};
|
|
229
|
+
export type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask' | 'validateOnChange'>;
|
|
230
|
+
export type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition' | 'cardTypes' | 'skipLuhnValidation'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
231
|
+
'aria-label'?: string;
|
|
232
|
+
value?: string;
|
|
233
|
+
};
|
|
234
|
+
export type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
235
|
+
export type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
236
|
+
'aria-label'?: string;
|
|
237
|
+
value?: CardExpirationDateValue<'static'> | string;
|
|
238
|
+
};
|
|
239
|
+
export type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
240
|
+
export type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
241
|
+
'aria-label'?: string;
|
|
242
|
+
value?: string;
|
|
243
|
+
};
|
|
244
|
+
export type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
245
|
+
export interface BinDetails {
|
|
246
|
+
cardBrand?: string;
|
|
247
|
+
type?: string;
|
|
248
|
+
prepaid?: boolean;
|
|
249
|
+
cardSegmentType?: string;
|
|
250
|
+
reloadable?: boolean;
|
|
251
|
+
panOrToken?: string;
|
|
252
|
+
accountUpdater?: boolean;
|
|
253
|
+
alm?: boolean;
|
|
254
|
+
domesticOnly?: boolean;
|
|
255
|
+
gamblingBlocked?: boolean;
|
|
256
|
+
level2?: boolean;
|
|
257
|
+
level3?: boolean;
|
|
258
|
+
issuerCurrency?: string;
|
|
259
|
+
comboCard?: string;
|
|
260
|
+
binLength?: number;
|
|
261
|
+
authentication?: unknown;
|
|
262
|
+
cost?: unknown;
|
|
263
|
+
bank?: BinDetailsBank;
|
|
264
|
+
country?: BinDetailsCountry;
|
|
265
|
+
product?: BinDetailsProduct;
|
|
266
|
+
}
|
|
267
|
+
export interface BinDetailsBank {
|
|
268
|
+
name?: string;
|
|
269
|
+
phone?: string;
|
|
270
|
+
url?: string;
|
|
271
|
+
cleanName?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface BinDetailsCountry {
|
|
274
|
+
alpha2?: string;
|
|
275
|
+
name?: string;
|
|
276
|
+
numeric?: string;
|
|
277
|
+
}
|
|
278
|
+
export interface BinDetailsProduct {
|
|
279
|
+
code?: string;
|
|
280
|
+
name?: string;
|
|
281
|
+
}
|
|
282
|
+
export type Primitive = string | number | boolean | null;
|
|
283
|
+
export type TokenType = 'token' | 'card' | 'bank' | 'card_number' | 'us_bank_routing_number' | 'us_bank_account_number' | 'social_security_number';
|
|
284
|
+
export interface Auditable {
|
|
285
|
+
createdBy?: string;
|
|
286
|
+
createdAt?: string;
|
|
287
|
+
modifiedBy?: string;
|
|
288
|
+
modifiedAt?: string;
|
|
289
|
+
}
|
|
290
|
+
export type DataObject<DataType = Primitive> = {
|
|
291
|
+
[member: string]: TokenData<DataType>;
|
|
292
|
+
};
|
|
293
|
+
type DataArray<DataType> = Array<TokenData<DataType>>;
|
|
294
|
+
type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
|
|
295
|
+
export interface TokenBase<DataType = Primitive> extends Auditable {
|
|
296
|
+
data: TokenData<DataType>;
|
|
297
|
+
type: TokenType;
|
|
298
|
+
}
|
|
299
|
+
export interface ReactResponse {
|
|
300
|
+
tokens: DataObject;
|
|
301
|
+
raw: DataObject;
|
|
302
|
+
}
|
|
303
|
+
export const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
|
|
304
|
+
export type DataClassification = (typeof DATA_CLASSIFICATIONS)[number];
|
|
305
|
+
export const DATA_IMPACT_LEVELS: readonly ["low", "moderate", "high"];
|
|
306
|
+
export type DataImpactLevel = (typeof DATA_IMPACT_LEVELS)[number];
|
|
307
|
+
export const DATA_RESTRICTION_POLICIES: readonly ["mask", "redact"];
|
|
308
|
+
export type DataRestrictionPolicy = (typeof DATA_RESTRICTION_POLICIES)[number];
|
|
309
|
+
type MaskObject = {
|
|
310
|
+
[member: string]: TokenMask;
|
|
311
|
+
};
|
|
312
|
+
type MaskArray = Array<TokenMask>;
|
|
313
|
+
type TokenMask = string | null | MaskObject | MaskArray;
|
|
314
|
+
interface TokenEncryptionKey {
|
|
315
|
+
key: string;
|
|
316
|
+
alg: string;
|
|
317
|
+
}
|
|
318
|
+
interface TokenEncryption {
|
|
319
|
+
cek: TokenEncryptionKey;
|
|
320
|
+
kek: TokenEncryptionKey;
|
|
321
|
+
}
|
|
322
|
+
interface TokenPrivacy {
|
|
323
|
+
classification?: DataClassification;
|
|
324
|
+
impactLevel?: DataImpactLevel;
|
|
325
|
+
restrictionPolicy?: DataRestrictionPolicy;
|
|
326
|
+
}
|
|
327
|
+
export interface TokenEnrichments {
|
|
328
|
+
binDetails?: BinDetails;
|
|
329
|
+
}
|
|
330
|
+
export type Token<DataType = Primitive> = TokenBase<DataType> & {
|
|
331
|
+
id: string;
|
|
332
|
+
privacy?: TokenPrivacy;
|
|
333
|
+
containers?: string[];
|
|
334
|
+
encryption?: TokenEncryption;
|
|
335
|
+
searchIndexes?: string[];
|
|
336
|
+
fingerprintExpression?: string;
|
|
337
|
+
mask?: TokenMask;
|
|
338
|
+
expiresAt?: string;
|
|
339
|
+
enrichments?: TokenEnrichments;
|
|
340
|
+
tenantId: string;
|
|
341
|
+
fingerprint?: string;
|
|
342
|
+
metadata?: Record<string, string>;
|
|
343
|
+
};
|
|
344
|
+
export type CreateTokenModel<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
345
|
+
deduplicateToken?: boolean;
|
|
346
|
+
id?: string;
|
|
347
|
+
};
|
|
348
|
+
export type UpdateTokenModel<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
349
|
+
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
350
|
+
deduplicateToken: boolean;
|
|
351
|
+
}>;
|
|
352
|
+
export type TokenizeObject<DataType = Primitive> = {
|
|
353
|
+
[key: string]: Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType;
|
|
354
|
+
};
|
|
355
|
+
export type TokenizeArray<DataType = Primitive> = Array<Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType>;
|
|
356
|
+
export type TokenizeDataModel<DataType = Primitive> = TokenizeArray<DataType> | TokenizeObject<DataType>;
|
|
357
|
+
export interface Card {
|
|
358
|
+
number: string;
|
|
359
|
+
expirationMonth?: number;
|
|
360
|
+
expirationYear?: number;
|
|
361
|
+
cvc?: string;
|
|
362
|
+
}
|
|
363
|
+
export interface IssuerCountry {
|
|
364
|
+
alpha2: string;
|
|
365
|
+
name: string;
|
|
366
|
+
numeric: string;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Make all properties in T nullable
|
|
370
|
+
*/
|
|
371
|
+
export type Nullable<T> = {
|
|
372
|
+
[P in keyof T]: T[P] | null;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Make selected properties in T nullable
|
|
376
|
+
*/
|
|
377
|
+
export type NullableProps<T, K extends keyof T> = T | Nullable<Pick<T, K>>;
|
|
378
|
+
export interface TokenIntentCardDetails {
|
|
379
|
+
type: 'card';
|
|
380
|
+
card: {
|
|
381
|
+
bin: string;
|
|
382
|
+
last4: string;
|
|
383
|
+
brand: string;
|
|
384
|
+
funding: string;
|
|
385
|
+
expirationMonth: number;
|
|
386
|
+
expirationYear: number;
|
|
387
|
+
issuerCountry?: IssuerCountry;
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
interface TokenIntentBankDetails {
|
|
391
|
+
type: 'bank';
|
|
392
|
+
bank: {
|
|
393
|
+
routingNumber: string;
|
|
394
|
+
accountNumberLast4: string;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
type TokenTypesForTokenIntents = Exclude<TokenType, 'token' | 'card' | 'bank'>;
|
|
398
|
+
type TokenTypeMap = {
|
|
399
|
+
[K in TokenTypesForTokenIntents]: {
|
|
400
|
+
type: K;
|
|
401
|
+
} & Record<K, Record<string, unknown>>;
|
|
402
|
+
};
|
|
403
|
+
export type TokenIntent<DataType = DataObject> = (TokenBase<DataType> & Omit<Auditable, 'modifiedAt' | 'modifiedBy'> & {
|
|
404
|
+
id: string;
|
|
405
|
+
tenantId: string;
|
|
406
|
+
expiresAt: string;
|
|
407
|
+
fingerprint?: string;
|
|
408
|
+
}) & (TokenTypeMap[TokenTypesForTokenIntents] | TokenIntentCardDetails | TokenIntentBankDetails | {
|
|
409
|
+
type: 'token';
|
|
410
|
+
});
|
|
411
|
+
export type CreateTokenIntentModel<DataType = DataObject> = Pick<TokenIntent<DataType>, 'type' | 'data'>;
|
|
412
|
+
interface RequestOptions {
|
|
413
|
+
apiKey?: string;
|
|
414
|
+
correlationId?: string;
|
|
415
|
+
idempotencyKey?: string;
|
|
416
|
+
}
|
|
417
|
+
type Create<T, C> = {
|
|
418
|
+
create(model: C, options?: RequestOptions): Promise<T>;
|
|
419
|
+
};
|
|
420
|
+
type Retrieve<T> = {
|
|
421
|
+
retrieve(id: string, options?: RequestOptions): Promise<T>;
|
|
422
|
+
};
|
|
423
|
+
type Update<T, U> = {
|
|
424
|
+
update(id: string, model: U, options?: RequestOptions): Promise<T>;
|
|
425
|
+
};
|
|
426
|
+
export type TokenizeData = TokenizeDataModel<ElementValue>;
|
|
427
|
+
export interface Tokenize {
|
|
428
|
+
tokenize(tokens: TokenizeData, options?: RequestOptions): Promise<TokenizeDataModel>;
|
|
429
|
+
}
|
|
430
|
+
export type CreateToken = CreateTokenModel<ElementValue>;
|
|
431
|
+
export type UpdateToken = UpdateTokenModel<ElementValue>;
|
|
432
|
+
export type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken>;
|
|
433
|
+
type BasisTheoryProxyHeaders = {
|
|
434
|
+
[key: string]: string;
|
|
435
|
+
'BT-PROXY-URL': string;
|
|
436
|
+
'BT-PROXY-KEY': string;
|
|
437
|
+
};
|
|
438
|
+
type ProxyHeaders = Partial<BasisTheoryProxyHeaders>;
|
|
439
|
+
type BasisTheoryQueryParams = {
|
|
440
|
+
[key: string]: string;
|
|
441
|
+
'bt-proxy-key': string;
|
|
442
|
+
};
|
|
443
|
+
type ProxyQuery = Partial<BasisTheoryQueryParams>;
|
|
444
|
+
export interface ProxyRequestOptions extends RequestOptions {
|
|
445
|
+
includeResponseHeaders?: boolean;
|
|
446
|
+
path?: string;
|
|
447
|
+
query?: ProxyQuery;
|
|
448
|
+
headers?: ProxyHeaders;
|
|
449
|
+
body?: unknown;
|
|
450
|
+
}
|
|
451
|
+
export interface Proxy {
|
|
452
|
+
get(options?: ProxyRequestOptions): Promise<unknown>;
|
|
453
|
+
post(options?: ProxyRequestOptions): Promise<unknown>;
|
|
454
|
+
patch(options?: ProxyRequestOptions): Promise<unknown>;
|
|
455
|
+
put(options?: ProxyRequestOptions): Promise<unknown>;
|
|
456
|
+
delete(options?: ProxyRequestOptions): Promise<unknown>;
|
|
457
|
+
}
|
|
458
|
+
export type CreateTokenIntent = CreateTokenIntentModel<ElementValue>;
|
|
459
|
+
export type TokenIntents = Create<TokenIntent, CreateTokenIntent>;
|
|
460
|
+
type CreateSessionResponse = {
|
|
461
|
+
sessionKey: string;
|
|
462
|
+
nonce: string;
|
|
463
|
+
expiresAt: string;
|
|
464
|
+
_debug?: Record<string, unknown>;
|
|
465
|
+
};
|
|
466
|
+
interface Sessions {
|
|
467
|
+
create(options?: RequestOptions): Promise<CreateSessionResponse>;
|
|
468
|
+
}
|
|
469
|
+
export interface BaseElement<UpdateOptions, ElementEvents> {
|
|
470
|
+
readonly mounted: boolean;
|
|
471
|
+
readonly metadata: ElementMetadata;
|
|
472
|
+
mount(selector: string): Promise<void>;
|
|
473
|
+
mount(element: Element): Promise<void>;
|
|
474
|
+
update(options: UpdateOptions): Promise<void>;
|
|
475
|
+
clear(): void;
|
|
476
|
+
focus(): void;
|
|
477
|
+
blur(): void;
|
|
478
|
+
unmount(): void;
|
|
479
|
+
on<T extends EventType>(eventType: T, listener: ElementEventListener<ElementEvents, T>): Subscription;
|
|
480
|
+
}
|
|
481
|
+
export type ICardElement = BaseElement<UpdateCardElementOptions, CardElementEvents> & {
|
|
482
|
+
readonly cardMetadata?: CardMetadata;
|
|
483
|
+
setValue(value: CardElementValue<'reference'>): void;
|
|
484
|
+
validate(): void;
|
|
485
|
+
};
|
|
486
|
+
export type ITextElement = BaseElement<UpdateTextElementOptions, TextElementEvents> & {
|
|
487
|
+
setValueRef(value: ITextElement): void;
|
|
488
|
+
setValue(value: DataElementReference): void;
|
|
489
|
+
};
|
|
490
|
+
export type ICardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents> & {
|
|
491
|
+
readonly cardMetadata?: CardMetadata;
|
|
492
|
+
setValueRef(value: ICardNumberElement): void;
|
|
493
|
+
setValue(value: DataElementReference): void;
|
|
494
|
+
};
|
|
495
|
+
export type ICardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
|
|
496
|
+
setValueRef(value: ICardExpirationDateElement): void;
|
|
497
|
+
setValue(value: CardExpirationDateValue<'reference'>): void;
|
|
498
|
+
month(): ElementWrapper<ICardExpirationDateElement>;
|
|
499
|
+
year(): ElementWrapper<ICardExpirationDateElement>;
|
|
500
|
+
format(dateFormat: string): ElementWrapper<ICardExpirationDateElement>;
|
|
501
|
+
};
|
|
502
|
+
export type ICardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents> & {
|
|
503
|
+
setValueRef(value: ICardVerificationCodeElement): void;
|
|
504
|
+
setValue(value: DataElementReference): void;
|
|
505
|
+
};
|
|
506
|
+
export type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
|
|
507
|
+
element: T;
|
|
508
|
+
method?: string;
|
|
509
|
+
formattingOptions?: {
|
|
510
|
+
format: string;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
export type ElementValue = ITextElement | ICardElement | ICardNumberElement | ICardExpirationDateElement | ICardVerificationCodeElement | ElementWrapper;
|
|
514
|
+
export interface BasisTheoryElements {
|
|
515
|
+
tokens: Tokens;
|
|
516
|
+
proxy: Proxy;
|
|
517
|
+
sessions: Sessions;
|
|
518
|
+
tokenIntents: TokenIntents;
|
|
519
|
+
tokenize: Tokenize['tokenize'];
|
|
520
|
+
client: HttpClient;
|
|
521
|
+
createElement(type: 'card', options?: CreateCardElementOptions): ICardElement;
|
|
522
|
+
createElement(type: 'text', options: CreateTextElementOptions): ITextElement;
|
|
523
|
+
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): ICardNumberElement;
|
|
524
|
+
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): ICardExpirationDateElement;
|
|
525
|
+
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): ICardVerificationCodeElement;
|
|
526
|
+
}
|
|
527
|
+
export interface BasisTheoryElementsInternal extends BasisTheoryElements {
|
|
528
|
+
init: (apiKey: string | undefined, elementsBaseUrl: string, elementsUseNgApi: boolean | undefined, elementsUseSameOriginApi: boolean | undefined, disableTelemetry: boolean | undefined, debug: boolean | undefined) => Promise<BasisTheoryElements>;
|
|
529
|
+
hasElement: (payload: unknown) => boolean;
|
|
530
|
+
}
|
|
531
|
+
declare global {
|
|
532
|
+
interface Window {
|
|
533
|
+
BasisTheoryElements?: BasisTheoryElementsInternal;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
export interface BasisTheoryInitOptions {
|
|
537
|
+
_devMode?: boolean;
|
|
538
|
+
disableTelemetry?: boolean;
|
|
539
|
+
useSameOriginApi?: boolean;
|
|
540
|
+
debug?: boolean;
|
|
541
|
+
}
|
|
542
|
+
export const basistheory: (apiKey: string, options?: BasisTheoryInitOptions) => Promise<BasisTheoryElements | undefined>;
|
|
543
|
+
declare global {
|
|
544
|
+
interface Window {
|
|
545
|
+
basistheory?: typeof basistheory;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
interface BasisTheoryProviderProps {
|
|
549
|
+
bt?: BasisTheoryElements;
|
|
550
|
+
}
|
|
551
|
+
export const BasisTheoryProvider: ({ bt, children, }: PropsWithChildren<BasisTheoryProviderProps>) => JSX.Element;
|
|
552
|
+
export const useBasisTheory: (apiKey?: string, options?: BasisTheoryInitOptions) => {
|
|
553
|
+
bt: BasisTheoryElements | undefined;
|
|
554
|
+
error: Error | undefined;
|
|
555
|
+
} | {
|
|
556
|
+
bt: BasisTheoryElements | undefined;
|
|
557
|
+
error?: undefined;
|
|
558
|
+
};
|
|
559
|
+
export interface CardElementProps {
|
|
560
|
+
autoComplete?: CreateCardElementOptions['autoComplete'];
|
|
561
|
+
bt?: BasisTheoryElements;
|
|
562
|
+
cardTypes?: CreditCardType[];
|
|
563
|
+
copyIconStyles?: CopyIconStyles;
|
|
564
|
+
disabled?: boolean;
|
|
565
|
+
enableCopy?: boolean;
|
|
566
|
+
id: string;
|
|
567
|
+
inputMode?: `${InputMode}`;
|
|
568
|
+
onBlur?: ElementEventListener<CardElementEvents, 'blur'>;
|
|
569
|
+
onChange?: ElementEventListener<CardElementEvents, 'change'>;
|
|
570
|
+
onFocus?: ElementEventListener<CardElementEvents, 'focus'>;
|
|
571
|
+
onKeyDown?: ElementEventListener<CardElementEvents, 'keydown'>;
|
|
572
|
+
onReady?: ElementEventListener<CardElementEvents, 'ready'>;
|
|
573
|
+
placeholder?: CardElementPlaceholder;
|
|
574
|
+
readOnly?: boolean;
|
|
575
|
+
skipLuhnValidation?: boolean;
|
|
576
|
+
style?: ElementStyle;
|
|
577
|
+
validateOnChange?: boolean;
|
|
578
|
+
value?: CardElementValue<'static'>;
|
|
579
|
+
}
|
|
580
|
+
export const CardElement: React.ForwardRefExoticComponent<CardElementProps & React.RefAttributes<ICardElement>>;
|
|
581
|
+
interface BaseTextElementProps {
|
|
582
|
+
'aria-label'?: string;
|
|
583
|
+
autoComplete?: CreateTextElementOptions['autoComplete'];
|
|
584
|
+
bt?: BasisTheoryElements;
|
|
585
|
+
disabled?: boolean;
|
|
586
|
+
id: string;
|
|
587
|
+
inputMode?: `${InputMode}`;
|
|
588
|
+
maxLength?: HTMLInputElement['maxLength'];
|
|
589
|
+
onBlur?: ElementEventListener<TextElementEvents, 'blur'>;
|
|
590
|
+
onChange?: ElementEventListener<TextElementEvents, 'change'>;
|
|
591
|
+
onFocus?: ElementEventListener<TextElementEvents, 'focus'>;
|
|
592
|
+
onKeyDown?: ElementEventListener<TextElementEvents, 'keydown'>;
|
|
593
|
+
onReady?: ElementEventListener<TextElementEvents, 'ready'>;
|
|
594
|
+
placeholder?: string;
|
|
595
|
+
readOnly?: boolean;
|
|
596
|
+
style?: ElementStyle;
|
|
597
|
+
transform?: RegExp | [RegExp, string?];
|
|
598
|
+
validateOnChange?: boolean;
|
|
599
|
+
validation?: RegExp;
|
|
600
|
+
value?: string;
|
|
601
|
+
valueRef?: MutableRefObject<ITextElement | null>;
|
|
602
|
+
}
|
|
603
|
+
interface MaskedTextElementProps extends BaseTextElementProps {
|
|
604
|
+
mask?: (RegExp | string)[];
|
|
605
|
+
password?: false;
|
|
606
|
+
}
|
|
607
|
+
interface PasswordTextElementProps extends BaseTextElementProps {
|
|
608
|
+
mask?: never;
|
|
609
|
+
password: true;
|
|
610
|
+
}
|
|
611
|
+
export type TextElementProps = MaskedTextElementProps | PasswordTextElementProps;
|
|
612
|
+
export const TextElement: React.ForwardRefExoticComponent<TextElementProps & React.RefAttributes<ITextElement>>;
|
|
613
|
+
export interface CardNumberElementProps {
|
|
614
|
+
'aria-label'?: string;
|
|
615
|
+
autoComplete?: CreateCardNumberElementOptions['autoComplete'];
|
|
616
|
+
bt?: BasisTheoryElements;
|
|
617
|
+
cardTypes?: CreditCardType[];
|
|
618
|
+
copyIconStyles?: CopyIconStyles;
|
|
619
|
+
disabled?: boolean;
|
|
620
|
+
enableCopy?: boolean;
|
|
621
|
+
iconPosition?: SanitizedElementOptions['iconPosition'];
|
|
622
|
+
id: string;
|
|
623
|
+
inputMode?: `${InputMode}`;
|
|
624
|
+
onBlur?: ElementEventListener<CardNumberElementEvents, 'blur'>;
|
|
625
|
+
onChange?: ElementEventListener<CardNumberElementEvents, 'change'>;
|
|
626
|
+
onFocus?: ElementEventListener<CardNumberElementEvents, 'focus'>;
|
|
627
|
+
onKeyDown?: ElementEventListener<CardNumberElementEvents, 'keydown'>;
|
|
628
|
+
onReady?: ElementEventListener<CardNumberElementEvents, 'ready'>;
|
|
629
|
+
placeholder?: string;
|
|
630
|
+
readOnly?: boolean;
|
|
631
|
+
skipLuhnValidation?: boolean;
|
|
632
|
+
style?: ElementStyle;
|
|
633
|
+
validateOnChange?: boolean;
|
|
634
|
+
value?: string;
|
|
635
|
+
valueRef?: MutableRefObject<ICardNumberElement | null>;
|
|
636
|
+
}
|
|
637
|
+
export const CardNumberElement: React.ForwardRefExoticComponent<CardNumberElementProps & React.RefAttributes<ICardNumberElement>>;
|
|
638
|
+
export interface CardExpirationDateElementProps {
|
|
639
|
+
'aria-label'?: string;
|
|
640
|
+
autoComplete?: CreateCardExpirationDateElementOptions['autoComplete'];
|
|
641
|
+
bt?: BasisTheoryElements;
|
|
642
|
+
copyIconStyles?: CopyIconStyles;
|
|
643
|
+
disabled?: boolean;
|
|
644
|
+
enableCopy?: boolean;
|
|
645
|
+
id: string;
|
|
646
|
+
inputMode?: `${InputMode}`;
|
|
647
|
+
onBlur?: ElementEventListener<CardExpirationDateElementEvents, 'blur'>;
|
|
648
|
+
onChange?: ElementEventListener<CardExpirationDateElementEvents, 'change'>;
|
|
649
|
+
onFocus?: ElementEventListener<CardExpirationDateElementEvents, 'focus'>;
|
|
650
|
+
onKeyDown?: ElementEventListener<CardExpirationDateElementEvents, 'keydown'>;
|
|
651
|
+
onReady?: ElementEventListener<CardExpirationDateElementEvents, 'ready'>;
|
|
652
|
+
placeholder?: string;
|
|
653
|
+
readOnly?: boolean;
|
|
654
|
+
style?: ElementStyle;
|
|
655
|
+
validateOnChange?: boolean;
|
|
656
|
+
value?: CardExpirationDateValue<'static'> | string;
|
|
657
|
+
valueRef?: MutableRefObject<ICardExpirationDateElement | null>;
|
|
658
|
+
}
|
|
659
|
+
export const CardExpirationDateElement: React.ForwardRefExoticComponent<CardExpirationDateElementProps & React.RefAttributes<ICardExpirationDateElement>>;
|
|
660
|
+
export interface CardVerificationCodeElementProps {
|
|
661
|
+
'aria-label'?: string;
|
|
662
|
+
autoComplete?: CreateCardVerificationCodeElementOptions['autoComplete'];
|
|
663
|
+
bt?: BasisTheoryElements;
|
|
664
|
+
cardBrand?: Brand | string;
|
|
665
|
+
copyIconStyles?: CopyIconStyles;
|
|
666
|
+
disabled?: boolean;
|
|
667
|
+
enableCopy?: boolean;
|
|
668
|
+
id: string;
|
|
669
|
+
inputMode?: `${InputMode}`;
|
|
670
|
+
onBlur?: ElementEventListener<CardVerificationCodeElementEvents, 'blur'>;
|
|
671
|
+
onChange?: ElementEventListener<CardVerificationCodeElementEvents, 'change'>;
|
|
672
|
+
onFocus?: ElementEventListener<CardVerificationCodeElementEvents, 'focus'>;
|
|
673
|
+
onKeyDown?: ElementEventListener<CardVerificationCodeElementEvents, 'keydown'>;
|
|
674
|
+
onReady?: ElementEventListener<CardVerificationCodeElementEvents, 'ready'>;
|
|
675
|
+
placeholder?: string;
|
|
676
|
+
readOnly?: boolean;
|
|
677
|
+
style?: ElementStyle;
|
|
678
|
+
validateOnChange?: boolean;
|
|
679
|
+
value?: string;
|
|
680
|
+
valueRef?: MutableRefObject<ICardVerificationCodeElement | null>;
|
|
681
|
+
}
|
|
682
|
+
export const CardVerificationCodeElement: React.ForwardRefExoticComponent<CardVerificationCodeElementProps & React.RefAttributes<ICardVerificationCodeElement>>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { BasisTheoryElements } from '@basis-theory/web-elements';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
interface BasisTheoryProviderValue {
|
|
4
|
-
bt?: BasisTheoryElements;
|
|
5
|
-
}
|
|
6
|
-
interface BasisTheoryProviderProps {
|
|
7
|
-
bt?: BasisTheoryElements;
|
|
8
|
-
}
|
|
9
|
-
declare const BasisTheoryProvider: ({ bt, children, }: PropsWithChildren<BasisTheoryProviderProps>) => JSX.Element;
|
|
10
|
-
declare const useBasisTheoryFromContext: () => BasisTheoryProviderValue;
|
|
11
|
-
export { BasisTheoryProvider, useBasisTheoryFromContext };
|
package/types/core/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BasisTheoryElements, BasisTheoryInitOptions } from '@basis-theory/web-elements';
|
|
2
|
-
declare const useBasisTheory: (apiKey?: string, options?: BasisTheoryInitOptions) => {
|
|
3
|
-
bt: BasisTheoryElements | undefined;
|
|
4
|
-
error: Error | undefined;
|
|
5
|
-
} | {
|
|
6
|
-
bt: BasisTheoryElements | undefined;
|
|
7
|
-
error?: undefined;
|
|
8
|
-
};
|
|
9
|
-
export { useBasisTheory };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { BasisTheoryElements, CardElement as ICardElement, CardElementEvents, CardElementPlaceholder, CardElementValue, CopyIconStyles, CreateCardElementOptions, CreditCardType, ElementEventListener, ElementStyle, InputMode } from '@basis-theory/web-elements';
|
|
3
|
-
interface CardElementProps {
|
|
4
|
-
autoComplete?: CreateCardElementOptions['autoComplete'];
|
|
5
|
-
bt?: BasisTheoryElements;
|
|
6
|
-
cardTypes?: CreditCardType[];
|
|
7
|
-
copyIconStyles?: CopyIconStyles;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
enableCopy?: boolean;
|
|
10
|
-
id: string;
|
|
11
|
-
inputMode?: `${InputMode}`;
|
|
12
|
-
onBlur?: ElementEventListener<CardElementEvents, 'blur'>;
|
|
13
|
-
onChange?: ElementEventListener<CardElementEvents, 'change'>;
|
|
14
|
-
onFocus?: ElementEventListener<CardElementEvents, 'focus'>;
|
|
15
|
-
onKeyDown?: ElementEventListener<CardElementEvents, 'keydown'>;
|
|
16
|
-
onReady?: ElementEventListener<CardElementEvents, 'ready'>;
|
|
17
|
-
placeholder?: CardElementPlaceholder;
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
skipLuhnValidation?: boolean;
|
|
20
|
-
style?: ElementStyle;
|
|
21
|
-
validateOnChange?: boolean;
|
|
22
|
-
value?: CardElementValue<'static'>;
|
|
23
|
-
}
|
|
24
|
-
export declare const CardElement: React.ForwardRefExoticComponent<CardElementProps & React.RefAttributes<ICardElement>>;
|
|
25
|
-
export type { CardElementProps };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import type { BasisTheoryElements, CardExpirationDateElement as ICardExpirationDateElement, CardExpirationDateElementEvents, CardExpirationDateValue, CopyIconStyles, CreateCardExpirationDateElementOptions, ElementEventListener, ElementStyle, InputMode } from '@basis-theory/web-elements';
|
|
3
|
-
interface CardExpirationDateElementProps {
|
|
4
|
-
'aria-label'?: string;
|
|
5
|
-
autoComplete?: CreateCardExpirationDateElementOptions['autoComplete'];
|
|
6
|
-
bt?: BasisTheoryElements;
|
|
7
|
-
copyIconStyles?: CopyIconStyles;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
enableCopy?: boolean;
|
|
10
|
-
id: string;
|
|
11
|
-
inputMode?: `${InputMode}`;
|
|
12
|
-
onBlur?: ElementEventListener<CardExpirationDateElementEvents, 'blur'>;
|
|
13
|
-
onChange?: ElementEventListener<CardExpirationDateElementEvents, 'change'>;
|
|
14
|
-
onFocus?: ElementEventListener<CardExpirationDateElementEvents, 'focus'>;
|
|
15
|
-
onKeyDown?: ElementEventListener<CardExpirationDateElementEvents, 'keydown'>;
|
|
16
|
-
onReady?: ElementEventListener<CardExpirationDateElementEvents, 'ready'>;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
style?: ElementStyle;
|
|
20
|
-
validateOnChange?: boolean;
|
|
21
|
-
value?: CardExpirationDateValue<'static'> | string;
|
|
22
|
-
valueRef?: MutableRefObject<ICardExpirationDateElement | null>;
|
|
23
|
-
}
|
|
24
|
-
export declare const CardExpirationDateElement: React.ForwardRefExoticComponent<CardExpirationDateElementProps & React.RefAttributes<ICardExpirationDateElement>>;
|
|
25
|
-
export type { CardExpirationDateElementProps };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import type { BasisTheoryElements, CardNumberElement as ICardNumberElement, CardNumberElementEvents, CopyIconStyles, CreateCardNumberElementOptions, CreditCardType, ElementEventListener, ElementStyle, InputMode, SanitizedElementOptions } from '@basis-theory/web-elements';
|
|
3
|
-
interface CardNumberElementProps {
|
|
4
|
-
'aria-label'?: string;
|
|
5
|
-
autoComplete?: CreateCardNumberElementOptions['autoComplete'];
|
|
6
|
-
bt?: BasisTheoryElements;
|
|
7
|
-
cardTypes?: CreditCardType[];
|
|
8
|
-
copyIconStyles?: CopyIconStyles;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
enableCopy?: boolean;
|
|
11
|
-
iconPosition?: SanitizedElementOptions['iconPosition'];
|
|
12
|
-
id: string;
|
|
13
|
-
inputMode?: `${InputMode}`;
|
|
14
|
-
onBlur?: ElementEventListener<CardNumberElementEvents, 'blur'>;
|
|
15
|
-
onChange?: ElementEventListener<CardNumberElementEvents, 'change'>;
|
|
16
|
-
onFocus?: ElementEventListener<CardNumberElementEvents, 'focus'>;
|
|
17
|
-
onKeyDown?: ElementEventListener<CardNumberElementEvents, 'keydown'>;
|
|
18
|
-
onReady?: ElementEventListener<CardNumberElementEvents, 'ready'>;
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
readOnly?: boolean;
|
|
21
|
-
skipLuhnValidation?: boolean;
|
|
22
|
-
style?: ElementStyle;
|
|
23
|
-
validateOnChange?: boolean;
|
|
24
|
-
value?: string;
|
|
25
|
-
valueRef?: MutableRefObject<ICardNumberElement | null>;
|
|
26
|
-
}
|
|
27
|
-
export declare const CardNumberElement: React.ForwardRefExoticComponent<CardNumberElementProps & React.RefAttributes<ICardNumberElement>>;
|
|
28
|
-
export type { CardNumberElementProps };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import type { BasisTheoryElements, Brand, CardVerificationCodeElement as ICardVerificationCodeElement, CardVerificationCodeElementEvents, CopyIconStyles, CreateCardVerificationCodeElementOptions, ElementEventListener, ElementStyle, InputMode } from '@basis-theory/web-elements';
|
|
3
|
-
interface CardVerificationCodeElementProps {
|
|
4
|
-
'aria-label'?: string;
|
|
5
|
-
autoComplete?: CreateCardVerificationCodeElementOptions['autoComplete'];
|
|
6
|
-
bt?: BasisTheoryElements;
|
|
7
|
-
cardBrand?: Brand | string;
|
|
8
|
-
copyIconStyles?: CopyIconStyles;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
enableCopy?: boolean;
|
|
11
|
-
id: string;
|
|
12
|
-
inputMode?: `${InputMode}`;
|
|
13
|
-
onBlur?: ElementEventListener<CardVerificationCodeElementEvents, 'blur'>;
|
|
14
|
-
onChange?: ElementEventListener<CardVerificationCodeElementEvents, 'change'>;
|
|
15
|
-
onFocus?: ElementEventListener<CardVerificationCodeElementEvents, 'focus'>;
|
|
16
|
-
onKeyDown?: ElementEventListener<CardVerificationCodeElementEvents, 'keydown'>;
|
|
17
|
-
onReady?: ElementEventListener<CardVerificationCodeElementEvents, 'ready'>;
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
style?: ElementStyle;
|
|
21
|
-
validateOnChange?: boolean;
|
|
22
|
-
value?: string;
|
|
23
|
-
valueRef?: MutableRefObject<ICardVerificationCodeElement | null>;
|
|
24
|
-
}
|
|
25
|
-
export declare const CardVerificationCodeElement: React.ForwardRefExoticComponent<CardVerificationCodeElementProps & React.RefAttributes<ICardVerificationCodeElement>>;
|
|
26
|
-
export type { CardVerificationCodeElementProps };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import type { BasisTheoryElements, CreateTextElementOptions, ElementEventListener, ElementStyle, InputMode, TextElement as ITextElement, TextElementEvents } from '@basis-theory/web-elements';
|
|
3
|
-
interface BaseTextElementProps {
|
|
4
|
-
'aria-label'?: string;
|
|
5
|
-
autoComplete?: CreateTextElementOptions['autoComplete'];
|
|
6
|
-
bt?: BasisTheoryElements;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
id: string;
|
|
9
|
-
inputMode?: `${InputMode}`;
|
|
10
|
-
maxLength?: HTMLInputElement['maxLength'];
|
|
11
|
-
onBlur?: ElementEventListener<TextElementEvents, 'blur'>;
|
|
12
|
-
onChange?: ElementEventListener<TextElementEvents, 'change'>;
|
|
13
|
-
onFocus?: ElementEventListener<TextElementEvents, 'focus'>;
|
|
14
|
-
onKeyDown?: ElementEventListener<TextElementEvents, 'keydown'>;
|
|
15
|
-
onReady?: ElementEventListener<TextElementEvents, 'ready'>;
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
readOnly?: boolean;
|
|
18
|
-
style?: ElementStyle;
|
|
19
|
-
transform?: RegExp | [RegExp, string?];
|
|
20
|
-
validation?: RegExp;
|
|
21
|
-
value?: string;
|
|
22
|
-
valueRef?: MutableRefObject<ITextElement | null>;
|
|
23
|
-
}
|
|
24
|
-
interface MaskedTextElementProps extends BaseTextElementProps {
|
|
25
|
-
mask?: (RegExp | string)[];
|
|
26
|
-
password?: false;
|
|
27
|
-
}
|
|
28
|
-
interface PasswordTextElementProps extends BaseTextElementProps {
|
|
29
|
-
mask?: never;
|
|
30
|
-
password: true;
|
|
31
|
-
}
|
|
32
|
-
type TextElementProps = MaskedTextElementProps | PasswordTextElementProps;
|
|
33
|
-
export declare const TextElement: React.ForwardRefExoticComponent<TextElementProps & React.RefAttributes<ITextElement>>;
|
|
34
|
-
export type { TextElementProps };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { CardElement } from './CardElement';
|
|
2
|
-
export type { CardElementProps } from './CardElement';
|
|
3
|
-
export { TextElement } from './TextElement';
|
|
4
|
-
export type { TextElementProps } from './TextElement';
|
|
5
|
-
export { CardNumberElement } from './CardNumberElement';
|
|
6
|
-
export type { CardNumberElementProps } from './CardNumberElement';
|
|
7
|
-
export { CardExpirationDateElement } from './CardExpirationDateElement';
|
|
8
|
-
export type { CardExpirationDateElementProps } from './CardExpirationDateElement';
|
|
9
|
-
export { CardVerificationCodeElement } from './CardVerificationCodeElement';
|
|
10
|
-
export type { CardVerificationCodeElementProps } from './CardVerificationCodeElement';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { BasisTheoryElements } from '@basis-theory/web-elements';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves which BasisTheoryReact instance to use,
|
|
4
|
-
* by favoring the optional parameter.
|
|
5
|
-
* For internal use only.
|
|
6
|
-
* @param bt
|
|
7
|
-
* @returns parameter if it exists; instance from Context otherwise
|
|
8
|
-
*/
|
|
9
|
-
declare const useBasisTheoryValue: (bt?: BasisTheoryElements) => BasisTheoryElements | undefined;
|
|
10
|
-
export { useBasisTheoryValue };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { ForwardedRef, MutableRefObject } from 'react';
|
|
2
|
-
import type { BaseElement, BasisTheoryElements, ElementType } from '@basis-theory/web-elements';
|
|
3
|
-
/**
|
|
4
|
-
* Creates, mounts and indexes an Element
|
|
5
|
-
* with React lifecycle
|
|
6
|
-
* @param id
|
|
7
|
-
* @param type
|
|
8
|
-
* @param options
|
|
9
|
-
* @param wrapperRef
|
|
10
|
-
* @param btFromProps
|
|
11
|
-
* @param ref optional ref to set the underlying element
|
|
12
|
-
* @returns created element and initial options used for mounting
|
|
13
|
-
*/
|
|
14
|
-
declare const useElement: <Element extends BaseElement<any, any>, Options extends unknown>(id: string, type: ElementType, wrapperRef: React.RefObject<HTMLDivElement>, options: Options, btFromProps?: BasisTheoryElements, ref?: ForwardedRef<Element>, targetValueRef?: MutableRefObject<Element | null>) => Element | undefined;
|
|
15
|
-
export { useElement };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BaseElement, ElementEventListener, EventType } from '@basis-theory/web-elements';
|
|
2
|
-
declare const useListener: <T extends EventType, Ev, E extends BaseElement<unknown, Ev>>(eventType: T, element?: E, listener?: ElementEventListener<Ev, T>) => void;
|
|
3
|
-
export { useListener };
|
package/types/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from '@basis-theory/web-elements';
|