skyflow-js 1.9.1 → 1.10.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 +4 -0
- package/README.md +36 -13
- package/dist/sdkNodeBuild/index.js +1 -1
- package/dist/sdkNodeBuild/index.js.gz +0 -0
- package/package.json +4 -4
- package/types/core/constants.d.ts +2 -0
- package/types/core/external/reveal/RevealContainer.d.ts +4 -1
- package/types/core/external/reveal/RevealElement.d.ts +3 -2
- package/types/core-utils/reveal.d.ts +5 -8
- package/types/libs/objectParse.d.ts +3 -2
- package/types/utils/busEvents/index.d.ts +1 -1
- package/types/utils/constants.d.ts +8 -0
- package/types/utils/helpers/index.d.ts +1 -0
- package/types/utils/logs.d.ts +2 -0
- package/types/utils/validators/index.d.ts +5 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -871,9 +871,15 @@ const revealElement = {
|
|
|
871
871
|
label: "string", //optional, label for the form element
|
|
872
872
|
altText: "string" //optional, string that is shown before reveal, will show token if altText is not provided
|
|
873
873
|
}
|
|
874
|
+
|
|
875
|
+
const revealElementOptions = {
|
|
876
|
+
formatRegex: RegExp //optional, regex to specify the format on the value that has been revealed
|
|
877
|
+
}
|
|
874
878
|
```
|
|
875
879
|
`Note`:
|
|
876
880
|
- `token` is optional only if it is being used in invokeConnection()
|
|
881
|
+
- If revealElement has a formatRegex option and on invoking container.reveal() method, it will first reveal the token and then apply the formatRegex match, and then render it in UI
|
|
882
|
+
- If there are multiple matches found with the given formatRegex option, then always the first match is applied to the revealed value
|
|
877
883
|
|
|
878
884
|
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 only a single variant is available i.e. base.
|
|
879
885
|
|
|
@@ -911,7 +917,7 @@ errorTextStyles: {
|
|
|
911
917
|
Once you've defined a Skyflow Element, you can use the `create(element)` method of the container to create the Element as shown below:
|
|
912
918
|
|
|
913
919
|
```javascript
|
|
914
|
-
const element = container.create(revealElement)
|
|
920
|
+
const element = container.create(revealElement, revealElementOptions)
|
|
915
921
|
```
|
|
916
922
|
|
|
917
923
|
### Step 3: Mount Elements to the DOM
|
|
@@ -1242,6 +1248,8 @@ Please ensure that the paths configured in the responseXML are present in the ac
|
|
|
1242
1248
|
|
|
1243
1249
|
// step 1
|
|
1244
1250
|
const skyflowClient = skyflow.init({
|
|
1251
|
+
vaultID: '<vault_ID>', // optional, required only when a revealElement has formatRegex option set
|
|
1252
|
+
vaultURL: '<vault_URL>', // optional, required only when a revealElement has formatRegex option set
|
|
1245
1253
|
getBearerToken: '<helperFunc>'
|
|
1246
1254
|
});
|
|
1247
1255
|
|
|
@@ -1256,10 +1264,18 @@ const cardNumberElement = collectContainer.create({
|
|
|
1256
1264
|
})
|
|
1257
1265
|
cardNumberElement.mount("#cardNumber")
|
|
1258
1266
|
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1267
|
+
const expiryMonthElement = revealContainer.create({
|
|
1268
|
+
token: "<expiry_month_token>"
|
|
1261
1269
|
})
|
|
1262
|
-
|
|
1270
|
+
expiryMonthElement.mount("#expirationMonth")
|
|
1271
|
+
|
|
1272
|
+
const expiryYearElement = revealContainer.create({
|
|
1273
|
+
token: "<expiry_year_token>"
|
|
1274
|
+
}, {
|
|
1275
|
+
formatRegex: /^..$/ // only last 2 characters are sent for invoking connection
|
|
1276
|
+
})
|
|
1277
|
+
expiryYearElement.mount("#expirationYear")
|
|
1278
|
+
|
|
1263
1279
|
|
|
1264
1280
|
const cvvElement = revealContainer.create({
|
|
1265
1281
|
altText: "###",
|
|
@@ -1268,7 +1284,8 @@ cvvElement.mount("#cvv")
|
|
|
1268
1284
|
|
|
1269
1285
|
//step 4
|
|
1270
1286
|
const cardNumberID = cardNumberElement.getID() // to get element ID
|
|
1271
|
-
const
|
|
1287
|
+
const expiryMonthID = expiryDateElement.getID()
|
|
1288
|
+
const expiryYearID = expiryYearElement.getID()
|
|
1272
1289
|
const cvvElementID = cvvElement.getID()
|
|
1273
1290
|
|
|
1274
1291
|
// step 5
|
|
@@ -1281,9 +1298,12 @@ const requestXML = `<soapenv:Envelope>
|
|
|
1281
1298
|
<CardNumber>
|
|
1282
1299
|
<Skyflow>${cardNumberID}</Skyflow>
|
|
1283
1300
|
</CardNumber>
|
|
1284
|
-
<
|
|
1285
|
-
<Skyflow>${
|
|
1286
|
-
</
|
|
1301
|
+
<ExpiryMonth>
|
|
1302
|
+
<Skyflow>${expiryMonthID}</Skyflow>
|
|
1303
|
+
</ExpiryMonth>
|
|
1304
|
+
<ExpiryYear>
|
|
1305
|
+
<Skyflow>${expiryYearID}</Skyflow>
|
|
1306
|
+
</ExpiryYear>
|
|
1287
1307
|
</GenerateCVV>
|
|
1288
1308
|
</soapenv:Body>
|
|
1289
1309
|
</soapenv:Envelope>`
|
|
@@ -1363,8 +1383,11 @@ Sample Response on failure:
|
|
|
1363
1383
|
}
|
|
1364
1384
|
```
|
|
1365
1385
|
|
|
1366
|
-
`Note`:
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1386
|
+
`Note`:
|
|
1387
|
+
- In responseXML we provide the tags that needs to be rendered in UI and stripped out from the actual response.
|
|
1388
|
+
1. For uniquely identifiable tag, we can give the elementID within a skyflow tag directly corresponding to the actual value.
|
|
1389
|
+
Please refer to the CVV tag in the above example. Here, we wish to strip the actual value present within the CVV tag.
|
|
1390
|
+
2. For arrays, since we have multiple tags with the same name, we will need to provide identifiers to uniquely identify the required tag.
|
|
1391
|
+
Please refer to HeaderItem tag. Here, we have provided NodeId within the Name tag which acts as an identifier and we wish to strip the actual value present in the Value tag.
|
|
1392
|
+
- In requestXML, if revealElement has a formatRegex option, it will first reveal the token and then apply the formatRegex match, and then sent it to invokeConnections/invokeSoapConnections
|
|
1393
|
+
- In responseXML, if revealElement has a formatRegex option, then value is revealed in the UI according to the match found with respect to the given formatRegex
|