@basis-theory/react-elements 1.24.1 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/types/index.d.ts +60 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/react-elements",
3
- "version": "1.24.1",
3
+ "version": "2.0.0",
4
4
  "repository": "https://github.com/basis-theory/react-elements",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,7 +30,7 @@
30
30
  "tag": "latest"
31
31
  },
32
32
  "dependencies": {
33
- "@basis-theory/web-elements": "1.24.1"
33
+ "@basis-theory/web-elements": "2.0.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
package/types/index.d.ts CHANGED
@@ -40,9 +40,55 @@ export interface HttpClient {
40
40
  get(url: string, config?: RequestConfig): Promise<unknown>;
41
41
  delete(url: string, config?: RequestConfig): Promise<unknown>;
42
42
  }
43
+ interface NetworkInformation {
44
+ downlink: number;
45
+ downlinkMax?: number;
46
+ effectiveType: 'slow-2g' | '2g' | '3g' | '4g';
47
+ rtt: number;
48
+ saveData: boolean;
49
+ type?: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
50
+ }
51
+ type DeviceInfo = {
52
+ uaBrands?: Array<{
53
+ brand: string;
54
+ version: string;
55
+ }>;
56
+ uaMobile?: boolean;
57
+ uaPlatform?: string;
58
+ uaPlatformVersion?: string;
59
+ languages?: string[];
60
+ timeZone?: string;
61
+ cookiesEnabled?: boolean;
62
+ localStorageEnabled?: boolean;
63
+ sessionStorageEnabled?: boolean;
64
+ platform?: string;
65
+ hardwareConcurrency?: number;
66
+ deviceMemoryGb?: number | null;
67
+ screenWidth?: number;
68
+ screenHeight?: number;
69
+ screenAvailWidth?: number;
70
+ screenAvailHeight?: number;
71
+ innerWidth?: number;
72
+ innerHeight?: number;
73
+ devicePixelRatio?: number;
74
+ maxTouchPoints?: number;
75
+ plugins?: string[];
76
+ mimeTypes?: string[];
77
+ webdriver?: boolean;
78
+ suspectedHeadless?: boolean;
79
+ webglVendor?: string;
80
+ webglRenderer?: string;
81
+ canvasHash?: string;
82
+ network?: NetworkInformation;
83
+ };
84
+ interface Device {
85
+ getDeviceInfo(options?: {
86
+ includeCanvasHash?: boolean;
87
+ }): DeviceInfo;
88
+ }
43
89
  export const CARD_BRANDS: readonly ["accel", "bancontact", "cartes-bancaires", "culiance", "dankort", "ebt", "eftpos-australia", "nyce", "private-label", "prop", "pulse", "rupay", "star", "uatp", "korean-local", "visa", "mastercard", "american-express", "discover", "diners-club", "jcb", "unionpay", "maestro", "elo", "hiper", "hipercard", "mir", "unknown"];
44
- declare const CARD_ICON_POSITIONS: readonly ["left", "right", "none"];
45
- 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"];
90
+ export const CARD_ICON_POSITIONS: readonly ["left", "right", "none"];
91
+ export 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"];
46
92
  export type FieldErrorType = 'incomplete' | 'invalid';
47
93
  export type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
48
94
  export interface ConfigError {
@@ -138,7 +184,7 @@ export type SafeStyle = Pick<Properties, SafeCSSProperty>;
138
184
  export const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", ":read-only", "::placeholder", "::selection", ":disabled"];
139
185
  export type CardElementStyleVariantSelector = (typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS)[number];
140
186
  export type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
141
- export const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "complete", "invalid", "empty"];
187
+ export const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "container", "complete", "invalid", "empty"];
142
188
  export const CARD_ELEMENT_STYLE_FONTS_ATTR: "fonts";
143
189
  export type CardElementStyleVariant = (typeof CARD_ELEMENT_STYLE_VARIANTS)[number];
144
190
  type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
@@ -278,12 +324,20 @@ export interface BinDetails {
278
324
  issuerCurrency?: string;
279
325
  comboCard?: string;
280
326
  binLength?: number;
281
- authentication?: unknown;
282
- cost?: unknown;
327
+ authentication?: Authentication;
328
+ cost?: Cost;
283
329
  bank?: BinDetailsBank;
284
330
  country?: BinDetailsCountry;
285
331
  product?: BinDetailsProduct;
286
332
  }
333
+ interface Cost {
334
+ capAdvaloremAmount: string;
335
+ capTypeName: string;
336
+ capFixedAmount: string;
337
+ }
338
+ interface Authentication {
339
+ authenticationName: string;
340
+ }
287
341
  export interface BinDetailsBank {
288
342
  name?: string;
289
343
  phone?: string;
@@ -582,6 +636,7 @@ export interface BasisTheoryElements {
582
636
  tokenIntents: TokenIntents;
583
637
  tokenize: Tokenize['tokenize'];
584
638
  client: HttpClient;
639
+ device: Device;
585
640
  createElement(type: 'card', options?: CreateCardElementOptions): ICardElement;
586
641
  createElement(type: 'text', options: CreateTextElementOptions): ITextElement;
587
642
  createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): ICardNumberElement;