@atlaskit/feedback-collector 15.4.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,12 @@
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
+
3
10
  ## 15.4.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.3.0" || '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",
@@ -100,9 +100,16 @@ var FeedbackForm = function FeedbackForm(_ref2) {
100
100
  var isTypeSelected = function isTypeSelected() {
101
101
  return type !== 'empty';
102
102
  };
103
+
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
105
  var handleCancel = function handleCancel() {
104
- onCancel === null || onCancel === void 0 || onCancel();
105
- onClose();
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);
106
113
  };
107
114
  var canShowTextField = isTypeSelected() || !showTypeField;
108
115
  var hasDescription = description || hasDescriptionDefaultValue;
@@ -92,7 +92,7 @@ export default class FeedbackCollector extends Component {
92
92
  return FeedbackCollector.defaultProps.url;
93
93
  }
94
94
  getPackageVersion() {
95
- return "15.3.0" || '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;
@@ -60,9 +60,13 @@ const FeedbackForm = ({
60
60
  formatMessage
61
61
  } = useIntl();
62
62
  const isTypeSelected = () => type !== 'empty';
63
- const handleCancel = () => {
64
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
65
- onClose();
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);
66
70
  };
67
71
  const canShowTextField = isTypeSelected() || !showTypeField;
68
72
  const hasDescription = description || hasDescriptionDefaultValue;
@@ -155,7 +155,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
155
155
  }, {
156
156
  key: "getPackageVersion",
157
157
  value: function getPackageVersion() {
158
- return "15.3.0" || '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",
@@ -91,9 +91,16 @@ var FeedbackForm = function FeedbackForm(_ref2) {
91
91
  var isTypeSelected = function isTypeSelected() {
92
92
  return type !== 'empty';
93
93
  };
94
+
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
96
  var handleCancel = function handleCancel() {
95
- onCancel === null || onCancel === void 0 || onCancel();
96
- onClose();
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);
97
104
  };
98
105
  var canShowTextField = isTypeSelected() || !showTypeField;
99
106
  var hasDescription = description || hasDescriptionDefaultValue;
@@ -86,10 +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;
91
97
  /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
92
- onCancel?: () => void;
98
+ onCancel?: (...args: any[]) => void;
93
99
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
94
100
  onSubmit: (formFields: FormFields) => void;
95
101
  /** Locale for i18n */
@@ -168,7 +174,7 @@ export default class FeedbackCollector extends Component<Props> {
168
174
  showTypeField: boolean;
169
175
  showDefaultTextFields: boolean;
170
176
  anonymousFeedback: boolean;
171
- onClose: () => void;
177
+ onClose: (...args: any[]) => void;
172
178
  onSubmit: () => void;
173
179
  };
174
180
  getGatewayUrl(): string;
@@ -27,10 +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;
32
38
  /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
33
- onCancel?: () => void;
39
+ onCancel?: (...args: any[]) => void;
34
40
  /** Function that will be called immediately after the submit action */
35
41
  onSubmit: (formValues: FormFields) => Promise<void>;
36
42
  /** Optional locale for i18n **/
@@ -86,10 +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;
91
97
  /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
92
- onCancel?: () => void;
98
+ onCancel?: (...args: any[]) => void;
93
99
  /** Function that will be called optimistically after a delay when the feedback is submitted. */
94
100
  onSubmit: (formFields: FormFields) => void;
95
101
  /** Locale for i18n */
@@ -168,7 +174,7 @@ export default class FeedbackCollector extends Component<Props> {
168
174
  showTypeField: boolean;
169
175
  showDefaultTextFields: boolean;
170
176
  anonymousFeedback: boolean;
171
- onClose: () => void;
177
+ onClose: (...args: any[]) => void;
172
178
  onSubmit: () => void;
173
179
  };
174
180
  getGatewayUrl(): string;
@@ -27,10 +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;
32
38
  /** Optional function that will be called when the cancel button is clicked, in addition to onClose. */
33
- onCancel?: () => void;
39
+ onCancel?: (...args: any[]) => void;
34
40
  /** Function that will be called immediately after the submit action */
35
41
  onSubmit: (formValues: FormFields) => Promise<void>;
36
42
  /** Optional locale for i18n **/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "15.4.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.2.0",
47
+ "@atlaskit/tokens": "^13.3.0",
48
48
  "@babel/runtime": "^7.0.0"
49
49
  },
50
50
  "peerDependencies": {