@atlaskit/feedback-collector 10.0.1 → 10.3.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.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7891017f3f9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7891017f3f9) - use hash of userid or email instead of sending PII
8
+
9
+ ## 10.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`1781fc857bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1781fc857bd) - add email from logged in user
14
+
15
+ ## 10.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`b35b73e9670`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b35b73e9670) - Use correct requestTypeId for feedback collector
20
+
3
21
  ## 10.0.1
4
22
 
5
23
  ### Patch 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),
@@ -259,10 +259,86 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
259
259
  }
260
260
  }
261
261
  }, {
262
- key: "getEmail",
263
- value: function getEmail(formValues) {
264
- return formValues.canBeContacted && this.props.email ? this.props.email : this.props.emailDefaultValue;
265
- }
262
+ key: "getEmailAndAtlassianID",
263
+ value: function () {
264
+ var _getEmailAndAtlassianID = (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", {
283
+ email: this.props.email,
284
+ aaidOrHash: Buffer.from(this.props.email).toString('base64')
285
+ });
286
+
287
+ case 4:
288
+ url = this.props.url;
289
+ _context3.next = 7;
290
+ return fetch("".concat(url, "/me"), {
291
+ method: 'GET',
292
+ headers: {
293
+ 'Content-Type': 'application/json'
294
+ },
295
+ credentials: 'include'
296
+ });
297
+
298
+ case 7:
299
+ result = _context3.sent;
300
+ _context3.next = 10;
301
+ return result.json();
302
+
303
+ case 10:
304
+ json = _context3.sent;
305
+ return _context3.abrupt("return", {
306
+ email: json.email,
307
+ aaidOrHash: json.account_id
308
+ });
309
+
310
+ case 14:
311
+ return _context3.abrupt("return", {
312
+ email: this.props.emailDefaultValue,
313
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
314
+ });
315
+
316
+ case 15:
317
+ _context3.next = 20;
318
+ break;
319
+
320
+ case 17:
321
+ _context3.prev = 17;
322
+ _context3.t0 = _context3["catch"](0);
323
+ return _context3.abrupt("return", {
324
+ email: this.props.emailDefaultValue,
325
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
326
+ });
327
+
328
+ case 20:
329
+ case "end":
330
+ return _context3.stop();
331
+ }
332
+ }
333
+ }, _callee3, this, [[0, 17]]);
334
+ }));
335
+
336
+ function getEmailAndAtlassianID(_x2) {
337
+ return _getEmailAndAtlassianID.apply(this, arguments);
338
+ }
339
+
340
+ return getEmailAndAtlassianID;
341
+ }()
266
342
  }, {
267
343
  key: "getDescription",
268
344
  value: function getDescription(formValues) {
@@ -281,51 +357,78 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
281
357
  }, {
282
358
  key: "mapFormToJSD",
283
359
  value: function () {
284
- var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(formValues) {
360
+ var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(formValues) {
285
361
  var entitlementInformation;
286
- return _regenerator.default.wrap(function _callee3$(_context3) {
362
+ return _regenerator.default.wrap(function _callee4$(_context4) {
287
363
  while (1) {
288
- switch (_context3.prev = _context3.next) {
364
+ switch (_context4.prev = _context4.next) {
289
365
  case 0:
290
- _context3.next = 2;
366
+ _context4.next = 2;
291
367
  return this.getEntitlementInformation();
292
368
 
293
369
  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)
370
+ entitlementInformation = _context4.sent;
371
+ _context4.t0 = [];
372
+ _context4.t1 = (0, _toConsumableArray2.default)(entitlementInformation !== null && entitlementInformation || []);
373
+ _context4.t2 = this.props.showTypeField ? {
374
+ id: this.props.typeFieldId,
375
+ value: this.getTypeFieldValue(formValues.type)
376
+ } : undefined;
377
+ _context4.t3 = {
378
+ id: this.props.summaryFieldId,
379
+ value: this.getSummary(formValues)
380
+ };
381
+ _context4.t4 = {
382
+ id: this.props.descriptionFieldId,
383
+ value: this.getDescription(formValues)
384
+ };
385
+ _context4.t5 = this.props.emailFieldId;
386
+ _context4.next = 11;
387
+ return this.getEmailAndAtlassianID(formValues);
388
+
389
+ case 11:
390
+ _context4.t6 = _context4.sent.email;
391
+ _context4.t7 = {
392
+ id: _context4.t5,
393
+ value: _context4.t6
394
+ };
395
+ _context4.next = 15;
396
+ return this.getEmailAndAtlassianID(formValues);
397
+
398
+ case 15:
399
+ _context4.t8 = _context4.sent.aaidOrHash;
400
+ _context4.t9 = {
401
+ id: 'aaidOrHash',
402
+ value: _context4.t8
403
+ };
404
+ _context4.t10 = {
405
+ id: this.props.customerNameFieldId,
406
+ value: this.getCustomerName()
407
+ };
408
+ _context4.t11 = formValues.canBeContacted ? {
409
+ id: this.props.canBeContactedFieldId,
410
+ value: this.props.canBeContactedDefaultValue
411
+ } : undefined;
412
+ _context4.t12 = formValues.enrollInResearchGroup ? {
413
+ id: this.props.enrollInResearchFieldId,
414
+ value: this.props.enrollInResearchDefaultValue
415
+ } : undefined;
416
+ _context4.t13 = [_context4.t2, _context4.t3, _context4.t4, _context4.t7, _context4.t9, _context4.t10, _context4.t11, _context4.t12];
417
+ _context4.t14 = (0, _toConsumableArray2.default)(this.props.additionalFields);
418
+ _context4.t15 = _context4.t0.concat.call(_context4.t0, _context4.t1, _context4.t13, _context4.t14).filter(Boolean);
419
+ return _context4.abrupt("return", {
420
+ fields: _context4.t15
318
421
  });
319
422
 
320
- case 4:
423
+ case 24:
321
424
  case "end":
322
- return _context3.stop();
425
+ return _context4.stop();
323
426
  }
324
427
  }
325
- }, _callee3, this);
428
+ }, _callee4, this);
326
429
  }));
327
430
 
328
- function mapFormToJSD(_x2) {
431
+ function mapFormToJSD(_x3) {
329
432
  return _mapFormToJSD.apply(this, arguments);
330
433
  }
331
434
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.1",
3
+ "version": "10.3.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,41 @@ 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 getEmailAndAtlassianID(formValues) {
148
+ try {
149
+ if (formValues.canBeContacted) {
150
+ if (this.props.email) {
151
+ return {
152
+ email: this.props.email,
153
+ aaidOrHash: Buffer.from(this.props.email).toString('base64')
154
+ };
155
+ }
156
+
157
+ const url = this.props.url;
158
+ const result = await fetch(`${url}/me`, {
159
+ method: 'GET',
160
+ headers: {
161
+ 'Content-Type': 'application/json'
162
+ },
163
+ credentials: 'include'
164
+ });
165
+ const json = await result.json();
166
+ return {
167
+ email: json.email,
168
+ aaidOrHash: json.account_id
169
+ };
170
+ } else {
171
+ return {
172
+ email: this.props.emailDefaultValue,
173
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
174
+ };
175
+ }
176
+ } catch (e) {
177
+ return {
178
+ email: this.props.emailDefaultValue,
179
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
180
+ };
181
+ }
149
182
  }
150
183
 
151
184
  getDescription(formValues) {
@@ -174,7 +207,10 @@ export default class FeedbackCollector extends Component {
174
207
  value: this.getDescription(formValues)
175
208
  }, {
176
209
  id: this.props.emailFieldId,
177
- value: this.getEmail(formValues)
210
+ value: (await this.getEmailAndAtlassianID(formValues)).email
211
+ }, {
212
+ id: 'aaidOrHash',
213
+ value: (await this.getEmailAndAtlassianID(formValues)).aaidOrHash
178
214
  }, {
179
215
  id: this.props.customerNameFieldId,
180
216
  value: this.getCustomerName()
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.1",
3
+ "version": "10.3.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),
@@ -234,10 +234,86 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
234
234
  }
235
235
  }
236
236
  }, {
237
- key: "getEmail",
238
- value: function getEmail(formValues) {
239
- return formValues.canBeContacted && this.props.email ? this.props.email : this.props.emailDefaultValue;
240
- }
237
+ key: "getEmailAndAtlassianID",
238
+ value: function () {
239
+ var _getEmailAndAtlassianID = _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", {
258
+ email: this.props.email,
259
+ aaidOrHash: Buffer.from(this.props.email).toString('base64')
260
+ });
261
+
262
+ case 4:
263
+ url = this.props.url;
264
+ _context3.next = 7;
265
+ return fetch("".concat(url, "/me"), {
266
+ method: 'GET',
267
+ headers: {
268
+ 'Content-Type': 'application/json'
269
+ },
270
+ credentials: 'include'
271
+ });
272
+
273
+ case 7:
274
+ result = _context3.sent;
275
+ _context3.next = 10;
276
+ return result.json();
277
+
278
+ case 10:
279
+ json = _context3.sent;
280
+ return _context3.abrupt("return", {
281
+ email: json.email,
282
+ aaidOrHash: json.account_id
283
+ });
284
+
285
+ case 14:
286
+ return _context3.abrupt("return", {
287
+ email: this.props.emailDefaultValue,
288
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
289
+ });
290
+
291
+ case 15:
292
+ _context3.next = 20;
293
+ break;
294
+
295
+ case 17:
296
+ _context3.prev = 17;
297
+ _context3.t0 = _context3["catch"](0);
298
+ return _context3.abrupt("return", {
299
+ email: this.props.emailDefaultValue,
300
+ aaidOrHash: Buffer.from(this.props.emailDefaultValue).toString('base64')
301
+ });
302
+
303
+ case 20:
304
+ case "end":
305
+ return _context3.stop();
306
+ }
307
+ }
308
+ }, _callee3, this, [[0, 17]]);
309
+ }));
310
+
311
+ function getEmailAndAtlassianID(_x2) {
312
+ return _getEmailAndAtlassianID.apply(this, arguments);
313
+ }
314
+
315
+ return getEmailAndAtlassianID;
316
+ }()
241
317
  }, {
242
318
  key: "getDescription",
243
319
  value: function getDescription(formValues) {
@@ -256,51 +332,78 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
256
332
  }, {
257
333
  key: "mapFormToJSD",
258
334
  value: function () {
259
- var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(formValues) {
335
+ var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(formValues) {
260
336
  var entitlementInformation;
261
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
337
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
262
338
  while (1) {
263
- switch (_context3.prev = _context3.next) {
339
+ switch (_context4.prev = _context4.next) {
264
340
  case 0:
265
- _context3.next = 2;
341
+ _context4.next = 2;
266
342
  return this.getEntitlementInformation();
267
343
 
268
344
  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)
345
+ entitlementInformation = _context4.sent;
346
+ _context4.t0 = [];
347
+ _context4.t1 = _toConsumableArray(entitlementInformation !== null && entitlementInformation || []);
348
+ _context4.t2 = this.props.showTypeField ? {
349
+ id: this.props.typeFieldId,
350
+ value: this.getTypeFieldValue(formValues.type)
351
+ } : undefined;
352
+ _context4.t3 = {
353
+ id: this.props.summaryFieldId,
354
+ value: this.getSummary(formValues)
355
+ };
356
+ _context4.t4 = {
357
+ id: this.props.descriptionFieldId,
358
+ value: this.getDescription(formValues)
359
+ };
360
+ _context4.t5 = this.props.emailFieldId;
361
+ _context4.next = 11;
362
+ return this.getEmailAndAtlassianID(formValues);
363
+
364
+ case 11:
365
+ _context4.t6 = _context4.sent.email;
366
+ _context4.t7 = {
367
+ id: _context4.t5,
368
+ value: _context4.t6
369
+ };
370
+ _context4.next = 15;
371
+ return this.getEmailAndAtlassianID(formValues);
372
+
373
+ case 15:
374
+ _context4.t8 = _context4.sent.aaidOrHash;
375
+ _context4.t9 = {
376
+ id: 'aaidOrHash',
377
+ value: _context4.t8
378
+ };
379
+ _context4.t10 = {
380
+ id: this.props.customerNameFieldId,
381
+ value: this.getCustomerName()
382
+ };
383
+ _context4.t11 = formValues.canBeContacted ? {
384
+ id: this.props.canBeContactedFieldId,
385
+ value: this.props.canBeContactedDefaultValue
386
+ } : undefined;
387
+ _context4.t12 = formValues.enrollInResearchGroup ? {
388
+ id: this.props.enrollInResearchFieldId,
389
+ value: this.props.enrollInResearchDefaultValue
390
+ } : undefined;
391
+ _context4.t13 = [_context4.t2, _context4.t3, _context4.t4, _context4.t7, _context4.t9, _context4.t10, _context4.t11, _context4.t12];
392
+ _context4.t14 = _toConsumableArray(this.props.additionalFields);
393
+ _context4.t15 = _context4.t0.concat.call(_context4.t0, _context4.t1, _context4.t13, _context4.t14).filter(Boolean);
394
+ return _context4.abrupt("return", {
395
+ fields: _context4.t15
293
396
  });
294
397
 
295
- case 4:
398
+ case 24:
296
399
  case "end":
297
- return _context3.stop();
400
+ return _context4.stop();
298
401
  }
299
402
  }
300
- }, _callee3, this);
403
+ }, _callee4, this);
301
404
  }));
302
405
 
303
- function mapFormToJSD(_x2) {
406
+ function mapFormToJSD(_x3) {
304
407
  return _mapFormToJSD.apply(this, arguments);
305
408
  }
306
409
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.1",
3
+ "version": "10.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -128,7 +128,10 @@ 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
+ getEmailAndAtlassianID(formValues: FormFields): Promise<{
132
+ email: any;
133
+ aaidOrHash: any;
134
+ }>;
132
135
  getDescription(formValues: FormFields): Object;
133
136
  getSummary(formValues: FormFields): Object;
134
137
  getCustomerName(): Object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "10.0.1",
3
+ "version": "10.3.0",
4
4
  "description": "A component that collects feedback across Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"