@atlaskit/link-datasource 2.11.4 → 2.11.6

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 (29) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/hooks/useDatasourceTableFlag.js +19 -16
  3. package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +1 -1
  4. package/dist/cjs/ui/confluence-search-modal/modal/index.js +1 -1
  5. package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +5 -2
  6. package/dist/cjs/ui/issue-like-table/messages.js +12 -7
  7. package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +8 -8
  8. package/dist/es2019/hooks/useDatasourceTableFlag.js +18 -14
  9. package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +2 -2
  10. package/dist/es2019/ui/confluence-search-modal/modal/index.js +1 -1
  11. package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +5 -2
  12. package/dist/es2019/ui/issue-like-table/messages.js +12 -7
  13. package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +5 -6
  14. package/dist/esm/hooks/useDatasourceTableFlag.js +20 -17
  15. package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +2 -2
  16. package/dist/esm/ui/confluence-search-modal/modal/index.js +1 -1
  17. package/dist/esm/ui/issue-like-table/edit-type/text/index.js +5 -2
  18. package/dist/esm/ui/issue-like-table/messages.js +12 -7
  19. package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +6 -6
  20. package/dist/types/hooks/useDatasourceTableFlag.d.ts +3 -1
  21. package/dist/types/ui/issue-like-table/messages.d.ts +6 -1
  22. package/dist/types-ts4.5/hooks/useDatasourceTableFlag.d.ts +3 -1
  23. package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +6 -1
  24. package/package.json +4 -3
  25. package/dist/cjs/common/utils/response-item.js +0 -18
  26. package/dist/es2019/common/utils/response-item.js +0 -6
  27. package/dist/esm/common/utils/response-item.js +0 -11
  28. package/dist/types/common/utils/response-item.d.ts +0 -2
  29. package/dist/types-ts4.5/common/utils/response-item.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 2.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#130683](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130683)
8
+ [`c61bb13127c88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c61bb13127c88) -
9
+ Add datasource table inline edit 403 error message behind feature flag
10
+ - [#132566](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132566)
11
+ [`3e30b62782282`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3e30b62782282) -
12
+ Fix datasource modal close on pressing escape (ESC) from inline edit behind feature flag
13
+
14
+ ## 2.11.5
15
+
16
+ ### Patch Changes
17
+
18
+ - [`2206c4285ada1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2206c4285ada1) -
19
+ Fixes bug in Confluence datasource modal found behind ff.
20
+
3
21
  ## 2.11.4
4
22
 
5
23
  ### Patch Changes
@@ -17,32 +17,35 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
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
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 getGenericErrorMessage = function getGenericErrorMessage(status) {
21
+ switch (status) {
22
+ case 403:
23
+ return {
24
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateError403Title),
25
+ description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateError403Description)
26
+ };
27
+ default:
28
+ return {
29
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericTitle),
30
+ description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericDescription)
31
+ };
32
+ }
33
+ };
20
34
  var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDatasourceTableFlag(options) {
21
35
  var _useFlags = (0, _flag.useFlags)(),
22
36
  showFlag = _useFlags.showFlag;
23
- var actions = (0, _react.useMemo)(function () {
24
- var resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
25
- content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.goToResourceLink),
26
- href: options === null || options === void 0 ? void 0 : options.url,
27
- target: '_blank'
28
- };
29
- return resourceLink ? [resourceLink] : undefined;
30
- }, [options === null || options === void 0 ? void 0 : options.url]);
31
37
  var showErrorFlag = (0, _react.useCallback)(function (args) {
32
- showFlag(_objectSpread({
33
- actions: actions,
34
- description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericDescription),
35
- // We need IconTile (currently in beta) in order to scale the new icon to 24px
38
+ showFlag(_objectSpread(_objectSpread({
39
+ // We need IconTile in order to scale the new icon to 24px
36
40
  // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
37
41
  icon: /*#__PURE__*/_react.default.createElement(_crossCircle.default, {
38
42
  label: "Error",
39
43
  primaryColor: "var(--ds-icon-danger, #C9372C)"
40
44
  }),
41
45
  id: (0, _uuid.default)(),
42
- isAutoDismiss: true,
43
- title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericTitle)
44
- }, args));
45
- }, [actions, showFlag]);
46
+ isAutoDismiss: true
47
+ }, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
48
+ }, [showFlag]);
46
49
  return {
47
50
  showErrorFlag: showErrorFlag
48
51
  };
@@ -94,7 +94,7 @@ var ConfluenceSearchContainer = function ConfluenceSearchContainer(_ref) {
94
94
  }
95
95
  }, [cloudId, resetHydrationHook]);
96
96
  var showBasicFilters = (0, _react.useMemo)(function () {
97
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.show-clol-basic-filters')) {
97
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.show-clol-basic-filters')) {
98
98
  return true;
99
99
  }
100
100
  return false;
@@ -318,7 +318,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
318
318
  }, (0, _react2.jsx)(_confluenceSearchContainer.default, {
319
319
  isSearching: status === 'loading',
320
320
  onSearch: onSearch,
321
- parameters: parameters && isValidParameters(parameters) ? parameters : {
321
+ parameters: parameters !== null && parameters !== void 0 ? parameters : {
322
322
  cloudId: ''
323
323
  }
324
324
  })), currentViewMode === 'inline' ? renderInlineLinkModalContent() : renderTableModalContent()) : (0, _react2.jsx)(_noInstances.NoInstancesView, {
@@ -7,12 +7,15 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ var _layering = require("@atlaskit/layering");
10
11
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
11
12
  var TextEditType = function TextEditType(props) {
12
- return /*#__PURE__*/_react.default.createElement(_textfield.default, (0, _extends2.default)({}, props, {
13
+ return /*#__PURE__*/_react.default.createElement(_layering.UNSAFE_LAYERING, {
14
+ isDisabled: false
15
+ }, /*#__PURE__*/_react.default.createElement(_textfield.default, (0, _extends2.default)({}, props, {
13
16
  autoFocus: true,
14
17
  isCompact: true,
15
18
  testId: "inline-edit-text"
16
- }));
19
+ })));
17
20
  };
18
21
  var _default = exports.default = TextEditType;
@@ -6,18 +6,23 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.issueLikeTableMessages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
8
  var issueLikeTableMessages = exports.issueLikeTableMessages = (0, _reactIntlNext.defineMessages)({
9
- goToResourceLink: {
10
- id: 'linkDataSource.issue-line-table.go-to-resource.nonfinal',
11
- description: 'Link to navigate to the resource page',
12
- defaultMessage: 'Go to item'
9
+ updateError403Description: {
10
+ id: 'linkDataSource.issue-line-table.error-403-description',
11
+ description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
12
+ defaultMessage: 'You need the right permissions to edit this item.'
13
+ },
14
+ updateError403Title: {
15
+ id: 'linkDataSource.issue-line-table.error-403-title',
16
+ description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
17
+ defaultMessage: 'Changes not saved'
13
18
  },
14
19
  updateErrorGenericDescription: {
15
- id: 'linkDataSource.issue-line-table.error-generic-description.nonfinal',
20
+ id: 'linkDataSource.issue-line-table.error-generic-description',
16
21
  description: 'Generic error message description shown when updating issue field fails',
17
- defaultMessage: 'We had an issue trying to complete the update. Refresh the page and try again.'
22
+ defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
18
23
  },
19
24
  updateErrorGenericTitle: {
20
- id: 'linkDataSource.issue-line-table.error-generic-title.nonfinal',
25
+ id: 'linkDataSource.issue-line-table.error-generic-title',
21
26
  description: 'Generic error message title shown when updating issue field fails',
22
27
  defaultMessage: 'Something went wrong'
23
28
  },
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
4
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.InlineEdit = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
13
  var _react = _interopRequireWildcard(require("react"));
13
14
  var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
14
15
  var _primitives = require("@atlaskit/primitives");
15
- var _responseItem = require("../../../common/utils/response-item");
16
16
  var _useDatasourceTableFlag = require("../../../hooks/useDatasourceTableFlag");
17
17
  var _state = require("../../../state");
18
18
  var _editType = require("../edit-type");
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
21
  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; }
22
22
  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; }
23
23
  var containerStyles = (0, _primitives.xcss)({
@@ -49,10 +49,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
49
49
  var item = (0, _state.useDatasourceItem)({
50
50
  id: ari
51
51
  });
52
- var url = (0, _responseItem.getResourceUrl)(item === null || item === void 0 ? void 0 : item.data);
53
- var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
54
- url: url
55
- }),
52
+ var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)(),
56
53
  showErrorFlag = _useDatasourceTableFl.showErrorFlag;
57
54
  var _useDatasourceActions = (0, _state.useDatasourceActions)(),
58
55
  onUpdateItem = _useDatasourceActions.onUpdateItem;
@@ -69,7 +66,10 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
69
66
  }
70
67
  onUpdateItem(ari, newItem);
71
68
  execute(value).catch(function (error) {
72
- showErrorFlag();
69
+ var status = error && (0, _typeof2.default)(error) === 'object' ? error.status : undefined;
70
+ showErrorFlag({
71
+ status: status
72
+ });
73
73
  onUpdateItem(ari, existingData);
74
74
  });
75
75
  setIsEditing(false);
@@ -1,26 +1,30 @@
1
- import React, { useCallback, useMemo } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { FormattedMessage } from 'react-intl-next';
3
3
  import uuid from 'uuid';
4
4
  import { useFlags } from '@atlaskit/flag';
5
5
  import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
6
6
  import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
7
+ const getGenericErrorMessage = status => {
8
+ switch (status) {
9
+ case 403:
10
+ return {
11
+ title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Title),
12
+ description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Description)
13
+ };
14
+ default:
15
+ return {
16
+ title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle),
17
+ description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription)
18
+ };
19
+ }
20
+ };
7
21
  export const useDatasourceTableFlag = options => {
8
22
  const {
9
23
  showFlag
10
24
  } = useFlags();
11
- const actions = useMemo(() => {
12
- const resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
13
- content: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.goToResourceLink),
14
- href: options === null || options === void 0 ? void 0 : options.url,
15
- target: '_blank'
16
- };
17
- return resourceLink ? [resourceLink] : undefined;
18
- }, [options === null || options === void 0 ? void 0 : options.url]);
19
25
  const showErrorFlag = useCallback(args => {
20
26
  showFlag({
21
- actions,
22
- description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription),
23
- // We need IconTile (currently in beta) in order to scale the new icon to 24px
27
+ // We need IconTile in order to scale the new icon to 24px
24
28
  // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
25
29
  icon: /*#__PURE__*/React.createElement(CrossCircleIcon, {
26
30
  label: "Error",
@@ -28,10 +32,10 @@ export const useDatasourceTableFlag = options => {
28
32
  }),
29
33
  id: uuid(),
30
34
  isAutoDismiss: true,
31
- title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle),
35
+ ...getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status),
32
36
  ...args
33
37
  });
34
- }, [actions, showFlag]);
38
+ }, [showFlag]);
35
39
  return {
36
40
  showErrorFlag
37
41
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { useDebouncedCallback } from 'use-debounce';
3
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { Flex, xcss } from '@atlaskit/primitives';
5
5
  import { BasicSearchInput } from '../../common/modal/basic-search-input';
6
6
  import { FILTER_SELECTION_DEBOUNCE_MS } from '../../common/modal/popup-select/constants';
@@ -73,7 +73,7 @@ const ConfluenceSearchContainer = ({
73
73
  }
74
74
  }, [cloudId, resetHydrationHook]);
75
75
  const showBasicFilters = useMemo(() => {
76
- if (getBooleanFF('platform.linking-platform.datasource.show-clol-basic-filters')) {
76
+ if (fg('platform.linking-platform.datasource.show-clol-basic-filters')) {
77
77
  return true;
78
78
  }
79
79
  return false;
@@ -305,7 +305,7 @@ export const PlainConfluenceSearchConfigModal = props => {
305
305
  }, jsx(ConfluenceSearchContainer, {
306
306
  isSearching: status === 'loading',
307
307
  onSearch: onSearch,
308
- parameters: parameters && isValidParameters(parameters) ? parameters : {
308
+ parameters: parameters !== null && parameters !== void 0 ? parameters : {
309
309
  cloudId: ''
310
310
  }
311
311
  })), currentViewMode === 'inline' ? renderInlineLinkModalContent() : renderTableModalContent()) : jsx(NoInstancesView, {
@@ -1,9 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { UNSAFE_LAYERING } from '@atlaskit/layering';
3
4
  import Textfield from '@atlaskit/textfield';
4
- const TextEditType = props => /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
5
+ const TextEditType = props => /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
6
+ isDisabled: false
7
+ }, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
5
8
  autoFocus: true,
6
9
  isCompact: true,
7
10
  testId: "inline-edit-text"
8
- }));
11
+ })));
9
12
  export default TextEditType;
@@ -1,17 +1,22 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export const issueLikeTableMessages = defineMessages({
3
- goToResourceLink: {
4
- id: 'linkDataSource.issue-line-table.go-to-resource.nonfinal',
5
- description: 'Link to navigate to the resource page',
6
- defaultMessage: 'Go to item'
3
+ updateError403Description: {
4
+ id: 'linkDataSource.issue-line-table.error-403-description',
5
+ description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
6
+ defaultMessage: 'You need the right permissions to edit this item.'
7
+ },
8
+ updateError403Title: {
9
+ id: 'linkDataSource.issue-line-table.error-403-title',
10
+ description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
11
+ defaultMessage: 'Changes not saved'
7
12
  },
8
13
  updateErrorGenericDescription: {
9
- id: 'linkDataSource.issue-line-table.error-generic-description.nonfinal',
14
+ id: 'linkDataSource.issue-line-table.error-generic-description',
10
15
  description: 'Generic error message description shown when updating issue field fails',
11
- defaultMessage: 'We had an issue trying to complete the update. Refresh the page and try again.'
16
+ defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
12
17
  },
13
18
  updateErrorGenericTitle: {
14
- id: 'linkDataSource.issue-line-table.error-generic-title.nonfinal',
19
+ id: 'linkDataSource.issue-line-table.error-generic-title',
15
20
  description: 'Generic error message title shown when updating issue field fails',
16
21
  defaultMessage: 'Something went wrong'
17
22
  },
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useState } from 'react';
3
3
  import AKInlineEdit from '@atlaskit/inline-edit';
4
4
  import { Box, xcss } from '@atlaskit/primitives';
5
- import { getResourceUrl } from '../../../common/utils/response-item';
6
5
  import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
7
6
  import { useDatasourceActions, useDatasourceItem } from '../../../state';
8
7
  import { editType } from '../edit-type';
@@ -36,12 +35,9 @@ export const InlineEdit = ({
36
35
  const item = useDatasourceItem({
37
36
  id: ari
38
37
  });
39
- const url = getResourceUrl(item === null || item === void 0 ? void 0 : item.data);
40
38
  const {
41
39
  showErrorFlag
42
- } = useDatasourceTableFlag({
43
- url
44
- });
40
+ } = useDatasourceTableFlag();
45
41
  const {
46
42
  onUpdateItem
47
43
  } = useDatasourceActions();
@@ -58,7 +54,10 @@ export const InlineEdit = ({
58
54
  }
59
55
  onUpdateItem(ari, newItem);
60
56
  execute(value).catch(error => {
61
- showErrorFlag();
57
+ const status = error && typeof error === 'object' ? error.status : undefined;
58
+ showErrorFlag({
59
+ status
60
+ });
62
61
  onUpdateItem(ari, existingData);
63
62
  });
64
63
  setIsEditing(false);
@@ -1,38 +1,41 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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) { _defineProperty(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; }
4
- import React, { useCallback, useMemo } from 'react';
4
+ import React, { useCallback } from 'react';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
6
  import uuid from 'uuid';
7
7
  import { useFlags } from '@atlaskit/flag';
8
8
  import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
9
9
  import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
10
+ var getGenericErrorMessage = function getGenericErrorMessage(status) {
11
+ switch (status) {
12
+ case 403:
13
+ return {
14
+ title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Title),
15
+ description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Description)
16
+ };
17
+ default:
18
+ return {
19
+ title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle),
20
+ description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription)
21
+ };
22
+ }
23
+ };
10
24
  export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
11
25
  var _useFlags = useFlags(),
12
26
  showFlag = _useFlags.showFlag;
13
- var actions = useMemo(function () {
14
- var resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
15
- content: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.goToResourceLink),
16
- href: options === null || options === void 0 ? void 0 : options.url,
17
- target: '_blank'
18
- };
19
- return resourceLink ? [resourceLink] : undefined;
20
- }, [options === null || options === void 0 ? void 0 : options.url]);
21
27
  var showErrorFlag = useCallback(function (args) {
22
- showFlag(_objectSpread({
23
- actions: actions,
24
- description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription),
25
- // We need IconTile (currently in beta) in order to scale the new icon to 24px
28
+ showFlag(_objectSpread(_objectSpread({
29
+ // We need IconTile in order to scale the new icon to 24px
26
30
  // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
27
31
  icon: /*#__PURE__*/React.createElement(CrossCircleIcon, {
28
32
  label: "Error",
29
33
  primaryColor: "var(--ds-icon-danger, #C9372C)"
30
34
  }),
31
35
  id: uuid(),
32
- isAutoDismiss: true,
33
- title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle)
34
- }, args));
35
- }, [actions, showFlag]);
36
+ isAutoDismiss: true
37
+ }, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
38
+ }, [showFlag]);
36
39
  return {
37
40
  showErrorFlag: showErrorFlag
38
41
  };
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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) { _defineProperty(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; }
5
5
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { useDebouncedCallback } from 'use-debounce';
7
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { Flex, xcss } from '@atlaskit/primitives';
9
9
  import { BasicSearchInput } from '../../common/modal/basic-search-input';
10
10
  import { FILTER_SELECTION_DEBOUNCE_MS } from '../../common/modal/popup-select/constants';
@@ -84,7 +84,7 @@ var ConfluenceSearchContainer = function ConfluenceSearchContainer(_ref) {
84
84
  }
85
85
  }, [cloudId, resetHydrationHook]);
86
86
  var showBasicFilters = useMemo(function () {
87
- if (getBooleanFF('platform.linking-platform.datasource.show-clol-basic-filters')) {
87
+ if (fg('platform.linking-platform.datasource.show-clol-basic-filters')) {
88
88
  return true;
89
89
  }
90
90
  return false;
@@ -315,7 +315,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
315
315
  }, jsx(ConfluenceSearchContainer, {
316
316
  isSearching: status === 'loading',
317
317
  onSearch: onSearch,
318
- parameters: parameters && isValidParameters(parameters) ? parameters : {
318
+ parameters: parameters !== null && parameters !== void 0 ? parameters : {
319
319
  cloudId: ''
320
320
  }
321
321
  })), currentViewMode === 'inline' ? renderInlineLinkModalContent() : renderTableModalContent()) : jsx(NoInstancesView, {
@@ -1,11 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { UNSAFE_LAYERING } from '@atlaskit/layering';
3
4
  import Textfield from '@atlaskit/textfield';
4
5
  var TextEditType = function TextEditType(props) {
5
- return /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
6
+ return /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
7
+ isDisabled: false
8
+ }, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
6
9
  autoFocus: true,
7
10
  isCompact: true,
8
11
  testId: "inline-edit-text"
9
- }));
12
+ })));
10
13
  };
11
14
  export default TextEditType;
@@ -1,17 +1,22 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export var issueLikeTableMessages = defineMessages({
3
- goToResourceLink: {
4
- id: 'linkDataSource.issue-line-table.go-to-resource.nonfinal',
5
- description: 'Link to navigate to the resource page',
6
- defaultMessage: 'Go to item'
3
+ updateError403Description: {
4
+ id: 'linkDataSource.issue-line-table.error-403-description',
5
+ description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
6
+ defaultMessage: 'You need the right permissions to edit this item.'
7
+ },
8
+ updateError403Title: {
9
+ id: 'linkDataSource.issue-line-table.error-403-title',
10
+ description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
11
+ defaultMessage: 'Changes not saved'
7
12
  },
8
13
  updateErrorGenericDescription: {
9
- id: 'linkDataSource.issue-line-table.error-generic-description.nonfinal',
14
+ id: 'linkDataSource.issue-line-table.error-generic-description',
10
15
  description: 'Generic error message description shown when updating issue field fails',
11
- defaultMessage: 'We had an issue trying to complete the update. Refresh the page and try again.'
16
+ defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
12
17
  },
13
18
  updateErrorGenericTitle: {
14
- id: 'linkDataSource.issue-line-table.error-generic-title.nonfinal',
19
+ id: 'linkDataSource.issue-line-table.error-generic-title',
15
20
  description: 'Generic error message title shown when updating issue field fails',
16
21
  defaultMessage: 'Something went wrong'
17
22
  },
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _typeof from "@babel/runtime/helpers/typeof";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
5
  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; }
@@ -6,7 +7,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
7
  import React, { useCallback, useState } from 'react';
7
8
  import AKInlineEdit from '@atlaskit/inline-edit';
8
9
  import { Box, xcss } from '@atlaskit/primitives';
9
- import { getResourceUrl } from '../../../common/utils/response-item';
10
10
  import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
11
11
  import { useDatasourceActions, useDatasourceItem } from '../../../state';
12
12
  import { editType } from '../edit-type';
@@ -39,10 +39,7 @@ export var InlineEdit = function InlineEdit(_ref) {
39
39
  var item = useDatasourceItem({
40
40
  id: ari
41
41
  });
42
- var url = getResourceUrl(item === null || item === void 0 ? void 0 : item.data);
43
- var _useDatasourceTableFl = useDatasourceTableFlag({
44
- url: url
45
- }),
42
+ var _useDatasourceTableFl = useDatasourceTableFlag(),
46
43
  showErrorFlag = _useDatasourceTableFl.showErrorFlag;
47
44
  var _useDatasourceActions = useDatasourceActions(),
48
45
  onUpdateItem = _useDatasourceActions.onUpdateItem;
@@ -59,7 +56,10 @@ export var InlineEdit = function InlineEdit(_ref) {
59
56
  }
60
57
  onUpdateItem(ari, newItem);
61
58
  execute(value).catch(function (error) {
62
- showErrorFlag();
59
+ var status = error && _typeof(error) === 'object' ? error.status : undefined;
60
+ showErrorFlag({
61
+ status: status
62
+ });
63
63
  onUpdateItem(ari, existingData);
64
64
  });
65
65
  setIsEditing(false);
@@ -3,6 +3,8 @@ interface DatasourceTableFlagOptions {
3
3
  url?: string;
4
4
  }
5
5
  export declare const useDatasourceTableFlag: (options?: DatasourceTableFlagOptions) => {
6
- showErrorFlag: (args?: Partial<CreateFlagArgs>) => void;
6
+ showErrorFlag: (args?: Partial<CreateFlagArgs> & {
7
+ status?: number;
8
+ }) => void;
7
9
  };
8
10
  export {};
@@ -1,5 +1,10 @@
1
1
  export declare const issueLikeTableMessages: {
2
- goToResourceLink: {
2
+ updateError403Description: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ updateError403Title: {
3
8
  id: string;
4
9
  description: string;
5
10
  defaultMessage: string;
@@ -3,6 +3,8 @@ interface DatasourceTableFlagOptions {
3
3
  url?: string;
4
4
  }
5
5
  export declare const useDatasourceTableFlag: (options?: DatasourceTableFlagOptions) => {
6
- showErrorFlag: (args?: Partial<CreateFlagArgs>) => void;
6
+ showErrorFlag: (args?: Partial<CreateFlagArgs> & {
7
+ status?: number;
8
+ }) => void;
7
9
  };
8
10
  export {};
@@ -1,5 +1,10 @@
1
1
  export declare const issueLikeTableMessages: {
2
- goToResourceLink: {
2
+ updateError403Description: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ updateError403Title: {
3
8
  id: string;
4
9
  description: string;
5
10
  defaultMessage: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "2.11.4",
3
+ "version": "2.11.6",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -52,11 +52,12 @@
52
52
  "@atlaskit/icon": "^22.14.0",
53
53
  "@atlaskit/icon-object": "^6.5.0",
54
54
  "@atlaskit/image": "^1.3.0",
55
- "@atlaskit/inline-edit": "^13.6.0",
55
+ "@atlaskit/inline-edit": "^13.7.0",
56
56
  "@atlaskit/intl-messages-provider": "^1.0.0",
57
57
  "@atlaskit/jql-ast": "^3.3.0",
58
58
  "@atlaskit/jql-editor": "^4.5.0",
59
59
  "@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
60
+ "@atlaskit/layering": "^0.4.0",
60
61
  "@atlaskit/link-client-extension": "^2.1.0",
61
62
  "@atlaskit/linking-common": "^5.11.0",
62
63
  "@atlaskit/linking-types": "^9.0.0",
@@ -101,7 +102,7 @@
101
102
  "@af/integration-testing": "*",
102
103
  "@af/visual-regression": "*",
103
104
  "@atlaskit/link-provider": "^1.14.0",
104
- "@atlaskit/link-test-helpers": "^7.4.0",
105
+ "@atlaskit/link-test-helpers": "^7.5.0",
105
106
  "@atlaskit/ssr": "*",
106
107
  "@atlaskit/visual-regression": "*",
107
108
  "@atlassian/feature-flags-test-utils": "^0.2.0",
@@ -1,18 +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.getResourceUrl = void 0;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var isLink = function isLink(data) {
10
- return (0, _typeof2.default)(data) === 'object' && 'url' in data;
11
- };
12
- var getLinkTypeUrl = function getLinkTypeUrl(data) {
13
- return isLink(data) ? data.url : undefined;
14
- };
15
- var getResourceUrl = exports.getResourceUrl = function getResourceUrl(data) {
16
- var _data$key, _data$title;
17
- return getLinkTypeUrl(data === null || data === void 0 || (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 || (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
18
- };
@@ -1,6 +0,0 @@
1
- const isLink = data => typeof data === 'object' && 'url' in data;
2
- const getLinkTypeUrl = data => isLink(data) ? data.url : undefined;
3
- export const getResourceUrl = data => {
4
- var _data$key, _data$title;
5
- return getLinkTypeUrl(data === null || data === void 0 ? void 0 : (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 ? void 0 : (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
6
- };
@@ -1,11 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- var isLink = function isLink(data) {
3
- return _typeof(data) === 'object' && 'url' in data;
4
- };
5
- var getLinkTypeUrl = function getLinkTypeUrl(data) {
6
- return isLink(data) ? data.url : undefined;
7
- };
8
- export var getResourceUrl = function getResourceUrl(data) {
9
- var _data$key, _data$title;
10
- return getLinkTypeUrl(data === null || data === void 0 || (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 || (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
11
- };
@@ -1,2 +0,0 @@
1
- import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
2
- export declare const getResourceUrl: (data?: DatasourceDataResponseItem) => string | undefined;
@@ -1,2 +0,0 @@
1
- import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
2
- export declare const getResourceUrl: (data?: DatasourceDataResponseItem) => string | undefined;