@product7/feedback-sdk 1.0.3 → 1.0.4
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/types/index.d.ts +63 -37
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,42 +1,68 @@
|
|
|
1
|
+
|
|
1
2
|
declare module '@product7/feedback-sdk' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export interface FeedbackConfig {
|
|
4
|
+
workspace: string;
|
|
5
|
+
userContext: UserContext;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
boardId?: string;
|
|
8
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
9
|
+
theme?: 'light' | 'dark';
|
|
10
|
+
apiUrl?: string;
|
|
11
|
+
autoShow?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UserContext {
|
|
15
|
+
user_id?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
custom_fields?: Record<string, any>;
|
|
19
|
+
company?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
monthly_spend?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
8
25
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
export interface ButtonWidget {
|
|
27
|
+
id: string;
|
|
28
|
+
type: 'button';
|
|
29
|
+
mount(container?: string | HTMLElement): this;
|
|
30
|
+
destroy(): void;
|
|
31
|
+
show(): this;
|
|
32
|
+
hide(): this;
|
|
33
|
+
openModal(): void;
|
|
34
|
+
closeModal(): void;
|
|
35
|
+
}
|
|
17
36
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
export class FeedbackSDK {
|
|
38
|
+
constructor(config: FeedbackConfig);
|
|
39
|
+
init(): Promise<{
|
|
40
|
+
initialized: boolean;
|
|
41
|
+
config?: any;
|
|
42
|
+
sessionToken?: string;
|
|
43
|
+
expiresIn?: number;
|
|
44
|
+
}>;
|
|
45
|
+
createWidget(type: 'button', options?: Partial<FeedbackConfig>): ButtonWidget;
|
|
46
|
+
setUserContext(userContext: UserContext): void;
|
|
47
|
+
getUserContext(): UserContext | null;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
readonly initialized: boolean;
|
|
50
|
+
}
|
|
27
51
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
interface FeedbackSDKExport {
|
|
53
|
+
FeedbackSDK: typeof FeedbackSDK;
|
|
54
|
+
ButtonWidget: any;
|
|
55
|
+
create: (config: FeedbackConfig) => FeedbackSDK;
|
|
56
|
+
initWithUser: (config: Omit<FeedbackConfig, 'userContext'>, userContext: UserContext) => Promise<FeedbackSDK>;
|
|
57
|
+
getInstance: () => FeedbackSDK | null;
|
|
58
|
+
isReady: () => boolean;
|
|
59
|
+
setUserContext: (userContext: UserContext) => void;
|
|
60
|
+
onReady: (callback: (sdk: FeedbackSDK) => void) => void;
|
|
61
|
+
onError: (callback: (error: Error) => void) => void;
|
|
62
|
+
version: string;
|
|
63
|
+
instance: FeedbackSDK | null;
|
|
64
|
+
}
|
|
39
65
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
66
|
+
const FeedbackSDKDefault: FeedbackSDKExport;
|
|
67
|
+
export default FeedbackSDKDefault;
|
|
68
|
+
}
|