@soyio/soyio-widget 0.0.14 → 0.0.15
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 +21 -17
- package/dist/index.js +923 -893
- package/dist/index.umd.cjs +9 -9
- package/dist/{constants.d.ts → src/constants.d.ts} +1 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/listeners.d.ts +6 -0
- package/dist/{widget.d.ts → src/widget.d.ts} +1 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/listeners.d.ts +0 -3
- /package/dist/{events.d.ts → src/events.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# soy-io-widget
|
|
2
|
+
|
|
2
3
|
This is the library for include a soyio widget.
|
|
3
4
|
|
|
4
5
|
This library contemplate that a div element with ID: `soyio-widget-iframe-container` should be created before instantiate the widget.
|
|
@@ -7,26 +8,29 @@ This library contemplate that a div element with ID: `soyio-widget-iframe-contai
|
|
|
7
8
|
|
|
8
9
|
For frontend frameworks, this should be imported as follows.
|
|
9
10
|
|
|
10
|
-
```
|
|
11
|
+
```html
|
|
11
12
|
<script>
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const flow = '<flow>' // Can only take the values of 'register' or 'authenticate'
|
|
14
|
+
|
|
15
|
+
const configProps = {
|
|
16
|
+
companyId: '<company id>', // Starts with 'com_'
|
|
17
|
+
userReference?: '<user identifier of company>' // Optional
|
|
18
|
+
flowTemplateId: '<flow template id', // Starts with 'vft_' only needed in 'register' flow
|
|
19
|
+
identityId: '<identity id>' // Starts with 'id_' only needed in 'authenticate' flow
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const onEvent = (data) => {
|
|
23
|
+
console.log('APPLICATION: EVENT!');
|
|
24
|
+
console.log(data);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Create widget when needed. In this example, widget is created when page is loaded.
|
|
28
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
29
|
+
new Widget(flow, configProps, onEvent)
|
|
30
|
+
});
|
|
16
31
|
</script>
|
|
32
|
+
|
|
17
33
|
<body>
|
|
18
34
|
<div id="soyio-widget-iframe-container"></div>
|
|
19
35
|
</body>
|
|
20
|
-
|
|
21
36
|
```
|
|
22
|
-
|
|
23
|
-
The widget class receive the following object when is initialized:
|
|
24
|
-
|
|
25
|
-
```JS
|
|
26
|
-
{
|
|
27
|
-
userEmail?: string
|
|
28
|
-
companyName?: string
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
And if there is an email this is sended to the iframe.
|