@atlaskit/editor-core 190.1.27 → 190.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/presets/universal.js +6 -2
  5. package/dist/cjs/ui/ToolbarFeedback/index.js +20 -17
  6. package/dist/cjs/version-wrapper.js +1 -1
  7. package/dist/es2019/plugins/index.js +0 -1
  8. package/dist/es2019/presets/universal.js +7 -2
  9. package/dist/es2019/ui/ToolbarFeedback/index.js +23 -8
  10. package/dist/es2019/version-wrapper.js +1 -1
  11. package/dist/esm/plugins/index.js +0 -1
  12. package/dist/esm/presets/universal.js +6 -2
  13. package/dist/esm/ui/ToolbarFeedback/index.js +20 -17
  14. package/dist/esm/version-wrapper.js +1 -1
  15. package/dist/types/editor.d.ts +2 -1
  16. package/dist/types/plugins/index.d.ts +0 -1
  17. package/dist/types/types/editor-props.d.ts +1 -10
  18. package/dist/types/types/index.d.ts +1 -1
  19. package/dist/types-ts4.5/editor.d.ts +2 -1
  20. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  21. package/dist/types-ts4.5/types/editor-props.d.ts +1 -10
  22. package/dist/types-ts4.5/types/index.d.ts +1 -1
  23. package/package.json +5 -4
  24. package/dist/cjs/plugins/feedback-dialog/getBrowserInfo.js +0 -70
  25. package/dist/cjs/plugins/feedback-dialog/getDeviceInfo.js +0 -118
  26. package/dist/cjs/plugins/feedback-dialog/index.js +0 -127
  27. package/dist/cjs/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +0 -67
  28. package/dist/cjs/utils/pick-by.js +0 -16
  29. package/dist/es2019/plugins/feedback-dialog/getBrowserInfo.js +0 -64
  30. package/dist/es2019/plugins/feedback-dialog/getDeviceInfo.js +0 -112
  31. package/dist/es2019/plugins/feedback-dialog/index.js +0 -82
  32. package/dist/es2019/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +0 -47
  33. package/dist/es2019/utils/pick-by.js +0 -5
  34. package/dist/esm/plugins/feedback-dialog/getBrowserInfo.js +0 -64
  35. package/dist/esm/plugins/feedback-dialog/getDeviceInfo.js +0 -112
  36. package/dist/esm/plugins/feedback-dialog/index.js +0 -120
  37. package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +0 -60
  38. package/dist/esm/utils/pick-by.js +0 -9
  39. package/dist/types/plugins/feedback-dialog/getBrowserInfo.d.ts +0 -6
  40. package/dist/types/plugins/feedback-dialog/getDeviceInfo.d.ts +0 -6
  41. package/dist/types/plugins/feedback-dialog/index.d.ts +0 -10
  42. package/dist/types/plugins/feedback-dialog/loadJiraCollectorDialogScript.d.ts +0 -8
  43. package/dist/types/utils/pick-by.d.ts +0 -2
  44. package/dist/types-ts4.5/plugins/feedback-dialog/getBrowserInfo.d.ts +0 -6
  45. package/dist/types-ts4.5/plugins/feedback-dialog/getDeviceInfo.d.ts +0 -6
  46. package/dist/types-ts4.5/plugins/feedback-dialog/index.d.ts +0 -12
  47. package/dist/types-ts4.5/plugins/feedback-dialog/loadJiraCollectorDialogScript.d.ts +0 -8
  48. package/dist/types-ts4.5/utils/pick-by.d.ts +0 -2
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * Inspired from:
9
- * https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript
10
- */
11
- var getDeviceInfo = function getDeviceInfo(nAgt, nVersion) {
12
- var os = '';
13
- var osVersion = '';
14
- var clientStrings = [{
15
- s: 'Windows 3.11',
16
- r: /Win16/
17
- }, {
18
- s: 'Windows 95',
19
- r: /(Windows 95|Win95|Windows_95)/
20
- }, {
21
- s: 'Windows ME',
22
- r: /(Win 9x 4.90|Windows ME)/
23
- }, {
24
- s: 'Windows 98',
25
- r: /(Windows 98|Win98)/
26
- }, {
27
- s: 'Windows CE',
28
- r: /Windows CE/
29
- }, {
30
- s: 'Windows 2000',
31
- r: /(Windows NT 5.0|Windows 2000)/
32
- }, {
33
- s: 'Windows XP',
34
- r: /(Windows NT 5.1|Windows XP)/
35
- }, {
36
- s: 'Windows Server 2003',
37
- r: /Windows NT 5.2/
38
- }, {
39
- s: 'Windows Vista',
40
- r: /Windows NT 6.0/
41
- }, {
42
- s: 'Windows 7',
43
- r: /(Windows 7|Windows NT 6.1)/
44
- }, {
45
- s: 'Windows 8.1',
46
- r: /(Windows 8.1|Windows NT 6.3)/
47
- }, {
48
- s: 'Windows 8',
49
- r: /(Windows 8|Windows NT 6.2)/
50
- }, {
51
- s: 'Windows NT 4.0',
52
- r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/
53
- }, {
54
- s: 'Android',
55
- r: /Android/
56
- }, {
57
- s: 'Open BSD',
58
- r: /OpenBSD/
59
- }, {
60
- s: 'Sun OS',
61
- r: /SunOS/
62
- }, {
63
- s: 'Linux',
64
- r: /(Linux|X11)/
65
- }, {
66
- s: 'iOS',
67
- r: /(iPhone|iPad|iPod)/
68
- }, {
69
- s: 'Mac OS X',
70
- r: /Mac OS X/
71
- }, {
72
- s: 'Mac OS',
73
- r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/
74
- }, {
75
- s: 'QNX',
76
- r: /QNX/
77
- }, {
78
- s: 'UNIX',
79
- r: /UNIX/
80
- }, {
81
- s: 'BeOS',
82
- r: /BeOS/
83
- }, {
84
- s: 'OS/2',
85
- r: /OS\/2/
86
- }, {
87
- s: 'Search Bot',
88
- r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
89
- }];
90
- for (var client in clientStrings) {
91
- var clientObj = clientStrings[client];
92
- if (clientObj.r.test(nAgt)) {
93
- os = clientObj.s;
94
- break;
95
- }
96
- }
97
- var match;
98
- if (/Windows/.test(os)) {
99
- match = /Windows (.*)/.exec(os);
100
- osVersion = match && match[1];
101
- os = 'Windows';
102
- }
103
- switch (os) {
104
- case 'Mac OS X':
105
- match = /Mac OS X (10[\.\_\d]+)/.exec(nAgt);
106
- osVersion = match && match[1];
107
- break;
108
- case 'Android':
109
- match = /Android ([\.\_\d]+)/.exec(nAgt);
110
- osVersion = match && match[1];
111
- break;
112
- case 'iOS':
113
- match = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVersion);
114
- osVersion = match && match[1] + '.' + match[2] + '.' + (match[3] || 0);
115
- }
116
- return "".concat(os, " ").concat(osVersion);
117
- };
118
- var _default = exports.default = getDeviceInfo;
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.openFeedbackDialog = exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
- var _react = _interopRequireDefault(require("react"));
13
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
14
- var _versionWrapper = require("../../version-wrapper");
15
- var _analytics = require("@atlaskit/editor-common/analytics");
16
- var _loadJiraCollectorDialogScript = _interopRequireDefault(require("./loadJiraCollectorDialogScript"));
17
- var _messages = require("@atlaskit/editor-common/messages");
18
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- var showJiraCollectorDialog;
21
- var feedbackInfoHash;
22
- var defaultFeedbackInfo;
23
- var hashFeedbackInfo = function hashFeedbackInfo(feedbackInfo) {
24
- var product = feedbackInfo.product,
25
- packageName = feedbackInfo.packageName,
26
- packageVersion = feedbackInfo.packageVersion,
27
- labels = feedbackInfo.labels;
28
- return [product, packageName, packageVersion].concat((0, _toConsumableArray2.default)(labels || [])).join('|');
29
- };
30
- var openFeedbackDialog = exports.openFeedbackDialog = /*#__PURE__*/function () {
31
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(feedbackInfo) {
32
- return _regenerator.default.wrap(function _callee2$(_context2) {
33
- while (1) switch (_context2.prev = _context2.next) {
34
- case 0:
35
- return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
36
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
37
- var combinedFeedbackInfo, newFeedbackInfoHash, timeoutId;
38
- return _regenerator.default.wrap(function _callee$(_context) {
39
- while (1) switch (_context.prev = _context.next) {
40
- case 0:
41
- combinedFeedbackInfo = _objectSpread(_objectSpread(_objectSpread({}, {
42
- product: 'n/a',
43
- labels: [],
44
- packageName: '',
45
- packageVersion: '',
46
- sessionId: '',
47
- contentId: '',
48
- tabId: ''
49
- }), defaultFeedbackInfo), feedbackInfo);
50
- newFeedbackInfoHash = hashFeedbackInfo(combinedFeedbackInfo);
51
- if (!(!showJiraCollectorDialog || feedbackInfoHash !== newFeedbackInfoHash)) {
52
- _context.next = 13;
53
- break;
54
- }
55
- _context.prev = 3;
56
- _context.next = 6;
57
- return (0, _loadJiraCollectorDialogScript.default)([combinedFeedbackInfo.product].concat((0, _toConsumableArray2.default)(combinedFeedbackInfo.labels)), combinedFeedbackInfo.packageName, _versionWrapper.version, combinedFeedbackInfo.packageVersion, combinedFeedbackInfo.sessionId, combinedFeedbackInfo.contentId, combinedFeedbackInfo.tabId);
58
- case 6:
59
- showJiraCollectorDialog = _context.sent;
60
- feedbackInfoHash = newFeedbackInfoHash;
61
- _context.next = 13;
62
- break;
63
- case 10:
64
- _context.prev = 10;
65
- _context.t0 = _context["catch"](3);
66
- reject(_context.t0);
67
- case 13:
68
- timeoutId = window.setTimeout(showJiraCollectorDialog, 0); // Return the timoutId for consumers to call clearTimeout if they need to.
69
- resolve(timeoutId);
70
- case 15:
71
- case "end":
72
- return _context.stop();
73
- }
74
- }, _callee, null, [[3, 10]]);
75
- }));
76
- return function (_x2, _x3) {
77
- return _ref2.apply(this, arguments);
78
- };
79
- }()));
80
- case 1:
81
- case "end":
82
- return _context2.stop();
83
- }
84
- }, _callee2);
85
- }));
86
- return function openFeedbackDialog(_x) {
87
- return _ref.apply(this, arguments);
88
- };
89
- }();
90
- var feedbackDialog = function feedbackDialog(_ref3) {
91
- var feedbackInfo = _ref3.config,
92
- api = _ref3.api;
93
- defaultFeedbackInfo = feedbackInfo !== null && feedbackInfo !== void 0 ? feedbackInfo : {};
94
- return {
95
- name: 'feedbackDialog',
96
- pluginsOptions: {
97
- quickInsert: function quickInsert(_ref4) {
98
- var formatMessage = _ref4.formatMessage;
99
- return [{
100
- id: 'feedbackdialog',
101
- title: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialog),
102
- description: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialogDescription),
103
- priority: 400,
104
- keywords: ['bug'],
105
- icon: function icon() {
106
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFeedback, null);
107
- },
108
- action: function action(insert, state) {
109
- var _api$analytics;
110
- var tr = insert('');
111
- openFeedbackDialog(feedbackInfo);
112
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
113
- action: _analytics.ACTION.OPENED,
114
- actionSubject: _analytics.ACTION_SUBJECT.FEEDBACK_DIALOG,
115
- attributes: {
116
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
117
- },
118
- eventType: _analytics.EVENT_TYPE.UI
119
- })(tr);
120
- return tr;
121
- }
122
- }];
123
- }
124
- }
125
- };
126
- };
127
- var _default = exports.default = feedbackDialog;
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _getDeviceInfo = _interopRequireDefault(require("./getDeviceInfo"));
11
- var _getBrowserInfo = _interopRequireDefault(require("./getBrowserInfo"));
12
- var JIRA_ISSUE_COLLECTOR_URL = 'https://product-fabric.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/-w0bwo4/b/14/e73395c53c3b10fde2303f4bf74ffbf6/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-US&collectorId=98644b9c';
13
- var loadJiraCollectorDialogScript = function loadJiraCollectorDialogScript(labels, packageName, coreVersion, packageVersion, sessionId, contentId, tabId) {
14
- return new Promise( /*#__PURE__*/function () {
15
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
16
- return _regenerator.default.wrap(function _callee$(_context) {
17
- while (1) switch (_context.prev = _context.next) {
18
- case 0:
19
- if (window.jQuery) {
20
- window.ATL_JQ_PAGE_PROPS = {
21
- triggerFunction: function triggerFunction(showCollectorDialog) {
22
- if (typeof showCollectorDialog === 'function') {
23
- resolve(showCollectorDialog);
24
- } else {
25
- reject('Failed to initialize showCollectorDialog');
26
- }
27
- },
28
- fieldValues: {
29
- description: "Please describe the problem you're having or feature you'd like to see:\n\n\n",
30
- // 11711 is the field ID for the Feedback Labels field on Product Fabric.
31
- // this is found by clicking "configure" on the field and inspecting the URL
32
- customfield_11711: labels || [],
33
- customfield_11712: "version: ".concat(packageName, "@").concat(packageVersion, " (").concat(coreVersion, ")\n Browser: ").concat((0, _getBrowserInfo.default)(navigator.userAgent), "\n OS: ").concat((0, _getDeviceInfo.default)(navigator.userAgent, navigator.appVersion))
34
- },
35
- environment: {
36
- 'Editor Package': packageName,
37
- 'Editor Version': packageVersion,
38
- 'Editor Core Version': coreVersion,
39
- sessionId: sessionId,
40
- contentId: contentId,
41
- tabId: tabId
42
- },
43
- priority: '1',
44
- components: '15306' // Fix here
45
- };
46
-
47
- window.jQuery.ajax({
48
- url: JIRA_ISSUE_COLLECTOR_URL,
49
- type: 'get',
50
- cache: true,
51
- dataType: 'script'
52
- });
53
- } else {
54
- reject('jQuery is not defined');
55
- }
56
- case 1:
57
- case "end":
58
- return _context.stop();
59
- }
60
- }, _callee);
61
- }));
62
- return function (_x, _x2) {
63
- return _ref.apply(this, arguments);
64
- };
65
- }());
66
- };
67
- var _default = exports.default = loadJiraCollectorDialogScript;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- var pickBy = function pickBy(test, object) {
12
- return Object.keys(object).reduce(function (obj, key) {
13
- return test(String(key), object[key]) ? _objectSpread(_objectSpread({}, obj), {}, (0, _defineProperty2.default)({}, key, object[key])) : obj;
14
- }, {});
15
- };
16
- var _default = exports.default = pickBy;
@@ -1,64 +0,0 @@
1
- /**
2
- * Inspired from:
3
- * https://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript
4
- */
5
- const getBrowserInfo = nAgt => {
6
- let browserName;
7
- let browserVersion;
8
- let nameOffset;
9
- let verOffset;
10
- let index;
11
-
12
- // In Opera 15+, version is after "OPR/"
13
- if ((verOffset = nAgt.indexOf('OPR/')) !== -1) {
14
- browserName = 'Opera';
15
- browserVersion = nAgt.substring(verOffset + 4);
16
- } else if ((verOffset = nAgt.indexOf('Opera')) !== -1) {
17
- // In older Opera, version is after "Opera" or after "Version"
18
- browserName = 'Opera';
19
- if ((verOffset = nAgt.indexOf('Version')) !== -1) {
20
- browserVersion = nAgt.substring(verOffset + 8);
21
- } else {
22
- browserVersion = nAgt.substring(verOffset + 6);
23
- }
24
- } else if ((verOffset = nAgt.indexOf('MSIE')) !== -1) {
25
- // In MSIE, version is after "MSIE" in userAgent
26
- browserName = 'Microsoft Internet Explorer';
27
- browserVersion = nAgt.substring(verOffset + 5);
28
- } else if ((verOffset = nAgt.indexOf('Chrome')) !== -1) {
29
- // In Chrome, version is after "Chrome"
30
- browserName = 'Chrome';
31
- browserVersion = nAgt.substring(verOffset + 7);
32
- } else if ((verOffset = nAgt.indexOf('Safari')) !== -1) {
33
- // In Safari, version is after "Safari" or after "Version"
34
- browserName = 'Safari';
35
- if ((verOffset = nAgt.indexOf('Version')) !== -1) {
36
- browserVersion = nAgt.substring(verOffset + 8);
37
- } else {
38
- browserVersion = nAgt.substring(verOffset + 7);
39
- }
40
- } else if ((verOffset = nAgt.indexOf('Firefox')) !== -1) {
41
- // In Firefox, version is after "Firefox"
42
- browserName = 'Firefox';
43
- browserVersion = nAgt.substring(verOffset + 8);
44
- } else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
45
- // In most other browsers, "name/version" is at the end of userAgent
46
- browserName = nAgt.substring(nameOffset, verOffset);
47
- browserVersion = nAgt.substring(verOffset + 1);
48
- if (browserName.toLowerCase() === browserName.toUpperCase()) {
49
- browserName = navigator.appName;
50
- }
51
- } else {
52
- browserName = navigator.appName;
53
- browserVersion = '' + parseFloat(navigator.appVersion);
54
- }
55
- // trim the versionStr string at semicolon/space if present
56
- if ((index = browserVersion.indexOf(';')) !== -1) {
57
- browserVersion = browserVersion.substring(0, index);
58
- }
59
- if ((index = browserVersion.indexOf(' ')) !== -1) {
60
- browserVersion = browserVersion.substring(0, index);
61
- }
62
- return `${browserName} ${browserVersion}`;
63
- };
64
- export default getBrowserInfo;
@@ -1,112 +0,0 @@
1
- /**
2
- * Inspired from:
3
- * https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript
4
- */
5
- const getDeviceInfo = (nAgt, nVersion) => {
6
- let os = '';
7
- let osVersion = '';
8
- let clientStrings = [{
9
- s: 'Windows 3.11',
10
- r: /Win16/
11
- }, {
12
- s: 'Windows 95',
13
- r: /(Windows 95|Win95|Windows_95)/
14
- }, {
15
- s: 'Windows ME',
16
- r: /(Win 9x 4.90|Windows ME)/
17
- }, {
18
- s: 'Windows 98',
19
- r: /(Windows 98|Win98)/
20
- }, {
21
- s: 'Windows CE',
22
- r: /Windows CE/
23
- }, {
24
- s: 'Windows 2000',
25
- r: /(Windows NT 5.0|Windows 2000)/
26
- }, {
27
- s: 'Windows XP',
28
- r: /(Windows NT 5.1|Windows XP)/
29
- }, {
30
- s: 'Windows Server 2003',
31
- r: /Windows NT 5.2/
32
- }, {
33
- s: 'Windows Vista',
34
- r: /Windows NT 6.0/
35
- }, {
36
- s: 'Windows 7',
37
- r: /(Windows 7|Windows NT 6.1)/
38
- }, {
39
- s: 'Windows 8.1',
40
- r: /(Windows 8.1|Windows NT 6.3)/
41
- }, {
42
- s: 'Windows 8',
43
- r: /(Windows 8|Windows NT 6.2)/
44
- }, {
45
- s: 'Windows NT 4.0',
46
- r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/
47
- }, {
48
- s: 'Android',
49
- r: /Android/
50
- }, {
51
- s: 'Open BSD',
52
- r: /OpenBSD/
53
- }, {
54
- s: 'Sun OS',
55
- r: /SunOS/
56
- }, {
57
- s: 'Linux',
58
- r: /(Linux|X11)/
59
- }, {
60
- s: 'iOS',
61
- r: /(iPhone|iPad|iPod)/
62
- }, {
63
- s: 'Mac OS X',
64
- r: /Mac OS X/
65
- }, {
66
- s: 'Mac OS',
67
- r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/
68
- }, {
69
- s: 'QNX',
70
- r: /QNX/
71
- }, {
72
- s: 'UNIX',
73
- r: /UNIX/
74
- }, {
75
- s: 'BeOS',
76
- r: /BeOS/
77
- }, {
78
- s: 'OS/2',
79
- r: /OS\/2/
80
- }, {
81
- s: 'Search Bot',
82
- r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
83
- }];
84
- for (let client in clientStrings) {
85
- const clientObj = clientStrings[client];
86
- if (clientObj.r.test(nAgt)) {
87
- os = clientObj.s;
88
- break;
89
- }
90
- }
91
- let match;
92
- if (/Windows/.test(os)) {
93
- match = /Windows (.*)/.exec(os);
94
- osVersion = match && match[1];
95
- os = 'Windows';
96
- }
97
- switch (os) {
98
- case 'Mac OS X':
99
- match = /Mac OS X (10[\.\_\d]+)/.exec(nAgt);
100
- osVersion = match && match[1];
101
- break;
102
- case 'Android':
103
- match = /Android ([\.\_\d]+)/.exec(nAgt);
104
- osVersion = match && match[1];
105
- break;
106
- case 'iOS':
107
- match = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVersion);
108
- osVersion = match && match[1] + '.' + match[2] + '.' + (match[3] || 0);
109
- }
110
- return `${os} ${osVersion}`;
111
- };
112
- export default getDeviceInfo;
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
- import { IconFeedback } from '@atlaskit/editor-common/quick-insert';
3
- import { version as coreVersion } from '../../version-wrapper';
4
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
- import loadJiraCollectorDialogScript from './loadJiraCollectorDialogScript';
6
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
7
- let showJiraCollectorDialog;
8
- let feedbackInfoHash;
9
- let defaultFeedbackInfo;
10
- const hashFeedbackInfo = feedbackInfo => {
11
- const {
12
- product,
13
- packageName,
14
- packageVersion,
15
- labels
16
- } = feedbackInfo;
17
- return [product, packageName, packageVersion, ...(labels || [])].join('|');
18
- };
19
- export const openFeedbackDialog = async feedbackInfo => new Promise(async (resolve, reject) => {
20
- const combinedFeedbackInfo = {
21
- // default value assignment
22
- ...{
23
- product: 'n/a',
24
- labels: [],
25
- packageName: '',
26
- packageVersion: '',
27
- sessionId: '',
28
- contentId: '',
29
- tabId: ''
30
- },
31
- ...defaultFeedbackInfo,
32
- ...feedbackInfo
33
- };
34
- const newFeedbackInfoHash = hashFeedbackInfo(combinedFeedbackInfo);
35
- if (!showJiraCollectorDialog || feedbackInfoHash !== newFeedbackInfoHash) {
36
- try {
37
- showJiraCollectorDialog = await loadJiraCollectorDialogScript([combinedFeedbackInfo.product, ...combinedFeedbackInfo.labels], combinedFeedbackInfo.packageName, coreVersion, combinedFeedbackInfo.packageVersion, combinedFeedbackInfo.sessionId, combinedFeedbackInfo.contentId, combinedFeedbackInfo.tabId);
38
- feedbackInfoHash = newFeedbackInfoHash;
39
- } catch (err) {
40
- reject(err);
41
- }
42
- }
43
- const timeoutId = window.setTimeout(showJiraCollectorDialog, 0);
44
- // Return the timoutId for consumers to call clearTimeout if they need to.
45
- resolve(timeoutId);
46
- });
47
- const feedbackDialog = ({
48
- config: feedbackInfo,
49
- api
50
- }) => {
51
- defaultFeedbackInfo = feedbackInfo !== null && feedbackInfo !== void 0 ? feedbackInfo : {};
52
- return {
53
- name: 'feedbackDialog',
54
- pluginsOptions: {
55
- quickInsert: ({
56
- formatMessage
57
- }) => [{
58
- id: 'feedbackdialog',
59
- title: formatMessage(messages.feedbackDialog),
60
- description: formatMessage(messages.feedbackDialogDescription),
61
- priority: 400,
62
- keywords: ['bug'],
63
- icon: () => /*#__PURE__*/React.createElement(IconFeedback, null),
64
- action(insert, state) {
65
- var _api$analytics;
66
- const tr = insert('');
67
- openFeedbackDialog(feedbackInfo);
68
- api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
69
- action: ACTION.OPENED,
70
- actionSubject: ACTION_SUBJECT.FEEDBACK_DIALOG,
71
- attributes: {
72
- inputMethod: INPUT_METHOD.QUICK_INSERT
73
- },
74
- eventType: EVENT_TYPE.UI
75
- })(tr);
76
- return tr;
77
- }
78
- }]
79
- }
80
- };
81
- };
82
- export default feedbackDialog;
@@ -1,47 +0,0 @@
1
- import getDeviceInfo from './getDeviceInfo';
2
- import getBrowserInfo from './getBrowserInfo';
3
- const JIRA_ISSUE_COLLECTOR_URL = 'https://product-fabric.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/-w0bwo4/b/14/e73395c53c3b10fde2303f4bf74ffbf6/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-US&collectorId=98644b9c';
4
- const loadJiraCollectorDialogScript = (labels, packageName, coreVersion, packageVersion, sessionId, contentId, tabId) => {
5
- return new Promise(async (resolve, reject) => {
6
- if (window.jQuery) {
7
- window.ATL_JQ_PAGE_PROPS = {
8
- triggerFunction: showCollectorDialog => {
9
- if (typeof showCollectorDialog === 'function') {
10
- resolve(showCollectorDialog);
11
- } else {
12
- reject('Failed to initialize showCollectorDialog');
13
- }
14
- },
15
- fieldValues: {
16
- description: `Please describe the problem you're having or feature you'd like to see:\n\n\n`,
17
- // 11711 is the field ID for the Feedback Labels field on Product Fabric.
18
- // this is found by clicking "configure" on the field and inspecting the URL
19
- customfield_11711: labels || [],
20
- customfield_11712: `version: ${packageName}@${packageVersion} (${coreVersion})
21
- Browser: ${getBrowserInfo(navigator.userAgent)}
22
- OS: ${getDeviceInfo(navigator.userAgent, navigator.appVersion)}`
23
- },
24
- environment: {
25
- 'Editor Package': packageName,
26
- 'Editor Version': packageVersion,
27
- 'Editor Core Version': coreVersion,
28
- sessionId,
29
- contentId,
30
- tabId
31
- },
32
- priority: '1',
33
- components: '15306' // Fix here
34
- };
35
-
36
- window.jQuery.ajax({
37
- url: JIRA_ISSUE_COLLECTOR_URL,
38
- type: 'get',
39
- cache: true,
40
- dataType: 'script'
41
- });
42
- } else {
43
- reject('jQuery is not defined');
44
- }
45
- });
46
- };
47
- export default loadJiraCollectorDialogScript;
@@ -1,5 +0,0 @@
1
- const pickBy = (test, object) => Object.keys(object).reduce((obj, key) => test(String(key), object[key]) ? {
2
- ...obj,
3
- [key]: object[key]
4
- } : obj, {});
5
- export default pickBy;