skyflow-js 2.4.3 → 2.5.0-beta.10

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.4.3",
5
+ "version": "2.5.0-beta.10",
6
6
  "author": "Skyflow",
7
7
  "description": "Skyflow JavaScript SDK",
8
8
  "homepage": "https://github.com/skyflowapi/skyflow-js",
@@ -9,10 +9,12 @@ export declare const SDK_IFRAME_EVENT = "SDK IFRAME EVENT";
9
9
  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
+ export declare const COMPOSABLE_REVEAL = "reveal-composable";
12
13
  export declare const ELEMENT_TYPES: {
13
14
  COLLECT: string;
14
15
  REVEAL: string;
15
16
  COMPOSE: string;
17
+ REVEAL_COMPOSE: string;
16
18
  };
17
19
  export declare const EVENT_TYPES: {
18
20
  MOUNTED: string;
@@ -30,6 +32,7 @@ export declare const METRIC_TYPES: {
30
32
  COLLECT: string;
31
33
  REVEAL: string;
32
34
  COMPOSE: string;
35
+ REVEAL_COMPOSE: string;
33
36
  };
34
37
  ELEMENT_TYPE_KEY: string;
35
38
  DIV_ID: string;
@@ -86,8 +89,19 @@ export declare const ELEMENT_EVENTS_TO_CLIENT: {
86
89
  HEIGHT: string;
87
90
  };
88
91
  export declare const ELEMENT_EVENTS_TO_IFRAME: {
92
+ MULTIPLE_UPLOAD_FILES_RESPONSE: string;
93
+ RENDER_MOUNTED: string;
94
+ HEIGHT_CALLBACK: string;
95
+ HEIGHT_CALLBACK_COMPOSABLE: string;
96
+ COMPOSABLE_REVEAL: string;
97
+ MULTIPLE_UPLOAD_FILES: string;
89
98
  COLLECT_CALL_REQUESTS: string;
99
+ COMPOSABLE_CALL_REQUESTS: string;
100
+ COMPOSABLE_CALL_RESPONSE: string;
101
+ COMPOSABLE_FILE_CALL_RESPONSE: string;
102
+ COMPOSABLE_CONTAINER: string;
90
103
  REVEAL_CALL_REQUESTS: string;
104
+ REVEAL_CALL_RESPONSE: string;
91
105
  FRAME_READY: string;
92
106
  READY_FOR_CLIENT: string;
93
107
  TOKENIZATION_REQUEST: string;
@@ -140,7 +154,8 @@ export declare enum ElementType {
140
154
  PIN = "PIN",
141
155
  EXPIRATION_MONTH = "EXPIRATION_MONTH",
142
156
  EXPIRATION_YEAR = "EXPIRATION_YEAR",
143
- FILE_INPUT = "FILE_INPUT"
157
+ FILE_INPUT = "FILE_INPUT",
158
+ MULTI_FILE_INPUT = "MULTI_FILE_INPUT"
144
159
  }
145
160
  export declare enum CardType {
146
161
  VISA = "VISA",
@@ -322,6 +337,14 @@ export declare const ELEMENTS: {
322
337
  type: string;
323
338
  };
324
339
  };
340
+ MULTI_FILE_INPUT: {
341
+ name: string;
342
+ sensitive: boolean;
343
+ attributes: {
344
+ type: string;
345
+ multiple: string;
346
+ };
347
+ };
325
348
  };
326
349
  export declare const CARDNUMBER_INPUT_FORMAT: {
327
350
  SPACE_FORMAT: string;
@@ -550,6 +573,7 @@ export declare const DEFAULT_ERROR_TEXT_ELEMENT_TYPES: {
550
573
  EXPIRATION_MONTH: string;
551
574
  EXPIRATION_YEAR: string;
552
575
  FILE_INPUT: string;
576
+ MULTI_FILE_INPUT: string;
553
577
  };
554
578
  export declare const DEFAULT_REQUIRED_TEXT_ELEMENT_TYPES: {
555
579
  CVV: string;
@@ -561,6 +585,7 @@ export declare const DEFAULT_REQUIRED_TEXT_ELEMENT_TYPES: {
561
585
  EXPIRATION_MONTH: string;
562
586
  EXPIRATION_YEAR: string;
563
587
  FILE_INPUT: string;
588
+ MULTI_FILE_INPUT: string;
564
589
  };
565
590
  export declare const INPUT_KEYBOARD_EVENTS: {
566
591
  ENTER: string;
@@ -1,4 +1,4 @@
1
- import { CollectElementInput, CollectElementOptions, ICollectOptions, CollectResponse } from '../../../utils/common';
1
+ import { CollectElementInput, CollectElementOptions, ICollectOptions, CollectResponse, UploadFilesResponse } from '../../../utils/common';
2
2
  import Container from '../common/container';
3
3
  import ComposableElement from './compose-collect-element';
4
4
  declare class ComposableContainer extends Container {
@@ -10,5 +10,6 @@ declare class ComposableContainer extends Container {
10
10
  mount: (domElement: HTMLElement | string) => void;
11
11
  unmount: () => void;
12
12
  collect: (options?: ICollectOptions) => Promise<CollectResponse>;
13
+ uploadFiles: (options: ICollectOptions) => Promise<UploadFilesResponse>;
13
14
  }
14
15
  export default ComposableContainer;
@@ -1,11 +1,12 @@
1
- import { CollectElementUpdateOptions } from '../../../utils/common';
1
+ import { CollectElementUpdateOptions, MetaData } from '../../../utils/common';
2
2
  declare class ComposableElement {
3
3
  #private;
4
4
  type: string;
5
- constructor(name: any, eventEmitter: any, iframeName: any);
5
+ constructor(name: any, eventEmitter: any, iframeName: any, metaData: any);
6
6
  on(eventName: string, handler: Function): void;
7
7
  iframeName(): string;
8
8
  getID(): string;
9
9
  update: (options: CollectElementUpdateOptions) => void;
10
+ uploadMultipleFiles: (metaData?: MetaData) => Promise<unknown>;
10
11
  }
11
12
  export default ComposableElement;
@@ -0,0 +1,14 @@
1
+ import Container from '../common/container';
2
+ import ComposableRevealElement from './composable-reveal-element';
3
+ import { RevealElementInput, RevealResponse } from '../../../index-node';
4
+ import { IRevealElementOptions } from './reveal-container';
5
+ declare class ComposableRevealContainer extends Container {
6
+ #private;
7
+ type: string;
8
+ constructor(options: any, metaData: any, skyflowElements: any, context: any);
9
+ create: (input: RevealElementInput, options?: IRevealElementOptions) => ComposableRevealElement;
10
+ mount: (domElement: HTMLElement | string) => void;
11
+ unmount: () => void;
12
+ reveal(): Promise<RevealResponse>;
13
+ }
14
+ export default ComposableRevealContainer;
@@ -0,0 +1,12 @@
1
+ import { RenderFileResponse } from '../../../utils/common';
2
+ import { IRevealElementInput, IRevealElementOptions } from './reveal-container';
3
+ declare class ComposableRevealElement {
4
+ #private;
5
+ type: string;
6
+ constructor(name: any, eventEmitter: any, iframeName: any);
7
+ iframeName(): string;
8
+ getID(): string;
9
+ renderFile(): Promise<RenderFileResponse>;
10
+ update: (options: IRevealElementInput | IRevealElementOptions) => void;
11
+ }
12
+ export default ComposableRevealElement;
@@ -0,0 +1,30 @@
1
+ import { Context, RenderFileResponse } from '../../../utils/common';
2
+ import SkyflowElement from '../common/skyflow-element';
3
+ import { IRevealElementInput, IRevealElementOptions } from './reveal-container';
4
+ export interface RevealComposableGroup {
5
+ record: IRevealElementInput;
6
+ options: IRevealElementOptions;
7
+ }
8
+ declare class ComposableRevealInternalElement extends SkyflowElement {
9
+ #private;
10
+ resizeObserver: ResizeObserver | null;
11
+ constructor(elementId: string, recordGroup: RevealComposableGroup[], metaData: any, container: any, isSingleElementAPI: boolean | undefined, context: Context);
12
+ private setupRenderFileEventListener;
13
+ getID(): string;
14
+ mount(domElementSelector: HTMLElement | string): void;
15
+ renderFile(recordData: any): Promise<RenderFileResponse>;
16
+ iframeName(): string;
17
+ isMounted(): boolean;
18
+ hasToken(): boolean;
19
+ isClientSetError(): boolean;
20
+ getRecordData(): any;
21
+ setErrorOverride(clientErrorText: string): void;
22
+ setError(clientErrorText: string): void;
23
+ resetError(): void;
24
+ setAltText(altText: string): void;
25
+ clearAltText(): void;
26
+ setToken(token: string): void;
27
+ unmount(): void;
28
+ update(options: IRevealElementInput | IRevealElementOptions, record: any): void;
29
+ }
30
+ export default ComposableRevealInternalElement;
@@ -0,0 +1,21 @@
1
+ import { IRevealRecordComposable } from '../../utils/common';
2
+ import IFrameFormElement from './iframe-form';
3
+ import FrameElement from '.';
4
+ export default class RevealComposableFrameElementInit {
5
+ #private;
6
+ iframeFormElement: IFrameFormElement | undefined;
7
+ clientMetaData: any;
8
+ frameElement: FrameElement;
9
+ private static frameEle?;
10
+ containerId: string;
11
+ group: any;
12
+ frameList: FrameElement[];
13
+ iframeFormList: IFrameFormElement[];
14
+ revealFrameList: any[];
15
+ rootDiv: HTMLDivElement;
16
+ constructor();
17
+ updateGroupData: () => void;
18
+ static startFrameElement: () => void;
19
+ revealData(revealRecords: IRevealRecordComposable[], containerId: any, authToken: any): Promise<unknown>;
20
+ createContainerDiv: (newGroup: any) => void;
21
+ }
@@ -10,7 +10,18 @@ export default class FrameElementInit {
10
10
  private static frameEle?;
11
11
  containerId: string;
12
12
  group: any;
13
+ frameList: FrameElement[];
14
+ iframeFormList: IFrameFormElement[];
13
15
  constructor();
16
+ private handleCollectCall;
17
+ private parallelUploadFiles;
18
+ uploadFiles: (fileElement: any, clientConfig: any) => Promise<unknown>;
19
+ private tokenize;
20
+ private multipleUploadFiles;
21
+ private validateFiles;
22
+ private createInsertRequest;
23
+ private extractSkyflowIDs;
24
+ private insertDataCallInMultiFiles;
14
25
  updateGroupData: () => void;
15
26
  createIframeElement: (frameName: any, label: any, skyflowID: any, isRequired: any) => IFrameFormElement;
16
27
  static startFrameElement: () => void;
@@ -44,6 +44,11 @@ export default class IFrameFormElement extends EventEmitter {
44
44
  changeFocus: (focus: boolean) => void;
45
45
  setReplacePattern(pattern: string[]): void;
46
46
  setMask(mask: string[]): void;
47
+ getFileDetails: (value: FileList | File | null) => Array<{
48
+ fileName: string;
49
+ fileSizeKB: number;
50
+ fileType: string;
51
+ }>;
47
52
  setValidation(validations: IValidationRule[] | undefined): void;
48
53
  setFormat(format: string): void;
49
54
  setSensitive(sensitive?: boolean): void;
@@ -20,7 +20,8 @@ export default class FrameElement {
20
20
  private selectionStart?;
21
21
  private selectionEnd?;
22
22
  private selectedData?;
23
- constructor(iFrameFormElement: IFrameFormElement, options: any, htmlDivElement: HTMLDivElement);
23
+ private clientDomain;
24
+ constructor(iFrameFormElement: IFrameFormElement, options: any, htmlDivElement: HTMLDivElement, clientDomain?: string);
24
25
  mount: () => void;
25
26
  setupInputField(newValue?: boolean): void;
26
27
  updateParentDiv: (newDiv: HTMLDivElement) => void;
@@ -51,4 +52,5 @@ export default class FrameElement {
51
52
  updateOptions(options: any): void;
52
53
  private applyMask;
53
54
  private appendDropdown;
55
+ private setDropdownIconStyle;
54
56
  }
@@ -4,7 +4,12 @@ declare class RevealFrame {
4
4
  private domCopy?;
5
5
  private isRevealCalled?;
6
6
  static init(): void;
7
- constructor(record: any, context: any, id: any);
7
+ constructor(record: any, context: any, id: any, rootDiv?: any);
8
+ responseUpdate: (data: any) => void;
9
+ getConfig: () => void;
10
+ getData: () => any;
11
+ private sub2;
12
+ private renderFile;
8
13
  private getExtension;
9
14
  private addFileRender;
10
15
  private setRevealError;
@@ -28,5 +28,8 @@ export declare const constructElementsInsertReq: (req: any, update: any, options
28
28
  records?: undefined;
29
29
  })[];
30
30
  export declare const updateRecordsBySkyflowID: (skyflowIdRecords: any, client: Client, options: any) => Promise<unknown>;
31
+ export declare const updateRecordsBySkyflowIDComposable: (skyflowIdRecords: any, client: Client, options: any, authToken: string) => Promise<unknown>;
32
+ export declare const insertDataInCollect: (records: any, client: Client, options: any, finalInsertRecords: any, authToken: string) => Promise<unknown>;
33
+ export declare const insertDataInMultipleFiles: (records: any, client: Client, options: any, finalInsertRecords: any, authToken: string) => Promise<unknown>;
31
34
  export declare const checkForElementMatchRule: (validations: IValidationRule[]) => boolean;
32
35
  export declare const checkForValueMatch: (validations: IValidationRule[], element: IFrameFormElement) => boolean;
@@ -1,8 +1,10 @@
1
1
  import Client from '../client';
2
- import { IRevealRecord, IRevealResponseType, IGetRecord, ISkyflowIdRecord, IRenderResponseType, IGetOptions, RenderFileResponse } from '../utils/common';
2
+ import { IRevealRecord, IRevealResponseType, IGetRecord, ISkyflowIdRecord, IRenderResponseType, IGetOptions, RenderFileResponse, IRevealRecordComposable } from '../utils/common';
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
+ export declare const getFileURLFromVaultBySkyflowIDComposable: (skyflowIdRecord: IRevealRecord, client: Client, authToken: string) => Promise<IRenderResponseType>;
5
6
  export declare const fetchRecordsByTokenId: (tokenIdRecords: IRevealRecord[], client: Client) => Promise<IRevealResponseType>;
7
+ export declare const fetchRecordsByTokenIdComposable: (tokenIdRecords: IRevealRecordComposable[], client: Client, authToken: string) => Promise<IRevealResponseType>;
6
8
  export declare const formatRecordsForIframe: (response: IRevealResponseType) => Record<string, string>;
7
9
  export declare const formatRecordsForRender: (response: IRenderResponseType, column: any, skyflowID: any) => {
8
10
  column: any;
@@ -26,5 +28,15 @@ export declare const formatRecordsForClient: (response: IRevealResponseType) =>
26
28
  errors: Record<string, any>[] | undefined;
27
29
  success?: undefined;
28
30
  };
31
+ export declare const formatRecordsForClientComposable: (response: any) => {
32
+ success: never[];
33
+ errors: never[];
34
+ } | {
35
+ success: never[];
36
+ errors?: undefined;
37
+ } | {
38
+ errors: never[];
39
+ success?: undefined;
40
+ };
29
41
  export declare const fetchRecordsGET: (skyflowIdRecords: IGetRecord[], client: Client, options?: IGetOptions) => Promise<unknown>;
30
42
  export declare const fetchRecordsBySkyflowID: (skyflowIdRecords: ISkyflowIdRecord[], client: Client) => Promise<unknown>;
@@ -5,10 +5,12 @@ import SkyflowError from './libs/skyflow-error';
5
5
  import { RequestMethod, IInsertRecordInput, IDetokenizeInput, IGetInput, RedactionType, EventName, Env, LogLevel, ValidationRuleType, IGetByIdInput, IInsertOptions, IDeleteRecordInput, IDeleteOptions, IGetOptions, InsertResponse, GetResponse, GetByIdResponse, DeleteResponse, ContainerOptions, DetokenizeResponse } from './utils/common';
6
6
  import ComposableContainer from './core/external/collect/compose-collect-container';
7
7
  import ThreeDS from './core/external/threeds/threeds';
8
+ import ComposableRevealContainer from './core/external/reveal/composable-reveal-container';
8
9
  export declare enum ContainerType {
9
10
  COLLECT = "COLLECT",
10
11
  REVEAL = "REVEAL",
11
- COMPOSABLE = "COMPOSABLE"
12
+ COMPOSABLE = "COMPOSABLE",
13
+ COMPOSE_REVEAL = "COMPOSABLE_REVEAL"
12
14
  }
13
15
  export interface ISkyflow {
14
16
  vaultID?: string;
@@ -23,6 +25,7 @@ declare class Skyflow {
23
25
  container(type: ContainerType.COLLECT, options?: ContainerOptions): CollectContainer;
24
26
  container(type: ContainerType.COMPOSABLE, options?: ContainerOptions): ComposableContainer;
25
27
  container(type: ContainerType.REVEAL, options?: ContainerOptions): RevealContainer;
28
+ container(type: ContainerType.COMPOSE_REVEAL, options?: ContainerOptions): ComposableRevealContainer;
26
29
  insert(records: IInsertRecordInput, options?: IInsertOptions): Promise<InsertResponse>;
27
30
  detokenize(detokenizeInput: IDetokenizeInput): Promise<DetokenizeResponse>;
28
31
  getById(getByIdInput: IGetByIdInput): Promise<GetByIdResponse>;
@@ -60,6 +60,14 @@ export interface IRevealRecord {
60
60
  skyflowID?: string;
61
61
  table?: string;
62
62
  }
63
+ export interface IRevealRecordComposable {
64
+ token?: string;
65
+ redaction?: RedactionType;
66
+ column?: string;
67
+ skyflowID?: string;
68
+ table?: string;
69
+ iframeName?: string;
70
+ }
63
71
  export interface IInsertResponse {
64
72
  records: IInsertResponseReocrds[];
65
73
  }
@@ -75,6 +83,7 @@ export interface IRevealResponseType {
75
83
  export interface IRenderResponseType {
76
84
  fields?: Record<string, any>;
77
85
  errors?: Record<string, any>;
86
+ fileMetadata?: Record<string, any>;
78
87
  }
79
88
  export interface IDetokenizeInput {
80
89
  records: IRevealRecord[];
@@ -260,6 +269,9 @@ export interface ICollectOptions {
260
269
  additionalFields?: IInsertRecordInput;
261
270
  upsert?: Array<IUpsertOptions>;
262
271
  }
272
+ export interface MetaData {
273
+ [key: string]: any;
274
+ }
263
275
  export interface UploadFilesResponse {
264
276
  fileUploadResponse: [{
265
277
  skyflow_id: string;
@@ -1,4 +1,12 @@
1
1
  declare const SKYFLOW_ERROR_CODE: {
2
+ MULTI_FILE_NOT_SUPPORTED: {
3
+ code: number;
4
+ description: string;
5
+ };
6
+ INVALID_REVEAL_COMPOSABLE_INPUT: {
7
+ code: number;
8
+ description: string;
9
+ };
2
10
  INVALID_FILE_NAME: {
3
11
  code: number;
4
12
  description: string;
@@ -4,6 +4,7 @@ declare const logs: {
4
4
  CLIENT_INITIALIZED: string;
5
5
  CREATE_COLLECT_CONTAINER: string;
6
6
  COLLECT_CONTAINER_CREATED: string;
7
+ INITIALIZE_COMPOSABLE_CLIENT: string;
7
8
  CREATE_REVEAL_CONTAINER: string;
8
9
  REVEAL_CONTAINER_CREATED: string;
9
10
  VALIDATE_RECORDS: string;
@@ -18,6 +19,8 @@ declare const logs: {
18
19
  ELEMENT_REVEALED: string;
19
20
  FILE_RENDERED: string;
20
21
  COLLECT_SUBMIT_SUCCESS: string;
22
+ UPLOAD_FILES_SUCCESS: string;
23
+ MULTI_UPLOAD_FILES_SUCCESS: string;
21
24
  REVEAL_SUBMIT_SUCCESS: string;
22
25
  RENDER_SUBMIT_SUCCESS: string;
23
26
  INSERT_DATA_SUCCESS: string;
@@ -74,6 +77,8 @@ declare const logs: {
74
77
  VALIDATE_GET_BY_ID_INPUT: string;
75
78
  };
76
79
  errorLogs: {
80
+ MULTI_FILE_NOT_SUPPORTED: string;
81
+ INVALID_REVEAL_COMPOSABLE_INPUT: string;
77
82
  NO_ELEMENTS_IN_COLLECT: string;
78
83
  NO_ELEMENTS_IN_COMPOSABLE: string;
79
84
  NO_ELEMENTS_IN_REVEAL: string;