skyflow-js 2.7.0 → 2.7.2
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
|
@@ -18,7 +18,7 @@ Skyflow’s JavaScript SDK can be used to securely collect, tokenize, and reveal
|
|
|
18
18
|
- [**Securely collecting data client-side using Composable Elements**](#securely-collecting-data-client-side-using-composable-elements)
|
|
19
19
|
- [**Securely revealing data client-side**](#securely-revealing-data-client-side)
|
|
20
20
|
- [**Securely deleting data client-side**](#securely-deleting-data-client-side)
|
|
21
|
-
|
|
21
|
+
- [**Set Custom Network messages on container**](#set-custom-network-messages-on-container)
|
|
22
22
|
---
|
|
23
23
|
|
|
24
24
|
# Including Skyflow.js
|
|
@@ -1848,7 +1848,6 @@ collectContainer.uploadFiles();
|
|
|
1848
1848
|
|
|
1849
1849
|
Note: File name should contain only alphanumeric characters and !-_.*()
|
|
1850
1850
|
|
|
1851
|
-
|
|
1852
1851
|
# Securely collecting data client-side using Composable Elements
|
|
1853
1852
|
- [**Using Skyflow Composable Elements to collect data**](#using-skyflow-composable-elements-to-collect-data)
|
|
1854
1853
|
- [**Event listener on Composable Element**](#set-an-event-listener-on-composable-elements)
|
|
@@ -3859,7 +3858,7 @@ cardNumberRevealElement.update({
|
|
|
3859
3858
|
---
|
|
3860
3859
|
|
|
3861
3860
|
|
|
3862
|
-
|
|
3861
|
+
## Using Composable Reveal Elements to reveal data
|
|
3863
3862
|
|
|
3864
3863
|
Composable Reveal Elements combine multiple Skyflow Elements in a single iframe, letting you create multiple Skyflow Elements in a single row. The following steps create a composable reveal element and securely collect data through it.
|
|
3865
3864
|
|
|
@@ -4421,7 +4420,75 @@ A sample response:
|
|
|
4421
4420
|
}
|
|
4422
4421
|
```
|
|
4423
4422
|
|
|
4423
|
+
# Set Custom Network messages on container:
|
|
4424
|
+
|
|
4425
|
+
Add custom network error messages to a container with the `setError` method.
|
|
4426
|
+
|
|
4427
|
+
`setError(ErrorMessages: Record<ErrorType, string>)` sets the error text for the different network errors types. When this method is triggered, all the errors present in the error response are overridden with the specified custom error message. This error is sent on the collect or upload file call on the same container.
|
|
4428
|
+
|
|
4429
|
+
### Sample code snippet for setError on collect container
|
|
4430
|
+
```javascript
|
|
4431
|
+
const container = skyflowClient.container(Skyflow.ContainerType.COLLECT);
|
|
4432
|
+
|
|
4433
|
+
const cardNumber = container.create({
|
|
4434
|
+
table: 'pii_fields',
|
|
4435
|
+
column: 'primary_card.card_number',
|
|
4436
|
+
type: Skyflow.ElementType.CARD_NUMBER,
|
|
4437
|
+
});
|
|
4438
|
+
|
|
4439
|
+
// Set custom error.
|
|
4440
|
+
container.setError({
|
|
4441
|
+
[Skyflow.ErrorType.BAD_REQUEST]: "Bad request. Please check the request payload.",
|
|
4442
|
+
[Skyflow.ErrorType.UNAUTHORIZED]: "You are not authorized. Please check your token.",
|
|
4443
|
+
[Skyflow.ErrorType.FORBIDDEN]: "Access denied. You do not have permission to perform this action.",
|
|
4444
|
+
[Skyflow.ErrorType.TOO_MANY_REQUESTS]: "Too many requests. Please try again later.",
|
|
4445
|
+
[Skyflow.ErrorType.INTERNAL_SERVER_ERROR]: "Something went wrong on our end. Please try again later.",
|
|
4446
|
+
[Skyflow.ErrorType.BAD_GATEWAY]: "Received an invalid response from the server. Please try again.",
|
|
4447
|
+
[Skyflow.ErrorType.SERVICE_UNAVAILABLE]: "Service is temporarily unavailable. Please try again later.",
|
|
4448
|
+
[Skyflow.ErrorType.CONNECTION]: "Unable to connect to the server. Please check your network connection.",
|
|
4449
|
+
[Skyflow.ErrorType.NOT_FOUND]: "Table not found with custom message",
|
|
4450
|
+
[Skyflow.ErrorType.OFFLINE]: "You appear to be offline. Please check your internet connection.",
|
|
4451
|
+
[Skyflow.ErrorType.TIMEOUT]: "The request took too long to respond. Please try again.",
|
|
4452
|
+
[Skyflow.ErrorType.ABORT]: "The request was aborted.",
|
|
4453
|
+
[Skyflow.ErrorType.NETWORK_GENERIC]: "A network error occurred. Please try again.",
|
|
4454
|
+
});
|
|
4455
|
+
|
|
4456
|
+
container
|
|
4457
|
+
.collect()
|
|
4458
|
+
.then(res => console.log(res))
|
|
4459
|
+
.catch(err =>{
|
|
4460
|
+
console.log(err);
|
|
4461
|
+
})
|
|
4462
|
+
```
|
|
4463
|
+
#### Sample Error structure:
|
|
4464
|
+
```json
|
|
4465
|
+
{
|
|
4466
|
+
"error":{
|
|
4467
|
+
"code":0,
|
|
4468
|
+
"description":"You appear to be offline. Please check your internet connection.",
|
|
4469
|
+
"type":"OFFLINE"
|
|
4470
|
+
},
|
|
4471
|
+
}
|
|
4472
|
+
```
|
|
4473
|
+
|
|
4474
|
+
`Skyflow.ErrorType` accepts following values:
|
|
4475
|
+
- `BAD_REQUEST`
|
|
4476
|
+
- `UNAUTHORIZED`
|
|
4477
|
+
- `FORBIDDEN`
|
|
4478
|
+
- `TOO_MANY_REQUESTS`
|
|
4479
|
+
- `INTERNAL_SERVER_ERROR`
|
|
4480
|
+
- `BAD_GATEWAY`
|
|
4481
|
+
- `SERVICE_UNAVAILABLE`
|
|
4482
|
+
- `CONNECTION`
|
|
4483
|
+
- `NOT_FOUND`
|
|
4484
|
+
- `OFFLINE`
|
|
4485
|
+
- `TIMEOUT`
|
|
4486
|
+
- `NETWORK_GENERIC`
|
|
4487
|
+
- `ABORT`
|
|
4488
|
+
|
|
4424
4489
|
|
|
4425
4490
|
## Reporting a Vulnerability
|
|
4426
4491
|
|
|
4427
4492
|
If you discover a potential security issue in this project, please reach out to us at security@skyflow.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.
|
|
4493
|
+
|
|
4494
|
+
|