@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 +1 -1
- package/survicate_widget.d.ts +18 -25
- package/survicate_widget.js +1 -1
package/package.json
CHANGED
package/survicate_widget.d.ts
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
type
|
|
1
|
+
type CallbackType = (surveyId: string, answer?: any) => void;
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
surveyId: string,
|
|
5
|
-
questionId: number,
|
|
6
|
-
answer: unknown
|
|
7
|
-
) => void;
|
|
3
|
+
type QuestionAnsweredCallback = (surveyId: string, questionId: number, answer: any) => void;
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
| SurvicateCallbackType
|
|
11
|
-
| SurvicateQuestionAnsweredCallback;
|
|
5
|
+
type AttributeValue = string | number | boolean | Date;
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
[key: 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?:
|
|
15
|
+
displayMethod?: AppearMethodApi;
|
|
20
16
|
displayOptions?: {
|
|
21
17
|
delay?: number;
|
|
22
18
|
scrolledPercentage?: number;
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
export enum
|
|
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
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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:
|
|
48
|
+
setVisitorTraits: (attributes: VisitorAttributes) => void;
|
|
53
49
|
showSurvey: (id: string, options: ShowSurveyOptions) => boolean;
|
|
54
|
-
traits?:
|
|
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;
|