@atlaskit/link-datasource 1.1.3 → 1.1.5

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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
  4. package/dist/cjs/ui/common/error-state/loading-error.js +1 -1
  5. package/dist/cjs/ui/common/error-state/messages.js +4 -4
  6. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -1
  7. package/dist/cjs/ui/jira-issues-modal/modal/index.js +13 -4
  8. package/dist/cjs/ui/table-footer/index.js +11 -11
  9. package/dist/cjs/ui/table-footer/messages.js +4 -4
  10. package/dist/es2019/analytics/constants.js +1 -1
  11. package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
  12. package/dist/es2019/ui/common/error-state/loading-error.js +1 -1
  13. package/dist/es2019/ui/common/error-state/messages.js +4 -4
  14. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -1
  15. package/dist/es2019/ui/jira-issues-modal/modal/index.js +11 -2
  16. package/dist/es2019/ui/table-footer/index.js +11 -11
  17. package/dist/es2019/ui/table-footer/messages.js +4 -4
  18. package/dist/esm/analytics/constants.js +1 -1
  19. package/dist/esm/ui/assets-modal/modal/index.js +1 -1
  20. package/dist/esm/ui/common/error-state/loading-error.js +1 -1
  21. package/dist/esm/ui/common/error-state/messages.js +4 -4
  22. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -1
  23. package/dist/esm/ui/jira-issues-modal/modal/index.js +13 -4
  24. package/dist/esm/ui/table-footer/index.js +11 -11
  25. package/dist/esm/ui/table-footer/messages.js +4 -4
  26. package/dist/types/ui/common/error-state/messages.d.ts +1 -1
  27. package/dist/types/ui/table-footer/index.d.ts +2 -2
  28. package/dist/types/ui/table-footer/messages.d.ts +1 -1
  29. package/dist/types-ts4.5/ui/common/error-state/messages.d.ts +1 -1
  30. package/dist/types-ts4.5/ui/table-footer/index.d.ts +2 -2
  31. package/dist/types-ts4.5/ui/table-footer/messages.d.ts +1 -1
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cd31900dba6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd31900dba6) - [ux] Renaming 'issues' to 'items' to be more generic
8
+
9
+ ## 1.1.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`067fe62a1dc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/067fe62a1dc) - [ux] Updated logic for site selector to default to current site
14
+
3
15
  ## 1.1.3
4
16
 
5
17
  ### Patch Changes
@@ -8,6 +8,6 @@ var EVENT_CHANNEL = 'media';
8
8
  exports.EVENT_CHANNEL = EVENT_CHANNEL;
9
9
  var packageMetaData = {
10
10
  packageName: "@atlaskit/link-datasource",
11
- packageVersion: "1.1.3"
11
+ packageVersion: "1.1.5"
12
12
  };
13
13
  exports.packageMetaData = packageMetaData;
@@ -231,7 +231,7 @@ var analyticsContextAttributes = {
231
231
  };
232
232
  var analyticsContextData = {
233
233
  packageName: "@atlaskit/link-datasource",
234
- packageVersion: "1.1.3",
234
+ packageVersion: "1.1.5",
235
235
  source: 'datasourceConfigModal'
236
236
  };
237
237
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -48,7 +48,7 @@ var LoadingError = function LoadingError(_ref) {
48
48
  css: errorMessageContainerStyles
49
49
  }, (0, _react2.jsx)("span", {
50
50
  css: errorMessageStyles
51
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadIssues)), (0, _react2.jsx)("p", {
51
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.unableToLoadItems)), (0, _react2.jsx)("p", {
52
52
  css: errorDescriptionStyles
53
53
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.loadingErrorMessages.checkConnection)), onRefresh && (0, _react2.jsx)(_standardButton.default, {
54
54
  appearance: "primary",
@@ -41,10 +41,10 @@ var loadingErrorMessages = (0, _reactIntlNext.defineMessages)({
41
41
  description: 'Button text to allow the user to refresh the table to see results',
42
42
  defaultMessage: 'Refresh'
43
43
  },
44
- unableToLoadIssues: {
45
- id: 'linkDataSource.jira-issues.unableToLoadIssues',
46
- description: 'Error state message letting the user know we were unable the load the requested list of issues',
47
- defaultMessage: 'Unable to load issues'
44
+ unableToLoadItems: {
45
+ id: 'linkDataSource.jira-issues.unableToLoadItems',
46
+ description: 'Error state message letting the user know we were unable the load the requested list of items',
47
+ defaultMessage: 'Unable to load items'
48
48
  },
49
49
  unableToLoadResults: {
50
50
  id: 'linkDataSource.jira-issues.unableToLoadResults',
@@ -103,7 +103,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
103
103
  isCompact: true,
104
104
  isLoading: !isDataReady || status === 'loading'
105
105
  }), (0, _react2.jsx)(_tableFooter.TableFooter, {
106
- issueCount: isDataReady ? totalCount : undefined,
106
+ itemCount: isDataReady ? totalCount : undefined,
107
107
  onRefresh: forcedReset,
108
108
  isLoading: !isDataReady || status === 'loading'
109
109
  }))
@@ -146,9 +146,18 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
146
146
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
147
147
  fireEvent = _useDatasourceAnalyti.fireEvent;
148
148
  var selectedJiraSite = (0, _react.useMemo)(function () {
149
- return availableSites.find(function (jiraSite) {
150
- return jiraSite.cloudId === cloudId;
151
- }) || availableSites[0];
149
+ if (cloudId) {
150
+ // if the cloud id we're editing isn't in available sites then user is likely unauthorized for that site
151
+ // TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
152
+ return availableSites.find(function (jiraSite) {
153
+ return jiraSite.cloudId === cloudId;
154
+ }) || availableSites[0];
155
+ } else {
156
+ var currentlyLoggedInSiteUrl = window.location.origin;
157
+ return availableSites.find(function (jiraSite) {
158
+ return jiraSite.url === currentlyLoggedInSiteUrl;
159
+ }) || availableSites[0];
160
+ }
152
161
  }, [availableSites, cloudId]);
153
162
  var buttonClickedAnalyticsPayload = (0, _react.useMemo)(function () {
154
163
  return {
@@ -196,7 +205,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
196
205
  void fetchSiteDisplayNames();
197
206
  }, [fireEvent]);
198
207
  (0, _react.useEffect)(function () {
199
- if (!cloudId && selectedJiraSite) {
208
+ if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
200
209
  setCloudId(selectedJiraSite.cloudId);
201
210
  }
202
211
  }, [cloudId, selectedJiraSite]);
@@ -22,11 +22,11 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
22
22
  /** @jsx jsx */
23
23
  var FooterWrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 ", ";\n box-sizing: border-box;\n background: ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-background-input, ".concat(_colors.N0, ")"));
24
24
  var TopBorderWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n padding: ", " 0;\n border-top: 2px solid ", ";\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"));
25
- var IssueCounterWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
25
+ var ItemCounterWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
26
26
  var SyncWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N90, ")"));
27
27
  var SyncTextWrapper = _styled.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: 5px;\n font-size: 12px;\n"])));
28
28
  var TableFooter = function TableFooter(_ref) {
29
- var issueCount = _ref.issueCount,
29
+ var itemCount = _ref.itemCount,
30
30
  onRefresh = _ref.onRefresh,
31
31
  isLoading = _ref.isLoading;
32
32
  var intl = (0, _reactIntlNext.useIntl)();
@@ -34,7 +34,7 @@ var TableFooter = function TableFooter(_ref) {
34
34
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
35
  lastSyncTime = _useState2[0],
36
36
  setLastSyncTime = _useState2[1];
37
- var showIssueCount = issueCount && issueCount > 0 ? true : issueCount === 0 ? !isLoading : false;
37
+ var showItemCount = itemCount && itemCount > 0 ? true : itemCount === 0 ? !isLoading : false;
38
38
  (0, _react.useEffect)(function () {
39
39
  if (isLoading) {
40
40
  setLastSyncTime(new Date());
@@ -43,18 +43,18 @@ var TableFooter = function TableFooter(_ref) {
43
43
 
44
44
  // If only one of the two is passed in, still show the other one (Note: We keep the div encapsulating the one not shown to
45
45
  // ensure correct positioning since 'justify-content: space-between' is used).
46
- return onRefresh || showIssueCount ? (0, _react2.jsx)(FooterWrapper, {
46
+ return onRefresh || showItemCount ? (0, _react2.jsx)(FooterWrapper, {
47
47
  "data-testid": "table-footer"
48
- }, (0, _react2.jsx)(TopBorderWrapper, null, (0, _react2.jsx)(IssueCounterWrapper, {
49
- "data-testid": 'issue-count-wrapper'
50
- }, showIssueCount && (0, _react2.jsx)(_heading.default, {
51
- testId: "issue-count",
48
+ }, (0, _react2.jsx)(TopBorderWrapper, null, (0, _react2.jsx)(ItemCounterWrapper, {
49
+ "data-testid": 'item-count-wrapper'
50
+ }, showItemCount && (0, _react2.jsx)(_heading.default, {
51
+ testId: "item-count",
52
52
  level: "h200"
53
53
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
54
- value: issueCount
55
- }), ' ', (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.footerMessages.issueText, {
54
+ value: itemCount
55
+ }), ' ', (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.footerMessages.itemText, {
56
56
  values: {
57
- issueCount: issueCount
57
+ itemCount: itemCount
58
58
  }
59
59
  })))), (0, _react2.jsx)(SyncWrapper, null, onRefresh && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(SyncTextWrapper, {
60
60
  "data-testid": "sync-text"
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.footerMessages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
8
  var footerMessages = (0, _reactIntlNext.defineMessages)({
9
- issueText: {
10
- id: 'linkDataSource.table-footer.issue',
11
- description: 'Text that appears after issue count number.',
12
- defaultMessage: '{issueCount, plural, one {issue} other {issues}}'
9
+ itemText: {
10
+ id: 'linkDataSource.table-footer.item',
11
+ description: 'Text that appears after item count number.',
12
+ defaultMessage: '{itemCount, plural, one {item} other {items}}'
13
13
  },
14
14
  loadingText: {
15
15
  id: 'linkDataSource.table-footer.loading',
@@ -1,5 +1,5 @@
1
1
  export const EVENT_CHANNEL = 'media';
2
2
  export const packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.1.3"
4
+ packageVersion: "1.1.5"
5
5
  };
@@ -205,7 +205,7 @@ const analyticsContextAttributes = {
205
205
  };
206
206
  const analyticsContextData = {
207
207
  packageName: "@atlaskit/link-datasource",
208
- packageVersion: "1.1.3",
208
+ packageVersion: "1.1.5",
209
209
  source: 'datasourceConfigModal'
210
210
  };
211
211
  const contextData = {
@@ -42,7 +42,7 @@ export const LoadingError = ({
42
42
  css: errorMessageContainerStyles
43
43
  }, jsx("span", {
44
44
  css: errorMessageStyles
45
- }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadIssues)), jsx("p", {
45
+ }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadItems)), jsx("p", {
46
46
  css: errorDescriptionStyles
47
47
  }, jsx(FormattedMessage, loadingErrorMessages.checkConnection)), onRefresh && jsx(Button, {
48
48
  appearance: "primary",
@@ -35,10 +35,10 @@ export const loadingErrorMessages = defineMessages({
35
35
  description: 'Button text to allow the user to refresh the table to see results',
36
36
  defaultMessage: 'Refresh'
37
37
  },
38
- unableToLoadIssues: {
39
- id: 'linkDataSource.jira-issues.unableToLoadIssues',
40
- description: 'Error state message letting the user know we were unable the load the requested list of issues',
41
- defaultMessage: 'Unable to load issues'
38
+ unableToLoadItems: {
39
+ id: 'linkDataSource.jira-issues.unableToLoadItems',
40
+ description: 'Error state message letting the user know we were unable the load the requested list of items',
41
+ defaultMessage: 'Unable to load items'
42
42
  },
43
43
  unableToLoadResults: {
44
44
  id: 'linkDataSource.jira-issues.unableToLoadResults',
@@ -97,7 +97,7 @@ const DatasourceTableViewWithoutAnalytics = ({
97
97
  isCompact: true,
98
98
  isLoading: !isDataReady || status === 'loading'
99
99
  }), jsx(TableFooter, {
100
- issueCount: isDataReady ? totalCount : undefined,
100
+ itemCount: isDataReady ? totalCount : undefined,
101
101
  onRefresh: forcedReset,
102
102
  isLoading: !isDataReady || status === 'loading'
103
103
  }))
@@ -116,7 +116,16 @@ export const PlainJiraIssuesConfigModal = props => {
116
116
  const {
117
117
  fireEvent
118
118
  } = useDatasourceAnalyticsEvents();
119
- const selectedJiraSite = useMemo(() => availableSites.find(jiraSite => jiraSite.cloudId === cloudId) || availableSites[0], [availableSites, cloudId]);
119
+ const selectedJiraSite = useMemo(() => {
120
+ if (cloudId) {
121
+ // if the cloud id we're editing isn't in available sites then user is likely unauthorized for that site
122
+ // TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
123
+ return availableSites.find(jiraSite => jiraSite.cloudId === cloudId) || availableSites[0];
124
+ } else {
125
+ const currentlyLoggedInSiteUrl = window.location.origin;
126
+ return availableSites.find(jiraSite => jiraSite.url === currentlyLoggedInSiteUrl) || availableSites[0];
127
+ }
128
+ }, [availableSites, cloudId]);
120
129
  const buttonClickedAnalyticsPayload = useMemo(() => {
121
130
  return {
122
131
  extensionKey: extensionKey,
@@ -146,7 +155,7 @@ export const PlainJiraIssuesConfigModal = props => {
146
155
  void fetchSiteDisplayNames();
147
156
  }, [fireEvent]);
148
157
  useEffect(() => {
149
- if (!cloudId && selectedJiraSite) {
158
+ if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
150
159
  setCloudId(selectedJiraSite.cloudId);
151
160
  }
152
161
  }, [cloudId, selectedJiraSite]);
@@ -22,7 +22,7 @@ const TopBorderWrapper = styled.div`
22
22
  padding: ${"var(--ds-space-250, 20px)"} 0;
23
23
  border-top: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`};
24
24
  `;
25
- const IssueCounterWrapper = styled.div`
25
+ const ItemCounterWrapper = styled.div`
26
26
  display: flex;
27
27
  align-self: center;
28
28
  color: ${`var(--ds-text-accent-gray, ${N800})`};
@@ -37,13 +37,13 @@ const SyncTextWrapper = styled.div`
37
37
  font-size: 12px;
38
38
  `;
39
39
  export const TableFooter = ({
40
- issueCount,
40
+ itemCount,
41
41
  onRefresh,
42
42
  isLoading
43
43
  }) => {
44
44
  const intl = useIntl();
45
45
  const [lastSyncTime, setLastSyncTime] = useState(new Date());
46
- const showIssueCount = issueCount && issueCount > 0 ? true : issueCount === 0 ? !isLoading : false;
46
+ const showItemCount = itemCount && itemCount > 0 ? true : itemCount === 0 ? !isLoading : false;
47
47
  useEffect(() => {
48
48
  if (isLoading) {
49
49
  setLastSyncTime(new Date());
@@ -52,18 +52,18 @@ export const TableFooter = ({
52
52
 
53
53
  // If only one of the two is passed in, still show the other one (Note: We keep the div encapsulating the one not shown to
54
54
  // ensure correct positioning since 'justify-content: space-between' is used).
55
- return onRefresh || showIssueCount ? jsx(FooterWrapper, {
55
+ return onRefresh || showItemCount ? jsx(FooterWrapper, {
56
56
  "data-testid": "table-footer"
57
- }, jsx(TopBorderWrapper, null, jsx(IssueCounterWrapper, {
58
- "data-testid": 'issue-count-wrapper'
59
- }, showIssueCount && jsx(Heading, {
60
- testId: "issue-count",
57
+ }, jsx(TopBorderWrapper, null, jsx(ItemCounterWrapper, {
58
+ "data-testid": 'item-count-wrapper'
59
+ }, showItemCount && jsx(Heading, {
60
+ testId: "item-count",
61
61
  level: "h200"
62
62
  }, jsx(FormattedNumber, {
63
- value: issueCount
64
- }), ' ', jsx(FormattedMessage, _extends({}, footerMessages.issueText, {
63
+ value: itemCount
64
+ }), ' ', jsx(FormattedMessage, _extends({}, footerMessages.itemText, {
65
65
  values: {
66
- issueCount
66
+ itemCount
67
67
  }
68
68
  })))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
69
69
  "data-testid": "sync-text"
@@ -1,9 +1,9 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export const footerMessages = defineMessages({
3
- issueText: {
4
- id: 'linkDataSource.table-footer.issue',
5
- description: 'Text that appears after issue count number.',
6
- defaultMessage: '{issueCount, plural, one {issue} other {issues}}'
3
+ itemText: {
4
+ id: 'linkDataSource.table-footer.item',
5
+ description: 'Text that appears after item count number.',
6
+ defaultMessage: '{itemCount, plural, one {item} other {items}}'
7
7
  },
8
8
  loadingText: {
9
9
  id: 'linkDataSource.table-footer.loading',
@@ -1,5 +1,5 @@
1
1
  export var EVENT_CHANNEL = 'media';
2
2
  export var packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.1.3"
4
+ packageVersion: "1.1.5"
5
5
  };
@@ -222,7 +222,7 @@ var analyticsContextAttributes = {
222
222
  };
223
223
  var analyticsContextData = {
224
224
  packageName: "@atlaskit/link-datasource",
225
- packageVersion: "1.1.3",
225
+ packageVersion: "1.1.5",
226
226
  source: 'datasourceConfigModal'
227
227
  };
228
228
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -40,7 +40,7 @@ export var LoadingError = function LoadingError(_ref) {
40
40
  css: errorMessageContainerStyles
41
41
  }, jsx("span", {
42
42
  css: errorMessageStyles
43
- }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadIssues)), jsx("p", {
43
+ }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadItems)), jsx("p", {
44
44
  css: errorDescriptionStyles
45
45
  }, jsx(FormattedMessage, loadingErrorMessages.checkConnection)), onRefresh && jsx(Button, {
46
46
  appearance: "primary",
@@ -35,10 +35,10 @@ export var loadingErrorMessages = defineMessages({
35
35
  description: 'Button text to allow the user to refresh the table to see results',
36
36
  defaultMessage: 'Refresh'
37
37
  },
38
- unableToLoadIssues: {
39
- id: 'linkDataSource.jira-issues.unableToLoadIssues',
40
- description: 'Error state message letting the user know we were unable the load the requested list of issues',
41
- defaultMessage: 'Unable to load issues'
38
+ unableToLoadItems: {
39
+ id: 'linkDataSource.jira-issues.unableToLoadItems',
40
+ description: 'Error state message letting the user know we were unable the load the requested list of items',
41
+ defaultMessage: 'Unable to load items'
42
42
  },
43
43
  unableToLoadResults: {
44
44
  id: 'linkDataSource.jira-issues.unableToLoadResults',
@@ -95,7 +95,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
95
95
  isCompact: true,
96
96
  isLoading: !isDataReady || status === 'loading'
97
97
  }), jsx(TableFooter, {
98
- issueCount: isDataReady ? totalCount : undefined,
98
+ itemCount: isDataReady ? totalCount : undefined,
99
99
  onRefresh: forcedReset,
100
100
  isLoading: !isDataReady || status === 'loading'
101
101
  }))
@@ -136,9 +136,18 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
136
136
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
137
137
  fireEvent = _useDatasourceAnalyti.fireEvent;
138
138
  var selectedJiraSite = useMemo(function () {
139
- return availableSites.find(function (jiraSite) {
140
- return jiraSite.cloudId === cloudId;
141
- }) || availableSites[0];
139
+ if (cloudId) {
140
+ // if the cloud id we're editing isn't in available sites then user is likely unauthorized for that site
141
+ // TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
142
+ return availableSites.find(function (jiraSite) {
143
+ return jiraSite.cloudId === cloudId;
144
+ }) || availableSites[0];
145
+ } else {
146
+ var currentlyLoggedInSiteUrl = window.location.origin;
147
+ return availableSites.find(function (jiraSite) {
148
+ return jiraSite.url === currentlyLoggedInSiteUrl;
149
+ }) || availableSites[0];
150
+ }
142
151
  }, [availableSites, cloudId]);
143
152
  var buttonClickedAnalyticsPayload = useMemo(function () {
144
153
  return {
@@ -186,7 +195,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
186
195
  void fetchSiteDisplayNames();
187
196
  }, [fireEvent]);
188
197
  useEffect(function () {
189
- if (!cloudId && selectedJiraSite) {
198
+ if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
190
199
  setCloudId(selectedJiraSite.cloudId);
191
200
  }
192
201
  }, [cloudId, selectedJiraSite]);
@@ -15,11 +15,11 @@ import { footerMessages } from './messages';
15
15
  import { SyncInfo } from './sync-info';
16
16
  var FooterWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 ", ";\n box-sizing: border-box;\n background: ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-background-input, ".concat(N0, ")"));
17
17
  var TopBorderWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n padding: ", " 0;\n border-top: 2px solid ", ";\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
18
- var IssueCounterWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N800, ")"));
18
+ var ItemCounterWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N800, ")"));
19
19
  var SyncWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N90, ")"));
20
20
  var SyncTextWrapper = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-right: 5px;\n font-size: 12px;\n"])));
21
21
  export var TableFooter = function TableFooter(_ref) {
22
- var issueCount = _ref.issueCount,
22
+ var itemCount = _ref.itemCount,
23
23
  onRefresh = _ref.onRefresh,
24
24
  isLoading = _ref.isLoading;
25
25
  var intl = useIntl();
@@ -27,7 +27,7 @@ export var TableFooter = function TableFooter(_ref) {
27
27
  _useState2 = _slicedToArray(_useState, 2),
28
28
  lastSyncTime = _useState2[0],
29
29
  setLastSyncTime = _useState2[1];
30
- var showIssueCount = issueCount && issueCount > 0 ? true : issueCount === 0 ? !isLoading : false;
30
+ var showItemCount = itemCount && itemCount > 0 ? true : itemCount === 0 ? !isLoading : false;
31
31
  useEffect(function () {
32
32
  if (isLoading) {
33
33
  setLastSyncTime(new Date());
@@ -36,18 +36,18 @@ export var TableFooter = function TableFooter(_ref) {
36
36
 
37
37
  // If only one of the two is passed in, still show the other one (Note: We keep the div encapsulating the one not shown to
38
38
  // ensure correct positioning since 'justify-content: space-between' is used).
39
- return onRefresh || showIssueCount ? jsx(FooterWrapper, {
39
+ return onRefresh || showItemCount ? jsx(FooterWrapper, {
40
40
  "data-testid": "table-footer"
41
- }, jsx(TopBorderWrapper, null, jsx(IssueCounterWrapper, {
42
- "data-testid": 'issue-count-wrapper'
43
- }, showIssueCount && jsx(Heading, {
44
- testId: "issue-count",
41
+ }, jsx(TopBorderWrapper, null, jsx(ItemCounterWrapper, {
42
+ "data-testid": 'item-count-wrapper'
43
+ }, showItemCount && jsx(Heading, {
44
+ testId: "item-count",
45
45
  level: "h200"
46
46
  }, jsx(FormattedNumber, {
47
- value: issueCount
48
- }), ' ', jsx(FormattedMessage, _extends({}, footerMessages.issueText, {
47
+ value: itemCount
48
+ }), ' ', jsx(FormattedMessage, _extends({}, footerMessages.itemText, {
49
49
  values: {
50
- issueCount: issueCount
50
+ itemCount: itemCount
51
51
  }
52
52
  })))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
53
53
  "data-testid": "sync-text"
@@ -1,9 +1,9 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export var footerMessages = defineMessages({
3
- issueText: {
4
- id: 'linkDataSource.table-footer.issue',
5
- description: 'Text that appears after issue count number.',
6
- defaultMessage: '{issueCount, plural, one {issue} other {issues}}'
3
+ itemText: {
4
+ id: 'linkDataSource.table-footer.item',
5
+ description: 'Text that appears after item count number.',
6
+ defaultMessage: '{itemCount, plural, one {item} other {items}}'
7
7
  },
8
8
  loadingText: {
9
9
  id: 'linkDataSource.table-footer.loading',
@@ -34,7 +34,7 @@ export declare const loadingErrorMessages: {
34
34
  description: string;
35
35
  defaultMessage: string;
36
36
  };
37
- unableToLoadIssues: {
37
+ unableToLoadItems: {
38
38
  id: string;
39
39
  description: string;
40
40
  defaultMessage: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  export type TableFooterProps = {
3
- issueCount?: number;
3
+ itemCount?: number;
4
4
  onRefresh?: () => void;
5
5
  isLoading: boolean;
6
6
  };
7
- export declare const TableFooter: ({ issueCount, onRefresh, isLoading, }: TableFooterProps) => jsx.JSX.Element | null;
7
+ export declare const TableFooter: ({ itemCount, onRefresh, isLoading, }: TableFooterProps) => jsx.JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  export declare const footerMessages: {
2
- issueText: {
2
+ itemText: {
3
3
  id: string;
4
4
  description: string;
5
5
  defaultMessage: string;
@@ -34,7 +34,7 @@ export declare const loadingErrorMessages: {
34
34
  description: string;
35
35
  defaultMessage: string;
36
36
  };
37
- unableToLoadIssues: {
37
+ unableToLoadItems: {
38
38
  id: string;
39
39
  description: string;
40
40
  defaultMessage: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  export type TableFooterProps = {
3
- issueCount?: number;
3
+ itemCount?: number;
4
4
  onRefresh?: () => void;
5
5
  isLoading: boolean;
6
6
  };
7
- export declare const TableFooter: ({ issueCount, onRefresh, isLoading, }: TableFooterProps) => jsx.JSX.Element | null;
7
+ export declare const TableFooter: ({ itemCount, onRefresh, isLoading, }: TableFooterProps) => jsx.JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  export declare const footerMessages: {
2
- issueText: {
2
+ itemText: {
3
3
  id: string;
4
4
  description: string;
5
5
  defaultMessage: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"