@basis-theory/react-elements 1.15.0 → 1.17.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 +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/react-elements",
3
- "version": "1.15.0",
3
+ "version": "1.17.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.15.0"
33
+ "@basis-theory/web-elements": "1.17.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
package/types/index.d.ts CHANGED
@@ -361,6 +361,17 @@ export type UpdateTokenModel<DataType = Primitive> = Partial<Pick<Token<DataType
361
361
  privacy: Omit<TokenPrivacy, 'classification'>;
362
362
  deduplicateToken: boolean;
363
363
  }>;
364
+ export type EncryptTokenModel<DataType = Primitive> = {
365
+ tokenRequests: {
366
+ [key: string]: Pick<CreateTokenModel<DataType>, 'data' | 'type'>;
367
+ } | Pick<CreateTokenModel<DataType>, 'data' | 'type'>;
368
+ public_key: string;
369
+ key_id: string;
370
+ };
371
+ export type EncryptedToken = {
372
+ encrypted: string;
373
+ type: TokenBase['type'];
374
+ };
364
375
  export type TokenizeObject<DataType = Primitive> = {
365
376
  [key: string]: Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType;
366
377
  };
@@ -435,13 +446,17 @@ type Retrieve<T> = {
435
446
  type Update<T, U> = {
436
447
  update(id: string, model: U, options?: RequestOptions): Promise<T>;
437
448
  };
449
+ type Encrypt<E, T> = {
450
+ encrypt(model: T, options?: RequestOptions): Promise<E>;
451
+ };
438
452
  export type TokenizeData = TokenizeDataModel<ElementValue>;
439
453
  export interface Tokenize {
440
454
  tokenize(tokens: TokenizeData, options?: RequestOptions): Promise<TokenizeDataModel>;
441
455
  }
442
456
  export type CreateToken = CreateTokenModel<ElementValue>;
443
457
  export type UpdateToken = UpdateTokenModel<ElementValue>;
444
- export type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken>;
458
+ type EncryptToken = EncryptTokenModel<ElementValue>;
459
+ export type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken> & Encrypt<EncryptedToken, EncryptToken>;
445
460
  type BasisTheoryProxyHeaders = {
446
461
  [key: string]: string;
447
462
  'BT-PROXY-URL': string;
@@ -555,7 +570,8 @@ export const basistheory: (apiKey: string, options?: BasisTheoryInitOptions) =>
555
570
  export class BasisTheoryApiError extends Error {
556
571
  readonly status: number;
557
572
  readonly data?: unknown | undefined;
558
- constructor(message: string, status: number, data?: unknown | undefined);
573
+ readonly _debug?: Record<string, unknown> | undefined;
574
+ constructor(message: string, status: number, data?: unknown | undefined, _debug?: Record<string, unknown> | undefined);
559
575
  }
560
576
  export class BasisTheoryValidationError<Details = Record<string, unknown>> extends Error {
561
577
  readonly details: Details;