@atlaskit/feedback-collector 13.1.3 → 13.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 +10 -0
- package/dist/cjs/components/FeedbackCollector.js +93 -45
- package/dist/es2019/components/FeedbackCollector.js +27 -2
- package/dist/esm/components/FeedbackCollector.js +93 -45
- package/dist/types/components/FeedbackCollector.d.ts +5 -0
- package/dist/types-ts4.5/components/FeedbackCollector.d.ts +5 -0
- package/package.json +9 -3
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/feedback-collector
|
|
2
2
|
|
|
3
|
+
## 13.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#43003](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43003) [`84ce39f5f04`](https://bitbucket.org/atlassian/atlassian-frontend/commits/84ce39f5f04) - Fix shouldShowOptInCheckboxes to not always return undefined
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 13.1.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
18
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
19
|
var _buffer = require("buffer");
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _isApiGatewayUrl = require("../utils/is-api-gateway-url");
|
|
22
23
|
var _Truncate = _interopRequireDefault(require("../utils/Truncate"));
|
|
23
24
|
var _FeedbackForm = _interopRequireDefault(require("./FeedbackForm"));
|
|
@@ -43,6 +44,9 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
43
44
|
args[_key] = arguments[_key];
|
|
44
45
|
}
|
|
45
46
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
48
|
+
anonymousFeedback: true
|
|
49
|
+
});
|
|
46
50
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "postFeedback", /*#__PURE__*/function () {
|
|
47
51
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(formValues) {
|
|
48
52
|
var entrypointId, fetchUrl, formData, body, postData;
|
|
@@ -106,6 +110,32 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
106
110
|
return _this;
|
|
107
111
|
}
|
|
108
112
|
(0, _createClass2.default)(FeedbackCollector, [{
|
|
113
|
+
key: "componentDidMount",
|
|
114
|
+
value: function () {
|
|
115
|
+
var _componentDidMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
116
|
+
var anonymousFeedback;
|
|
117
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
118
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
_context2.next = 2;
|
|
121
|
+
return this.shouldShowOptInCheckboxesNew();
|
|
122
|
+
case 2:
|
|
123
|
+
anonymousFeedback = !_context2.sent;
|
|
124
|
+
this.setState({
|
|
125
|
+
anonymousFeedback: anonymousFeedback
|
|
126
|
+
});
|
|
127
|
+
case 4:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context2.stop();
|
|
130
|
+
}
|
|
131
|
+
}, _callee2, this);
|
|
132
|
+
}));
|
|
133
|
+
function componentDidMount() {
|
|
134
|
+
return _componentDidMount.apply(this, arguments);
|
|
135
|
+
}
|
|
136
|
+
return componentDidMount;
|
|
137
|
+
}()
|
|
138
|
+
}, {
|
|
109
139
|
key: "getGatewayUrl",
|
|
110
140
|
value: function getGatewayUrl() {
|
|
111
141
|
var _this$props = this.props,
|
|
@@ -136,20 +166,20 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
136
166
|
}, {
|
|
137
167
|
key: "getPackageVersion",
|
|
138
168
|
value: function getPackageVersion() {
|
|
139
|
-
return "13.
|
|
169
|
+
return "13.2.0" || 'Unknown, at least 11.0.0';
|
|
140
170
|
}
|
|
141
171
|
}, {
|
|
142
172
|
key: "getEntitlementInformation",
|
|
143
173
|
value: function () {
|
|
144
|
-
var _getEntitlementInformation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
174
|
+
var _getEntitlementInformation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
145
175
|
var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
|
|
146
176
|
var url, productName, productEntitlement, entitlementDetails, productKey, _document$querySelect, hasPremium, entitlement, entitlementInformation, cloudSiteId, _entitlementDetails3;
|
|
147
|
-
return _regenerator.default.wrap(function
|
|
148
|
-
while (1) switch (
|
|
177
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
178
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
179
|
case 0:
|
|
150
180
|
url = this.getGatewayUrl(); // jira / confluence / bitbucket / trello
|
|
151
181
|
if (!window.location.host.includes('bitbucket.org')) {
|
|
152
|
-
|
|
182
|
+
_context3.next = 9;
|
|
153
183
|
break;
|
|
154
184
|
}
|
|
155
185
|
productName = 'Bitbucket';
|
|
@@ -157,16 +187,16 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
157
187
|
entitlementDetails = JSON.parse(JSON.stringify((_document$querySelect = document.querySelector('meta[id="bb-bootstrap"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getAttribute('data-current-user')));
|
|
158
188
|
hasPremium = entitlementDetails['hasPremium'];
|
|
159
189
|
productEntitlement = hasPremium ? 'PREMIUM' : 'STANDARD';
|
|
160
|
-
|
|
190
|
+
_context3.next = 24;
|
|
161
191
|
break;
|
|
162
192
|
case 9:
|
|
163
193
|
if (!['trellis.coffee', 'trello.com'].includes(window.location.host)) {
|
|
164
|
-
|
|
194
|
+
_context3.next = 14;
|
|
165
195
|
break;
|
|
166
196
|
}
|
|
167
197
|
productName = 'Trello';
|
|
168
198
|
productKey = 'trello';
|
|
169
|
-
|
|
199
|
+
_context3.next = 24;
|
|
170
200
|
break;
|
|
171
201
|
case 14:
|
|
172
202
|
if (document.querySelector('meta[id="confluence-context-path"]')) {
|
|
@@ -176,8 +206,8 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
176
206
|
productName = 'Jira';
|
|
177
207
|
productKey = 'jira-software.ondemand';
|
|
178
208
|
}
|
|
179
|
-
|
|
180
|
-
|
|
209
|
+
_context3.prev = 15;
|
|
210
|
+
_context3.next = 18;
|
|
181
211
|
return fetch("".concat(url, "/customer-context/entitlements/").concat(window.location.host), _objectSpread({
|
|
182
212
|
method: 'GET',
|
|
183
213
|
headers: {
|
|
@@ -187,12 +217,12 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
187
217
|
credentials: 'include'
|
|
188
218
|
} : {}));
|
|
189
219
|
case 18:
|
|
190
|
-
entitlementDetails =
|
|
191
|
-
|
|
220
|
+
entitlementDetails = _context3.sent;
|
|
221
|
+
_context3.next = 24;
|
|
192
222
|
break;
|
|
193
223
|
case 21:
|
|
194
|
-
|
|
195
|
-
|
|
224
|
+
_context3.prev = 21;
|
|
225
|
+
_context3.t0 = _context3["catch"](15);
|
|
196
226
|
entitlementDetails = undefined;
|
|
197
227
|
case 24:
|
|
198
228
|
entitlementInformation = [];
|
|
@@ -215,12 +245,12 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
215
245
|
id: 'cloudId',
|
|
216
246
|
value: cloudSiteId
|
|
217
247
|
});
|
|
218
|
-
return
|
|
248
|
+
return _context3.abrupt("return", entitlementInformation);
|
|
219
249
|
case 29:
|
|
220
250
|
case "end":
|
|
221
|
-
return
|
|
251
|
+
return _context3.stop();
|
|
222
252
|
}
|
|
223
|
-
},
|
|
253
|
+
}, _callee3, this, [[15, 21]]);
|
|
224
254
|
}));
|
|
225
255
|
function getEntitlementInformation() {
|
|
226
256
|
return _getEntitlementInformation.apply(this, arguments);
|
|
@@ -247,21 +277,21 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
247
277
|
}, {
|
|
248
278
|
key: "getAtlassianID",
|
|
249
279
|
value: function () {
|
|
250
|
-
var _getAtlassianID = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
280
|
+
var _getAtlassianID = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
251
281
|
var _this$props3, atlassianAccountId, shouldGetEntitlementDetails, url, result, json;
|
|
252
|
-
return _regenerator.default.wrap(function
|
|
253
|
-
while (1) switch (
|
|
282
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
283
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
254
284
|
case 0:
|
|
255
285
|
_this$props3 = this.props, atlassianAccountId = _this$props3.atlassianAccountId, shouldGetEntitlementDetails = _this$props3.shouldGetEntitlementDetails;
|
|
256
|
-
|
|
286
|
+
_context4.prev = 1;
|
|
257
287
|
if (!(atlassianAccountId || !shouldGetEntitlementDetails)) {
|
|
258
|
-
|
|
288
|
+
_context4.next = 4;
|
|
259
289
|
break;
|
|
260
290
|
}
|
|
261
|
-
return
|
|
291
|
+
return _context4.abrupt("return", atlassianAccountId);
|
|
262
292
|
case 4:
|
|
263
293
|
url = this.getGatewayUrl();
|
|
264
|
-
|
|
294
|
+
_context4.next = 7;
|
|
265
295
|
return fetch("".concat(url, "/me"), _objectSpread({
|
|
266
296
|
method: 'GET',
|
|
267
297
|
headers: {
|
|
@@ -271,21 +301,21 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
271
301
|
credentials: 'include'
|
|
272
302
|
} : {}));
|
|
273
303
|
case 7:
|
|
274
|
-
result =
|
|
275
|
-
|
|
304
|
+
result = _context4.sent;
|
|
305
|
+
_context4.next = 10;
|
|
276
306
|
return result.json();
|
|
277
307
|
case 10:
|
|
278
|
-
json =
|
|
279
|
-
return
|
|
308
|
+
json = _context4.sent;
|
|
309
|
+
return _context4.abrupt("return", json.account_id);
|
|
280
310
|
case 14:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return
|
|
311
|
+
_context4.prev = 14;
|
|
312
|
+
_context4.t0 = _context4["catch"](1);
|
|
313
|
+
return _context4.abrupt("return", undefined);
|
|
284
314
|
case 17:
|
|
285
315
|
case "end":
|
|
286
|
-
return
|
|
316
|
+
return _context4.stop();
|
|
287
317
|
}
|
|
288
|
-
},
|
|
318
|
+
}, _callee4, this, [[1, 14]]);
|
|
289
319
|
}));
|
|
290
320
|
function getAtlassianID() {
|
|
291
321
|
return _getAtlassianID.apply(this, arguments);
|
|
@@ -310,6 +340,24 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
310
340
|
// @ts-ignore
|
|
311
341
|
return response;
|
|
312
342
|
}
|
|
343
|
+
}, {
|
|
344
|
+
key: "shouldShowOptInCheckboxesNew",
|
|
345
|
+
value: function shouldShowOptInCheckboxesNew() {
|
|
346
|
+
var _this2 = this;
|
|
347
|
+
return new Promise(function (resolve) {
|
|
348
|
+
if (_this2.props.anonymousFeedback) {
|
|
349
|
+
resolve(!_this2.props.anonymousFeedback);
|
|
350
|
+
}
|
|
351
|
+
if (_this2.props.atlassianAccountId) {
|
|
352
|
+
resolve(true);
|
|
353
|
+
}
|
|
354
|
+
_this2.getAtlassianID().then(function (result) {
|
|
355
|
+
resolve(result !== undefined);
|
|
356
|
+
}).catch(function () {
|
|
357
|
+
resolve(false);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}
|
|
313
361
|
}, {
|
|
314
362
|
key: "getDescription",
|
|
315
363
|
value: function getDescription(formValues) {
|
|
@@ -344,29 +392,29 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
344
392
|
}, {
|
|
345
393
|
key: "mapFormToJSD",
|
|
346
394
|
value: function () {
|
|
347
|
-
var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
395
|
+
var _mapFormToJSD = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(formValues) {
|
|
348
396
|
var entitlementInformation, atlassianID;
|
|
349
|
-
return _regenerator.default.wrap(function
|
|
350
|
-
while (1) switch (
|
|
397
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
398
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
351
399
|
case 0:
|
|
352
400
|
entitlementInformation = null;
|
|
353
401
|
if (!this.props.shouldGetEntitlementDetails) {
|
|
354
|
-
|
|
402
|
+
_context5.next = 5;
|
|
355
403
|
break;
|
|
356
404
|
}
|
|
357
|
-
|
|
405
|
+
_context5.next = 4;
|
|
358
406
|
return this.getEntitlementInformation();
|
|
359
407
|
case 4:
|
|
360
|
-
entitlementInformation =
|
|
408
|
+
entitlementInformation = _context5.sent;
|
|
361
409
|
case 5:
|
|
362
410
|
if (this.props.email) {
|
|
363
411
|
this.addEmailToContext();
|
|
364
412
|
}
|
|
365
|
-
|
|
413
|
+
_context5.next = 8;
|
|
366
414
|
return this.getAtlassianID();
|
|
367
415
|
case 8:
|
|
368
|
-
atlassianID =
|
|
369
|
-
return
|
|
416
|
+
atlassianID = _context5.sent;
|
|
417
|
+
return _context5.abrupt("return", {
|
|
370
418
|
fields: [].concat((0, _toConsumableArray2.default)(entitlementInformation !== null && entitlementInformation || []), [this.props.showTypeField ? {
|
|
371
419
|
id: this.props.typeFieldId,
|
|
372
420
|
value: this.getTypeFieldValue(formValues.type)
|
|
@@ -398,9 +446,9 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
398
446
|
});
|
|
399
447
|
case 10:
|
|
400
448
|
case "end":
|
|
401
|
-
return
|
|
449
|
+
return _context5.stop();
|
|
402
450
|
}
|
|
403
|
-
},
|
|
451
|
+
}, _callee5, this);
|
|
404
452
|
}));
|
|
405
453
|
function mapFormToJSD(_x2) {
|
|
406
454
|
return _mapFormToJSD.apply(this, arguments);
|
|
@@ -427,7 +475,7 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
427
475
|
onSubmit: this.postFeedback,
|
|
428
476
|
onClose: this.props.onClose,
|
|
429
477
|
locale: this.props.locale,
|
|
430
|
-
anonymousFeedback: anonymousFeedback,
|
|
478
|
+
anonymousFeedback: (0, _platformFeatureFlags.getBooleanFF)('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
|
|
431
479
|
selectLabel: this.props.selectLabel
|
|
432
480
|
});
|
|
433
481
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { isApiGatewayUrl } from '../utils/is-api-gateway-url';
|
|
5
6
|
import truncate from '../utils/Truncate';
|
|
6
7
|
import FeedbackForm from './FeedbackForm';
|
|
@@ -12,6 +13,9 @@ const singleLineTruncatedText = (text, length = MAX_SUMMARY_LENGTH_CHARS) => {
|
|
|
12
13
|
export default class FeedbackCollector extends Component {
|
|
13
14
|
constructor(...args) {
|
|
14
15
|
super(...args);
|
|
16
|
+
_defineProperty(this, "state", {
|
|
17
|
+
anonymousFeedback: true
|
|
18
|
+
});
|
|
15
19
|
_defineProperty(this, "postFeedback", async formValues => {
|
|
16
20
|
const entrypointId = this.props.entrypointId;
|
|
17
21
|
let fetchUrl = this.getFeedbackUrl();
|
|
@@ -54,6 +58,12 @@ export default class FeedbackCollector extends Component {
|
|
|
54
58
|
setTimeout(() => this.props.onSubmit(formValues), this.props.timeoutOnSubmit);
|
|
55
59
|
});
|
|
56
60
|
}
|
|
61
|
+
async componentDidMount() {
|
|
62
|
+
const anonymousFeedback = !(await this.shouldShowOptInCheckboxesNew());
|
|
63
|
+
this.setState({
|
|
64
|
+
anonymousFeedback
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
getGatewayUrl() {
|
|
58
68
|
const {
|
|
59
69
|
customGatewayUrl,
|
|
@@ -81,7 +91,7 @@ export default class FeedbackCollector extends Component {
|
|
|
81
91
|
return FeedbackCollector.defaultProps.url;
|
|
82
92
|
}
|
|
83
93
|
getPackageVersion() {
|
|
84
|
-
return "13.
|
|
94
|
+
return "13.2.0" || 'Unknown, at least 11.0.0';
|
|
85
95
|
}
|
|
86
96
|
async getEntitlementInformation() {
|
|
87
97
|
var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
|
|
@@ -203,6 +213,21 @@ export default class FeedbackCollector extends Component {
|
|
|
203
213
|
// @ts-ignore
|
|
204
214
|
return response;
|
|
205
215
|
}
|
|
216
|
+
shouldShowOptInCheckboxesNew() {
|
|
217
|
+
return new Promise(resolve => {
|
|
218
|
+
if (this.props.anonymousFeedback) {
|
|
219
|
+
resolve(!this.props.anonymousFeedback);
|
|
220
|
+
}
|
|
221
|
+
if (this.props.atlassianAccountId) {
|
|
222
|
+
resolve(true);
|
|
223
|
+
}
|
|
224
|
+
this.getAtlassianID().then(result => {
|
|
225
|
+
resolve(result !== undefined);
|
|
226
|
+
}).catch(() => {
|
|
227
|
+
resolve(false);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
206
231
|
getDescription(formValues) {
|
|
207
232
|
return formValues.description || this.props.descriptionDefaultValue;
|
|
208
233
|
}
|
|
@@ -285,7 +310,7 @@ export default class FeedbackCollector extends Component {
|
|
|
285
310
|
onSubmit: this.postFeedback,
|
|
286
311
|
onClose: this.props.onClose,
|
|
287
312
|
locale: this.props.locale,
|
|
288
|
-
anonymousFeedback: anonymousFeedback,
|
|
313
|
+
anonymousFeedback: getBooleanFF('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
|
|
289
314
|
selectLabel: this.props.selectLabel
|
|
290
315
|
});
|
|
291
316
|
}
|
|
@@ -14,6 +14,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
15
|
import { Buffer } from 'buffer';
|
|
16
16
|
import React, { Component } from 'react';
|
|
17
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { isApiGatewayUrl } from '../utils/is-api-gateway-url';
|
|
18
19
|
import truncate from '../utils/Truncate';
|
|
19
20
|
import FeedbackForm from './FeedbackForm';
|
|
@@ -33,6 +34,9 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
33
34
|
args[_key] = arguments[_key];
|
|
34
35
|
}
|
|
35
36
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
38
|
+
anonymousFeedback: true
|
|
39
|
+
});
|
|
36
40
|
_defineProperty(_assertThisInitialized(_this), "postFeedback", /*#__PURE__*/function () {
|
|
37
41
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(formValues) {
|
|
38
42
|
var entrypointId, fetchUrl, formData, body, postData;
|
|
@@ -96,6 +100,32 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
96
100
|
return _this;
|
|
97
101
|
}
|
|
98
102
|
_createClass(FeedbackCollector, [{
|
|
103
|
+
key: "componentDidMount",
|
|
104
|
+
value: function () {
|
|
105
|
+
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
106
|
+
var anonymousFeedback;
|
|
107
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
108
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
_context2.next = 2;
|
|
111
|
+
return this.shouldShowOptInCheckboxesNew();
|
|
112
|
+
case 2:
|
|
113
|
+
anonymousFeedback = !_context2.sent;
|
|
114
|
+
this.setState({
|
|
115
|
+
anonymousFeedback: anonymousFeedback
|
|
116
|
+
});
|
|
117
|
+
case 4:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context2.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee2, this);
|
|
122
|
+
}));
|
|
123
|
+
function componentDidMount() {
|
|
124
|
+
return _componentDidMount.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return componentDidMount;
|
|
127
|
+
}()
|
|
128
|
+
}, {
|
|
99
129
|
key: "getGatewayUrl",
|
|
100
130
|
value: function getGatewayUrl() {
|
|
101
131
|
var _this$props = this.props,
|
|
@@ -126,20 +156,20 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
126
156
|
}, {
|
|
127
157
|
key: "getPackageVersion",
|
|
128
158
|
value: function getPackageVersion() {
|
|
129
|
-
return "13.
|
|
159
|
+
return "13.2.0" || 'Unknown, at least 11.0.0';
|
|
130
160
|
}
|
|
131
161
|
}, {
|
|
132
162
|
key: "getEntitlementInformation",
|
|
133
163
|
value: function () {
|
|
134
|
-
var _getEntitlementInformation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
164
|
+
var _getEntitlementInformation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
135
165
|
var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
|
|
136
166
|
var url, productName, productEntitlement, entitlementDetails, productKey, _document$querySelect, hasPremium, entitlement, entitlementInformation, cloudSiteId, _entitlementDetails3;
|
|
137
|
-
return _regeneratorRuntime.wrap(function
|
|
138
|
-
while (1) switch (
|
|
167
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
168
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
139
169
|
case 0:
|
|
140
170
|
url = this.getGatewayUrl(); // jira / confluence / bitbucket / trello
|
|
141
171
|
if (!window.location.host.includes('bitbucket.org')) {
|
|
142
|
-
|
|
172
|
+
_context3.next = 9;
|
|
143
173
|
break;
|
|
144
174
|
}
|
|
145
175
|
productName = 'Bitbucket';
|
|
@@ -147,16 +177,16 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
147
177
|
entitlementDetails = JSON.parse(JSON.stringify((_document$querySelect = document.querySelector('meta[id="bb-bootstrap"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getAttribute('data-current-user')));
|
|
148
178
|
hasPremium = entitlementDetails['hasPremium'];
|
|
149
179
|
productEntitlement = hasPremium ? 'PREMIUM' : 'STANDARD';
|
|
150
|
-
|
|
180
|
+
_context3.next = 24;
|
|
151
181
|
break;
|
|
152
182
|
case 9:
|
|
153
183
|
if (!['trellis.coffee', 'trello.com'].includes(window.location.host)) {
|
|
154
|
-
|
|
184
|
+
_context3.next = 14;
|
|
155
185
|
break;
|
|
156
186
|
}
|
|
157
187
|
productName = 'Trello';
|
|
158
188
|
productKey = 'trello';
|
|
159
|
-
|
|
189
|
+
_context3.next = 24;
|
|
160
190
|
break;
|
|
161
191
|
case 14:
|
|
162
192
|
if (document.querySelector('meta[id="confluence-context-path"]')) {
|
|
@@ -166,8 +196,8 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
166
196
|
productName = 'Jira';
|
|
167
197
|
productKey = 'jira-software.ondemand';
|
|
168
198
|
}
|
|
169
|
-
|
|
170
|
-
|
|
199
|
+
_context3.prev = 15;
|
|
200
|
+
_context3.next = 18;
|
|
171
201
|
return fetch("".concat(url, "/customer-context/entitlements/").concat(window.location.host), _objectSpread({
|
|
172
202
|
method: 'GET',
|
|
173
203
|
headers: {
|
|
@@ -177,12 +207,12 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
177
207
|
credentials: 'include'
|
|
178
208
|
} : {}));
|
|
179
209
|
case 18:
|
|
180
|
-
entitlementDetails =
|
|
181
|
-
|
|
210
|
+
entitlementDetails = _context3.sent;
|
|
211
|
+
_context3.next = 24;
|
|
182
212
|
break;
|
|
183
213
|
case 21:
|
|
184
|
-
|
|
185
|
-
|
|
214
|
+
_context3.prev = 21;
|
|
215
|
+
_context3.t0 = _context3["catch"](15);
|
|
186
216
|
entitlementDetails = undefined;
|
|
187
217
|
case 24:
|
|
188
218
|
entitlementInformation = [];
|
|
@@ -205,12 +235,12 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
205
235
|
id: 'cloudId',
|
|
206
236
|
value: cloudSiteId
|
|
207
237
|
});
|
|
208
|
-
return
|
|
238
|
+
return _context3.abrupt("return", entitlementInformation);
|
|
209
239
|
case 29:
|
|
210
240
|
case "end":
|
|
211
|
-
return
|
|
241
|
+
return _context3.stop();
|
|
212
242
|
}
|
|
213
|
-
},
|
|
243
|
+
}, _callee3, this, [[15, 21]]);
|
|
214
244
|
}));
|
|
215
245
|
function getEntitlementInformation() {
|
|
216
246
|
return _getEntitlementInformation.apply(this, arguments);
|
|
@@ -237,21 +267,21 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
237
267
|
}, {
|
|
238
268
|
key: "getAtlassianID",
|
|
239
269
|
value: function () {
|
|
240
|
-
var _getAtlassianID = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
270
|
+
var _getAtlassianID = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
241
271
|
var _this$props3, atlassianAccountId, shouldGetEntitlementDetails, url, result, json;
|
|
242
|
-
return _regeneratorRuntime.wrap(function
|
|
243
|
-
while (1) switch (
|
|
272
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
273
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
244
274
|
case 0:
|
|
245
275
|
_this$props3 = this.props, atlassianAccountId = _this$props3.atlassianAccountId, shouldGetEntitlementDetails = _this$props3.shouldGetEntitlementDetails;
|
|
246
|
-
|
|
276
|
+
_context4.prev = 1;
|
|
247
277
|
if (!(atlassianAccountId || !shouldGetEntitlementDetails)) {
|
|
248
|
-
|
|
278
|
+
_context4.next = 4;
|
|
249
279
|
break;
|
|
250
280
|
}
|
|
251
|
-
return
|
|
281
|
+
return _context4.abrupt("return", atlassianAccountId);
|
|
252
282
|
case 4:
|
|
253
283
|
url = this.getGatewayUrl();
|
|
254
|
-
|
|
284
|
+
_context4.next = 7;
|
|
255
285
|
return fetch("".concat(url, "/me"), _objectSpread({
|
|
256
286
|
method: 'GET',
|
|
257
287
|
headers: {
|
|
@@ -261,21 +291,21 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
261
291
|
credentials: 'include'
|
|
262
292
|
} : {}));
|
|
263
293
|
case 7:
|
|
264
|
-
result =
|
|
265
|
-
|
|
294
|
+
result = _context4.sent;
|
|
295
|
+
_context4.next = 10;
|
|
266
296
|
return result.json();
|
|
267
297
|
case 10:
|
|
268
|
-
json =
|
|
269
|
-
return
|
|
298
|
+
json = _context4.sent;
|
|
299
|
+
return _context4.abrupt("return", json.account_id);
|
|
270
300
|
case 14:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return
|
|
301
|
+
_context4.prev = 14;
|
|
302
|
+
_context4.t0 = _context4["catch"](1);
|
|
303
|
+
return _context4.abrupt("return", undefined);
|
|
274
304
|
case 17:
|
|
275
305
|
case "end":
|
|
276
|
-
return
|
|
306
|
+
return _context4.stop();
|
|
277
307
|
}
|
|
278
|
-
},
|
|
308
|
+
}, _callee4, this, [[1, 14]]);
|
|
279
309
|
}));
|
|
280
310
|
function getAtlassianID() {
|
|
281
311
|
return _getAtlassianID.apply(this, arguments);
|
|
@@ -300,6 +330,24 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
300
330
|
// @ts-ignore
|
|
301
331
|
return response;
|
|
302
332
|
}
|
|
333
|
+
}, {
|
|
334
|
+
key: "shouldShowOptInCheckboxesNew",
|
|
335
|
+
value: function shouldShowOptInCheckboxesNew() {
|
|
336
|
+
var _this2 = this;
|
|
337
|
+
return new Promise(function (resolve) {
|
|
338
|
+
if (_this2.props.anonymousFeedback) {
|
|
339
|
+
resolve(!_this2.props.anonymousFeedback);
|
|
340
|
+
}
|
|
341
|
+
if (_this2.props.atlassianAccountId) {
|
|
342
|
+
resolve(true);
|
|
343
|
+
}
|
|
344
|
+
_this2.getAtlassianID().then(function (result) {
|
|
345
|
+
resolve(result !== undefined);
|
|
346
|
+
}).catch(function () {
|
|
347
|
+
resolve(false);
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
303
351
|
}, {
|
|
304
352
|
key: "getDescription",
|
|
305
353
|
value: function getDescription(formValues) {
|
|
@@ -334,29 +382,29 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
334
382
|
}, {
|
|
335
383
|
key: "mapFormToJSD",
|
|
336
384
|
value: function () {
|
|
337
|
-
var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
385
|
+
var _mapFormToJSD = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(formValues) {
|
|
338
386
|
var entitlementInformation, atlassianID;
|
|
339
|
-
return _regeneratorRuntime.wrap(function
|
|
340
|
-
while (1) switch (
|
|
387
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
388
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
341
389
|
case 0:
|
|
342
390
|
entitlementInformation = null;
|
|
343
391
|
if (!this.props.shouldGetEntitlementDetails) {
|
|
344
|
-
|
|
392
|
+
_context5.next = 5;
|
|
345
393
|
break;
|
|
346
394
|
}
|
|
347
|
-
|
|
395
|
+
_context5.next = 4;
|
|
348
396
|
return this.getEntitlementInformation();
|
|
349
397
|
case 4:
|
|
350
|
-
entitlementInformation =
|
|
398
|
+
entitlementInformation = _context5.sent;
|
|
351
399
|
case 5:
|
|
352
400
|
if (this.props.email) {
|
|
353
401
|
this.addEmailToContext();
|
|
354
402
|
}
|
|
355
|
-
|
|
403
|
+
_context5.next = 8;
|
|
356
404
|
return this.getAtlassianID();
|
|
357
405
|
case 8:
|
|
358
|
-
atlassianID =
|
|
359
|
-
return
|
|
406
|
+
atlassianID = _context5.sent;
|
|
407
|
+
return _context5.abrupt("return", {
|
|
360
408
|
fields: [].concat(_toConsumableArray(entitlementInformation !== null && entitlementInformation || []), [this.props.showTypeField ? {
|
|
361
409
|
id: this.props.typeFieldId,
|
|
362
410
|
value: this.getTypeFieldValue(formValues.type)
|
|
@@ -388,9 +436,9 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
388
436
|
});
|
|
389
437
|
case 10:
|
|
390
438
|
case "end":
|
|
391
|
-
return
|
|
439
|
+
return _context5.stop();
|
|
392
440
|
}
|
|
393
|
-
},
|
|
441
|
+
}, _callee5, this);
|
|
394
442
|
}));
|
|
395
443
|
function mapFormToJSD(_x2) {
|
|
396
444
|
return _mapFormToJSD.apply(this, arguments);
|
|
@@ -417,7 +465,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
|
|
|
417
465
|
onSubmit: this.postFeedback,
|
|
418
466
|
onClose: this.props.onClose,
|
|
419
467
|
locale: this.props.locale,
|
|
420
|
-
anonymousFeedback: anonymousFeedback,
|
|
468
|
+
anonymousFeedback: getBooleanFF('platform.proforma-form-builder-feedback_hupaz') ? this.state.anonymousFeedback : anonymousFeedback,
|
|
421
469
|
selectLabel: this.props.selectLabel
|
|
422
470
|
});
|
|
423
471
|
}
|
|
@@ -101,6 +101,10 @@ export interface Props {
|
|
|
101
101
|
selectLabel?: string;
|
|
102
102
|
}
|
|
103
103
|
export default class FeedbackCollector extends Component<Props> {
|
|
104
|
+
state: {
|
|
105
|
+
anonymousFeedback: boolean;
|
|
106
|
+
};
|
|
107
|
+
componentDidMount(): Promise<void>;
|
|
104
108
|
static defaultProps: {
|
|
105
109
|
url: string;
|
|
106
110
|
shouldGetEntitlementDetails: boolean;
|
|
@@ -156,6 +160,7 @@ export default class FeedbackCollector extends Component<Props> {
|
|
|
156
160
|
getTypeFieldValue(dtype: SelectValue): FieldValueType;
|
|
157
161
|
getAtlassianID(): Promise<string | undefined>;
|
|
158
162
|
shouldShowOptInCheckboxes(): boolean;
|
|
163
|
+
shouldShowOptInCheckboxesNew(): Promise<boolean>;
|
|
159
164
|
getDescription(formValues: FormFields): FieldValueType;
|
|
160
165
|
getSummary(formValues: FormFields): FieldValueType;
|
|
161
166
|
getCustomerName(): FieldValueType;
|
|
@@ -101,6 +101,10 @@ export interface Props {
|
|
|
101
101
|
selectLabel?: string;
|
|
102
102
|
}
|
|
103
103
|
export default class FeedbackCollector extends Component<Props> {
|
|
104
|
+
state: {
|
|
105
|
+
anonymousFeedback: boolean;
|
|
106
|
+
};
|
|
107
|
+
componentDidMount(): Promise<void>;
|
|
104
108
|
static defaultProps: {
|
|
105
109
|
url: string;
|
|
106
110
|
shouldGetEntitlementDetails: boolean;
|
|
@@ -157,6 +161,7 @@ export default class FeedbackCollector extends Component<Props> {
|
|
|
157
161
|
getTypeFieldValue(dtype: SelectValue): FieldValueType;
|
|
158
162
|
getAtlassianID(): Promise<string | undefined>;
|
|
159
163
|
shouldShowOptInCheckboxes(): boolean;
|
|
164
|
+
shouldShowOptInCheckboxesNew(): Promise<boolean>;
|
|
160
165
|
getDescription(formValues: FormFields): FieldValueType;
|
|
161
166
|
getSummary(formValues: FormFields): FieldValueType;
|
|
162
167
|
getCustomerName(): FieldValueType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/feedback-collector",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "A component that collects feedback across Atlassian products.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@atlaskit/button": "^16.
|
|
37
|
+
"@atlaskit/button": "^16.15.0",
|
|
38
38
|
"@atlaskit/checkbox": "^13.0.0",
|
|
39
39
|
"@atlaskit/flag": "^15.2.0",
|
|
40
40
|
"@atlaskit/form": "^9.0.0",
|
|
41
41
|
"@atlaskit/icon": "^21.12.0",
|
|
42
42
|
"@atlaskit/modal-dialog": "^12.8.0",
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
43
44
|
"@atlaskit/section-message": "^6.4.0",
|
|
44
45
|
"@atlaskit/select": "^16.7.0",
|
|
45
46
|
"@atlaskit/textarea": "^4.7.0",
|
|
@@ -81,5 +82,10 @@
|
|
|
81
82
|
]
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
85
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
86
|
+
"platform-feature-flags": {
|
|
87
|
+
"platform.proforma-form-builder-feedback_hupaz": {
|
|
88
|
+
"type": "boolean"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
85
91
|
}
|
package/report.api.md
CHANGED
|
@@ -39,6 +39,8 @@ class FeedbackCollector extends Component<Props> {
|
|
|
39
39
|
// (undocumented)
|
|
40
40
|
addEmailToContext(): void;
|
|
41
41
|
// (undocumented)
|
|
42
|
+
componentDidMount(): Promise<void>;
|
|
43
|
+
// (undocumented)
|
|
42
44
|
static defaultProps: {
|
|
43
45
|
url: string;
|
|
44
46
|
shouldGetEntitlementDetails: boolean;
|
|
@@ -113,6 +115,12 @@ class FeedbackCollector extends Component<Props> {
|
|
|
113
115
|
render(): JSX.Element;
|
|
114
116
|
// (undocumented)
|
|
115
117
|
shouldShowOptInCheckboxes(): boolean;
|
|
118
|
+
// (undocumented)
|
|
119
|
+
shouldShowOptInCheckboxesNew(): Promise<boolean>;
|
|
120
|
+
// (undocumented)
|
|
121
|
+
state: {
|
|
122
|
+
anonymousFeedback: boolean;
|
|
123
|
+
};
|
|
116
124
|
}
|
|
117
125
|
export default FeedbackCollector;
|
|
118
126
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ class FeedbackCollector extends Component<Props> {
|
|
|
28
28
|
// (undocumented)
|
|
29
29
|
addEmailToContext(): void;
|
|
30
30
|
// (undocumented)
|
|
31
|
+
componentDidMount(): Promise<void>;
|
|
32
|
+
// (undocumented)
|
|
31
33
|
static defaultProps: {
|
|
32
34
|
url: string;
|
|
33
35
|
shouldGetEntitlementDetails: boolean;
|
|
@@ -102,6 +104,12 @@ class FeedbackCollector extends Component<Props> {
|
|
|
102
104
|
render(): JSX.Element;
|
|
103
105
|
// (undocumented)
|
|
104
106
|
shouldShowOptInCheckboxes(): boolean;
|
|
107
|
+
// (undocumented)
|
|
108
|
+
shouldShowOptInCheckboxesNew(): Promise<boolean>;
|
|
109
|
+
// (undocumented)
|
|
110
|
+
state: {
|
|
111
|
+
anonymousFeedback: boolean;
|
|
112
|
+
};
|
|
105
113
|
}
|
|
106
114
|
export default FeedbackCollector;
|
|
107
115
|
|