sonic-widget 1.0.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/README.md ADDED
@@ -0,0 +1,76 @@
1
+ ## Installation:
2
+
3
+ **Sonic Widget** - _used to show the axiom protect 2.0 at the current page itself._
4
+
5
+ Use this script tag to get access to the widget.
6
+
7
+ **_`<script src="https://cdn.jsdelivr.net/npm/sonic-widget@1.0.0/dist/index.min.js"></script>`_**
8
+
9
+ ## Implementation:
10
+
11
+ **Steps:-**
12
+
13
+ 1. Create or open an html file.
14
+
15
+ 2. Add a button with the id **`xxxx`**. It is used to call the widget by on click event.
16
+
17
+ ```html
18
+ <button id="xxxx">Open</button>
19
+ ```
20
+
21
+ 3. Add a div tag with the id **`sonic-web-widget`** at the last or beginning of the body tag. It is used to display the sonic module with the help of this id.
22
+
23
+ ```html
24
+ <div id="sonic-web-widget"></div>
25
+ ```
26
+
27
+ 4. Add a Script tag to the head tag or body tag. And use the latest version.
28
+
29
+ ```html
30
+ <script src="https://cdn.jsdelivr.net/npm/sonic-widget@1.0.0/dist/index.min.js"></script>
31
+ ```
32
+
33
+ 5. Next, add the script tag at a necessary place. But add below the widget script.
34
+
35
+ ```html
36
+ <script>
37
+ const config = {
38
+ baseurl: string, // the base url of the backend server
39
+ showPage: boolean, // used to show the page or not
40
+ changeToPopup: boolean, // widget shows by popup modal default is false
41
+ ipInfoKey: string, // api key to detect vpn used or not from "ipInfo.io"
42
+ readyApiKey: string, // api key to detect passive liveliness from "ReadyApi"
43
+ accountId: string, // account can be taken from operator axiom account
44
+ userId: string, // user prospective data
45
+ userName: string, // user prospective data
46
+ email: string, // user prospective data
47
+ phone: string, // user prospective data
48
+ applicationNo: string, // user prospective data
49
+ onMessage: function (data) {}, // callback function, when api response message or error or any other actions
50
+ };
51
+ // get the element used in the action button
52
+ var container = document.getElementById('xxxx');
53
+ // on click of element widget works
54
+ container.addEventListener('click', function () {
55
+ sonic.SonicWidget(config);
56
+ });
57
+ </script>
58
+ ```
59
+
60
+ _Here, the config variable is used to pass the data. And the container variable is to get the dom element of the id **`xxxx`** button and add it to the event listener. It checks if the button is clicked and sends the config object data to the **`sonic`** module.
61
+ **`sonic.SonicWidget(config)`**_
62
+
63
+ **Note:-**
64
+
65
+ - _**`baseurl`** should pass as a string value. It is used as the base URL for API calls._
66
+ - _**`showPage`** is used to pass a boolean value ( **`true`** or **`false`** ). To toggle the widget page open or close._
67
+ - _**`changeToPopup`** is used to pass a boolean value ( **`true`** or **`false`** ). To toggle the widget as a popup or inline page._
68
+ - _**`ipInfoKey`** should pass as a string value. It is used to detect vpn used or not from "ipInfo.io" with this api key._
69
+ - _**`readyApiKey`** should pass as a string value. It is used to detect passive liveliness from "ReadyApi" with this api key._
70
+ - _**`accountId`** should pass as a string value. It is used to get the JWT token and proceed with the operator account._
71
+ - _**`userId`** should pass as a string value. It is used to create a application for onboard sonic kyc._
72
+ - _**`userName`** should pass as a string value. It is used to create a application for onboard sonic kyc._
73
+ - _**`email`** should pass as a string value. It is used to create a application for onboard sonic kyc._
74
+ - _**`phone`** should pass as a string value. It is used to create a application for onboard sonic kyc._
75
+ - _**`applicationNo`** should pass as a string value. It is used to create a application for onboard sonic kyc._
76
+ - _**`onMessage`** is a callback function. It is getting called when the API gives a message or at any configuration error. Return data is an object with its API endpoint and result._
Binary file