@survicate/survicate-web-package 22.1.0-npm → 22.4.0-npm
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 +28 -11
- package/package.json +1 -1
- package/survicate_widget.d.ts +1 -0
- package/survicate_widget.js +1 -1
package/README.md
CHANGED
|
@@ -1,30 +1,47 @@
|
|
|
1
1
|
# Survicate Web Package
|
|
2
|
-
This package allows you to run a web survey directly in your code.
|
|
2
|
+
This package allows you to run a web survey directly in your code.
|
|
3
3
|
It's built on top of [Preact](https://github.com/preactjs/preact) using [Typescript](https://github.com/Microsoft/TypeScript) and [CSS Modules](https://github.com/css-modules/css-modules).
|
|
4
4
|
|
|
5
5
|
# Installation
|
|
6
|
-
`npm install @survicate/survicate-web-package --save`
|
|
6
|
+
`npm install @survicate/survicate-web-package --save`
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
# Initialization
|
|
10
|
-
Find your workspace key in the [Survicate Panel](https://panel.survicate.com/o/0/w/0/settings/access-keys).
|
|
9
|
+
# Initialization
|
|
10
|
+
Find your workspace key in the [Survicate Panel](https://panel.survicate.com/o/0/w/0/settings/access-keys).
|
|
11
11
|
|
|
12
|
-
```
|
|
12
|
+
```javascript
|
|
13
13
|
import Survicate from '@survicate/survicate-web-package/survicate_widget'
|
|
14
14
|
|
|
15
15
|
const key = "..." // Your key from the panel
|
|
16
16
|
Survicate.init({workspaceKey: key});
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
All available methods can be found in our [documentation](https://developers.survicate.com/javascript/methods/).
|
|
19
|
+
## Examples:
|
|
21
20
|
|
|
21
|
+
To call available methods:
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
```javascript
|
|
24
|
+
import Survicate from '@survicate/survicate-web-package/survicate_widget'
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
// Initialize survicate:
|
|
27
|
+
const key = "..." // Your key from the panel
|
|
28
|
+
Survicate.init({workspaceKey: key});
|
|
29
|
+
|
|
30
|
+
// Show survey with force option
|
|
31
|
+
Survicate.showSurvey('surveyId', { forceDisplay: true });
|
|
32
|
+
|
|
33
|
+
// Set user attributes
|
|
34
|
+
Survicate.setVisitorTraits({name: 'userName', lastName: 'userLastName'});
|
|
35
|
+
|
|
36
|
+
// Add event listener
|
|
37
|
+
Survicate.addEventListener(ApiEvent.questionAnswered , () => console.log('question answered'));
|
|
38
|
+
|
|
39
|
+
// Remove eventListener
|
|
40
|
+
Survicate.removeEventListener(ApiEvent.questionAnswered);
|
|
26
41
|
|
|
27
42
|
```
|
|
28
|
-
|
|
43
|
+
*Please refer to the [documentation](https://developers.survicate.com/javascript/methods/) for the rest of the methods.*
|
|
44
|
+
|
|
45
|
+
# Changelog
|
|
29
46
|
|
|
30
|
-
|
|
47
|
+
The Survicate JavaScript SDK changelog can be found [here](https://developers.survicate.com/javascript/js-sdk-changelog/)
|
package/package.json
CHANGED
package/survicate_widget.d.ts
CHANGED