skyflow-js 2.6.0 → 2.7.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.
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "skyflow-js",
3
3
  "preferGlobal": true,
4
4
  "analyze": false,
5
- "version": "2.6.0",
5
+ "version": "2.7.0",
6
6
  "author": "Skyflow",
7
7
  "description": "Skyflow JavaScript SDK",
8
8
  "homepage": "https://github.com/skyflowapi/skyflow-js",
@@ -1,5 +1,6 @@
1
1
  import { ISkyflow } from '../skyflow';
2
2
  import { ClientMetadata } from '../core/internal/internal-types';
3
+ import { ErrorMessages } from '../utils/common';
3
4
  export interface IClientRequest {
4
5
  body?: Document | XMLHttpRequestBodyInit | null;
5
6
  headers?: Record<string, string>;
@@ -17,7 +18,9 @@ export interface ClientToJSON {
17
18
  declare class Client {
18
19
  #private;
19
20
  config: ISkyflow;
21
+ errorMessagesList: Partial<ErrorMessages>;
20
22
  constructor(config: ISkyflow, metadata: ClientMetadata);
23
+ setErrorMessages(messages: ErrorMessages): void;
21
24
  toJSON(): ClientToJSON;
22
25
  static fromJSON(json: ClientToJSON): Client;
23
26
  request: (request: IClientRequest) => Promise<unknown>;
@@ -10,6 +10,7 @@ export declare const DOMAIN = "US2";
10
10
  export declare const CORALOGIX_DOMAIN = "https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/coralogix-browser-sdk.js";
11
11
  export declare const FRAME_ELEMENT = "element";
12
12
  export declare const COMPOSABLE_REVEAL = "reveal-composable";
13
+ export declare const CUSTOM_ERROR_MESSAGES = "CUSTOM_ERROR_MESSAGES";
13
14
  export declare const ELEMENT_TYPES: {
14
15
  COLLECT: string;
15
16
  REVEAL: string;
@@ -1,4 +1,4 @@
1
- import { Context, CollectElementInput, CollectElementOptions, CollectResponse, ICollectOptions, UploadFilesResponse, ContainerOptions } from '../../../utils/common';
1
+ import { Context, CollectElementInput, CollectElementOptions, CollectResponse, ICollectOptions, UploadFilesResponse, ContainerOptions, ErrorType } from '../../../utils/common';
2
2
  import { ElementType } from '../../constants';
3
3
  import Container from '../common/container';
4
4
  import CollectElement from './collect-element';
@@ -32,6 +32,7 @@ declare class CollectContainer extends Container {
32
32
  type: string;
33
33
  constructor(metaData: Metadata, skyflowElements: Array<SkyflowElementProps>, context: Context, options?: ContainerOptions);
34
34
  create: (input: CollectElementInput, options?: CollectElementOptions) => CollectElement;
35
+ setError(errors: Partial<Record<ErrorType, string>>): void;
35
36
  collect: (options?: ICollectOptions) => Promise<CollectResponse>;
36
37
  uploadFiles: (options?: ICollectOptions) => Promise<UploadFilesResponse>;
37
38
  }
@@ -1,4 +1,4 @@
1
- import { Context, CollectElementInput, CollectElementOptions, ICollectOptions, CollectResponse, InputStyles, ErrorTextStyles, ContainerOptions, UploadFilesResponse } from '../../../utils/common';
1
+ import { Context, CollectElementInput, CollectElementOptions, ICollectOptions, CollectResponse, InputStyles, ErrorTextStyles, ContainerOptions, UploadFilesResponse, ErrorType } from '../../../utils/common';
2
2
  import Container from '../common/container';
3
3
  import ComposableElement from './compose-collect-element';
4
4
  import { ElementGroup } from './collect-container';
@@ -12,6 +12,7 @@ declare class ComposableContainer extends Container {
12
12
  type: string;
13
13
  constructor(metaData: Metadata, skyflowElements: Array<SkyflowElementProps>, context: Context, options: ContainerOptions);
14
14
  create: (input: CollectElementInput, options?: CollectElementOptions) => ComposableElement;
15
+ setError(errors: Partial<Record<ErrorType, string>>): void;
15
16
  on: (eventName: string, handler: Function) => void;
16
17
  mount: (domElement: HTMLElement | string) => void;
17
18
  unmount: () => void;
@@ -1,7 +1,7 @@
1
1
  import { Context } from '../../../utils/common';
2
2
  import Container from '../common/container';
3
3
  import ComposableRevealElement from './composable-reveal-element';
4
- import { ContainerOptions, RevealElementInput, RevealResponse } from '../../../index-node';
4
+ import { ContainerOptions, ErrorType, RevealElementInput, RevealResponse } from '../../../index-node';
5
5
  import { IRevealElementOptions } from './reveal-container';
6
6
  import { Metadata, SkyflowElementProps } from '../../internal/internal-types';
7
7
  declare class ComposableRevealContainer extends Container {
@@ -9,6 +9,7 @@ declare class ComposableRevealContainer extends Container {
9
9
  type: string;
10
10
  constructor(metaData: Metadata, skyflowElements: Array<SkyflowElementProps>, context: Context, options?: ContainerOptions);
11
11
  create: (input: RevealElementInput, options?: IRevealElementOptions) => ComposableRevealElement;
12
+ setError(errors: Partial<Record<ErrorType, string>>): void;
12
13
  mount: (domElement: HTMLElement | string) => void;
13
14
  unmount: () => void;
14
15
  reveal(): Promise<RevealResponse>;
@@ -1,4 +1,4 @@
1
- import { ContainerOptions, Context, RedactionType, RevealResponse } from '../../../utils/common';
1
+ import { ContainerOptions, Context, ErrorType, RedactionType, RevealResponse } from '../../../utils/common';
2
2
  import Container from '../common/container';
3
3
  import RevealElement from './reveal-element';
4
4
  import { Metadata, SkyflowElementProps } from '../../internal/internal-types';
@@ -24,6 +24,7 @@ declare class RevealContainer extends Container {
24
24
  type: string;
25
25
  constructor(metaData: Metadata, skyflowElements: Array<SkyflowElementProps>, context: Context, options?: ContainerOptions);
26
26
  create(record: IRevealElementInput, options?: IRevealElementOptions): RevealElement;
27
+ setError(errors: Partial<Record<ErrorType, string>>): void;
27
28
  reveal(): Promise<RevealResponse>;
28
29
  }
29
30
  export default RevealContainer;
@@ -1,4 +1,4 @@
1
- import { Context } from '../../utils/common';
1
+ import { Context, ErrorType } from '../../utils/common';
2
2
  import IFrameFormElement from './iframe-form';
3
3
  import FrameElement from '.';
4
4
  export default class FrameElementInit {
@@ -15,7 +15,7 @@ export default class FrameElementInit {
15
15
  constructor();
16
16
  private handleCollectCall;
17
17
  private parallelUploadFiles;
18
- uploadFiles: (fileElement: any, clientConfig: any) => Promise<unknown>;
18
+ uploadFiles: (fileElement: any, clientConfig: any, errorMessages?: Record<ErrorType, string>) => Promise<unknown>;
19
19
  private tokenize;
20
20
  private multipleUploadFiles;
21
21
  private validateFiles;
@@ -3,7 +3,7 @@ import { IRevealRecord, IRevealResponseType, IGetRecord, ISkyflowIdRecord, IRend
3
3
  export declare const getFileURLForRender: (skyflowIdRecord: IRevealRecord, client: Client, authToken: string) => Promise<any>;
4
4
  export declare const getFileURLFromVaultBySkyflowID: (skyflowIdRecord: IRevealRecord, client: Client) => Promise<IRenderResponseType>;
5
5
  export declare const getFileURLFromVaultBySkyflowIDComposable: (skyflowIdRecord: IRevealRecord, client: Client, authToken: string) => Promise<IRenderResponseType>;
6
- export declare const fetchRecordsByTokenId: (tokenIdRecords: IRevealRecord[], client: Client) => Promise<IRevealResponseType>;
6
+ export declare const fetchRecordsByTokenId: (tokenIdRecords: IRevealRecord[], client: Client, purejs: boolean) => Promise<IRevealResponseType>;
7
7
  export declare const fetchRecordsByTokenIdComposable: (tokenIdRecords: IRevealRecordComposable[], client: Client, authToken: string) => Promise<IRevealResponseType>;
8
8
  export declare const formatRecordsForIframe: (response: IRevealResponseType) => Record<string, string>;
9
9
  export declare const formatRecordsForRender: (response: IRenderResponseType, column: any, skyflowID: any) => {
@@ -1,5 +1,5 @@
1
1
  import Skyflow from './skyflow';
2
- export { IInsertRecordInput as InsertRequest, IInsertRecord as InsertRecord, IInsertOptions as InsertOptions, IUpdateRequest as UpdateRequest, IUpdateOptions as UpdateOptions, UpdateResponse, InsertResponse, IDetokenizeInput as DetokenizeRequest, DetokenizeRecord, DetokenizeResponse, IDeleteRecordInput as DeleteRequest, IDeleteRecord as DeleteRecord, IDeleteOptions as DeleteOptions, DeleteResponse, IGetInput as GetRequest, IGetRecord as GetRecord, IGetOptions as GetOptions, GetResponse, IGetByIdInput as GetByIdRequest, GetByIdResponse, ContainerOptions, CollectElementInput, CollectElementUpdateOptions, CollectElementOptions, ICollectOptions as CollectOptions, CollectResponse, UploadFilesResponse, CardMetadata, InputStyles, LabelStyles, ErrorTextStyles, RedactionType, IRevealRecord as RevealRecord, RevealResponse, RenderFileResponse, IValidationRule as ValidationRule, ValidationRuleType, EventName, LogLevel, Env, ElementState, } from './utils/common';
2
+ export { IInsertRecordInput as InsertRequest, IInsertRecord as InsertRecord, IInsertOptions as InsertOptions, IUpdateRequest as UpdateRequest, IUpdateOptions as UpdateOptions, UpdateResponse, InsertResponse, IDetokenizeInput as DetokenizeRequest, DetokenizeRecord, DetokenizeResponse, IDeleteRecordInput as DeleteRequest, IDeleteRecord as DeleteRecord, IDeleteOptions as DeleteOptions, DeleteResponse, IGetInput as GetRequest, IGetRecord as GetRecord, IGetOptions as GetOptions, GetResponse, IGetByIdInput as GetByIdRequest, GetByIdResponse, ContainerOptions, CollectElementInput, CollectElementUpdateOptions, CollectElementOptions, ICollectOptions as CollectOptions, CollectResponse, UploadFilesResponse, CardMetadata, InputStyles, LabelStyles, ErrorTextStyles, RedactionType, IRevealRecord as RevealRecord, RevealResponse, RenderFileResponse, IValidationRule as ValidationRule, ValidationRuleType, EventName, LogLevel, Env, ElementState, ErrorType, ErrorMessages, } from './utils/common';
3
3
  export { IRevealElementInput as RevealElementInput, IRevealElementOptions as RevealElementOptions, } from './core/external/reveal/reveal-container';
4
4
  export { ThreeDSBrowserDetails } from './core/external/threeds/threeds';
5
5
  export { CardType, ElementType, } from './core/constants';
@@ -1,6 +1,8 @@
1
+ import { ErrorType } from '../utils/common';
1
2
  export interface ISkyflowError {
2
3
  code: string | number;
3
4
  description: string;
5
+ type?: ErrorType | string | undefined;
4
6
  }
5
7
  export default class SkyflowError extends Error {
6
8
  error?: ISkyflowError;
@@ -2,7 +2,7 @@ import { ElementType, CardType } from './core/constants';
2
2
  import RevealContainer from './core/external/reveal/reveal-container';
3
3
  import CollectContainer from './core/external/collect/collect-container';
4
4
  import SkyflowError from './libs/skyflow-error';
5
- import { RequestMethod, IInsertRecordInput, IDetokenizeInput, IGetInput, RedactionType, EventName, Env, LogLevel, ValidationRuleType, IGetByIdInput, IInsertOptions, IDeleteRecordInput, IDeleteOptions, IGetOptions, InsertResponse, GetResponse, GetByIdResponse, DeleteResponse, ContainerOptions, DetokenizeResponse, IUpdateRequest, UpdateResponse, IUpdateOptions } from './utils/common';
5
+ import { RequestMethod, IInsertRecordInput, IDetokenizeInput, IGetInput, RedactionType, EventName, Env, LogLevel, ValidationRuleType, IGetByIdInput, IInsertOptions, IDeleteRecordInput, IDeleteOptions, IGetOptions, InsertResponse, GetResponse, GetByIdResponse, DeleteResponse, ContainerOptions, DetokenizeResponse, IUpdateRequest, UpdateResponse, IUpdateOptions, ErrorType } from './utils/common';
6
6
  import ComposableContainer from './core/external/collect/compose-collect-container';
7
7
  import ThreeDS from './core/external/threeds/threeds';
8
8
  import ComposableRevealContainer from './core/external/reveal/composable-reveal-container';
@@ -42,6 +42,7 @@ declare class Skyflow {
42
42
  static get ContainerType(): typeof ContainerType;
43
43
  static get ElementType(): typeof ElementType;
44
44
  static get RedactionType(): typeof RedactionType;
45
+ static get ErrorType(): typeof ErrorType;
45
46
  static get RequestMethod(): typeof RequestMethod;
46
47
  static get LogLevel(): typeof LogLevel;
47
48
  static get EventName(): typeof EventName;
@@ -5,6 +5,24 @@ declare global {
5
5
  CoralogixRum: any;
6
6
  }
7
7
  }
8
+ export declare enum ErrorType {
9
+ BAD_REQUEST = "400",
10
+ UNAUTHORIZED = "401",
11
+ FORBIDDEN = "403",
12
+ NOT_FOUND = "404",
13
+ TOO_MANY_REQUESTS = "429",
14
+ INTERNAL_SERVER_ERROR = "500",
15
+ BAD_GATEWAY = "502",
16
+ SERVICE_UNAVAILABLE = "503",
17
+ CONNECTION = "CONNECTION",
18
+ TIMEOUT = "TIMEOUT",
19
+ ABORT = "ABORT",
20
+ NETWORK_GENERIC = "NETWORK_GENERIC",
21
+ OFFLINE = "OFFLINE"
22
+ }
23
+ export type ErrorMessages = {
24
+ [key in ErrorType]: string;
25
+ };
8
26
  export declare enum RedactionType {
9
27
  DEFAULT = "DEFAULT",
10
28
  PLAIN_TEXT = "PLAIN_TEXT",