@survicate/survicate-web-package 22.4.1-npm → 22.4.3-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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "22.4.1-npm",
2
+ "version": "22.4.3-npm",
3
3
  "name": "@survicate/survicate-web-package",
4
4
  "description": "Survicate Web Package",
5
5
  "author": {
@@ -1,36 +1,32 @@
1
- type SurvicateCallbackType = (surveyId: string, answer?: unknown) => void;
1
+ type CallbackType = (surveyId: string, answer?: any) => void;
2
2
 
3
- type SurvicateQuestionAnsweredCallback = (
4
- surveyId: string,
5
- questionId: number,
6
- answer: unknown
7
- ) => void;
3
+ type QuestionAnsweredCallback = (surveyId: string, questionId: number, answer: any) => void;
8
4
 
9
- export type SurvicateCallbackTypes =
10
- | SurvicateCallbackType
11
- | SurvicateQuestionAnsweredCallback;
5
+ type AttributeValue = string | number | boolean | Date;
12
6
 
13
- export interface SurvicateVisitorAttributes {
14
- [key: string]: string;
7
+ interface VisitorAttributes {
8
+ [key: string]: AttributeValue;
15
9
  }
16
10
 
11
+ export type CallbackTypes = CallbackType | QuestionAnsweredCallback;
12
+
17
13
  export interface ShowSurveyOptions {
18
14
  forceDisplay?: true;
19
- displayMethod?: AppearMethod;
15
+ displayMethod?: AppearMethodApi;
20
16
  displayOptions?: {
21
17
  delay?: number;
22
18
  scrolledPercentage?: number;
23
19
  };
24
20
  }
25
21
 
26
- export enum AppearMethod {
22
+ export enum AppearMethodApi {
27
23
  immediately = 'immediately',
28
24
  delayed = 'delayed',
29
25
  exitIntent = 'exitIntent',
30
26
  scroll = 'onScroll',
31
27
  }
32
28
 
33
- export enum ApiEvent {
29
+ export enum ApiEvents {
34
30
  questionAnswered = 'question_answered',
35
31
  surveyDisplayed = 'survey_displayed',
36
32
  surveyCompleted = 'survey_completed',
@@ -38,23 +34,20 @@ export enum ApiEvent {
38
34
  }
39
35
 
40
36
  declare const Survicate: {
41
- init: (config: { workspaceKey: string }) => Promise<null | void>;
42
- addEventListener: (
43
- event: ApiEvent,
44
- callback: SurvicateCallbackTypes
45
- ) => number | void;
37
+ ApiEvent: typeof ApiEvents;
38
+ AppearMethod: typeof AppearMethodApi;
39
+ addEventListener: (event: ApiEvents, callback: CallbackTypes) => number | void;
46
40
  destroyVisitor: (callback?: () => void) => void;
47
41
  disableTargeting?: boolean;
48
42
  getSurvey: () => { id: string | null; name: string | null };
49
43
  getVisitorId: () => string;
50
- removeEventListener: (eventId: number | ApiEvent) => void;
44
+ init: (config: { workspaceKey: string }) => Promise<null | void>;
45
+ invokeEvent: (eventName: string, eventProperties?: Record<string, string>) => void;
46
+ removeEventListener: (eventId: number | ApiEvents) => void;
51
47
  retarget: () => void;
52
- setVisitorTraits: (attributes: SurvicateVisitorAttributes) => void;
48
+ setVisitorTraits: (attributes: VisitorAttributes) => void;
53
49
  showSurvey: (id: string, options: ShowSurveyOptions) => boolean;
54
- traits?: SurvicateVisitorAttributes;
55
- ApiEvent: typeof ApiEvent;
56
- AppearMethod: typeof AppearMethod;
57
- invokeEvent: (eventName: string, eventProperties?: Record<string, any>) => void;
50
+ traits?: VisitorAttributes;
58
51
  };
59
52
 
60
53
  export default Survicate;