@atlaskit/feedback-collector 15.3.0 → 15.4.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/feedback-collector
2
2
 
3
+ ## 15.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`4cffc70fa1cfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4cffc70fa1cfe) -
8
+ Add onCancel callback to FeedbackCollector and FeedbackForm
9
+
3
10
  ## 15.3.0
4
11
 
5
12
  ### Minor Changes
@@ -164,7 +164,7 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
164
164
  }, {
165
165
  key: "getPackageVersion",
166
166
  value: function getPackageVersion() {
167
- return "15.2.1" || 'Unknown, at least 11.0.0';
167
+ return "15.3.0" || 'Unknown, at least 11.0.0';
168
168
  }
169
169
  }, {
170
170
  key: "getEntitlementInformation",
@@ -486,6 +486,7 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
486
486
  feedbackGroupLabels: this.props.feedbackGroupLabels,
487
487
  onSubmit: this.postFeedback,
488
488
  onClose: this.props.onClose,
489
+ onCancel: this.props.onCancel,
489
490
  locale: this.props.locale,
490
491
  anonymousFeedback: (0, _platformFeatureFlags.fg)('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
491
492
  selectLabel: this.props.selectLabel,
@@ -49,6 +49,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
49
49
  showDefaultTextFields = _ref2$showDefaultText === void 0 ? true : _ref2$showDefaultText,
50
50
  customContent = _ref2.customContent,
51
51
  onClose = _ref2.onClose,
52
+ onCancel = _ref2.onCancel,
52
53
  onSubmit = _ref2.onSubmit,
53
54
  feedbackTitle = _ref2.feedbackTitle,
54
55
  feedbackTitleDetails = _ref2.feedbackTitleDetails,
@@ -99,6 +100,10 @@ var FeedbackForm = function FeedbackForm(_ref2) {
99
100
  var isTypeSelected = function isTypeSelected() {
100
101
  return type !== 'empty';
101
102
  };
103
+ var handleCancel = function handleCancel() {
104
+ onCancel === null || onCancel === void 0 || onCancel();
105
+ onClose();
106
+ };
102
107
  var canShowTextField = isTypeSelected() || !showTypeField;
103
108
  var hasDescription = description || hasDescriptionDefaultValue;
104
109
  var isDisabled = isSubmitting || disableSubmitButton;
@@ -318,7 +323,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
318
323
  }, feedbackIsAnonymous);
319
324
  })))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_standardButton.default, {
320
325
  appearance: "subtle",
321
- onClick: onClose
326
+ onClick: handleCancel
322
327
  }, cancelButtonLabel || /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _messages.messages.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(_standardButton.default, {
323
328
  appearance: "primary",
324
329
  type: "submit",
@@ -458,7 +463,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
458
463
  }, feedbackIsAnonymous);
459
464
  })))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_standardButton.default, {
460
465
  appearance: "subtle",
461
- onClick: onClose
466
+ onClick: handleCancel
462
467
  }, cancelButtonLabel || /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _messages.messages.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(_standardButton.default, {
463
468
  appearance: "primary",
464
469
  type: "submit",
@@ -92,7 +92,7 @@ export default class FeedbackCollector extends Component {
92
92
  return FeedbackCollector.defaultProps.url;
93
93
  }
94
94
  getPackageVersion() {
95
- return "15.2.1" || 'Unknown, at least 11.0.0';
95
+ return "15.3.0" || 'Unknown, at least 11.0.0';
96
96
  }
97
97
  async getEntitlementInformation() {
98
98
  var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
@@ -323,6 +323,7 @@ export default class FeedbackCollector extends Component {
323
323
  feedbackGroupLabels: this.props.feedbackGroupLabels,
324
324
  onSubmit: this.postFeedback,
325
325
  onClose: this.props.onClose,
326
+ onCancel: this.props.onCancel,
326
327
  locale: this.props.locale,
327
328
  anonymousFeedback: fg('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
328
329
  selectLabel: this.props.selectLabel,
@@ -29,6 +29,7 @@ const FeedbackForm = ({
29
29
  showDefaultTextFields = true,
30
30
  customContent,
31
31
  onClose,
32
+ onCancel,
32
33
  onSubmit,
33
34
  feedbackTitle,
34
35
  feedbackTitleDetails,
@@ -59,6 +60,10 @@ const FeedbackForm = ({
59
60
  formatMessage
60
61
  } = useIntl();
61
62
  const isTypeSelected = () => type !== 'empty';
63
+ const handleCancel = () => {
64
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
65
+ onClose();
66
+ };
62
67
  const canShowTextField = isTypeSelected() || !showTypeField;
63
68
  const hasDescription = description || hasDescriptionDefaultValue;
64
69
  const isDisabled = isSubmitting || disableSubmitButton;
@@ -251,7 +256,7 @@ const FeedbackForm = ({
251
256
  appearance: 'information'
252
257
  }, feedbackIsAnonymous))))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
253
258
  appearance: "subtle",
254
- onClick: onClose
259
+ onClick: handleCancel
255
260
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
256
261
  appearance: "primary",
257
262
  type: "submit",
@@ -364,7 +369,7 @@ const FeedbackForm = ({
364
369
  appearance: 'information'
365
370
  }, feedbackIsAnonymous))))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
366
371
  appearance: "subtle",
367
- onClick: onClose
372
+ onClick: handleCancel
368
373
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
369
374
  appearance: "primary",
370
375
  type: "submit",
@@ -155,7 +155,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
155
155
  }, {
156
156
  key: "getPackageVersion",
157
157
  value: function getPackageVersion() {
158
- return "15.2.1" || 'Unknown, at least 11.0.0';
158
+ return "15.3.0" || 'Unknown, at least 11.0.0';
159
159
  }
160
160
  }, {
161
161
  key: "getEntitlementInformation",
@@ -477,6 +477,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
477
477
  feedbackGroupLabels: this.props.feedbackGroupLabels,
478
478
  onSubmit: this.postFeedback,
479
479
  onClose: this.props.onClose,
480
+ onCancel: this.props.onCancel,
480
481
  locale: this.props.locale,
481
482
  anonymousFeedback: fg('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
482
483
  selectLabel: this.props.selectLabel,
@@ -40,6 +40,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
40
40
  showDefaultTextFields = _ref2$showDefaultText === void 0 ? true : _ref2$showDefaultText,
41
41
  customContent = _ref2.customContent,
42
42
  onClose = _ref2.onClose,
43
+ onCancel = _ref2.onCancel,
43
44
  onSubmit = _ref2.onSubmit,
44
45
  feedbackTitle = _ref2.feedbackTitle,
45
46
  feedbackTitleDetails = _ref2.feedbackTitleDetails,
@@ -90,6 +91,10 @@ var FeedbackForm = function FeedbackForm(_ref2) {
90
91
  var isTypeSelected = function isTypeSelected() {
91
92
  return type !== 'empty';
92
93
  };
94
+ var handleCancel = function handleCancel() {
95
+ onCancel === null || onCancel === void 0 || onCancel();
96
+ onClose();
97
+ };
93
98
  var canShowTextField = isTypeSelected() || !showTypeField;
94
99
  var hasDescription = description || hasDescriptionDefaultValue;
95
100
  var isDisabled = isSubmitting || disableSubmitButton;
@@ -309,7 +314,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
309
314
  }, feedbackIsAnonymous);
310
315
  })))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
311
316
  appearance: "subtle",
312
- onClick: onClose
317
+ onClick: handleCancel
313
318
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
314
319
  appearance: "primary",
315
320
  type: "submit",
@@ -449,7 +454,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
449
454
  }, feedbackIsAnonymous);
450
455
  })))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
451
456
  appearance: "subtle",
452
- onClick: onClose
457
+ onClick: handleCancel
453
458
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
454
459
  appearance: "primary",
455
460
  type: "submit",
@@ -88,6 +88,8 @@ export interface Props {
88
88
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
89
89
  /** Function that will be called to initiate the exit transition. */
90
90
  onClose: () => void;
91
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
92
+ onCancel?: () => void;
91
93
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
92
94
  onSubmit: (formFields: FormFields) => void;
93
95
  /** Locale for i18n */
@@ -29,6 +29,8 @@ interface Props {
29
29
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
30
30
  /** Function that will be called to initiate the exit transition. */
31
31
  onClose: () => void;
32
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
33
+ onCancel?: () => void;
32
34
  /** Function that will be called immediately after the submit action */
33
35
  onSubmit: (formValues: FormFields) => Promise<void>;
34
36
  /** Optional locale for i18n **/
@@ -88,6 +88,8 @@ export interface Props {
88
88
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
89
89
  /** Function that will be called to initiate the exit transition. */
90
90
  onClose: () => void;
91
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
92
+ onCancel?: () => void;
91
93
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
92
94
  onSubmit: (formFields: FormFields) => void;
93
95
  /** Locale for i18n */
@@ -29,6 +29,8 @@ interface Props {
29
29
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
30
30
  /** Function that will be called to initiate the exit transition. */
31
31
  onClose: () => void;
32
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
33
+ onCancel?: () => void;
32
34
  /** Function that will be called immediately after the submit action */
33
35
  onSubmit: (formValues: FormFields) => Promise<void>;
34
36
  /** Optional locale for i18n **/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "15.3.0",
3
+ "version": "15.4.0",
4
4
  "description": "A component that collects feedback across Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/section-message": "^8.13.0",
45
45
  "@atlaskit/select": "^21.12.0",
46
46
  "@atlaskit/textarea": "^8.3.0",
47
- "@atlaskit/tokens": "^13.1.0",
47
+ "@atlaskit/tokens": "^13.2.0",
48
48
  "@babel/runtime": "^7.0.0"
49
49
  },
50
50
  "peerDependencies": {