@atlaskit/media-picker 70.1.2 → 70.1.3
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 +8 -0
- package/dist/cjs/components/browser/index.js +22 -2
- package/dist/cjs/components/clipboard/index.js +24 -2
- package/dist/cjs/components/dropzone/index.js +30 -2
- package/dist/es2019/components/browser/index.js +13 -1
- package/dist/es2019/components/clipboard/index.js +13 -1
- package/dist/es2019/components/dropzone/index.js +16 -1
- package/dist/esm/components/browser/index.js +18 -2
- package/dist/esm/components/clipboard/index.js +20 -2
- package/dist/esm/components/dropzone/index.js +24 -2
- package/dist/types/components/clipboard/index.d.ts +1 -0
- package/dist/types/components/dropzone/index.d.ts +1 -0
- package/dist/types-ts4.5/components/clipboard/index.d.ts +1 -0
- package/dist/types-ts4.5/components/dropzone/index.d.ts +1 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-picker
|
|
2
2
|
|
|
3
|
+
## 70.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`143a6c6aea5cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/143a6c6aea5cf) -
|
|
8
|
+
Move media picker loader components to use componentDidMount instead of UNSAFE_componentWillMount
|
|
9
|
+
(under FF: jfp-magma-media-clipboard-init-after-mount)
|
|
10
|
+
|
|
3
11
|
## 70.1.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.BrowserLoader = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -16,6 +16,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -37,7 +38,26 @@ var BrowserLoader = exports.BrowserLoader = /*#__PURE__*/function (_React$PureCo
|
|
|
37
38
|
return (0, _createClass2.default)(BrowserLoader, [{
|
|
38
39
|
key: "componentDidMount",
|
|
39
40
|
value: function componentDidMount() {
|
|
41
|
+
var _this2 = this;
|
|
40
42
|
this.mounted = true;
|
|
43
|
+
if (!this.state.Browser && (0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount')) {
|
|
44
|
+
Promise.all([Promise.resolve().then(function () {
|
|
45
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'));
|
|
46
|
+
}), Promise.resolve().then(function () {
|
|
47
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-browser" */'./browser'));
|
|
48
|
+
})]).then(function (_ref) {
|
|
49
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
50
|
+
mediaClient = _ref2[0],
|
|
51
|
+
browserModule = _ref2[1];
|
|
52
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
53
|
+
BrowserLoader.Browser = mediaClient.withMediaClient(browserModule.Browser);
|
|
54
|
+
if (_this2.mounted) {
|
|
55
|
+
_this2.setState({
|
|
56
|
+
Browser: BrowserLoader.Browser
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
41
61
|
}
|
|
42
62
|
}, {
|
|
43
63
|
key: "componentWillUnmount",
|
|
@@ -52,7 +72,7 @@ var BrowserLoader = exports.BrowserLoader = /*#__PURE__*/function (_React$PureCo
|
|
|
52
72
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
53
73
|
while (1) switch (_context.prev = _context.next) {
|
|
54
74
|
case 0:
|
|
55
|
-
if (this.state.Browser) {
|
|
75
|
+
if (!(!this.state.Browser && !(0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
56
76
|
_context.next = 9;
|
|
57
77
|
break;
|
|
58
78
|
}
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.ClipboardLoader = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -16,6 +16,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -34,6 +35,27 @@ var ClipboardLoader = exports.ClipboardLoader = /*#__PURE__*/function (_React$Pu
|
|
|
34
35
|
}
|
|
35
36
|
(0, _inherits2.default)(ClipboardLoader, _React$PureComponent);
|
|
36
37
|
return (0, _createClass2.default)(ClipboardLoader, [{
|
|
38
|
+
key: "componentDidMount",
|
|
39
|
+
value: function componentDidMount() {
|
|
40
|
+
var _this2 = this;
|
|
41
|
+
if (!this.state.Clipboard && (0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount')) {
|
|
42
|
+
Promise.all([Promise.resolve().then(function () {
|
|
43
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'));
|
|
44
|
+
}), Promise.resolve().then(function () {
|
|
45
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-clipboard" */'./clipboard'));
|
|
46
|
+
})]).then(function (_ref) {
|
|
47
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
48
|
+
mediaClient = _ref2[0],
|
|
49
|
+
clipboardModule = _ref2[1];
|
|
50
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
51
|
+
ClipboardLoader.Clipboard = mediaClient.withMediaClient(clipboardModule.Clipboard);
|
|
52
|
+
_this2.setState({
|
|
53
|
+
Clipboard: ClipboardLoader.Clipboard
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
37
59
|
key: "UNSAFE_componentWillMount",
|
|
38
60
|
value: function () {
|
|
39
61
|
var _UNSAFE_componentWillMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -41,7 +63,7 @@ var ClipboardLoader = exports.ClipboardLoader = /*#__PURE__*/function (_React$Pu
|
|
|
41
63
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
64
|
while (1) switch (_context.prev = _context.next) {
|
|
43
65
|
case 0:
|
|
44
|
-
if (this.state.Clipboard) {
|
|
66
|
+
if (!(!this.state.Clipboard && !(0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
45
67
|
_context.next = 9;
|
|
46
68
|
break;
|
|
47
69
|
}
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.DropzoneLoader = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -16,6 +16,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -35,6 +36,33 @@ var DropzoneLoader = exports.DropzoneLoader = /*#__PURE__*/function (_React$Pure
|
|
|
35
36
|
}
|
|
36
37
|
(0, _inherits2.default)(DropzoneLoader, _React$PureComponent);
|
|
37
38
|
return (0, _createClass2.default)(DropzoneLoader, [{
|
|
39
|
+
key: "componentDidMount",
|
|
40
|
+
value: function componentDidMount() {
|
|
41
|
+
var _this2 = this;
|
|
42
|
+
if ((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && (0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount')) {
|
|
43
|
+
Promise.all([Promise.resolve().then(function () {
|
|
44
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'));
|
|
45
|
+
}), Promise.resolve().then(function () {
|
|
46
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-dropzone" */'./dropzone'));
|
|
47
|
+
}), Promise.resolve().then(function () {
|
|
48
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-picker-error-boundary" */'../media-picker-analytics-error-boundary'));
|
|
49
|
+
})]).then(function (_ref) {
|
|
50
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 3),
|
|
51
|
+
mediaClient = _ref2[0],
|
|
52
|
+
dropzoneModule = _ref2[1],
|
|
53
|
+
mediaPickerErrorBoundaryModule = _ref2[2];
|
|
54
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
55
|
+
DropzoneLoader.Dropzone = mediaClient.withMediaClient(dropzoneModule.Dropzone);
|
|
56
|
+
DropzoneLoader.MediaPickerErrorBoundary = mediaPickerErrorBoundaryModule.default;
|
|
57
|
+
_this2.setState({
|
|
58
|
+
Dropzone: DropzoneLoader.Dropzone,
|
|
59
|
+
MediaPickerErrorBoundary: DropzoneLoader.MediaPickerErrorBoundary
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
// TODO [MS-2272]: Add operational error to catch import error
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
38
66
|
key: "UNSAFE_componentWillMount",
|
|
39
67
|
value: function () {
|
|
40
68
|
var _UNSAFE_componentWillMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -42,7 +70,7 @@ var DropzoneLoader = exports.DropzoneLoader = /*#__PURE__*/function (_React$Pure
|
|
|
42
70
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
43
71
|
while (1) switch (_context.prev = _context.next) {
|
|
44
72
|
case 0:
|
|
45
|
-
if (!(!this.state.Dropzone || !this.state.MediaPickerErrorBoundary)) {
|
|
73
|
+
if (!((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && !(0, _platformFeatureFlags.fg)('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
46
74
|
_context.next = 16;
|
|
47
75
|
break;
|
|
48
76
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export class BrowserLoader extends React.PureComponent {
|
|
4
5
|
constructor(...args) {
|
|
5
6
|
super(...args);
|
|
@@ -10,12 +11,23 @@ export class BrowserLoader extends React.PureComponent {
|
|
|
10
11
|
}
|
|
11
12
|
componentDidMount() {
|
|
12
13
|
this.mounted = true;
|
|
14
|
+
if (!this.state.Browser && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
15
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-browser" */'./browser')]).then(([mediaClient, browserModule]) => {
|
|
16
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
17
|
+
BrowserLoader.Browser = mediaClient.withMediaClient(browserModule.Browser);
|
|
18
|
+
if (this.mounted) {
|
|
19
|
+
this.setState({
|
|
20
|
+
Browser: BrowserLoader.Browser
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
13
25
|
}
|
|
14
26
|
componentWillUnmount() {
|
|
15
27
|
this.mounted = false;
|
|
16
28
|
}
|
|
17
29
|
async UNSAFE_componentWillMount() {
|
|
18
|
-
if (!this.state.Browser) {
|
|
30
|
+
if (!this.state.Browser && !fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
19
31
|
const [mediaClient, browserModule] = await Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-browser" */'./browser')]);
|
|
20
32
|
|
|
21
33
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export class ClipboardLoader extends React.PureComponent {
|
|
4
5
|
constructor(...args) {
|
|
5
6
|
super(...args);
|
|
@@ -7,8 +8,19 @@ export class ClipboardLoader extends React.PureComponent {
|
|
|
7
8
|
Clipboard: ClipboardLoader.Clipboard
|
|
8
9
|
});
|
|
9
10
|
}
|
|
11
|
+
componentDidMount() {
|
|
12
|
+
if (!this.state.Clipboard && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
13
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-clipboard" */'./clipboard')]).then(([mediaClient, clipboardModule]) => {
|
|
14
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
15
|
+
ClipboardLoader.Clipboard = mediaClient.withMediaClient(clipboardModule.Clipboard);
|
|
16
|
+
this.setState({
|
|
17
|
+
Clipboard: ClipboardLoader.Clipboard
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
10
22
|
async UNSAFE_componentWillMount() {
|
|
11
|
-
if (!this.state.Clipboard) {
|
|
23
|
+
if (!this.state.Clipboard && !fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
12
24
|
const [mediaClient, clipboardModule] = await Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-clipboard" */'./clipboard')]);
|
|
13
25
|
|
|
14
26
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export class DropzoneLoader extends React.PureComponent {
|
|
4
5
|
constructor(...args) {
|
|
5
6
|
super(...args);
|
|
@@ -8,8 +9,22 @@ export class DropzoneLoader extends React.PureComponent {
|
|
|
8
9
|
MediaPickerErrorBoundary: DropzoneLoader.MediaPickerErrorBoundary
|
|
9
10
|
});
|
|
10
11
|
}
|
|
12
|
+
componentDidMount() {
|
|
13
|
+
if ((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
14
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-dropzone" */'./dropzone'), import( /* webpackChunkName: "@atlaskit-internal_media-picker-error-boundary" */'../media-picker-analytics-error-boundary')]).then(([mediaClient, dropzoneModule, mediaPickerErrorBoundaryModule]) => {
|
|
15
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
16
|
+
DropzoneLoader.Dropzone = mediaClient.withMediaClient(dropzoneModule.Dropzone);
|
|
17
|
+
DropzoneLoader.MediaPickerErrorBoundary = mediaPickerErrorBoundaryModule.default;
|
|
18
|
+
this.setState({
|
|
19
|
+
Dropzone: DropzoneLoader.Dropzone,
|
|
20
|
+
MediaPickerErrorBoundary: DropzoneLoader.MediaPickerErrorBoundary
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
// TODO [MS-2272]: Add operational error to catch import error
|
|
24
|
+
}
|
|
25
|
+
}
|
|
11
26
|
async UNSAFE_componentWillMount() {
|
|
12
|
-
if (!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) {
|
|
27
|
+
if ((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && !fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
13
28
|
try {
|
|
14
29
|
const [mediaClient, dropzoneModule, mediaPickerErrorBoundaryModule] = await Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-dropzone" */'./dropzone'), import( /* webpackChunkName: "@atlaskit-internal_media-picker-error-boundary" */'../media-picker-analytics-error-boundary')]);
|
|
15
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
export var BrowserLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
14
15
|
function BrowserLoader() {
|
|
15
16
|
var _this;
|
|
@@ -28,7 +29,22 @@ export var BrowserLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
28
29
|
return _createClass(BrowserLoader, [{
|
|
29
30
|
key: "componentDidMount",
|
|
30
31
|
value: function componentDidMount() {
|
|
32
|
+
var _this2 = this;
|
|
31
33
|
this.mounted = true;
|
|
34
|
+
if (!this.state.Browser && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
35
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-browser" */'./browser')]).then(function (_ref) {
|
|
36
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
37
|
+
mediaClient = _ref2[0],
|
|
38
|
+
browserModule = _ref2[1];
|
|
39
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
40
|
+
BrowserLoader.Browser = mediaClient.withMediaClient(browserModule.Browser);
|
|
41
|
+
if (_this2.mounted) {
|
|
42
|
+
_this2.setState({
|
|
43
|
+
Browser: BrowserLoader.Browser
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
32
48
|
}
|
|
33
49
|
}, {
|
|
34
50
|
key: "componentWillUnmount",
|
|
@@ -43,7 +59,7 @@ export var BrowserLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
43
59
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44
60
|
while (1) switch (_context.prev = _context.next) {
|
|
45
61
|
case 0:
|
|
46
|
-
if (this.state.Browser) {
|
|
62
|
+
if (!(!this.state.Browser && !fg('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
47
63
|
_context.next = 9;
|
|
48
64
|
break;
|
|
49
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
export var ClipboardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
14
15
|
function ClipboardLoader() {
|
|
15
16
|
var _this;
|
|
@@ -25,6 +26,23 @@ export var ClipboardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
25
26
|
}
|
|
26
27
|
_inherits(ClipboardLoader, _React$PureComponent);
|
|
27
28
|
return _createClass(ClipboardLoader, [{
|
|
29
|
+
key: "componentDidMount",
|
|
30
|
+
value: function componentDidMount() {
|
|
31
|
+
var _this2 = this;
|
|
32
|
+
if (!this.state.Clipboard && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
33
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-clipboard" */'./clipboard')]).then(function (_ref) {
|
|
34
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
35
|
+
mediaClient = _ref2[0],
|
|
36
|
+
clipboardModule = _ref2[1];
|
|
37
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
38
|
+
ClipboardLoader.Clipboard = mediaClient.withMediaClient(clipboardModule.Clipboard);
|
|
39
|
+
_this2.setState({
|
|
40
|
+
Clipboard: ClipboardLoader.Clipboard
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
28
46
|
key: "UNSAFE_componentWillMount",
|
|
29
47
|
value: function () {
|
|
30
48
|
var _UNSAFE_componentWillMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -32,7 +50,7 @@ export var ClipboardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
32
50
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
33
51
|
while (1) switch (_context.prev = _context.next) {
|
|
34
52
|
case 0:
|
|
35
|
-
if (this.state.Clipboard) {
|
|
53
|
+
if (!(!this.state.Clipboard && !fg('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
36
54
|
_context.next = 9;
|
|
37
55
|
break;
|
|
38
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
export var DropzoneLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
14
15
|
function DropzoneLoader() {
|
|
15
16
|
var _this;
|
|
@@ -26,6 +27,27 @@ export var DropzoneLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
26
27
|
}
|
|
27
28
|
_inherits(DropzoneLoader, _React$PureComponent);
|
|
28
29
|
return _createClass(DropzoneLoader, [{
|
|
30
|
+
key: "componentDidMount",
|
|
31
|
+
value: function componentDidMount() {
|
|
32
|
+
var _this2 = this;
|
|
33
|
+
if ((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && fg('jfp-magma-media-clipboard-init-after-mount')) {
|
|
34
|
+
Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react'), import( /* webpackChunkName: "@atlaskit-internal_media-dropzone" */'./dropzone'), import( /* webpackChunkName: "@atlaskit-internal_media-picker-error-boundary" */'../media-picker-analytics-error-boundary')]).then(function (_ref) {
|
|
35
|
+
var _ref2 = _slicedToArray(_ref, 3),
|
|
36
|
+
mediaClient = _ref2[0],
|
|
37
|
+
dropzoneModule = _ref2[1],
|
|
38
|
+
mediaPickerErrorBoundaryModule = _ref2[2];
|
|
39
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
40
|
+
DropzoneLoader.Dropzone = mediaClient.withMediaClient(dropzoneModule.Dropzone);
|
|
41
|
+
DropzoneLoader.MediaPickerErrorBoundary = mediaPickerErrorBoundaryModule.default;
|
|
42
|
+
_this2.setState({
|
|
43
|
+
Dropzone: DropzoneLoader.Dropzone,
|
|
44
|
+
MediaPickerErrorBoundary: DropzoneLoader.MediaPickerErrorBoundary
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
// TODO [MS-2272]: Add operational error to catch import error
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
29
51
|
key: "UNSAFE_componentWillMount",
|
|
30
52
|
value: function () {
|
|
31
53
|
var _UNSAFE_componentWillMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -33,7 +55,7 @@ export var DropzoneLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
33
55
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
34
56
|
while (1) switch (_context.prev = _context.next) {
|
|
35
57
|
case 0:
|
|
36
|
-
if (!(!this.state.Dropzone || !this.state.MediaPickerErrorBoundary)) {
|
|
58
|
+
if (!((!this.state.Dropzone || !this.state.MediaPickerErrorBoundary) && !fg('jfp-magma-media-clipboard-init-after-mount'))) {
|
|
37
59
|
_context.next = 16;
|
|
38
60
|
break;
|
|
39
61
|
}
|
|
@@ -15,6 +15,7 @@ export declare class ClipboardLoader extends React.PureComponent<ClipboardWithMe
|
|
|
15
15
|
state: {
|
|
16
16
|
Clipboard: ClipboardWithMediaClientConfigComponent | undefined;
|
|
17
17
|
};
|
|
18
|
+
componentDidMount(): void;
|
|
18
19
|
UNSAFE_componentWillMount(): Promise<void>;
|
|
19
20
|
render(): React.JSX.Element | null;
|
|
20
21
|
}
|
|
@@ -17,6 +17,7 @@ export declare class DropzoneLoader extends React.PureComponent<DropzoneWithMedi
|
|
|
17
17
|
Dropzone: DropzoneWithMediaClientConfigComponent | undefined;
|
|
18
18
|
MediaPickerErrorBoundary: MediaPickerErrorBoundaryComponent | undefined;
|
|
19
19
|
};
|
|
20
|
+
componentDidMount(): void;
|
|
20
21
|
UNSAFE_componentWillMount(): Promise<void>;
|
|
21
22
|
render(): React.JSX.Element | null;
|
|
22
23
|
}
|
|
@@ -15,6 +15,7 @@ export declare class ClipboardLoader extends React.PureComponent<ClipboardWithMe
|
|
|
15
15
|
state: {
|
|
16
16
|
Clipboard: ClipboardWithMediaClientConfigComponent | undefined;
|
|
17
17
|
};
|
|
18
|
+
componentDidMount(): void;
|
|
18
19
|
UNSAFE_componentWillMount(): Promise<void>;
|
|
19
20
|
render(): React.JSX.Element | null;
|
|
20
21
|
}
|
|
@@ -17,6 +17,7 @@ export declare class DropzoneLoader extends React.PureComponent<DropzoneWithMedi
|
|
|
17
17
|
Dropzone: DropzoneWithMediaClientConfigComponent | undefined;
|
|
18
18
|
MediaPickerErrorBoundary: MediaPickerErrorBoundaryComponent | undefined;
|
|
19
19
|
};
|
|
20
|
+
componentDidMount(): void;
|
|
20
21
|
UNSAFE_componentWillMount(): Promise<void>;
|
|
21
22
|
render(): React.JSX.Element | null;
|
|
22
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-picker",
|
|
3
|
-
"version": "70.1.
|
|
3
|
+
"version": "70.1.3",
|
|
4
4
|
"description": "Library for handling file uploads",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
},
|
|
93
93
|
"add_media_picker_error_detail": {
|
|
94
94
|
"type": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"jfp-magma-media-clipboard-init-after-mount": {
|
|
97
|
+
"type": "boolean"
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|