@basis-theory/react-elements 1.5.0 → 1.7.2
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/CHANGELOG.md +15 -1
- package/dist/LICENSE +202 -0
- package/dist/README.md +126 -0
- package/dist/main/index.js +413 -0
- package/dist/module/module.js +391 -0
- package/dist/package.json +41 -0
- package/dist/types/index.d.ts +617 -0
- package/dist/types/react-elements/src/core/BasisTheoryProvider.d.ts +11 -0
- package/dist/types/react-elements/src/core/index.d.ts +4 -0
- package/dist/types/react-elements/src/core/useBasisTheory.d.ts +9 -0
- package/dist/types/react-elements/src/elements/CardElement.d.ts +26 -0
- package/dist/types/react-elements/src/elements/CardExpirationDateElement.d.ts +26 -0
- package/dist/types/react-elements/src/elements/CardNumberElement.d.ts +29 -0
- package/dist/types/react-elements/src/elements/CardVerificationCodeElement.d.ts +27 -0
- package/dist/types/react-elements/src/elements/TextElement.d.ts +35 -0
- package/dist/types/react-elements/src/elements/index.d.ts +10 -0
- package/dist/types/react-elements/src/elements/useBasisTheoryValue.d.ts +10 -0
- package/dist/types/react-elements/src/elements/useElement.d.ts +16 -0
- package/dist/types/react-elements/src/elements/useListener.d.ts +3 -0
- package/dist/types/react-elements/src/index.d.ts +2 -0
- package/dist/types/react-elements/src/types.d.ts +1 -0
- package/dist/types/web-elements/src/BasisTheory.d.ts +8 -0
- package/dist/types/web-elements/src/common/logging.d.ts +8 -0
- package/dist/types/web-elements/src/elements/constants.d.ts +9 -0
- package/dist/types/web-elements/src/elements/getOrCreateScriptElement.d.ts +1 -0
- package/dist/types/web-elements/src/elements/index.d.ts +2 -0
- package/dist/types/web-elements/src/elements/loadElements.d.ts +3 -0
- package/dist/types/web-elements/src/index.d.ts +8 -0
- package/dist/types/web-elements/src/types/elements/cardTypes.d.ts +29 -0
- package/dist/types/web-elements/src/types/elements/elements.d.ts +74 -0
- package/dist/types/web-elements/src/types/elements/events.d.ts +40 -0
- package/dist/types/web-elements/src/types/elements/index.d.ts +7 -0
- package/dist/types/web-elements/src/types/elements/options.d.ts +98 -0
- package/dist/types/web-elements/src/types/elements/services/index.d.ts +4 -0
- package/dist/types/web-elements/src/types/elements/services/proxy.d.ts +27 -0
- package/dist/types/web-elements/src/types/elements/services/sessions.d.ts +11 -0
- package/dist/types/web-elements/src/types/elements/services/shared.d.ts +21 -0
- package/dist/types/web-elements/src/types/elements/services/token-intents.d.ts +6 -0
- package/dist/types/web-elements/src/types/elements/services/tokenize.d.ts +8 -0
- package/dist/types/web-elements/src/types/elements/services/tokens.d.ts +7 -0
- package/dist/types/web-elements/src/types/elements/shared.d.ts +51 -0
- package/dist/types/web-elements/src/types/elements/styles.d.ts +25 -0
- package/dist/types/web-elements/src/types/index.d.ts +1 -0
- package/dist/types/web-elements/src/types/models/bin-details.d.ts +38 -0
- package/dist/types/web-elements/src/types/models/cards.d.ts +7 -0
- package/dist/types/web-elements/src/types/models/index.d.ts +7 -0
- package/dist/types/web-elements/src/types/models/shared.d.ts +22 -0
- package/dist/types/web-elements/src/types/models/token-intents.d.ts +28 -0
- package/dist/types/web-elements/src/types/models/tokenize.d.ts +7 -0
- package/dist/types/web-elements/src/types/models/tokens.d.ts +53 -0
- package/dist/types/web-elements/src/types/models/util.d.ts +11 -0
- package/dist/types/web-elements/src/types/sdk/index.d.ts +1 -0
- package/dist/types/web-elements/src/types/sdk/services/http.d.ts +11 -0
- package/dist/types/web-elements/src/types/sdk/services/index.d.ts +1 -0
- package/dist/types/web-elements/src/version.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Properties as CSSProperties } from 'csstype';
|
|
2
|
+
declare const SAFE_CSS_PROPERTIES: readonly ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "padding", "textDecoration", "textShadow", "textTransform"];
|
|
3
|
+
type SafeCSSProperty = typeof SAFE_CSS_PROPERTIES[number];
|
|
4
|
+
declare const SAFE_CSS_PROPERTIES_ALTERNATES: Partial<Record<SafeCSSProperty, string[]>>;
|
|
5
|
+
declare const SAFE_CSS_PROPERTIES_WITH_ALTERNATES: string[];
|
|
6
|
+
type SafeStyle = Pick<CSSProperties, SafeCSSProperty>;
|
|
7
|
+
declare const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", ":read-only", "::placeholder", "::selection", ":disabled"];
|
|
8
|
+
type CardElementStyleVariantSelector = typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS[number];
|
|
9
|
+
type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
|
|
10
|
+
declare const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "complete", "invalid", "empty"];
|
|
11
|
+
declare const CARD_ELEMENT_STYLE_FONTS_ATTR: "fonts";
|
|
12
|
+
type CardElementStyleVariant = typeof CARD_ELEMENT_STYLE_VARIANTS[number];
|
|
13
|
+
type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
|
|
14
|
+
type FontSource = string;
|
|
15
|
+
type FontSources = FontSource[];
|
|
16
|
+
type Fonts = Record<CardElementStyleFontAttr, FontSources>;
|
|
17
|
+
type CardElementStyle = Partial<Record<CardElementStyleVariant, CardElementStyleVariantStyle> & Fonts>;
|
|
18
|
+
type ElementStyle = CardElementStyle;
|
|
19
|
+
type CopyIconStyles = {
|
|
20
|
+
size?: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
successColor?: string;
|
|
23
|
+
};
|
|
24
|
+
export { SAFE_CSS_PROPERTIES, SAFE_CSS_PROPERTIES_ALTERNATES, SAFE_CSS_PROPERTIES_WITH_ALTERNATES, CARD_ELEMENT_STYLE_VARIANT_SELECTORS, CARD_ELEMENT_STYLE_VARIANTS, CARD_ELEMENT_STYLE_FONTS_ATTR, };
|
|
25
|
+
export type { CardElementStyle, CardElementStyleVariant, CardElementStyleVariantSelector, CardElementStyleVariantStyle, CopyIconStyles, ElementStyle, Fonts, FontSources, SafeCSSProperty, SafeStyle, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './elements';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface BinDetails {
|
|
2
|
+
cardBrand?: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
prepaid?: boolean;
|
|
5
|
+
cardSegmentType?: string;
|
|
6
|
+
reloadable?: boolean;
|
|
7
|
+
panOrToken?: string;
|
|
8
|
+
accountUpdater?: boolean;
|
|
9
|
+
alm?: boolean;
|
|
10
|
+
domesticOnly?: boolean;
|
|
11
|
+
gamblingBlocked?: boolean;
|
|
12
|
+
level2?: boolean;
|
|
13
|
+
level3?: boolean;
|
|
14
|
+
issuerCurrency?: string;
|
|
15
|
+
comboCard?: string;
|
|
16
|
+
binLength?: number;
|
|
17
|
+
authentication?: unknown;
|
|
18
|
+
cost?: unknown;
|
|
19
|
+
bank?: BinDetailsBank;
|
|
20
|
+
country?: BinDetailsCountry;
|
|
21
|
+
product?: BinDetailsProduct;
|
|
22
|
+
}
|
|
23
|
+
interface BinDetailsBank {
|
|
24
|
+
name?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
cleanName?: string;
|
|
28
|
+
}
|
|
29
|
+
interface BinDetailsCountry {
|
|
30
|
+
alpha2?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
numeric?: string;
|
|
33
|
+
}
|
|
34
|
+
interface BinDetailsProduct {
|
|
35
|
+
code?: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
export type { BinDetails, BinDetailsBank, BinDetailsCountry, BinDetailsProduct, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Primitive = string | number | boolean | null;
|
|
2
|
+
type TokenType = 'token' | 'card' | 'bank' | 'card_number' | 'us_bank_routing_number' | 'us_bank_account_number' | 'social_security_number';
|
|
3
|
+
interface Auditable {
|
|
4
|
+
createdBy?: string;
|
|
5
|
+
createdAt?: string;
|
|
6
|
+
modifiedBy?: string;
|
|
7
|
+
modifiedAt?: string;
|
|
8
|
+
}
|
|
9
|
+
type DataObject<DataType = Primitive> = {
|
|
10
|
+
[member: string]: TokenData<DataType>;
|
|
11
|
+
};
|
|
12
|
+
type DataArray<DataType> = Array<TokenData<DataType>>;
|
|
13
|
+
type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
|
|
14
|
+
interface TokenBase<DataType = Primitive> extends Auditable {
|
|
15
|
+
data: TokenData<DataType>;
|
|
16
|
+
type: TokenType;
|
|
17
|
+
}
|
|
18
|
+
interface ReactResponse {
|
|
19
|
+
tokens: DataObject;
|
|
20
|
+
raw: DataObject;
|
|
21
|
+
}
|
|
22
|
+
export type { Primitive, Auditable, TokenType, TokenBase, ReactResponse, DataObject, };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TokenBase, DataObject, Auditable, TokenType } from '../../types/models';
|
|
2
|
+
interface TokenIntentCardDetails {
|
|
3
|
+
type: 'card';
|
|
4
|
+
card: {
|
|
5
|
+
bin: string;
|
|
6
|
+
last4: string;
|
|
7
|
+
brand: string;
|
|
8
|
+
funding: string;
|
|
9
|
+
expirationMonth: number;
|
|
10
|
+
expirationYear: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
type TokenTypesForTokenIntents = Exclude<TokenType, 'token' | 'card'>;
|
|
14
|
+
type TokenTypeMap = {
|
|
15
|
+
[K in TokenTypesForTokenIntents]: {
|
|
16
|
+
type: K;
|
|
17
|
+
} & Record<K, Record<string, unknown>>;
|
|
18
|
+
};
|
|
19
|
+
type TokenIntent<DataType = DataObject> = (TokenBase<DataType> & Omit<Auditable, 'modifiedAt' | 'modifiedBy'> & {
|
|
20
|
+
id: string;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
expiresAt: string;
|
|
23
|
+
fingerprint?: string;
|
|
24
|
+
}) & (TokenTypeMap[TokenTypesForTokenIntents] | TokenIntentCardDetails | {
|
|
25
|
+
type: 'token';
|
|
26
|
+
});
|
|
27
|
+
type CreateTokenIntent<DataType = DataObject> = Pick<TokenIntent<DataType>, 'type' | 'data'>;
|
|
28
|
+
export type { TokenIntent, CreateTokenIntent, TokenIntentCardDetails };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Primitive } from './shared';
|
|
2
|
+
type TokenizeObject<DataType = Primitive> = {
|
|
3
|
+
[key: string]: Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType;
|
|
4
|
+
};
|
|
5
|
+
type TokenizeArray<DataType = Primitive> = Array<Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType>;
|
|
6
|
+
type TokenizeData<DataType = Primitive> = TokenizeArray<DataType> | TokenizeObject<DataType>;
|
|
7
|
+
export type { TokenizeObject, TokenizeArray, TokenizeData };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BinDetails } from './bin-details';
|
|
2
|
+
import type { Primitive, TokenBase } from './shared';
|
|
3
|
+
declare const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
|
|
4
|
+
type DataClassification = typeof DATA_CLASSIFICATIONS[number];
|
|
5
|
+
declare const DATA_IMPACT_LEVELS: readonly ["low", "moderate", "high"];
|
|
6
|
+
type DataImpactLevel = typeof DATA_IMPACT_LEVELS[number];
|
|
7
|
+
declare const DATA_RESTRICTION_POLICIES: readonly ["mask", "redact"];
|
|
8
|
+
type DataRestrictionPolicy = typeof DATA_RESTRICTION_POLICIES[number];
|
|
9
|
+
type MaskObject = {
|
|
10
|
+
[member: string]: TokenMask;
|
|
11
|
+
};
|
|
12
|
+
type MaskArray = Array<TokenMask>;
|
|
13
|
+
type TokenMask = string | null | MaskObject | MaskArray;
|
|
14
|
+
interface TokenEncryptionKey {
|
|
15
|
+
key: string;
|
|
16
|
+
alg: string;
|
|
17
|
+
}
|
|
18
|
+
interface TokenEncryption {
|
|
19
|
+
cek: TokenEncryptionKey;
|
|
20
|
+
kek: TokenEncryptionKey;
|
|
21
|
+
}
|
|
22
|
+
interface TokenPrivacy {
|
|
23
|
+
classification?: DataClassification;
|
|
24
|
+
impactLevel?: DataImpactLevel;
|
|
25
|
+
restrictionPolicy?: DataRestrictionPolicy;
|
|
26
|
+
}
|
|
27
|
+
interface TokenEnrichments {
|
|
28
|
+
binDetails?: BinDetails;
|
|
29
|
+
}
|
|
30
|
+
type Token<DataType = Primitive> = TokenBase<DataType> & {
|
|
31
|
+
id: string;
|
|
32
|
+
privacy?: TokenPrivacy;
|
|
33
|
+
containers?: string[];
|
|
34
|
+
encryption?: TokenEncryption;
|
|
35
|
+
searchIndexes?: string[];
|
|
36
|
+
fingerprintExpression?: string;
|
|
37
|
+
mask?: TokenMask;
|
|
38
|
+
expiresAt?: string;
|
|
39
|
+
enrichments?: TokenEnrichments;
|
|
40
|
+
tenantId: string;
|
|
41
|
+
fingerprint?: string;
|
|
42
|
+
metadata?: Record<string, string>;
|
|
43
|
+
};
|
|
44
|
+
type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
45
|
+
deduplicateToken?: boolean;
|
|
46
|
+
id?: string;
|
|
47
|
+
};
|
|
48
|
+
type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
49
|
+
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
50
|
+
deduplicateToken: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
export type { Token, TokenEnrichments, CreateToken, UpdateToken, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
|
|
53
|
+
export { DATA_CLASSIFICATIONS, DATA_IMPACT_LEVELS, DATA_RESTRICTION_POLICIES };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make all properties in T nullable
|
|
3
|
+
*/
|
|
4
|
+
type Nullable<T> = {
|
|
5
|
+
[P in keyof T]: T[P] | null;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Make selected properties in T nullable
|
|
9
|
+
*/
|
|
10
|
+
type NullableProps<T, K extends keyof T> = T | Nullable<Pick<T, K>>;
|
|
11
|
+
export type { Nullable, NullableProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './services';
|
|
@@ -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
|
+
export * from './http';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const version: "1.7.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basis-theory/react-elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"repository": "https://github.com/basis-theory/react-elements",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@basis-theory/basis-theory-js": "^4.27.0",
|
|
60
|
-
"@basis-theory/web-elements": "
|
|
60
|
+
"@basis-theory/web-elements": "1.7.2"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"ts-jest": "^29.2.5",
|
|
72
72
|
"typescript": "^5.7.2"
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|