@product7/feedback-sdk 1.2.3 → 1.2.5
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/dist/feedback-sdk.js +5917 -4356
- package/dist/feedback-sdk.js.map +1 -1
- package/dist/feedback-sdk.min.js +1 -1
- package/dist/feedback-sdk.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core/APIService.js +107 -0
- package/src/core/FeedbackSDK.js +86 -1
- package/src/index.js +3 -0
- package/src/styles/styles.js +747 -1
- package/src/widgets/ButtonWidget.js +93 -91
- package/src/widgets/ChangelogWidget.js +619 -0
- package/src/widgets/WidgetFactory.js +2 -0
- package/src/widgets/messenger/components/NavigationTabs.js +1 -1
- package/types/index.d.ts +152 -123
package/types/index.d.ts
CHANGED
|
@@ -1,135 +1,164 @@
|
|
|
1
1
|
declare module '@product7/feedback-sdk' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
export interface FeedbackConfig {
|
|
3
|
+
workspace: string;
|
|
4
|
+
userContext?: UserContext;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
boardId?: string;
|
|
7
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
8
|
+
theme?: 'light' | 'dark';
|
|
9
|
+
apiUrl?: string;
|
|
10
|
+
autoShow?: boolean;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
export interface UserContext {
|
|
14
|
+
user_id?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
custom_fields?: Record<string, any>;
|
|
18
|
+
company?: {
|
|
19
|
+
id?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
monthly_spend?: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
export interface ButtonWidget {
|
|
26
|
+
id: string;
|
|
27
|
+
type: 'button';
|
|
28
|
+
mount(container?: string | HTMLElement): this;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
show(): this;
|
|
31
|
+
hide(): this;
|
|
32
|
+
openModal(): void;
|
|
33
|
+
closeModal(): void;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
export class FeedbackSDK {
|
|
37
|
+
constructor(config: FeedbackConfig);
|
|
38
|
+
init(): Promise<{
|
|
39
|
+
initialized: boolean;
|
|
40
|
+
config?: any;
|
|
41
|
+
sessionToken?: string;
|
|
42
|
+
expiresIn?: number;
|
|
43
|
+
}>;
|
|
44
|
+
createWidget(
|
|
45
|
+
type: 'button',
|
|
46
|
+
options?: Partial<FeedbackConfig>
|
|
47
|
+
): ButtonWidget;
|
|
48
|
+
setUserContext(userContext: UserContext): void;
|
|
49
|
+
getUserContext(): UserContext | null;
|
|
50
|
+
destroy(): void;
|
|
51
|
+
readonly initialized: boolean;
|
|
52
|
+
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export interface SurveyQuestion {
|
|
57
|
-
id?: string;
|
|
58
|
-
label: string;
|
|
59
|
-
type: 'select' | 'text';
|
|
60
|
-
placeholder?: string;
|
|
61
|
-
options?: Array<{ value: string; label: string }>;
|
|
62
|
-
}
|
|
54
|
+
export type SurveyType = 'nps' | 'csat' | 'ces' | 'custom';
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
export interface SurveyQuestion {
|
|
57
|
+
id?: string;
|
|
58
|
+
label: string;
|
|
59
|
+
type: 'select' | 'text';
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
options?: Array<{ value: string; label: string }>;
|
|
62
|
+
}
|
|
71
63
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
highLabel?: string | null;
|
|
80
|
-
customQuestions?: SurveyQuestion[];
|
|
81
|
-
theme?: 'light' | 'dark';
|
|
82
|
-
onSubmit?: (response: SurveyWidgetResponse) => void;
|
|
83
|
-
onDismiss?: () => void;
|
|
84
|
-
}
|
|
64
|
+
export interface SurveyWidgetResponse {
|
|
65
|
+
type: SurveyType;
|
|
66
|
+
score: number | null;
|
|
67
|
+
feedback: string;
|
|
68
|
+
customAnswers: Record<string, any>;
|
|
69
|
+
timestamp: string;
|
|
70
|
+
}
|
|
85
71
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
export interface SurveyWidgetOptions {
|
|
73
|
+
surveyId?: string | null;
|
|
74
|
+
surveyType?: SurveyType;
|
|
75
|
+
position?: 'bottom-right' | 'bottom-left' | 'center' | 'bottom';
|
|
76
|
+
title?: string | null;
|
|
77
|
+
description?: string | null;
|
|
78
|
+
lowLabel?: string | null;
|
|
79
|
+
highLabel?: string | null;
|
|
80
|
+
customQuestions?: SurveyQuestion[];
|
|
81
|
+
theme?: 'light' | 'dark';
|
|
82
|
+
onSubmit?: (response: SurveyWidgetResponse) => void;
|
|
83
|
+
onDismiss?: () => void;
|
|
84
|
+
}
|
|
98
85
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
export interface SurveyWidget {
|
|
87
|
+
show(): this;
|
|
88
|
+
hide(): this;
|
|
89
|
+
destroy(): void;
|
|
90
|
+
surveyOptions: SurveyWidgetOptions;
|
|
91
|
+
surveyState: {
|
|
92
|
+
score: number | null;
|
|
93
|
+
feedback: string;
|
|
94
|
+
customAnswers: Record<string, any>;
|
|
95
|
+
isVisible: boolean;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
105
98
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
destroy(): void;
|
|
113
|
-
readonly initialized: boolean;
|
|
114
|
-
}
|
|
99
|
+
export interface SurveyConfig {
|
|
100
|
+
workspace: string;
|
|
101
|
+
userContext?: UserContext;
|
|
102
|
+
debug?: boolean;
|
|
103
|
+
apiUrl?: string;
|
|
104
|
+
}
|
|
115
105
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
isReady: () => boolean;
|
|
126
|
-
setUserContext: (userContext: UserContext) => void;
|
|
127
|
-
onReady: (callback: (sdk: FeedbackSDK) => void) => void;
|
|
128
|
-
onError: (callback: (error: Error) => void) => void;
|
|
129
|
-
version: string;
|
|
130
|
-
instance: FeedbackSDK | null;
|
|
131
|
-
}
|
|
106
|
+
export class SurveySDK {
|
|
107
|
+
constructor(config: SurveyConfig);
|
|
108
|
+
init(): Promise<{ initialized: boolean }>;
|
|
109
|
+
createWidget(type: 'survey', options: SurveyWidgetOptions): SurveyWidget;
|
|
110
|
+
setUserContext(userContext: UserContext): void;
|
|
111
|
+
getUserContext(): UserContext | null;
|
|
112
|
+
destroy(): void;
|
|
113
|
+
readonly initialized: boolean;
|
|
114
|
+
}
|
|
132
115
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
116
|
+
interface FeedbackSDKExport {
|
|
117
|
+
FeedbackSDK: typeof FeedbackSDK;
|
|
118
|
+
ButtonWidget: any;
|
|
119
|
+
create: (config: FeedbackConfig) => FeedbackSDK;
|
|
120
|
+
initWithUser: (
|
|
121
|
+
config: Omit<FeedbackConfig, 'userContext'>,
|
|
122
|
+
userContext: UserContext
|
|
123
|
+
) => Promise<FeedbackSDK>;
|
|
124
|
+
getInstance: () => FeedbackSDK | null;
|
|
125
|
+
isReady: () => boolean;
|
|
126
|
+
setUserContext: (userContext: UserContext) => void;
|
|
127
|
+
onReady: (callback: (sdk: FeedbackSDK) => void) => void;
|
|
128
|
+
onError: (callback: (error: Error) => void) => void;
|
|
129
|
+
version: string;
|
|
130
|
+
instance: FeedbackSDK | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ChangelogWidgetOptions {
|
|
134
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
135
|
+
theme?: 'light' | 'dark';
|
|
136
|
+
triggerText?: string;
|
|
137
|
+
showBadge?: boolean;
|
|
138
|
+
title?: string;
|
|
139
|
+
viewButtonText?: string;
|
|
140
|
+
changelogBaseUrl?: string;
|
|
141
|
+
openInNewTab?: boolean;
|
|
142
|
+
customStyles?: Record<string, string>;
|
|
143
|
+
onViewUpdate?: (changelog: any) => void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface ChangelogWidget {
|
|
147
|
+
id: string;
|
|
148
|
+
type: 'changelog';
|
|
149
|
+
mount(container?: string | HTMLElement): this;
|
|
150
|
+
destroy(): void;
|
|
151
|
+
openModal(): void;
|
|
152
|
+
closeModal(): void;
|
|
153
|
+
openSidebar(): void;
|
|
154
|
+
closeSidebar(): void;
|
|
155
|
+
hideBadge(): void;
|
|
156
|
+
showBadge(): void;
|
|
157
|
+
nextChangelog(): void;
|
|
158
|
+
prevChangelog(): void;
|
|
159
|
+
refresh(): Promise<void>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const FeedbackSDKDefault: FeedbackSDKExport;
|
|
163
|
+
export default FeedbackSDKDefault;
|
|
164
|
+
}
|