@atlaskit/media-test-helpers 28.7.4 → 28.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/cjs/I18nWrapper.js +4 -4
- package/dist/cjs/authProvider.js +1 -2
- package/dist/cjs/fakeI18n.js +5 -1
- package/dist/cjs/fakeMediaClient.js +1 -0
- package/dist/cjs/getAuthFromContextProvider.js +2 -3
- package/dist/cjs/mediaPickerAuthProvider.js +2 -3
- package/dist/cjs/mockData/handlers/tenantAuth.js +2 -2
- package/dist/cjs/mocks/fileAndDirectoriesUtils.js +33 -39
- package/dist/cjs/mocks/routers/media-playground-router.js +3 -3
- package/dist/cjs/userAuthProvider.js +2 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/I18nWrapper.js +1 -1
- package/dist/es2019/authProvider.js +1 -2
- package/dist/es2019/fakeI18n.js +4 -2
- package/dist/es2019/fakeMediaClient.js +1 -0
- package/dist/es2019/getAuthFromContextProvider.js +2 -3
- package/dist/es2019/mediaPickerAuthProvider.js +2 -3
- package/dist/es2019/mockData/handlers/tenantAuth.js +2 -2
- package/dist/es2019/mocks/fileAndDirectoriesUtils.js +3 -6
- package/dist/es2019/mocks/routers/media-playground-router.js +3 -3
- package/dist/es2019/userAuthProvider.js +2 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/I18nWrapper.js +1 -1
- package/dist/esm/authProvider.js +1 -2
- package/dist/esm/fakeI18n.js +5 -1
- package/dist/esm/fakeMediaClient.js +1 -0
- package/dist/esm/getAuthFromContextProvider.js +2 -3
- package/dist/esm/mediaPickerAuthProvider.js +2 -3
- package/dist/esm/mockData/handlers/tenantAuth.js +2 -2
- package/dist/esm/mocks/fileAndDirectoriesUtils.js +33 -39
- package/dist/esm/mocks/routers/media-playground-router.js +3 -3
- package/dist/esm/userAuthProvider.js +2 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/featureFlagsWrapper/helpers.d.ts +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 28.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1724e1b8277`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1724e1b8277) - Extended fakeMediaClient with getImageUrlSync mock
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 28.8.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`11df2d9b882`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11df2d9b882) - Re-enabling non stargate url for media examples
|
|
18
|
+
- [`d15fbde3a83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d15fbde3a83) - Reverting media playground url change because of broken regression tests
|
|
19
|
+
- [`e362e52fc66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e362e52fc66) - Updating the media playground urls for media examples, to avoid stargate auth
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
22
|
+
## 28.8.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- [`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - Make `fakeIntl`'s `defaultMessage` member to be a `jest.fn` with default behvaiour returning provided `{defaultMessage}` argument with `fakeIntl[]` wrapping
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
32
|
+
## 28.7.5
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [`4777a174e6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4777a174e6d) - Added analytics support for customMediaPlayer + screen event + entrypoint for locales
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
|
|
3
39
|
## 28.7.4
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/dist/cjs/I18nWrapper.js
CHANGED
|
@@ -15,12 +15,12 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
|
|
18
|
-
var _mediaUi = require("@atlaskit/media-ui");
|
|
19
|
-
|
|
20
18
|
var _reactIntl = require("react-intl");
|
|
21
19
|
|
|
22
20
|
var _LocaleSelect = _interopRequireWildcard(require("@atlaskit/locale/LocaleSelect"));
|
|
23
21
|
|
|
22
|
+
var _locales = require("@atlaskit/media-ui/locales");
|
|
23
|
+
|
|
24
24
|
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); }
|
|
25
25
|
|
|
26
26
|
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; }
|
|
@@ -28,7 +28,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
28
28
|
function getMessages(localeValue) {
|
|
29
29
|
var lang = localeValue.substring(0, 2);
|
|
30
30
|
var langWithRegion = localeValue.replace('-', '_');
|
|
31
|
-
return
|
|
31
|
+
return _locales.locales[langWithRegion] || _locales.locales[lang];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var selectableLocales = _LocaleSelect.defaultLocales.reduce(function (result, locale) {
|
|
@@ -40,7 +40,7 @@ var selectableLocales = _LocaleSelect.defaultLocales.reduce(function (result, lo
|
|
|
40
40
|
}, []);
|
|
41
41
|
|
|
42
42
|
function addAllLocaleData() {
|
|
43
|
-
Object.keys(
|
|
43
|
+
Object.keys(_locales.locales).forEach(function (localeKey) {
|
|
44
44
|
var lang = localeKey.substring(0, 2);
|
|
45
45
|
|
|
46
46
|
var localeData = require("react-intl/locale-data/".concat(lang));
|
package/dist/cjs/authProvider.js
CHANGED
|
@@ -18,7 +18,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
18
18
|
var _collectionNames = require("./collectionNames");
|
|
19
19
|
|
|
20
20
|
var cachedAuths = {};
|
|
21
|
-
var authProviderBaseURL = 'https://
|
|
21
|
+
var authProviderBaseURL = 'https://media-playground.dev.atl-paas.net/';
|
|
22
22
|
|
|
23
23
|
var StoryBookAuthProvider = /*#__PURE__*/function () {
|
|
24
24
|
function StoryBookAuthProvider() {
|
|
@@ -41,7 +41,6 @@ var StoryBookAuthProvider = /*#__PURE__*/function () {
|
|
|
41
41
|
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
42
42
|
config = {
|
|
43
43
|
method: 'POST',
|
|
44
|
-
credentials: 'include',
|
|
45
44
|
headers: headers,
|
|
46
45
|
body: access ? JSON.stringify({
|
|
47
46
|
access: access
|
package/dist/cjs/fakeI18n.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.fakeIntl = void 0;
|
|
7
|
+
// fakeIntl["..."] here to indicate those went through formatMessage and not just left as string itself
|
|
7
8
|
var fakeIntl = {
|
|
8
|
-
formatMessage: function
|
|
9
|
+
formatMessage: jest.fn(function (_ref) {
|
|
10
|
+
var defaultMessage = _ref.defaultMessage;
|
|
11
|
+
return "fakeIntl[\"".concat(defaultMessage, "\"]");
|
|
12
|
+
})
|
|
9
13
|
};
|
|
10
14
|
exports.fakeIntl = fakeIntl;
|
|
@@ -54,6 +54,7 @@ var fakeMediaClient = function fakeMediaClient() {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
(0, _jestHelpers.asMock)(mediaClient.getImageUrl).mockResolvedValue('some-image-url');
|
|
57
|
+
(0, _jestHelpers.asMock)(mediaClient.getImageUrlSync).mockReturnValue('some-image-url');
|
|
57
58
|
(0, _jestHelpers.asMock)(mediaClient.getImage).mockImplementation(mockMediaStore.getImage);
|
|
58
59
|
(0, _jestHelpers.asMock)(mediaClient.collection.getItems).mockReturnValue((0, _of.of)([]));
|
|
59
60
|
(0, _jestHelpers.asMock)(mediaClient.file.copyFile).mockReturnValue({
|
|
@@ -29,7 +29,7 @@ var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
29
29
|
while (1) {
|
|
30
30
|
switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
|
-
url = 'https://
|
|
32
|
+
url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
|
|
33
33
|
body = JSON.stringify({
|
|
34
34
|
access: access
|
|
35
35
|
});
|
|
@@ -40,8 +40,7 @@ var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
40
40
|
return fetch(url, {
|
|
41
41
|
method: 'POST',
|
|
42
42
|
body: body,
|
|
43
|
-
headers: headers
|
|
44
|
-
credentials: 'include'
|
|
43
|
+
headers: headers
|
|
45
44
|
});
|
|
46
45
|
|
|
47
46
|
case 7:
|
|
@@ -43,7 +43,7 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
43
43
|
while (1) {
|
|
44
44
|
switch (_context.prev = _context.next) {
|
|
45
45
|
case 0:
|
|
46
|
-
url = "https://
|
|
46
|
+
url = "https://media-playground.dev.atl-paas.net/token/tenant?environment=".concat(authEnvironment);
|
|
47
47
|
body = JSON.stringify({
|
|
48
48
|
access: accessUrns[collectionName] || {}
|
|
49
49
|
});
|
|
@@ -54,8 +54,7 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
54
54
|
return fetch(url, {
|
|
55
55
|
method: 'POST',
|
|
56
56
|
body: body,
|
|
57
|
-
headers: headers
|
|
58
|
-
credentials: 'include'
|
|
57
|
+
headers: headers
|
|
59
58
|
});
|
|
60
59
|
|
|
61
60
|
case 7:
|
|
@@ -22,7 +22,7 @@ var tenantAuth = function tenantAuth(context) {
|
|
|
22
22
|
var data1 = {
|
|
23
23
|
method: 'POST',
|
|
24
24
|
url: {
|
|
25
|
-
path: '/
|
|
25
|
+
path: '/token/tenant',
|
|
26
26
|
query: {
|
|
27
27
|
collection: context().tenantContext.collectionName,
|
|
28
28
|
environment: ''
|
|
@@ -37,7 +37,7 @@ var tenantAuth = function tenantAuth(context) {
|
|
|
37
37
|
var data2 = {
|
|
38
38
|
method: 'GET',
|
|
39
39
|
url: {
|
|
40
|
-
path: '/
|
|
40
|
+
path: '/token/tenant',
|
|
41
41
|
query: {
|
|
42
42
|
collection: context().tenantContext.collectionName,
|
|
43
43
|
environment: ''
|
|
@@ -23,52 +23,46 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
23
23
|
// Based on https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
|
|
24
24
|
// Represents https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader
|
|
25
25
|
var createDataTransferItem = function createDataTransferItem(webkitGetAsEntryResult) {
|
|
26
|
-
return
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return webkitGetAsEntryResult;
|
|
38
|
-
}
|
|
26
|
+
return {
|
|
27
|
+
getAsFile: function getAsFile() {
|
|
28
|
+
return null;
|
|
29
|
+
},
|
|
30
|
+
getAsString: function getAsString() {
|
|
31
|
+
return '';
|
|
32
|
+
},
|
|
33
|
+
kind: 'file',
|
|
34
|
+
type: '',
|
|
35
|
+
webkitGetAsEntry: function webkitGetAsEntry() {
|
|
36
|
+
return webkitGetAsEntryResult;
|
|
39
37
|
}
|
|
40
|
-
|
|
38
|
+
};
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
var createFileList = function createFileList(filesArray) {
|
|
44
|
-
return (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
);
|
|
42
|
+
return _objectSpread(_objectSpread({}, filesArray), {}, {
|
|
43
|
+
length: filesArray.length,
|
|
44
|
+
item: function item(index) {
|
|
45
|
+
return filesArray[index];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
52
48
|
};
|
|
53
49
|
|
|
54
50
|
var createDataTransferItemList = function createDataTransferItemList(itemsArray) {
|
|
55
|
-
return (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
);
|
|
51
|
+
return _objectSpread(_objectSpread({}, itemsArray), {}, {
|
|
52
|
+
length: itemsArray.length,
|
|
53
|
+
add: function add() {
|
|
54
|
+
return null;
|
|
55
|
+
},
|
|
56
|
+
clear: function clear() {
|
|
57
|
+
return null;
|
|
58
|
+
},
|
|
59
|
+
item: function item(index) {
|
|
60
|
+
return itemsArray[index];
|
|
61
|
+
},
|
|
62
|
+
remove: function remove() {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
72
66
|
};
|
|
73
67
|
|
|
74
68
|
var createDataTransfer = function createDataTransfer(files, items) {
|
|
@@ -11,12 +11,12 @@ var _database = require("../database");
|
|
|
11
11
|
|
|
12
12
|
function createMediaPlaygroundRouter() {
|
|
13
13
|
var router = new _kakapo.Router({
|
|
14
|
-
host: 'https://
|
|
14
|
+
host: 'https://media-playground.dev.atl-paas.net',
|
|
15
15
|
requestDelay: 10
|
|
16
16
|
}, {
|
|
17
17
|
strategies: ['fetch']
|
|
18
18
|
});
|
|
19
|
-
router.get('/
|
|
20
|
-
router.post('/
|
|
19
|
+
router.get('/api/token/user/impersonation', _database.userAuthProvider);
|
|
20
|
+
router.post('/token/tenant', _database.tenantAuthProvider);
|
|
21
21
|
return router;
|
|
22
22
|
}
|
|
@@ -32,10 +32,9 @@ var userAuthProvider = function userAuthProvider() {
|
|
|
32
32
|
return userAuthProviderPromiseCache;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var url = 'https://
|
|
35
|
+
var url = 'https://media-playground.dev.atl-paas.net/api/token/user/impersonation';
|
|
36
36
|
userAuthProviderPromiseCache = fetch(url, {
|
|
37
|
-
method: 'GET'
|
|
38
|
-
credentials: 'include'
|
|
37
|
+
method: 'GET'
|
|
39
38
|
}).then(function (response) {
|
|
40
39
|
return (// We leverage the fact, that our internal /toke/tenant API returns data in the same format as Auth
|
|
41
40
|
response.json()
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { locales } from '@atlaskit/media-ui';
|
|
3
2
|
import { IntlProvider, addLocaleData } from 'react-intl';
|
|
4
3
|
import LocaleSelect, { defaultLocales } from '@atlaskit/locale/LocaleSelect';
|
|
4
|
+
import { locales } from '@atlaskit/media-ui/locales';
|
|
5
5
|
|
|
6
6
|
function getMessages(localeValue) {
|
|
7
7
|
const lang = localeValue.substring(0, 2);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultCollectionName } from './collectionNames';
|
|
2
2
|
const cachedAuths = {};
|
|
3
|
-
const authProviderBaseURL = 'https://
|
|
3
|
+
const authProviderBaseURL = 'https://media-playground.dev.atl-paas.net/';
|
|
4
4
|
export class StoryBookAuthProvider {
|
|
5
5
|
static create(isAsapEnvironment, access) {
|
|
6
6
|
const loadTenatAuth = async collectionName => {
|
|
@@ -10,7 +10,6 @@ export class StoryBookAuthProvider {
|
|
|
10
10
|
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
11
11
|
const config = {
|
|
12
12
|
method: 'POST',
|
|
13
|
-
credentials: 'include',
|
|
14
13
|
headers,
|
|
15
14
|
body: access ? JSON.stringify({
|
|
16
15
|
access
|
package/dist/es2019/fakeI18n.js
CHANGED
|
@@ -37,6 +37,7 @@ export const fakeMediaClient = (config = getDefaultMediaClientConfig()) => {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
asMock(mediaClient.getImageUrl).mockResolvedValue('some-image-url');
|
|
40
|
+
asMock(mediaClient.getImageUrlSync).mockReturnValue('some-image-url');
|
|
40
41
|
asMock(mediaClient.getImage).mockImplementation(mockMediaStore.getImage);
|
|
41
42
|
asMock(mediaClient.collection.getItems).mockReturnValue(of([]));
|
|
42
43
|
asMock(mediaClient.file.copyFile).mockReturnValue({
|
|
@@ -9,7 +9,7 @@ const access = {
|
|
|
9
9
|
'urn:filestore:collection:mediapicker-test': ['read', 'insert']
|
|
10
10
|
};
|
|
11
11
|
export const getAuthFromContextProvider = async () => {
|
|
12
|
-
const url = 'https://
|
|
12
|
+
const url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
|
|
13
13
|
const body = JSON.stringify({
|
|
14
14
|
access
|
|
15
15
|
});
|
|
@@ -19,8 +19,7 @@ export const getAuthFromContextProvider = async () => {
|
|
|
19
19
|
const response = await fetch(url, {
|
|
20
20
|
method: 'POST',
|
|
21
21
|
body,
|
|
22
|
-
headers
|
|
23
|
-
credentials: 'include'
|
|
22
|
+
headers
|
|
24
23
|
});
|
|
25
24
|
return response.json();
|
|
26
25
|
};
|
|
@@ -22,7 +22,7 @@ const accessUrns = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const requestAuthProvider = async (authEnvironment, collectionName) => {
|
|
25
|
-
const url = `https://
|
|
25
|
+
const url = `https://media-playground.dev.atl-paas.net/token/tenant?environment=${authEnvironment}`;
|
|
26
26
|
const body = JSON.stringify({
|
|
27
27
|
access: accessUrns[collectionName] || {}
|
|
28
28
|
});
|
|
@@ -32,8 +32,7 @@ const requestAuthProvider = async (authEnvironment, collectionName) => {
|
|
|
32
32
|
const response = await fetch(url, {
|
|
33
33
|
method: 'POST',
|
|
34
34
|
body,
|
|
35
|
-
headers
|
|
36
|
-
credentials: 'include'
|
|
35
|
+
headers
|
|
37
36
|
}); // We leverage the fact, that our internal /toke/tenant API returns data in the same format as Auth
|
|
38
37
|
|
|
39
38
|
return response.json();
|
|
@@ -12,7 +12,7 @@ export const tenantAuth = context => (req, res) => {
|
|
|
12
12
|
const data1 = {
|
|
13
13
|
method: 'POST',
|
|
14
14
|
url: {
|
|
15
|
-
path: '/
|
|
15
|
+
path: '/token/tenant',
|
|
16
16
|
query: {
|
|
17
17
|
collection: context().tenantContext.collectionName,
|
|
18
18
|
environment: ''
|
|
@@ -27,7 +27,7 @@ export const tenantAuth = context => (req, res) => {
|
|
|
27
27
|
const data2 = {
|
|
28
28
|
method: 'GET',
|
|
29
29
|
url: {
|
|
30
|
-
path: '/
|
|
30
|
+
path: '/token/tenant',
|
|
31
31
|
query: {
|
|
32
32
|
collection: context().tenantContext.collectionName,
|
|
33
33
|
environment: ''
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
// Based on https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
|
|
8
8
|
// Based on https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
|
|
9
9
|
// Represents https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader
|
|
10
|
-
const createDataTransferItem = webkitGetAsEntryResult => (
|
|
11
|
-
{
|
|
10
|
+
const createDataTransferItem = webkitGetAsEntryResult => ({
|
|
12
11
|
getAsFile: () => null,
|
|
13
12
|
|
|
14
13
|
getAsString() {
|
|
@@ -20,14 +19,12 @@ const createDataTransferItem = webkitGetAsEntryResult => ( // Using DataTransfer
|
|
|
20
19
|
webkitGetAsEntry: () => webkitGetAsEntryResult
|
|
21
20
|
});
|
|
22
21
|
|
|
23
|
-
const createFileList = filesArray => (
|
|
24
|
-
{ ...filesArray,
|
|
22
|
+
const createFileList = filesArray => ({ ...filesArray,
|
|
25
23
|
length: filesArray.length,
|
|
26
24
|
item: index => filesArray[index]
|
|
27
25
|
});
|
|
28
26
|
|
|
29
|
-
const createDataTransferItemList = itemsArray => (
|
|
30
|
-
{ ...itemsArray,
|
|
27
|
+
const createDataTransferItemList = itemsArray => ({ ...itemsArray,
|
|
31
28
|
length: itemsArray.length,
|
|
32
29
|
add: () => null,
|
|
33
30
|
clear: () => null,
|
|
@@ -2,12 +2,12 @@ import { Router } from 'kakapo';
|
|
|
2
2
|
import { userAuthProvider, tenantAuthProvider } from '../database';
|
|
3
3
|
export function createMediaPlaygroundRouter() {
|
|
4
4
|
const router = new Router({
|
|
5
|
-
host: 'https://
|
|
5
|
+
host: 'https://media-playground.dev.atl-paas.net',
|
|
6
6
|
requestDelay: 10
|
|
7
7
|
}, {
|
|
8
8
|
strategies: ['fetch']
|
|
9
9
|
});
|
|
10
|
-
router.get('/
|
|
11
|
-
router.post('/
|
|
10
|
+
router.get('/api/token/user/impersonation', userAuthProvider);
|
|
11
|
+
router.post('/token/tenant', tenantAuthProvider);
|
|
12
12
|
return router;
|
|
13
13
|
}
|
|
@@ -15,10 +15,9 @@ export const userAuthProvider = () => {
|
|
|
15
15
|
return userAuthProviderPromiseCache;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const url = 'https://
|
|
18
|
+
const url = 'https://media-playground.dev.atl-paas.net/api/token/user/impersonation';
|
|
19
19
|
userAuthProviderPromiseCache = fetch(url, {
|
|
20
|
-
method: 'GET'
|
|
21
|
-
credentials: 'include'
|
|
20
|
+
method: 'GET'
|
|
22
21
|
}).then(response => // We leverage the fact, that our internal /toke/tenant API returns data in the same format as Auth
|
|
23
22
|
response.json());
|
|
24
23
|
return userAuthProviderPromiseCache;
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/I18nWrapper.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import { locales } from '@atlaskit/media-ui';
|
|
5
4
|
import { IntlProvider, addLocaleData } from 'react-intl';
|
|
6
5
|
import LocaleSelect, { defaultLocales } from '@atlaskit/locale/LocaleSelect';
|
|
6
|
+
import { locales } from '@atlaskit/media-ui/locales';
|
|
7
7
|
|
|
8
8
|
function getMessages(localeValue) {
|
|
9
9
|
var lang = localeValue.substring(0, 2);
|
package/dist/esm/authProvider.js
CHANGED
|
@@ -4,7 +4,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import { defaultCollectionName } from './collectionNames';
|
|
6
6
|
var cachedAuths = {};
|
|
7
|
-
var authProviderBaseURL = 'https://
|
|
7
|
+
var authProviderBaseURL = 'https://media-playground.dev.atl-paas.net/';
|
|
8
8
|
export var StoryBookAuthProvider = /*#__PURE__*/function () {
|
|
9
9
|
function StoryBookAuthProvider() {
|
|
10
10
|
_classCallCheck(this, StoryBookAuthProvider);
|
|
@@ -26,7 +26,6 @@ export var StoryBookAuthProvider = /*#__PURE__*/function () {
|
|
|
26
26
|
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
27
27
|
config = {
|
|
28
28
|
method: 'POST',
|
|
29
|
-
credentials: 'include',
|
|
30
29
|
headers: headers,
|
|
31
30
|
body: access ? JSON.stringify({
|
|
32
31
|
access: access
|
package/dist/esm/fakeI18n.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// fakeIntl["..."] here to indicate those went through formatMessage and not just left as string itself
|
|
1
2
|
export var fakeIntl = {
|
|
2
|
-
formatMessage: function
|
|
3
|
+
formatMessage: jest.fn(function (_ref) {
|
|
4
|
+
var defaultMessage = _ref.defaultMessage;
|
|
5
|
+
return "fakeIntl[\"".concat(defaultMessage, "\"]");
|
|
6
|
+
})
|
|
3
7
|
};
|
|
@@ -41,6 +41,7 @@ export var fakeMediaClient = function fakeMediaClient() {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
asMock(mediaClient.getImageUrl).mockResolvedValue('some-image-url');
|
|
44
|
+
asMock(mediaClient.getImageUrlSync).mockReturnValue('some-image-url');
|
|
44
45
|
asMock(mediaClient.getImage).mockImplementation(mockMediaStore.getImage);
|
|
45
46
|
asMock(mediaClient.collection.getItems).mockReturnValue(of([]));
|
|
46
47
|
asMock(mediaClient.file.copyFile).mockReturnValue({
|
|
@@ -17,7 +17,7 @@ export var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
17
17
|
while (1) {
|
|
18
18
|
switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
|
-
url = 'https://
|
|
20
|
+
url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
|
|
21
21
|
body = JSON.stringify({
|
|
22
22
|
access: access
|
|
23
23
|
});
|
|
@@ -28,8 +28,7 @@ export var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
28
28
|
return fetch(url, {
|
|
29
29
|
method: 'POST',
|
|
30
30
|
body: body,
|
|
31
|
-
headers: headers
|
|
32
|
-
credentials: 'include'
|
|
31
|
+
headers: headers
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
case 7:
|
|
@@ -30,7 +30,7 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
30
30
|
while (1) {
|
|
31
31
|
switch (_context.prev = _context.next) {
|
|
32
32
|
case 0:
|
|
33
|
-
url = "https://
|
|
33
|
+
url = "https://media-playground.dev.atl-paas.net/token/tenant?environment=".concat(authEnvironment);
|
|
34
34
|
body = JSON.stringify({
|
|
35
35
|
access: accessUrns[collectionName] || {}
|
|
36
36
|
});
|
|
@@ -41,8 +41,7 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
41
41
|
return fetch(url, {
|
|
42
42
|
method: 'POST',
|
|
43
43
|
body: body,
|
|
44
|
-
headers: headers
|
|
45
|
-
credentials: 'include'
|
|
44
|
+
headers: headers
|
|
46
45
|
});
|
|
47
46
|
|
|
48
47
|
case 7:
|
|
@@ -13,7 +13,7 @@ export var tenantAuth = function tenantAuth(context) {
|
|
|
13
13
|
var data1 = {
|
|
14
14
|
method: 'POST',
|
|
15
15
|
url: {
|
|
16
|
-
path: '/
|
|
16
|
+
path: '/token/tenant',
|
|
17
17
|
query: {
|
|
18
18
|
collection: context().tenantContext.collectionName,
|
|
19
19
|
environment: ''
|
|
@@ -28,7 +28,7 @@ export var tenantAuth = function tenantAuth(context) {
|
|
|
28
28
|
var data2 = {
|
|
29
29
|
method: 'GET',
|
|
30
30
|
url: {
|
|
31
|
-
path: '/
|
|
31
|
+
path: '/token/tenant',
|
|
32
32
|
query: {
|
|
33
33
|
collection: context().tenantContext.collectionName,
|
|
34
34
|
environment: ''
|
|
@@ -14,52 +14,46 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
// Based on https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
|
|
15
15
|
// Represents https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader
|
|
16
16
|
var createDataTransferItem = function createDataTransferItem(webkitGetAsEntryResult) {
|
|
17
|
-
return
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return webkitGetAsEntryResult;
|
|
29
|
-
}
|
|
17
|
+
return {
|
|
18
|
+
getAsFile: function getAsFile() {
|
|
19
|
+
return null;
|
|
20
|
+
},
|
|
21
|
+
getAsString: function getAsString() {
|
|
22
|
+
return '';
|
|
23
|
+
},
|
|
24
|
+
kind: 'file',
|
|
25
|
+
type: '',
|
|
26
|
+
webkitGetAsEntry: function webkitGetAsEntry() {
|
|
27
|
+
return webkitGetAsEntryResult;
|
|
30
28
|
}
|
|
31
|
-
|
|
29
|
+
};
|
|
32
30
|
};
|
|
33
31
|
|
|
34
32
|
var createFileList = function createFileList(filesArray) {
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
);
|
|
33
|
+
return _objectSpread(_objectSpread({}, filesArray), {}, {
|
|
34
|
+
length: filesArray.length,
|
|
35
|
+
item: function item(index) {
|
|
36
|
+
return filesArray[index];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
43
39
|
};
|
|
44
40
|
|
|
45
41
|
var createDataTransferItemList = function createDataTransferItemList(itemsArray) {
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
);
|
|
42
|
+
return _objectSpread(_objectSpread({}, itemsArray), {}, {
|
|
43
|
+
length: itemsArray.length,
|
|
44
|
+
add: function add() {
|
|
45
|
+
return null;
|
|
46
|
+
},
|
|
47
|
+
clear: function clear() {
|
|
48
|
+
return null;
|
|
49
|
+
},
|
|
50
|
+
item: function item(index) {
|
|
51
|
+
return itemsArray[index];
|
|
52
|
+
},
|
|
53
|
+
remove: function remove() {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
63
57
|
};
|
|
64
58
|
|
|
65
59
|
var createDataTransfer = function createDataTransfer(files, items) {
|
|
@@ -2,12 +2,12 @@ import { Router } from 'kakapo';
|
|
|
2
2
|
import { userAuthProvider, tenantAuthProvider } from '../database';
|
|
3
3
|
export function createMediaPlaygroundRouter() {
|
|
4
4
|
var router = new Router({
|
|
5
|
-
host: 'https://
|
|
5
|
+
host: 'https://media-playground.dev.atl-paas.net',
|
|
6
6
|
requestDelay: 10
|
|
7
7
|
}, {
|
|
8
8
|
strategies: ['fetch']
|
|
9
9
|
});
|
|
10
|
-
router.get('/
|
|
11
|
-
router.post('/
|
|
10
|
+
router.get('/api/token/user/impersonation', userAuthProvider);
|
|
11
|
+
router.post('/token/tenant', tenantAuthProvider);
|
|
12
12
|
return router;
|
|
13
13
|
}
|
|
@@ -15,10 +15,9 @@ export var userAuthProvider = function userAuthProvider() {
|
|
|
15
15
|
return userAuthProviderPromiseCache;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
var url = 'https://
|
|
18
|
+
var url = 'https://media-playground.dev.atl-paas.net/api/token/user/impersonation';
|
|
19
19
|
userAuthProviderPromiseCache = fetch(url, {
|
|
20
|
-
method: 'GET'
|
|
21
|
-
credentials: 'include'
|
|
20
|
+
method: 'GET'
|
|
22
21
|
}).then(function (response) {
|
|
23
22
|
return (// We leverage the fact, that our internal /toke/tenant API returns data in the same format as Auth
|
|
24
23
|
response.json()
|
package/dist/esm/version.json
CHANGED
|
@@ -2,4 +2,4 @@ import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
|
2
2
|
export declare const setLocalFeatureFlag: (key: keyof MediaFeatureFlags, value: number | boolean | string | Object) => void;
|
|
3
3
|
export declare const clearLocalFeatureFlag: (key: keyof MediaFeatureFlags) => void;
|
|
4
4
|
export declare const clearAllLocalFeatureFlags: () => void;
|
|
5
|
-
export declare const getMediaFeatureFlags: (filter?: ("newCardExperience" | "
|
|
5
|
+
export declare const getMediaFeatureFlags: (filter?: ("newCardExperience" | "captions" | "mediaInline" | "folderUploads")[] | undefined) => MediaFeatureFlags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.9.0",
|
|
4
4
|
"description": "Collection of test helpers used in media component stories and specs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@atlaskit/button": "^16.0.0",
|
|
23
23
|
"@atlaskit/checkbox": "^12.2.0",
|
|
24
|
-
"@atlaskit/icon": "^21.
|
|
24
|
+
"@atlaskit/icon": "^21.9.0",
|
|
25
25
|
"@atlaskit/locale": "^2.1.0",
|
|
26
|
-
"@atlaskit/media-client": "^14.
|
|
27
|
-
"@atlaskit/media-common": "^2.
|
|
26
|
+
"@atlaskit/media-client": "^14.3.0",
|
|
27
|
+
"@atlaskit/media-common": "^2.10.0",
|
|
28
28
|
"@atlaskit/media-core": "^32.2.0",
|
|
29
|
-
"@atlaskit/media-picker": "^58.
|
|
30
|
-
"@atlaskit/media-ui": "^
|
|
29
|
+
"@atlaskit/media-picker": "^58.1.0",
|
|
30
|
+
"@atlaskit/media-ui": "^17.2.0",
|
|
31
31
|
"@atlaskit/popup": "^1.1.0",
|
|
32
32
|
"@atlaskit/textfield": "^5.0.1",
|
|
33
|
-
"@atlaskit/tooltip": "^17.
|
|
33
|
+
"@atlaskit/tooltip": "^17.5.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"enzyme": "^3.10.0",
|
|
36
36
|
"exenv": "^1.2.2",
|