@atlaskit/feedback-collector 14.6.19 → 14.6.21
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 +14 -0
- package/dist/cjs/components/FeedbackCollector.js +1 -1
- package/dist/cjs/components/FeedbackFlag.js +1 -2
- package/dist/cjs/components/FeedbackForm.js +30 -52
- package/dist/es2019/components/FeedbackCollector.js +1 -1
- package/dist/es2019/components/FeedbackFlag.js +1 -2
- package/dist/es2019/components/FeedbackForm.js +18 -42
- package/dist/esm/components/FeedbackCollector.js +1 -1
- package/dist/esm/components/FeedbackFlag.js +1 -2
- package/dist/esm/components/FeedbackForm.js +30 -52
- package/package.json +7 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/feedback-collector
|
|
2
2
|
|
|
3
|
+
## 14.6.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8f1a80e10b1d7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8f1a80e10b1d7) -
|
|
8
|
+
Internal changes to remove unnecessary token fallbacks and imports from `@atlaskit/theme`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 14.6.20
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 14.6.19
|
|
4
18
|
|
|
5
19
|
### Patch 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 "
|
|
167
|
+
return "0.0.0-development" || 'Unknown, at least 11.0.0';
|
|
168
168
|
}
|
|
169
169
|
}, {
|
|
170
170
|
key: "getEntitlementInformation",
|
|
@@ -10,7 +10,6 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
10
10
|
var _flag = require("@atlaskit/flag");
|
|
11
11
|
var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-success"));
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
14
13
|
var _messages = require("../messages");
|
|
15
14
|
var _IntlProviderWithResolvedMessages = require("./IntlProviderWithResolvedMessages");
|
|
16
15
|
var FeedbackFlag = function FeedbackFlag(_ref) {
|
|
@@ -21,7 +20,7 @@ var FeedbackFlag = function FeedbackFlag(_ref) {
|
|
|
21
20
|
return /*#__PURE__*/_react.default.createElement(_flag.AutoDismissFlag, {
|
|
22
21
|
icon: /*#__PURE__*/_react.default.createElement(_statusSuccess.default, {
|
|
23
22
|
spacing: "spacious",
|
|
24
|
-
color: "var(--ds-icon-success,
|
|
23
|
+
color: "var(--ds-icon-success, #6A9A23)",
|
|
25
24
|
label: "Success"
|
|
26
25
|
}),
|
|
27
26
|
id: "feedbackSent",
|
|
@@ -23,7 +23,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
23
23
|
var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
|
|
24
24
|
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
25
25
|
var _textarea = _interopRequireDefault(require("@atlaskit/textarea"));
|
|
26
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
27
26
|
var _messages = require("../messages");
|
|
28
27
|
var _IntlProviderWithResolvedMessages = require("./IntlProviderWithResolvedMessages");
|
|
29
28
|
var _excluded = ["id"],
|
|
@@ -102,12 +101,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
102
101
|
};
|
|
103
102
|
var canShowTextField = isTypeSelected() || !showTypeField;
|
|
104
103
|
var hasDescription = description || hasDescriptionDefaultValue;
|
|
105
|
-
|
|
106
|
-
// Feature flag determines validation behavior
|
|
107
|
-
var useNewValidation = (0, _platformFeatureFlags.fg)('feedback-collector-custom-validation');
|
|
108
|
-
var isDisabled = useNewValidation ? isSubmitting || disableSubmitButton // New: only disable when submitting or explicitly disabled
|
|
109
|
-
: disableSubmitButton || (showTypeField ? !isTypeSelected() || !hasDescription : !hasDescription); // Old: disable based on form validation
|
|
110
|
-
|
|
104
|
+
var isDisabled = isSubmitting || disableSubmitButton;
|
|
111
105
|
var getValidationErrors = function getValidationErrors() {
|
|
112
106
|
var errors = {};
|
|
113
107
|
|
|
@@ -177,7 +171,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
177
171
|
_react.default.createElement("p", {
|
|
178
172
|
style: {
|
|
179
173
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
180
|
-
color: "var(--ds-text-subtle,
|
|
174
|
+
color: "var(--ds-text-subtle, #505258)",
|
|
181
175
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
182
176
|
marginBottom: "var(--ds-space-300, 24px)"
|
|
183
177
|
}
|
|
@@ -198,38 +192,32 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
198
192
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
199
193
|
while (1) switch (_context.prev = _context.next) {
|
|
200
194
|
case 0:
|
|
201
|
-
|
|
202
|
-
_context.next = 5;
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
// New validation: validate on submit and show errors
|
|
206
|
-
errors = getValidationErrors(); // If there are validation errors, show them and don't submit
|
|
195
|
+
errors = getValidationErrors();
|
|
207
196
|
if (!(Object.keys(errors).length > 0)) {
|
|
208
|
-
_context.next =
|
|
197
|
+
_context.next = 4;
|
|
209
198
|
break;
|
|
210
199
|
}
|
|
211
200
|
setValidationErrors(errors);
|
|
212
201
|
return _context.abrupt("return");
|
|
213
|
-
case
|
|
214
|
-
// Submit the form (both old and new validation paths reach here)
|
|
202
|
+
case 4:
|
|
215
203
|
setIsSubmitting(true);
|
|
216
|
-
_context.prev =
|
|
217
|
-
_context.next =
|
|
204
|
+
_context.prev = 5;
|
|
205
|
+
_context.next = 8;
|
|
218
206
|
return onSubmit({
|
|
219
207
|
canBeContacted: canBeContacted,
|
|
220
208
|
description: description,
|
|
221
209
|
enrollInResearchGroup: enrollInResearchGroup,
|
|
222
210
|
type: type
|
|
223
211
|
});
|
|
224
|
-
case
|
|
225
|
-
_context.prev =
|
|
212
|
+
case 8:
|
|
213
|
+
_context.prev = 8;
|
|
226
214
|
setIsSubmitting(false);
|
|
227
|
-
return _context.finish(
|
|
228
|
-
case
|
|
215
|
+
return _context.finish(8);
|
|
216
|
+
case 11:
|
|
229
217
|
case "end":
|
|
230
218
|
return _context.stop();
|
|
231
219
|
}
|
|
232
|
-
}, _callee, null, [[
|
|
220
|
+
}, _callee, null, [[5,, 8, 11]]);
|
|
233
221
|
}))
|
|
234
222
|
}, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalHeader, {
|
|
235
223
|
hasCloseButton: true
|
|
@@ -247,8 +235,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
247
235
|
return;
|
|
248
236
|
}
|
|
249
237
|
setType(option.value);
|
|
250
|
-
|
|
251
|
-
if (useNewValidation && validationErrors.type) {
|
|
238
|
+
if (validationErrors.type) {
|
|
252
239
|
setValidationErrors(function (prev) {
|
|
253
240
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
254
241
|
type: undefined
|
|
@@ -270,7 +257,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
270
257
|
ref: focusRef,
|
|
271
258
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
272
259
|
inputId: id
|
|
273
|
-
})),
|
|
260
|
+
})), validationErrors.type && /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, null, validationErrors.type));
|
|
274
261
|
}) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
275
262
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(_messages.messages.defaultCustomTextAreaLabel),
|
|
276
263
|
isRequired: true,
|
|
@@ -283,8 +270,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
283
270
|
placeholder: summaryPlaceholder || undefined,
|
|
284
271
|
onChange: function onChange(e) {
|
|
285
272
|
setDescription(e.target.value);
|
|
286
|
-
|
|
287
|
-
if (useNewValidation && validationErrors.description) {
|
|
273
|
+
if (validationErrors.description) {
|
|
288
274
|
setValidationErrors(function (prev) {
|
|
289
275
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
290
276
|
description: undefined
|
|
@@ -293,7 +279,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
293
279
|
}
|
|
294
280
|
},
|
|
295
281
|
value: description
|
|
296
|
-
})),
|
|
282
|
+
})), validationErrors.description && /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, null, validationErrors.description));
|
|
297
283
|
}), !anonymousFeedback && /*#__PURE__*/_react.default.createElement(_form.Fieldset, null, /*#__PURE__*/_react.default.createElement("legend", {
|
|
298
284
|
"aria-hidden": false,
|
|
299
285
|
hidden: true
|
|
@@ -354,38 +340,32 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
354
340
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
355
341
|
while (1) switch (_context2.prev = _context2.next) {
|
|
356
342
|
case 0:
|
|
357
|
-
|
|
358
|
-
_context2.next = 5;
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
// New validation: validate on submit and show errors
|
|
362
|
-
errors = getValidationErrors(); // If there are validation errors, show them and don't submit
|
|
343
|
+
errors = getValidationErrors();
|
|
363
344
|
if (!(Object.keys(errors).length > 0)) {
|
|
364
|
-
_context2.next =
|
|
345
|
+
_context2.next = 4;
|
|
365
346
|
break;
|
|
366
347
|
}
|
|
367
348
|
setValidationErrors(errors);
|
|
368
349
|
return _context2.abrupt("return");
|
|
369
|
-
case
|
|
370
|
-
// Submit the form (both old and new validation paths reach here)
|
|
350
|
+
case 4:
|
|
371
351
|
setIsSubmitting(true);
|
|
372
|
-
_context2.prev =
|
|
373
|
-
_context2.next =
|
|
352
|
+
_context2.prev = 5;
|
|
353
|
+
_context2.next = 8;
|
|
374
354
|
return onSubmit({
|
|
375
355
|
canBeContacted: canBeContacted,
|
|
376
356
|
description: description,
|
|
377
357
|
enrollInResearchGroup: enrollInResearchGroup,
|
|
378
358
|
type: type
|
|
379
359
|
});
|
|
380
|
-
case
|
|
381
|
-
_context2.prev =
|
|
360
|
+
case 8:
|
|
361
|
+
_context2.prev = 8;
|
|
382
362
|
setIsSubmitting(false);
|
|
383
|
-
return _context2.finish(
|
|
384
|
-
case
|
|
363
|
+
return _context2.finish(8);
|
|
364
|
+
case 11:
|
|
385
365
|
case "end":
|
|
386
366
|
return _context2.stop();
|
|
387
367
|
}
|
|
388
|
-
}, _callee2, null, [[
|
|
368
|
+
}, _callee2, null, [[5,, 8, 11]]);
|
|
389
369
|
}))
|
|
390
370
|
}, function (_ref9) {
|
|
391
371
|
var formProps = _ref9.formProps;
|
|
@@ -405,8 +385,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
405
385
|
return;
|
|
406
386
|
}
|
|
407
387
|
setType(option.value);
|
|
408
|
-
|
|
409
|
-
if (useNewValidation && validationErrors.type) {
|
|
388
|
+
if (validationErrors.type) {
|
|
410
389
|
setValidationErrors(function (prev) {
|
|
411
390
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
412
391
|
type: undefined
|
|
@@ -428,7 +407,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
428
407
|
ref: focusRef,
|
|
429
408
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
430
409
|
inputId: id
|
|
431
|
-
})),
|
|
410
|
+
})), validationErrors.type && /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, null, validationErrors.type));
|
|
432
411
|
}) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
433
412
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(_messages.messages.defaultCustomTextAreaLabel),
|
|
434
413
|
isRequired: true,
|
|
@@ -441,8 +420,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
441
420
|
placeholder: summaryPlaceholder || undefined,
|
|
442
421
|
onChange: function onChange(e) {
|
|
443
422
|
setDescription(e.target.value);
|
|
444
|
-
|
|
445
|
-
if (useNewValidation && validationErrors.description) {
|
|
423
|
+
if (validationErrors.description) {
|
|
446
424
|
setValidationErrors(function (prev) {
|
|
447
425
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
448
426
|
description: undefined
|
|
@@ -451,7 +429,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
451
429
|
}
|
|
452
430
|
},
|
|
453
431
|
value: description
|
|
454
|
-
})),
|
|
432
|
+
})), validationErrors.description && /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, null, validationErrors.description));
|
|
455
433
|
}), !anonymousFeedback && /*#__PURE__*/_react.default.createElement(_form.Fieldset, null, /*#__PURE__*/_react.default.createElement("legend", {
|
|
456
434
|
"aria-hidden": false,
|
|
457
435
|
hidden: true
|
|
@@ -92,7 +92,7 @@ export default class FeedbackCollector extends Component {
|
|
|
92
92
|
return FeedbackCollector.defaultProps.url;
|
|
93
93
|
}
|
|
94
94
|
getPackageVersion() {
|
|
95
|
-
return "
|
|
95
|
+
return "0.0.0-development" || 'Unknown, at least 11.0.0';
|
|
96
96
|
}
|
|
97
97
|
async getEntitlementInformation() {
|
|
98
98
|
var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { AutoDismissFlag } from '@atlaskit/flag';
|
|
4
4
|
import SuccessIcon from '@atlaskit/icon/core/status-success';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { G300 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { messages } from '../messages';
|
|
8
7
|
import { IntlProviderWithResolvedMessages } from './IntlProviderWithResolvedMessages';
|
|
9
8
|
const FeedbackFlag = ({
|
|
@@ -16,7 +15,7 @@ const FeedbackFlag = ({
|
|
|
16
15
|
return /*#__PURE__*/React.createElement(AutoDismissFlag, {
|
|
17
16
|
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
18
17
|
spacing: "spacious",
|
|
19
|
-
color:
|
|
18
|
+
color: "var(--ds-icon-success, #6A9A23)",
|
|
20
19
|
label: "Success"
|
|
21
20
|
}),
|
|
22
21
|
id: "feedbackSent",
|
|
@@ -10,7 +10,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
10
10
|
import SectionMessage from '@atlaskit/section-message';
|
|
11
11
|
import Select from '@atlaskit/select';
|
|
12
12
|
import TextArea from '@atlaskit/textarea';
|
|
13
|
-
import { N300 } from '@atlaskit/theme/colors';
|
|
14
13
|
import { messages } from '../messages';
|
|
15
14
|
import { IntlProviderWithResolvedMessages } from './IntlProviderWithResolvedMessages';
|
|
16
15
|
const LinkWrapper = ({
|
|
@@ -62,12 +61,7 @@ const FeedbackForm = ({
|
|
|
62
61
|
const isTypeSelected = () => type !== 'empty';
|
|
63
62
|
const canShowTextField = isTypeSelected() || !showTypeField;
|
|
64
63
|
const hasDescription = description || hasDescriptionDefaultValue;
|
|
65
|
-
|
|
66
|
-
// Feature flag determines validation behavior
|
|
67
|
-
const useNewValidation = fg('feedback-collector-custom-validation');
|
|
68
|
-
const isDisabled = useNewValidation ? isSubmitting || disableSubmitButton // New: only disable when submitting or explicitly disabled
|
|
69
|
-
: disableSubmitButton || (showTypeField ? !isTypeSelected() || !hasDescription : !hasDescription); // Old: disable based on form validation
|
|
70
|
-
|
|
64
|
+
const isDisabled = isSubmitting || disableSubmitButton;
|
|
71
65
|
const getValidationErrors = () => {
|
|
72
66
|
const errors = {};
|
|
73
67
|
|
|
@@ -137,7 +131,7 @@ const FeedbackForm = ({
|
|
|
137
131
|
React.createElement("p", {
|
|
138
132
|
style: {
|
|
139
133
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
140
|
-
color:
|
|
134
|
+
color: "var(--ds-text-subtle, #505258)",
|
|
141
135
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
142
136
|
marginBottom: "var(--ds-space-300, 24px)"
|
|
143
137
|
}
|
|
@@ -154,18 +148,11 @@ const FeedbackForm = ({
|
|
|
154
148
|
shouldScrollInViewport: true
|
|
155
149
|
}, fg('platform-design_system_team-form_conversion') ? /*#__PURE__*/React.createElement(Form, {
|
|
156
150
|
onSubmit: async () => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// If there are validation errors, show them and don't submit
|
|
162
|
-
if (Object.keys(errors).length > 0) {
|
|
163
|
-
setValidationErrors(errors);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
151
|
+
const errors = getValidationErrors();
|
|
152
|
+
if (Object.keys(errors).length > 0) {
|
|
153
|
+
setValidationErrors(errors);
|
|
154
|
+
return;
|
|
166
155
|
}
|
|
167
|
-
|
|
168
|
-
// Submit the form (both old and new validation paths reach here)
|
|
169
156
|
setIsSubmitting(true);
|
|
170
157
|
try {
|
|
171
158
|
await onSubmit({
|
|
@@ -195,8 +182,7 @@ const FeedbackForm = ({
|
|
|
195
182
|
return;
|
|
196
183
|
}
|
|
197
184
|
setType(option.value);
|
|
198
|
-
|
|
199
|
-
if (useNewValidation && validationErrors.type) {
|
|
185
|
+
if (validationErrors.type) {
|
|
200
186
|
setValidationErrors(prev => ({
|
|
201
187
|
...prev,
|
|
202
188
|
type: undefined
|
|
@@ -216,7 +202,7 @@ const FeedbackForm = ({
|
|
|
216
202
|
ref: focusRef,
|
|
217
203
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
218
204
|
inputId: id
|
|
219
|
-
})),
|
|
205
|
+
})), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type))) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
220
206
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
|
|
221
207
|
isRequired: true,
|
|
222
208
|
name: "description"
|
|
@@ -228,8 +214,7 @@ const FeedbackForm = ({
|
|
|
228
214
|
placeholder: summaryPlaceholder || undefined,
|
|
229
215
|
onChange: e => {
|
|
230
216
|
setDescription(e.target.value);
|
|
231
|
-
|
|
232
|
-
if (useNewValidation && validationErrors.description) {
|
|
217
|
+
if (validationErrors.description) {
|
|
233
218
|
setValidationErrors(prev => ({
|
|
234
219
|
...prev,
|
|
235
220
|
description: undefined
|
|
@@ -237,7 +222,7 @@ const FeedbackForm = ({
|
|
|
237
222
|
}
|
|
238
223
|
},
|
|
239
224
|
value: description
|
|
240
|
-
})),
|
|
225
|
+
})), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description))), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", {
|
|
241
226
|
"aria-hidden": false,
|
|
242
227
|
hidden: true
|
|
243
228
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.optInOptionsLegend)), /*#__PURE__*/React.createElement(Field, {
|
|
@@ -283,18 +268,11 @@ const FeedbackForm = ({
|
|
|
283
268
|
testId: "feedbackCollectorSubmitBtn"
|
|
284
269
|
}, submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, messages.submitButtonLabel)))) : /*#__PURE__*/React.createElement(Form, {
|
|
285
270
|
onSubmit: async () => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
// If there are validation errors, show them and don't submit
|
|
291
|
-
if (Object.keys(errors).length > 0) {
|
|
292
|
-
setValidationErrors(errors);
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
271
|
+
const errors = getValidationErrors();
|
|
272
|
+
if (Object.keys(errors).length > 0) {
|
|
273
|
+
setValidationErrors(errors);
|
|
274
|
+
return;
|
|
295
275
|
}
|
|
296
|
-
|
|
297
|
-
// Submit the form (both old and new validation paths reach here)
|
|
298
276
|
setIsSubmitting(true);
|
|
299
277
|
try {
|
|
300
278
|
await onSubmit({
|
|
@@ -326,8 +304,7 @@ const FeedbackForm = ({
|
|
|
326
304
|
return;
|
|
327
305
|
}
|
|
328
306
|
setType(option.value);
|
|
329
|
-
|
|
330
|
-
if (useNewValidation && validationErrors.type) {
|
|
307
|
+
if (validationErrors.type) {
|
|
331
308
|
setValidationErrors(prev => ({
|
|
332
309
|
...prev,
|
|
333
310
|
type: undefined
|
|
@@ -347,7 +324,7 @@ const FeedbackForm = ({
|
|
|
347
324
|
ref: focusRef,
|
|
348
325
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
349
326
|
inputId: id
|
|
350
|
-
})),
|
|
327
|
+
})), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type))) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
351
328
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
|
|
352
329
|
isRequired: true,
|
|
353
330
|
name: "description"
|
|
@@ -359,8 +336,7 @@ const FeedbackForm = ({
|
|
|
359
336
|
placeholder: summaryPlaceholder || undefined,
|
|
360
337
|
onChange: e => {
|
|
361
338
|
setDescription(e.target.value);
|
|
362
|
-
|
|
363
|
-
if (useNewValidation && validationErrors.description) {
|
|
339
|
+
if (validationErrors.description) {
|
|
364
340
|
setValidationErrors(prev => ({
|
|
365
341
|
...prev,
|
|
366
342
|
description: undefined
|
|
@@ -368,7 +344,7 @@ const FeedbackForm = ({
|
|
|
368
344
|
}
|
|
369
345
|
},
|
|
370
346
|
value: description
|
|
371
|
-
})),
|
|
347
|
+
})), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description))), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", {
|
|
372
348
|
"aria-hidden": false,
|
|
373
349
|
hidden: true
|
|
374
350
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.optInOptionsLegend)), /*#__PURE__*/React.createElement(Field, {
|
|
@@ -155,7 +155,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
155
155
|
}, {
|
|
156
156
|
key: "getPackageVersion",
|
|
157
157
|
value: function getPackageVersion() {
|
|
158
|
-
return "
|
|
158
|
+
return "0.0.0-development" || 'Unknown, at least 11.0.0';
|
|
159
159
|
}
|
|
160
160
|
}, {
|
|
161
161
|
key: "getEntitlementInformation",
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { AutoDismissFlag } from '@atlaskit/flag';
|
|
4
4
|
import SuccessIcon from '@atlaskit/icon/core/status-success';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { G300 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { messages } from '../messages';
|
|
8
7
|
import { IntlProviderWithResolvedMessages } from './IntlProviderWithResolvedMessages';
|
|
9
8
|
var FeedbackFlag = function FeedbackFlag(_ref) {
|
|
@@ -14,7 +13,7 @@ var FeedbackFlag = function FeedbackFlag(_ref) {
|
|
|
14
13
|
return /*#__PURE__*/React.createElement(AutoDismissFlag, {
|
|
15
14
|
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
16
15
|
spacing: "spacious",
|
|
17
|
-
color: "var(--ds-icon-success,
|
|
16
|
+
color: "var(--ds-icon-success, #6A9A23)",
|
|
18
17
|
label: "Success"
|
|
19
18
|
}),
|
|
20
19
|
id: "feedbackSent",
|
|
@@ -20,7 +20,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
20
20
|
import SectionMessage from '@atlaskit/section-message';
|
|
21
21
|
import Select from '@atlaskit/select';
|
|
22
22
|
import TextArea from '@atlaskit/textarea';
|
|
23
|
-
import { N300 } from '@atlaskit/theme/colors';
|
|
24
23
|
import { messages } from '../messages';
|
|
25
24
|
import { IntlProviderWithResolvedMessages } from './IntlProviderWithResolvedMessages';
|
|
26
25
|
var LinkWrapper = function LinkWrapper(_ref) {
|
|
@@ -93,12 +92,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
93
92
|
};
|
|
94
93
|
var canShowTextField = isTypeSelected() || !showTypeField;
|
|
95
94
|
var hasDescription = description || hasDescriptionDefaultValue;
|
|
96
|
-
|
|
97
|
-
// Feature flag determines validation behavior
|
|
98
|
-
var useNewValidation = fg('feedback-collector-custom-validation');
|
|
99
|
-
var isDisabled = useNewValidation ? isSubmitting || disableSubmitButton // New: only disable when submitting or explicitly disabled
|
|
100
|
-
: disableSubmitButton || (showTypeField ? !isTypeSelected() || !hasDescription : !hasDescription); // Old: disable based on form validation
|
|
101
|
-
|
|
95
|
+
var isDisabled = isSubmitting || disableSubmitButton;
|
|
102
96
|
var getValidationErrors = function getValidationErrors() {
|
|
103
97
|
var errors = {};
|
|
104
98
|
|
|
@@ -168,7 +162,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
168
162
|
React.createElement("p", {
|
|
169
163
|
style: {
|
|
170
164
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
171
|
-
color: "var(--ds-text-subtle,
|
|
165
|
+
color: "var(--ds-text-subtle, #505258)",
|
|
172
166
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
173
167
|
marginBottom: "var(--ds-space-300, 24px)"
|
|
174
168
|
}
|
|
@@ -189,38 +183,32 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
189
183
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
190
184
|
while (1) switch (_context.prev = _context.next) {
|
|
191
185
|
case 0:
|
|
192
|
-
|
|
193
|
-
_context.next = 5;
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
// New validation: validate on submit and show errors
|
|
197
|
-
errors = getValidationErrors(); // If there are validation errors, show them and don't submit
|
|
186
|
+
errors = getValidationErrors();
|
|
198
187
|
if (!(Object.keys(errors).length > 0)) {
|
|
199
|
-
_context.next =
|
|
188
|
+
_context.next = 4;
|
|
200
189
|
break;
|
|
201
190
|
}
|
|
202
191
|
setValidationErrors(errors);
|
|
203
192
|
return _context.abrupt("return");
|
|
204
|
-
case
|
|
205
|
-
// Submit the form (both old and new validation paths reach here)
|
|
193
|
+
case 4:
|
|
206
194
|
setIsSubmitting(true);
|
|
207
|
-
_context.prev =
|
|
208
|
-
_context.next =
|
|
195
|
+
_context.prev = 5;
|
|
196
|
+
_context.next = 8;
|
|
209
197
|
return onSubmit({
|
|
210
198
|
canBeContacted: canBeContacted,
|
|
211
199
|
description: description,
|
|
212
200
|
enrollInResearchGroup: enrollInResearchGroup,
|
|
213
201
|
type: type
|
|
214
202
|
});
|
|
215
|
-
case
|
|
216
|
-
_context.prev =
|
|
203
|
+
case 8:
|
|
204
|
+
_context.prev = 8;
|
|
217
205
|
setIsSubmitting(false);
|
|
218
|
-
return _context.finish(
|
|
219
|
-
case
|
|
206
|
+
return _context.finish(8);
|
|
207
|
+
case 11:
|
|
220
208
|
case "end":
|
|
221
209
|
return _context.stop();
|
|
222
210
|
}
|
|
223
|
-
}, _callee, null, [[
|
|
211
|
+
}, _callee, null, [[5,, 8, 11]]);
|
|
224
212
|
}))
|
|
225
213
|
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
226
214
|
hasCloseButton: true
|
|
@@ -238,8 +226,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
238
226
|
return;
|
|
239
227
|
}
|
|
240
228
|
setType(option.value);
|
|
241
|
-
|
|
242
|
-
if (useNewValidation && validationErrors.type) {
|
|
229
|
+
if (validationErrors.type) {
|
|
243
230
|
setValidationErrors(function (prev) {
|
|
244
231
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
245
232
|
type: undefined
|
|
@@ -261,7 +248,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
261
248
|
ref: focusRef,
|
|
262
249
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
263
250
|
inputId: id
|
|
264
|
-
})),
|
|
251
|
+
})), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type));
|
|
265
252
|
}) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
266
253
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
|
|
267
254
|
isRequired: true,
|
|
@@ -274,8 +261,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
274
261
|
placeholder: summaryPlaceholder || undefined,
|
|
275
262
|
onChange: function onChange(e) {
|
|
276
263
|
setDescription(e.target.value);
|
|
277
|
-
|
|
278
|
-
if (useNewValidation && validationErrors.description) {
|
|
264
|
+
if (validationErrors.description) {
|
|
279
265
|
setValidationErrors(function (prev) {
|
|
280
266
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
281
267
|
description: undefined
|
|
@@ -284,7 +270,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
284
270
|
}
|
|
285
271
|
},
|
|
286
272
|
value: description
|
|
287
|
-
})),
|
|
273
|
+
})), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description));
|
|
288
274
|
}), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", {
|
|
289
275
|
"aria-hidden": false,
|
|
290
276
|
hidden: true
|
|
@@ -345,38 +331,32 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
345
331
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
346
332
|
while (1) switch (_context2.prev = _context2.next) {
|
|
347
333
|
case 0:
|
|
348
|
-
|
|
349
|
-
_context2.next = 5;
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
// New validation: validate on submit and show errors
|
|
353
|
-
errors = getValidationErrors(); // If there are validation errors, show them and don't submit
|
|
334
|
+
errors = getValidationErrors();
|
|
354
335
|
if (!(Object.keys(errors).length > 0)) {
|
|
355
|
-
_context2.next =
|
|
336
|
+
_context2.next = 4;
|
|
356
337
|
break;
|
|
357
338
|
}
|
|
358
339
|
setValidationErrors(errors);
|
|
359
340
|
return _context2.abrupt("return");
|
|
360
|
-
case
|
|
361
|
-
// Submit the form (both old and new validation paths reach here)
|
|
341
|
+
case 4:
|
|
362
342
|
setIsSubmitting(true);
|
|
363
|
-
_context2.prev =
|
|
364
|
-
_context2.next =
|
|
343
|
+
_context2.prev = 5;
|
|
344
|
+
_context2.next = 8;
|
|
365
345
|
return onSubmit({
|
|
366
346
|
canBeContacted: canBeContacted,
|
|
367
347
|
description: description,
|
|
368
348
|
enrollInResearchGroup: enrollInResearchGroup,
|
|
369
349
|
type: type
|
|
370
350
|
});
|
|
371
|
-
case
|
|
372
|
-
_context2.prev =
|
|
351
|
+
case 8:
|
|
352
|
+
_context2.prev = 8;
|
|
373
353
|
setIsSubmitting(false);
|
|
374
|
-
return _context2.finish(
|
|
375
|
-
case
|
|
354
|
+
return _context2.finish(8);
|
|
355
|
+
case 11:
|
|
376
356
|
case "end":
|
|
377
357
|
return _context2.stop();
|
|
378
358
|
}
|
|
379
|
-
}, _callee2, null, [[
|
|
359
|
+
}, _callee2, null, [[5,, 8, 11]]);
|
|
380
360
|
}))
|
|
381
361
|
}, function (_ref9) {
|
|
382
362
|
var formProps = _ref9.formProps;
|
|
@@ -396,8 +376,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
396
376
|
return;
|
|
397
377
|
}
|
|
398
378
|
setType(option.value);
|
|
399
|
-
|
|
400
|
-
if (useNewValidation && validationErrors.type) {
|
|
379
|
+
if (validationErrors.type) {
|
|
401
380
|
setValidationErrors(function (prev) {
|
|
402
381
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
403
382
|
type: undefined
|
|
@@ -419,7 +398,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
419
398
|
ref: focusRef,
|
|
420
399
|
placeholder: getDefaultPlaceholder(feedbackGroupLabels),
|
|
421
400
|
inputId: id
|
|
422
|
-
})),
|
|
401
|
+
})), validationErrors.type && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.type));
|
|
423
402
|
}) : null, showDefaultTextFields && canShowTextField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
424
403
|
label: showTypeField ? getFieldLabels(feedbackGroupLabels)[type] : customTextAreaLabel || formatMessage(messages.defaultCustomTextAreaLabel),
|
|
425
404
|
isRequired: true,
|
|
@@ -432,8 +411,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
432
411
|
placeholder: summaryPlaceholder || undefined,
|
|
433
412
|
onChange: function onChange(e) {
|
|
434
413
|
setDescription(e.target.value);
|
|
435
|
-
|
|
436
|
-
if (useNewValidation && validationErrors.description) {
|
|
414
|
+
if (validationErrors.description) {
|
|
437
415
|
setValidationErrors(function (prev) {
|
|
438
416
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
439
417
|
description: undefined
|
|
@@ -442,7 +420,7 @@ var FeedbackForm = function FeedbackForm(_ref2) {
|
|
|
442
420
|
}
|
|
443
421
|
},
|
|
444
422
|
value: description
|
|
445
|
-
})),
|
|
423
|
+
})), validationErrors.description && /*#__PURE__*/React.createElement(ErrorMessage, null, validationErrors.description));
|
|
446
424
|
}), !anonymousFeedback && /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement("legend", {
|
|
447
425
|
"aria-hidden": false,
|
|
448
426
|
hidden: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/feedback-collector",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.21",
|
|
4
4
|
"description": "A component that collects feedback across Atlassian products.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,17 +35,16 @@
|
|
|
35
35
|
"@atlaskit/afm-i18n-platform-web-platform-feedback-collector": "2.7.0",
|
|
36
36
|
"@atlaskit/button": "^23.10.0",
|
|
37
37
|
"@atlaskit/checkbox": "^17.3.0",
|
|
38
|
-
"@atlaskit/flag": "^17.
|
|
39
|
-
"@atlaskit/form": "^15.
|
|
40
|
-
"@atlaskit/icon": "^
|
|
38
|
+
"@atlaskit/flag": "^17.9.0",
|
|
39
|
+
"@atlaskit/form": "^15.5.0",
|
|
40
|
+
"@atlaskit/icon": "^34.0.0",
|
|
41
41
|
"@atlaskit/link": "^3.3.0",
|
|
42
|
-
"@atlaskit/modal-dialog": "^14.
|
|
42
|
+
"@atlaskit/modal-dialog": "^14.14.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/section-message": "^8.12.0",
|
|
45
|
-
"@atlaskit/select": "^21.
|
|
45
|
+
"@atlaskit/select": "^21.10.0",
|
|
46
46
|
"@atlaskit/textarea": "^8.2.0",
|
|
47
|
-
"@atlaskit/
|
|
48
|
-
"@atlaskit/tokens": "^11.0.0",
|
|
47
|
+
"@atlaskit/tokens": "^11.4.0",
|
|
49
48
|
"@babel/runtime": "^7.0.0",
|
|
50
49
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
51
50
|
},
|
|
@@ -89,9 +88,6 @@
|
|
|
89
88
|
"product-terminology-refresh": {
|
|
90
89
|
"type": "boolean"
|
|
91
90
|
},
|
|
92
|
-
"feedback-collector-custom-validation": {
|
|
93
|
-
"type": "boolean"
|
|
94
|
-
},
|
|
95
91
|
"jfp_a11y_team_feedback_collector_nested_elements": {
|
|
96
92
|
"type": "boolean"
|
|
97
93
|
},
|