@sawport/react-sdk 0.1.0-alpha.5 → 0.1.0-alpha.51
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 +32 -9
- package/dist/index.js +49689 -49071
- package/dist/index.umd.js +65 -68175
- package/dist/style.css +1 -591
- package/package.json +19 -15
package/README.md
CHANGED
|
@@ -7,24 +7,47 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
|
|
7
7
|
```html
|
|
8
8
|
<html>
|
|
9
9
|
<head>
|
|
10
|
-
<link href="https://
|
|
11
|
-
<script src="https://{WIDGET_HOST_DOMAIN}/widget/index.js"></script>
|
|
10
|
+
<link href="https://unpkg.com/@sawport/react-sdk/dist/style.css" rel="stylesheet" />
|
|
12
11
|
...
|
|
13
12
|
```
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
### Put the widget into a container id of `sawport-widget`
|
|
15
|
+
```html
|
|
16
|
+
...
|
|
17
|
+
<div id="sawport-widget"></div>
|
|
18
|
+
</body>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Pull in ther sawport SDK into your website
|
|
22
|
+
> Mount the sawport widget when document is fully loaded and with default configurations.
|
|
15
23
|
```html
|
|
16
24
|
...
|
|
17
|
-
<
|
|
25
|
+
<script type="module" src="https://unpkg.com/@sawport/react-sdk@latest/dist/index.js"></script>
|
|
26
|
+
|
|
27
|
+
<script>function docReady(fn) {
|
|
28
|
+
['complete', 'interactive'].includes(document.readyState)
|
|
29
|
+
? setTimeout(fn, 1)
|
|
30
|
+
: document.addEventListener('DOMContentLoaded', fn);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
docReady(() => sawportSDK.mountWidget({
|
|
34
|
+
baseURL: 'https://{DASHBOARD_HOST_DOMAIN}',
|
|
35
|
+
apiURL: 'https://{DASHBOARD_HOST_DOMAIN}/api/v1/',
|
|
36
|
+
projectId: XXXXXXXXXXXXXX,
|
|
37
|
+
user: {email: 'example@emai.lcom', phone: '080XXXXXXXXX', name: 'Firstname Lastname'}, // optional
|
|
38
|
+
}, 'sawport-widget'))
|
|
39
|
+
</script>
|
|
18
40
|
</body>
|
|
19
41
|
```
|
|
20
42
|
|
|
21
43
|
### Setting up enterprise credentials
|
|
22
|
-
|
|
44
|
+
> Call the Sawport function `setSawportConfig` to set the enterprise credential.
|
|
23
45
|
```js
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
docReady(() => sawportSDK.setSawportConfig({
|
|
47
|
+
baseURL: 'https://{DASHBOARD_HOST_DOMAIN}',
|
|
48
|
+
apiURL: 'https://{DASHBOARD_HOST_DOMAIN}/api/v1/',
|
|
49
|
+
projectId: XXXXXXXXXXXXXX,
|
|
50
|
+
user: {email: 'example@emai.lcom', phone: '080XXXXXXXXX', name: 'Firstname Lastname'}
|
|
28
51
|
})
|
|
29
52
|
})
|
|
30
53
|
```
|