skyflow-js 1.7.0 → 1.8.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": "1.7.0",
5
+ "version": "1.8.0",
6
6
  "author": "Skyflow",
7
7
  "description": "Skyflow JavaScript SDK",
8
8
  "homepage": "https://github.com/skyflowapi/skyflow-js",
@@ -7,8 +7,8 @@ export declare enum ContainerType {
7
7
  REVEAL = "REVEAL"
8
8
  }
9
9
  export interface ISkyflow {
10
- vaultID: string;
11
- vaultURL: string;
10
+ vaultID?: string;
11
+ vaultURL?: string;
12
12
  getBearerToken: () => Promise<string>;
13
13
  options?: Record<string, any>;
14
14
  }
@@ -38,6 +38,13 @@ export declare const ELEMENT_EVENTS_TO_IFRAME: {
38
38
  GET_BEARER_TOKEN: string;
39
39
  GET_COLLECT_ELEMENT: string;
40
40
  GET_REVEAL_ELEMENT: string;
41
+ COLLECT_ELEMENT_SET_ERROR: string;
42
+ REVEAL_ELEMENT_SET_ERROR: string;
43
+ REVEAL_ELEMENT_UPDATE_OPTIONS: string;
44
+ };
45
+ export declare const REVEAL_ELEMENT_OPTIONS_TYPES: {
46
+ TOKEN: string;
47
+ ALT_TEXT: string;
41
48
  };
42
49
  export declare const ELEMENT_EVENTS_TO_CONTAINER: {
43
50
  ELEMENT_MOUNTED: string;
@@ -51,6 +58,50 @@ export declare enum ElementType {
51
58
  INPUT_FIELD = "INPUT_FIELD",
52
59
  PIN = "PIN"
53
60
  }
61
+ export declare enum CardType {
62
+ VISA = "VISA",
63
+ MASTERCARD = "MASTERCARD",
64
+ AMEX = "AMEX",
65
+ DINERS_CLUB = "DINERS_CLUB",
66
+ DISCOVER = "DISCOVER",
67
+ JCB = "JCB",
68
+ MAESTRO = "MAESTRO",
69
+ UNIONPAY = "UNIONPAY",
70
+ HIPERCARD = "HIPERCARD",
71
+ DEFAULT = "DEFAULT"
72
+ }
73
+ export declare const CARD_NUMBER_MASK: {
74
+ AMEX: (string | {
75
+ X: string;
76
+ })[];
77
+ VISA: (string | {
78
+ X: string;
79
+ })[];
80
+ MASTERCARD: (string | {
81
+ X: string;
82
+ })[];
83
+ DISCOVER: (string | {
84
+ X: string;
85
+ })[];
86
+ DINERS_CLUB: (string | {
87
+ X: string;
88
+ })[];
89
+ JCB: (string | {
90
+ X: string;
91
+ })[];
92
+ MAESTRO: (string | {
93
+ X: string;
94
+ })[];
95
+ UNIONPAY: (string | {
96
+ X: string;
97
+ })[];
98
+ HIPERCARD: (string | {
99
+ X: string;
100
+ })[];
101
+ DEFAULT: (string | {
102
+ X: string;
103
+ })[];
104
+ };
54
105
  export declare const ELEMENTS: {
55
106
  text: {
56
107
  name: string;
@@ -216,6 +267,9 @@ export declare const ELEMENTS: {
216
267
  type: string;
217
268
  };
218
269
  sensitive: boolean;
270
+ mask: (string | {
271
+ X: string;
272
+ })[];
219
273
  regex: RegExp;
220
274
  };
221
275
  EXPIRATION_DATE: {
@@ -224,7 +278,6 @@ export declare const ELEMENTS: {
224
278
  type: string;
225
279
  };
226
280
  sensitive: boolean;
227
- regex: RegExp;
228
281
  };
229
282
  CVV: {
230
283
  name: string;
@@ -336,18 +389,6 @@ export declare const COLLECT_ELEMENT_LABEL_DEFAULT_STYLES: {
336
389
  };
337
390
  };
338
391
  export declare const connectionConfigParseKeys: string[];
339
- export declare enum CardType {
340
- VISA = "VISA",
341
- MASTERCARD = "MASTERCARD",
342
- AMEX = "AMEX",
343
- DINERS_CLUB = "DINERS_CLUB",
344
- DISCOVER = "DISCOVER",
345
- JCB = "JCB",
346
- MAESTRO = "MAESTRO",
347
- UNIONPAY = "UNIONPAY",
348
- HIPERCARD = "HIPERCARD",
349
- DEFAULT = "DEFAULT"
350
- }
351
392
  export declare const CARD_TYPE_REGEX: {
352
393
  VISA: {
353
394
  regex: RegExp;
@@ -408,3 +449,23 @@ export declare const CARD_ENCODED_ICONS: {
408
449
  UNIONPAY: string;
409
450
  VISA: string;
410
451
  };
452
+ export declare const EXPIRY_DATE_MASK: {
453
+ 'MM/YYYY': (string | {
454
+ X: string;
455
+ Y: string;
456
+ })[];
457
+ 'MM/YY': (string | {
458
+ X: string;
459
+ Y: string;
460
+ })[];
461
+ 'YYYY/MM': (string | {
462
+ X: string;
463
+ Y: string;
464
+ })[];
465
+ 'YY/MM': (string | {
466
+ X: string;
467
+ Y: string;
468
+ })[];
469
+ };
470
+ export declare const DEFAULT_EXPIRATION_DATE_FORMAT = "MM/YY";
471
+ export declare const ALLOWED_EXPIRY_DATE_FORMATS: string[];
@@ -19,5 +19,9 @@ declare class Element {
19
19
  iframeName(): string;
20
20
  isMounted(): boolean;
21
21
  isValidElement(): boolean;
22
+ setError(clientErrorText: string): void;
23
+ resetError(): void;
24
+ setValue(elementValue: string): void;
25
+ clearValue(): void;
22
26
  }
23
27
  export default Element;
@@ -7,5 +7,13 @@ declare class RevealElement {
7
7
  iframeName(): string;
8
8
  isMounted(): boolean;
9
9
  hasToken(): boolean;
10
+ isClientSetError(): boolean;
11
+ getRecordData(): any;
12
+ setError(clientErrorText: string): void;
13
+ resetError(): void;
14
+ setAltText(altText: string): void;
15
+ clearAltText(): void;
16
+ setToken(token: string): void;
17
+ unmount(): void;
10
18
  }
11
19
  export default RevealElement;
@@ -22,12 +22,16 @@ export declare class IFrameFormElement extends EventEmitter {
22
22
  mask?: any;
23
23
  context: Context;
24
24
  label?: string;
25
+ doesClientHasError: boolean;
26
+ clientErrorText: string | undefined;
27
+ expirationDateFormat: string;
25
28
  constructor(name: string, label: string, metaData: any, context: Context);
26
29
  onFocusChange: (focus: boolean) => void;
27
30
  changeFocus: (focus: boolean) => void;
28
31
  setReplacePattern(pattern: string[]): void;
29
32
  setMask(mask: string[]): void;
30
33
  setValidation(validations: IValidationRule[] | undefined): void;
34
+ setExpirationDateFormat(format: string): void;
31
35
  setSensitive(sensitive?: boolean): void;
32
36
  setValue: (value?: string, valid?: boolean) => void;
33
37
  getValue: () => string | undefined;
@@ -6,6 +6,7 @@ export declare class FrameController {
6
6
  controller?: FrameController;
7
7
  controllerId: string;
8
8
  private clientDomain;
9
+ private CLASS_NAME;
9
10
  constructor(controllerId: string, logLevel: LogLevel);
10
11
  static init(uuid: string, logLevel: any): FrameController;
11
12
  }
@@ -34,4 +35,5 @@ export declare class FrameElement {
34
35
  }): void;
35
36
  setClass(types: string[], dom?: HTMLElement, preText?: string): void;
36
37
  updateOptions(options: any): void;
38
+ private applyMask;
37
39
  }
@@ -3,5 +3,8 @@ declare class RevealFrame {
3
3
  static revealFrame: RevealFrame;
4
4
  static init(): void;
5
5
  constructor(record: any, context: any);
6
+ private setRevealError;
7
+ private updateRevealElementOptions;
8
+ private updateDataView;
6
9
  }
7
10
  export default RevealFrame;
@@ -1,4 +1,4 @@
1
- import { IInsertRecordInput, IInsertRecord } from '../utils/common';
1
+ import { IInsertRecordInput, IInsertRecord, IValidationRule } from '../utils/common';
2
2
  export declare const constructInsertRecordRequest: (records: IInsertRecordInput, options?: Record<string, any>) => any;
3
3
  export declare const constructInsertRecordResponse: (responseBody: any, tokens: boolean, records: IInsertRecord[]) => {
4
4
  records: any;
@@ -6,3 +6,4 @@ export declare const constructInsertRecordResponse: (responseBody: any, tokens:
6
6
  export declare const constructElementsInsertReq: (req: any, options: any) => {
7
7
  records: IInsertRecord[];
8
8
  };
9
+ export declare const checkForElementMatchRule: (validations: IValidationRule[]) => boolean;
@@ -5,3 +5,4 @@ export declare function validateAndSetupGroupOptions(oldGroup: any, newGroup?: a
5
5
  export declare const getElements: (group: any) => string[];
6
6
  export declare const getValueAndItsUnit: (string?: string, defaultValue?: string, defaultUnit?: string) => string[];
7
7
  export declare const formatValidations: (input: CollectElementInput) => IValidationRule[] | undefined;
8
+ export declare const formatOptions: (elementType: any, options: any, logLevel: any) => any;
@@ -3,7 +3,31 @@ declare const SKYFLOW_ERROR_CODE: {
3
3
  code: number;
4
4
  description: string;
5
5
  };
6
- INVALID_CREDENTIALS: {
6
+ VAULTID_IS_REQUIRED: {
7
+ code: number;
8
+ description: string;
9
+ };
10
+ EMPTY_VAULTID_IN_INIT: {
11
+ code: number;
12
+ description: string;
13
+ };
14
+ VAULTURL_IS_REQUIRED: {
15
+ code: number;
16
+ description: string;
17
+ };
18
+ EMPTY_VAULTURL_IN_INIT: {
19
+ code: number;
20
+ description: string;
21
+ };
22
+ INVALID_VAULTURL_IN_INIT: {
23
+ code: number;
24
+ description: string;
25
+ };
26
+ GET_BEARER_TOKEN_IS_REQUIRED: {
27
+ code: number;
28
+ description: string;
29
+ };
30
+ EMPTY_CONTAINER_TYPE: {
7
31
  code: number;
8
32
  description: string;
9
33
  };
@@ -19,7 +43,27 @@ declare const SKYFLOW_ERROR_CODE: {
19
43
  code: number;
20
44
  description: string;
21
45
  };
22
- INVALID_TABLE_OR_COLUMN: {
46
+ MISSING_TABLE_IN_COLLECT: {
47
+ code: number;
48
+ description: string;
49
+ };
50
+ EMPTY_TABLE_IN_COLLECT: {
51
+ code: number;
52
+ description: string;
53
+ };
54
+ INVALID_TABLE_IN_COLLECT: {
55
+ code: number;
56
+ description: string;
57
+ };
58
+ MISSING_COLUMN_IN_COLLECT: {
59
+ code: number;
60
+ description: string;
61
+ };
62
+ EMPTY_COLUMN_IN_COLLECT: {
63
+ code: number;
64
+ description: string;
65
+ };
66
+ INVALID_COLUMN_IN_COLLECT: {
23
67
  code: number;
24
68
  description: string;
25
69
  };
@@ -31,79 +75,187 @@ declare const SKYFLOW_ERROR_CODE: {
31
75
  code: number;
32
76
  description: string;
33
77
  };
34
- EMPTY_RECORDS: {
78
+ EMPTY_RECORDS_IN_INSERT: {
35
79
  code: number;
36
80
  description: string;
37
81
  };
38
- MISSING_RECORDS: {
82
+ INVALID_RECORDS_IN_INSERT: {
39
83
  code: number;
40
84
  description: string;
41
85
  };
42
- EMPTY_RECORD_IDS: {
86
+ INVALID_TABLE_IN_INSERT: {
43
87
  code: number;
44
88
  description: string;
45
89
  };
46
- INVALID_RECORD_ID_TYPE: {
90
+ EMPTY_TABLE_IN_INSERT: {
47
91
  code: number;
48
92
  description: string;
49
93
  };
50
- INVALID_RECORD_LABEL: {
94
+ MISSING_TABLE_IN_INSERT: {
51
95
  code: number;
52
96
  description: string;
53
97
  };
54
- INVALID_RECORD_ALT_TEXT: {
98
+ EMPTY_FIELDS_IN_INSERT: {
55
99
  code: number;
56
100
  description: string;
57
101
  };
58
- EMPTY_TABLE_AND_FIELDS: {
102
+ MISSING_FIELDS_IN_INSERT: {
59
103
  code: number;
60
104
  description: string;
61
105
  };
62
- EMPTY_TABLE: {
106
+ INVALID_FIELDS_IN_INSERT: {
63
107
  code: number;
64
108
  description: string;
65
109
  };
66
- MISSING_TABLE: {
110
+ INVALID_TOKENS_IN_INSERT: {
67
111
  code: number;
68
112
  description: string;
69
113
  };
70
- INVALID_RECORD_TABLE_VALUE: {
114
+ RECORDS_KEY_NOT_FOUND_DETOKENIZE: {
71
115
  code: number;
72
116
  description: string;
73
117
  };
74
- INVALID_TOKEN_ID: {
118
+ EMPTY_RECORDS_DETOKENIZE: {
75
119
  code: number;
76
120
  description: string;
77
121
  };
78
- MISSING_TOKEN: {
122
+ INVALID_RECORDS_IN_DETOKENIZE: {
79
123
  code: number;
80
124
  description: string;
81
125
  };
82
- MISSING_TOKEN_KEY: {
126
+ MISSING_TOKEN_IN_DETOKENIZE: {
83
127
  code: number;
84
128
  description: string;
85
129
  };
86
- ELEMENT_MUST_HAVE_TOKEN: {
130
+ INVALID_TOKEN_IN_DETOKENIZE: {
131
+ code: number;
132
+ description: string;
133
+ };
134
+ RECORDS_KEY_NOT_FOUND_GETBYID: {
135
+ code: number;
136
+ description: string;
137
+ };
138
+ INVALID_RECORDS_IN_GETBYID: {
139
+ code: number;
140
+ description: string;
141
+ };
142
+ EMPTY_RECORDS_GETBYID: {
143
+ code: number;
144
+ description: string;
145
+ };
146
+ MISSING_IDS_IN_GETBYID: {
147
+ code: number;
148
+ description: string;
149
+ };
150
+ INVALID_IDS_IN_GETBYID: {
151
+ code: number;
152
+ description: string;
153
+ };
154
+ EMPTY_IDS_IN_GETBYID: {
155
+ code: number;
156
+ description: string;
157
+ };
158
+ INVALID_SKYFLOWID_TYPE_IN_GETBYID: {
159
+ code: number;
160
+ description: string;
161
+ };
162
+ MISSING_TABLE_IN_GETBYID: {
163
+ code: number;
164
+ description: string;
165
+ };
166
+ INVALID_TABLE_IN_GETBYID: {
167
+ code: number;
168
+ description: string;
169
+ };
170
+ MISSING_REDACTION_IN_GETBYID: {
171
+ code: number;
172
+ description: string;
173
+ };
174
+ INVALID_REDACTION_TYPE_IN_GETBYID: {
175
+ code: number;
176
+ description: string;
177
+ };
178
+ INVALID_TOKENS_IN_COLLECT: {
179
+ code: number;
180
+ description: string;
181
+ };
182
+ RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS: {
87
183
  code: number;
88
184
  description: string;
89
185
  };
90
- INVALID_REDACTION_TYPE: {
186
+ INVALID_RECORDS_IN_ADDITIONAL_FIELDS: {
91
187
  code: number;
92
188
  description: string;
93
189
  };
94
- MISSING_REDACTION: {
190
+ EMPTY_RECORDS_IN_ADDITIONAL_FIELDS: {
95
191
  code: number;
96
192
  description: string;
97
193
  };
98
- MISSING_REDACTION_VALUE: {
194
+ MISSING_TABLE_IN_ADDITIONAL_FIELDS: {
99
195
  code: number;
100
196
  description: string;
101
197
  };
102
- ELEMENT_NOT_MOUNTED: {
198
+ INVALID_TABLE_IN_ADDITIONAL_FIELDS: {
103
199
  code: number;
104
200
  description: string;
105
201
  };
106
- MISSING_IDS: {
202
+ MISSING_FIELDS_IN_ADDITIONAL_FIELDS: {
203
+ code: number;
204
+ description: string;
205
+ };
206
+ INVALID_FIELDS_IN_ADDITIONAL_FIELDS: {
207
+ code: number;
208
+ description: string;
209
+ };
210
+ EMPTY_RECORDS_REVEAL: {
211
+ code: number;
212
+ description: string;
213
+ };
214
+ MISSING_TOKEN_KEY_REVEAL: {
215
+ code: number;
216
+ description: string;
217
+ };
218
+ INVALID_TOKEN_ID_REVEAL: {
219
+ code: number;
220
+ description: string;
221
+ };
222
+ INVALID_LABEL_REVEAL: {
223
+ code: number;
224
+ description: string;
225
+ };
226
+ INVALID_ALT_TEXT_REVEAL: {
227
+ code: number;
228
+ description: string;
229
+ };
230
+ EMPTY_TABLE_IN_ADDITIONAL_FIELDS: {
231
+ code: number;
232
+ description: string;
233
+ };
234
+ EMPTY_FIELDS_IN_ADDITIONAL_FIELDS: {
235
+ code: number;
236
+ description: string;
237
+ };
238
+ EMPTY_TOKEN_IN_DETOKENIZE: {
239
+ code: number;
240
+ description: string;
241
+ };
242
+ EMPTY_SKYFLOWID_IN_GETBYID: {
243
+ code: number;
244
+ description: string;
245
+ };
246
+ EMPTY_TABLE_IN_GETBYID: {
247
+ code: number;
248
+ description: string;
249
+ };
250
+ EMPTY_REDACTION_TYPE_IN_GETBYID: {
251
+ code: number;
252
+ description: string;
253
+ };
254
+ EMPTY_TOKEN_ID_REVEAL: {
255
+ code: number;
256
+ description: string;
257
+ };
258
+ ELEMENT_MUST_HAVE_TOKEN: {
107
259
  code: number;
108
260
  description: string;
109
261
  };
@@ -111,6 +263,18 @@ declare const SKYFLOW_ERROR_CODE: {
111
263
  code: number;
112
264
  description: string;
113
265
  };
266
+ DUPLICATE_ELEMENT_ADDITIONAL_FIELDS: {
267
+ code: number;
268
+ description: string;
269
+ };
270
+ MISSING_ELEMENT_TYPE: {
271
+ code: number;
272
+ description: string;
273
+ };
274
+ EMPTY_ELEMENT_TYPE: {
275
+ code: number;
276
+ description: string;
277
+ };
114
278
  INVALID_ELEMENT_TYPE: {
115
279
  code: number;
116
280
  description: string;
@@ -119,6 +283,14 @@ declare const SKYFLOW_ERROR_CODE: {
119
283
  code: number;
120
284
  description: string;
121
285
  };
286
+ MISSING_CONNECTION_CONFIG: {
287
+ code: number;
288
+ description: string;
289
+ };
290
+ EMPTY_CONNECTION_URL: {
291
+ code: number;
292
+ description: string;
293
+ };
122
294
  MISSING_CONNECTION_URL: {
123
295
  code: number;
124
296
  description: string;
@@ -127,6 +299,10 @@ declare const SKYFLOW_ERROR_CODE: {
127
299
  code: number;
128
300
  description: string;
129
301
  };
302
+ ELEMENTS_NOT_MOUNTED_INVOKE_CONNECTION: {
303
+ code: number;
304
+ description: string;
305
+ };
130
306
  INVALID_CONNECTION_URL: {
131
307
  code: number;
132
308
  description: string;
@@ -155,6 +331,14 @@ declare const SKYFLOW_ERROR_CODE: {
155
331
  code: number;
156
332
  description: string;
157
333
  };
334
+ MISSING_HANDLER_IN_EVENT_LISTENER: {
335
+ code: number;
336
+ description: string;
337
+ };
338
+ INVALID_HANDLER_IN_EVENT_LISTENER: {
339
+ code: number;
340
+ description: string;
341
+ };
158
342
  UNKNOWN_ERROR: {
159
343
  code: number;
160
344
  description: string;
@@ -163,7 +347,7 @@ declare const SKYFLOW_ERROR_CODE: {
163
347
  code: number;
164
348
  description: string;
165
349
  };
166
- TRANSACTION_ERROR: {
350
+ NETWORK_ERROR: {
167
351
  code: number;
168
352
  description: string;
169
353
  };
@@ -219,5 +403,13 @@ declare const SKYFLOW_ERROR_CODE: {
219
403
  code: number;
220
404
  description: string;
221
405
  };
406
+ EMPTY_ELEMENT_IN_MOUNT: {
407
+ code: number;
408
+ description: string;
409
+ };
410
+ REVEAL_ELEMENT_ERROR_STATE: {
411
+ code: number;
412
+ description: string;
413
+ };
222
414
  };
223
415
  export default SKYFLOW_ERROR_CODE;
@@ -3,3 +3,5 @@ export declare function deletePropertyPath(obj: any, path: any): void;
3
3
  export declare function clearEmpties(o: any): void;
4
4
  export declare function formatFrameNameToId(name: string): string;
5
5
  export declare function fillUrlWithPathAndQueryParams(url: string, pathParams?: object, queryParams?: object): string;
6
+ export declare function removeSpaces(inputString: string): string;
7
+ export declare function formatVaultURL(vaultURL: any): any;