@atlaskit/editor-common 61.0.1 → 62.0.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/cjs/index.js +24 -0
  3. package/dist/cjs/messages/codeBidiWarning.js +2 -2
  4. package/dist/cjs/messages/link.js +2 -2
  5. package/dist/cjs/messages/unsupportedContent.js +2 -2
  6. package/dist/cjs/ui/Caption/index.js +2 -2
  7. package/dist/cjs/ui/Caption/messages.js +2 -2
  8. package/dist/cjs/ui/Expand/index.js +2 -2
  9. package/dist/cjs/ui/IntlLegacyFallbackProvider/index.js +60 -0
  10. package/dist/cjs/ui/IntlNextErrorBoundary/index.js +90 -0
  11. package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +67 -0
  12. package/dist/cjs/ui/UnsupportedBlock/index.js +2 -2
  13. package/dist/cjs/ui/UnsupportedInline/index.js +2 -2
  14. package/dist/cjs/ui/index.js +30 -0
  15. package/dist/cjs/utils/date.js +2 -3
  16. package/dist/cjs/version.json +1 -1
  17. package/dist/es2019/index.js +1 -1
  18. package/dist/es2019/messages/codeBidiWarning.js +1 -1
  19. package/dist/es2019/messages/link.js +1 -1
  20. package/dist/es2019/messages/unsupportedContent.js +1 -1
  21. package/dist/es2019/ui/Caption/index.js +1 -1
  22. package/dist/es2019/ui/Caption/messages.js +1 -1
  23. package/dist/es2019/ui/Expand/index.js +1 -1
  24. package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +21 -0
  25. package/dist/es2019/ui/IntlNextErrorBoundary/index.js +43 -0
  26. package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +24 -0
  27. package/dist/es2019/ui/UnsupportedBlock/index.js +1 -1
  28. package/dist/es2019/ui/UnsupportedInline/index.js +1 -1
  29. package/dist/es2019/ui/index.js +4 -1
  30. package/dist/es2019/utils/date.js +2 -3
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/messages/codeBidiWarning.js +1 -1
  34. package/dist/esm/messages/link.js +1 -1
  35. package/dist/esm/messages/unsupportedContent.js +1 -1
  36. package/dist/esm/ui/Caption/index.js +1 -1
  37. package/dist/esm/ui/Caption/messages.js +1 -1
  38. package/dist/esm/ui/Expand/index.js +1 -1
  39. package/dist/esm/ui/IntlLegacyFallbackProvider/index.js +45 -0
  40. package/dist/esm/ui/IntlNextErrorBoundary/index.js +73 -0
  41. package/dist/esm/ui/LegacyToNextIntlProvider/index.js +51 -0
  42. package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
  43. package/dist/esm/ui/UnsupportedInline/index.js +1 -1
  44. package/dist/esm/ui/index.js +4 -1
  45. package/dist/esm/utils/date.js +2 -3
  46. package/dist/esm/version.json +1 -1
  47. package/dist/types/extensions/types/extension-handler.d.ts +1 -0
  48. package/dist/types/index.d.ts +1 -1
  49. package/dist/types/ui/Caption/index.d.ts +4 -4
  50. package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +8 -0
  51. package/dist/types/ui/IntlNextErrorBoundary/index.d.ts +15 -0
  52. package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +8 -0
  53. package/dist/types/ui/UnsupportedBlock/index.d.ts +3 -3
  54. package/dist/types/ui/UnsupportedInline/index.d.ts +3 -3
  55. package/dist/types/ui/index.d.ts +3 -0
  56. package/dist/types/ui/unsupported-content-helper.d.ts +2 -2
  57. package/dist/types/utils/date.d.ts +3 -3
  58. package/package.json +9 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 62.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`47f58da5946`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47f58da5946) - ED-13322, ED-13324, ED-13326, ED-13323, ED-13204: Upgrade and support react-intl@^5.18.1 including breaking API changes, types and tests in atlassian-frontend packages
8
+
9
+ What changed: Upgraded our react-intl support from ^2.6.0 to ^5.18.1. This means editor packages now rely on consumers installing ^5.18.1, otherwise editor usage of react-intl will mismatch with actual installed react-intl APIs.
10
+ Why change was made: As part of a coordinated upgrade effort across AF packages, as react-intl v2 is quite dated.
11
+ How consumer should update their code: Ensure react-intl ^5.18.1 is installed in consuming applications.
12
+
13
+ Upgrade guide: To consume atlassian-frontend packages that use react-intl5 setup a second provider for the new version, using an npm alias
14
+
15
+ ```js
16
+ "react-intl": "^2.6.0",
17
+ "react-intl-next": "npm:react-intl@^5.18.1",
18
+ ```
19
+
20
+ ```js
21
+ import { IntlProvider } from 'react-intl';
22
+ import { IntlProvider as IntlNextProvider } from 'react-intl-next';
23
+
24
+ return (
25
+ <IntlProvider
26
+ key={locale}
27
+ data-test-language={locale}
28
+ locale={locale}
29
+ defaultLocale={DEFAULT_LOCALE}
30
+ messages={messages}
31
+ >
32
+ <IntlNextProvider
33
+ key={locale}
34
+ data-test-language={locale}
35
+ locale={locale}
36
+ defaultLocale={DEFAULT_LOCALE}
37
+ messages={messages}
38
+ >
39
+ {children}
40
+ </IntlNextProvider>
41
+ </IntlProvider>
42
+ );
43
+ ```
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies
48
+
3
49
  ## 61.0.1
4
50
 
5
51
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -117,6 +117,24 @@ Object.defineProperty(exports, "HelperMessage", {
117
117
  return _ui.HelperMessage;
118
118
  }
119
119
  });
120
+ Object.defineProperty(exports, "IntlLegacyFallbackProvider", {
121
+ enumerable: true,
122
+ get: function get() {
123
+ return _ui.IntlLegacyFallbackProvider;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "IntlNextErrorBoundary", {
127
+ enumerable: true,
128
+ get: function get() {
129
+ return _ui.IntlNextErrorBoundary;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "LegacyToNextIntlProvider", {
133
+ enumerable: true,
134
+ get: function get() {
135
+ return _ui.LegacyToNextIntlProvider;
136
+ }
137
+ });
120
138
  Object.defineProperty(exports, "MediaLink", {
121
139
  enumerable: true,
122
140
  get: function get() {
@@ -171,6 +189,12 @@ Object.defineProperty(exports, "ProviderFactory", {
171
189
  return _providerFactory.ProviderFactory;
172
190
  }
173
191
  });
192
+ Object.defineProperty(exports, "REACT_INTL_ERROR_MESSAGE", {
193
+ enumerable: true,
194
+ get: function get() {
195
+ return _ui.REACT_INTL_ERROR_MESSAGE;
196
+ }
197
+ });
174
198
  Object.defineProperty(exports, "RenderCountProfiler", {
175
199
  enumerable: true,
176
200
  get: function get() {
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.codeBidiWarningMessages = void 0;
7
7
 
8
- var _reactIntl = require("react-intl");
8
+ var _reactIntlNext = require("react-intl-next");
9
9
 
10
- var codeBidiWarningMessages = (0, _reactIntl.defineMessages)({
10
+ var codeBidiWarningMessages = (0, _reactIntlNext.defineMessages)({
11
11
  /**
12
12
  * Message taken from
13
13
  * https://hello.atlassian.net/wiki/spaces/~tswan/pages/1366555782/PSHELP-2943+Investigate+Trojan+Source+Attack+Vulnerability+design
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.linkMessages = void 0;
7
7
 
8
- var _reactIntl = require("react-intl");
8
+ var _reactIntlNext = require("react-intl-next");
9
9
 
10
- var linkMessages = (0, _reactIntl.defineMessages)({
10
+ var linkMessages = (0, _reactIntlNext.defineMessages)({
11
11
  openLink: {
12
12
  id: 'fabric.editor.openLink',
13
13
  defaultMessage: 'Open link in a new tab',
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.unsupportedContentMessages = void 0;
7
7
 
8
- var _reactIntl = require("react-intl");
8
+ var _reactIntlNext = require("react-intl-next");
9
9
 
10
- var unsupportedContentMessages = (0, _reactIntl.defineMessages)({
10
+ var unsupportedContentMessages = (0, _reactIntlNext.defineMessages)({
11
11
  unsupportedInlineContent: {
12
12
  id: 'fabric.editor.unsupportedInlineContent',
13
13
  defaultMessage: 'Unsupported content',
@@ -23,7 +23,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
23
23
 
24
24
  var _react = _interopRequireDefault(require("react"));
25
25
 
26
- var _reactIntl = require("react-intl");
26
+ var _reactIntlNext = require("react-intl-next");
27
27
 
28
28
  var _styledComponents = _interopRequireDefault(require("styled-components"));
29
29
 
@@ -72,6 +72,6 @@ var CaptionComponent = /*#__PURE__*/function (_React$Component) {
72
72
 
73
73
  exports.CaptionComponent = CaptionComponent;
74
74
 
75
- var _default = (0, _reactIntl.injectIntl)(CaptionComponent);
75
+ var _default = (0, _reactIntlNext.injectIntl)(CaptionComponent);
76
76
 
77
77
  exports.default = _default;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.messages = void 0;
7
7
 
8
- var _reactIntl = require("react-intl");
8
+ var _reactIntlNext = require("react-intl-next");
9
9
 
10
- var messages = (0, _reactIntl.defineMessages)({
10
+ var messages = (0, _reactIntlNext.defineMessages)({
11
11
  placeholder: {
12
12
  id: 'fabric.editor.captionPlaceholder',
13
13
  defaultMessage: 'Add a caption',
@@ -11,7 +11,7 @@ exports.sharedExpandStyles = exports.messages = exports.ExpandLayoutWrapper = ex
11
11
 
12
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
13
 
14
- var _reactIntl = require("react-intl");
14
+ var _reactIntlNext = require("react-intl-next");
15
15
 
16
16
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
17
 
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
29
 
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
 
32
- var messages = (0, _reactIntl.defineMessages)({
32
+ var messages = (0, _reactIntlNext.defineMessages)({
33
33
  collapseNode: {
34
34
  id: 'fabric.editor.collapseNode',
35
35
  defaultMessage: 'Collapse content',
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.IntlLegacyFallbackProvider = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
22
+ var _react = _interopRequireDefault(require("react"));
23
+
24
+ var _reactIntl = require("react-intl");
25
+
26
+ 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); }; }
27
+
28
+ 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; } }
29
+
30
+ var IntlLegacyFallbackProvider = /*#__PURE__*/function (_React$Component) {
31
+ (0, _inherits2.default)(IntlLegacyFallbackProvider, _React$Component);
32
+
33
+ var _super = _createSuper(IntlLegacyFallbackProvider);
34
+
35
+ function IntlLegacyFallbackProvider() {
36
+ (0, _classCallCheck2.default)(this, IntlLegacyFallbackProvider);
37
+ return _super.apply(this, arguments);
38
+ }
39
+
40
+ (0, _createClass2.default)(IntlLegacyFallbackProvider, [{
41
+ key: "render",
42
+ value: function render() {
43
+ var oldIntl = this.context.intl;
44
+
45
+ if (!oldIntl) {
46
+ return /*#__PURE__*/_react.default.createElement(_reactIntl.IntlProvider, {
47
+ locale: "en"
48
+ }, this.props.children);
49
+ }
50
+
51
+ return this.props.children;
52
+ }
53
+ }]);
54
+ return IntlLegacyFallbackProvider;
55
+ }(_react.default.Component);
56
+
57
+ exports.IntlLegacyFallbackProvider = IntlLegacyFallbackProvider;
58
+ (0, _defineProperty2.default)(IntlLegacyFallbackProvider, "contextTypes", {
59
+ intl: _reactIntl.intlShape
60
+ });
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.REACT_INTL_ERROR_MESSAGE = exports.IntlNextErrorBoundary = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
+
24
+ var _react = _interopRequireDefault(require("react"));
25
+
26
+ var _reactIntlNext = require("react-intl-next");
27
+
28
+ 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); }; }
29
+
30
+ 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; } }
31
+
32
+ var REACT_INTL_ERROR_MESSAGE = '<IntlProvider> needs to exist in the component ancestry';
33
+ exports.REACT_INTL_ERROR_MESSAGE = REACT_INTL_ERROR_MESSAGE;
34
+
35
+ var isMissingIntlProviderInAncestryError = function isMissingIntlProviderInAncestryError(err) {
36
+ var _err$toString;
37
+
38
+ return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
39
+ };
40
+
41
+ var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
42
+ (0, _inherits2.default)(IntlNextErrorBoundary, _React$Component);
43
+
44
+ var _super = _createSuper(IntlNextErrorBoundary);
45
+
46
+ function IntlNextErrorBoundary() {
47
+ var _this;
48
+
49
+ (0, _classCallCheck2.default)(this, IntlNextErrorBoundary);
50
+
51
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
52
+ args[_key] = arguments[_key];
53
+ }
54
+
55
+ _this = _super.call.apply(_super, [this].concat(args));
56
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
57
+ missingIntlProviderInAncestry: false
58
+ });
59
+ return _this;
60
+ }
61
+
62
+ (0, _createClass2.default)(IntlNextErrorBoundary, [{
63
+ key: "componentDidCatch",
64
+ value: function componentDidCatch(error, errorInfo) {
65
+ // if missing IntlProvider in ancestry, we setup a fallback IntlProvider ourselves
66
+ if (isMissingIntlProviderInAncestryError(error)) {
67
+ this.setState({
68
+ missingIntlProviderInAncestry: true
69
+ });
70
+ } else {
71
+ // else we re-propagate the non-react-intl-next error
72
+ throw error;
73
+ }
74
+ }
75
+ }, {
76
+ key: "render",
77
+ value: function render() {
78
+ if (this.state.missingIntlProviderInAncestry) {
79
+ return /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
80
+ locale: "en"
81
+ }, this.props.children);
82
+ }
83
+
84
+ return this.props.children;
85
+ }
86
+ }]);
87
+ return IntlNextErrorBoundary;
88
+ }(_react.default.Component);
89
+
90
+ exports.IntlNextErrorBoundary = IntlNextErrorBoundary;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.LegacyToNextIntlProvider = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
22
+ var _react = _interopRequireDefault(require("react"));
23
+
24
+ var _reactIntl = require("react-intl");
25
+
26
+ var _reactIntlNext = require("react-intl-next");
27
+
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
29
+
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
31
+
32
+ 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); }; }
33
+
34
+ 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; } }
35
+
36
+ var LegacyToNextIntlProvider = /*#__PURE__*/function (_React$Component) {
37
+ (0, _inherits2.default)(LegacyToNextIntlProvider, _React$Component);
38
+
39
+ var _super = _createSuper(LegacyToNextIntlProvider);
40
+
41
+ function LegacyToNextIntlProvider() {
42
+ (0, _classCallCheck2.default)(this, LegacyToNextIntlProvider);
43
+ return _super.apply(this, arguments);
44
+ }
45
+
46
+ (0, _createClass2.default)(LegacyToNextIntlProvider, [{
47
+ key: "render",
48
+ value: function render() {
49
+ var oldIntl = this.context.intl;
50
+
51
+ if (oldIntl) {
52
+ var nextIntl = (0, _reactIntlNext.createIntl)(_objectSpread({}, oldIntl));
53
+ return /*#__PURE__*/_react.default.createElement(_reactIntlNext.RawIntlProvider, {
54
+ value: nextIntl
55
+ }, this.props.children);
56
+ }
57
+
58
+ return this.props.children;
59
+ }
60
+ }]);
61
+ return LegacyToNextIntlProvider;
62
+ }(_react.default.Component);
63
+
64
+ exports.LegacyToNextIntlProvider = LegacyToNextIntlProvider;
65
+ (0, _defineProperty2.default)(LegacyToNextIntlProvider, "contextTypes", {
66
+ intl: _reactIntl.intlShape
67
+ });
@@ -13,7 +13,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
- var _reactIntl = require("react-intl");
16
+ var _reactIntlNext = require("react-intl-next");
17
17
 
18
18
  var _styledComponents = _interopRequireDefault(require("styled-components"));
19
19
 
@@ -73,6 +73,6 @@ var UnsupportedBlockNode = function UnsupportedBlockNode(_ref) {
73
73
  }))));
74
74
  };
75
75
 
76
- var _default = (0, _reactIntl.injectIntl)(UnsupportedBlockNode);
76
+ var _default = (0, _reactIntlNext.injectIntl)(UnsupportedBlockNode);
77
77
 
78
78
  exports.default = _default;
@@ -13,7 +13,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
- var _reactIntl = require("react-intl");
16
+ var _reactIntlNext = require("react-intl-next");
17
17
 
18
18
  var _styledComponents = _interopRequireDefault(require("styled-components"));
19
19
 
@@ -73,6 +73,6 @@ var UnsupportedInlineNode = function UnsupportedInlineNode(_ref) {
73
73
  }))));
74
74
  };
75
75
 
76
- var _default = (0, _reactIntl.injectIntl)(UnsupportedInlineNode);
76
+ var _default = (0, _reactIntlNext.injectIntl)(UnsupportedInlineNode);
77
77
 
78
78
  exports.default = _default;
@@ -67,6 +67,24 @@ Object.defineProperty(exports, "HelperMessage", {
67
67
  return _Messages.HelperMessage;
68
68
  }
69
69
  });
70
+ Object.defineProperty(exports, "IntlLegacyFallbackProvider", {
71
+ enumerable: true,
72
+ get: function get() {
73
+ return _IntlLegacyFallbackProvider.IntlLegacyFallbackProvider;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "IntlNextErrorBoundary", {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _IntlNextErrorBoundary.IntlNextErrorBoundary;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "LegacyToNextIntlProvider", {
83
+ enumerable: true,
84
+ get: function get() {
85
+ return _LegacyToNextIntlProvider.LegacyToNextIntlProvider;
86
+ }
87
+ });
70
88
  Object.defineProperty(exports, "MediaLink", {
71
89
  enumerable: true,
72
90
  get: function get() {
@@ -97,6 +115,12 @@ Object.defineProperty(exports, "Popup", {
97
115
  return _Popup.default;
98
116
  }
99
117
  });
118
+ Object.defineProperty(exports, "REACT_INTL_ERROR_MESSAGE", {
119
+ enumerable: true,
120
+ get: function get() {
121
+ return _IntlNextErrorBoundary.REACT_INTL_ERROR_MESSAGE;
122
+ }
123
+ });
100
124
  Object.defineProperty(exports, "UnsupportedBlock", {
101
125
  enumerable: true,
102
126
  get: function get() {
@@ -266,6 +290,12 @@ var _Messages = require("./Messages");
266
290
 
267
291
  var _clearNextSiblingMarginTop = require("./clear-next-sibling-margin-top");
268
292
 
293
+ var _IntlNextErrorBoundary = require("./IntlNextErrorBoundary");
294
+
295
+ var _IntlLegacyFallbackProvider = require("./IntlLegacyFallbackProvider");
296
+
297
+ var _LegacyToNextIntlProvider = require("./LegacyToNextIntlProvider");
298
+
269
299
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
270
300
 
271
301
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -95,9 +95,8 @@ var timestampToTaskContext = function timestampToTaskContext(timestamp, intl) {
95
95
  var sameYear = givenDate.getUTCFullYear() === curDate.getUTCFullYear();
96
96
 
97
97
  if (intl && [-1, 0, 1].indexOf(distance) > -1) {
98
- return capitalizeFirstLetter(intl.formatRelative(givenDate, {
99
- units: 'day',
100
- now: Number(todayTimestampInUTC())
98
+ return capitalizeFirstLetter(intl.formatRelativeTime(distance, 'day', {
99
+ numeric: 'auto'
101
100
  }));
102
101
  }
103
102
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "61.0.1",
3
+ "version": "62.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -19,7 +19,7 @@ StatusSharedCssClassName, smartCardSharedStyles, SmartCardSharedCssClassName } f
19
19
 
20
20
  export { BaseTheme, Caption, ClearNextSiblingMarginTop, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, Emoji, //exported from ./src/emoji.ts
21
21
  ErrorMessage, ExpandIconWrapper, ExpandLayoutWrapper, HelperMessage, MediaSingle, MediaSingleDimensionHelper, Mention, //exported from ./src/mention.ts
22
- Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth } from './ui'; // new child entry point ./ui/index.tsx
22
+ Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth, IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE, IntlLegacyFallbackProvider, LegacyToNextIntlProvider } from './ui'; // new child entry point ./ui/index.tsx
23
23
 
24
24
  // already exported by ./messages/index.ts
25
25
  export { linkMessages } from './messages/link'; // new child entry point in ./utils/index.ts
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export const codeBidiWarningMessages = defineMessages({
3
3
  /**
4
4
  * Message taken from
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export const linkMessages = defineMessages({
3
3
  openLink: {
4
4
  id: 'fabric.editor.openLink',
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export const unsupportedContentMessages = defineMessages({
3
3
  unsupportedInlineContent: {
4
4
  id: 'fabric.editor.unsupportedInlineContent',
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { injectIntl } from 'react-intl';
3
+ import { injectIntl } from 'react-intl-next';
4
4
  import styled from 'styled-components';
5
5
  import { N200, N400 } from '@atlaskit/theme/colors';
6
6
  import { messages } from './messages';
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export const messages = defineMessages({
3
3
  placeholder: {
4
4
  id: 'fabric.editor.captionPlaceholder',
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
4
4
  import * as colors from '@atlaskit/theme/colors';
@@ -0,0 +1,21 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import React from 'react';
3
+ import { IntlProvider, intlShape } from 'react-intl';
4
+ export class IntlLegacyFallbackProvider extends React.Component {
5
+ render() {
6
+ const oldIntl = this.context.intl;
7
+
8
+ if (!oldIntl) {
9
+ return /*#__PURE__*/React.createElement(IntlProvider, {
10
+ locale: "en"
11
+ }, this.props.children);
12
+ }
13
+
14
+ return this.props.children;
15
+ }
16
+
17
+ }
18
+
19
+ _defineProperty(IntlLegacyFallbackProvider, "contextTypes", {
20
+ intl: intlShape
21
+ });
@@ -0,0 +1,43 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import React from 'react';
3
+ import { IntlProvider } from 'react-intl-next';
4
+ export const REACT_INTL_ERROR_MESSAGE = '<IntlProvider> needs to exist in the component ancestry';
5
+
6
+ const isMissingIntlProviderInAncestryError = err => {
7
+ var _err$toString;
8
+
9
+ return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
10
+ };
11
+
12
+ export class IntlNextErrorBoundary extends React.Component {
13
+ constructor(...args) {
14
+ super(...args);
15
+
16
+ _defineProperty(this, "state", {
17
+ missingIntlProviderInAncestry: false
18
+ });
19
+ }
20
+
21
+ componentDidCatch(error, errorInfo) {
22
+ // if missing IntlProvider in ancestry, we setup a fallback IntlProvider ourselves
23
+ if (isMissingIntlProviderInAncestryError(error)) {
24
+ this.setState({
25
+ missingIntlProviderInAncestry: true
26
+ });
27
+ } else {
28
+ // else we re-propagate the non-react-intl-next error
29
+ throw error;
30
+ }
31
+ }
32
+
33
+ render() {
34
+ if (this.state.missingIntlProviderInAncestry) {
35
+ return /*#__PURE__*/React.createElement(IntlProvider, {
36
+ locale: "en"
37
+ }, this.props.children);
38
+ }
39
+
40
+ return this.props.children;
41
+ }
42
+
43
+ }
@@ -0,0 +1,24 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import React from 'react';
3
+ import { intlShape } from 'react-intl';
4
+ import { createIntl, RawIntlProvider } from 'react-intl-next';
5
+ export class LegacyToNextIntlProvider extends React.Component {
6
+ render() {
7
+ const oldIntl = this.context.intl;
8
+
9
+ if (oldIntl) {
10
+ const nextIntl = createIntl({ ...oldIntl
11
+ });
12
+ return /*#__PURE__*/React.createElement(RawIntlProvider, {
13
+ value: nextIntl
14
+ }, this.props.children);
15
+ }
16
+
17
+ return this.props.children;
18
+ }
19
+
20
+ }
21
+
22
+ _defineProperty(LegacyToNextIntlProvider, "contextTypes", {
23
+ intl: intlShape
24
+ });
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useRef } from 'react';
2
- import { injectIntl } from 'react-intl';
2
+ import { injectIntl } from 'react-intl-next';
3
3
  import styled from 'styled-components';
4
4
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
5
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useRef } from 'react';
2
- import { injectIntl } from 'react-intl';
2
+ import { injectIntl } from 'react-intl-next';
3
3
  import styled from 'styled-components';
4
4
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
5
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
@@ -20,4 +20,7 @@ export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
20
20
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
21
21
  export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, ExpandLayoutWrapper } from './Expand';
22
22
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
23
- export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
23
+ export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
24
+ export { IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlNextErrorBoundary';
25
+ export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
26
+ export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
@@ -70,9 +70,8 @@ export const timestampToTaskContext = (timestamp, intl) => {
70
70
  const sameYear = givenDate.getUTCFullYear() === curDate.getUTCFullYear();
71
71
 
72
72
  if (intl && [-1, 0, 1].indexOf(distance) > -1) {
73
- return capitalizeFirstLetter(intl.formatRelative(givenDate, {
74
- units: 'day',
75
- now: Number(todayTimestampInUTC())
73
+ return capitalizeFirstLetter(intl.formatRelativeTime(distance, 'day', {
74
+ numeric: 'auto'
76
75
  }));
77
76
  }
78
77
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "61.0.1",
3
+ "version": "62.0.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -19,7 +19,7 @@ StatusSharedCssClassName, smartCardSharedStyles, SmartCardSharedCssClassName } f
19
19
 
20
20
  export { BaseTheme, Caption, ClearNextSiblingMarginTop, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, Emoji, //exported from ./src/emoji.ts
21
21
  ErrorMessage, ExpandIconWrapper, ExpandLayoutWrapper, HelperMessage, MediaSingle, MediaSingleDimensionHelper, Mention, //exported from ./src/mention.ts
22
- Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth } from './ui'; // new child entry point ./ui/index.tsx
22
+ Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth, IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE, IntlLegacyFallbackProvider, LegacyToNextIntlProvider } from './ui'; // new child entry point ./ui/index.tsx
23
23
 
24
24
  // already exported by ./messages/index.ts
25
25
  export { linkMessages } from './messages/link'; // new child entry point in ./utils/index.ts
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export var codeBidiWarningMessages = defineMessages({
3
3
  /**
4
4
  * Message taken from
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export var linkMessages = defineMessages({
3
3
  openLink: {
4
4
  id: 'fabric.editor.openLink',
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export var unsupportedContentMessages = defineMessages({
3
3
  unsupportedInlineContent: {
4
4
  id: 'fabric.editor.unsupportedInlineContent',
@@ -13,7 +13,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
13
13
  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; } }
14
14
 
15
15
  import React from 'react';
16
- import { injectIntl } from 'react-intl';
16
+ import { injectIntl } from 'react-intl-next';
17
17
  import styled from 'styled-components';
18
18
  import { N200, N400 } from '@atlaskit/theme/colors';
19
19
  import { messages } from './messages';
@@ -1,4 +1,4 @@
1
- import { defineMessages } from 'react-intl';
1
+ import { defineMessages } from 'react-intl-next';
2
2
  export var messages = defineMessages({
3
3
  placeholder: {
4
4
  id: 'fabric.editor.captionPlaceholder',
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
4
4
 
5
- import { defineMessages } from 'react-intl';
5
+ import { defineMessages } from 'react-intl-next';
6
6
  import styled, { css } from 'styled-components';
7
7
  import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
8
8
  import * as colors from '@atlaskit/theme/colors';
@@ -0,0 +1,45 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+
8
+ 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); }; }
9
+
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
+
12
+ import React from 'react';
13
+ import { IntlProvider, intlShape } from 'react-intl';
14
+ export var IntlLegacyFallbackProvider = /*#__PURE__*/function (_React$Component) {
15
+ _inherits(IntlLegacyFallbackProvider, _React$Component);
16
+
17
+ var _super = _createSuper(IntlLegacyFallbackProvider);
18
+
19
+ function IntlLegacyFallbackProvider() {
20
+ _classCallCheck(this, IntlLegacyFallbackProvider);
21
+
22
+ return _super.apply(this, arguments);
23
+ }
24
+
25
+ _createClass(IntlLegacyFallbackProvider, [{
26
+ key: "render",
27
+ value: function render() {
28
+ var oldIntl = this.context.intl;
29
+
30
+ if (!oldIntl) {
31
+ return /*#__PURE__*/React.createElement(IntlProvider, {
32
+ locale: "en"
33
+ }, this.props.children);
34
+ }
35
+
36
+ return this.props.children;
37
+ }
38
+ }]);
39
+
40
+ return IntlLegacyFallbackProvider;
41
+ }(React.Component);
42
+
43
+ _defineProperty(IntlLegacyFallbackProvider, "contextTypes", {
44
+ intl: intlShape
45
+ });
@@ -0,0 +1,73 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+
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
+
11
+ 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; } }
12
+
13
+ import React from 'react';
14
+ import { IntlProvider } from 'react-intl-next';
15
+ export var REACT_INTL_ERROR_MESSAGE = '<IntlProvider> needs to exist in the component ancestry';
16
+
17
+ var isMissingIntlProviderInAncestryError = function isMissingIntlProviderInAncestryError(err) {
18
+ var _err$toString;
19
+
20
+ return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
21
+ };
22
+
23
+ export var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
24
+ _inherits(IntlNextErrorBoundary, _React$Component);
25
+
26
+ var _super = _createSuper(IntlNextErrorBoundary);
27
+
28
+ function IntlNextErrorBoundary() {
29
+ var _this;
30
+
31
+ _classCallCheck(this, IntlNextErrorBoundary);
32
+
33
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
+ args[_key] = arguments[_key];
35
+ }
36
+
37
+ _this = _super.call.apply(_super, [this].concat(args));
38
+
39
+ _defineProperty(_assertThisInitialized(_this), "state", {
40
+ missingIntlProviderInAncestry: false
41
+ });
42
+
43
+ return _this;
44
+ }
45
+
46
+ _createClass(IntlNextErrorBoundary, [{
47
+ key: "componentDidCatch",
48
+ value: function componentDidCatch(error, errorInfo) {
49
+ // if missing IntlProvider in ancestry, we setup a fallback IntlProvider ourselves
50
+ if (isMissingIntlProviderInAncestryError(error)) {
51
+ this.setState({
52
+ missingIntlProviderInAncestry: true
53
+ });
54
+ } else {
55
+ // else we re-propagate the non-react-intl-next error
56
+ throw error;
57
+ }
58
+ }
59
+ }, {
60
+ key: "render",
61
+ value: function render() {
62
+ if (this.state.missingIntlProviderInAncestry) {
63
+ return /*#__PURE__*/React.createElement(IntlProvider, {
64
+ locale: "en"
65
+ }, this.props.children);
66
+ }
67
+
68
+ return this.props.children;
69
+ }
70
+ }]);
71
+
72
+ return IntlNextErrorBoundary;
73
+ }(React.Component);
@@ -0,0 +1,51 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
+
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
+
12
+ 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); }; }
13
+
14
+ 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; } }
15
+
16
+ import React from 'react';
17
+ import { intlShape } from 'react-intl';
18
+ import { createIntl, RawIntlProvider } from 'react-intl-next';
19
+ export var LegacyToNextIntlProvider = /*#__PURE__*/function (_React$Component) {
20
+ _inherits(LegacyToNextIntlProvider, _React$Component);
21
+
22
+ var _super = _createSuper(LegacyToNextIntlProvider);
23
+
24
+ function LegacyToNextIntlProvider() {
25
+ _classCallCheck(this, LegacyToNextIntlProvider);
26
+
27
+ return _super.apply(this, arguments);
28
+ }
29
+
30
+ _createClass(LegacyToNextIntlProvider, [{
31
+ key: "render",
32
+ value: function render() {
33
+ var oldIntl = this.context.intl;
34
+
35
+ if (oldIntl) {
36
+ var nextIntl = createIntl(_objectSpread({}, oldIntl));
37
+ return /*#__PURE__*/React.createElement(RawIntlProvider, {
38
+ value: nextIntl
39
+ }, this.props.children);
40
+ }
41
+
42
+ return this.props.children;
43
+ }
44
+ }]);
45
+
46
+ return LegacyToNextIntlProvider;
47
+ }(React.Component);
48
+
49
+ _defineProperty(LegacyToNextIntlProvider, "contextTypes", {
50
+ intl: intlShape
51
+ });
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject;
4
4
 
5
5
  import React, { useCallback, useRef } from 'react';
6
- import { injectIntl } from 'react-intl';
6
+ import { injectIntl } from 'react-intl-next';
7
7
  import styled from 'styled-components';
8
8
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
9
9
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject;
4
4
 
5
5
  import React, { useCallback, useRef } from 'react';
6
- import { injectIntl } from 'react-intl';
6
+ import { injectIntl } from 'react-intl-next';
7
7
  import styled from 'styled-components';
8
8
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
9
9
  import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
@@ -20,4 +20,7 @@ export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
20
20
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
21
21
  export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, ExpandLayoutWrapper } from './Expand';
22
22
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
23
- export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
23
+ export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
24
+ export { IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlNextErrorBoundary';
25
+ export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
26
+ export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
@@ -70,9 +70,8 @@ export var timestampToTaskContext = function timestampToTaskContext(timestamp, i
70
70
  var sameYear = givenDate.getUTCFullYear() === curDate.getUTCFullYear();
71
71
 
72
72
  if (intl && [-1, 0, 1].indexOf(distance) > -1) {
73
- return capitalizeFirstLetter(intl.formatRelative(givenDate, {
74
- units: 'day',
75
- now: Number(todayTimestampInUTC())
73
+ return capitalizeFirstLetter(intl.formatRelativeTime(distance, 'day', {
74
+ numeric: 'auto'
76
75
  }));
77
76
  }
78
77
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "61.0.1",
3
+ "version": "62.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ADFEntity } from '@atlaskit/adf-utils';
2
3
  import { Parameters } from './extension-parameters';
3
4
  export interface ExtensionParams<T extends Parameters> {
@@ -15,7 +15,7 @@ EmojiSharedCssClassName, //exported from ./src/emoji.ts
15
15
  StatusSharedCssClassName, smartCardSharedStyles, SmartCardSharedCssClassName, } from './styles';
16
16
  export { BaseTheme, Caption, ClearNextSiblingMarginTop, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, Emoji, //exported from ./src/emoji.ts
17
17
  ErrorMessage, ExpandIconWrapper, ExpandLayoutWrapper, HelperMessage, MediaSingle, MediaSingleDimensionHelper, Mention, //exported from ./src/mention.ts
18
- Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth, } from './ui';
18
+ Popup, UnsupportedBlock, UnsupportedInline, ValidMessage, WidthConsumer, WidthProvider, WithCreateAnalyticsEvent, calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, calcPxFromPct, expandMessages, findOverflowScrollParent, getBreakpoint, layoutSupportsWidth, mapBreakpointToLayoutMaxWidth, overflowShadow, shadowClassNames, sharedExpandStyles, snapToGrid, withOuterListeners, MediaLink, wrappedLayouts, shouldAddDefaultWrappedWidth, IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE, IntlLegacyFallbackProvider, LegacyToNextIntlProvider, } from './ui';
19
19
  export type { CardEventClickHandler, CardSurroundings, EmojiProps, EventHandlers, LinkEventClickHandler, MediaSingleDimensionHelperProps, MediaSingleProps, MentionEventHandler, MentionEventHandlers, OverflowShadowOptions, OverflowShadowProps, OverflowShadowState, PopupPosition, PopupProps, SmartCardEventClickHandler, WidthConsumerContext, ExpandStyleProps, } from './ui';
20
20
  export { linkMessages } from './messages/link';
21
21
  export { validateADFEntity, validationErrorHandler, } from './utils/validate-using-spec';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InjectedIntlProps } from 'react-intl';
2
+ import { WrappedComponentProps } from 'react-intl-next';
3
3
  declare type Props = {
4
4
  selected?: boolean;
5
5
  hasContent?: boolean;
@@ -8,10 +8,10 @@ declare type Props = {
8
8
  'data-renderer-start-pos': number;
9
9
  };
10
10
  };
11
- export declare class CaptionComponent extends React.Component<Props & InjectedIntlProps> {
11
+ export declare class CaptionComponent extends React.Component<Props & WrappedComponentProps> {
12
12
  render(): JSX.Element;
13
13
  }
14
- declare const _default: React.ComponentClass<Props, any> & {
15
- WrappedComponent: ReactIntl.ComponentConstructor<Props & InjectedIntlProps>;
14
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
15
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
16
16
  };
17
17
  export default _default;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react-intl" />
2
+ import React from 'react';
3
+ export declare class IntlLegacyFallbackProvider extends React.Component {
4
+ static contextTypes: {
5
+ intl: ReactIntl.IntlShape;
6
+ };
7
+ render(): {} | null | undefined;
8
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface ErrorBoundaryProps {
3
+ }
4
+ interface ErrorBoundaryState {
5
+ missingIntlProviderInAncestry: boolean;
6
+ }
7
+ export declare const REACT_INTL_ERROR_MESSAGE = "<IntlProvider> needs to exist in the component ancestry";
8
+ export declare class IntlNextErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
9
+ state: {
10
+ missingIntlProviderInAncestry: boolean;
11
+ };
12
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
13
+ render(): {} | null | undefined;
14
+ }
15
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react-intl" />
2
+ import React from 'react';
3
+ export declare class LegacyToNextIntlProvider extends React.Component {
4
+ static contextTypes: {
5
+ intl: ReactIntl.IntlShape;
6
+ };
7
+ render(): {} | null | undefined;
8
+ }
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
- import { InjectedIntlProps } from 'react-intl';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
4
  import { UnsupportedContentTooltipPayload } from '../../utils';
5
5
  export interface Props {
6
6
  node?: PMNode;
7
7
  children?: React.ReactNode;
8
8
  dispatchAnalyticsEvent?: (payload: UnsupportedContentTooltipPayload) => void;
9
9
  }
10
- declare const _default: React.ComponentClass<Props, any> & {
11
- WrappedComponent: ReactIntl.ComponentConstructor<Props & InjectedIntlProps>;
10
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
11
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
12
12
  };
13
13
  export default _default;
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
- import { InjectedIntlProps } from 'react-intl';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
4
  import { UnsupportedContentTooltipPayload } from '../../utils';
5
5
  export interface Props {
6
6
  node?: PMNode;
7
7
  children?: React.ReactNode;
8
8
  dispatchAnalyticsEvent?: (payload: UnsupportedContentTooltipPayload) => void;
9
9
  }
10
- declare const _default: React.ComponentClass<Props, any> & {
11
- WrappedComponent: ReactIntl.ComponentConstructor<Props & InjectedIntlProps>;
10
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
11
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
12
12
  };
13
13
  export default _default;
@@ -24,3 +24,6 @@ export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, Expa
24
24
  export type { StyleProps as ExpandStyleProps } from './Expand';
25
25
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
26
26
  export { ClearNextSiblingMarginTop } from './clear-next-sibling-margin-top';
27
+ export { IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE, } from './IntlNextErrorBoundary';
28
+ export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
29
+ export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
@@ -1,3 +1,3 @@
1
1
  import { Node as PMNode } from 'prosemirror-model';
2
- import { InjectedIntl } from 'react-intl';
3
- export declare function getUnsupportedContent(message: any, prefix: string, node?: PMNode, intl?: InjectedIntl): any;
2
+ import { IntlShape } from 'react-intl-next';
3
+ export declare function getUnsupportedContent(message: any, prefix: string, node?: PMNode, intl?: IntlShape): any;
@@ -1,4 +1,4 @@
1
- import { InjectedIntl } from 'react-intl';
1
+ import { IntlShape } from 'react-intl-next';
2
2
  declare enum FORMATS {
3
3
  ISO_FORMAT = "YYYY-MM-DD",
4
4
  CURRENT_YEAR_FORMAT_WITHOUT_YEAR = "CURRENT_YEAR_FORMAT_WITHOUT_YEAR",
@@ -11,8 +11,8 @@ export interface Date {
11
11
  }
12
12
  export declare const timestampToUTCDate: (timestamp: string | number) => Date;
13
13
  export declare const todayTimestampInUTC: () => string;
14
- export declare const timestampToString: (timestamp: string | number, intl: InjectedIntl | null, pattern?: FORMATS | undefined) => string;
14
+ export declare const timestampToString: (timestamp: string | number, intl: IntlShape | null, pattern?: FORMATS | undefined) => string;
15
15
  export declare const timestampToIsoFormat: (timestamp: string | number) => string;
16
16
  export declare const isPastDate: (timestamp: string | number) => boolean;
17
- export declare const timestampToTaskContext: (timestamp: string | number, intl: InjectedIntl) => string;
17
+ export declare const timestampToTaskContext: (timestamp: string | number, intl: IntlShape) => string;
18
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "61.0.1",
3
+ "version": "62.0.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,20 +49,20 @@
49
49
  "@atlaskit/code": "^14.3.0",
50
50
  "@atlaskit/editor-json-transformer": "^8.7.0",
51
51
  "@atlaskit/editor-shared-styles": "^1.6.0",
52
- "@atlaskit/emoji": "^63.1.0",
52
+ "@atlaskit/emoji": "^64.0.0",
53
53
  "@atlaskit/icon": "^21.9.0",
54
54
  "@atlaskit/in-product-testing": "^0.1.0",
55
- "@atlaskit/media-card": "^72.1.0",
55
+ "@atlaskit/media-card": "^73.0.0",
56
56
  "@atlaskit/media-client": "^14.3.0",
57
- "@atlaskit/media-picker": "^58.1.0",
57
+ "@atlaskit/media-picker": "^59.0.0",
58
58
  "@atlaskit/mention": "^19.7.0",
59
- "@atlaskit/profilecard": "^15.8.0",
60
- "@atlaskit/smart-card": "^16.3.0",
59
+ "@atlaskit/profilecard": "^16.0.0",
60
+ "@atlaskit/smart-card": "^17.0.0",
61
61
  "@atlaskit/task-decision": "^17.2.0",
62
62
  "@atlaskit/theme": "^12.0.0",
63
63
  "@atlaskit/tooltip": "^17.5.0",
64
64
  "@atlaskit/ufo": "^0.0.6",
65
- "@atlaskit/user-picker": "^7.3.0",
65
+ "@atlaskit/user-picker": "^8.0.0",
66
66
  "@atlaskit/width-detector": "^3.0.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@types/prosemirror-model": "^1.11.0",
@@ -85,11 +85,12 @@
85
85
  "react": "^16.8.0",
86
86
  "react-dom": "^16.8.0",
87
87
  "react-intl": "^2.6.0",
88
+ "react-intl-next": "npm:react-intl@^5.18.1",
88
89
  "styled-components": "^3.2.6"
89
90
  },
90
91
  "devDependencies": {
91
92
  "@atlaskit/editor-json-transformer": "^8.7.0",
92
- "@atlaskit/editor-test-helpers": "^15.6.0",
93
+ "@atlaskit/editor-test-helpers": "^16.0.0",
93
94
  "@atlaskit/media-core": "^32.2.0",
94
95
  "@atlaskit/util-data-test": "^17.0.0",
95
96
  "@atlaskit/visual-regression": "*",