@basis-theory/basis-theory-js 1.40.0 → 1.42.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.
@@ -1,10 +1,9 @@
1
1
  import type { BasisTheoryServiceOptions } from '@/service';
2
- import type { AtomicBank, AtomicReactRequest, ReactResponse, UpdateAtomicBank } from '@/types/models';
2
+ import type { AtomicBank, UpdateAtomicBank } from '@/types/models';
3
3
  import type { PaginatedQuery, RequestOptions } from '@/types/sdk';
4
4
  export declare const BasisTheoryAtomicBanks: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicBank, options?: RequestOptions | undefined): Promise<AtomicBank>;
7
- react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
7
  readonly client: import("axios").AxiosInstance;
9
8
  };
10
9
  } & (new (...args: any[]) => import("../../types/sdk/services/shared").Create<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Retrieve<AtomicBank>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../../types/sdk/services/shared").List<AtomicBank, PaginatedQuery>);
@@ -26,12 +26,5 @@ const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
26
26
  return this.client.patch(`/${id}`, request, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
27
27
  }
28
28
 
29
- react(tokenId, request, options) {
30
- return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
31
- transformRequest: _common.transformAtomicReactionRequestSnakeCase,
32
- transformResponse: _common.proxyRaw
33
- })).then(_common.dataExtractor);
34
- }
35
-
36
29
  }).create().retrieve().delete().list().build();
37
30
  exports.BasisTheoryAtomicBanks = BasisTheoryAtomicBanks;
@@ -1,10 +1,9 @@
1
1
  import type { BasisTheoryServiceOptions } from '@/service';
2
- import type { AtomicCard, AtomicReactRequest, ReactResponse, UpdateAtomicCard } from '@/types/models';
2
+ import type { AtomicCard, UpdateAtomicCard } from '@/types/models';
3
3
  import type { PaginatedQuery, RequestOptions } from '@/types/sdk';
4
4
  export declare const BasisTheoryAtomicCards: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicCard, options?: RequestOptions | undefined): Promise<AtomicCard>;
7
- react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
7
  readonly client: import("axios").AxiosInstance;
9
8
  };
10
9
  } & (new (...args: any[]) => import("../../types/sdk/services/shared").Create<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Retrieve<AtomicCard>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../../types/sdk/services/shared").List<AtomicCard, PaginatedQuery>);
@@ -28,12 +28,5 @@ const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
28
28
  return this.client.patch(`/${id}`, request, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
29
29
  }
30
30
 
31
- react(tokenId, request, options) {
32
- return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
33
- transformRequest: _common.transformAtomicReactionRequestSnakeCase,
34
- transformResponse: _common.proxyRaw
35
- })).then(_common.dataExtractor);
36
- }
37
-
38
31
  }).create().retrieve().delete().list().build();
39
32
  exports.BasisTheoryAtomicCards = BasisTheoryAtomicCards;
package/common/utils.d.ts CHANGED
@@ -6,7 +6,6 @@ declare const proxyRaw: AxiosTransformer;
6
6
  declare const transformReactorRequestSnakeCase: AxiosTransformer;
7
7
  declare const transformAtomicRequestSnakeCase: AxiosTransformer;
8
8
  declare const transformTokenRequestSnakeCase: AxiosTransformer;
9
- declare const transformAtomicReactionRequestSnakeCase: AxiosTransformer;
10
9
  declare const transformTokenResponseCamelCase: AxiosTransformer;
11
10
  declare const transformReactorResponseCamelCase: AxiosTransformer;
12
11
  declare const transformResponseCamelCase: AxiosTransformer;
@@ -22,4 +21,4 @@ declare const getBrowser: () => string;
22
21
  declare const getOSVersion: () => string;
23
22
  declare const getRuntime: () => string;
24
23
  declare const buildClientUserAgentString: (appInfo?: ApplicationInfo | undefined) => string;
25
- export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformAtomicReactionRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformerWithDefault, errorInterceptor, getQueryParams, buildUserAgentString, buildClientUserAgentString, getOSVersion, getRuntime, getBrowser, };
24
+ export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformerWithDefault, errorInterceptor, getQueryParams, buildUserAgentString, buildClientUserAgentString, getOSVersion, getRuntime, getBrowser, };
package/common/utils.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.transformAtomicReactionRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformerWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
6
+ exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformerWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
7
7
 
8
8
  var _axios = _interopRequireDefault(require("axios"));
9
9
 
@@ -99,23 +99,6 @@ const transformTokenRequestSnakeCase = token => {
99
99
 
100
100
  exports.transformTokenRequestSnakeCase = transformTokenRequestSnakeCase;
101
101
 
102
- const transformAtomicReactionRequestSnakeCase = request => {
103
- if (typeof request === 'undefined') {
104
- return undefined;
105
- }
106
-
107
- return { ...(0, _snakecaseKeys.default)(request, {
108
- deep: true
109
- }),
110
- ...(request.requestParameters !== undefined ? // eslint-disable-next-line camelcase
111
- {
112
- request_parameters: request.requestParameters
113
- } : {})
114
- };
115
- };
116
-
117
- exports.transformAtomicReactionRequestSnakeCase = transformAtomicReactionRequestSnakeCase;
118
-
119
102
  const transformTokenResponseCamelCase = token => {
120
103
  if (typeof token === 'undefined') {
121
104
  return undefined;
@@ -267,7 +250,7 @@ const getQueryParams = (query = {}) => {
267
250
  } else if (value && typeof value === 'object') {
268
251
  const objectKeys = Object.keys(value);
269
252
  objectKeys.forEach(objectKey => {
270
- appendSafe(`${key}.${objectKey}`, value[objectKey], true);
253
+ appendSafe(`${String(key)}.${objectKey}`, value[objectKey], true);
271
254
  });
272
255
  } else {
273
256
  appendSafe(String(key), value);
@@ -4,4 +4,5 @@ declare const ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = "BasisTheoryElements did not
4
4
  declare const ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = "There was an unknown error when loading BasisTheoryElements";
5
5
  declare const CARD_BRANDS: readonly ["visa", "mastercard", "american-express", "discover", "diners-club", "jcb", "unionpay", "maestro", "elo", "hiper", "hipercard", "mir", "unknown"];
6
6
  declare const CARD_ICON_POSITIONS: readonly ["left", "right", "none"];
7
- export { ELEMENTS_INIT_ERROR_MESSAGE, ELEMENTS_NOM_DOM_ERROR_MESSAGE, ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE, ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE, CARD_BRANDS, CARD_ICON_POSITIONS, };
7
+ declare const AUTOCOMPLETE_VALUES: readonly ["off", "on"];
8
+ export { ELEMENTS_INIT_ERROR_MESSAGE, ELEMENTS_NOM_DOM_ERROR_MESSAGE, ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE, ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE, CARD_BRANDS, CARD_ICON_POSITIONS, AUTOCOMPLETE_VALUES, };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = exports.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = exports.ELEMENTS_NOM_DOM_ERROR_MESSAGE = exports.ELEMENTS_INIT_ERROR_MESSAGE = exports.CARD_ICON_POSITIONS = exports.CARD_BRANDS = void 0;
6
+ exports.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = exports.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE = exports.ELEMENTS_NOM_DOM_ERROR_MESSAGE = exports.ELEMENTS_INIT_ERROR_MESSAGE = exports.CARD_ICON_POSITIONS = exports.CARD_BRANDS = exports.AUTOCOMPLETE_VALUES = void 0;
7
7
  const ELEMENTS_INIT_ERROR_MESSAGE = 'BasisTheory Elements was not properly initialized.';
8
8
  exports.ELEMENTS_INIT_ERROR_MESSAGE = ELEMENTS_INIT_ERROR_MESSAGE;
9
9
  const ELEMENTS_NOM_DOM_ERROR_MESSAGE = 'Tried to load BasisTheoryElements in a non-DOM environment.';
@@ -15,4 +15,6 @@ exports.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE = ELEMENTS_SCRIPT_UNKNOWN_ERROR_ME
15
15
  const CARD_BRANDS = ['visa', 'mastercard', 'american-express', 'discover', 'diners-club', 'jcb', 'unionpay', 'maestro', 'elo', 'hiper', 'hipercard', 'mir', 'unknown'];
16
16
  exports.CARD_BRANDS = CARD_BRANDS;
17
17
  const CARD_ICON_POSITIONS = ['left', 'right', 'none'];
18
- exports.CARD_ICON_POSITIONS = CARD_ICON_POSITIONS;
18
+ exports.CARD_ICON_POSITIONS = CARD_ICON_POSITIONS;
19
+ const AUTOCOMPLETE_VALUES = ['off', 'on'];
20
+ exports.AUTOCOMPLETE_VALUES = AUTOCOMPLETE_VALUES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.40.0",
3
+ "version": "1.42.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -1,3 +1,4 @@
1
+ import { AutoCompleteValue } from './shared';
1
2
  import type { ElementStyle } from './styles';
2
3
  declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode"];
3
4
  declare type ElementType = typeof ELEMENTS_TYPES[number];
@@ -18,13 +19,17 @@ interface SanitizedElementOptions {
18
19
  ariaLabel?: string;
19
20
  iconPosition?: string;
20
21
  cardBrand?: string;
22
+ autoComplete?: string;
21
23
  }
22
24
  declare type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
23
25
  declare type Transform = RegExp | [RegExp, string?] | null;
24
26
  interface TransformOption {
25
27
  transform?: Transform;
26
28
  }
27
- declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled'>;
29
+ interface AutoCompleteOption {
30
+ autoComplete?: AutoCompleteValue;
31
+ }
32
+ declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled'> & AutoCompleteOption;
28
33
  declare type CreateCardElementOptions = CustomizableElementOptions;
29
34
  declare type UpdateCardElementOptions = CreateCardElementOptions;
30
35
  declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
@@ -1,4 +1,4 @@
1
- import { CARD_BRANDS, CARD_ICON_POSITIONS } from '@/elements/constants';
1
+ import { AUTOCOMPLETE_VALUES, CARD_BRANDS, CARD_ICON_POSITIONS } from '@/elements/constants';
2
2
  declare type FieldErrorType = 'incomplete' | 'invalid';
3
3
  declare type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
4
4
  interface ConfigError {
@@ -24,4 +24,8 @@ declare type Brand = typeof CARD_BRANDS[number];
24
24
  * Icon position for card number element
25
25
  */
26
26
  declare type CardIconPosition = typeof CARD_ICON_POSITIONS[number];
27
- export type { FieldErrorType, ConfigErrorType, ConfigError, Targeted, ListenableKey, FieldError, PropertyError, Brand, CardIconPosition, };
27
+ /**
28
+ * Values for the element input autocomplete attribute
29
+ */
30
+ declare type AutoCompleteValue = typeof AUTOCOMPLETE_VALUES[number];
31
+ export type { FieldErrorType, ConfigErrorType, ConfigError, Targeted, ListenableKey, FieldError, PropertyError, Brand, CardIconPosition, AutoCompleteValue, };
@@ -14,12 +14,8 @@ interface TokenBase<T extends TokenType = TokenType> extends Auditable {
14
14
  fingerprint?: string;
15
15
  metadata?: Record<string, string>;
16
16
  }
17
- interface AtomicReactRequest {
18
- reactorId: string;
19
- requestParameters?: Record<string, unknown>;
20
- }
21
17
  interface ReactResponse {
22
18
  tokens: DataObject;
23
19
  raw: DataObject;
24
20
  }
25
- export type { Primitive, Auditable, TokenType, TokenBase, AtomicReactRequest, ReactResponse, };
21
+ export type { Primitive, Auditable, TokenType, TokenBase, ReactResponse };
@@ -38,6 +38,7 @@ interface Token<DataType = Primitive> extends TokenBase {
38
38
  }
39
39
  declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
40
40
  deduplicateToken?: boolean;
41
+ id?: string;
41
42
  };
42
43
  declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
43
44
  privacy: Omit<TokenPrivacy, 'classification'>;
@@ -1,5 +1,5 @@
1
1
  import type { AtomicBank, CreateAtomicBank, UpdateAtomicBank } from '@/types/models';
2
- import type { Create, Retrieve, Update, Delete, List, AtomicReact } from './shared';
3
- interface AtomicBanks extends Create<AtomicBank, CreateAtomicBank>, Retrieve<AtomicBank>, Update<AtomicBank, UpdateAtomicBank>, Delete, List<AtomicBank>, AtomicReact {
2
+ import type { Create, Retrieve, Update, Delete, List } from './shared';
3
+ interface AtomicBanks extends Create<AtomicBank, CreateAtomicBank>, Retrieve<AtomicBank>, Update<AtomicBank, UpdateAtomicBank>, Delete, List<AtomicBank> {
4
4
  }
5
5
  export type { AtomicBanks };
@@ -1,5 +1,5 @@
1
1
  import type { AtomicCard, CreateAtomicCard, UpdateAtomicCard } from '@/types/models';
2
- import type { Create, Retrieve, Update, Delete, List, AtomicReact } from './shared';
3
- interface AtomicCards extends Create<AtomicCard, CreateAtomicCard>, Retrieve<AtomicCard>, Update<AtomicCard, UpdateAtomicCard>, Delete, List<AtomicCard>, AtomicReact {
2
+ import type { Create, Retrieve, Update, Delete, List } from './shared';
3
+ interface AtomicCards extends Create<AtomicCard, CreateAtomicCard>, Retrieve<AtomicCard>, Update<AtomicCard, UpdateAtomicCard>, Delete, List<AtomicCard> {
4
4
  }
5
5
  export type { AtomicCards };
@@ -1,4 +1,3 @@
1
- import type { AtomicReactRequest, ReactResponse } from '@/types/models';
2
1
  interface RequestOptions {
3
2
  apiKey?: string;
4
3
  correlationId?: string;
@@ -34,7 +33,4 @@ declare type Delete = {
34
33
  declare type List<T, Q extends PaginatedQuery = PaginatedQuery> = {
35
34
  list(query?: Q, options?: RequestOptions): Promise<PaginatedList<T>>;
36
35
  };
37
- declare type AtomicReact = {
38
- react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions): Promise<ReactResponse>;
39
- };
40
- export type { RequestOptions, PaginatedQuery, PaginatedList, Create, Retrieve, Update, Delete, List, AtomicReact, };
36
+ export type { RequestOptions, PaginatedQuery, PaginatedList, Create, Retrieve, Update, Delete, List, };