@atlaskit/feedback-collector 15.3.0 → 15.5.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,19 @@
1
1
  # @atlaskit/feedback-collector
2
2
 
3
+ ## 15.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7bbde375a3b30`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7bbde375a3b30) -
8
+ Add onCancel callback to FeedbackCollector and FeedbackForm
9
+
10
+ ## 15.4.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`4cffc70fa1cfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4cffc70fa1cfe) -
15
+ Add onCancel callback to FeedbackCollector and FeedbackForm
16
+
3
17
  ## 15.3.0
4
18
 
5
19
  ### 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.4.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,17 @@ var FeedbackForm = function FeedbackForm(_ref2) {
99
100
  var isTypeSelected = function isTypeSelected() {
100
101
  return type !== 'empty';
101
102
  };
103
+
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
+ var handleCancel = function handleCancel() {
106
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
107
+ args[_key] = arguments[_key];
108
+ }
109
+ onCancel === null || onCancel === void 0 || onCancel.apply(void 0, args);
110
+ // Forward every arg the click handler received so consumers retain the full
111
+ // pre-change runtime contract (originating event + Atlaskit UI analytics event).
112
+ onClose.apply(void 0, args);
113
+ };
102
114
  var canShowTextField = isTypeSelected() || !showTypeField;
103
115
  var hasDescription = description || hasDescriptionDefaultValue;
104
116
  var isDisabled = isSubmitting || disableSubmitButton;
@@ -318,7 +330,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
318
330
  }, feedbackIsAnonymous);
319
331
  })))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_standardButton.default, {
320
332
  appearance: "subtle",
321
- onClick: onClose
333
+ onClick: handleCancel
322
334
  }, cancelButtonLabel || /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _messages.messages.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(_standardButton.default, {
323
335
  appearance: "primary",
324
336
  type: "submit",
@@ -458,7 +470,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
458
470
  }, feedbackIsAnonymous);
459
471
  })))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_standardButton.default, {
460
472
  appearance: "subtle",
461
- onClick: onClose
473
+ onClick: handleCancel
462
474
  }, cancelButtonLabel || /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _messages.messages.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(_standardButton.default, {
463
475
  appearance: "primary",
464
476
  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.4.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,14 @@ const FeedbackForm = ({
59
60
  formatMessage
60
61
  } = useIntl();
61
62
  const isTypeSelected = () => type !== 'empty';
63
+
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ const handleCancel = (...args) => {
66
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel(...args);
67
+ // Forward every arg the click handler received so consumers retain the full
68
+ // pre-change runtime contract (originating event + Atlaskit UI analytics event).
69
+ onClose(...args);
70
+ };
62
71
  const canShowTextField = isTypeSelected() || !showTypeField;
63
72
  const hasDescription = description || hasDescriptionDefaultValue;
64
73
  const isDisabled = isSubmitting || disableSubmitButton;
@@ -251,7 +260,7 @@ const FeedbackForm = ({
251
260
  appearance: 'information'
252
261
  }, feedbackIsAnonymous))))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
253
262
  appearance: "subtle",
254
- onClick: onClose
263
+ onClick: handleCancel
255
264
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
256
265
  appearance: "primary",
257
266
  type: "submit",
@@ -364,7 +373,7 @@ const FeedbackForm = ({
364
373
  appearance: 'information'
365
374
  }, feedbackIsAnonymous))))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
366
375
  appearance: "subtle",
367
- onClick: onClose
376
+ onClick: handleCancel
368
377
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
369
378
  appearance: "primary",
370
379
  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.4.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,17 @@ var FeedbackForm = function FeedbackForm(_ref2) {
90
91
  var isTypeSelected = function isTypeSelected() {
91
92
  return type !== 'empty';
92
93
  };
94
+
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ var handleCancel = function handleCancel() {
97
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
98
+ args[_key] = arguments[_key];
99
+ }
100
+ onCancel === null || onCancel === void 0 || onCancel.apply(void 0, args);
101
+ // Forward every arg the click handler received so consumers retain the full
102
+ // pre-change runtime contract (originating event + Atlaskit UI analytics event).
103
+ onClose.apply(void 0, args);
104
+ };
93
105
  var canShowTextField = isTypeSelected() || !showTypeField;
94
106
  var hasDescription = description || hasDescriptionDefaultValue;
95
107
  var isDisabled = isSubmitting || disableSubmitButton;
@@ -309,7 +321,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
309
321
  }, feedbackIsAnonymous);
310
322
  })))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
311
323
  appearance: "subtle",
312
- onClick: onClose
324
+ onClick: handleCancel
313
325
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
314
326
  appearance: "primary",
315
327
  type: "submit",
@@ -449,7 +461,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
449
461
  }, feedbackIsAnonymous);
450
462
  })))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
451
463
  appearance: "subtle",
452
- onClick: onClose
464
+ onClick: handleCancel
453
465
  }, cancelButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
454
466
  appearance: "primary",
455
467
  type: "submit",
@@ -86,8 +86,16 @@ export interface Props {
86
86
  cancelButtonLabel?: string;
87
87
  /** Message for select option labels and field labels */
88
88
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
89
- /** Function that will be called to initiate the exit transition. */
90
- onClose: () => void;
89
+ /**
90
+ * Function that will be called to initiate the exit transition.
91
+ * When triggered by the cancel button the originating event and Atlaskit UI analytics
92
+ * event are forwarded; programmatic close paths (e.g. after submit) invoke it with no
93
+ * arguments. Typed as a variadic `any[]` to maximise backward compatibility with
94
+ * consumers that declared any conceivable signature for this callback.
95
+ */
96
+ onClose: (...args: any[]) => void;
97
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
98
+ onCancel?: (...args: any[]) => void;
91
99
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
92
100
  onSubmit: (formFields: FormFields) => void;
93
101
  /** Locale for i18n */
@@ -166,7 +174,7 @@ export default class FeedbackCollector extends Component<Props> {
166
174
  showTypeField: boolean;
167
175
  showDefaultTextFields: boolean;
168
176
  anonymousFeedback: boolean;
169
- onClose: () => void;
177
+ onClose: (...args: any[]) => void;
170
178
  onSubmit: () => void;
171
179
  };
172
180
  getGatewayUrl(): string;
@@ -27,8 +27,16 @@ interface Props {
27
27
  cancelButtonLabel?: string;
28
28
  /** Message for select option labels and field labels **/
29
29
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
30
- /** Function that will be called to initiate the exit transition. */
31
- onClose: () => void;
30
+ /**
31
+ * Function that will be called to initiate the exit transition.
32
+ * When triggered by the cancel button the originating event and Atlaskit UI analytics
33
+ * event are forwarded; programmatic close paths (e.g. after submit) invoke it with no
34
+ * arguments. Typed as a variadic `any[]` to maximise backward compatibility with
35
+ * consumers that declared any conceivable signature for this callback.
36
+ */
37
+ onClose: (...args: any[]) => void;
38
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
39
+ onCancel?: (...args: any[]) => void;
32
40
  /** Function that will be called immediately after the submit action */
33
41
  onSubmit: (formValues: FormFields) => Promise<void>;
34
42
  /** Optional locale for i18n **/
@@ -86,8 +86,16 @@ export interface Props {
86
86
  cancelButtonLabel?: string;
87
87
  /** Message for select option labels and field labels */
88
88
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
89
- /** Function that will be called to initiate the exit transition. */
90
- onClose: () => void;
89
+ /**
90
+ * Function that will be called to initiate the exit transition.
91
+ * When triggered by the cancel button the originating event and Atlaskit UI analytics
92
+ * event are forwarded; programmatic close paths (e.g. after submit) invoke it with no
93
+ * arguments. Typed as a variadic `any[]` to maximise backward compatibility with
94
+ * consumers that declared any conceivable signature for this callback.
95
+ */
96
+ onClose: (...args: any[]) => void;
97
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
98
+ onCancel?: (...args: any[]) => void;
91
99
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
92
100
  onSubmit: (formFields: FormFields) => void;
93
101
  /** Locale for i18n */
@@ -166,7 +174,7 @@ export default class FeedbackCollector extends Component<Props> {
166
174
  showTypeField: boolean;
167
175
  showDefaultTextFields: boolean;
168
176
  anonymousFeedback: boolean;
169
- onClose: () => void;
177
+ onClose: (...args: any[]) => void;
170
178
  onSubmit: () => void;
171
179
  };
172
180
  getGatewayUrl(): string;
@@ -27,8 +27,16 @@ interface Props {
27
27
  cancelButtonLabel?: string;
28
28
  /** Message for select option labels and field labels **/
29
29
  feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
30
- /** Function that will be called to initiate the exit transition. */
31
- onClose: () => void;
30
+ /**
31
+ * Function that will be called to initiate the exit transition.
32
+ * When triggered by the cancel button the originating event and Atlaskit UI analytics
33
+ * event are forwarded; programmatic close paths (e.g. after submit) invoke it with no
34
+ * arguments. Typed as a variadic `any[]` to maximise backward compatibility with
35
+ * consumers that declared any conceivable signature for this callback.
36
+ */
37
+ onClose: (...args: any[]) => void;
38
+ /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
39
+ onCancel?: (...args: any[]) => void;
32
40
  /** Function that will be called immediately after the submit action */
33
41
  onSubmit: (formValues: FormFields) => Promise<void>;
34
42
  /** 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.5.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.3.0",
48
48
  "@babel/runtime": "^7.0.0"
49
49
  },
50
50
  "peerDependencies": {