@atlaskit/feedback-collector 7.1.0
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/CHANGELOG.md +774 -0
- package/LICENSE +13 -0
- package/README.md +13 -0
- package/dist/cjs/components/FeedbackCollector.js +226 -0
- package/dist/cjs/components/FeedbackFlag.js +35 -0
- package/dist/cjs/components/FeedbackForm.js +227 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/components/FeedbackCollector.js +162 -0
- package/dist/es2019/components/FeedbackFlag.js +18 -0
- package/dist/es2019/components/FeedbackForm.js +156 -0
- package/dist/es2019/index.js +5 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/components/FeedbackCollector.js +205 -0
- package/dist/esm/components/FeedbackFlag.js +20 -0
- package/dist/esm/components/FeedbackForm.js +205 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/components/FeedbackCollector.d.ts +135 -0
- package/dist/types/components/FeedbackFlag.d.ts +9 -0
- package/dist/types/components/FeedbackForm.d.ts +47 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/types.d.ts +11 -0
- package/package.json +72 -0
- package/types/package.json +7 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AutoDismissFlag } from '@atlaskit/flag';
|
|
4
|
+
import SuccessIcon from '@atlaskit/icon/glyph/check-circle';
|
|
5
|
+
import { G300 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
|
|
8
|
+
var FeedbackFlag = function FeedbackFlag(props) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(AutoDismissFlag, _extends({
|
|
10
|
+
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
11
|
+
primaryColor: token('color.iconBorder.success', G300),
|
|
12
|
+
label: "Success"
|
|
13
|
+
}),
|
|
14
|
+
id: "feedbackSent",
|
|
15
|
+
description: props.description ? props.description : 'Your valuable feedback helps us continually improve our products.',
|
|
16
|
+
title: props.title ? props.title : 'Thanks!'
|
|
17
|
+
}, props));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default FeedbackFlag;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
+
|
|
14
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
15
|
+
|
|
16
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
|
+
|
|
18
|
+
import React, { Component, Fragment } from 'react';
|
|
19
|
+
import Button from '@atlaskit/button/standard-button';
|
|
20
|
+
import { Checkbox } from '@atlaskit/checkbox';
|
|
21
|
+
import Form, { Field } from '@atlaskit/form';
|
|
22
|
+
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle } from '@atlaskit/modal-dialog';
|
|
23
|
+
import Select from '@atlaskit/select';
|
|
24
|
+
import TextArea from '@atlaskit/textarea';
|
|
25
|
+
|
|
26
|
+
var getFieldLabels = function getFieldLabels(record) {
|
|
27
|
+
return {
|
|
28
|
+
bug: record !== null && record !== void 0 && record.bug.fieldLabel ? record.bug.fieldLabel : 'Describe the bug or issue',
|
|
29
|
+
comment: record !== null && record !== void 0 && record.comment.fieldLabel ? record.comment.fieldLabel : "Let us know what's on your mind",
|
|
30
|
+
suggestion: record !== null && record !== void 0 && record.suggestion.fieldLabel ? record.suggestion.fieldLabel : "Let us know what you'd like to improve",
|
|
31
|
+
question: record !== null && record !== void 0 && record.question.fieldLabel ? record.question.fieldLabel : 'What would you like to know?',
|
|
32
|
+
empty: record !== null && record !== void 0 && record.empty.fieldLabel ? record.empty.fieldLabel : 'Select an option'
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var getSelectOptions = function getSelectOptions(record) {
|
|
37
|
+
return [{
|
|
38
|
+
label: record !== null && record !== void 0 && record.question.selectOptionLabel ? record.question.selectOptionLabel : 'Ask a question',
|
|
39
|
+
value: 'question'
|
|
40
|
+
}, {
|
|
41
|
+
label: record !== null && record !== void 0 && record.comment.selectOptionLabel ? record.comment.selectOptionLabel : 'Leave a comment',
|
|
42
|
+
value: 'comment'
|
|
43
|
+
}, {
|
|
44
|
+
label: record !== null && record !== void 0 && record.bug.selectOptionLabel ? record.bug.selectOptionLabel : 'Report a bug',
|
|
45
|
+
value: 'bug'
|
|
46
|
+
}, {
|
|
47
|
+
label: record !== null && record !== void 0 && record.suggestion.selectOptionLabel ? record.suggestion.selectOptionLabel : 'Suggest an improvement',
|
|
48
|
+
value: 'suggestion'
|
|
49
|
+
}];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var getDefaultSelectValue = function getDefaultSelectValue(record) {
|
|
53
|
+
return {
|
|
54
|
+
label: record !== null && record !== void 0 && record.empty.selectOptionLabel ? record.empty.selectOptionLabel : 'I want to...',
|
|
55
|
+
value: 'empty'
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var FeedbackForm = /*#__PURE__*/function (_Component) {
|
|
60
|
+
_inherits(FeedbackForm, _Component);
|
|
61
|
+
|
|
62
|
+
var _super = _createSuper(FeedbackForm);
|
|
63
|
+
|
|
64
|
+
function FeedbackForm() {
|
|
65
|
+
var _this;
|
|
66
|
+
|
|
67
|
+
_classCallCheck(this, FeedbackForm);
|
|
68
|
+
|
|
69
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
|
+
args[_key] = arguments[_key];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
74
|
+
|
|
75
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
76
|
+
type: 'empty',
|
|
77
|
+
description: '',
|
|
78
|
+
canBeContacted: false,
|
|
79
|
+
enrollInResearchGroup: false
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "isTypeSelected", function () {
|
|
83
|
+
return _this.state.type !== 'empty';
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
_defineProperty(_assertThisInitialized(_this), "onSubmit", function () {
|
|
87
|
+
var _this$state = _this.state,
|
|
88
|
+
type = _this$state.type,
|
|
89
|
+
description = _this$state.description,
|
|
90
|
+
canBeContacted = _this$state.canBeContacted,
|
|
91
|
+
enrollInResearchGroup = _this$state.enrollInResearchGroup;
|
|
92
|
+
|
|
93
|
+
_this.props.onSubmit({
|
|
94
|
+
type: type,
|
|
95
|
+
description: description,
|
|
96
|
+
canBeContacted: canBeContacted,
|
|
97
|
+
enrollInResearchGroup: enrollInResearchGroup
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return _this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_createClass(FeedbackForm, [{
|
|
105
|
+
key: "render",
|
|
106
|
+
value: function render() {
|
|
107
|
+
var _this2 = this;
|
|
108
|
+
|
|
109
|
+
var showTypeField = this.props.showTypeField;
|
|
110
|
+
var canShowTextField = this.isTypeSelected() || !showTypeField;
|
|
111
|
+
var isDisabled = showTypeField ? !this.isTypeSelected() || !this.state.description : !this.state.description;
|
|
112
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
113
|
+
onClose: this.props.onClose
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
115
|
+
onSubmit: this.onSubmit
|
|
116
|
+
}, function (_ref) {
|
|
117
|
+
var formProps = _ref.formProps;
|
|
118
|
+
return /*#__PURE__*/React.createElement("form", formProps, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, _this2.props.feedbackTitle)), /*#__PURE__*/React.createElement(ModalBody, null, _this2.props.feedbackTitleDetails, showTypeField ? /*#__PURE__*/React.createElement(Select, {
|
|
119
|
+
onChange: function onChange(option) {
|
|
120
|
+
if (!option || option instanceof Array) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_this2.setState({
|
|
125
|
+
type: option.value
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
menuPortalTarget: document.body,
|
|
129
|
+
styles: {
|
|
130
|
+
menuPortal: function menuPortal(base) {
|
|
131
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
132
|
+
zIndex: 9999
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
defaultValue: getDefaultSelectValue(_this2.props.feedbackGroupLabels),
|
|
137
|
+
options: getSelectOptions(_this2.props.feedbackGroupLabels)
|
|
138
|
+
}) : null, canShowTextField ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
139
|
+
label: showTypeField ? getFieldLabels(_this2.props.feedbackGroupLabels)[_this2.state.type] : null,
|
|
140
|
+
isRequired: true,
|
|
141
|
+
name: "description"
|
|
142
|
+
}, function (_ref2) {
|
|
143
|
+
var fieldProps = _ref2.fieldProps;
|
|
144
|
+
return /*#__PURE__*/React.createElement(TextArea, _extends({}, fieldProps, {
|
|
145
|
+
name: "foo",
|
|
146
|
+
minimumRows: 6,
|
|
147
|
+
placeholder: _this2.props.summaryPlaceholder,
|
|
148
|
+
onChange: function onChange(e) {
|
|
149
|
+
return _this2.setState({
|
|
150
|
+
description: e.target.value
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
value: _this2.state.description
|
|
154
|
+
}));
|
|
155
|
+
}), /*#__PURE__*/React.createElement(Field, {
|
|
156
|
+
name: "can-be-contacted"
|
|
157
|
+
}, function (_ref3) {
|
|
158
|
+
var fieldProps = _ref3.fieldProps;
|
|
159
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
160
|
+
label: _this2.props.canBeContactedLabel,
|
|
161
|
+
onChange: function onChange(event) {
|
|
162
|
+
return _this2.setState({
|
|
163
|
+
canBeContacted: event.target.checked
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
}), /*#__PURE__*/React.createElement(Field, {
|
|
168
|
+
name: "enroll-in-research-group"
|
|
169
|
+
}, function (_ref4) {
|
|
170
|
+
var fieldProps = _ref4.fieldProps;
|
|
171
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
172
|
+
label: _this2.props.enrolInResearchLabel,
|
|
173
|
+
onChange: function onChange(event) {
|
|
174
|
+
return _this2.setState({
|
|
175
|
+
enrollInResearchGroup: event.target.checked
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}));
|
|
179
|
+
})) : /*#__PURE__*/React.createElement(Fragment, null)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
180
|
+
appearance: "subtle",
|
|
181
|
+
onClick: _this2.props.onClose
|
|
182
|
+
}, _this2.props.cancelButtonLabel), /*#__PURE__*/React.createElement(Button, {
|
|
183
|
+
appearance: "primary",
|
|
184
|
+
type: "submit",
|
|
185
|
+
isDisabled: isDisabled
|
|
186
|
+
}, _this2.props.submitButtonLabel)));
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
}]);
|
|
190
|
+
|
|
191
|
+
return FeedbackForm;
|
|
192
|
+
}(Component);
|
|
193
|
+
|
|
194
|
+
_defineProperty(FeedbackForm, "defaultProps", {
|
|
195
|
+
showTypeField: true,
|
|
196
|
+
feedbackTitle: 'Share your thoughts',
|
|
197
|
+
enrolInResearchLabel: "I'd like to participate in product research",
|
|
198
|
+
canBeContactedLabel: 'Atlassian can contact me about this feedback',
|
|
199
|
+
submitButtonLabel: 'Send feedback',
|
|
200
|
+
cancelButtonLabel: 'Cancel',
|
|
201
|
+
onClose: function onClose() {},
|
|
202
|
+
onSubmit: function onSubmit() {}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export { FeedbackForm as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { FormFields, SelectOptionDetails, SelectValue } from '../types';
|
|
3
|
+
declare type FieldValueType = string | Object | Object[];
|
|
4
|
+
export declare type FieldType = {
|
|
5
|
+
id: string;
|
|
6
|
+
value: FieldValueType;
|
|
7
|
+
};
|
|
8
|
+
declare type FeedbackType = {
|
|
9
|
+
fields: FieldType[];
|
|
10
|
+
};
|
|
11
|
+
export interface Props {
|
|
12
|
+
/** The customer email */
|
|
13
|
+
email?: string;
|
|
14
|
+
/** The customer name */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** The request id to access the widget service */
|
|
17
|
+
requestTypeId: string;
|
|
18
|
+
/** The embeddable key to access the widget service */
|
|
19
|
+
embeddableKey: string;
|
|
20
|
+
/** Additional fields to send to the widget service **/
|
|
21
|
+
additionalFields: FieldType[];
|
|
22
|
+
/** Override the default id for the "can be contacted" custom field in your widget service **/
|
|
23
|
+
canBeContactedFieldId: string;
|
|
24
|
+
/** Override the default value for the "can be contacted" custom field in your widget service **/
|
|
25
|
+
canBeContactedDefaultValue: FieldValueType;
|
|
26
|
+
/** Override the default id for the "customer name" custom field in your widget service **/
|
|
27
|
+
customerNameFieldId: string;
|
|
28
|
+
/** Override the default value for the "customer name" custom field in your widget service **/
|
|
29
|
+
customerNameDefaultValue: FieldValueType;
|
|
30
|
+
/** Override the default id for the "description" custom field in your widget service **/
|
|
31
|
+
descriptionFieldId: string;
|
|
32
|
+
/** Override the default value for the "description" custom field in your widget service **/
|
|
33
|
+
descriptionDefaultValue: FieldValueType;
|
|
34
|
+
/** Override the default id for the "enroll in research" custom field in your widget service **/
|
|
35
|
+
enrollInResearchFieldId: string;
|
|
36
|
+
/** Override the default value for the "enroll in research" custom field in your widget service **/
|
|
37
|
+
enrollInResearchDefaultValue: FieldValueType;
|
|
38
|
+
/** Override the default id for the "email" custom field in your widget service **/
|
|
39
|
+
emailFieldId: string;
|
|
40
|
+
/** Override the default value for the "email" custom field in your widget service **/
|
|
41
|
+
emailDefaultValue: FieldValueType;
|
|
42
|
+
/** Override the default id for the "summary" custom field in your widget service **/
|
|
43
|
+
summaryFieldId: string;
|
|
44
|
+
/** Override the default value for the "summary" custom field in your widget service **/
|
|
45
|
+
summaryDefaultValue: FieldValueType;
|
|
46
|
+
/** Number of characters that the "summary" field accepts, the rest will be truncated **/
|
|
47
|
+
summaryTruncateLength: number;
|
|
48
|
+
/** After this delay the onSubmit callback will be triggered optimistically **/
|
|
49
|
+
timeoutOnSubmit: number;
|
|
50
|
+
/** Override the default id for the "type" custom field in your widget service **/
|
|
51
|
+
typeFieldId: string;
|
|
52
|
+
/** Override the default value for the "Bug" type of response in your widget service **/
|
|
53
|
+
typeBugDefaultValue: FieldValueType;
|
|
54
|
+
/** Override the default value for the "Comment" type of response in your widget service **/
|
|
55
|
+
typeCommentDefaultValue: FieldValueType;
|
|
56
|
+
/** Override the default value for the "Suggestion" type of response in your widget service **/
|
|
57
|
+
typeSuggestionDefaultValue: FieldValueType;
|
|
58
|
+
/** Override the default value for the "Question" type of response in your widget service **/
|
|
59
|
+
typeQuestionDefaultValue: FieldValueType;
|
|
60
|
+
/** Override the default value for the "Empty" type of response in your widget service **/
|
|
61
|
+
typeEmptyDefaultValue: FieldValueType;
|
|
62
|
+
/** Override to hide the feedback type select drop down for the feedback **/
|
|
63
|
+
showTypeField: boolean;
|
|
64
|
+
/** Message which will be shown as the title of the feedback dialog **/
|
|
65
|
+
feedbackTitle?: React.ReactText;
|
|
66
|
+
/** Message which will be shown below the title of the feedback dialog **/
|
|
67
|
+
feedbackTitleDetails?: React.ReactChild;
|
|
68
|
+
/** Message which will be shown next to the enrol in research checkbox **/
|
|
69
|
+
enrolInResearchLabel?: React.ReactChild;
|
|
70
|
+
/** Message which will be shown next to the can be contacted checkbox **/
|
|
71
|
+
canBeContactedLabel?: React.ReactChild;
|
|
72
|
+
/** Message which will be shown inside the summary text field **/
|
|
73
|
+
summaryPlaceholder?: string;
|
|
74
|
+
/** Message for submit button label **/
|
|
75
|
+
submitButtonLabel?: string;
|
|
76
|
+
/** Message for cancel button label **/
|
|
77
|
+
cancelButtonLabel?: string;
|
|
78
|
+
/** Message for select option labels and field labels **/
|
|
79
|
+
feedbackGroupLabels?: Record<SelectValue, SelectOptionDetails>;
|
|
80
|
+
/** Function that will be called to initiate the exit transition. */
|
|
81
|
+
onClose: () => void;
|
|
82
|
+
/** Function that will be called optimistically after a delay when the feedback is submitted. */
|
|
83
|
+
onSubmit: (formFields: FormFields) => void;
|
|
84
|
+
}
|
|
85
|
+
export default class FeedbackCollector extends Component<Props> {
|
|
86
|
+
static defaultProps: {
|
|
87
|
+
canBeContactedFieldId: string;
|
|
88
|
+
canBeContactedDefaultValue: {
|
|
89
|
+
id: string;
|
|
90
|
+
}[];
|
|
91
|
+
additionalFields: never[];
|
|
92
|
+
customerNameFieldId: string;
|
|
93
|
+
customerNameDefaultValue: string;
|
|
94
|
+
descriptionFieldId: string;
|
|
95
|
+
descriptionDefaultValue: string;
|
|
96
|
+
enrollInResearchFieldId: string;
|
|
97
|
+
enrollInResearchDefaultValue: {
|
|
98
|
+
id: string;
|
|
99
|
+
}[];
|
|
100
|
+
emailFieldId: string;
|
|
101
|
+
emailDefaultValue: string;
|
|
102
|
+
summaryFieldId: string;
|
|
103
|
+
summaryDefaultValue: string;
|
|
104
|
+
summaryTruncateLength: number;
|
|
105
|
+
timeoutOnSubmit: number;
|
|
106
|
+
typeFieldId: string;
|
|
107
|
+
typeBugDefaultValue: {
|
|
108
|
+
id: string;
|
|
109
|
+
};
|
|
110
|
+
typeCommentDefaultValue: {
|
|
111
|
+
id: string;
|
|
112
|
+
};
|
|
113
|
+
typeSuggestionDefaultValue: {
|
|
114
|
+
id: string;
|
|
115
|
+
};
|
|
116
|
+
typeQuestionDefaultValue: {
|
|
117
|
+
id: string;
|
|
118
|
+
};
|
|
119
|
+
typeEmptyDefaultValue: {
|
|
120
|
+
id: string;
|
|
121
|
+
};
|
|
122
|
+
showTypeField: boolean;
|
|
123
|
+
onClose: () => void;
|
|
124
|
+
onSubmit: () => void;
|
|
125
|
+
};
|
|
126
|
+
getTypeFieldValue(dtype: SelectValue): FieldValueType;
|
|
127
|
+
getEmail(formValues: FormFields): Object;
|
|
128
|
+
getDescription(formValues: FormFields): Object;
|
|
129
|
+
getSummary(formValues: FormFields): Object;
|
|
130
|
+
getCustomerName(): Object;
|
|
131
|
+
mapFormToJSD(formValues: FormFields): FeedbackType;
|
|
132
|
+
postFeedback: (formValues: FormFields) => void;
|
|
133
|
+
render(): JSX.Element;
|
|
134
|
+
}
|
|
135
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AkProps {
|
|
3
|
+
isDismissAllowed?: boolean;
|
|
4
|
+
description?: React.ReactText;
|
|
5
|
+
title?: React.ReactText;
|
|
6
|
+
onDismissed?: (...args: Array<any>) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const FeedbackFlag: (props: AkProps) => JSX.Element;
|
|
9
|
+
export default FeedbackFlag;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { FormFields, SelectOptionDetails, SelectValue } from '../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Message which will be shown as the title of the feedback dialog **/
|
|
5
|
+
feedbackTitle?: React.ReactText;
|
|
6
|
+
/** Override to hide the feedback type select drop down for the feedback **/
|
|
7
|
+
showTypeField?: boolean;
|
|
8
|
+
/** Message which will be shown below the title of the feedback dialog **/
|
|
9
|
+
feedbackTitleDetails?: React.ReactChild;
|
|
10
|
+
/** Message which will be shown next to the enrol in research checkbox **/
|
|
11
|
+
enrolInResearchLabel: React.ReactChild;
|
|
12
|
+
/** Message which will be shown next to the can be contacted checkbox **/
|
|
13
|
+
canBeContactedLabel?: React.ReactChild;
|
|
14
|
+
/** Message which will be shown inside the summary text field **/
|
|
15
|
+
summaryPlaceholder?: string;
|
|
16
|
+
/** Message for submit button label **/
|
|
17
|
+
submitButtonLabel?: string;
|
|
18
|
+
/** Message for cancel button label **/
|
|
19
|
+
cancelButtonLabel?: string;
|
|
20
|
+
/** Message for select option labels and field labels **/
|
|
21
|
+
feedbackGroupLabels?: Record<SelectValue, SelectOptionDetails>;
|
|
22
|
+
/** Function that will be called to initiate the exit transition. */
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
/** Function that will be called immediately after the submit action */
|
|
25
|
+
onSubmit: (formValues: FormFields) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface OptionType {
|
|
28
|
+
label: string;
|
|
29
|
+
value: SelectValue;
|
|
30
|
+
}
|
|
31
|
+
export default class FeedbackForm extends Component<Props, FormFields> {
|
|
32
|
+
state: FormFields;
|
|
33
|
+
static defaultProps: {
|
|
34
|
+
showTypeField: boolean;
|
|
35
|
+
feedbackTitle: string;
|
|
36
|
+
enrolInResearchLabel: string;
|
|
37
|
+
canBeContactedLabel: string;
|
|
38
|
+
submitButtonLabel: string;
|
|
39
|
+
cancelButtonLabel: string;
|
|
40
|
+
onClose: () => void;
|
|
41
|
+
onSubmit: () => void;
|
|
42
|
+
};
|
|
43
|
+
isTypeSelected: () => boolean;
|
|
44
|
+
onSubmit: () => void;
|
|
45
|
+
render(): JSX.Element;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import FeedbackCollector from './components/FeedbackCollector';
|
|
2
|
+
import FeedbackFlag from './components/FeedbackFlag';
|
|
3
|
+
import FeedbackForm from './components/FeedbackForm';
|
|
4
|
+
export type { FormFields } from './types';
|
|
5
|
+
export default FeedbackCollector;
|
|
6
|
+
export { FeedbackFlag, FeedbackForm };
|