@survicate/survicate-web-package 22.0.0-npm → 22.3.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
@@ -9,22 +9,35 @@ It's built on top of [Preact](https://github.com/preactjs/preact) using [Typescr
9
9
  # Initialization
10
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});
26
29
 
27
- ```
28
- Survicate.addEventListener(Survicate.ApiEvent.questionAnswered, () => console.log("question answered"));
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'));
29
38
 
30
- ```
39
+ // Remove eventListener
40
+ Survicate.removeEventListener(ApiEvent.questionAnswered);
41
+
42
+ ```
43
+ *Please refer to the [documentation](https://developers.survicate.com/javascript/methods/) for the rest of the methods.*
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "22.0.0-npm",
2
+ "version": "22.3.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;