@atlaskit/editor-extension-dropbox 5.0.11 → 5.1.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-extension-dropbox
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0a65ee9a1c299`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0a65ee9a1c299) -
8
+ Replace ReactDOM.render in editor-extesion-dropbox
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 5.0.12
15
+
16
+ ### Patch Changes
17
+
18
+ - [`07a6b579ea15d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/07a6b579ea15d) -
19
+ remove unused dependencies
20
+ - Updated dependencies
21
+
3
22
  ## 5.0.11
4
23
 
5
24
  ### Patch Changes
@@ -32,9 +32,6 @@
32
32
  {
33
33
  "path": "../../../design-system/heading/afm-cc/tsconfig.json"
34
34
  },
35
- {
36
- "path": "../../../design-system/icon/afm-cc/tsconfig.json"
37
- },
38
35
  {
39
36
  "path": "../../../design-system/modal-dialog/afm-cc/tsconfig.json"
40
37
  },
@@ -32,9 +32,6 @@
32
32
  {
33
33
  "path": "../../../design-system/heading/afm-jira/tsconfig.json"
34
34
  },
35
- {
36
- "path": "../../../design-system/icon/afm-jira/tsconfig.json"
37
- },
38
35
  {
39
36
  "path": "../../../design-system/modal-dialog/afm-jira/tsconfig.json"
40
37
  },
@@ -1,4 +1,4 @@
1
- /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -10,7 +10,9 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _reactDom = _interopRequireDefault(require("react-dom"));
13
+ var _client = require("react-dom/client");
13
14
  var _builders = require("@atlaskit/adf-utils/builders");
15
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
16
  var _enableDropbox = _interopRequireDefault(require("./enable-dropbox"));
15
17
  var _constants = require("./constants");
16
18
  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); }
@@ -19,22 +21,25 @@ function pickFromDropbox(_x, _x2) {
19
21
  }
20
22
  function _pickFromDropbox() {
21
23
  _pickFromDropbox = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(appKey, canMountinIframe) {
22
- var popupMountPoint, Modal, files, node, newNodes;
24
+ var popupMountPoint, root, Modal, files, node, newNodes;
23
25
  return _regenerator.default.wrap(function _callee2$(_context2) {
24
26
  while (1) switch (_context2.prev = _context2.next) {
25
27
  case 0:
26
28
  _context2.next = 2;
27
29
  return (0, _enableDropbox.default)(appKey);
28
30
  case 2:
31
+ root = null; // BC - as of 2020-01-21 this does not work, as no dropbox app we have is authorised
32
+ // to iframe in the picker - we are currently waiting for permissions.
33
+ // To test the picker, comment out the render call, and the `iframe` and `winowName` options
29
34
  if (!canMountinIframe) {
30
- _context2.next = 9;
35
+ _context2.next = 10;
31
36
  break;
32
37
  }
33
- _context2.next = 5;
38
+ _context2.next = 6;
34
39
  return Promise.resolve().then(function () {
35
40
  return _interopRequireWildcard(require('./modal'));
36
41
  });
37
- case 5:
42
+ case 6:
38
43
  Modal = _context2.sent;
39
44
  // The decision has been made to simply append our modal to the body
40
45
  // Using the passed in popupMountPoint has the potential to cause
@@ -47,12 +52,19 @@ function _pickFromDropbox() {
47
52
  popupMountPoint.id = _constants.POPUP_MOUNTPOINT;
48
53
  document.body.appendChild(popupMountPoint);
49
54
  }
50
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(Modal.default, {
51
- onClose: function onClose() {}
52
- }), popupMountPoint);
53
- case 9:
54
- _context2.prev = 9;
55
- _context2.next = 12;
55
+ if ((0, _expValEquals.expValEquals)('platform_editor_react19_migration', 'isEnabled', true)) {
56
+ root = (0, _client.createRoot)(popupMountPoint);
57
+ root.render( /*#__PURE__*/_react.default.createElement(Modal.default, {
58
+ onClose: function onClose() {}
59
+ }));
60
+ } else {
61
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(Modal.default, {
62
+ onClose: function onClose() {}
63
+ }), popupMountPoint);
64
+ }
65
+ case 10:
66
+ _context2.prev = 10;
67
+ _context2.next = 13;
56
68
  return new Promise(function (resolve, reject) {
57
69
  window.Dropbox.choose({
58
70
  iframe: canMountinIframe,
@@ -61,27 +73,35 @@ function _pickFromDropbox() {
61
73
  cancel: reject
62
74
  });
63
75
  });
64
- case 12:
76
+ case 13:
65
77
  files = _context2.sent;
66
- _context2.next = 19;
78
+ _context2.next = 20;
67
79
  break;
68
- case 15:
69
- _context2.prev = 15;
70
- _context2.t0 = _context2["catch"](9);
71
- if (popupMountPoint) {
80
+ case 16:
81
+ _context2.prev = 16;
82
+ _context2.t0 = _context2["catch"](10);
83
+ if ((0, _expValEquals.expValEquals)('platform_editor_react19_migration', 'isEnabled', true)) {
84
+ if (root) {
85
+ root.unmount();
86
+ }
87
+ } else if (popupMountPoint) {
72
88
  _reactDom.default.unmountComponentAtNode(popupMountPoint);
73
89
  }
74
90
  return _context2.abrupt("return");
75
- case 19:
91
+ case 20:
76
92
  if (files.length) {
77
- _context2.next = 22;
93
+ _context2.next = 23;
78
94
  break;
79
95
  }
80
- if (popupMountPoint) {
96
+ if ((0, _expValEquals.expValEquals)('platform_editor_react19_migration', 'isEnabled', true)) {
97
+ if (root) {
98
+ root.unmount();
99
+ }
100
+ } else if (popupMountPoint) {
81
101
  _reactDom.default.unmountComponentAtNode(popupMountPoint);
82
102
  }
83
103
  return _context2.abrupt("return");
84
- case 22:
104
+ case 23:
85
105
  newNodes = files.map(function (file) {
86
106
  return (0, _builders.inlineCard)({
87
107
  url: file.link
@@ -97,15 +117,19 @@ function _pickFromDropbox() {
97
117
  content: newNodes
98
118
  };
99
119
  }
100
- if (popupMountPoint) {
120
+ if ((0, _expValEquals.expValEquals)('platform_editor_react19_migration', 'isEnabled', true)) {
121
+ if (root) {
122
+ root.unmount();
123
+ }
124
+ } else if (popupMountPoint) {
101
125
  _reactDom.default.unmountComponentAtNode(popupMountPoint);
102
126
  }
103
127
  return _context2.abrupt("return", node);
104
- case 26:
128
+ case 27:
105
129
  case "end":
106
130
  return _context2.stop();
107
131
  }
108
- }, _callee2, null, [[9, 15]]);
132
+ }, _callee2, null, [[10, 16]]);
109
133
  }));
110
134
  return _pickFromDropbox.apply(this, arguments);
111
135
  }
@@ -1,4 +1,4 @@
1
- /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./DropboxIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,15 +1,18 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
+ import { createRoot } from 'react-dom/client';
3
4
  import { inlineCard } from '@atlaskit/adf-utils/builders';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
6
  import enableDropbox from './enable-dropbox';
5
7
  import { POPUP_MOUNTPOINT, DROPBOX_IFRAME_NAME } from './constants';
6
8
  async function pickFromDropbox(appKey, canMountinIframe) {
7
9
  await enableDropbox(appKey);
8
10
  let popupMountPoint;
11
+ let root = null;
9
12
 
10
13
  // BC - as of 2020-01-21 this does not work, as no dropbox app we have is authorised
11
14
  // to iframe in the picker - we are currently waiting for permissions.
12
- // To test the picker, comment out the ReactDOM render call, and the `iframe` and `winowName` options
15
+ // To test the picker, comment out the render call, and the `iframe` and `winowName` options
13
16
  if (canMountinIframe) {
14
17
  const Modal = await import('./modal');
15
18
 
@@ -24,9 +27,16 @@ async function pickFromDropbox(appKey, canMountinIframe) {
24
27
  popupMountPoint.id = POPUP_MOUNTPOINT;
25
28
  document.body.appendChild(popupMountPoint);
26
29
  }
27
- ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
28
- onClose: () => {}
29
- }), popupMountPoint);
30
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
31
+ root = createRoot(popupMountPoint);
32
+ root.render( /*#__PURE__*/React.createElement(Modal.default, {
33
+ onClose: () => {}
34
+ }));
35
+ } else {
36
+ ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
37
+ onClose: () => {}
38
+ }), popupMountPoint);
39
+ }
30
40
  }
31
41
  let files;
32
42
  try {
@@ -38,15 +48,24 @@ async function pickFromDropbox(appKey, canMountinIframe) {
38
48
  cancel: reject
39
49
  });
40
50
  });
51
+ // eslint-disable-next-line no-unused-vars
41
52
  } catch (e) {
42
- if (popupMountPoint) {
53
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
54
+ if (root) {
55
+ root.unmount();
56
+ }
57
+ } else if (popupMountPoint) {
43
58
  ReactDOM.unmountComponentAtNode(popupMountPoint);
44
59
  }
45
60
  return;
46
61
  }
47
62
  let node;
48
63
  if (!files.length) {
49
- if (popupMountPoint) {
64
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
65
+ if (root) {
66
+ root.unmount();
67
+ }
68
+ } else if (popupMountPoint) {
50
69
  ReactDOM.unmountComponentAtNode(popupMountPoint);
51
70
  }
52
71
  return;
@@ -64,7 +83,11 @@ async function pickFromDropbox(appKey, canMountinIframe) {
64
83
  content: newNodes
65
84
  };
66
85
  }
67
- if (popupMountPoint) {
86
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
87
+ if (root) {
88
+ root.unmount();
89
+ }
90
+ } else if (popupMountPoint) {
68
91
  ReactDOM.unmountComponentAtNode(popupMountPoint);
69
92
  }
70
93
  return node;
@@ -1,4 +1,4 @@
1
- /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* DropboxIcon.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./DropboxIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -2,7 +2,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import ReactDOM from 'react-dom';
5
+ import { createRoot } from 'react-dom/client';
5
6
  import { inlineCard } from '@atlaskit/adf-utils/builders';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
8
  import enableDropbox from './enable-dropbox';
7
9
  import { POPUP_MOUNTPOINT, DROPBOX_IFRAME_NAME } from './constants';
8
10
  function pickFromDropbox(_x, _x2) {
@@ -10,20 +12,23 @@ function pickFromDropbox(_x, _x2) {
10
12
  }
11
13
  function _pickFromDropbox() {
12
14
  _pickFromDropbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(appKey, canMountinIframe) {
13
- var popupMountPoint, Modal, files, node, newNodes;
15
+ var popupMountPoint, root, Modal, files, node, newNodes;
14
16
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
15
17
  while (1) switch (_context2.prev = _context2.next) {
16
18
  case 0:
17
19
  _context2.next = 2;
18
20
  return enableDropbox(appKey);
19
21
  case 2:
22
+ root = null; // BC - as of 2020-01-21 this does not work, as no dropbox app we have is authorised
23
+ // to iframe in the picker - we are currently waiting for permissions.
24
+ // To test the picker, comment out the render call, and the `iframe` and `winowName` options
20
25
  if (!canMountinIframe) {
21
- _context2.next = 9;
26
+ _context2.next = 10;
22
27
  break;
23
28
  }
24
- _context2.next = 5;
29
+ _context2.next = 6;
25
30
  return import('./modal');
26
- case 5:
31
+ case 6:
27
32
  Modal = _context2.sent;
28
33
  // The decision has been made to simply append our modal to the body
29
34
  // Using the passed in popupMountPoint has the potential to cause
@@ -36,12 +41,19 @@ function _pickFromDropbox() {
36
41
  popupMountPoint.id = POPUP_MOUNTPOINT;
37
42
  document.body.appendChild(popupMountPoint);
38
43
  }
39
- ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
40
- onClose: function onClose() {}
41
- }), popupMountPoint);
42
- case 9:
43
- _context2.prev = 9;
44
- _context2.next = 12;
44
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
45
+ root = createRoot(popupMountPoint);
46
+ root.render( /*#__PURE__*/React.createElement(Modal.default, {
47
+ onClose: function onClose() {}
48
+ }));
49
+ } else {
50
+ ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
51
+ onClose: function onClose() {}
52
+ }), popupMountPoint);
53
+ }
54
+ case 10:
55
+ _context2.prev = 10;
56
+ _context2.next = 13;
45
57
  return new Promise(function (resolve, reject) {
46
58
  window.Dropbox.choose({
47
59
  iframe: canMountinIframe,
@@ -50,27 +62,35 @@ function _pickFromDropbox() {
50
62
  cancel: reject
51
63
  });
52
64
  });
53
- case 12:
65
+ case 13:
54
66
  files = _context2.sent;
55
- _context2.next = 19;
67
+ _context2.next = 20;
56
68
  break;
57
- case 15:
58
- _context2.prev = 15;
59
- _context2.t0 = _context2["catch"](9);
60
- if (popupMountPoint) {
69
+ case 16:
70
+ _context2.prev = 16;
71
+ _context2.t0 = _context2["catch"](10);
72
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
73
+ if (root) {
74
+ root.unmount();
75
+ }
76
+ } else if (popupMountPoint) {
61
77
  ReactDOM.unmountComponentAtNode(popupMountPoint);
62
78
  }
63
79
  return _context2.abrupt("return");
64
- case 19:
80
+ case 20:
65
81
  if (files.length) {
66
- _context2.next = 22;
82
+ _context2.next = 23;
67
83
  break;
68
84
  }
69
- if (popupMountPoint) {
85
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
86
+ if (root) {
87
+ root.unmount();
88
+ }
89
+ } else if (popupMountPoint) {
70
90
  ReactDOM.unmountComponentAtNode(popupMountPoint);
71
91
  }
72
92
  return _context2.abrupt("return");
73
- case 22:
93
+ case 23:
74
94
  newNodes = files.map(function (file) {
75
95
  return inlineCard({
76
96
  url: file.link
@@ -86,15 +106,19 @@ function _pickFromDropbox() {
86
106
  content: newNodes
87
107
  };
88
108
  }
89
- if (popupMountPoint) {
109
+ if (expValEquals('platform_editor_react19_migration', 'isEnabled', true)) {
110
+ if (root) {
111
+ root.unmount();
112
+ }
113
+ } else if (popupMountPoint) {
90
114
  ReactDOM.unmountComponentAtNode(popupMountPoint);
91
115
  }
92
116
  return _context2.abrupt("return", node);
93
- case 26:
117
+ case 27:
94
118
  case "end":
95
119
  return _context2.stop();
96
120
  }
97
- }, _callee2, null, [[9, 15]]);
121
+ }, _callee2, null, [[10, 16]]);
98
122
  }));
99
123
  return _pickFromDropbox.apply(this, arguments);
100
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "5.0.11",
3
+ "version": "5.1.0",
4
4
  "description": "A an atlassian editor extension to add a native dropbox picker",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,18 +34,17 @@
34
34
  "@atlaskit/adf-utils": "^19.27.0",
35
35
  "@atlaskit/button": "^23.10.0",
36
36
  "@atlaskit/heading": "^5.3.0",
37
- "@atlaskit/icon": "^32.0.0",
38
37
  "@atlaskit/modal-dialog": "^14.11.0",
39
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
39
  "@atlaskit/primitives": "^18.0.0",
41
- "@atlaskit/tmp-editor-statsig": "^34.0.0",
42
- "@atlaskit/tokens": "^11.0.0",
40
+ "@atlaskit/tmp-editor-statsig": "^35.7.0",
41
+ "@atlaskit/tokens": "^11.1.0",
43
42
  "@babel/runtime": "^7.0.0",
44
43
  "@compiled/react": "^0.20.0",
45
44
  "@emotion/react": "^11.7.1"
46
45
  },
47
46
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^111.28.0",
47
+ "@atlaskit/editor-common": "^111.34.0",
49
48
  "react": "^18.2.0",
50
49
  "react-dom": "^18.2.0"
51
50
  },