@atlaskit/feedback-collector 10.0.0 → 10.2.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,23 @@
1
1
  # @atlaskit/feedback-collector
2
2
 
3
+ ## 10.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1781fc857bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1781fc857bd) - add email from logged in user
8
+
9
+ ## 10.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`b35b73e9670`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b35b73e9670) - Use correct requestTypeId for feedback collector
14
+
15
+ ## 10.0.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 10.0.0
4
22
 
5
23
  ### Major Changes
@@ -31,6 +31,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
31
 
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
+ /*
35
+ * Standard feedback button with "Give Feedback" as the text and speaker icon on the left of the text
36
+ * */
34
37
  var FeedbackButton = function FeedbackButton(props) {
35
38
  var _useState = (0, _react.useState)(false),
36
39
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -260,9 +260,73 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
260
260
  }
261
261
  }, {
262
262
  key: "getEmail",
263
- value: function getEmail(formValues) {
264
- return formValues.canBeContacted && this.props.email ? this.props.email : this.props.emailDefaultValue;
265
- }
263
+ value: function () {
264
+ var _getEmail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(formValues) {
265
+ var url, result, json;
266
+ return _regenerator.default.wrap(function _callee3$(_context3) {
267
+ while (1) {
268
+ switch (_context3.prev = _context3.next) {
269
+ case 0:
270
+ _context3.prev = 0;
271
+
272
+ if (!formValues.canBeContacted) {
273
+ _context3.next = 14;
274
+ break;
275
+ }
276
+
277
+ if (!this.props.email) {
278
+ _context3.next = 4;
279
+ break;
280
+ }
281
+
282
+ return _context3.abrupt("return", this.props.email);
283
+
284
+ case 4:
285
+ url = this.props.url;
286
+ _context3.next = 7;
287
+ return fetch("".concat(url, "/me"), {
288
+ method: 'GET',
289
+ headers: {
290
+ 'Content-Type': 'application/json'
291
+ },
292
+ credentials: 'include'
293
+ });
294
+
295
+ case 7:
296
+ result = _context3.sent;
297
+ _context3.next = 10;
298
+ return result.json();
299
+
300
+ case 10:
301
+ json = _context3.sent;
302
+ return _context3.abrupt("return", json.email);
303
+
304
+ case 14:
305
+ return _context3.abrupt("return", this.props.emailDefaultValue);
306
+
307
+ case 15:
308
+ _context3.next = 20;
309
+ break;
310
+
311
+ case 17:
312
+ _context3.prev = 17;
313
+ _context3.t0 = _context3["catch"](0);
314
+ return _context3.abrupt("return", this.props.emailDefaultValue);
315
+
316
+ case 20:
317
+ case "end":
318
+ return _context3.stop();
319
+ }
320
+ }
321
+ }, _callee3, this, [[0, 17]]);
322
+ }));
323
+
324
+ function getEmail(_x2) {
325
+ return _getEmail.apply(this, arguments);
326
+ }
327
+
328
+ return getEmail;
329
+ }()
266
330
  }, {
267
331
  key: "getDescription",
268
332
  value: function getDescription(formValues) {
@@ -281,51 +345,69 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
281
345
  }, {
282
346
  key: "mapFormToJSD",
283
347
  value: function () {
284
- var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(formValues) {
348
+ var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(formValues) {
285
349
  var entitlementInformation;
286
- return _regenerator.default.wrap(function _callee3$(_context3) {
350
+ return _regenerator.default.wrap(function _callee4$(_context4) {
287
351
  while (1) {
288
- switch (_context3.prev = _context3.next) {
352
+ switch (_context4.prev = _context4.next) {
289
353
  case 0:
290
- _context3.next = 2;
354
+ _context4.next = 2;
291
355
  return this.getEntitlementInformation();
292
356
 
293
357
  case 2:
294
- entitlementInformation = _context3.sent;
295
- return _context3.abrupt("return", {
296
- fields: [].concat((0, _toConsumableArray2.default)(entitlementInformation !== null && entitlementInformation || []), [this.props.showTypeField ? {
297
- id: this.props.typeFieldId,
298
- value: this.getTypeFieldValue(formValues.type)
299
- } : undefined, {
300
- id: this.props.summaryFieldId,
301
- value: this.getSummary(formValues)
302
- }, {
303
- id: this.props.descriptionFieldId,
304
- value: this.getDescription(formValues)
305
- }, {
306
- id: this.props.emailFieldId,
307
- value: this.getEmail(formValues)
308
- }, {
309
- id: this.props.customerNameFieldId,
310
- value: this.getCustomerName()
311
- }, formValues.canBeContacted ? {
312
- id: this.props.canBeContactedFieldId,
313
- value: this.props.canBeContactedDefaultValue
314
- } : undefined, formValues.enrollInResearchGroup ? {
315
- id: this.props.enrollInResearchFieldId,
316
- value: this.props.enrollInResearchDefaultValue
317
- } : undefined], (0, _toConsumableArray2.default)(this.props.additionalFields)).filter(Boolean)
358
+ entitlementInformation = _context4.sent;
359
+ _context4.t0 = [];
360
+ _context4.t1 = (0, _toConsumableArray2.default)(entitlementInformation !== null && entitlementInformation || []);
361
+ _context4.t2 = this.props.showTypeField ? {
362
+ id: this.props.typeFieldId,
363
+ value: this.getTypeFieldValue(formValues.type)
364
+ } : undefined;
365
+ _context4.t3 = {
366
+ id: this.props.summaryFieldId,
367
+ value: this.getSummary(formValues)
368
+ };
369
+ _context4.t4 = {
370
+ id: this.props.descriptionFieldId,
371
+ value: this.getDescription(formValues)
372
+ };
373
+ _context4.t5 = this.props.emailFieldId;
374
+ _context4.next = 11;
375
+ return this.getEmail(formValues);
376
+
377
+ case 11:
378
+ _context4.t6 = _context4.sent;
379
+ _context4.t7 = {
380
+ id: _context4.t5,
381
+ value: _context4.t6
382
+ };
383
+ _context4.t8 = {
384
+ id: this.props.customerNameFieldId,
385
+ value: this.getCustomerName()
386
+ };
387
+ _context4.t9 = formValues.canBeContacted ? {
388
+ id: this.props.canBeContactedFieldId,
389
+ value: this.props.canBeContactedDefaultValue
390
+ } : undefined;
391
+ _context4.t10 = formValues.enrollInResearchGroup ? {
392
+ id: this.props.enrollInResearchFieldId,
393
+ value: this.props.enrollInResearchDefaultValue
394
+ } : undefined;
395
+ _context4.t11 = [_context4.t2, _context4.t3, _context4.t4, _context4.t7, _context4.t8, _context4.t9, _context4.t10];
396
+ _context4.t12 = (0, _toConsumableArray2.default)(this.props.additionalFields);
397
+ _context4.t13 = _context4.t0.concat.call(_context4.t0, _context4.t1, _context4.t11, _context4.t12).filter(Boolean);
398
+ return _context4.abrupt("return", {
399
+ fields: _context4.t13
318
400
  });
319
401
 
320
- case 4:
402
+ case 20:
321
403
  case "end":
322
- return _context3.stop();
404
+ return _context4.stop();
323
405
  }
324
406
  }
325
- }, _callee3, this);
407
+ }, _callee4, this);
326
408
  }));
327
409
 
328
- function mapFormToJSD(_x2) {
410
+ function mapFormToJSD(_x3) {
329
411
  return _mapFormToJSD.apply(this, arguments);
330
412
  }
331
413
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -7,6 +7,9 @@ import FeedbackCollector from './FeedbackCollector';
7
7
  import FeedbackFlag from './FeedbackFlag';
8
8
  import { messages } from './messages';
9
9
 
10
+ /*
11
+ * Standard feedback button with "Give Feedback" as the text and speaker icon on the left of the text
12
+ * */
10
13
  const FeedbackButton = props => {
11
14
  const [isOpen, setIsOpen] = useState(false);
12
15
  const [displayFlag, setDisplayFlag] = useState(false);
@@ -144,8 +144,29 @@ export default class FeedbackCollector extends Component {
144
144
  }
145
145
  }
146
146
 
147
- getEmail(formValues) {
148
- return formValues.canBeContacted && this.props.email ? this.props.email : this.props.emailDefaultValue;
147
+ async getEmail(formValues) {
148
+ try {
149
+ if (formValues.canBeContacted) {
150
+ if (this.props.email) {
151
+ return this.props.email;
152
+ }
153
+
154
+ const url = this.props.url;
155
+ const result = await fetch(`${url}/me`, {
156
+ method: 'GET',
157
+ headers: {
158
+ 'Content-Type': 'application/json'
159
+ },
160
+ credentials: 'include'
161
+ });
162
+ const json = await result.json();
163
+ return json.email;
164
+ } else {
165
+ return this.props.emailDefaultValue;
166
+ }
167
+ } catch (e) {
168
+ return this.props.emailDefaultValue;
169
+ }
149
170
  }
150
171
 
151
172
  getDescription(formValues) {
@@ -174,7 +195,7 @@ export default class FeedbackCollector extends Component {
174
195
  value: this.getDescription(formValues)
175
196
  }, {
176
197
  id: this.props.emailFieldId,
177
- value: this.getEmail(formValues)
198
+ value: await this.getEmail(formValues)
178
199
  }, {
179
200
  id: this.props.customerNameFieldId,
180
201
  value: this.getCustomerName()
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -8,6 +8,9 @@ import FeedbackCollector from './FeedbackCollector';
8
8
  import FeedbackFlag from './FeedbackFlag';
9
9
  import { messages } from './messages';
10
10
 
11
+ /*
12
+ * Standard feedback button with "Give Feedback" as the text and speaker icon on the left of the text
13
+ * */
11
14
  var FeedbackButton = function FeedbackButton(props) {
12
15
  var _useState = useState(false),
13
16
  _useState2 = _slicedToArray(_useState, 2),
@@ -235,9 +235,73 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
235
235
  }
236
236
  }, {
237
237
  key: "getEmail",
238
- value: function getEmail(formValues) {
239
- return formValues.canBeContacted && this.props.email ? this.props.email : this.props.emailDefaultValue;
240
- }
238
+ value: function () {
239
+ var _getEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(formValues) {
240
+ var url, result, json;
241
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
242
+ while (1) {
243
+ switch (_context3.prev = _context3.next) {
244
+ case 0:
245
+ _context3.prev = 0;
246
+
247
+ if (!formValues.canBeContacted) {
248
+ _context3.next = 14;
249
+ break;
250
+ }
251
+
252
+ if (!this.props.email) {
253
+ _context3.next = 4;
254
+ break;
255
+ }
256
+
257
+ return _context3.abrupt("return", this.props.email);
258
+
259
+ case 4:
260
+ url = this.props.url;
261
+ _context3.next = 7;
262
+ return fetch("".concat(url, "/me"), {
263
+ method: 'GET',
264
+ headers: {
265
+ 'Content-Type': 'application/json'
266
+ },
267
+ credentials: 'include'
268
+ });
269
+
270
+ case 7:
271
+ result = _context3.sent;
272
+ _context3.next = 10;
273
+ return result.json();
274
+
275
+ case 10:
276
+ json = _context3.sent;
277
+ return _context3.abrupt("return", json.email);
278
+
279
+ case 14:
280
+ return _context3.abrupt("return", this.props.emailDefaultValue);
281
+
282
+ case 15:
283
+ _context3.next = 20;
284
+ break;
285
+
286
+ case 17:
287
+ _context3.prev = 17;
288
+ _context3.t0 = _context3["catch"](0);
289
+ return _context3.abrupt("return", this.props.emailDefaultValue);
290
+
291
+ case 20:
292
+ case "end":
293
+ return _context3.stop();
294
+ }
295
+ }
296
+ }, _callee3, this, [[0, 17]]);
297
+ }));
298
+
299
+ function getEmail(_x2) {
300
+ return _getEmail.apply(this, arguments);
301
+ }
302
+
303
+ return getEmail;
304
+ }()
241
305
  }, {
242
306
  key: "getDescription",
243
307
  value: function getDescription(formValues) {
@@ -256,51 +320,69 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
256
320
  }, {
257
321
  key: "mapFormToJSD",
258
322
  value: function () {
259
- var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(formValues) {
323
+ var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(formValues) {
260
324
  var entitlementInformation;
261
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
325
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
262
326
  while (1) {
263
- switch (_context3.prev = _context3.next) {
327
+ switch (_context4.prev = _context4.next) {
264
328
  case 0:
265
- _context3.next = 2;
329
+ _context4.next = 2;
266
330
  return this.getEntitlementInformation();
267
331
 
268
332
  case 2:
269
- entitlementInformation = _context3.sent;
270
- return _context3.abrupt("return", {
271
- fields: [].concat(_toConsumableArray(entitlementInformation !== null && entitlementInformation || []), [this.props.showTypeField ? {
272
- id: this.props.typeFieldId,
273
- value: this.getTypeFieldValue(formValues.type)
274
- } : undefined, {
275
- id: this.props.summaryFieldId,
276
- value: this.getSummary(formValues)
277
- }, {
278
- id: this.props.descriptionFieldId,
279
- value: this.getDescription(formValues)
280
- }, {
281
- id: this.props.emailFieldId,
282
- value: this.getEmail(formValues)
283
- }, {
284
- id: this.props.customerNameFieldId,
285
- value: this.getCustomerName()
286
- }, formValues.canBeContacted ? {
287
- id: this.props.canBeContactedFieldId,
288
- value: this.props.canBeContactedDefaultValue
289
- } : undefined, formValues.enrollInResearchGroup ? {
290
- id: this.props.enrollInResearchFieldId,
291
- value: this.props.enrollInResearchDefaultValue
292
- } : undefined], _toConsumableArray(this.props.additionalFields)).filter(Boolean)
333
+ entitlementInformation = _context4.sent;
334
+ _context4.t0 = [];
335
+ _context4.t1 = _toConsumableArray(entitlementInformation !== null && entitlementInformation || []);
336
+ _context4.t2 = this.props.showTypeField ? {
337
+ id: this.props.typeFieldId,
338
+ value: this.getTypeFieldValue(formValues.type)
339
+ } : undefined;
340
+ _context4.t3 = {
341
+ id: this.props.summaryFieldId,
342
+ value: this.getSummary(formValues)
343
+ };
344
+ _context4.t4 = {
345
+ id: this.props.descriptionFieldId,
346
+ value: this.getDescription(formValues)
347
+ };
348
+ _context4.t5 = this.props.emailFieldId;
349
+ _context4.next = 11;
350
+ return this.getEmail(formValues);
351
+
352
+ case 11:
353
+ _context4.t6 = _context4.sent;
354
+ _context4.t7 = {
355
+ id: _context4.t5,
356
+ value: _context4.t6
357
+ };
358
+ _context4.t8 = {
359
+ id: this.props.customerNameFieldId,
360
+ value: this.getCustomerName()
361
+ };
362
+ _context4.t9 = formValues.canBeContacted ? {
363
+ id: this.props.canBeContactedFieldId,
364
+ value: this.props.canBeContactedDefaultValue
365
+ } : undefined;
366
+ _context4.t10 = formValues.enrollInResearchGroup ? {
367
+ id: this.props.enrollInResearchFieldId,
368
+ value: this.props.enrollInResearchDefaultValue
369
+ } : undefined;
370
+ _context4.t11 = [_context4.t2, _context4.t3, _context4.t4, _context4.t7, _context4.t8, _context4.t9, _context4.t10];
371
+ _context4.t12 = _toConsumableArray(this.props.additionalFields);
372
+ _context4.t13 = _context4.t0.concat.call(_context4.t0, _context4.t1, _context4.t11, _context4.t12).filter(Boolean);
373
+ return _context4.abrupt("return", {
374
+ fields: _context4.t13
293
375
  });
294
376
 
295
- case 4:
377
+ case 20:
296
378
  case "end":
297
- return _context3.stop();
379
+ return _context4.stop();
298
380
  }
299
381
  }
300
- }, _callee3, this);
382
+ }, _callee4, this);
301
383
  }));
302
384
 
303
- function mapFormToJSD(_x2) {
385
+ function mapFormToJSD(_x3) {
304
386
  return _mapFormToJSD.apply(this, arguments);
305
387
  }
306
388
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -128,7 +128,7 @@ export default class FeedbackCollector extends Component<Props> {
128
128
  };
129
129
  getEntitlementInformation(): Promise<FieldType[] | []>;
130
130
  getTypeFieldValue(dtype: SelectValue): FieldValueType;
131
- getEmail(formValues: FormFields): Object;
131
+ getEmail(formValues: FormFields): Promise<any>;
132
132
  getDescription(formValues: FormFields): Object;
133
133
  getSummary(formValues: FormFields): Object;
134
134
  getCustomerName(): Object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "description": "A component that collects feedback across Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/select": "^15.2.0",
36
36
  "@atlaskit/textarea": "^4.3.0",
37
37
  "@atlaskit/theme": "^12.1.0",
38
- "@atlaskit/tokens": "^0.7.0",
38
+ "@atlaskit/tokens": "^0.8.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "react-intl-next": "npm:react-intl@^5.18.1"
41
41
  },
@@ -45,7 +45,6 @@
45
45
  "devDependencies": {
46
46
  "@atlaskit/docs": "*",
47
47
  "@atlaskit/logo": "^13.5.0",
48
- "@atlaskit/navigation-next": "^9.0.0",
49
48
  "@atlaskit/ssr": "*",
50
49
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
51
50
  "enzyme": "^3.10.0",