@atlaskit/link-datasource 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/common/utils/locale/fetch-messages-for-locale.js +63 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +9 -3
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/common/utils/locale/fetch-messages-for-locale.js +21 -0
- package/dist/es2019/ui/assets-modal/modal/index.js +9 -3
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/common/utils/locale/fetch-messages-for-locale.js +41 -0
- package/dist/esm/ui/assets-modal/modal/index.js +9 -3
- package/dist/types/common/utils/locale/fetch-messages-for-locale.d.ts +2 -0
- package/dist/types-ts4.5/common/utils/locale/fetch-messages-for-locale.d.ts +2 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42063](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42063) [`74fd796c7c7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/74fd796c7c7) - Internationalisation for Assets LOL
|
|
8
|
+
|
|
3
9
|
## 1.10.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.fetchMessagesForLocale = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _en = _interopRequireDefault(require("../../../i18n/en"));
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
var fetchMessagesForLocale = exports.fetchMessagesForLocale = /*#__PURE__*/function () {
|
|
15
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(locale) {
|
|
16
|
+
var _messages, parentLocale, _messages2;
|
|
17
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
_context.prev = 0;
|
|
21
|
+
_context.next = 3;
|
|
22
|
+
return function (specifier) {
|
|
23
|
+
return new Promise(function (r) {
|
|
24
|
+
return r(specifier);
|
|
25
|
+
}).then(function (s) {
|
|
26
|
+
return _interopRequireWildcard(require(s));
|
|
27
|
+
});
|
|
28
|
+
}( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(locale.replace('-', '_')));
|
|
29
|
+
case 3:
|
|
30
|
+
_messages = _context.sent;
|
|
31
|
+
return _context.abrupt("return", _messages.default);
|
|
32
|
+
case 7:
|
|
33
|
+
_context.prev = 7;
|
|
34
|
+
_context.t0 = _context["catch"](0);
|
|
35
|
+
case 9:
|
|
36
|
+
_context.prev = 9;
|
|
37
|
+
parentLocale = locale.split(/[-_]/)[0];
|
|
38
|
+
_context.next = 13;
|
|
39
|
+
return function (specifier) {
|
|
40
|
+
return new Promise(function (r) {
|
|
41
|
+
return r(specifier);
|
|
42
|
+
}).then(function (s) {
|
|
43
|
+
return _interopRequireWildcard(require(s));
|
|
44
|
+
});
|
|
45
|
+
}( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(parentLocale));
|
|
46
|
+
case 13:
|
|
47
|
+
_messages2 = _context.sent;
|
|
48
|
+
return _context.abrupt("return", _messages2.default);
|
|
49
|
+
case 17:
|
|
50
|
+
_context.prev = 17;
|
|
51
|
+
_context.t1 = _context["catch"](9);
|
|
52
|
+
case 19:
|
|
53
|
+
return _context.abrupt("return", _en.default);
|
|
54
|
+
case 20:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee, null, [[0, 7], [9, 17]]);
|
|
59
|
+
}));
|
|
60
|
+
return function fetchMessagesForLocale(_x) {
|
|
61
|
+
return _ref.apply(this, arguments);
|
|
62
|
+
};
|
|
63
|
+
}();
|
|
@@ -16,10 +16,13 @@ var _react2 = require("@emotion/react");
|
|
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
18
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
19
|
+
var _intlMessagesProvider = require("@atlaskit/intl-messages-provider");
|
|
19
20
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
20
21
|
var _analytics = require("../../../analytics");
|
|
22
|
+
var _fetchMessagesForLocale = require("../../../common/utils/locale/fetch-messages-for-locale");
|
|
21
23
|
var _useAssetsClient2 = require("../../../hooks/useAssetsClient");
|
|
22
24
|
var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
|
|
25
|
+
var _en = _interopRequireDefault(require("../../../i18n/en"));
|
|
23
26
|
var _modalLoadingError = require("../../common/error-state/modal-loading-error");
|
|
24
27
|
var _searchContainer = require("../search-container");
|
|
25
28
|
var _loadingState = require("../search-container/loading-state");
|
|
@@ -193,7 +196,10 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
193
196
|
});
|
|
194
197
|
}
|
|
195
198
|
}, [aql, assetsClientLoading, handleOnSearch, objectSchema, status, workspaceError, workspaceId]);
|
|
196
|
-
return (0, _react2.jsx)(
|
|
199
|
+
return (0, _react2.jsx)(_intlMessagesProvider.IntlMessagesProvider, {
|
|
200
|
+
defaultMessages: _en.default,
|
|
201
|
+
loaderFn: _fetchMessagesForLocale.fetchMessagesForLocale
|
|
202
|
+
}, (0, _react2.jsx)(_modalDialog.ModalTransition, null, (0, _react2.jsx)(_modalDialog.default, {
|
|
197
203
|
testId: 'asset-datasource-modal',
|
|
198
204
|
onClose: onCancel,
|
|
199
205
|
width: "calc(100% - 80px)",
|
|
@@ -227,14 +233,14 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
227
233
|
values: {
|
|
228
234
|
objectsCount: responseItems.length
|
|
229
235
|
}
|
|
230
|
-
}))))));
|
|
236
|
+
})))))));
|
|
231
237
|
};
|
|
232
238
|
var analyticsContextAttributes = {
|
|
233
239
|
dataProvider: 'jsm-assets'
|
|
234
240
|
};
|
|
235
241
|
var analyticsContextData = {
|
|
236
242
|
packageName: "@atlaskit/link-datasource",
|
|
237
|
-
packageVersion: "1.10.
|
|
243
|
+
packageVersion: "1.10.1",
|
|
238
244
|
source: 'datasourceConfigModal'
|
|
239
245
|
};
|
|
240
246
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import messages from '../../../i18n/en';
|
|
2
|
+
export const fetchMessagesForLocale = async locale => {
|
|
3
|
+
try {
|
|
4
|
+
const messages = await import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */`../../../i18n/${locale.replace('-', '_')}`);
|
|
5
|
+
return messages.default;
|
|
6
|
+
} catch (e) {
|
|
7
|
+
// ignore
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const parentLocale = locale.split(/[-_]/)[0];
|
|
11
|
+
const messages = await import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */`../../../i18n/${parentLocale}`);
|
|
12
|
+
return messages.default;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
// ignore
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* English bundled by default as this is the majority of users
|
|
19
|
+
*/
|
|
20
|
+
return messages;
|
|
21
|
+
};
|
|
@@ -5,10 +5,13 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
7
7
|
import Button from '@atlaskit/button/standard-button';
|
|
8
|
+
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
8
9
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
9
10
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
11
|
+
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
10
12
|
import { useAssetsClient } from '../../../hooks/useAssetsClient';
|
|
11
13
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
14
|
+
import i18nEN from '../../../i18n/en';
|
|
12
15
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
13
16
|
import { AssetsSearchContainer } from '../search-container';
|
|
14
17
|
import { AssetsSearchContainerLoading } from '../search-container/loading-state';
|
|
@@ -153,7 +156,10 @@ const PlainAssetsConfigModal = props => {
|
|
|
153
156
|
});
|
|
154
157
|
}
|
|
155
158
|
}, [aql, assetsClientLoading, handleOnSearch, objectSchema, status, workspaceError, workspaceId]);
|
|
156
|
-
return jsx(
|
|
159
|
+
return jsx(IntlMessagesProvider, {
|
|
160
|
+
defaultMessages: i18nEN,
|
|
161
|
+
loaderFn: fetchMessagesForLocale
|
|
162
|
+
}, jsx(ModalTransition, null, jsx(Modal, {
|
|
157
163
|
testId: 'asset-datasource-modal',
|
|
158
164
|
onClose: onCancel,
|
|
159
165
|
width: "calc(100% - 80px)",
|
|
@@ -187,14 +193,14 @@ const PlainAssetsConfigModal = props => {
|
|
|
187
193
|
values: {
|
|
188
194
|
objectsCount: responseItems.length
|
|
189
195
|
}
|
|
190
|
-
}))))));
|
|
196
|
+
})))))));
|
|
191
197
|
};
|
|
192
198
|
const analyticsContextAttributes = {
|
|
193
199
|
dataProvider: 'jsm-assets'
|
|
194
200
|
};
|
|
195
201
|
const analyticsContextData = {
|
|
196
202
|
packageName: "@atlaskit/link-datasource",
|
|
197
|
-
packageVersion: "1.10.
|
|
203
|
+
packageVersion: "1.10.1",
|
|
198
204
|
source: 'datasourceConfigModal'
|
|
199
205
|
};
|
|
200
206
|
const contextData = {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import messages from '../../../i18n/en';
|
|
4
|
+
export var fetchMessagesForLocale = /*#__PURE__*/function () {
|
|
5
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(locale) {
|
|
6
|
+
var _messages, parentLocale, _messages2;
|
|
7
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9
|
+
case 0:
|
|
10
|
+
_context.prev = 0;
|
|
11
|
+
_context.next = 3;
|
|
12
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(locale.replace('-', '_')));
|
|
13
|
+
case 3:
|
|
14
|
+
_messages = _context.sent;
|
|
15
|
+
return _context.abrupt("return", _messages.default);
|
|
16
|
+
case 7:
|
|
17
|
+
_context.prev = 7;
|
|
18
|
+
_context.t0 = _context["catch"](0);
|
|
19
|
+
case 9:
|
|
20
|
+
_context.prev = 9;
|
|
21
|
+
parentLocale = locale.split(/[-_]/)[0];
|
|
22
|
+
_context.next = 13;
|
|
23
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/link-datasource-i18n-[request]" */"../../../i18n/".concat(parentLocale));
|
|
24
|
+
case 13:
|
|
25
|
+
_messages2 = _context.sent;
|
|
26
|
+
return _context.abrupt("return", _messages2.default);
|
|
27
|
+
case 17:
|
|
28
|
+
_context.prev = 17;
|
|
29
|
+
_context.t1 = _context["catch"](9);
|
|
30
|
+
case 19:
|
|
31
|
+
return _context.abrupt("return", messages);
|
|
32
|
+
case 20:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee, null, [[0, 7], [9, 17]]);
|
|
37
|
+
}));
|
|
38
|
+
return function fetchMessagesForLocale(_x) {
|
|
39
|
+
return _ref.apply(this, arguments);
|
|
40
|
+
};
|
|
41
|
+
}();
|
|
@@ -11,10 +11,13 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
13
13
|
import Button from '@atlaskit/button/standard-button';
|
|
14
|
+
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
14
15
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
15
16
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
17
|
+
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
16
18
|
import { useAssetsClient } from '../../../hooks/useAssetsClient';
|
|
17
19
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
20
|
+
import i18nEN from '../../../i18n/en';
|
|
18
21
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
19
22
|
import { AssetsSearchContainer } from '../search-container';
|
|
20
23
|
import { AssetsSearchContainerLoading } from '../search-container/loading-state';
|
|
@@ -184,7 +187,10 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
184
187
|
});
|
|
185
188
|
}
|
|
186
189
|
}, [aql, assetsClientLoading, handleOnSearch, objectSchema, status, workspaceError, workspaceId]);
|
|
187
|
-
return jsx(
|
|
190
|
+
return jsx(IntlMessagesProvider, {
|
|
191
|
+
defaultMessages: i18nEN,
|
|
192
|
+
loaderFn: fetchMessagesForLocale
|
|
193
|
+
}, jsx(ModalTransition, null, jsx(Modal, {
|
|
188
194
|
testId: 'asset-datasource-modal',
|
|
189
195
|
onClose: onCancel,
|
|
190
196
|
width: "calc(100% - 80px)",
|
|
@@ -218,14 +224,14 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
218
224
|
values: {
|
|
219
225
|
objectsCount: responseItems.length
|
|
220
226
|
}
|
|
221
|
-
}))))));
|
|
227
|
+
})))))));
|
|
222
228
|
};
|
|
223
229
|
var analyticsContextAttributes = {
|
|
224
230
|
dataProvider: 'jsm-assets'
|
|
225
231
|
};
|
|
226
232
|
var analyticsContextData = {
|
|
227
233
|
packageName: "@atlaskit/link-datasource",
|
|
228
|
-
packageVersion: "1.10.
|
|
234
|
+
packageVersion: "1.10.1",
|
|
229
235
|
source: 'datasourceConfigModal'
|
|
230
236
|
};
|
|
231
237
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@atlaskit/icon": "^21.12.0",
|
|
42
42
|
"@atlaskit/icon-object": "^6.3.0",
|
|
43
43
|
"@atlaskit/image": "^1.1.0",
|
|
44
|
+
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
44
45
|
"@atlaskit/jql-ast": "^3.0.0",
|
|
45
46
|
"@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
|
|
46
47
|
"@atlaskit/link-client-extension": "^1.7.0",
|