@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/types/index.d.ts CHANGED
@@ -1,135 +1,164 @@
1
1
  declare module '@product7/feedback-sdk' {
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
- }
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
- 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
- }
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
- 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
- }
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
- 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
- }
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
- export type SurveyType = 'nps' | 'csat' | 'ces' | 'custom';
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
- export interface SurveyWidgetResponse {
65
- type: SurveyType;
66
- score: number | null;
67
- feedback: string;
68
- customAnswers: Record<string, any>;
69
- timestamp: string;
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
- 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
- }
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
- 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
- }
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
- export interface SurveyConfig {
100
- workspace: string;
101
- userContext?: UserContext;
102
- debug?: boolean;
103
- apiUrl?: string;
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
- 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
- }
99
+ export interface SurveyConfig {
100
+ workspace: string;
101
+ userContext?: UserContext;
102
+ debug?: boolean;
103
+ apiUrl?: string;
104
+ }
115
105
 
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
- }
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
- const FeedbackSDKDefault: FeedbackSDKExport;
134
- export default FeedbackSDKDefault;
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
+ }