idmission-web-sdk 0.0.36 → 0.0.38
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 +30 -0
- package/dist/sdk2.cjs.development.js +1 -1
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +1 -1
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +1 -1
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -452,3 +452,33 @@ Render a fullscreen capture component that analyzes frames from the user's front
|
|
|
452
452
|
```js
|
|
453
453
|
IDmissionSDK.renderCustomerIdentification('#target-element', { submissionToken: 'my-idmission-token' });
|
|
454
454
|
```
|
|
455
|
+
|
|
456
|
+
## Other Functionality
|
|
457
|
+
|
|
458
|
+
### Intercepting (and modifying) API calls to IDmission's backend with `onBeforeSubmit`
|
|
459
|
+
|
|
460
|
+
Each customer flow documented above includes an optional `onBeforeSubmit` prop, which bears the type signature `(request: SubmissionRequest) => Promise<SubmissionRequest>`. This can be useful if you would like to include some custom functionality that interrupts the WebSDK's outgoing request to IDmission's servers, allowing you a chance to modify the request before it is dispatched.
|
|
461
|
+
|
|
462
|
+
To delay the submission until some async condition has been met by your application:
|
|
463
|
+
|
|
464
|
+
```js
|
|
465
|
+
onBeforeSubmit: () => new Promise((resolve) => {
|
|
466
|
+
// do whatever you want in here, websdk will delay submission until you call:
|
|
467
|
+
resolve()
|
|
468
|
+
})
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Calling `resolve()` without an argument as shown above will result in no modification being made to the request that will be sent to IDmission's servers.
|
|
472
|
+
|
|
473
|
+
To alter the submission request before it goes out:
|
|
474
|
+
|
|
475
|
+
```js
|
|
476
|
+
onBeforeSubmit: (req) => new Promise((resolve) => {
|
|
477
|
+
req.myRandomExtraThing = '123'
|
|
478
|
+
resolve(req)
|
|
479
|
+
})
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Note that you will receive the request as a parameter to `onBeforeSubmit`, and must `resolve` with the altered version in order for your changes to be committed.
|
|
483
|
+
|
|
484
|
+
If the promise is rejected or an error is thrown, that rejection value or error will be printed to the logs and the request will be not be sent. The `onRequestFailure` hook will be fired with the error that came from your code.
|
|
@@ -485,7 +485,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
485
485
|
}
|
|
486
486
|
if (signatureData) {
|
|
487
487
|
submissionRequest_1.customerData.signatureData = {
|
|
488
|
-
signatureImage: signatureData
|
|
488
|
+
signatureImage: JSON.stringify(signatureData)
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
if (additionalDocuments) {
|