@atlaskit/feedback-collector 15.5.0 → 16.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/FeedbackButton/package.json +1 -8
  3. package/FeedbackFlag/package.json +1 -8
  4. package/FeedbackForm/package.json +1 -8
  5. package/dist/cjs/components/FeedbackCollector.js +1 -1
  6. package/dist/cjs/components/FeedbackForm.js +65 -96
  7. package/dist/es2019/components/FeedbackCollector.js +1 -1
  8. package/dist/es2019/components/FeedbackForm.js +73 -88
  9. package/dist/esm/components/FeedbackCollector.js +1 -1
  10. package/dist/esm/components/FeedbackForm.js +65 -96
  11. package/messages/package.json +1 -8
  12. package/package.json +15 -22
  13. package/types/package.json +1 -8
  14. package/dist/types-ts4.5/components/FeedbackButton.d.ts +0 -9
  15. package/dist/types-ts4.5/components/FeedbackCollector.d.ts +0 -198
  16. package/dist/types-ts4.5/components/FeedbackFlag.d.ts +0 -11
  17. package/dist/types-ts4.5/components/FeedbackForm.d.ts +0 -68
  18. package/dist/types-ts4.5/components/IntlProviderWithResolvedMessages.d.ts +0 -4
  19. package/dist/types-ts4.5/entry-points/FeedbackButton.d.ts +0 -1
  20. package/dist/types-ts4.5/entry-points/FeedbackFlag.d.ts +0 -1
  21. package/dist/types-ts4.5/entry-points/FeedbackForm.d.ts +0 -1
  22. package/dist/types-ts4.5/i18n/cs.d.ts +0 -8
  23. package/dist/types-ts4.5/i18n/da.d.ts +0 -8
  24. package/dist/types-ts4.5/i18n/de.d.ts +0 -8
  25. package/dist/types-ts4.5/i18n/en.d.ts +0 -8
  26. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -8
  27. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -8
  28. package/dist/types-ts4.5/i18n/es.d.ts +0 -8
  29. package/dist/types-ts4.5/i18n/fi.d.ts +0 -8
  30. package/dist/types-ts4.5/i18n/fr.d.ts +0 -8
  31. package/dist/types-ts4.5/i18n/hr.d.ts +0 -8
  32. package/dist/types-ts4.5/i18n/hu.d.ts +0 -8
  33. package/dist/types-ts4.5/i18n/index.d.ts +0 -1
  34. package/dist/types-ts4.5/i18n/it.d.ts +0 -8
  35. package/dist/types-ts4.5/i18n/ja.d.ts +0 -8
  36. package/dist/types-ts4.5/i18n/ko.d.ts +0 -8
  37. package/dist/types-ts4.5/i18n/nb.d.ts +0 -8
  38. package/dist/types-ts4.5/i18n/nl.d.ts +0 -8
  39. package/dist/types-ts4.5/i18n/pl.d.ts +0 -8
  40. package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -8
  41. package/dist/types-ts4.5/i18n/ru.d.ts +0 -8
  42. package/dist/types-ts4.5/i18n/sl.d.ts +0 -8
  43. package/dist/types-ts4.5/i18n/sr_RS.d.ts +0 -8
  44. package/dist/types-ts4.5/i18n/sr_YR.d.ts +0 -8
  45. package/dist/types-ts4.5/i18n/sv.d.ts +0 -8
  46. package/dist/types-ts4.5/i18n/th.d.ts +0 -8
  47. package/dist/types-ts4.5/i18n/tr.d.ts +0 -8
  48. package/dist/types-ts4.5/i18n/uk.d.ts +0 -8
  49. package/dist/types-ts4.5/i18n/vi.d.ts +0 -8
  50. package/dist/types-ts4.5/i18n/zh.d.ts +0 -8
  51. package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -8
  52. package/dist/types-ts4.5/index.d.ts +0 -7
  53. package/dist/types-ts4.5/messages.d.ts +0 -192
  54. package/dist/types-ts4.5/types.d.ts +0 -16
  55. package/dist/types-ts4.5/utils/Truncate.d.ts +0 -1
  56. package/dist/types-ts4.5/utils/i18n-get-messages-for-locale.d.ts +0 -11
  57. package/dist/types-ts4.5/utils/is-api-gateway-url.d.ts +0 -1
@@ -155,7 +155,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
155
155
  }, {
156
156
  key: "getPackageVersion",
157
157
  value: function getPackageVersion() {
158
- return "15.4.0" || 'Unknown, at least 11.0.0';
158
+ return "15.6.0" || 'Unknown, at least 11.0.0';
159
159
  }
160
160
  }, {
161
161
  key: "getEntitlementInformation",
@@ -1,13 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
5
  var _excluded = ["id"],
7
6
  _excluded2 = ["id"],
8
7
  _excluded3 = ["locale"];
9
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
9
  import React, { useRef, useState } from 'react';
13
10
  import { FormattedMessage, useIntl } from 'react-intl';
@@ -82,15 +79,20 @@ var FeedbackForm = function FeedbackForm(_ref2) {
82
79
  _useState0 = _slicedToArray(_useState9, 2),
83
80
  isSubmitting = _useState0[0],
84
81
  setIsSubmitting = _useState0[1];
85
- var _useState1 = useState({}),
86
- _useState10 = _slicedToArray(_useState1, 2),
87
- validationErrors = _useState10[0],
88
- setValidationErrors = _useState10[1];
89
82
  var _useIntl = useIntl(),
90
83
  formatMessage = _useIntl.formatMessage;
91
84
  var isTypeSelected = function isTypeSelected() {
92
85
  return type !== 'empty';
93
86
  };
87
+ var validateType = function validateType(value) {
88
+ return showTypeField && (!value || value === 'empty') ? formatMessage(messages.validationErrorTypeRequired) : undefined;
89
+ };
90
+ var validateDescription = function validateDescription(value) {
91
+ if (!showDefaultTextFields || hasDescriptionDefaultValue) {
92
+ return undefined;
93
+ }
94
+ return !value || !value.trim() ? formatMessage(messages.validationErrorDescriptionRequired) : undefined;
95
+ };
94
96
 
95
97
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
98
  var handleCancel = function handleCancel() {
@@ -103,22 +105,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
103
105
  onClose.apply(void 0, args);
104
106
  };
105
107
  var canShowTextField = isTypeSelected() || !showTypeField;
106
- var hasDescription = description || hasDescriptionDefaultValue;
107
108
  var isDisabled = isSubmitting || disableSubmitButton;
108
- var getValidationErrors = function getValidationErrors() {
109
- var errors = {};
110
-
111
- // Validate type selection if showTypeField is true
112
- if (showTypeField && !isTypeSelected()) {
113
- errors.type = formatMessage(messages.validationErrorTypeRequired);
114
- }
115
-
116
- // Validate description if showDefaultTextFields is true
117
- if (showDefaultTextFields && !hasDescription) {
118
- errors.description = formatMessage(messages.validationErrorDescriptionRequired);
119
- }
120
- return errors;
121
- };
122
109
  var getFieldLabels = function getFieldLabels(record) {
123
110
  var _record$bug, _record$comment, _record$suggestion, _record$question, _record$empty, _record$not_relevant, _record$not_accurate, _record$too_slow, _record$unhelpful_lin, _record$other;
124
111
  return {
@@ -191,60 +178,53 @@ var FeedbackForm = function FeedbackForm(_ref2) {
191
178
  shouldScrollInViewport: true
192
179
  }, fg('platform-design_system_team-form_conversion') ? /*#__PURE__*/React.createElement(Form, {
193
180
  onSubmit: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
194
- var errors;
195
181
  return _regeneratorRuntime.wrap(function (_context) {
196
182
  while (1) switch (_context.prev = _context.next) {
197
183
  case 0:
198
- errors = getValidationErrors();
199
- if (!(Object.keys(errors).length > 0)) {
200
- _context.next = 1;
201
- break;
202
- }
203
- setValidationErrors(errors);
204
- return _context.abrupt("return");
205
- case 1:
206
184
  setIsSubmitting(true);
207
- _context.prev = 2;
208
- _context.next = 3;
185
+ _context.prev = 1;
186
+ _context.next = 2;
209
187
  return onSubmit({
210
188
  canBeContacted: canBeContacted,
211
189
  description: description,
212
190
  enrollInResearchGroup: enrollInResearchGroup,
213
191
  type: type
214
192
  });
215
- case 3:
216
- _context.prev = 3;
193
+ case 2:
194
+ _context.prev = 2;
217
195
  setIsSubmitting(false);
218
- return _context.finish(3);
219
- case 4:
196
+ return _context.finish(2);
197
+ case 3:
220
198
  case "end":
221
199
  return _context.stop();
222
200
  }
223
- }, _callee, null, [[2,, 3, 4]]);
201
+ }, _callee, null, [[1,, 2, 3]]);
224
202
  }))
225
203
  }, /*#__PURE__*/React.createElement(ModalHeader, {
226
204
  hasCloseButton: true
227
205
  }, /*#__PURE__*/React.createElement(ModalTitle, null, feedbackTitle || /*#__PURE__*/React.createElement(FormattedMessage, messages.feedbackTitle))), /*#__PURE__*/React.createElement(ModalBody, null, fg('ak_feedback_collector_hide_required_summary') ? showRequiredFieldsSummary && requiredFieldsSummary : requiredFieldsSummary, feedbackTitleDetails, customContent, showTypeField ? /*#__PURE__*/React.createElement(Field, {
228
206
  name: "topic",
207
+ id: "topic",
229
208
  label: selectLabel || formatMessage(messages.selectionOptionDefaultLabel),
230
- isRequired: true
209
+ isRequired: true,
210
+ validate: validateType
231
211
  }, function (_ref4) {
212
+ var _selectOptions$find;
232
213
  var _ref4$fieldProps = _ref4.fieldProps,
233
214
  id = _ref4$fieldProps.id,
234
- restProps = _objectWithoutProperties(_ref4$fieldProps, _excluded);
215
+ restProps = _objectWithoutProperties(_ref4$fieldProps, _excluded),
216
+ error = _ref4.error;
235
217
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, _extends({}, restProps, {
218
+ value: (_selectOptions$find = selectOptions.find(function (opt) {
219
+ return opt.value === type;
220
+ })) !== null && _selectOptions$find !== void 0 ? _selectOptions$find : null,
236
221
  onChange: function onChange(option) {
222
+ var _restProps$onChange;
237
223
  if (!option || option instanceof Array) {
238
224
  return;
239
225
  }
240
226
  setType(option.value);
241
- if (validationErrors.type) {
242
- setValidationErrors(function (prev) {
243
- return _objectSpread(_objectSpread({}, prev), {}, {
244
- type: undefined
245
- });
246
- });
247
- }
227
+ (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 || _restProps$onChange.call(restProps, option.value);
248
228
  },
249
229
  menuPosition: "fixed",
250
230
  options: selectOptions
@@ -252,30 +232,28 @@ var FeedbackForm = function FeedbackForm(_ref2) {
252
232
  ,
253
233
  ref: focusRef,
254
234
  placeholder: getDefaultPlaceholder(feedbackGroupLabels),
255
- inputId: id
256
- })), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type));
235
+ inputId: id,
236
+ isInvalid: !!error
237
+ })), error && /*#__PURE__*/React.createElement(ErrorMessage, null, error));
257
238
  }) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
258
239
  label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
259
240
  isRequired: true,
260
- name: "description"
241
+ name: "description",
242
+ id: "description",
243
+ validate: validateDescription
261
244
  }, function (_ref5) {
262
- var fieldProps = _ref5.fieldProps;
245
+ var fieldProps = _ref5.fieldProps,
246
+ error = _ref5.error;
263
247
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea, _extends({}, fieldProps, {
264
248
  name: "foo",
265
249
  minimumRows: 6,
266
250
  placeholder: summaryPlaceholder || undefined,
267
251
  onChange: function onChange(e) {
268
252
  setDescription(e.target.value);
269
- if (validationErrors.description) {
270
- setValidationErrors(function (prev) {
271
- return _objectSpread(_objectSpread({}, prev), {}, {
272
- description: undefined
273
- });
274
- });
275
- }
253
+ fieldProps.onChange(e.target.value);
276
254
  },
277
255
  value: description
278
- })), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description));
256
+ })), error && /*#__PURE__*/React.createElement(ErrorMessage, null, error));
279
257
  }), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", null, /*#__PURE__*/React.createElement(FormattedMessage, messages.optInOptionsLegend)), /*#__PURE__*/React.createElement(Field, {
280
258
  name: "can-be-contacted"
281
259
  }, function (_ref6) {
@@ -329,36 +307,27 @@ var FeedbackForm = function FeedbackForm(_ref2) {
329
307
  testId: "feedbackCollectorSubmitBtn"
330
308
  }, submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.submitButtonLabel)))) : /*#__PURE__*/React.createElement(Form, {
331
309
  onSubmit: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
332
- var errors;
333
310
  return _regeneratorRuntime.wrap(function (_context2) {
334
311
  while (1) switch (_context2.prev = _context2.next) {
335
312
  case 0:
336
- errors = getValidationErrors();
337
- if (!(Object.keys(errors).length > 0)) {
338
- _context2.next = 1;
339
- break;
340
- }
341
- setValidationErrors(errors);
342
- return _context2.abrupt("return");
343
- case 1:
344
313
  setIsSubmitting(true);
345
- _context2.prev = 2;
346
- _context2.next = 3;
314
+ _context2.prev = 1;
315
+ _context2.next = 2;
347
316
  return onSubmit({
348
317
  canBeContacted: canBeContacted,
349
318
  description: description,
350
319
  enrollInResearchGroup: enrollInResearchGroup,
351
320
  type: type
352
321
  });
353
- case 3:
354
- _context2.prev = 3;
322
+ case 2:
323
+ _context2.prev = 2;
355
324
  setIsSubmitting(false);
356
- return _context2.finish(3);
357
- case 4:
325
+ return _context2.finish(2);
326
+ case 3:
358
327
  case "end":
359
328
  return _context2.stop();
360
329
  }
361
- }, _callee2, null, [[2,, 3, 4]]);
330
+ }, _callee2, null, [[1,, 2, 3]]);
362
331
  }))
363
332
  }, function (_ref9) {
364
333
  var formProps = _ref9.formProps;
@@ -366,25 +335,27 @@ var FeedbackForm = function FeedbackForm(_ref2) {
366
335
  hasCloseButton: true
367
336
  }, /*#__PURE__*/React.createElement(ModalTitle, null, feedbackTitle || /*#__PURE__*/React.createElement(FormattedMessage, messages.feedbackTitle))), /*#__PURE__*/React.createElement(ModalBody, null, fg('ak_feedback_collector_hide_required_summary') ? showRequiredFieldsSummary && requiredFieldsSummary : requiredFieldsSummary, feedbackTitleDetails, customContent, showTypeField ? /*#__PURE__*/React.createElement(Field, {
368
337
  name: "topic",
338
+ id: "topic",
369
339
  label: selectLabel || formatMessage(messages.selectionOptionDefaultLabel),
370
- isRequired: true
340
+ isRequired: true,
341
+ validate: validateType
371
342
  }, function (_ref0) {
343
+ var _selectOptions$find2;
372
344
  var _ref0$fieldProps = _ref0.fieldProps,
373
345
  id = _ref0$fieldProps.id,
374
- restProps = _objectWithoutProperties(_ref0$fieldProps, _excluded2);
346
+ restProps = _objectWithoutProperties(_ref0$fieldProps, _excluded2),
347
+ error = _ref0.error;
375
348
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, _extends({}, restProps, {
349
+ value: (_selectOptions$find2 = selectOptions.find(function (opt) {
350
+ return opt.value === type;
351
+ })) !== null && _selectOptions$find2 !== void 0 ? _selectOptions$find2 : null,
376
352
  onChange: function onChange(option) {
353
+ var _restProps$onChange2;
377
354
  if (!option || option instanceof Array) {
378
355
  return;
379
356
  }
380
357
  setType(option.value);
381
- if (validationErrors.type) {
382
- setValidationErrors(function (prev) {
383
- return _objectSpread(_objectSpread({}, prev), {}, {
384
- type: undefined
385
- });
386
- });
387
- }
358
+ (_restProps$onChange2 = restProps.onChange) === null || _restProps$onChange2 === void 0 || _restProps$onChange2.call(restProps, option.value);
388
359
  },
389
360
  menuPosition: "fixed",
390
361
  options: selectOptions
@@ -392,30 +363,28 @@ var FeedbackForm = function FeedbackForm(_ref2) {
392
363
  ,
393
364
  ref: focusRef,
394
365
  placeholder: getDefaultPlaceholder(feedbackGroupLabels),
395
- inputId: id
396
- })), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type));
366
+ inputId: id,
367
+ isInvalid: !!error
368
+ })), error && /*#__PURE__*/React.createElement(ErrorMessage, null, error));
397
369
  }) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
398
370
  label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
399
371
  isRequired: true,
400
- name: "description"
372
+ name: "description",
373
+ id: "description",
374
+ validate: validateDescription
401
375
  }, function (_ref1) {
402
- var fieldProps = _ref1.fieldProps;
376
+ var fieldProps = _ref1.fieldProps,
377
+ error = _ref1.error;
403
378
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea, _extends({}, fieldProps, {
404
379
  name: "foo",
405
380
  minimumRows: 6,
406
381
  placeholder: summaryPlaceholder || undefined,
407
382
  onChange: function onChange(e) {
408
383
  setDescription(e.target.value);
409
- if (validationErrors.description) {
410
- setValidationErrors(function (prev) {
411
- return _objectSpread(_objectSpread({}, prev), {}, {
412
- description: undefined
413
- });
414
- });
415
- }
384
+ fieldProps.onChange(e.target.value);
416
385
  },
417
386
  value: description
418
- })), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description));
387
+ })), error && /*#__PURE__*/React.createElement(ErrorMessage, null, error));
419
388
  }), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", null, /*#__PURE__*/React.createElement(FormattedMessage, messages.optInOptionsLegend)), /*#__PURE__*/React.createElement(Field, {
420
389
  name: "can-be-contacted"
421
390
  }, function (_ref10) {
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/messages.js",
5
5
  "module:es2019": "../dist/es2019/messages.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/messages.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/messages.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/messages.d.ts"
15
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "15.5.0",
3
+ "version": "16.0.0",
4
4
  "description": "A component that collects feedback across Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,18 +12,10 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.5 <4.9": {
17
- "*": [
18
- "dist/types-ts4.5/*",
19
- "dist/types-ts4.5/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.ts",
25
17
  "atlassian": {
26
- "team": "Belugas: Feedback Collector",
18
+ "team": "Cloud Readiness: Otter",
27
19
  "website": {
28
20
  "name": "Feedback Collector"
29
21
  }
@@ -33,18 +25,19 @@
33
25
  },
34
26
  "dependencies": {
35
27
  "@atlaskit/afm-i18n-platform-web-platform-feedback-collector": "2.96.0",
36
- "@atlaskit/button": "^23.11.0",
37
- "@atlaskit/checkbox": "^17.3.0",
38
- "@atlaskit/flag": "^17.12.0",
39
- "@atlaskit/form": "^15.5.0",
40
- "@atlaskit/icon": "^35.4.0",
41
- "@atlaskit/link": "^3.4.0",
42
- "@atlaskit/modal-dialog": "^15.2.0",
43
- "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/section-message": "^8.13.0",
45
- "@atlaskit/select": "^21.12.0",
46
- "@atlaskit/textarea": "^8.3.0",
47
- "@atlaskit/tokens": "^13.3.0",
28
+ "@atlaskit/button": "^24.0.0",
29
+ "@atlaskit/checkbox": "^18.0.0",
30
+ "@atlaskit/flag": "^18.0.0",
31
+ "@atlaskit/form": "^16.0.0",
32
+ "@atlaskit/icon": "^36.0.0",
33
+ "@atlaskit/link": "^4.0.0",
34
+ "@atlaskit/modal-dialog": "^16.0.0",
35
+ "@atlaskit/platform-feature-flags": "^2.0.0",
36
+ "@atlaskit/section-message": "^9.0.0",
37
+ "@atlaskit/select": "^22.0.0",
38
+ "@atlaskit/textarea": "^9.0.0",
39
+ "@atlaskit/tokens": "^14.0.0",
40
+ "@atlaskit/visually-hidden": "^4.0.0",
48
41
  "@babel/runtime": "^7.0.0"
49
42
  },
50
43
  "peerDependencies": {
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/types.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/types.d.ts"
15
8
  }
@@ -1,9 +0,0 @@
1
- import React, { type PropsWithChildren } from 'react';
2
- type Props = PropsWithChildren<{
3
- entrypointId: string;
4
- atlassianAccountId?: string;
5
- shouldGetEntitlementDetails?: boolean;
6
- locale: string;
7
- }>;
8
- declare const FeedbackButtonWithIntl: (props: Props) => React.JSX.Element;
9
- export default FeedbackButtonWithIntl;
@@ -1,198 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { type FormFields, type SelectOptionDetails, type SelectValue } from '../types';
3
- import { type OptionType } from './FeedbackForm';
4
- type FieldValueType = string | Object | Object[];
5
- export type FieldType = {
6
- id: string;
7
- value: FieldValueType;
8
- };
9
- type FeedbackType = {
10
- fields: FieldType[];
11
- };
12
- export interface Props {
13
- /** Override the URL for all HTTPS calls, only needed if service is not behind stargate (like the Atlaskit frontend itself) */
14
- url?: string;
15
- /** A custom URL for the Stargate gateway, this field takes priority over `url` */
16
- customGatewayUrl?: string;
17
- /** A custom URL for the Feedback Collector API, this field takes priority over `url` */
18
- customFeedbackUrl?: string;
19
- /** Whether to request email details and product entitlements */
20
- shouldGetEntitlementDetails?: boolean;
21
- /** The customer name */
22
- name?: string;
23
- /** The id of the entrypoint in the feedback service; to acquire your entrypointId, visit the #feedback-collectors channel */
24
- entrypointId: string;
25
- /** Additional fields to send to the widget service **/
26
- additionalFields: FieldType[];
27
- /** Override the default id for the "can be contacted" custom field in your widget service **/
28
- canBeContactedFieldId: string;
29
- /** Override the agree value for the "can be contacted" custom field in your widget service */
30
- canBeContactedAgreeValue: FieldValueType;
31
- /** Override the decline value for the "can be contacted" custom field in your widget service */
32
- canBeContactedDeclineValue: FieldValueType;
33
- /** Override the default id for the "customer name" custom field in your widget service */
34
- customerNameFieldId: string;
35
- /** Override the default value for the "customer name" custom field in your widget service */
36
- customerNameDefaultValue: FieldValueType;
37
- /** Override the default id for the "description" custom field in your widget service */
38
- descriptionFieldId: string;
39
- /** Override the default value for the "description" custom field in your widget service */
40
- descriptionDefaultValue: FieldValueType;
41
- /** Override the default id for the "enroll in research" custom field in your widget service */
42
- enrollInResearchFieldId: string;
43
- /** Override the agree value for the "enroll in research" custom field in your widget service */
44
- enrollInResearchAgreeValue: FieldValueType;
45
- /** Override the decline value for the "enroll in research" custom field in your widget service */
46
- enrollInResearchDeclineValue: FieldValueType;
47
- /** Override the default id for the "summary" custom field in your widget service */
48
- summaryFieldId: string;
49
- /** Override the default value for the "summary" custom field in your widget service */
50
- summaryDefaultValue: FieldValueType;
51
- /** Number of characters that the "summary" field accepts, the rest will be truncated */
52
- summaryTruncateLength: number;
53
- /** After this delay the onSubmit callback will be triggered optimistically */
54
- timeoutOnSubmit: number;
55
- /** Override the default id for the "type" custom field in your widget service */
56
- typeFieldId: string;
57
- /** Override the default value for the "Bug" type of response in your widget service */
58
- typeBugDefaultValue: FieldValueType;
59
- /** Override the default value for the "Comment" type of response in your widget service */
60
- typeCommentDefaultValue: FieldValueType;
61
- /** Override the default value for the "Suggestion" type of response in your widget service */
62
- typeSuggestionDefaultValue: FieldValueType;
63
- /** Override the default value for the "Question" type of response in your widget service */
64
- typeQuestionDefaultValue: FieldValueType;
65
- /** Override the default value for the "Empty" type of response in your widget service */
66
- typeEmptyDefaultValue: FieldValueType;
67
- /** Override to hide the feedback type select drop down for the feedback */
68
- showTypeField: boolean;
69
- /** Message which will be shown as the title of the feedback dialog */
70
- feedbackTitle?: React.ReactText;
71
- /** Message which will be shown below the title of the feedback dialog */
72
- feedbackTitleDetails?: React.ReactChild;
73
- /** Message which will be shown next to the enrol in research checkbox */
74
- enrolInResearchLabel?: React.ReactChild;
75
- /** Message which will be shown below the enrol in research checkbox */
76
- enrolInResearchLink?: React.ReactChild;
77
- /** Message which will be shown next to the can be contacted checkbox */
78
- canBeContactedLabel?: React.ReactChild;
79
- /** Link which will be shown below the can be contacted checkbox */
80
- canBeContactedLink?: React.ReactNode;
81
- /** Message which will be shown inside the summary text field */
82
- summaryPlaceholder?: string;
83
- /** Message for submit button label */
84
- submitButtonLabel?: string;
85
- /** Message for cancel button label */
86
- cancelButtonLabel?: string;
87
- /** Message for select option labels and field labels */
88
- feedbackGroupLabels?: Partial<Record<SelectValue, SelectOptionDetails>>;
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;
99
- /** Function that will be called optimistically after a delay when the feedback is submitted. */
100
- onSubmit: (formFields: FormFields) => void;
101
- /** Locale for i18n */
102
- locale: string;
103
- /** Optional custom modal content */
104
- customContent?: React.ReactChild;
105
- /** Override to hide the default text fields for feedback */
106
- showDefaultTextFields?: boolean;
107
- /** Optional parameter for feedback submitter's Atlassian Account ID */
108
- atlassianAccountId?: string;
109
- /** Optional parameter for feedback submitter's email address */
110
- email?: string;
111
- /** Override to mark feedback as anonymous */
112
- anonymousFeedback?: boolean;
113
- /** Optional custom label for select field */
114
- selectLabel?: string;
115
- /** Optional custom label for TextArea when showTypeField is false*/
116
- customTextAreaLabel?: string;
117
- /** Custom Select feedback options */
118
- customFeedbackOptions?: OptionType[];
119
- /** Optional ref to return focus to after feedback form is closed */
120
- shouldReturnFocusRef?: React.RefObject<HTMLElement>;
121
- /** Disable submit button to allow custom content to handle validation */
122
- disableSubmitButton?: boolean;
123
- /** Optional to show or hide the required fields summary */
124
- showRequiredFieldsSummary?: boolean;
125
- }
126
- export default class FeedbackCollector extends Component<Props> {
127
- state: {
128
- anonymousFeedback: boolean;
129
- };
130
- componentDidMount(): Promise<void>;
131
- static defaultProps: {
132
- locale: string;
133
- url: string;
134
- shouldGetEntitlementDetails: boolean;
135
- canBeContactedFieldId: string;
136
- canBeContactedAgreeValue: {
137
- id: string;
138
- }[];
139
- canBeContactedDeclineValue: {
140
- id: string;
141
- }[];
142
- additionalFields: never[];
143
- customerNameFieldId: string;
144
- customerNameDefaultValue: string;
145
- descriptionFieldId: string;
146
- descriptionDefaultValue: string;
147
- enrollInResearchFieldId: string;
148
- enrollInResearchAgreeValue: {
149
- id: string;
150
- }[];
151
- enrollInResearchDeclineValue: {
152
- id: string;
153
- }[];
154
- summaryFieldId: string;
155
- summaryDefaultValue: string;
156
- summaryTruncateLength: number;
157
- timeoutOnSubmit: number;
158
- typeFieldId: string;
159
- typeBugDefaultValue: {
160
- id: string;
161
- };
162
- typeCommentDefaultValue: {
163
- id: string;
164
- };
165
- typeSuggestionDefaultValue: {
166
- id: string;
167
- };
168
- typeQuestionDefaultValue: {
169
- id: string;
170
- };
171
- typeEmptyDefaultValue: {
172
- id: string;
173
- };
174
- showTypeField: boolean;
175
- showDefaultTextFields: boolean;
176
- anonymousFeedback: boolean;
177
- onClose: (...args: any[]) => void;
178
- onSubmit: () => void;
179
- };
180
- getGatewayUrl(): string;
181
- getFeedbackUrl(): string;
182
- getPackageVersion(): string;
183
- getEntitlementInformation(): Promise<FieldType[] | [
184
- ]>;
185
- getTypeFieldValue(dtype: SelectValue): FieldValueType;
186
- getAtlassianID(): Promise<string | undefined>;
187
- shouldShowOptInCheckboxes(): boolean;
188
- shouldShowOptInCheckboxesNew(): Promise<boolean>;
189
- getDescription(formValues: FormFields): FieldValueType;
190
- getSummary(formValues: FormFields): FieldValueType;
191
- getCustomerName(): FieldValueType;
192
- addEmailToContext(): void;
193
- addAccountIdToContext(atlassianID: string | undefined): void;
194
- mapFormToJSD(formValues: FormFields): Promise<FeedbackType>;
195
- postFeedback: (formValues: FormFields) => Promise<void>;
196
- render(): React.JSX.Element;
197
- }
198
- export {};
@@ -1,11 +0,0 @@
1
- import React, { type FunctionComponent } 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 FeedbackFlagWithIntl: FunctionComponent<AkProps & {
9
- locale?: string;
10
- }>;
11
- export default FeedbackFlagWithIntl;