@atlaskit/media-client 24.0.3 → 25.0.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 +12 -0
- package/dist/cjs/index.js +1 -96
- package/dist/cjs/utils/request/helpers.js +32 -117
- package/dist/es2019/index.js +2 -50
- package/dist/es2019/utils/request/helpers.js +0 -47
- package/dist/esm/index.js +2 -50
- package/dist/esm/utils/request/helpers.js +32 -115
- package/dist/types/index.d.ts +1 -45
- package/dist/types/utils/request/helpers.d.ts +0 -16
- package/dist/types-ts4.5/index.d.ts +1 -45
- package/dist/types-ts4.5/utils/request/helpers.d.ts +0 -16
- package/package.json +4 -14
- package/report.api.md +1 -89
- package/tmp/api-report-tmp.d.ts +0 -72
- package/dist/cjs/utils/isImageRemote.js +0 -22
- package/dist/cjs/utils/safeUnsubscribe.js +0 -14
- package/dist/cjs/utils/with-media-client-hoc.js +0 -88
- package/dist/es2019/utils/isImageRemote.js +0 -15
- package/dist/es2019/utils/safeUnsubscribe.js +0 -6
- package/dist/es2019/utils/with-media-client-hoc.js +0 -62
- package/dist/esm/utils/isImageRemote.js +0 -16
- package/dist/esm/utils/safeUnsubscribe.js +0 -8
- package/dist/esm/utils/with-media-client-hoc.js +0 -82
- package/dist/types/utils/isImageRemote.d.ts +0 -1
- package/dist/types/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types/utils/with-media-client-hoc.d.ts +0 -33
- package/dist/types-ts4.5/utils/isImageRemote.d.ts +0 -1
- package/dist/types-ts4.5/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types-ts4.5/utils/with-media-client-hoc.d.ts +0 -33
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ import { MediaType } from '@atlaskit/media-common';
|
|
|
25
25
|
import { ProcessedFileState } from '@atlaskit/media-state';
|
|
26
26
|
import { ProcessingFailedState } from '@atlaskit/media-state';
|
|
27
27
|
import { ProcessingFileState } from '@atlaskit/media-state';
|
|
28
|
-
import { default as React_2 } from 'react';
|
|
29
28
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
30
29
|
import { UploadingFileState } from '@atlaskit/media-state';
|
|
31
30
|
|
|
@@ -337,9 +336,6 @@ export interface GetFileOptions {
|
|
|
337
336
|
// @public (undocumented)
|
|
338
337
|
export const getFileStreamsCache: () => StreamsCache<FileState>;
|
|
339
338
|
|
|
340
|
-
// @public @deprecated (undocumented)
|
|
341
|
-
export const getMediaClient: (mediaClientConfig: MediaClientConfig) => MediaClient;
|
|
342
|
-
|
|
343
339
|
// @public (undocumented)
|
|
344
340
|
export function getMediaClientErrorReason(err: Error): 'unknown' | MediaClientErrorReason;
|
|
345
341
|
|
|
@@ -349,9 +345,6 @@ export const getMediaEnvironment: () => string | undefined;
|
|
|
349
345
|
// @public (undocumented)
|
|
350
346
|
export const getMediaRegion: () => string | undefined;
|
|
351
347
|
|
|
352
|
-
// @public @deprecated (undocumented)
|
|
353
|
-
export const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
|
|
354
|
-
|
|
355
348
|
// @public (undocumented)
|
|
356
349
|
export const globalMediaEventEmitter: {
|
|
357
350
|
on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E, any>): void;
|
|
@@ -389,18 +382,9 @@ export const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => M
|
|
|
389
382
|
// @public (undocumented)
|
|
390
383
|
export function isAbortedRequestError(err: any): boolean;
|
|
391
384
|
|
|
392
|
-
// @public @deprecated (undocumented)
|
|
393
|
-
export const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
394
|
-
|
|
395
385
|
// @public (undocumented)
|
|
396
386
|
export const isDifferentIdentifier: (a: Identifier, b: Identifier) => boolean;
|
|
397
387
|
|
|
398
|
-
// @public @deprecated (undocumented)
|
|
399
|
-
export const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
400
|
-
|
|
401
|
-
// @public @deprecated (undocumented)
|
|
402
|
-
export const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
403
|
-
|
|
404
388
|
// @public (undocumented)
|
|
405
389
|
export const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
406
390
|
|
|
@@ -416,15 +400,6 @@ export const isFileIdentifier: (identifier: Identifier) => identifier is FileIde
|
|
|
416
400
|
// @public (undocumented)
|
|
417
401
|
export const isFinalFileState: (fileState: FileState) => fileState is ErrorFileState | ProcessedFileState | ProcessingFailedState;
|
|
418
402
|
|
|
419
|
-
// @public @deprecated (undocumented)
|
|
420
|
-
export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
421
|
-
|
|
422
|
-
// @public @deprecated (undocumented)
|
|
423
|
-
export const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
424
|
-
|
|
425
|
-
// @public (undocumented)
|
|
426
|
-
export const isImageRemote: (imageUrl: string, windowOrigin?: string) => boolean;
|
|
427
|
-
|
|
428
403
|
// @public (undocumented)
|
|
429
404
|
export const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
430
405
|
|
|
@@ -439,12 +414,6 @@ export function isMediaClientError(error: any): error is MediaClientError<{
|
|
|
439
414
|
// @public (undocumented)
|
|
440
415
|
export function isMediaStoreError(err: Error): err is MediaStoreError;
|
|
441
416
|
|
|
442
|
-
// @public @deprecated (undocumented)
|
|
443
|
-
export const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
444
|
-
|
|
445
|
-
// @public @deprecated (undocumented)
|
|
446
|
-
export const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
447
|
-
|
|
448
417
|
// @public (undocumented)
|
|
449
418
|
export function isPollingError(err?: Error): err is PollingError;
|
|
450
419
|
|
|
@@ -466,15 +435,9 @@ export function isRateLimitedError(error: Error | undefined): boolean;
|
|
|
466
435
|
// @public (undocumented)
|
|
467
436
|
export function isRequestError(err: Error): err is RequestError;
|
|
468
437
|
|
|
469
|
-
// @public @deprecated (undocumented)
|
|
470
|
-
export const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
471
|
-
|
|
472
438
|
// @public (undocumented)
|
|
473
439
|
export const isUploadingFileState: (fileState: FileState) => fileState is UploadingFileState;
|
|
474
440
|
|
|
475
|
-
// @public @deprecated (undocumented)
|
|
476
|
-
export const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
477
|
-
|
|
478
441
|
// @public (undocumented)
|
|
479
442
|
export interface ItemsPayload {
|
|
480
443
|
// (undocumented)
|
|
@@ -487,15 +450,6 @@ export const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>)
|
|
|
487
450
|
// @public (undocumented)
|
|
488
451
|
export const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
|
|
489
452
|
|
|
490
|
-
// @public @deprecated (undocumented)
|
|
491
|
-
export function mapResponseToBlob(response: Response): Promise<Blob>;
|
|
492
|
-
|
|
493
|
-
// @public @deprecated (undocumented)
|
|
494
|
-
export function mapResponseToJson(response: Response): Promise<any>;
|
|
495
|
-
|
|
496
|
-
// @public @deprecated (undocumented)
|
|
497
|
-
export function mapResponseToVoid(): Promise<void>;
|
|
498
|
-
|
|
499
453
|
// @public (undocumented)
|
|
500
454
|
export const MAX_RESOLUTION = 4096;
|
|
501
455
|
|
|
@@ -1082,9 +1036,6 @@ export type RetryOptions = {
|
|
|
1082
1036
|
readonly factor: number;
|
|
1083
1037
|
};
|
|
1084
1038
|
|
|
1085
|
-
// @public (undocumented)
|
|
1086
|
-
export const safeUnsubscribe: (subscription: MediaSubscription) => void;
|
|
1087
|
-
|
|
1088
1039
|
// @public (undocumented)
|
|
1089
1040
|
export interface SourceFile {
|
|
1090
1041
|
// (undocumented)
|
|
@@ -1197,29 +1148,6 @@ export interface UploadFileResult {
|
|
|
1197
1148
|
|
|
1198
1149
|
export { UploadingFileState }
|
|
1199
1150
|
|
|
1200
|
-
// @public @deprecated (undocumented)
|
|
1201
|
-
export interface WithMediaClient {
|
|
1202
|
-
// (undocumented)
|
|
1203
|
-
identifier?: Identifier;
|
|
1204
|
-
// (undocumented)
|
|
1205
|
-
mediaClient: MediaClient;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
// @public @deprecated (undocumented)
|
|
1209
|
-
export const withMediaClient: WithMediaClientFunction;
|
|
1210
|
-
|
|
1211
|
-
// @public @deprecated (undocumented)
|
|
1212
|
-
export interface WithMediaClientConfig {
|
|
1213
|
-
// (undocumented)
|
|
1214
|
-
mediaClientConfig: MediaClientConfig;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
// @public @deprecated (undocumented)
|
|
1218
|
-
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
1219
|
-
|
|
1220
|
-
// @public @deprecated (undocumented)
|
|
1221
|
-
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React_2.ComponentType<P>) => React_2.ComponentType<WithMediaClientConfigProps<P>>;
|
|
1222
|
-
|
|
1223
1151
|
// (No @packageDocumentation comment for this package)
|
|
1224
1152
|
|
|
1225
1153
|
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isImageRemote = void 0;
|
|
7
|
-
// Returns true if you need to set crossorigin property of an img element.
|
|
8
|
-
var isImageRemote = exports.isImageRemote = function isImageRemote(imageUrl) {
|
|
9
|
-
var windowOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.origin;
|
|
10
|
-
if (URL && URL.prototype) {
|
|
11
|
-
var url = new URL(imageUrl);
|
|
12
|
-
if (!url.host) {
|
|
13
|
-
// This is a local resource. Safari will fail to load it if we set crossorigin
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return url.origin !== windowOrigin;
|
|
17
|
-
} else {
|
|
18
|
-
// IE doesn't have support to 'new URL'.
|
|
19
|
-
// But it can load local and remote images with crossorigin set.
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.safeUnsubscribe = void 0;
|
|
7
|
-
// TODO: remove this in next major version
|
|
8
|
-
var safeUnsubscribe = exports.safeUnsubscribe = function safeUnsubscribe(subscription) {
|
|
9
|
-
// eslint-disable-next-line no-console
|
|
10
|
-
console.warn('safeUnsubscribe() is deprecated and will be removed in the next media-client major version');
|
|
11
|
-
setTimeout(function () {
|
|
12
|
-
return subscription && subscription.unsubscribe();
|
|
13
|
-
}, 0);
|
|
14
|
-
};
|
|
@@ -1,88 +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.withMediaClient = exports.getMediaClient = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _mediaClient = require("../client/media-client");
|
|
17
|
-
var _excluded = ["mediaClientConfig"];
|
|
18
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
19
|
-
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; } }
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
var mediaClientsMap = new Map();
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
32
|
-
*/
|
|
33
|
-
var getMediaClient = exports.getMediaClient = function getMediaClient(mediaClientConfig) {
|
|
34
|
-
var mediaClient = mediaClientsMap.get(mediaClientConfig);
|
|
35
|
-
if (!mediaClient) {
|
|
36
|
-
mediaClient = new _mediaClient.MediaClient(mediaClientConfig);
|
|
37
|
-
mediaClientsMap.set(mediaClientConfig, mediaClient);
|
|
38
|
-
}
|
|
39
|
-
return mediaClient;
|
|
40
|
-
};
|
|
41
|
-
var createEmptyMediaClient = function createEmptyMediaClient() {
|
|
42
|
-
var emptyConfig = {
|
|
43
|
-
authProvider: function authProvider() {
|
|
44
|
-
return Promise.resolve({
|
|
45
|
-
clientId: '',
|
|
46
|
-
token: '',
|
|
47
|
-
baseUrl: ''
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
return new _mediaClient.MediaClient(emptyConfig);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
64
|
-
*/
|
|
65
|
-
var withMediaClient = exports.withMediaClient = function withMediaClient(Component) {
|
|
66
|
-
return /*#__PURE__*/function (_React$Component) {
|
|
67
|
-
(0, _inherits2.default)(_class, _React$Component);
|
|
68
|
-
var _super = _createSuper(_class);
|
|
69
|
-
function _class() {
|
|
70
|
-
(0, _classCallCheck2.default)(this, _class);
|
|
71
|
-
return _super.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
(0, _createClass2.default)(_class, [{
|
|
74
|
-
key: "render",
|
|
75
|
-
value: function render() {
|
|
76
|
-
// TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
|
|
77
|
-
var _this$props = this.props,
|
|
78
|
-
mediaClientConfig = _this$props.mediaClientConfig,
|
|
79
|
-
otherProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
80
|
-
var mediaClient = !mediaClientConfig ? createEmptyMediaClient() : getMediaClient(mediaClientConfig);
|
|
81
|
-
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, otherProps, {
|
|
82
|
-
mediaClient: mediaClient
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}]);
|
|
86
|
-
return _class;
|
|
87
|
-
}(_react.default.Component);
|
|
88
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Returns true if you need to set crossorigin property of an img element.
|
|
2
|
-
export const isImageRemote = (imageUrl, windowOrigin = window.location.origin) => {
|
|
3
|
-
if (URL && URL.prototype) {
|
|
4
|
-
const url = new URL(imageUrl);
|
|
5
|
-
if (!url.host) {
|
|
6
|
-
// This is a local resource. Safari will fail to load it if we set crossorigin
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return url.origin !== windowOrigin;
|
|
10
|
-
} else {
|
|
11
|
-
// IE doesn't have support to 'new URL'.
|
|
12
|
-
// But it can load local and remote images with crossorigin set.
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// TODO: remove this in next major version
|
|
2
|
-
export const safeUnsubscribe = subscription => {
|
|
3
|
-
// eslint-disable-next-line no-console
|
|
4
|
-
console.warn('safeUnsubscribe() is deprecated and will be removed in the next media-client major version');
|
|
5
|
-
setTimeout(() => subscription && subscription.unsubscribe(), 0);
|
|
6
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { MediaClient } from '../client/media-client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const mediaClientsMap = new Map();
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
17
|
-
*/
|
|
18
|
-
export const getMediaClient = mediaClientConfig => {
|
|
19
|
-
let mediaClient = mediaClientsMap.get(mediaClientConfig);
|
|
20
|
-
if (!mediaClient) {
|
|
21
|
-
mediaClient = new MediaClient(mediaClientConfig);
|
|
22
|
-
mediaClientsMap.set(mediaClientConfig, mediaClient);
|
|
23
|
-
}
|
|
24
|
-
return mediaClient;
|
|
25
|
-
};
|
|
26
|
-
const createEmptyMediaClient = () => {
|
|
27
|
-
const emptyConfig = {
|
|
28
|
-
authProvider: () => Promise.resolve({
|
|
29
|
-
clientId: '',
|
|
30
|
-
token: '',
|
|
31
|
-
baseUrl: ''
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
return new MediaClient(emptyConfig);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
47
|
-
*/
|
|
48
|
-
export const withMediaClient = Component => {
|
|
49
|
-
return class extends React.Component {
|
|
50
|
-
render() {
|
|
51
|
-
// TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
|
|
52
|
-
const {
|
|
53
|
-
mediaClientConfig,
|
|
54
|
-
...otherProps
|
|
55
|
-
} = this.props;
|
|
56
|
-
const mediaClient = !mediaClientConfig ? createEmptyMediaClient() : getMediaClient(mediaClientConfig);
|
|
57
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, otherProps, {
|
|
58
|
-
mediaClient: mediaClient
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Returns true if you need to set crossorigin property of an img element.
|
|
2
|
-
export var isImageRemote = function isImageRemote(imageUrl) {
|
|
3
|
-
var windowOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.origin;
|
|
4
|
-
if (URL && URL.prototype) {
|
|
5
|
-
var url = new URL(imageUrl);
|
|
6
|
-
if (!url.host) {
|
|
7
|
-
// This is a local resource. Safari will fail to load it if we set crossorigin
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return url.origin !== windowOrigin;
|
|
11
|
-
} else {
|
|
12
|
-
// IE doesn't have support to 'new URL'.
|
|
13
|
-
// But it can load local and remote images with crossorigin set.
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// TODO: remove this in next major version
|
|
2
|
-
export var safeUnsubscribe = function safeUnsubscribe(subscription) {
|
|
3
|
-
// eslint-disable-next-line no-console
|
|
4
|
-
console.warn('safeUnsubscribe() is deprecated and will be removed in the next media-client major version');
|
|
5
|
-
setTimeout(function () {
|
|
6
|
-
return subscription && subscription.unsubscribe();
|
|
7
|
-
}, 0);
|
|
8
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
var _excluded = ["mediaClientConfig"];
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
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; } }
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { MediaClient } from '../client/media-client';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
var mediaClientsMap = new Map();
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
26
|
-
*/
|
|
27
|
-
export var getMediaClient = function getMediaClient(mediaClientConfig) {
|
|
28
|
-
var mediaClient = mediaClientsMap.get(mediaClientConfig);
|
|
29
|
-
if (!mediaClient) {
|
|
30
|
-
mediaClient = new MediaClient(mediaClientConfig);
|
|
31
|
-
mediaClientsMap.set(mediaClientConfig, mediaClient);
|
|
32
|
-
}
|
|
33
|
-
return mediaClient;
|
|
34
|
-
};
|
|
35
|
-
var createEmptyMediaClient = function createEmptyMediaClient() {
|
|
36
|
-
var emptyConfig = {
|
|
37
|
-
authProvider: function authProvider() {
|
|
38
|
-
return Promise.resolve({
|
|
39
|
-
clientId: '',
|
|
40
|
-
token: '',
|
|
41
|
-
baseUrl: ''
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return new MediaClient(emptyConfig);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
58
|
-
*/
|
|
59
|
-
export var withMediaClient = function withMediaClient(Component) {
|
|
60
|
-
return /*#__PURE__*/function (_React$Component) {
|
|
61
|
-
_inherits(_class, _React$Component);
|
|
62
|
-
var _super = _createSuper(_class);
|
|
63
|
-
function _class() {
|
|
64
|
-
_classCallCheck(this, _class);
|
|
65
|
-
return _super.apply(this, arguments);
|
|
66
|
-
}
|
|
67
|
-
_createClass(_class, [{
|
|
68
|
-
key: "render",
|
|
69
|
-
value: function render() {
|
|
70
|
-
// TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
|
|
71
|
-
var _this$props = this.props,
|
|
72
|
-
mediaClientConfig = _this$props.mediaClientConfig,
|
|
73
|
-
otherProps = _objectWithoutProperties(_this$props, _excluded);
|
|
74
|
-
var mediaClient = !mediaClientConfig ? createEmptyMediaClient() : getMediaClient(mediaClientConfig);
|
|
75
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, otherProps, {
|
|
76
|
-
mediaClient: mediaClient
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
}]);
|
|
80
|
-
return _class;
|
|
81
|
-
}(React.Component);
|
|
82
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isImageRemote: (imageUrl: string, windowOrigin?: string) => boolean;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaClient } from '../client/media-client';
|
|
4
|
-
import { Identifier } from '../identifier';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
7
|
-
*/
|
|
8
|
-
export interface WithMediaClientConfig {
|
|
9
|
-
mediaClientConfig: MediaClientConfig;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
13
|
-
*/
|
|
14
|
-
export interface WithMediaClient {
|
|
15
|
-
mediaClient: MediaClient;
|
|
16
|
-
identifier?: Identifier;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
20
|
-
*/
|
|
21
|
-
export declare const getMediaClient: (mediaClientConfig: MediaClientConfig) => MediaClient;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
24
|
-
*/
|
|
25
|
-
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
28
|
-
*/
|
|
29
|
-
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React.ComponentType<P>) => React.ComponentType<WithMediaClientConfigProps<P>>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
32
|
-
*/
|
|
33
|
-
export declare const withMediaClient: WithMediaClientFunction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isImageRemote: (imageUrl: string, windowOrigin?: string) => boolean;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaClient } from '../client/media-client';
|
|
4
|
-
import { Identifier } from '../identifier';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
7
|
-
*/
|
|
8
|
-
export interface WithMediaClientConfig {
|
|
9
|
-
mediaClientConfig: MediaClientConfig;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
13
|
-
*/
|
|
14
|
-
export interface WithMediaClient {
|
|
15
|
-
mediaClient: MediaClient;
|
|
16
|
-
identifier?: Identifier;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
20
|
-
*/
|
|
21
|
-
export declare const getMediaClient: (mediaClientConfig: MediaClientConfig) => MediaClient;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
24
|
-
*/
|
|
25
|
-
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
28
|
-
*/
|
|
29
|
-
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React.ComponentType<P>) => React.ComponentType<WithMediaClientConfigProps<P>>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated This export will be removed. Please use one from `@atlaskit/media-client-react`
|
|
32
|
-
*/
|
|
33
|
-
export declare const withMediaClient: WithMediaClientFunction;
|