@basis-theory/basis-theory-js 2.0.0 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -5,10 +5,6 @@ export declare const BasisTheoryTokens: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  retrieve(id: string, options?: RequestOptions): Promise<Token<any>>;
7
7
  update(id: string, model: UpdateToken, options?: RequestOptions): Promise<Token>;
8
- createAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
9
- deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
10
- createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
11
- listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
12
8
  search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
13
9
  readonly client: import("axios").AxiosInstance;
14
10
  };
@@ -40,26 +40,6 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
40
40
  }).then(_utils.dataExtractor);
41
41
  }
42
42
 
43
- async createAssociation(parentId, childId, options) {
44
- const url = `/${parentId}/children/${childId}`;
45
- await this.client.post(url, {}, (0, _common.createRequestConfig)(options));
46
- }
47
-
48
- async deleteAssociation(parentId, childId, options) {
49
- const url = `/${parentId}/children/${childId}`;
50
- await this.client.delete(url, (0, _common.createRequestConfig)(options));
51
- }
52
-
53
- createChild(parentId, token, options) {
54
- const url = `/${parentId}/children`;
55
- return this.client.post(url, token, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
56
- }
57
-
58
- listChildren(parentId, query = {}, options = {}) {
59
- const url = `/${parentId}/children${(0, _common.getQueryParams)(query)}`;
60
- return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
61
- }
62
-
63
43
  search(searchRequest, options) {
64
44
  return this.client.post('/search', searchRequest, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
65
45
  }
@@ -1,30 +1,41 @@
1
1
  import { AutoCompleteValue, DataElementReference } from './shared';
2
2
  import type { ElementStyle } from './styles';
3
- declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode", "data"];
3
+ declare const ELEMENTS_TYPES: readonly ["card", "cardExpirationDate", "cardNumber", "cardVerificationCode", "data", "text"];
4
4
  type ElementType = typeof ELEMENTS_TYPES[number];
5
5
  interface ElementInternalOptions {
6
6
  apiKey: string | undefined;
7
- type: ElementType;
8
7
  baseUrl: string;
8
+ type: ElementType;
9
+ }
10
+ declare enum InputMode {
11
+ DECIMAL = "decimal",
12
+ EMAIL = "email",
13
+ NONE = "none",
14
+ NUMERIC = "numeric",
15
+ SEARCH = "search",
16
+ TEL = "tel",
17
+ TEXT = "text",
18
+ URL = "url"
9
19
  }
10
20
  interface SanitizedElementOptions {
11
- validateOnChange?: boolean;
12
- enableCopy?: boolean;
13
- style?: ElementStyle;
21
+ ariaDescription?: string;
22
+ ariaLabel?: string;
23
+ autoComplete?: string;
24
+ cardBrand?: string;
14
25
  disabled?: boolean;
15
- readOnly?: boolean;
16
- targetId?: string;
26
+ enableCopy?: boolean;
27
+ iconPosition?: string;
28
+ inputMode?: `${InputMode}`;
17
29
  mask?: (RegExp | string)[];
18
30
  password?: boolean;
19
31
  placeholder?: string;
32
+ readOnly?: boolean;
33
+ style?: ElementStyle;
34
+ targetId?: string;
20
35
  transform?: [RegExp, string] | null;
21
- ariaDescription?: string;
22
- ariaLabel?: string;
23
- iconPosition?: string;
24
- cardBrand?: string;
25
- autoComplete?: string;
26
- value?: CardElementValue<'static'> | CardExpirationDateValue<'static'> | string;
36
+ validateOnChange?: boolean;
27
37
  validation?: RegExp;
38
+ value?: CardElementValue<'static'> | CardExpirationDateValue<'static'> | string;
28
39
  }
29
40
  type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
30
41
  type Transform = RegExp | [RegExp, string?] | null;
@@ -34,13 +45,13 @@ interface TransformOption {
34
45
  interface AutoCompleteOption {
35
46
  autoComplete?: AutoCompleteValue;
36
47
  }
37
- type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled' | 'readOnly' | 'validateOnChange' | 'enableCopy'> & AutoCompleteOption;
48
+ type CustomizableElementOptions = Pick<ElementOptions, 'disabled' | 'enableCopy' | 'inputMode' | 'readOnly' | 'style' | 'validateOnChange'> & AutoCompleteOption;
38
49
  type ElementValueType = 'static' | 'reference';
39
50
  interface CardElementValue<T extends ElementValueType> {
40
- number?: T extends 'reference' ? DataElementReference : string;
51
+ cvc?: T extends 'reference' ? DataElementReference : string;
41
52
  expiration_month?: T extends 'reference' ? DataElementReference : number;
42
53
  expiration_year?: T extends 'reference' ? DataElementReference : number;
43
- cvc?: T extends 'reference' ? DataElementReference : string;
54
+ number?: T extends 'reference' ? DataElementReference : string;
44
55
  }
45
56
  interface CardExpirationDateValue<T extends ElementValueType> {
46
57
  month: T extends 'reference' ? DataElementReference : number;
@@ -70,5 +81,5 @@ type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pic
70
81
  value?: string;
71
82
  };
72
83
  type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
73
- export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, CardElementValue, CardExpirationDateValue, };
84
+ export type { CardElementValue, CardExpirationDateValue, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, CustomizableElementOptions, ElementInternalOptions, ElementOptions, ElementType, InputMode, SanitizedElementOptions, Transform, UpdateCardElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardNumberElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions, };
74
85
  export { ELEMENTS_TYPES };
@@ -4,5 +4,17 @@ 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', 'data'];
8
- exports.ELEMENTS_TYPES = ELEMENTS_TYPES;
7
+ const ELEMENTS_TYPES = ['card', 'cardExpirationDate', 'cardNumber', 'cardVerificationCode', 'data', 'text'];
8
+ exports.ELEMENTS_TYPES = ELEMENTS_TYPES;
9
+ var InputMode;
10
+
11
+ (function (InputMode) {
12
+ InputMode["DECIMAL"] = "decimal";
13
+ InputMode["EMAIL"] = "email";
14
+ InputMode["NONE"] = "none";
15
+ InputMode["NUMERIC"] = "numeric";
16
+ InputMode["SEARCH"] = "search";
17
+ InputMode["TEL"] = "tel";
18
+ InputMode["TEXT"] = "text";
19
+ InputMode["URL"] = "url";
20
+ })(InputMode || (InputMode = {}));
@@ -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?: any;
18
+ cost?: any;
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 @@
1
+ "use strict";
@@ -10,4 +10,5 @@ export * from './tokenize';
10
10
  export * from './proxies';
11
11
  export * from './banks';
12
12
  export * from './cards';
13
+ export * from './bin-details';
13
14
  export * from './util';
@@ -160,6 +160,19 @@ Object.keys(_cards).forEach(function (key) {
160
160
  });
161
161
  });
162
162
 
163
+ var _binDetails = require("./bin-details");
164
+
165
+ Object.keys(_binDetails).forEach(function (key) {
166
+ if (key === "default" || key === "__esModule") return;
167
+ if (key in exports && exports[key] === _binDetails[key]) return;
168
+ Object.defineProperty(exports, key, {
169
+ enumerable: true,
170
+ get: function () {
171
+ return _binDetails[key];
172
+ }
173
+ });
174
+ });
175
+
163
176
  var _util = require("./util");
164
177
 
165
178
  Object.keys(_util).forEach(function (key) {
@@ -1,3 +1,4 @@
1
+ import type { BinDetails } from './bin-details';
1
2
  import type { Primitive, TokenBase } from './shared';
2
3
  declare const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
3
4
  type DataClassification = typeof DATA_CLASSIFICATIONS[number];
@@ -28,6 +29,9 @@ interface TokenPrivacy {
28
29
  impactLevel?: DataImpactLevel;
29
30
  restrictionPolicy?: DataRestrictionPolicy;
30
31
  }
32
+ interface TokenEnrichments {
33
+ binDetails?: BinDetails;
34
+ }
31
35
  interface Token<DataType = Primitive> extends TokenBase {
32
36
  data: TokenData<DataType>;
33
37
  privacy?: TokenPrivacy;
@@ -37,6 +41,7 @@ interface Token<DataType = Primitive> extends TokenBase {
37
41
  fingerprintExpression?: string;
38
42
  mask?: TokenMask;
39
43
  expiresAt?: string;
44
+ enrichments?: TokenEnrichments;
40
45
  }
41
46
  type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
42
47
  deduplicateToken?: boolean;
@@ -46,5 +51,5 @@ type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' |
46
51
  privacy: Omit<TokenPrivacy, 'classification'>;
47
52
  deduplicateToken: boolean;
48
53
  }>;
49
- export type { Token, CreateToken, UpdateToken, DataArray, DataObject, TokenData, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
54
+ export type { Token, TokenEnrichments, CreateToken, UpdateToken, DataArray, DataObject, TokenData, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
50
55
  export { DATA_CLASSIFICATIONS, DATA_IMPACT_LEVELS, DATA_RESTRICTION_POLICIES };
@@ -11,10 +11,6 @@ interface SearchTokensRequest {
11
11
  size?: number;
12
12
  }
13
13
  interface Tokens extends Create<Token, CreateToken>, Update<Token, UpdateToken>, Retrieve<Token<any>>, Delete, List<Token, ListTokensQuery> {
14
- createAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
15
- deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
16
- createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
17
- listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
18
14
  search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
19
15
  }
20
16
  export type { Tokens, ListTokensQuery, SearchTokensRequest };