skyflow-js 1.22.0 → 1.23.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.23.0] - 2022-12-27
6
+ ### Added
7
+ - Added new `get` interface.
8
+
5
9
  ## [1.22.0] - 2022-11-15
6
10
  ### Added
7
11
  - `upsert` support while collecting data through skyflow elements.
package/README.md CHANGED
@@ -126,16 +126,16 @@ For `env` parameter, there are 2 accepted values in Skyflow.Env
126
126
  ---
127
127
 
128
128
  # Securely collecting data client-side
129
- - [**Inserting data into the vault**](#inserting-data-into-the-vault)
129
+ - [**Insert data into the vault**](#insert-data-into-the-vault)
130
130
  - [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
131
131
  - [**Using validations on Collect Elements**](#validations)
132
132
  - [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
133
133
  - [**UI Error for Collect Eements**](#ui-error-for-collect-elements)
134
134
  - [**Set and Clear value for Collect Elements (DEV ENV ONLY)**](#set-and-clear-value-for-collect-elements-dev-env-only)
135
135
  - [**Using Skyflow File Element to upload a file**](#using-skyflow-file-element-to-upload-a-file)
136
- ## Inserting data into the vault
136
+ ## Insert data into the vault
137
137
 
138
- To insert data into the vault from the browser, use the `insert(records, options?)` method of the Skyflow client. The `records` parameter takes a JSON object of the records to be inserted in the below format. The `options` parameter takes a dictionary of optional parameters for the insertion. `insert` method also support upsert operations. See below:
138
+ To insert data into the vault, use the `insert(records, options?)` method of the Skyflow client. The `records` parameter takes a JSON object of the records to insert into the below format. The `options` parameter takes a dictionary of optional parameters for the insertion. The `insert` method also supports upsert operations.
139
139
 
140
140
  ```javascript
141
141
  const records = {
@@ -164,9 +164,7 @@ const options = {
164
164
  skyflowClient.insert(records, options)
165
165
  ```
166
166
 
167
-
168
-
169
- An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/purejs.html) of an insert call:
167
+ An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/pure-js.html) of an insert call:
170
168
  ```javascript
171
169
  skyflowClient.insert({
172
170
  "records": [
@@ -213,8 +211,8 @@ A Skyflow collect Element is defined as shown below:
213
211
 
214
212
  ```javascript
215
213
  const collectElement = {
216
- table: "string", //optional, the table this data belongs to
217
- column: "string", //optional, the column into which this data should be inserted
214
+ table: "string", //required, the table this data belongs to
215
+ column: "string", //required, the column into which this data should be inserted
218
216
  type: Skyflow.ElementType, //Skyflow.ElementType enum
219
217
  inputStyles: {}, //optional styles that should be applied to the form element
220
218
  labelStyles: {}, //optional styles that will be applied to the label of the collect element
@@ -400,8 +398,8 @@ element.unmount();
400
398
  When the form is ready to be submitted, call the `collect(options?)` method on the container object. The `options` parameter takes a object of optional parameters as shown below:
401
399
 
402
400
  - `tokens`: indicates whether tokens for the collected data should be returned or not. Defaults to 'true'
403
- - `additionalFields`: Non-PCI elements data to be inserted into the vault which should be in the `records` object format as described in the above [Inserting data into vault](#inserting-data-into-the-vault) section.
404
- - `upsert`: To support upsert operations while collecting the data from skyflow elements, pass the table and column that have been marked as unique in the table.
401
+ - `additionalFields`: Non-PCI elements data to be inserted into the vault which should be in the `records` object format as described in the above [Insert data into vault](#insert-data-into-the-vault) section.
402
+ - `upsert`: To support upsert operations while collecting data from Skyflow elements, pass the table and column marked as unique in the table.
405
403
 
406
404
  ```javascript
407
405
  const options = {
@@ -418,12 +416,6 @@ const options = {
418
416
  //...additional records here
419
417
  ]
420
418
  }, //optional
421
- upsert: [ //optional, upsert operations support in the vault
422
- {
423
- table: "string", // table name
424
- column: "value ", // unique column in the table
425
- }
426
- ]
427
419
  }
428
420
 
429
421
  container.collect(options)
@@ -503,20 +495,18 @@ container.collect({
503
495
  ]
504
496
  }
505
497
  ```
498
+ ### Insert call example with upsert support
499
+ **Sample Code**
506
500
 
507
- ### End to end example of `upsert` support with Skyflow Elements
508
-
509
- **[Sample Code:](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/upsert-support.html)**
510
-
511
- ```javascript
501
+ ```javascript
512
502
  //Step 1
513
503
  const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
514
-
504
+
515
505
  //Step 2
516
506
  const cardNumberElement = container.create({
517
507
  table: "cards",
518
508
  column: "card_number",
519
- inputstyles: {
509
+ inputStyles: {
520
510
  base: {
521
511
  color: "#1d1d1d",
522
512
  },
@@ -541,11 +531,11 @@ const cardNumberElement = container.create({
541
531
  label: "card_number",
542
532
  type: Skyflow.ElementType.CARD_NUMBER
543
533
  })
544
-
534
+
545
535
  const cvvElement = container.create({
546
536
  table: "cards",
547
537
  column: "cvv",
548
- inputstyles: {
538
+ inputStyles: {
549
539
  base: {
550
540
  color: "#1d1d1d",
551
541
  },
@@ -572,12 +562,11 @@ const cvvElement = container.create({
572
562
  })
573
563
 
574
564
  // Step 3
575
- cardNumberElement.mount("#cardNumber") //assumes there is a div with id="#cardNumber" in the webpage
576
- cvvElement.mount("#cvv"); //assumes there is a div with id="#cvv" in the webpage
577
-
565
+ 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
+
578
568
  // Step 4
579
-
580
- container.collect({
569
+ container.collect({
581
570
  tokens: true,
582
571
  upsert: [
583
572
  {
@@ -586,17 +575,17 @@ container.collect({
586
575
  }
587
576
  ]
588
577
  })
589
- ```
590
578
 
591
- **Sample Response :**
579
+ ```
580
+ **Skyflow returns tokens for the record you just inserted.**
592
581
  ```javascript
593
582
  {
594
583
  "records": [
595
584
  {
596
585
  "table": "cards",
597
586
  "fields": {
598
- "card_number": "f3907186-e7e2-466f-91e5-48e12c2bcbc1",
599
- "cvv": "12f670af-6c7d-4837-83fb-30365fbc0b1e"
587
+ "cardNumber": "f3907186-e7e2-466f-91e5-48e12c2bcbc1",
588
+ "gender": "12f670af-6c7d-4837-83fb-30365fbc0b1e"
600
589
  }
601
590
  }
602
591
  ]
@@ -656,7 +645,7 @@ const elementValueMatchRule = {
656
645
  }
657
646
  ```
658
647
 
659
- The Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/CustomValidations.html) for using custom validations:
648
+ The Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/custom-validations.html) for using custom validations:
660
649
 
661
650
  ```javascript
662
651
  /*
@@ -762,7 +751,7 @@ state : {
762
751
  `Note:`
763
752
  values of SkyflowElements will be returned in elementstate object only when `env` is `DEV`, else it is empty string i.e, ''
764
753
 
765
- ##### Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/CollectElementListeners.html) for using listeners
754
+ ##### Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/collect-element-listeners.html) for using listeners
766
755
  ```javascript
767
756
  //create skyflow client
768
757
  const skyflowClient = Skyflow.init({
@@ -897,7 +886,7 @@ const records = {
897
886
 
898
887
  skyflow.detokenize(records)
899
888
  ```
900
- An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/purejs.html) of a detokenize call:
889
+ An [example](https://github.com/skyflowapi/skyflow-js/blob/master/samples/using-script-tag/pure-js.html) of a detokenize call:
901
890
 
902
891
  ```javascript
903
892
  skyflow.detokenize({
@@ -1007,7 +996,7 @@ Then define a Skyflow Element to reveal data as shown below.
1007
996
 
1008
997
  ```javascript
1009
998
  const revealElement = {
1010
- token: "string", //optional, token of the data being revealed
999
+ token: "string", //required, token of the data being revealed
1011
1000
  inputStyles: {}, //optional styles to be applied to the element
1012
1001
  labelStyles: {}, //optional, styles to be applied to the label of the reveal element
1013
1002
  errorTextStyles: {}, //optional styles that will be applied to the errorText of the reveal element