-
-
Notifications
You must be signed in to change notification settings - Fork 344
/
Copy pathdefaults.ts
99 lines (93 loc) · 3.26 KB
/
defaults.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import type { FeedbackButtonProps, FeedbackWidgetProps, ScreenshotButtonProps } from './FeedbackWidget.types';
import { feedbackAlertDialog } from './utils';
const FORM_TITLE = 'Report a Bug';
const NAME_PLACEHOLDER = 'Your Name';
const NAME_LABEL = 'Name';
const EMAIL_PLACEHOLDER = '[email protected]';
const EMAIL_LABEL = 'Email';
const MESSAGE_PLACEHOLDER = "What's the bug? What did you expect?";
const MESSAGE_LABEL = 'Description';
const IS_REQUIRED_LABEL = '(required)';
const SUBMIT_BUTTON_LABEL = 'Send Bug Report';
const CANCEL_BUTTON_LABEL = 'Cancel';
const TRIGGER_LABEL = 'Report a Bug';
const TRIGGER_SCREENSHOT_LABEL = 'Take Screenshot';
const ERROR_TITLE = 'Error';
const FORM_ERROR = 'Please fill out all required fields.';
const EMAIL_ERROR = 'Please enter a valid email address.';
const CAPTURE_SCREENSHOT_ERROR = 'Error capturing screenshot. Please try again.';
const SUCCESS_MESSAGE_TEXT = 'Thank you for your report!';
const ADD_SCREENSHOT_LABEL = 'Add a screenshot';
const CAPTURE_SCREENSHOT_LABEL = 'Take a screenshot';
const REMOVE_SCREENSHOT_LABEL = 'Remove screenshot';
const GENERIC_ERROR_TEXT = 'Unable to send feedback due to an unexpected error.';
export const defaultConfiguration: Partial<FeedbackWidgetProps> = {
// FeedbackCallbacks
onFormOpen: () => {
// Does nothing by default
},
onFormClose: () => {
if (__DEV__) {
feedbackAlertDialog(
'Development note',
'onFormClose callback is not implemented. By default the form is just unmounted.',
);
}
},
onAddScreenshot: (_: (uri: string) => void) => {
if (__DEV__) {
feedbackAlertDialog('Development note', 'onAddScreenshot callback is not implemented.');
}
},
onSubmitSuccess: () => {
// Does nothing by default
},
onSubmitError: () => {
// Does nothing by default
},
onFormSubmitted: () => {
if (__DEV__) {
feedbackAlertDialog(
'Development note',
'onFormSubmitted callback is not implemented. By default the form is just unmounted.',
);
}
},
// FeedbackGeneralConfiguration
showBranding: true,
isEmailRequired: false,
shouldValidateEmail: true,
isNameRequired: false,
showEmail: true,
showName: true,
enableScreenshot: false,
enableTakeScreenshot: false,
// FeedbackTextConfiguration
cancelButtonLabel: CANCEL_BUTTON_LABEL,
emailLabel: EMAIL_LABEL,
emailPlaceholder: EMAIL_PLACEHOLDER,
formTitle: FORM_TITLE,
isRequiredLabel: IS_REQUIRED_LABEL,
messageLabel: MESSAGE_LABEL,
messagePlaceholder: MESSAGE_PLACEHOLDER,
nameLabel: NAME_LABEL,
namePlaceholder: NAME_PLACEHOLDER,
submitButtonLabel: SUBMIT_BUTTON_LABEL,
errorTitle: ERROR_TITLE,
formError: FORM_ERROR,
emailError: EMAIL_ERROR,
captureScreenshotError: CAPTURE_SCREENSHOT_ERROR,
successMessageText: SUCCESS_MESSAGE_TEXT,
addScreenshotButtonLabel: ADD_SCREENSHOT_LABEL,
removeScreenshotButtonLabel: REMOVE_SCREENSHOT_LABEL,
captureScreenshotButtonLabel: CAPTURE_SCREENSHOT_LABEL,
genericError: GENERIC_ERROR_TEXT,
};
export const defaultButtonConfiguration: Partial<FeedbackButtonProps> = {
triggerLabel: TRIGGER_LABEL,
triggerAriaLabel: '',
};
export const defaultScreenshotButtonConfiguration: Partial<ScreenshotButtonProps> = {
triggerLabel: TRIGGER_SCREENSHOT_LABEL,
triggerAriaLabel: '',
};