@atlaskit/media-test-helpers 29.2.1 → 29.3.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 +85 -0
- package/dist/cjs/fileStateFactory/factory.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/fileStateFactory/factory.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/fileStateFactory/factory.js +3 -3
- package/dist/esm/version.json +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 29.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f862d5ae7aa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f862d5ae7aa) - remove RxJs peer dependency
|
|
8
|
+
- [`118f3af101f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/118f3af101f) - Media Client APIs has been updated to use MediaSubscribable which provides subscription functionality (similar to RxJs observables).
|
|
9
|
+
It exposes subscribe method that is called with MediaObserver as an argument and returns MediaSubscription.
|
|
10
|
+
MediaSubscription exposes unsubscribe method.
|
|
11
|
+
|
|
12
|
+
getFileState:
|
|
13
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
17
|
+
|
|
18
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
19
|
+
|
|
20
|
+
const fileStateSubscribable: MediaSubscribable<FileState> = mediaClient.file.getFileState(id);
|
|
21
|
+
|
|
22
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
23
|
+
next: (fileState) => {
|
|
24
|
+
nextCallback(fileState)
|
|
25
|
+
},
|
|
26
|
+
error: (error) => {
|
|
27
|
+
errorCallback(error)
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const subscription: MediaSubscription = fileStateSubscribable.subscribe(mediaObserver);
|
|
32
|
+
|
|
33
|
+
subscription.unsubscribe();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
upload:
|
|
37
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
41
|
+
|
|
42
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
43
|
+
|
|
44
|
+
const uploadFileSubscribable: MediaSubscribable<FileState> = mediaClient.file.upload(uploadableFile);
|
|
45
|
+
|
|
46
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
47
|
+
next: (fileState) => {
|
|
48
|
+
nextCallback(fileState)
|
|
49
|
+
},
|
|
50
|
+
error: (error) => {
|
|
51
|
+
errorCallback(error)
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const subscription: MediaSubscription = uploadFileSubscribable.subscribe(mediaObserver);
|
|
56
|
+
|
|
57
|
+
subscription.unsubscribe();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
getItems:
|
|
61
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
65
|
+
|
|
66
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
67
|
+
|
|
68
|
+
const collectionItemsSubscribable: MediaSubscribable<MediaCollectionItem[]> = mediaClient.collection.getItems(collectionName);
|
|
69
|
+
|
|
70
|
+
const mediaObserver: MediaObserver<MediaCollectionItem[]> = {
|
|
71
|
+
next: (items) => {
|
|
72
|
+
nextCallback(items)
|
|
73
|
+
},
|
|
74
|
+
error: (error) => {
|
|
75
|
+
errorCallback(error)
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const subscription: MediaSubscription = collectionItemsSubscribable.subscribe(mediaObserver);
|
|
80
|
+
|
|
81
|
+
subscription.unsubscribe();
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies
|
|
87
|
+
|
|
3
88
|
## 29.2.1
|
|
4
89
|
|
|
5
90
|
### Patch Changes
|
|
@@ -143,7 +143,7 @@ var FileStateFactory = /*#__PURE__*/(0, _createClass2.default)(function FileStat
|
|
|
143
143
|
(0, _defineProperty2.default)(this, "updateIdentifier", function (identifier, fileDetails) {
|
|
144
144
|
_this2.identifier = identifier;
|
|
145
145
|
_this2.fileDetails = fileDetails || (0, _helpers.createFileDetails)(_this2.identifier.id);
|
|
146
|
-
_this2.observable = (0, _mediaClient.
|
|
146
|
+
_this2.observable = (0, _mediaClient.createMediaSubject)();
|
|
147
147
|
|
|
148
148
|
_this2.mediaClient.updateObserbable(_this2.observable);
|
|
149
149
|
});
|
|
@@ -168,7 +168,7 @@ var FileStateFactory = /*#__PURE__*/(0, _createClass2.default)(function FileStat
|
|
|
168
168
|
});
|
|
169
169
|
this.identifier = identifier;
|
|
170
170
|
this.fileDetails = _fileDetails || (0, _helpers.createFileDetails)(this.identifier.id);
|
|
171
|
-
this.observable = (0, _mediaClient.
|
|
171
|
+
this.observable = (0, _mediaClient.createMediaSubject)();
|
|
172
172
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
173
173
|
});
|
|
174
174
|
exports.FileStateFactory = FileStateFactory;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { tallImage, dataURItoBlob } from '..';
|
|
3
|
-
import { MediaClient,
|
|
3
|
+
import { MediaClient, createMediaSubject } from '@atlaskit/media-client';
|
|
4
4
|
import { createFileState } from './createFileState';
|
|
5
5
|
import { createFileDetails } from './helpers';
|
|
6
6
|
import { sleep } from '../nextTick';
|
|
@@ -53,7 +53,7 @@ export class FileStateFactory {
|
|
|
53
53
|
_defineProperty(this, "updateIdentifier", (identifier, fileDetails) => {
|
|
54
54
|
this.identifier = identifier;
|
|
55
55
|
this.fileDetails = fileDetails || createFileDetails(this.identifier.id);
|
|
56
|
-
this.observable =
|
|
56
|
+
this.observable = createMediaSubject();
|
|
57
57
|
this.mediaClient.updateObserbable(this.observable);
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -80,7 +80,7 @@ export class FileStateFactory {
|
|
|
80
80
|
|
|
81
81
|
this.identifier = identifier;
|
|
82
82
|
this.fileDetails = _fileDetails || createFileDetails(this.identifier.id);
|
|
83
|
-
this.observable =
|
|
83
|
+
this.observable = createMediaSubject();
|
|
84
84
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
85
85
|
}
|
|
86
86
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -17,7 +17,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
17
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
18
|
|
|
19
19
|
import { tallImage, dataURItoBlob } from '..';
|
|
20
|
-
import { MediaClient,
|
|
20
|
+
import { MediaClient, createMediaSubject } from '@atlaskit/media-client';
|
|
21
21
|
import { createFileState } from './createFileState';
|
|
22
22
|
import { createFileDetails } from './helpers';
|
|
23
23
|
import { sleep } from '../nextTick';
|
|
@@ -126,7 +126,7 @@ export var FileStateFactory = /*#__PURE__*/_createClass(function FileStateFactor
|
|
|
126
126
|
_defineProperty(this, "updateIdentifier", function (identifier, fileDetails) {
|
|
127
127
|
_this2.identifier = identifier;
|
|
128
128
|
_this2.fileDetails = fileDetails || createFileDetails(_this2.identifier.id);
|
|
129
|
-
_this2.observable =
|
|
129
|
+
_this2.observable = createMediaSubject();
|
|
130
130
|
|
|
131
131
|
_this2.mediaClient.updateObserbable(_this2.observable);
|
|
132
132
|
});
|
|
@@ -156,6 +156,6 @@ export var FileStateFactory = /*#__PURE__*/_createClass(function FileStateFactor
|
|
|
156
156
|
|
|
157
157
|
this.identifier = identifier;
|
|
158
158
|
this.fileDetails = _fileDetails || createFileDetails(this.identifier.id);
|
|
159
|
-
this.observable =
|
|
159
|
+
this.observable = createMediaSubject();
|
|
160
160
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
161
161
|
});
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.3.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/"
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@atlaskit/checkbox": "^12.2.0",
|
|
24
24
|
"@atlaskit/icon": "^21.10.0",
|
|
25
25
|
"@atlaskit/locale": "^2.1.0",
|
|
26
|
-
"@atlaskit/media-client": "^
|
|
26
|
+
"@atlaskit/media-client": "^15.0.0",
|
|
27
27
|
"@atlaskit/media-common": "^2.11.0",
|
|
28
|
-
"@atlaskit/media-core": "^32.
|
|
29
|
-
"@atlaskit/media-picker": "^
|
|
30
|
-
"@atlaskit/media-ui": "^
|
|
28
|
+
"@atlaskit/media-core": "^32.3.0",
|
|
29
|
+
"@atlaskit/media-picker": "^60.0.0",
|
|
30
|
+
"@atlaskit/media-ui": "^21.0.0",
|
|
31
31
|
"@atlaskit/popup": "^1.3.0",
|
|
32
32
|
"@atlaskit/textfield": "^5.0.1",
|
|
33
33
|
"@atlaskit/tooltip": "^17.5.0",
|
|
@@ -40,17 +40,16 @@
|
|
|
40
40
|
"mock-socket": "^9.0.3",
|
|
41
41
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
42
42
|
"react-redux": "^5.1.2",
|
|
43
|
+
"rxjs": "^5.5.0",
|
|
43
44
|
"uuid": "^3.1.0",
|
|
44
45
|
"xhr-mock": "^2.4.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"react": "^16.8.0"
|
|
48
|
-
"rxjs": "^5.5.0"
|
|
48
|
+
"react": "^16.8.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
52
52
|
"react-dom": "^16.8.0",
|
|
53
|
-
"rxjs": "^5.5.0",
|
|
54
53
|
"typescript": "3.9.6"
|
|
55
54
|
},
|
|
56
55
|
"af:exports": {
|