@atlaskit/media-client 35.5.0 → 35.6.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 +7 -24
- package/compass.yml +3 -0
- package/dist/cjs/client/file-fetcher/index.js +4 -2
- package/dist/cjs/client/media-store/MediaStore.js +4 -5
- package/dist/cjs/models/errors/index.js +1 -1
- package/dist/cjs/utils/mediaCdn.js +2 -1
- package/dist/cjs/utils/pathBasedUrl.js +19 -8
- package/dist/es2019/client/file-fetcher/index.js +4 -1
- package/dist/es2019/client/media-store/MediaStore.js +5 -6
- package/dist/es2019/models/errors/index.js +1 -1
- package/dist/es2019/utils/mediaCdn.js +2 -1
- package/dist/es2019/utils/pathBasedUrl.js +17 -7
- package/dist/esm/client/file-fetcher/index.js +4 -1
- package/dist/esm/client/media-store/MediaStore.js +5 -6
- package/dist/esm/models/errors/index.js +1 -1
- package/dist/esm/utils/mediaCdn.js +2 -1
- package/dist/esm/utils/pathBasedUrl.js +17 -7
- package/dist/types/utils/pathBasedUrl.d.ts +1 -0
- package/dist/types-ts4.5/utils/pathBasedUrl.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 35.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b3183021fdece`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b3183021fdece) -
|
|
8
|
+
Bug fix for path based routing - "/media-api" getting prepended twice resolved"
|
|
9
|
+
|
|
3
10
|
## 35.5.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -299,7 +306,6 @@
|
|
|
299
306
|
- [#102527](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102527)
|
|
300
307
|
[`a90d34cd14faf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a90d34cd14faf) -
|
|
301
308
|
Updated the constructor of the following classes. Consult the type definitions for details.
|
|
302
|
-
|
|
303
309
|
- `RequestError`
|
|
304
310
|
|
|
305
311
|
- `PollingError`
|
|
@@ -311,7 +317,6 @@
|
|
|
311
317
|
- [#102527](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102527)
|
|
312
318
|
[`a90d34cd14faf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a90d34cd14faf) - -
|
|
313
319
|
New error verification helper `isCommonMediaClientError`
|
|
314
|
-
|
|
315
320
|
- `ErrorFileState` is now deserializable into a `CommonMediaClientError` using new export
|
|
316
321
|
`toCommonMediaClientError`
|
|
317
322
|
|
|
@@ -491,7 +496,6 @@
|
|
|
491
496
|
- [#134882](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134882)
|
|
492
497
|
[`ba204702f8e32`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba204702f8e32) -
|
|
493
498
|
[ED-24567]
|
|
494
|
-
|
|
495
499
|
- **@atlaskit/editor-common** Add MEDIA_PICKER as a variable fo analytics
|
|
496
500
|
- **@atlaskit/media-client** Return the mime-type from when calling the `uploadExternal` function
|
|
497
501
|
|
|
@@ -919,7 +923,6 @@
|
|
|
919
923
|
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
|
|
920
924
|
[`0f99ed9df35`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0f99ed9df35) - BREAKING
|
|
921
925
|
CHANGES:
|
|
922
|
-
|
|
923
926
|
- Media Store class no longer exposes getCollectionItems method
|
|
924
927
|
|
|
925
928
|
- `MediaClient.collection.removeFile` method is now accessible through the replacement method
|
|
@@ -927,7 +930,6 @@
|
|
|
927
930
|
|
|
928
931
|
- `MediaClient.collection` has been fully removed. The following classes, types and utils have
|
|
929
932
|
been also removed:
|
|
930
|
-
|
|
931
933
|
- MediaCollection
|
|
932
934
|
- MediaCollectionItem
|
|
933
935
|
- MediaCollectionItems
|
|
@@ -1132,7 +1134,6 @@
|
|
|
1132
1134
|
Client Uploader enforces a hard limit of 2Tb files.
|
|
1133
1135
|
|
|
1134
1136
|
To mitigate these changes:
|
|
1135
|
-
|
|
1136
1137
|
- Set the feature flag mediaUploadApiV2 as false or Revert to a previous version for affected
|
|
1137
1138
|
consumers and methods; Media Client uploadFile method. Media Client File Fetcher upload method.
|
|
1138
1139
|
Media Picker.
|
|
@@ -1437,7 +1438,6 @@
|
|
|
1437
1438
|
pollingMaxFailuresExceeded error from implementation and feature flags
|
|
1438
1439
|
- [`50cc05dde71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/50cc05dde71) - Mark the
|
|
1439
1440
|
following members as deprecated:
|
|
1440
|
-
|
|
1441
1441
|
- getMediaTypeFromMimeType
|
|
1442
1442
|
- isImageMimeTypeSupportedByBrowser
|
|
1443
1443
|
- isDocumentMimeTypeSupportedByBrowser
|
|
@@ -1885,7 +1885,6 @@
|
|
|
1885
1885
|
### Minor Changes
|
|
1886
1886
|
|
|
1887
1887
|
- [minor][eb962d2c36](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb962d2c36):
|
|
1888
|
-
|
|
1889
1888
|
- Add MAX_RESOLUTION constant. Can be imported via direct entry point
|
|
1890
1889
|
`import { MAX_RESOLUTION } from '@atlaskit/media-client/constants';`
|
|
1891
1890
|
- `Preview` class (`preview` prop in most `FileState`) now has optional field `origin` that can be
|
|
@@ -1981,7 +1980,6 @@
|
|
|
1981
1980
|
|
|
1982
1981
|
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
|
|
1983
1982
|
[6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
1984
|
-
|
|
1985
1983
|
- @atlaskit/docs@8.3.2
|
|
1986
1984
|
- @atlaskit/button@13.3.7
|
|
1987
1985
|
- @atlaskit/type-helpers@4.2.3
|
|
@@ -2074,7 +2072,6 @@
|
|
|
2074
2072
|
Check if the subscription is defined before calling unsubscribe in utils observableToPromise-
|
|
2075
2073
|
Updated dependencies
|
|
2076
2074
|
[24865cfaff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/24865cfaff):
|
|
2077
|
-
|
|
2078
2075
|
- @atlaskit/media-card@66.1.2
|
|
2079
2076
|
|
|
2080
2077
|
## 4.1.1
|
|
@@ -2230,7 +2227,6 @@ Bumped dependencies.
|
|
|
2230
2227
|
### Changed
|
|
2231
2228
|
|
|
2232
2229
|
**getMediaClient**
|
|
2233
|
-
|
|
2234
2230
|
- Before
|
|
2235
2231
|
|
|
2236
2232
|
> works with passing either mediaClientConfig or context
|
|
@@ -2301,7 +2297,6 @@ Bumped dependencies.
|
|
|
2301
2297
|
- [minor][65ada7f318](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/65ada7f318):
|
|
2302
2298
|
|
|
2303
2299
|
**FABDODGEM-12 Editor Cashmere Release**
|
|
2304
|
-
|
|
2305
2300
|
- [Internal post](http://go.atlassian.com/cashmere-release)
|
|
2306
2301
|
|
|
2307
2302
|
**Affected editor components:**
|
|
@@ -2309,19 +2304,16 @@ Bumped dependencies.
|
|
|
2309
2304
|
tables, media, mobile, text color, emoji, copy/paste, analytics
|
|
2310
2305
|
|
|
2311
2306
|
**Performance**
|
|
2312
|
-
|
|
2313
2307
|
- Async import for code blocks and task items on renderer
|
|
2314
2308
|
- https://product-fabric.atlassian.net/browse/ED-7155
|
|
2315
2309
|
|
|
2316
2310
|
**Table**
|
|
2317
|
-
|
|
2318
2311
|
- Add support to sort tables that contains smart links
|
|
2319
2312
|
- https://product-fabric.atlassian.net/browse/ED-7449
|
|
2320
2313
|
- Scale table when changing to full width mode
|
|
2321
2314
|
- https://product-fabric.atlassian.net/browse/ED-7724
|
|
2322
2315
|
|
|
2323
2316
|
**Text color**
|
|
2324
|
-
|
|
2325
2317
|
- Update text color toolbar with right color when text is inside a list, panel, etc.
|
|
2326
2318
|
- https://product-fabric.atlassian.net/browse/FM-1752
|
|
2327
2319
|
|
|
@@ -2508,7 +2500,6 @@ https://product-fabric.atlassian.net/browse/FM-2393
|
|
|
2508
2500
|
- [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
|
|
2509
2501
|
|
|
2510
2502
|
In this PR, we are:
|
|
2511
|
-
|
|
2512
2503
|
- Re-introducing dist build folders
|
|
2513
2504
|
- Adding back cjs
|
|
2514
2505
|
- Replacing es5 by cjs and es2015 by esm
|
|
@@ -2567,14 +2558,12 @@ https://product-fabric.atlassian.net/browse/FM-2393
|
|
|
2567
2558
|
## 1.2.1
|
|
2568
2559
|
|
|
2569
2560
|
- [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
|
|
2570
|
-
|
|
2571
2561
|
- This is just a safety release in case anything strange happened in in the previous one. See Pull
|
|
2572
2562
|
Request #5942 for details
|
|
2573
2563
|
|
|
2574
2564
|
## 1.2.0
|
|
2575
2565
|
|
|
2576
2566
|
- [minor][dcda79d48c](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/dcda79d48c):
|
|
2577
|
-
|
|
2578
2567
|
- `withMediaClient` and associated Props are introduced to make possible soft transition from
|
|
2579
2568
|
Context based media components to Media Client Config ones.
|
|
2580
2569
|
|
|
@@ -2587,13 +2576,11 @@ https://product-fabric.atlassian.net/browse/FM-2393
|
|
|
2587
2576
|
## 1.1.5
|
|
2588
2577
|
|
|
2589
2578
|
- [patch][af1cbd4ce4](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/af1cbd4ce4):
|
|
2590
|
-
|
|
2591
2579
|
- Removing unnecessary deps and dev deps in media-core and media-client
|
|
2592
2580
|
|
|
2593
2581
|
## 1.1.4
|
|
2594
2582
|
|
|
2595
2583
|
- [patch][12aa76d5b5](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/12aa76d5b5):
|
|
2596
|
-
|
|
2597
2584
|
- ED-6814: fixed rendering mediaSingle without collection
|
|
2598
2585
|
|
|
2599
2586
|
## 1.1.3
|
|
@@ -2607,27 +2594,23 @@ https://product-fabric.atlassian.net/browse/FM-2393
|
|
|
2607
2594
|
## 1.1.2
|
|
2608
2595
|
|
|
2609
2596
|
- [patch][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
2610
|
-
|
|
2611
2597
|
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
|
|
2612
2598
|
this package, please ensure you use at least this version of react and react-dom.
|
|
2613
2599
|
|
|
2614
2600
|
## 1.1.1
|
|
2615
2601
|
|
|
2616
2602
|
- [patch][2f58d39758](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/2f58d39758):
|
|
2617
|
-
|
|
2618
2603
|
- Fix problem with double exporting one of the existing items
|
|
2619
2604
|
|
|
2620
2605
|
## 1.1.0
|
|
2621
2606
|
|
|
2622
2607
|
- [minor][8536258182](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8536258182):
|
|
2623
|
-
|
|
2624
2608
|
- expose on + off + emit methods on client in order to communicate events with integrators. At
|
|
2625
2609
|
this point the only emitted event is 'file-added'
|
|
2626
2610
|
|
|
2627
2611
|
## 1.0.0
|
|
2628
2612
|
|
|
2629
2613
|
- [major][e38d662f7d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e38d662f7d):
|
|
2630
|
-
|
|
2631
2614
|
- Media API Web Client Library initial release. It contains mostly combined code from media-core
|
|
2632
2615
|
and media-store.
|
|
2633
2616
|
|
package/compass.yml
CHANGED
|
@@ -10,6 +10,9 @@ fields:
|
|
|
10
10
|
labels:
|
|
11
11
|
- atlassian-platform
|
|
12
12
|
links:
|
|
13
|
+
- name: Root Repository
|
|
14
|
+
type: REPOSITORY
|
|
15
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
|
|
13
16
|
- name: ''
|
|
14
17
|
type: REPOSITORY
|
|
15
18
|
url: 'https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/media/media-client/'
|
|
@@ -52,7 +52,7 @@ var _createCopyIntentRegisterationBatcher = require("../../utils/createCopyInten
|
|
|
52
52
|
var _helpers = require("../../utils/request/helpers");
|
|
53
53
|
var _errors = require("../../models/errors");
|
|
54
54
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
55
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
55
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
56
56
|
var isCopySourceFileWithToken = function isCopySourceFileWithToken(token) {
|
|
57
57
|
return !!token.authProvider;
|
|
58
58
|
};
|
|
@@ -297,7 +297,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
297
297
|
}
|
|
298
298
|
throw new Error('File is not a video');
|
|
299
299
|
case 5:
|
|
300
|
-
if (!((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
|
|
300
|
+
if (!('mediaMetadata' in fileState && (_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
|
|
301
301
|
_context5.next = 7;
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
@@ -523,7 +523,9 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
523
523
|
}, {
|
|
524
524
|
key: "generateUploadableFileUpfrontIds",
|
|
525
525
|
value: function generateUploadableFileUpfrontIds(collection, traceContext) {
|
|
526
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
526
527
|
var id = (0, _v.default)();
|
|
528
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
527
529
|
var occurrenceKey = (0, _v.default)();
|
|
528
530
|
var touchFileDescriptor = {
|
|
529
531
|
fileId: id,
|
|
@@ -17,7 +17,6 @@ var _request3 = require("../../utils/request");
|
|
|
17
17
|
var _helpers = require("../../utils/request/helpers");
|
|
18
18
|
var _mediaCdn = require("../../utils/mediaCdn");
|
|
19
19
|
var _resolveAuth = require("./resolveAuth");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
20
|
var _pathBasedUrl = require("../../utils/pathBasedUrl");
|
|
22
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -411,7 +410,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
411
410
|
auth: auth
|
|
412
411
|
};
|
|
413
412
|
var imageEndpoint = cdnFeatureFlag('image');
|
|
414
|
-
if ((0,
|
|
413
|
+
if ((0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
415
414
|
return (0, _pathBasedUrl.mapToPathBasedUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options));
|
|
416
415
|
}
|
|
417
416
|
return (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options), auth.token);
|
|
@@ -486,7 +485,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
486
485
|
auth: auth
|
|
487
486
|
};
|
|
488
487
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
489
|
-
if (!(0,
|
|
488
|
+
if (!(0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
490
489
|
_context9.next = 8;
|
|
491
490
|
break;
|
|
492
491
|
}
|
|
@@ -551,7 +550,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
551
550
|
auth: auth
|
|
552
551
|
};
|
|
553
552
|
url = (0, _helpers.createUrl)((0, _mediaCdn.mapToMediaCdnUrl)(artifactUrl, auth.token), options);
|
|
554
|
-
if (!(0,
|
|
553
|
+
if (!(0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
555
554
|
_context0.next = 11;
|
|
556
555
|
break;
|
|
557
556
|
}
|
|
@@ -945,7 +944,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
945
944
|
if (useMediaCdn) {
|
|
946
945
|
url = (0, _mediaCdn.mapToMediaCdnUrl)(url, auth.token);
|
|
947
946
|
}
|
|
948
|
-
if ((0,
|
|
947
|
+
if ((0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
949
948
|
url = (0, _pathBasedUrl.mapToPathBasedUrl)(url);
|
|
950
949
|
}
|
|
951
950
|
_context16.next = 20;
|
|
@@ -90,7 +90,7 @@ function isCommonMediaClientError(error) {
|
|
|
90
90
|
var toCommonMediaClientError = exports.toCommonMediaClientError = function toCommonMediaClientError(errorFileState) {
|
|
91
91
|
var _errorFileState$detai;
|
|
92
92
|
var error = (_errorFileState$detai = errorFileState.details) === null || _errorFileState$detai === void 0 ? void 0 : _errorFileState$detai.error;
|
|
93
|
-
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error.metadata, error.innerError);
|
|
93
|
+
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error === null || error === void 0 ? void 0 : error.metadata, error === null || error === void 0 ? void 0 : error.innerError);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
/** Serializer CommonMediaClientError -> ErrorFileState */
|
|
@@ -9,6 +9,7 @@ exports.mapToMediaCdnUrl = mapToMediaCdnUrl;
|
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
10
|
var _isCommercial = require("./isCommercial");
|
|
11
11
|
var _atlassianContext = require("@atlaskit/atlassian-context");
|
|
12
|
+
var _pathBasedUrl = require("./pathBasedUrl");
|
|
12
13
|
var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
|
|
13
14
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
14
15
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -19,7 +20,7 @@ var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
|
|
|
19
20
|
// Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
|
|
20
21
|
var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
|
|
21
22
|
function isCDNEnabled() {
|
|
22
|
-
return (0, _isCommercial.isCommercial)() && !(0, _atlassianContext.isIsolatedCloud)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0,
|
|
23
|
+
return (0, _isCommercial.isCommercial)() && !(0, _atlassianContext.isIsolatedCloud)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0, _pathBasedUrl.isPathBasedEnabled)();
|
|
23
24
|
}
|
|
24
25
|
function mapToMediaCdnUrl(url, token) {
|
|
25
26
|
var _token$length;
|
|
@@ -4,20 +4,29 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.isPathBasedEnabled = isPathBasedEnabled;
|
|
7
8
|
exports.mapRetryUrlToPathBasedUrl = mapRetryUrlToPathBasedUrl;
|
|
8
9
|
exports.mapToPathBasedUrl = mapToPathBasedUrl;
|
|
9
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
-
var
|
|
11
|
+
var _getDocument4 = _interopRequireDefault(require("./getDocument"));
|
|
12
|
+
var mediaApiPathPrefix = '/media-api';
|
|
11
13
|
function getRelativeUrl(absoluteUrl) {
|
|
12
14
|
var url = new URL(absoluteUrl);
|
|
13
15
|
return "".concat(url.pathname).concat(url.search).concat(url.hash);
|
|
14
16
|
}
|
|
17
|
+
function isPathBasedEnabled() {
|
|
18
|
+
var _getDocument;
|
|
19
|
+
var isLocalhost = ((_getDocument = (0, _getDocument4.default)()) === null || _getDocument === void 0 || (_getDocument = _getDocument.location) === null || _getDocument === void 0 ? void 0 : _getDocument.hostname) === 'localhost';
|
|
20
|
+
return (0, _platformFeatureFlags.fg)('platform_media_path_based_route') && !isLocalhost;
|
|
21
|
+
}
|
|
15
22
|
function mapToPathBasedUrl(url) {
|
|
16
|
-
if ((
|
|
17
|
-
var
|
|
23
|
+
if (isPathBasedEnabled()) {
|
|
24
|
+
var _getDocument2;
|
|
18
25
|
var parsedUrl = new URL(url);
|
|
19
|
-
parsedUrl.pathname
|
|
20
|
-
|
|
26
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
27
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
28
|
+
}
|
|
29
|
+
var location = (_getDocument2 = (0, _getDocument4.default)()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.location;
|
|
21
30
|
|
|
22
31
|
// in this case we are most likely in SSR / a non browser environment so just return a relative URL
|
|
23
32
|
if (!location) {
|
|
@@ -29,15 +38,17 @@ function mapToPathBasedUrl(url) {
|
|
|
29
38
|
return url;
|
|
30
39
|
}
|
|
31
40
|
function mapRetryUrlToPathBasedUrl(url) {
|
|
32
|
-
var _getDocument$location,
|
|
41
|
+
var _getDocument$location, _getDocument3;
|
|
33
42
|
var parsedUrl = new URL(url);
|
|
34
|
-
parsedUrl.host = (_getDocument$location = (
|
|
43
|
+
parsedUrl.host = (_getDocument$location = (_getDocument3 = (0, _getDocument4.default)()) === null || _getDocument3 === void 0 ? void 0 : _getDocument3.location.host) !== null && _getDocument$location !== void 0 ? _getDocument$location : '';
|
|
35
44
|
|
|
36
45
|
// remove CDN from the URL for retry if it exists
|
|
37
46
|
var pathname = parsedUrl.pathname;
|
|
38
47
|
if (pathname.endsWith('/cdn')) {
|
|
39
48
|
parsedUrl.pathname = pathname.replace('/cdn', '');
|
|
40
49
|
}
|
|
41
|
-
parsedUrl.pathname
|
|
50
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
51
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
52
|
+
}
|
|
42
53
|
return parsedUrl;
|
|
43
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Subscription } from 'rxjs/Subscription';
|
|
3
3
|
import { map } from 'rxjs/operators/map';
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid/v4';
|
|
5
6
|
import { authToOwner } from '@atlaskit/media-core';
|
|
6
7
|
import { downloadUrl } from '@atlaskit/media-common/downloadUrl';
|
|
@@ -184,7 +185,7 @@ export class FileFetcherImpl {
|
|
|
184
185
|
if (fileState.status !== 'processed' || fileState.mediaType !== 'video' || !fileState.artifacts['video.mp4']) {
|
|
185
186
|
throw new Error('File is not a video');
|
|
186
187
|
}
|
|
187
|
-
if ((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration) {
|
|
188
|
+
if ('mediaMetadata' in fileState && (_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration) {
|
|
188
189
|
return fileState.mediaMetadata.duration;
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -323,7 +324,9 @@ export class FileFetcherImpl {
|
|
|
323
324
|
}) => data);
|
|
324
325
|
}
|
|
325
326
|
generateUploadableFileUpfrontIds(collection, traceContext) {
|
|
327
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
326
328
|
const id = uuid();
|
|
329
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
327
330
|
const occurrenceKey = uuid();
|
|
328
331
|
const touchFileDescriptor = {
|
|
329
332
|
fileId: id,
|
|
@@ -7,8 +7,7 @@ import { createUrl, createMapResponseToJson, createMapResponseToBlob, defaultSho
|
|
|
7
7
|
import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
|
|
8
8
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
9
9
|
import { ChunkHashAlgorithm } from '@atlaskit/media-core';
|
|
10
|
-
import {
|
|
11
|
-
import { mapToPathBasedUrl } from '../../utils/pathBasedUrl';
|
|
10
|
+
import { isPathBasedEnabled, mapToPathBasedUrl } from '../../utils/pathBasedUrl';
|
|
12
11
|
const MEDIA_API_REGION = 'media-api-region';
|
|
13
12
|
const MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
14
13
|
const extendImageParams = (params, fetchMaxRes = false) => {
|
|
@@ -268,7 +267,7 @@ export class MediaStore {
|
|
|
268
267
|
auth
|
|
269
268
|
};
|
|
270
269
|
const imageEndpoint = cdnFeatureFlag('image');
|
|
271
|
-
if (
|
|
270
|
+
if (isPathBasedEnabled()) {
|
|
272
271
|
return mapToPathBasedUrl(createUrl(`${auth.baseUrl}/file/${id}/${imageEndpoint}`, options));
|
|
273
272
|
}
|
|
274
273
|
return mapToMediaCdnUrl(createUrl(`${auth.baseUrl}/file/${id}/${imageEndpoint}`, options), auth.token);
|
|
@@ -306,7 +305,7 @@ export class MediaStore {
|
|
|
306
305
|
auth
|
|
307
306
|
};
|
|
308
307
|
const binaryEndpoint = cdnFeatureFlag('binary');
|
|
309
|
-
if (
|
|
308
|
+
if (isPathBasedEnabled()) {
|
|
310
309
|
return mapToPathBasedUrl(createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options));
|
|
311
310
|
}
|
|
312
311
|
return mapToMediaCdnUrl(createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options), auth.token);
|
|
@@ -340,7 +339,7 @@ export class MediaStore {
|
|
|
340
339
|
auth
|
|
341
340
|
};
|
|
342
341
|
const url = createUrl(mapToMediaCdnUrl(artifactUrl, auth.token), options);
|
|
343
|
-
if (
|
|
342
|
+
if (isPathBasedEnabled()) {
|
|
344
343
|
return mapToPathBasedUrl(url);
|
|
345
344
|
}
|
|
346
345
|
return url;
|
|
@@ -573,7 +572,7 @@ export class MediaStore {
|
|
|
573
572
|
if (useMediaCdn) {
|
|
574
573
|
url = mapToMediaCdnUrl(url, auth.token);
|
|
575
574
|
}
|
|
576
|
-
if (
|
|
575
|
+
if (isPathBasedEnabled()) {
|
|
577
576
|
url = mapToPathBasedUrl(url);
|
|
578
577
|
}
|
|
579
578
|
const response = await request(url, {
|
|
@@ -51,7 +51,7 @@ export function isCommonMediaClientError(error) {
|
|
|
51
51
|
export const toCommonMediaClientError = errorFileState => {
|
|
52
52
|
var _errorFileState$detai;
|
|
53
53
|
const error = (_errorFileState$detai = errorFileState.details) === null || _errorFileState$detai === void 0 ? void 0 : _errorFileState$detai.error;
|
|
54
|
-
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error.metadata, error.innerError);
|
|
54
|
+
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error === null || error === void 0 ? void 0 : error.metadata, error === null || error === void 0 ? void 0 : error.innerError);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
/** Serializer CommonMediaClientError -> ErrorFileState */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { isCommercial } from './isCommercial';
|
|
3
3
|
import { isIsolatedCloud } from '@atlaskit/atlassian-context';
|
|
4
|
+
import { isPathBasedEnabled } from './pathBasedUrl';
|
|
4
5
|
export const MEDIA_CDN_MAP = {
|
|
5
6
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
6
7
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -11,7 +12,7 @@ export const MEDIA_CDN_MAP = {
|
|
|
11
12
|
// Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
|
|
12
13
|
const MEDIA_TOKEN_LENGTH_LIMIT = 7000;
|
|
13
14
|
export function isCDNEnabled() {
|
|
14
|
-
return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !
|
|
15
|
+
return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
|
|
15
16
|
}
|
|
16
17
|
export function mapToMediaCdnUrl(url, token) {
|
|
17
18
|
var _token$length;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import getDocument from './getDocument';
|
|
3
|
+
const mediaApiPathPrefix = '/media-api';
|
|
3
4
|
function getRelativeUrl(absoluteUrl) {
|
|
4
5
|
const url = new URL(absoluteUrl);
|
|
5
6
|
return `${url.pathname}${url.search}${url.hash}`;
|
|
6
7
|
}
|
|
8
|
+
export function isPathBasedEnabled() {
|
|
9
|
+
var _getDocument, _getDocument$location;
|
|
10
|
+
const isLocalhost = ((_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : (_getDocument$location = _getDocument.location) === null || _getDocument$location === void 0 ? void 0 : _getDocument$location.hostname) === 'localhost';
|
|
11
|
+
return fg('platform_media_path_based_route') && !isLocalhost;
|
|
12
|
+
}
|
|
7
13
|
export function mapToPathBasedUrl(url) {
|
|
8
|
-
if (
|
|
9
|
-
var
|
|
14
|
+
if (isPathBasedEnabled()) {
|
|
15
|
+
var _getDocument2;
|
|
10
16
|
const parsedUrl = new URL(url);
|
|
11
|
-
parsedUrl.pathname
|
|
12
|
-
|
|
17
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
18
|
+
parsedUrl.pathname = `${mediaApiPathPrefix}${parsedUrl.pathname}`;
|
|
19
|
+
}
|
|
20
|
+
const location = (_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.location;
|
|
13
21
|
|
|
14
22
|
// in this case we are most likely in SSR / a non browser environment so just return a relative URL
|
|
15
23
|
if (!location) {
|
|
@@ -21,15 +29,17 @@ export function mapToPathBasedUrl(url) {
|
|
|
21
29
|
return url;
|
|
22
30
|
}
|
|
23
31
|
export function mapRetryUrlToPathBasedUrl(url) {
|
|
24
|
-
var _getDocument$
|
|
32
|
+
var _getDocument$location2, _getDocument3;
|
|
25
33
|
const parsedUrl = new URL(url);
|
|
26
|
-
parsedUrl.host = (_getDocument$
|
|
34
|
+
parsedUrl.host = (_getDocument$location2 = (_getDocument3 = getDocument()) === null || _getDocument3 === void 0 ? void 0 : _getDocument3.location.host) !== null && _getDocument$location2 !== void 0 ? _getDocument$location2 : '';
|
|
27
35
|
|
|
28
36
|
// remove CDN from the URL for retry if it exists
|
|
29
37
|
const pathname = parsedUrl.pathname;
|
|
30
38
|
if (pathname.endsWith('/cdn')) {
|
|
31
39
|
parsedUrl.pathname = pathname.replace('/cdn', '');
|
|
32
40
|
}
|
|
33
|
-
parsedUrl.pathname
|
|
41
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
42
|
+
parsedUrl.pathname = `${mediaApiPathPrefix}${parsedUrl.pathname}`;
|
|
43
|
+
}
|
|
34
44
|
return parsedUrl;
|
|
35
45
|
}
|
|
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { Subscription } from 'rxjs/Subscription';
|
|
9
9
|
import { map } from 'rxjs/operators/map';
|
|
10
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
10
11
|
import uuid from 'uuid/v4';
|
|
11
12
|
import { authToOwner } from '@atlaskit/media-core';
|
|
12
13
|
import { downloadUrl } from '@atlaskit/media-common/downloadUrl';
|
|
@@ -279,7 +280,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
279
280
|
}
|
|
280
281
|
throw new Error('File is not a video');
|
|
281
282
|
case 5:
|
|
282
|
-
if (!((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
|
|
283
|
+
if (!('mediaMetadata' in fileState && (_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
|
|
283
284
|
_context5.next = 7;
|
|
284
285
|
break;
|
|
285
286
|
}
|
|
@@ -505,7 +506,9 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
505
506
|
}, {
|
|
506
507
|
key: "generateUploadableFileUpfrontIds",
|
|
507
508
|
value: function generateUploadableFileUpfrontIds(collection, traceContext) {
|
|
509
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
508
510
|
var id = uuid();
|
|
511
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
509
512
|
var occurrenceKey = uuid();
|
|
510
513
|
var touchFileDescriptor = {
|
|
511
514
|
fileId: id,
|
|
@@ -13,8 +13,7 @@ import { createUrl, createMapResponseToJson, createMapResponseToBlob, defaultSho
|
|
|
13
13
|
import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
|
|
14
14
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
15
15
|
import { ChunkHashAlgorithm } from '@atlaskit/media-core';
|
|
16
|
-
import {
|
|
17
|
-
import { mapToPathBasedUrl } from '../../utils/pathBasedUrl';
|
|
16
|
+
import { isPathBasedEnabled, mapToPathBasedUrl } from '../../utils/pathBasedUrl';
|
|
18
17
|
var MEDIA_API_REGION = 'media-api-region';
|
|
19
18
|
var MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
20
19
|
var extendImageParams = function extendImageParams(params) {
|
|
@@ -405,7 +404,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
405
404
|
auth: auth
|
|
406
405
|
};
|
|
407
406
|
var imageEndpoint = cdnFeatureFlag('image');
|
|
408
|
-
if (
|
|
407
|
+
if (isPathBasedEnabled()) {
|
|
409
408
|
return mapToPathBasedUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options));
|
|
410
409
|
}
|
|
411
410
|
return mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options), auth.token);
|
|
@@ -480,7 +479,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
480
479
|
auth: auth
|
|
481
480
|
};
|
|
482
481
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
483
|
-
if (!
|
|
482
|
+
if (!isPathBasedEnabled()) {
|
|
484
483
|
_context9.next = 8;
|
|
485
484
|
break;
|
|
486
485
|
}
|
|
@@ -545,7 +544,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
545
544
|
auth: auth
|
|
546
545
|
};
|
|
547
546
|
url = createUrl(mapToMediaCdnUrl(artifactUrl, auth.token), options);
|
|
548
|
-
if (!
|
|
547
|
+
if (!isPathBasedEnabled()) {
|
|
549
548
|
_context0.next = 11;
|
|
550
549
|
break;
|
|
551
550
|
}
|
|
@@ -939,7 +938,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
939
938
|
if (useMediaCdn) {
|
|
940
939
|
url = mapToMediaCdnUrl(url, auth.token);
|
|
941
940
|
}
|
|
942
|
-
if (
|
|
941
|
+
if (isPathBasedEnabled()) {
|
|
943
942
|
url = mapToPathBasedUrl(url);
|
|
944
943
|
}
|
|
945
944
|
_context16.next = 20;
|
|
@@ -72,7 +72,7 @@ export function isCommonMediaClientError(error) {
|
|
|
72
72
|
export var toCommonMediaClientError = function toCommonMediaClientError(errorFileState) {
|
|
73
73
|
var _errorFileState$detai;
|
|
74
74
|
var error = (_errorFileState$detai = errorFileState.details) === null || _errorFileState$detai === void 0 ? void 0 : _errorFileState$detai.error;
|
|
75
|
-
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error.metadata, error.innerError);
|
|
75
|
+
return new CommonMediaClientError((error === null || error === void 0 ? void 0 : error.reason) || 'unknown-reason', error === null || error === void 0 ? void 0 : error.metadata, error === null || error === void 0 ? void 0 : error.innerError);
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
/** Serializer CommonMediaClientError -> ErrorFileState */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { isCommercial } from './isCommercial';
|
|
3
3
|
import { isIsolatedCloud } from '@atlaskit/atlassian-context';
|
|
4
|
+
import { isPathBasedEnabled } from './pathBasedUrl';
|
|
4
5
|
export var MEDIA_CDN_MAP = {
|
|
5
6
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
6
7
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -11,7 +12,7 @@ export var MEDIA_CDN_MAP = {
|
|
|
11
12
|
// Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
|
|
12
13
|
var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
|
|
13
14
|
export function isCDNEnabled() {
|
|
14
|
-
return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !
|
|
15
|
+
return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
|
|
15
16
|
}
|
|
16
17
|
export function mapToMediaCdnUrl(url, token) {
|
|
17
18
|
var _token$length;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import getDocument from './getDocument';
|
|
3
|
+
var mediaApiPathPrefix = '/media-api';
|
|
3
4
|
function getRelativeUrl(absoluteUrl) {
|
|
4
5
|
var url = new URL(absoluteUrl);
|
|
5
6
|
return "".concat(url.pathname).concat(url.search).concat(url.hash);
|
|
6
7
|
}
|
|
8
|
+
export function isPathBasedEnabled() {
|
|
9
|
+
var _getDocument;
|
|
10
|
+
var isLocalhost = ((_getDocument = getDocument()) === null || _getDocument === void 0 || (_getDocument = _getDocument.location) === null || _getDocument === void 0 ? void 0 : _getDocument.hostname) === 'localhost';
|
|
11
|
+
return fg('platform_media_path_based_route') && !isLocalhost;
|
|
12
|
+
}
|
|
7
13
|
export function mapToPathBasedUrl(url) {
|
|
8
|
-
if (
|
|
9
|
-
var
|
|
14
|
+
if (isPathBasedEnabled()) {
|
|
15
|
+
var _getDocument2;
|
|
10
16
|
var parsedUrl = new URL(url);
|
|
11
|
-
parsedUrl.pathname
|
|
12
|
-
|
|
17
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
18
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
19
|
+
}
|
|
20
|
+
var location = (_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.location;
|
|
13
21
|
|
|
14
22
|
// in this case we are most likely in SSR / a non browser environment so just return a relative URL
|
|
15
23
|
if (!location) {
|
|
@@ -21,15 +29,17 @@ export function mapToPathBasedUrl(url) {
|
|
|
21
29
|
return url;
|
|
22
30
|
}
|
|
23
31
|
export function mapRetryUrlToPathBasedUrl(url) {
|
|
24
|
-
var _getDocument$location,
|
|
32
|
+
var _getDocument$location, _getDocument3;
|
|
25
33
|
var parsedUrl = new URL(url);
|
|
26
|
-
parsedUrl.host = (_getDocument$location = (
|
|
34
|
+
parsedUrl.host = (_getDocument$location = (_getDocument3 = getDocument()) === null || _getDocument3 === void 0 ? void 0 : _getDocument3.location.host) !== null && _getDocument$location !== void 0 ? _getDocument$location : '';
|
|
27
35
|
|
|
28
36
|
// remove CDN from the URL for retry if it exists
|
|
29
37
|
var pathname = parsedUrl.pathname;
|
|
30
38
|
if (pathname.endsWith('/cdn')) {
|
|
31
39
|
parsedUrl.pathname = pathname.replace('/cdn', '');
|
|
32
40
|
}
|
|
33
|
-
parsedUrl.pathname
|
|
41
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
42
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
43
|
+
}
|
|
34
44
|
return parsedUrl;
|
|
35
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.6.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@atlaskit/media-core": "^37.0.0",
|
|
54
54
|
"@atlaskit/media-state": "^1.8.0",
|
|
55
55
|
"@atlaskit/ssr": "workspace:^",
|
|
56
|
-
"@atlaskit/tokens": "^
|
|
57
|
-
"@atlassian/feature-flags-test-utils": "^0.
|
|
56
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
57
|
+
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
59
59
|
"@types/deep-equal": "^1.0.1",
|
|
60
60
|
"@types/uuid-validate": "^0.0.2",
|