skyflow-js 1.23.0 → 1.23.1

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/README.md CHANGED
@@ -34,17 +34,17 @@ npm install skyflow-js
34
34
  # Initializing Skyflow.js
35
35
  Use the `init()` method to initialize a Skyflow client as shown below.
36
36
  ```javascript
37
- import Skyflow from "skyflow-js" // If using script tag, this line is not required
37
+ import Skyflow from 'skyflow-js' // If using script tag, this line is not required.
38
38
 
39
39
  const skyflowClient = Skyflow.init({
40
- vaultID: "string", //Id of the vault that the client should connect to
41
- vaultURL: "string", //URL of the vault that the client should connect to
42
- getBearerToken: helperFunc, //helper function that retrieves a Skyflow bearer token from your backend
43
- options:{
44
- logLevel: Skyflow.LogLevel, // optional, if not specified default is ERROR
45
- env: Skyflow.Env // optional, if not specified default is PROD
46
- }
47
- })
40
+ vaultID: 'string', // Id of the vault that the client should connect to.
41
+ vaultURL: 'string', // URL of the vault that the client should connect to.
42
+ getBearerToken: helperFunc, // Helper function that retrieves a Skyflow bearer token from your backend.
43
+ options: {
44
+ logLevel: Skyflow.LogLevel, // Optional, if not specified default is ERROR.
45
+ env: Skyflow.Env // Optional, if not specified default is PROD.
46
+ }
47
+ });
48
48
  ```
49
49
  For the `getBearerToken` parameter, pass in a helper function that retrieves a Skyflow bearer token from your backend. This function will be invoked when the SDK needs to insert or retrieve data from the vault. A sample implementation is shown below:
50
50
 
@@ -52,39 +52,38 @@ For example, if the response of the consumer tokenAPI is in the below format
52
52
 
53
53
  ```
54
54
  {
55
- "accessToken": string,
56
- "tokenType": string
55
+ "accessToken": string,
56
+ "tokenType": string
57
57
  }
58
58
 
59
59
  ```
60
60
  then, your getBearerToken Implementation should be as below
61
61
 
62
62
  ```javascript
63
- getBearerToken: () => {
63
+ const getBearerToken = () => {
64
64
  return new Promise((resolve, reject) => {
65
65
  const Http = new XMLHttpRequest();
66
66
 
67
67
  Http.onreadystatechange = () => {
68
- if (Http.readyState == 4) {
69
- if (Http.status == 200) {
68
+ if (Http.readyState === 4) {
69
+ if (Http.status === 200) {
70
70
  const response = JSON.parse(Http.responseText);
71
71
  resolve(response.accessToken);
72
72
  } else {
73
- reject("Error occured");
73
+ reject('Error occured');
74
74
  }
75
75
  }
76
76
  };
77
77
 
78
- Http.onerror = (error) => {
79
- reject("Error occured");
78
+ Http.onerror = error => {
79
+ reject('Error occured');
80
80
  };
81
81
 
82
- const url = "https://api.acmecorp.com/skyflowToken";
83
- Http.open("GET", url);
82
+ const url = 'https://api.acmecorp.com/skyflowToken';
83
+ Http.open('GET', url);
84
84
  Http.send();
85
- })
86
-
87
- }
85
+ });
86
+ };
88
87
 
89
88
  ```
90
89
  For `logLevel` parameter, there are 4 accepted values in Skyflow.LogLevel
@@ -139,42 +138,43 @@ To insert data into the vault, use the `insert(records, options?)` method of the
139
138
 
140
139
  ```javascript
141
140
  const records = {
142
- "records": [
143
- {
144
- table: "string", //table into which record should be inserted
141
+ records: [
142
+ {
143
+ table: 'string', // Table into which record should be inserted.
145
144
  fields: {
146
- column1: "value", //column names should match vault column names
145
+ column1: 'value', // Column names should match vault column names.
147
146
  //...additional fields here
148
- }
149
- }
150
- //...additional records here
151
- ]
152
- }
147
+ },
148
+ },
149
+ // ...additional records here.
150
+ ],
151
+ };
153
152
 
154
153
  const options = {
155
- tokens: true, //indicates whether or not tokens should be returned for the inserted data. Defaults to 'true'
156
- upsert: [ // upsert operations support in the vault
154
+ tokens: true, // Indicates whether or not tokens should be returned for the inserted data. Defaults to 'true'
155
+ upsert: [ // Upsert operations support in the vault
157
156
  {
158
- table: "string", // table name
159
- column: "value ", // unique column in the table
157
+ table: 'string', // Table name
158
+ column: 'value', // Unique column in the table
160
159
  }
161
160
  ]
162
161
  }
163
162
 
164
- skyflowClient.insert(records, options)
163
+ skyflowClient.insert(records, options);
165
164
  ```
166
165
 
167
166
  An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/pure-js.html) of an insert call:
168
167
  ```javascript
169
168
  skyflowClient.insert({
170
- "records": [
171
- {
172
- "table": "cards",
173
- "fields": {
174
- "cardNumber": "41111111111",
175
- "cvv": "123",
176
- }
177
- }]
169
+ records: [
170
+ {
171
+ table: 'cards',
172
+ fields: {
173
+ cardNumber: '41111111111',
174
+ cvv: '123',
175
+ },
176
+ },
177
+ ],
178
178
  });
179
179
  ```
180
180
 
@@ -210,17 +210,17 @@ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
210
210
  A Skyflow collect Element is defined as shown below:
211
211
 
212
212
  ```javascript
213
- const collectElement = {
214
- table: "string", //required, the table this data belongs to
215
- column: "string", //required, the column into which this data should be inserted
216
- type: Skyflow.ElementType, //Skyflow.ElementType enum
217
- inputStyles: {}, //optional styles that should be applied to the form element
218
- labelStyles: {}, //optional styles that will be applied to the label of the collect element
219
- errorTextStyles:{}, //optional styles that will be applied to the errorText of the collect element
220
- label: "string", //optional label for the form element
221
- placeholder: "string", //optional placeholder for the form element
222
- altText: "string" //(DEPRECATED) string that acts as an initial value for the collect element
223
- validations:[] // optional array of validation rules
213
+ const collectElement = {
214
+ table: 'string', // Required, the table this data belongs to.
215
+ column: 'string', // Required, the column into which this data should be inserted.
216
+ type: Skyflow.ElementType, // Skyflow.ElementType enum.
217
+ inputStyles: {}, // Optional, styles that should be applied to the form element.
218
+ labelStyles: {}, // Optional, styles that will be applied to the label of the collect element.
219
+ errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the collect element.
220
+ label: 'string', // Optional, label for the form element.
221
+ placeholder: 'string', // Optional, placeholder for the form element.
222
+ altText: 'string', // (DEPRECATED) string that acts as an initial value for the collect element.
223
+ validations: [], // Optional, array of validation rules.
224
224
  }
225
225
  ```
226
226
  The `table` and `column` fields indicate which table and column in the vault the Element corresponds to.
@@ -241,31 +241,31 @@ Styles are specified with [JSS](https://cssinjs.org/?v=v10.7.1).
241
241
 
242
242
  An example of a inputStyles object:
243
243
  ```javascript
244
- inputStyles:{
245
- base: {
246
- border: "1px solid #eae8ee",
247
- padding: "10px 16px",
248
- borderRadius: "4px",
249
- color: "#1d1d1d",
250
- },
251
- complete: {
252
- color: "#4caf50",
253
- },
254
- empty: {},
255
- focus: {},
256
- invalid: {
257
- color: "#f44336",
258
- },
259
- cardIcon:{
260
- position: "absolute",
261
- left:"8px",
262
- bottom:"calc(50% - 12px)"
263
- },
264
- copyIcon:{
265
- position: "absolute",
266
- right:"8px",
267
- }
268
- }
244
+ inputStyles: {
245
+ base: {
246
+ border: '1px solid #eae8ee',
247
+ padding: '10px 16px',
248
+ borderRadius: '4px',
249
+ color: '#1d1d1d',
250
+ },
251
+ complete: {
252
+ color: '#4caf50',
253
+ },
254
+ empty: {},
255
+ focus: {},
256
+ invalid: {
257
+ color: '#f44336',
258
+ },
259
+ cardIcon: {
260
+ position: 'absolute',
261
+ left: '8px',
262
+ bottom: 'calc(50% - 12px)',
263
+ },
264
+ copyIcon: {
265
+ position: 'absolute',
266
+ right: '8px',
267
+ },
268
+ },
269
269
  ```
270
270
  The states that are available for `labelStyles` are `base` and `focus`.
271
271
 
@@ -273,14 +273,14 @@ An example of a labelStyles object:
273
273
 
274
274
  ```javascript
275
275
  labelStyles: {
276
- base: {
277
- fontSize: "12px",
278
- fontWeight: "bold"
279
- },
280
- focus: {
281
- color: "#1d1d1d"
282
- }
283
- }
276
+ base: {
277
+ fontSize: '12px',
278
+ fontWeight: 'bold',
279
+ },
280
+ focus: {
281
+ color: '#1d1d1d',
282
+ },
283
+ },
284
284
  ```
285
285
 
286
286
  The state that is available for `errorTextStyles` is only the `base` state, it shows up when there is some error in the collect element.
@@ -289,10 +289,10 @@ An example of a errorTextStyles object:
289
289
 
290
290
  ```javascript
291
291
  errorTextStyles: {
292
- base: {
293
- color: "#f44336"
294
- }
295
- }
292
+ base: {
293
+ color: '#f44336',
294
+ },
295
+ },
296
296
  ```
297
297
 
298
298
  Finally, the `type` field takes a Skyflow ElementType. Each type applies the appropriate regex and validations to the form element. There are currently 8 types:
@@ -313,11 +313,11 @@ Along with CollectElement we can define other options which takes a object of op
313
313
 
314
314
  ```javascript
315
315
  const options = {
316
- required: false, //optional, indicates whether the field is marked as required. Defaults to 'false'
317
- enableCardIcon: true, // optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType)
318
- format: String, //optional, format for the element (only applicable currently for EXPIRATION_DATE ElementType),
319
- enableCopy: false // optional, enables the copy icon in collect and reveal elements to copy text to clipboard. Defaults to 'false')
320
- }
316
+ required: false, // Optional, indicates whether the field is marked as required. Defaults to 'false'.
317
+ enableCardIcon: true, // Optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType).
318
+ format: String, // Optional, format for the element (only applicable currently for EXPIRATION_DATE ElementType).
319
+ enableCopy: false, // Optional, enables the copy icon in collect and reveal elements to copy text to clipboard. Defaults to 'false').
320
+ };
321
321
  ```
322
322
 
323
323
  `required` parameter indicates whether the field is marked as required or not. If not provided, it defaults to false
@@ -343,27 +343,27 @@ The values that are accepted for `EXPIRATION_YEAR` are
343
343
  Once the Element object and options has been defined, add it to the container using the `create(element, options)` method as shown below. The `element` param takes a Skyflow Element object and options as defined above:
344
344
 
345
345
  ```javascript
346
- const collectElement = {
347
- table: "string", //the table this data belongs to
348
- column: "string", //the column into which this data should be inserted
349
- type: Skyflow.ElementType, //Skyflow.ElementType enum
350
- inputStyles: {}, //optional styles that should be applied to the form element
351
- labelStyles: {}, //optional styles that will be applied to the label of the collect element
352
- errorTextStyles:{}, //optional styles that will be applied to the errorText of the collect element
353
- label: "string", //optional label for the form element
354
- placeholder: "string", //optional placeholder for the form element
355
- altText: "string" //(DEPRECATED) string that acts as an initial value for the collect element
356
- validations:[] // optional array of validation rules
346
+ const collectElement = {
347
+ table: 'string', // Required, the table this data belongs to.
348
+ column: 'string', // Required, the column into which this data should be inserted.
349
+ type: Skyflow.ElementType, // Skyflow.ElementType enum.
350
+ inputStyles: {}, // Optional, styles that should be applied to the form element.
351
+ labelStyles: {}, // Optional, styles that will be applied to the label of the collect element.
352
+ errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the collect element.
353
+ label: 'string', // Optional, label for the form element.
354
+ placeholder: 'string', // Optional, placeholder for the form element.
355
+ altText: 'string', // (DEPRECATED) string that acts as an initial value for the collect element.
356
+ validations: [], // Optional, array of validation rules.
357
357
  }
358
358
 
359
359
  const options = {
360
- required: false, //optional, indicates whether the field is marked as required. Defaults to 'false'
361
- enableCardIcon: true, // optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType)
362
- format: String, //optional, format for the element (only applicable currently for EXPIRATION_DATE ElementType)
363
- enableCopy: false // optional, enables the copy icon in collect and reveal elements to copy text to clipboard. Defaults to 'false')
364
- }
360
+ required: false, // Optional, indicates whether the field is marked as required. Defaults to 'false'.
361
+ enableCardIcon: true, // Optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType).
362
+ format: String, // Optional, format for the element (only applicable currently for EXPIRATION_DATE ElementType).
363
+ enableCopy: false, // Optional, enables the copy icon in collect and reveal elements to copy text to clipboard. Defaults to 'false').
364
+ };
365
365
 
366
- const element = container.create(collectElement, options)
366
+ const element = container.create(collectElement, options);
367
367
  ```
368
368
 
369
369
  ### Step 3: Mount Elements to the DOM
@@ -386,7 +386,7 @@ To specify where the Elements will be rendered on your page, create placeholder
386
386
  Now, when the `mount(domElement)` method of the Element is called, the Element will be inserted in the specified div. For instance, the call below will insert the Element into the div with the id "#cardNumber".
387
387
 
388
388
  ```javascript
389
- element.mount("#cardNumber")
389
+ element.mount('#cardNumber');
390
390
  ```
391
391
  you can use the `unmount` method to reset any collect element to it's initial state.
392
392
  ```javascript
@@ -403,22 +403,22 @@ When the form is ready to be submitted, call the `collect(options?)` method on t
403
403
 
404
404
  ```javascript
405
405
  const options = {
406
- tokens: true //optional, indicates whether tokens for the collected data should be returned. Defaults to 'true'
407
- additionalFields: {
406
+ tokens: true, // Optional, indicates whether tokens for the collected data should be returned. Defaults to 'true'.
407
+ additionalFields: {
408
408
  records: [
409
409
  {
410
- table: "string", //table into which record should be inserted
410
+ table: 'string', // Table into which record should be inserted.
411
411
  fields: {
412
- column1: "value", //column names should match vault column names
413
- //...additional fields here
414
- }
415
- }
416
- //...additional records here
417
- ]
418
- }, //optional
419
- }
412
+ column1: 'value', // Column names should match vault column names.
413
+ // ...additional fields here.
414
+ },
415
+ },
416
+ // ...additional records here.
417
+ ],
418
+ }, // Optional
419
+ };
420
420
 
421
- container.collect(options)
421
+ container.collect(options);
422
422
  ```
423
423
 
424
424
  ### End to end example of collecting data with Skyflow Elements
@@ -427,58 +427,59 @@ container.collect(options)
427
427
 
428
428
  ```javascript
429
429
  //Step 1
430
- const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
430
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
431
431
 
432
432
  //Step 2
433
- const element = container.create({
434
- table: "cards",
435
- column: "cardNumber",
433
+ const element = container.create({
434
+ table: 'cards',
435
+ column: 'cardNumber',
436
436
  inputstyles: {
437
- base: {
438
- color: "#1d1d1d",
439
- },
440
- cardIcon:{
441
- position: "absolute",
442
- left:"8px",
443
- bottom:"calc(50% - 12px)"
437
+ base: {
438
+ color: '#1d1d1d',
439
+ },
440
+ cardIcon: {
441
+ position: 'absolute',
442
+ left: '8px',
443
+ bottom: 'calc(50% - 12px)',
444
444
  },
445
445
  },
446
446
  labelStyles: {
447
- base: {
448
- fontSize: "12px",
449
- fontWeight: "bold"
450
- }
447
+ base: {
448
+ fontSize: '12px',
449
+ fontWeight: 'bold',
450
+ },
451
451
  },
452
452
  errorTextStyles: {
453
- base: {
454
- color: "#f44336"
455
- }
453
+ base: {
454
+ color: '#f44336',
455
+ },
456
456
  },
457
- placeholder: "Card Number",
458
- label: "card_number",
459
- type: Skyflow.ElementType.CARD_NUMBER
460
- })
457
+ placeholder: 'Card Number',
458
+ label: 'card_number',
459
+ type: Skyflow.ElementType.CARD_NUMBER,
460
+ });
461
461
 
462
462
  // Step 3
463
- element.mount("#cardNumber") //assumes there is a div with id="#cardNumber" in the webpage
463
+ element.mount('#cardNumber'); // Assumes there is a div with id='#cardNumber' in the webpage.
464
464
 
465
465
  // Step 4
466
466
 
467
467
  const nonPCIRecords = {
468
- "records": [
469
- {
470
- "table": "cards",
471
- "fields": {
472
- "gender": "MALE"
473
- }
474
- }
475
- ]
476
- }
468
+ records: [
469
+ {
470
+ table: 'cards',
471
+ fields: {
472
+ gender: 'MALE',
473
+ },
474
+ },
475
+ ],
476
+ };
477
477
 
478
478
  container.collect({
479
479
  tokens: true,
480
- additionalFields: nonPCIRecords
481
- })
480
+ additionalFields: nonPCIRecords,
481
+ });
482
+
482
483
  ```
483
484
 
484
485
  **Sample Response :**
@@ -563,7 +564,7 @@ const cvvElement = container.create({
563
564
 
564
565
  // Step 3
565
566
  cardNumberElement.mount("#cardNumber") //Assumes there is a div with id="#cardNumber" in the webpage.
566
- cvvElement.mount("#cvv"); //Aassumes there is a div with id="#cvv" in the webpage.
567
+ cvvElement.mount("#cvv"); //Assumes there is a div with id="#cvv" in the webpage.
567
568
 
568
569
  // Step 4
569
570
  container.collect({
@@ -615,7 +616,7 @@ const regexMatchRule = {
615
616
  type: Skyflow.ValidationRuleType.REGEX_MATCH_RULE,
616
617
  params: {
617
618
  regex: RegExp,
618
- error: string // optional, default error is "VALIDATION FAILED"
619
+ error: string // Optional, default error is 'VALIDATION FAILED'.
619
620
  }
620
621
  }
621
622
  ```
@@ -626,9 +627,9 @@ const regexMatchRule = {
626
627
  const lengthMatchRule = {
627
628
  type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
628
629
  params: {
629
- min : number, // optional
630
- max : number, // optional
631
- error: string // optional, default error is "VALIDATION FAILED"
630
+ min : number, // Optional.
631
+ max : number, // Optional.
632
+ error: string // Optional, default error is 'VALIDATION FAILED'.
632
633
  }
633
634
  }
634
635
  ```
@@ -640,7 +641,7 @@ const elementValueMatchRule = {
640
641
  type: Skyflow.ValidationRuleType.ELEMENT_VALUE_MATCH_RULE,
641
642
  params: {
642
643
  element: CollectElement,
643
- error: string // optional, default error is "VALIDATION FAILED"
644
+ error: string // Optional, default error is 'VALIDATION FAILED'.
644
645
  }
645
646
  }
646
647
  ```
@@ -653,71 +654,72 @@ The Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/s
653
654
  Adding REGEX_MATCH_RULE , LENGTH_MATCH_RULE to collect element.
654
655
  */
655
656
 
656
- // this rule allows 1 or more alphabets
657
+ // This rule allows 1 or more alphabets.
657
658
  const alphabetsOnlyRegexRule = {
658
659
  type: Skyflow.ValidationRuleType.REGEX_MATCH_RULE,
659
- params:{
660
+ params: {
660
661
  regex: /^[A-Za-z]+$/,
661
- error: "Only alphabets are allowed"
662
- }
663
- };
662
+ error: 'Only alphabets are allowed',
663
+ },
664
+ };
664
665
 
665
- // this rule allows input length between 4 and 6 characters
666
+ // This rule allows input length between 4 and 6 characters.
666
667
  const lengthRule = {
667
668
  type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
668
- params:{
669
+ params: {
669
670
  min: 4,
670
671
  max: 6,
671
- error: "Must be between 4 and 6 alphabets"
672
- }
673
- };
674
-
675
- const cardHolderNameElement = collectContainer.create({
676
- table: "pii_fields",
677
- column: "first_name",
678
- ...collectStylesOptions,
679
- label: "Card Holder Name",
680
- placeholder: "cardholder name",
681
- type: Skyflow.ElementType.INPUT_FIELD,
682
- validations: [alphabetsOnlyRegexRule, lengthRule]
683
- });
672
+ error: 'Must be between 4 and 6 alphabets',
673
+ },
674
+ };
675
+
676
+ const cardHolderNameElement = collectContainer.create({
677
+ table: 'pii_fields',
678
+ column: 'first_name',
679
+ ...collectStylesOptions,
680
+ label: 'Card Holder Name',
681
+ placeholder: 'cardholder name',
682
+ type: Skyflow.ElementType.INPUT_FIELD,
683
+ validations: [alphabetsOnlyRegexRule, lengthRule],
684
+ });
684
685
 
685
686
  /*
686
687
  Reset PIN - A simple example that illustrates custom validations.
687
688
  The below code shows an example of ELEMENT_VALUE_MATCH_RULE
688
689
  */
689
690
 
690
- // for the PIN element
691
+ // For the PIN element
691
692
  const pinElement = collectContainer.create({
692
- label: "PIN",
693
- placeholder: "****",
693
+ label: 'PIN',
694
+ placeholder: '****',
694
695
  type: Skyflow.ElementType.PIN,
695
696
  });
696
697
 
697
- // this rule allows to match the value with pinElement
698
- let elementMatchRule = {
698
+ // This rule allows to match the value with pinElement.
699
+ const elementMatchRule = {
699
700
  type: Skyflow.ValidationRuleType.ELEMENT_VALUE_MATCH_RULE,
700
- params:{
701
+ params: {
701
702
  element: pinElement,
702
- error: "PIN doesn't match"
703
- }
704
- }
703
+ error: "PIN doesn't match",
704
+ },
705
+ };
706
+
705
707
  const confirmPinElement = collectContainer.create({
706
- label: "Confirm PIN",
707
- placeholder: "****",
708
+ label: 'Confirm PIN',
709
+ placeholder: '****',
708
710
  type: Skyflow.ElementType.PIN,
709
- validations: [elementMatchRule]
711
+ validations: [elementMatchRule],
710
712
  });
711
713
 
712
- // mount elements on screen - errors will be shown if any of the validaitons fail
713
- pinElement.mount("#collectPIN");
714
- confirmPinElement.mount("#collectConfirmPIN");
714
+ // Mount elements on screen - errors will be shown if any of the validaitons fail.
715
+ pinElement.mount('#collectPIN');
716
+ confirmPinElement.mount('#collectConfirmPIN');
715
717
 
716
718
  ```
717
719
  ### Event Listener on Collect Elements
718
720
 
719
721
 
720
- Helps to communicate with skyflow elements / iframes by listening to an event
722
+ Helps to communicate with Skyflow elements / iframes by listening to an event
721
723
 
722
724
  ```javascript
723
725
  element.on(Skyflow.EventName,handler:function)
@@ -753,82 +755,80 @@ values of SkyflowElements will be returned in elementstate object only when `env
753
755
 
754
756
  ##### Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/collect-element-listeners.html) for using listeners
755
757
  ```javascript
756
- //create skyflow client
758
+ // Create Skyflow client.
757
759
  const skyflowClient = Skyflow.init({
758
- vaultID: <VAULT_ID>,
759
- vaultURL: <VAULT_URL>,
760
- getBearerToken: ()=>{},
761
- options: {
762
- env: Skyflow.Env.DEV
763
- }
764
- })
760
+ vaultID: '<VAULT_ID>',
761
+ vaultURL: '<VAULT_URL>',
762
+ getBearerToken: () => {},
763
+ options: {
764
+ env: Skyflow.Env.DEV,
765
+ },
766
+ });
765
767
 
766
- const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
768
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
767
769
 
768
770
  const cardNumber = container.create({
769
- table: "pii_fields",
770
- column: "primary_card.card_number",
771
- type: Skyflow.ElementType.CARD_NUMBER,
772
- });
771
+ table: 'pii_fields',
772
+ column: 'primary_card.card_number',
773
+ type: Skyflow.ElementType.CARD_NUMBER,
774
+ });
773
775
 
774
- cardNumber.mount("#cardNumberContainer");
776
+ cardNumber.mount('#cardNumberContainer');
775
777
 
776
- //subscribing to CHANGE event, which gets triggered when element changes
777
- cardNumber.on(Skyflow.EventName.CHANGE,(state) => {
778
- // Your implementation when Change event occurs
779
- console.log(state)
778
+ // Subscribing to CHANGE event, which gets triggered when element changes.
779
+ cardNumber.on(Skyflow.EventName.CHANGE, state => {
780
+ // Your implementation when Change event occurs.
781
+ console.log(state);
780
782
  });
783
+
781
784
  ```
782
785
  ##### Sample Element state object when `env` is `DEV`
783
786
 
784
787
  ```javascript
785
788
  {
786
- elementType: "CARD_NUMBER"
787
- isEmpty: false
788
- isFocused: true
789
- isValid: false
790
- value: "411"
791
- }
792
-
789
+ elementType: 'CARD_NUMBER',
790
+ isEmpty: false,
791
+ isFocused: true,
792
+ isValid: false,
793
+ value: '411',
794
+ };
793
795
  ```
794
796
  ##### Sample Element state object when `env` is `PROD`
795
797
 
796
798
  ```javascript
797
799
  {
798
- elementType: "CARD_NUMBER"
799
- isEmpty: false
800
- isFocused: true
801
- isValid: false
802
- value: ''
803
- }
800
+ elementType: 'CARD_NUMBER',
801
+ isEmpty: false,
802
+ isFocused: true,
803
+ isValid: false,
804
+ value: '',
805
+ };
804
806
  ```
805
807
 
806
808
  ### UI Error for Collect Elements
807
809
 
808
810
  Helps to display custom error messages on the Skyflow Elements through the methods `setError` and `resetError` on the elements.
809
811
 
810
- `setError(error: string)` method is used to set the error text for the element, when this method is trigerred, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is trigerred on the same element.
812
+ `setError(error: string)` method is used to set the error text for the element, when this method is triggered, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is triggered on the same element.
811
813
 
812
814
  `resetError()` method is used to clear the custom error message that is set using `setError`.
813
815
 
814
816
  ##### Sample code snippet for setError and resetError
815
817
 
816
818
  ```javascript
817
-
818
- const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
819
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
819
820
 
820
821
  const cardNumber = container.create({
821
- table: "pii_fields",
822
- column: "primary_card.card_number",
823
- type: Skyflow.ElementType.CARD_NUMBER,
822
+ table: 'pii_fields',
823
+ column: 'primary_card.card_number',
824
+ type: Skyflow.ElementType.CARD_NUMBER,
824
825
  });
825
826
 
826
- //Set custom error
827
- cardNumber.setError("custom error");
827
+ // Set custom error.
828
+ cardNumber.setError('custom error');
828
829
 
829
- //reset custom error
830
+ // Reset custom error.
830
831
  cardNumber.resetError();
831
-
832
832
  ```
833
833
 
834
834
  ### Set and Clear value for Collect Elements (DEV ENV ONLY)
@@ -842,18 +842,18 @@ cardNumber.resetError();
842
842
  ##### Sample code snippet for setValue and clearValue
843
843
 
844
844
  ```javascript
845
- const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
845
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
846
846
 
847
847
  const cardNumber = container.create({
848
- table: "pii_fields",
849
- column: "primary_card.card_number",
850
- type: Skyflow.ElementType.CARD_NUMBER,
848
+ table: 'pii_fields',
849
+ column: 'primary_card.card_number',
850
+ type: Skyflow.ElementType.CARD_NUMBER,
851
851
  });
852
852
 
853
- // Set a value programatically
854
- cardNumber.setValue("4111111111111111");
853
+ // Set a value programatically.
854
+ cardNumber.setValue('4111111111111111');
855
855
 
856
- // Clear the value
856
+ // Clear the value.
857
857
  cardNumber.clearValue();
858
858
 
859
859
  ```
@@ -877,25 +877,25 @@ For non-PCI use-cases, retrieving data from the vault and revealing it in the br
877
877
 
878
878
  ```javascript
879
879
  const records = {
880
- "records": [
881
- {
882
- token: "string", // token for the record to be fetched
883
- }
884
- ]
885
- }
880
+ records: [
881
+ {
882
+ token: 'string', // Token for the record to be fetched.
883
+ },
884
+ ],
885
+ };
886
886
 
887
- skyflow.detokenize(records)
887
+ skyflow.detokenize(records);
888
888
  ```
889
889
  An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/pure-js.html) of a detokenize call:
890
890
 
891
891
  ```javascript
892
892
  skyflow.detokenize({
893
- "records": [
893
+ records: [
894
894
  {
895
- token: "131e70dc-6f76-4319-bdd3-96281e051051"
896
- }
897
- ]
898
- })
895
+ token: '131e70dc-6f76-4319-bdd3-96281e051051',
896
+ },
897
+ ],
898
+ });
899
899
  ```
900
900
 
901
901
  The sample response:
@@ -915,11 +915,11 @@ The sample response:
915
915
 
916
916
  ```javascript
917
917
  {
918
- "records": [
918
+ records: [
919
919
  {
920
- ids: string[], // array of SkyflowID's of the records to be fetched
921
- table: string // table holding the above skyflow_id's
922
- redaction: Skyflow.RedactionType // redaction to be applied to retrieved data
920
+ ids: string[], // Array of SkyflowID's of the records to be fetched.
921
+ table: string, // Table holding the above skyflow_id's.
922
+ redaction: Skyflow.RedactionType, // Redaction to be applied to retrieved data.
923
923
  }
924
924
  ]
925
925
  }
@@ -934,17 +934,16 @@ There are 4 accepted values in Skyflow.RedactionTypes:
934
934
  An example of getById call:
935
935
 
936
936
  ```javascript
937
-
938
937
  skyflow.getById({
939
938
  records: [
940
939
  {
941
- ids: ["f8d8a622-b557-4c6b-a12c-c5ebe0b0bfd9"],
942
- table: "cards",
940
+ ids: ['f8d8a622-b557-4c6b-a12c-c5ebe0b0bfd9'],
941
+ table: 'cards',
943
942
  redaction: Skyflow.RedactionType.PLAIN_TEXT,
944
943
  },
945
944
  {
946
- ids: ["da26de53-95d5-4bdb-99db-8d8c66a35ff9"],
947
- table: "contacts",
945
+ ids: ['da26de53-95d5-4bdb-99db-8d8c66a35ff9'],
946
+ table: 'contacts',
948
947
  redaction: Skyflow.RedactionType.PLAIN_TEXT,
949
948
  },
950
949
  ],
@@ -996,14 +995,13 @@ Then define a Skyflow Element to reveal data as shown below.
996
995
 
997
996
  ```javascript
998
997
  const revealElement = {
999
- token: "string", //required, token of the data being revealed
1000
- inputStyles: {}, //optional styles to be applied to the element
1001
- labelStyles: {}, //optional, styles to be applied to the label of the reveal element
1002
- errorTextStyles: {}, //optional styles that will be applied to the errorText of the reveal element
1003
- label: "string", //optional, label for the form element
1004
- altText: "string" //optional, string that is shown before reveal, will show token if altText is not provided
1005
- }
1006
-
998
+ token: 'string', // Required, token of the data being revealed.
999
+ inputStyles: {}, // Optional, styles to be applied to the element.
1000
+ labelStyles: {}, // Optional, styles to be applied to the label of the reveal element.
1001
+ errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the reveal element.
1002
+ label: 'string', // Optional, label for the form element.
1003
+ altText: 'string', // Optional, string that is shown before reveal, will show token if altText is not provided.
1004
+ };
1007
1005
  ```
1008
1006
 
1009
1007
  The `inputStyles`, `labelStyles` and `errorTextStyles` parameters accepts a styles object as described in the [previous section](#step-2-create-a-collect-element) for collecting data. But for reveal element, `inputStyles` accepts only `base` variant and `copyIcon` style object.
@@ -1012,36 +1010,36 @@ An example of a inputStyles object:
1012
1010
 
1013
1011
  ```javascript
1014
1012
  inputStyles: {
1015
- base: {
1016
- color: "#1d1d1d"
1017
- },
1018
- copyIcon:{
1019
- position: "absolute",
1020
- right:"8px",
1021
- top: "calc(50% - 10px)",
1022
- }
1023
- }
1013
+ base: {
1014
+ color: '#1d1d1d',
1015
+ },
1016
+ copyIcon: {
1017
+ position: 'absolute',
1018
+ right: '8px',
1019
+ top: 'calc(50% - 10px)',
1020
+ },
1021
+ },
1024
1022
  ```
1025
1023
 
1026
1024
  An example of a labelStyles object:
1027
1025
 
1028
1026
  ```javascript
1029
1027
  labelStyles: {
1030
- base: {
1031
- fontSize: "12px",
1032
- fontWeight: "bold"
1033
- }
1034
- }
1028
+ base: {
1029
+ fontSize: '12px',
1030
+ fontWeight: 'bold',
1031
+ },
1032
+ },
1035
1033
  ```
1036
1034
 
1037
1035
  An example of a errorTextStyles object:
1038
1036
 
1039
1037
  ```javascript
1040
1038
  errorTextStyles: {
1041
- base: {
1042
- color: "#f44336"
1043
- }
1044
- }
1039
+ base: {
1040
+ color: '#f44336',
1041
+ },
1042
+ },
1045
1043
  ```
1046
1044
 
1047
1045
  Once you've defined a Skyflow Element, you can use the `create(element)` method of the container to create the Element as shown below:
@@ -1059,13 +1057,14 @@ Elements used for revealing data are mounted to the DOM the same way as Elements
1059
1057
  When the sensitive data is ready to be retrieved and revealed, call the `reveal()` method on the container as shown below:
1060
1058
 
1061
1059
  ```javascript
1062
- container.reveal()
1063
- .then((data) => {
1064
- //handle success
1065
- })
1066
- .catch((err) => {
1067
- //handle error
1060
+ container
1061
+ .reveal()
1062
+ .then(data => {
1063
+ // Handle success.
1068
1064
  })
1065
+ .catch(err => {
1066
+ // Handle error.
1067
+ });
1069
1068
  ```
1070
1069
 
1071
1070
 
@@ -1073,55 +1072,55 @@ container.reveal()
1073
1072
 
1074
1073
  **[Sample Code:](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/skyflow-elements.html)**
1075
1074
  ```javascript
1076
- //Step 1
1077
- const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1075
+ // Step 1.
1076
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL);
1078
1077
 
1079
- //Step 2
1080
- const cardNumberElement = container.create({
1081
- token: "b63ec4e0-bbad-4e43-96e6-6bd50f483f75",
1078
+ // Step 2.
1079
+ const cardNumberElement = container.create({
1080
+ token: 'b63ec4e0-bbad-4e43-96e6-6bd50f483f75',
1082
1081
  inputStyles: {
1083
- base: {
1084
- color: "#1d1d1d",
1085
- },
1082
+ base: {
1083
+ color: '#1d1d1d',
1084
+ },
1086
1085
  },
1087
1086
  labelStyles: {
1088
1087
  base: {
1089
- fontSize: "12px",
1090
- }
1088
+ fontSize: '12px',
1089
+ },
1091
1090
  },
1092
1091
  errorTextStyles: {
1093
1092
  base: {
1094
- color: "#f44336"
1095
- }
1096
- },
1097
- label: "card_number",
1098
- altText: "XXXX XXXX XXXX XXXX"
1099
- })
1093
+ color: '#f44336',
1094
+ },
1095
+ },
1096
+ label: 'card_number',
1097
+ altText: 'XXXX XXXX XXXX XXXX',
1098
+ });
1100
1099
 
1101
- const cvvElement = container.create({
1102
- token: "89024714-6a26-4256-b9d4-55ad69aa4047",
1100
+ const cvvElement = container.create({
1101
+ token: '89024714-6a26-4256-b9d4-55ad69aa4047',
1103
1102
  inputStyles: {
1104
- base: {
1105
- color: "#1d1d1d",
1106
- },
1103
+ base: {
1104
+ color: '#1d1d1d',
1107
1105
  },
1108
- label: "cvv",
1109
- altText: "XXX"
1110
- })
1106
+ },
1107
+ label: 'cvv',
1108
+ altText: 'XXX',
1109
+ });
1110
+
1111
+ // Step 3.
1112
+ cardNumberElement.mount('#cardNumber'); // Assumes there is a placeholder div with id='cardNumber' on the page
1113
+ cvvElement.mount('#cvv'); // Assumes there is a placeholder div with id='cvv' on the page
1111
1114
 
1112
- //Step 3
1113
- cardNumberElement.mount("#cardNumber") //assumes there is a placeholder div with id="#cardNumber" on the page
1114
- cvvElement.mount("#cvv") //assumes there is a placeholder div with id="#cvv" on the page
1115
-
1116
- //Step 4
1117
- container
1118
- .reveal()
1119
- .then((data) => {
1120
- //handle success
1121
- })
1122
- .catch((err) => {
1123
- //handle error
1124
- });
1115
+ // Step 4.
1116
+ container
1117
+ .reveal()
1118
+ .then(data => {
1119
+ // Handle success.
1120
+ })
1121
+ .catch(err => {
1122
+ // Handle error.
1123
+ });
1125
1124
  ```
1126
1125
 
1127
1126
  The response below shows that some tokens assigned to the reveal elements get revealed successfully, while others fail and remain unrevealed.
@@ -1150,26 +1149,24 @@ The response below shows that some tokens assigned to the reveal elements get re
1150
1149
  ### UI Error for Reveal Elements
1151
1150
  Helps to display custom error messages on the Skyflow Elements through the methods `setError` and `resetError` on the elements.
1152
1151
 
1153
- `setError(error: string)` method is used to set the error text for the element, when this method is trigerred, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is trigerred on the same element.
1152
+ `setError(error: string)` method is used to set the error text for the element, when this method is triggered, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is triggered on the same element.
1154
1153
 
1155
1154
  `resetError()` method is used to clear the custom error message that is set using `setError`.
1156
1155
 
1157
1156
  ##### Sample code snippet for setError and resetError
1158
1157
 
1159
1158
  ```javascript
1160
-
1161
- const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1159
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL);
1162
1160
 
1163
1161
  const cardNumber = container.create({
1164
- token: "89024714-6a26-4256-b9d4-55ad69aa4047",
1162
+ token: '89024714-6a26-4256-b9d4-55ad69aa4047',
1165
1163
  });
1166
1164
 
1167
- //Set custom error
1168
- cardNumber.setError("custom error");
1165
+ // Set custom error.
1166
+ cardNumber.setError('custom error');
1169
1167
 
1170
- //reset custom error
1168
+ // Reset custom error.
1171
1169
  cardNumber.resetError();
1172
-
1173
1170
  ```
1174
1171
  ### Set token for Reveal Elements
1175
1172
 
@@ -1177,15 +1174,14 @@ The `setToken(value: string)` method can be used to set the token of the Reveal
1177
1174
 
1178
1175
  ##### Sample code snippet for setToken
1179
1176
  ```javascript
1180
- const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1177
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL);
1181
1178
 
1182
1179
  const cardNumber = container.create({
1183
- altText:"Card Number",
1180
+ altText: 'Card Number',
1184
1181
  });
1185
1182
 
1186
- // set token
1187
- cardNumber.setToken("89024714-6a26-4256-b9d4-55ad69aa4047");
1188
-
1183
+ // Set token.
1184
+ cardNumber.setToken('89024714-6a26-4256-b9d4-55ad69aa4047');
1189
1185
  ```
1190
1186
  ### Set and Clear altText for Reveal Elements
1191
1187
  The `setAltText(value: string)` method can be used to set the altText of the Reveal Element. This will cause the altText to be displayed in the UI regardless of whether the token or value is currently being displayed.
@@ -1194,17 +1190,18 @@ The `setAltText(value: string)` method can be used to set the altText of the Rev
1194
1190
  ##### Sample code snippet for setAltText and clearAltText
1195
1191
 
1196
1192
  ```javascript
1197
- const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1193
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL);
1198
1194
 
1199
1195
  const cardNumber = container.create({
1200
- token:"89024714-6a26-4256-b9d4-55ad69aa4047",
1196
+ token: '89024714-6a26-4256-b9d4-55ad69aa4047',
1201
1197
  });
1202
1198
 
1203
- // set altText
1204
- cardNumber.setAltText("Card Number");
1199
+ // Set altText.
1200
+ cardNumber.setAltText('Card Number');
1201
+
1202
+ // Clear altText.
1203
+ cardNumber.clearAltText();
1205
1204
 
1206
- //clear altText
1207
- cardNumber.clearAltText();
1208
1205
  ```
1209
1206
 
1210
1207
  ## Using Skyflow File Element to upload a file
@@ -1224,13 +1221,13 @@ Skyflow Collect Elements are defined as follows:
1224
1221
 
1225
1222
  ```javascript
1226
1223
  const collectElement = {
1227
- table: "string", //the table this data belongs to
1228
- column: "string", //the column into which this data should be inserted
1229
- skyflowID: "string", // the skyflow_id of the record
1230
- type: Skyflow.ElementType.FILE_INPUT, //Skyflow.ElementType enum
1231
- inputStyles: {}, //optional styles that should be applied to the form element
1232
- labelStyles: {}, //optional styles that will be applied to the label of the collect element
1233
- errorTextStyles:{}, //optional styles that will be applied to the errorText of the collect element
1224
+ type: Skyflow.ElementType.FILE_INPUT, // Skyflow.ElementType enum.
1225
+ table: 'string', // The table this data belongs to.
1226
+ column: 'string', // The column into which this data should be inserted.
1227
+ skyflowID: 'string', // The skyflow_id of the record.
1228
+ inputStyles: {}, // Optional, styles that should be applied to the form element.
1229
+ labelStyles: {}, // Optional, styles that will be applied to the label of the collect element.
1230
+ errorTextStyles:{}, // Optional, styles that will be applied to the errorText of the collect element.
1234
1231
  }
1235
1232
  ```
1236
1233
  The `table` and `column` fields indicate which table and column the Element corresponds to.
@@ -1256,7 +1253,7 @@ To specify where to render Elements on your page, create placeholder `<div>` ele
1256
1253
  Now, when the `mount(domElement)` method of the Element is called, the Element is inserted in the specified div. For instance, the call below inserts the Element into the div with the id "#file".
1257
1254
 
1258
1255
  ```javascript
1259
- element.mount("#file")
1256
+ element.mount('#file');
1260
1257
  ```
1261
1258
  Use the `unmount` method to reset a Collect Element to its initial state.
1262
1259
 
@@ -1268,7 +1265,7 @@ element.unmount();
1268
1265
  When the file is ready to be uploaded, call the `uploadFiles()` method on the container object.
1269
1266
 
1270
1267
  ```javascript
1271
- container.uploadFiles()
1268
+ container.uploadFiles();
1272
1269
  ```
1273
1270
  ### File upload limitations:
1274
1271
 
@@ -1281,38 +1278,38 @@ container.uploadFiles()
1281
1278
  ### End-to-end file upload
1282
1279
 
1283
1280
  ```javascript
1284
- //Step 1
1285
- const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
1281
+ // Step 1.
1282
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
1286
1283
 
1287
- //Step 2
1288
- const element = container.create({
1289
- table: "pii_fields",
1290
- column: "file",
1291
- skyflowID:"431eaa6c-5c15-4513-aa15-29f50babe882",
1284
+ // Step 2.
1285
+ const element = container.create({
1286
+ table: 'pii_fields',
1287
+ column: 'file',
1288
+ skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
1292
1289
  inputstyles: {
1293
- base: {
1294
- color: "#1d1d1d",
1295
- },
1290
+ base: {
1291
+ color: '#1d1d1d',
1292
+ },
1296
1293
  },
1297
1294
  labelStyles: {
1298
- base: {
1299
- fontSize: "12px",
1300
- fontWeight: "bold"
1301
- }
1295
+ base: {
1296
+ fontSize: '12px',
1297
+ fontWeight: 'bold',
1298
+ },
1302
1299
  },
1303
1300
  errorTextStyles: {
1304
- base: {
1305
- color: "#f44336"
1306
- }
1301
+ base: {
1302
+ color: '#f44336',
1303
+ },
1307
1304
  },
1308
- type: Skyflow.ElementType.FILE_INPUT
1309
- })
1305
+ type: Skyflow.ElementType.FILE_INPUT,
1306
+ });
1310
1307
 
1311
- // Step 3
1312
- element.mount("#file") //assumes there is a div with id="#file" in the webpage
1308
+ // Step 3.
1309
+ element.mount('#file'); // Assumes there is a div with id='#file' in the webpage.
1313
1310
 
1314
- // Step 4
1315
- container.uploadFiles()
1311
+ // Step 4.
1312
+ container.uploadFiles();
1316
1313
  ```
1317
1314
 
1318
1315
  **Sample Response :**
@@ -1328,69 +1325,64 @@ container.uploadFiles()
1328
1325
  #### File upload with additional elements
1329
1326
 
1330
1327
  ```javascript
1331
- // Create collect Container
1332
-
1328
+ // Create collect Container.
1333
1329
  const collectContainer = skyflow.container(Skyflow.ContainerType.COLLECT);
1334
1330
 
1335
-
1336
- // Create collect elements
1337
-
1331
+ // Create collect elements.
1338
1332
  const cardNumberElement = collectContainer.create({
1339
- table: "newTable",
1340
- column: "card_number",
1333
+ table: 'newTable',
1334
+ column: 'card_number',
1341
1335
  inputstyles: {
1342
- base: {
1343
- color: "#1d1d1d",
1344
- },
1336
+ base: {
1337
+ color: '#1d1d1d',
1338
+ },
1345
1339
  },
1346
1340
  labelStyles: {
1347
- base: {
1348
- fontSize: "12px",
1349
- fontWeight: "bold"
1350
- }
1341
+ base: {
1342
+ fontSize: '12px',
1343
+ fontWeight: 'bold',
1344
+ },
1351
1345
  },
1352
1346
  errorTextStyles: {
1353
- base: {
1354
- color: "#f44336"
1355
- }
1356
- },,
1357
- placeholder: "card number",
1358
- label: "Card Number",
1347
+ base: {
1348
+ color: '#f44336',
1349
+ },
1350
+ },
1351
+ placeholder: 'card number',
1352
+ label: 'Card Number',
1359
1353
  type: Skyflow.ElementType.CARD_NUMBER,
1360
1354
  });
1361
1355
 
1362
1356
  const fileElement = collectContainer.create({
1363
- table: "newTable",
1364
- column: "file",
1357
+ table: 'newTable',
1358
+ column: 'file',
1365
1359
  skyflowID: '431eaa6c-5c15-4513-aa15-29f50babe882',
1366
1360
  inputstyles: {
1367
- base: {
1368
- color: "#1d1d1d",
1369
- },
1361
+ base: {
1362
+ color: '#1d1d1d',
1363
+ },
1370
1364
  },
1371
1365
  labelStyles: {
1372
- base: {
1373
- fontSize: "12px",
1374
- fontWeight: "bold"
1375
- }
1366
+ base: {
1367
+ fontSize: '12px',
1368
+ fontWeight: 'bold',
1369
+ },
1376
1370
  },
1377
1371
  errorTextStyles: {
1378
- base: {
1379
- color: "#f44336"
1380
- }
1381
- },,
1372
+ base: {
1373
+ color: '#f44336',
1374
+ },
1375
+ },
1382
1376
  type: Skyflow.ElementType.FILE_INPUT,
1383
1377
  });
1384
1378
 
1385
- // Mount the elements
1386
-
1387
- cardNumberElement.mount("#collectCardNumber");
1388
- fileElement.mount("#collectFile");
1389
-
1390
- // Collect and upload methods
1379
+ // Mount the elements.
1380
+ cardNumberElement.mount('#collectCardNumber');
1381
+ fileElement.mount('#collectFile');
1391
1382
 
1392
- container.collect(options={})
1393
- container.uploadFiles()
1383
+ // Collect and upload methods.
1384
+ container.collect({});
1385
+ container.uploadFiles();
1394
1386
 
1395
1387
  ```
1396
1388
  **Sample Response for collect():**