@dataspike/docver-widget 0.4.8 → 0.4.9

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.
Files changed (2) hide show
  1. package/README.md +101 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # DocVer-widget
2
+
3
+ Install:
4
+
5
+ ```
6
+ yarn @dataspike/docver-widget
7
+ ```
8
+ or
9
+ ```
10
+ npm i @dataspike/docver-widget
11
+ ```
12
+ or add static js file
13
+
14
+ ```
15
+ https://static.dataspike.io/scripts/dataspike-{version}.js
16
+ ```
17
+ Actual version you can find in https://www.npmjs.com/package/@dataspike/docver-widget
18
+
19
+ How to use:
20
+
21
+ ```
22
+ import { DocsVerificationWidget } from @dataspike/docver-widget;
23
+ ....
24
+ DocsVerificationWidgetProps(props);
25
+ ```
26
+
27
+ Available props:
28
+
29
+ <table>
30
+ <tr>
31
+ <th>Prop name</th>
32
+ <th>Type</th>
33
+ <th>Description</th>
34
+ </tr>
35
+ <tr>
36
+ <td>id</td>
37
+ <td>string</td>
38
+ <td>Verification Id</td>
39
+ </tr>
40
+ <tr>
41
+ <td>apiUrl</td>
42
+ <td>string</td>
43
+ <td>API base URL</td>
44
+ </tr>
45
+ <tr>
46
+ <td>elementId</td>
47
+ <td>string</td>
48
+ <td>Id of element when widget will be rendered</td>
49
+ </tr>
50
+ <tr>
51
+ <td>onFinish</td>
52
+ <td>() => Promise&lt;void&gt;</td>
53
+ <td>Callback raised when user finish verification</td>
54
+ </tr>
55
+ <tr>
56
+ <td>onInit</td>
57
+ <td>(verificationStatus: 'completed' | 'expired' | 'active' | 'error', error?: unknown) => Promise&lt;void&gt;</td>
58
+ <td>Callback raised before verification started</td>
59
+ </tr>
60
+ </table>
61
+
62
+ Example:
63
+ ```
64
+ import { DocsVerificationWidget } from '@dataspike/docver-widget';
65
+
66
+ export const renderWidget = async () => {
67
+ if (container) {
68
+ DocsVerificationWidget({
69
+ id: 'VF57124F182867E0'
70
+ elementId: 'root',
71
+ apiUrl: 'https://api.dataspike.io',
72
+ });
73
+ }
74
+ };
75
+
76
+ renderWidget()
77
+ ```
78
+
79
+ Or
80
+
81
+ ```
82
+ <script type="module" defer src="https://static.dataspike.io/scripts/dataspike-{version}.js"></script>
83
+ <script>
84
+ document.addEventListener('DOMContentLoaded', () => {
85
+ const renderWidget = async () => {
86
+ const container = window.document.querySelector('#root');
87
+ if (container) {
88
+ window.DocsVerificationWidget({
89
+ id: 'VF57124F182867E0',
90
+ elementId: 'root',
91
+ apiUrl: 'https://api.dataspike.io',
92
+ });
93
+ }
94
+ };
95
+
96
+ renderWidget()
97
+ });
98
+ </script>
99
+ ```
100
+
101
+ If you have any question about integration, please [contact us](https://www.dataspike.io/contact-us).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataspike/docver-widget",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "main": "./index.js",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"