@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 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
- # Available methods
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
- ## Examples:
23
+ ```javascript
24
+ import Survicate from '@survicate/survicate-web-package/survicate_widget'
24
25
 
25
- Based on the respondent's interaction with our surveys you can trigger actions in your app or website:
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
- Survicate.addEventListener(Survicate.ApiEvent.questionAnswered, () => console.log("question answered"));
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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "22.1.0-npm",
2
+ "version": "22.4.0-npm",
3
3
  "name": "@survicate/survicate-web-package",
4
4
  "description": "Survicate Web Package",
5
5
  "author": {
@@ -54,6 +54,7 @@ declare const Survicate: {
54
54
  traits?: SurvicateVisitorAttributes;
55
55
  ApiEvent: typeof ApiEvent;
56
56
  AppearMethod: typeof AppearMethod;
57
+ invokeEvent: (eventName: string, eventProperties?: Record<string, any>) => void;
57
58
  };
58
59
 
59
60
  export default Survicate;