@atlaskit/media-card 74.3.2 → 74.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/card/card.js +27 -18
  3. package/dist/cjs/card/cardAnalytics.js +16 -5
  4. package/dist/cjs/card/cardImageView/cardOverlay/index.js +1 -3
  5. package/dist/cjs/card/cardImageView/cardOverlay/styles.js +6 -8
  6. package/dist/cjs/card/cardImageView/fileCardImageView.js +1 -3
  7. package/dist/cjs/card/cardImageView/styles.js +7 -9
  8. package/dist/cjs/card/cardLoader.js +12 -3
  9. package/dist/cjs/card/cardState.js +11 -13
  10. package/dist/cjs/card/media-card-analytics-error-boundary.js +129 -0
  11. package/dist/cjs/card/styles/index.js +1 -3
  12. package/dist/cjs/card/ui/blanket/styles.js +1 -3
  13. package/dist/cjs/card/ui/iconMessage/styles.js +1 -3
  14. package/dist/cjs/card/ui/loadingRateLimited/styles.js +1 -3
  15. package/dist/cjs/card/ui/newFileExperience/newFileExperienceWrapper.js +5 -1
  16. package/dist/cjs/card/ui/newFileExperience/styles.js +12 -4
  17. package/dist/cjs/card/ui/playButton/styles.js +2 -4
  18. package/dist/cjs/card/ui/styles.js +1 -3
  19. package/dist/cjs/card/ui/tickBox/styles.js +2 -4
  20. package/dist/cjs/card/ui/titleBox/failedTitleBox.js +1 -3
  21. package/dist/cjs/card/ui/titleBox/styles.js +19 -5
  22. package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +5 -1
  23. package/dist/cjs/card/ui/unhandledErrorCard/index.js +112 -0
  24. package/dist/cjs/card/ui/unhandledErrorCard/types.js +5 -0
  25. package/dist/cjs/errors.js +12 -3
  26. package/dist/cjs/inline/loader.js +4 -4
  27. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +113 -0
  28. package/dist/cjs/utils/analytics.js +41 -10
  29. package/dist/cjs/utils/cardActions/styles.js +2 -4
  30. package/dist/cjs/utils/errorIcon/styles.js +1 -3
  31. package/dist/cjs/utils/lightCards/styles.js +4 -6
  32. package/dist/cjs/utils/ufoExperiences.js +1 -1
  33. package/dist/cjs/version.json +1 -1
  34. package/dist/es2019/card/card.js +29 -17
  35. package/dist/es2019/card/cardAnalytics.js +9 -5
  36. package/dist/es2019/card/cardImageView/cardOverlay/index.js +1 -2
  37. package/dist/es2019/card/cardImageView/cardOverlay/styles.js +20 -21
  38. package/dist/es2019/card/cardImageView/fileCardImageView.js +1 -2
  39. package/dist/es2019/card/cardImageView/styles.js +7 -8
  40. package/dist/es2019/card/cardLoader.js +12 -3
  41. package/dist/es2019/card/cardState.js +12 -7
  42. package/dist/es2019/card/media-card-analytics-error-boundary.js +90 -0
  43. package/dist/es2019/card/styles/index.js +1 -2
  44. package/dist/es2019/card/ui/blanket/styles.js +1 -2
  45. package/dist/es2019/card/ui/iconMessage/styles.js +1 -2
  46. package/dist/es2019/card/ui/loadingRateLimited/styles.js +1 -2
  47. package/dist/es2019/card/ui/newFileExperience/newFileExperienceWrapper.js +4 -1
  48. package/dist/es2019/card/ui/newFileExperience/styles.js +10 -3
  49. package/dist/es2019/card/ui/playButton/styles.js +2 -3
  50. package/dist/es2019/card/ui/styles.js +1 -2
  51. package/dist/es2019/card/ui/tickBox/styles.js +4 -5
  52. package/dist/es2019/card/ui/titleBox/failedTitleBox.js +1 -2
  53. package/dist/es2019/card/ui/titleBox/styles.js +20 -7
  54. package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +4 -1
  55. package/dist/es2019/card/ui/unhandledErrorCard/index.js +79 -0
  56. package/dist/es2019/card/ui/unhandledErrorCard/types.js +1 -0
  57. package/dist/es2019/errors.js +13 -2
  58. package/dist/es2019/inline/loader.js +4 -4
  59. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +75 -0
  60. package/dist/es2019/utils/analytics.js +32 -9
  61. package/dist/es2019/utils/cardActions/styles.js +4 -5
  62. package/dist/es2019/utils/errorIcon/styles.js +1 -2
  63. package/dist/es2019/utils/lightCards/styles.js +4 -5
  64. package/dist/es2019/utils/ufoExperiences.js +1 -1
  65. package/dist/es2019/version.json +1 -1
  66. package/dist/esm/card/card.js +28 -19
  67. package/dist/esm/card/cardAnalytics.js +12 -4
  68. package/dist/esm/card/cardImageView/cardOverlay/index.js +1 -2
  69. package/dist/esm/card/cardImageView/cardOverlay/styles.js +6 -7
  70. package/dist/esm/card/cardImageView/fileCardImageView.js +1 -2
  71. package/dist/esm/card/cardImageView/styles.js +7 -8
  72. package/dist/esm/card/cardLoader.js +12 -3
  73. package/dist/esm/card/cardState.js +12 -11
  74. package/dist/esm/card/media-card-analytics-error-boundary.js +115 -0
  75. package/dist/esm/card/styles/index.js +1 -2
  76. package/dist/esm/card/ui/blanket/styles.js +1 -2
  77. package/dist/esm/card/ui/iconMessage/styles.js +1 -2
  78. package/dist/esm/card/ui/loadingRateLimited/styles.js +1 -2
  79. package/dist/esm/card/ui/newFileExperience/newFileExperienceWrapper.js +4 -1
  80. package/dist/esm/card/ui/newFileExperience/styles.js +10 -3
  81. package/dist/esm/card/ui/playButton/styles.js +2 -3
  82. package/dist/esm/card/ui/styles.js +1 -2
  83. package/dist/esm/card/ui/tickBox/styles.js +2 -3
  84. package/dist/esm/card/ui/titleBox/failedTitleBox.js +1 -2
  85. package/dist/esm/card/ui/titleBox/styles.js +19 -5
  86. package/dist/esm/card/ui/titleBox/titleBoxComponents.js +4 -1
  87. package/dist/esm/card/ui/unhandledErrorCard/index.js +93 -0
  88. package/dist/esm/card/ui/unhandledErrorCard/types.js +1 -0
  89. package/dist/esm/errors.js +12 -3
  90. package/dist/esm/inline/loader.js +5 -5
  91. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +99 -0
  92. package/dist/esm/utils/analytics.js +34 -9
  93. package/dist/esm/utils/cardActions/styles.js +2 -3
  94. package/dist/esm/utils/errorIcon/styles.js +1 -2
  95. package/dist/esm/utils/lightCards/styles.js +4 -5
  96. package/dist/esm/utils/ufoExperiences.js +1 -1
  97. package/dist/esm/version.json +1 -1
  98. package/dist/types/card/card.d.ts +1 -1
  99. package/dist/types/card/cardAnalytics.d.ts +2 -1
  100. package/dist/types/card/cardState.d.ts +6 -1
  101. package/dist/types/card/getCardPreview/index.d.ts +1 -1
  102. package/dist/types/card/media-card-analytics-error-boundary.d.ts +14 -0
  103. package/dist/types/card/ui/newFileExperience/styles.d.ts +1 -1
  104. package/dist/types/card/ui/newFileExperience/types.d.ts +2 -0
  105. package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
  106. package/dist/types/card/ui/titleBox/types.d.ts +2 -0
  107. package/dist/types/card/ui/unhandledErrorCard/index.d.ts +7 -0
  108. package/dist/types/card/ui/unhandledErrorCard/types.d.ts +6 -0
  109. package/dist/types/errors.d.ts +2 -2
  110. package/dist/types/inline/mediaInlineAnalyticsErrorBoundary.d.ts +11 -0
  111. package/dist/types/types.d.ts +3 -0
  112. package/dist/types/utils/analytics.d.ts +26 -6
  113. package/example-helpers/styles.ts +13 -0
  114. package/package.json +9 -8
  115. package/report.api.md +18 -2
  116. package/dist/cjs/utils/media-card-analytics-error-boundary.js +0 -59
  117. package/dist/es2019/utils/media-card-analytics-error-boundary.js +0 -19
  118. package/dist/esm/utils/media-card-analytics-error-boundary.js +0 -46
  119. package/dist/types/utils/media-card-analytics-error-boundary.d.ts +0 -10
@@ -0,0 +1,115 @@
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+
13
+ 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); }; }
14
+
15
+ 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; } }
16
+
17
+ import React from 'react';
18
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
19
+ import { UnhandledErrorCard } from './ui/unhandledErrorCard';
20
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
21
+ import { fireMediaCardEvent } from '../utils/analytics';
22
+
23
+ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Component) {
24
+ _inherits(WrappedMediaCardAnalyticsErrorBoundary, _React$Component);
25
+
26
+ var _super = _createSuper(WrappedMediaCardAnalyticsErrorBoundary);
27
+
28
+ function WrappedMediaCardAnalyticsErrorBoundary(props) {
29
+ var _this;
30
+
31
+ _classCallCheck(this, WrappedMediaCardAnalyticsErrorBoundary);
32
+
33
+ _this = _super.call(this, props);
34
+
35
+ _defineProperty(_assertThisInitialized(_this), "fireOperationalEvent", function (error, info) {
36
+ var _window, _window$navigator;
37
+
38
+ var _this$props = _this.props,
39
+ _this$props$data = _this$props.data,
40
+ data = _this$props$data === void 0 ? {} : _this$props$data,
41
+ createAnalyticsEvent = _this$props.createAnalyticsEvent;
42
+ var payload = {
43
+ eventType: 'operational',
44
+ action: 'failed',
45
+ actionSubject: 'mediaCardRender',
46
+ attributes: _objectSpread({
47
+ browserInfo: (_window = window) !== null && _window !== void 0 && (_window$navigator = _window.navigator) !== null && _window$navigator !== void 0 && _window$navigator.userAgent ? window.navigator.userAgent : 'unknown',
48
+ error: error,
49
+ info: info,
50
+ failReason: 'unexpected-error'
51
+ }, data)
52
+ };
53
+ fireMediaCardEvent(payload, createAnalyticsEvent);
54
+ });
55
+
56
+ _defineProperty(_assertThisInitialized(_this), "handleOnClick", function (event) {
57
+ try {
58
+ var _this$props$onClick, _this$props2;
59
+
60
+ (_this$props$onClick = (_this$props2 = _this.props).onClick) === null || _this$props$onClick === void 0 ? void 0 : _this$props$onClick.call(_this$props2, {
61
+ event: event
62
+ });
63
+ } catch (e) {}
64
+ });
65
+
66
+ _this.state = {
67
+ hasError: false
68
+ };
69
+ return _this;
70
+ }
71
+
72
+ _createClass(WrappedMediaCardAnalyticsErrorBoundary, [{
73
+ key: "componentDidCatch",
74
+ value: function componentDidCatch(error, info) {
75
+ try {
76
+ this.fireOperationalEvent(error, info);
77
+ } catch (e) {}
78
+
79
+ this.setState({
80
+ hasError: true
81
+ });
82
+ }
83
+ }, {
84
+ key: "render",
85
+ value: function render() {
86
+ var hasError = this.state.hasError;
87
+ var _this$props3 = this.props,
88
+ dimensions = _this$props3.dimensions,
89
+ children = _this$props3.children;
90
+
91
+ if (hasError) {
92
+ return /*#__PURE__*/React.createElement(UnhandledErrorCard, {
93
+ dimensions: dimensions,
94
+ onClick: this.handleOnClick
95
+ });
96
+ }
97
+
98
+ return children;
99
+ }
100
+ }]);
101
+
102
+ return WrappedMediaCardAnalyticsErrorBoundary;
103
+ }(React.Component);
104
+
105
+ _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
106
+
107
+ var packageName = "@atlaskit/media-card";
108
+ var packageVersion = "74.4.1";
109
+ var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
110
+ packageVersion: packageVersion,
111
+ packageName: packageName,
112
+ componentName: 'mediaCard',
113
+ component: 'mediaCard'
114
+ })(withAnalyticsEvents()(WrappedMediaCardAnalyticsErrorBoundary));
115
+ export default MediaCardAnalyticsErrorBoundary;
@@ -5,7 +5,6 @@ var _templateObject, _templateObject2;
5
5
  import { css } from '@emotion/react';
6
6
  import { fontFamily } from '@atlaskit/theme/constants';
7
7
  import { fadeIn } from '@atlaskit/media-ui';
8
- import { token } from '@atlaskit/tokens';
9
8
  export { defaultTransitionDuration } from './config';
10
9
  export { antialiased, borderRadiusLeft, capitalize, centerSelf, centerSelfX, centerSelfY, centerX, hexToRgb, rgba, spaceAround, transition, withAppearance } from './mixins';
11
10
  export { easeOutCubic, easeOutExpo } from './easing';
@@ -13,7 +12,7 @@ export { spin } from './animations';
13
12
  export var rootStyles = function rootStyles() {
14
13
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n font-family: ", ";\n\n * {\n box-sizing: border-box;\n }\n"])), fontFamily());
15
14
  };
16
- export var cardShadow = "\n box-shadow: ".concat(token('elevation.shadow.raised', '0 1px 1px rgba(9, 30, 66, 0.2), 0 0 1px 0 rgba(9, 30, 66, 0.24)'), ";\n");
15
+ export var cardShadow = "\n box-shadow: ".concat("var(--ds-shadow-raised, 0 1px 1px rgba(9, 30, 66, 0.2), 0 0 1px 0 rgba(9, 30, 66, 0.24))", ";\n");
17
16
  export var fadeinImageStyles = function fadeinImageStyles() {
18
17
  return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n"])), fadeIn);
19
18
  };
@@ -2,12 +2,11 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject;
4
4
 
5
- import { token } from '@atlaskit/tokens';
6
5
  import { css } from '@emotion/react';
7
6
  import { transition } from '../../styles';
8
7
  import { N90A } from '@atlaskit/theme/colors';
9
8
  export var blanketClassName = 'media-card-blanket';
10
- export var fixedBlanketStyles = "background-color: ".concat(token('color.blanket', N90A), ";");
9
+ export var fixedBlanketStyles = "background-color: ".concat("var(--ds-blanket, ".concat(N90A, ")"), ";");
11
10
  export var blanketStyles = function blanketStyles(isFixed) {
12
11
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n position: absolute;\n width: 100%;\n height: 100%;\n max-height: 100%;\n max-width: 100%;\n left: 0;\n top: 0;\n ", "\n"])), transition(), isFixed ? fixedBlanketStyles : '');
13
12
  };
@@ -2,7 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
4
 
5
- import { token } from '@atlaskit/tokens';
6
5
  import { css, keyframes } from '@emotion/react';
7
6
  import { N300 } from '@atlaskit/theme/colors';
8
7
  var breatheAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { opacity: 1}\n 50% { opacity: 0.3 }\n 100% { opacity: 1; }"])));
@@ -11,7 +10,7 @@ var animatedStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplate
11
10
  var getStylesBasedOnProps = function getStylesBasedOnProps(_ref) {
12
11
  var animated = _ref.animated,
13
12
  reducedFont = _ref.reducedFont;
14
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n opacity: 1;\n font-weight: 450;\n ", "\n color: ", ";\n text-align: center;\n ", "\n margin-bottom: -1em;\n padding: 3px 10px;\n"])), reducedFont ? 'font-size: 0.7em;' : '', token('color.text.subtlest', N300), animated ? animatedStyles : '');
13
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n opacity: 1;\n font-weight: 450;\n ", "\n color: ", ";\n text-align: center;\n ", "\n margin-bottom: -1em;\n padding: 3px 10px;\n"])), reducedFont ? 'font-size: 0.7em;' : '', "var(--ds-text-subtlest, ".concat(N300, ")"), animated ? animatedStyles : '');
15
14
  };
16
15
 
17
16
  export var iconMessageWrapperStyles = function iconMessageWrapperStyles(props) {
@@ -2,7 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
4
4
 
5
- import { token } from '@atlaskit/tokens';
6
5
  import { css } from '@emotion/react';
7
6
  import { generateResponsiveStyles } from '../progressBar/styles';
8
7
  import { N300 } from '@atlaskit/theme/colors';
@@ -11,7 +10,7 @@ export var warningIconWrapperStyles = css(_templateObject2 || (_templateObject2
11
10
  export var loadingRateLimitedTextWrapperStyles = function loadingRateLimitedTextWrapperStyles(_ref) {
12
11
  var breakpoint = _ref.breakpoint,
13
12
  positionBottom = _ref.positionBottom;
14
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: 10px;\n overflow: hidden;\n color: ", ";\n display: block;\n width: 100%;\n text-align: center;\n ", "\n"])), token('color.text.subtlest', N300), generateResponsiveStyles(breakpoint, positionBottom, false, 1));
13
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: 10px;\n overflow: hidden;\n color: ", ";\n display: block;\n width: 100%;\n text-align: center;\n ", "\n"])), "var(--ds-text-subtlest, ".concat(N300, ")"), generateResponsiveStyles(breakpoint, positionBottom, false, 1));
15
14
  };
16
15
  loadingRateLimitedTextWrapperStyles.displayName = 'LoadingRateLimitedTextWrapper';
17
16
  export var couldntLoadWrapperStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-weight: 550;\n"])));
@@ -2,6 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import { newFileExperienceClassName } from '../../cardConstants';
4
4
  import { newFileExperienceWrapperStyles } from './styles';
5
+ import { useGlobalTheme } from '@atlaskit/theme/components';
5
6
  export var NewFileExperienceWrapper = function NewFileExperienceWrapper(props) {
6
7
  var testId = props.testId,
7
8
  dimensions = props.dimensions,
@@ -17,6 +18,7 @@ export var NewFileExperienceWrapper = function NewFileExperienceWrapper(props) {
17
18
  isPlayButtonClickable = props.isPlayButtonClickable,
18
19
  isTickBoxSelectable = props.isTickBoxSelectable,
19
20
  shouldDisplayTooltip = props.shouldDisplayTooltip;
21
+ var theme = useGlobalTheme();
20
22
  return jsx("div", {
21
23
  id: "newFileExperienceWrapper",
22
24
  className: newFileExperienceClassName,
@@ -31,7 +33,8 @@ export var NewFileExperienceWrapper = function NewFileExperienceWrapper(props) {
31
33
  isPlayButtonClickable: isPlayButtonClickable,
32
34
  isTickBoxSelectable: isTickBoxSelectable,
33
35
  shouldDisplayTooltip: shouldDisplayTooltip,
34
- mediaCardCursor: mediaCardCursor
36
+ mediaCardCursor: mediaCardCursor,
37
+ theme: theme
35
38
  }),
36
39
  ref: innerRef,
37
40
  onClick: onClick,
@@ -6,12 +6,13 @@ import { css } from '@emotion/react';
6
6
  import { fontFamily } from '@atlaskit/theme/constants';
7
7
  import { borderRadius } from '@atlaskit/media-ui';
8
8
  import { N20 } from '@atlaskit/theme/colors';
9
- import { token } from '@atlaskit/tokens';
10
9
  import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
10
+ import { themed } from '@atlaskit/theme/components';
11
11
  import { transition } from '../../styles';
12
12
  import { fixedBlanketStyles, blanketClassName } from '../blanket/styles';
13
13
  import { fixedActionBarStyles, actionsBarClassName } from '../actionsBar/styles';
14
14
  import { generateResponsiveStyles, getClickablePlayButtonStyles, getCursorStyle, getSelectableTickBoxStyles, getWrapperDimensions, getWrapperShadow } from '../styles';
15
+ var BACKGROUND_COLOR_DARK = '#22272C';
15
16
  export var newFileExperienceWrapperStyles = function newFileExperienceWrapperStyles(_ref) {
16
17
  var breakpoint = _ref.breakpoint,
17
18
  dimensions = _ref.dimensions,
@@ -22,7 +23,13 @@ export var newFileExperienceWrapperStyles = function newFileExperienceWrapperSty
22
23
  isPlayButtonClickable = _ref.isPlayButtonClickable,
23
24
  isTickBoxSelectable = _ref.isTickBoxSelectable,
24
25
  shouldDisplayTooltip = _ref.shouldDisplayTooltip,
25
- mediaCardCursor = _ref.mediaCardCursor;
26
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n position: relative;\n font-family: ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n ", "\n }\n &:hover .", " {\n ", "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ", "\n"])), transition(), fontFamily(), getWrapperDimensions(dimensions, appearance), displayBackground && "background-color: ".concat(token('color.background.neutral', N20), ";"), borderRadius, getCursorStyle(mediaCardCursor), getWrapperShadow(disableOverlay, selected), generateResponsiveStyles(breakpoint), hideNativeBrowserTextSelectionStyles, getClickablePlayButtonStyles(isPlayButtonClickable), getSelectableTickBoxStyles(isTickBoxSelectable), blanketClassName, fixedBlanketStyles, actionsBarClassName, fixedActionBarStyles, shouldDisplayTooltip && "> div { width: 100%; height: 100%; }");
26
+ mediaCardCursor = _ref.mediaCardCursor,
27
+ theme = _ref.theme;
28
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n position: relative;\n font-family: ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n ", "\n }\n &:hover .", " {\n ", "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ", "\n"])), transition(), fontFamily(), getWrapperDimensions(dimensions, appearance), displayBackground && "background: ".concat(themed({
29
+ light: "var(--ds-background-neutral, ".concat(N20, ")"),
30
+ dark: "var(--ds-background-neutral, ".concat(BACKGROUND_COLOR_DARK, ")")
31
+ })({
32
+ theme: theme
33
+ }), ";"), borderRadius, getCursorStyle(mediaCardCursor), getWrapperShadow(disableOverlay, selected), generateResponsiveStyles(breakpoint), hideNativeBrowserTextSelectionStyles, getClickablePlayButtonStyles(isPlayButtonClickable), getSelectableTickBoxStyles(isTickBoxSelectable), blanketClassName, fixedBlanketStyles, actionsBarClassName, fixedActionBarStyles, shouldDisplayTooltip && "> div { width: 100%; height: 100%; }");
27
34
  };
28
35
  newFileExperienceWrapperStyles.displayName = 'NewFileExperienceWrapper';
@@ -4,11 +4,10 @@ var _templateObject, _templateObject2;
4
4
 
5
5
  import { css } from '@emotion/react';
6
6
  import { N0, N90A } from '@atlaskit/theme/colors';
7
- import { token } from '@atlaskit/tokens';
8
7
  export var playButtonClassName = 'media-card-play-button';
9
8
  export var bkgClassName = 'play-icon-background';
10
9
  var discSize = 48;
11
10
  var discSizeHover = 56;
12
11
  export var fixedPlayButtonStyles = "\n .".concat(bkgClassName, " {\n width: ").concat(discSizeHover, "px;\n height: ").concat(discSizeHover, "px;\n }\n");
13
- export var playButtonWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n span {\n position: absolute;\n }\n"])), token('color.icon.inverse', N0));
14
- export var backgroundStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transition-property: width, height;\n transition-duration: 0.1s;\n position: absolute;\n width: ", "px;\n height: ", "px;\n background: ", ";\n border-radius: 100%;\n"])), discSize, discSize, token('color.background.neutral.bold', N90A));
12
+ export var playButtonWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ", ";\n span {\n position: absolute;\n }\n"])), "var(--ds-icon-inverse, ".concat(N0, ")"));
13
+ export var backgroundStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transition-property: width, height;\n transition-duration: 0.1s;\n position: absolute;\n width: ", "px;\n height: ", "px;\n background: ", ";\n border-radius: 100%;\n"])), discSize, discSize, "var(--ds-background-neutral-bold, ".concat(N90A, ")"));
@@ -6,7 +6,6 @@ var _templateObject;
6
6
  import { css } from '@emotion/react';
7
7
  import { borderRadius } from '@atlaskit/media-ui';
8
8
  import { N60A } from '@atlaskit/theme/colors';
9
- import { token } from '@atlaskit/tokens';
10
9
  import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
11
10
  import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
12
11
  import { getDefaultCardDimensions } from '../../utils/cardDimensions';
@@ -48,7 +47,7 @@ export var getWrapperDimensions = function getWrapperDimensions(dimensions, appe
48
47
  // CSS outline has no 'radius', therefore we can't achieve the same effect with it
49
48
 
50
49
  export var getWrapperShadow = function getWrapperShadow(disableOverlay, selected) {
51
- var withOverlayShadow = !disableOverlay ? "".concat(token('elevation.shadow.raised', "0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A))) : '';
50
+ var withOverlayShadow = !disableOverlay ? "".concat("var(--ds-shadow-raised, ".concat("0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A), ")")) : '';
52
51
  var selectedShadow = selected ? akEditorSelectedBoxShadow : '';
53
52
  var shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
54
53
  return shadow ? "box-shadow: ".concat(shadow, ";") : '';
@@ -5,11 +5,10 @@ var _templateObject;
5
5
  import { css } from '@emotion/react';
6
6
  import { transition } from '../../styles';
7
7
  import { B200, N0, N100 } from '@atlaskit/theme/colors';
8
- import { token } from '@atlaskit/tokens';
9
8
  export var tickBoxClassName = 'media-card-tickbox';
10
- export var tickboxFixedStyles = "\n background-color: ".concat(token('color.background.input', N0), ";\n color: ").concat(token('color.icon.subtle', N100), ";\n");
9
+ export var tickboxFixedStyles = "\n background-color: ".concat("var(--ds-background-input, ".concat(N0, ")"), ";\n color: ", "var(--ds-icon-subtle, ".concat(N100, ")"), ";\n");
11
10
  export var getSelectedStyles = function getSelectedStyles(selected) {
12
- return selected ? "background-color: ".concat(token('color.icon.information', B200), ";\n color: ").concat(token('color.icon.inverse', 'white'), ";") : "";
11
+ return selected ? "background-color: ".concat("var(--ds-icon-information, ".concat(B200, ")"), ";\n color: ", "var(--ds-icon-inverse, white)", ";") : "";
13
12
  };
14
13
  export var wrapperStyles = function wrapperStyles(selected) {
15
14
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n font-size: 14px;\n width: 14px;\n height: 14px;\n position: absolute;\n top: 7px;\n left: 7px;\n border-radius: 20px;\n color: transparent;\n /* Enforce dimensions and position of \"tick\" icon */\n span {\n display: block;\n svg {\n height: 14px;\n }\n }\n ", "\n"])), transition(), getSelectedStyles(selected));
@@ -3,7 +3,6 @@ import { FormattedMessage } from 'react-intl-next';
3
3
  import EditorWarningIcon from '@atlaskit/icon/glyph/editor/warning';
4
4
  import { messages } from '@atlaskit/media-ui';
5
5
  import { R300 } from '@atlaskit/theme/colors';
6
- import { token } from '@atlaskit/tokens';
7
6
  import { ErrorMessageWrapper, TitleBoxWrapper } from './titleBoxComponents';
8
7
  export var FailedTitleBox = function FailedTitleBox(_ref) {
9
8
  var breakpoint = _ref.breakpoint,
@@ -14,6 +13,6 @@ export var FailedTitleBox = function FailedTitleBox(_ref) {
14
13
  }, /*#__PURE__*/React.createElement(ErrorMessageWrapper, null, /*#__PURE__*/React.createElement(EditorWarningIcon, {
15
14
  label: 'Warning',
16
15
  size: 'small',
17
- primaryColor: token('color.text.danger', R300)
16
+ primaryColor: "var(--ds-text-danger, ".concat(R300, ")")
18
17
  }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, customMessage))));
19
18
  };
@@ -3,10 +3,10 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
4
4
 
5
5
  import { css } from '@emotion/react';
6
- import { token } from '@atlaskit/tokens';
7
6
  import { responsiveSettings, getTitleBoxHeight, Breakpoint } from '../common';
8
- import { N0 } from '@atlaskit/theme/colors';
7
+ import { N0, N800 } from '@atlaskit/theme/colors';
9
8
  import { rgba } from '../../styles/mixins';
9
+ import { themed } from '@atlaskit/theme/components';
10
10
 
11
11
  var generateResponsiveStyles = function generateResponsiveStyles() {
12
12
  var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Breakpoint.SMALL;
@@ -18,13 +18,27 @@ var generateResponsiveStyles = function generateResponsiveStyles() {
18
18
  };
19
19
 
20
20
  var HEX_REGEX = /^#[0-9A-F]{6}$/i;
21
+ var BACKGROUND_COLOR_DARK = '#161a1d';
22
+ var TEXT_COLOR_DARK = '#C7D1DB';
21
23
  export var titleBoxWrapperStyles = function titleBoxWrapperStyles(_ref) {
22
24
  var breakpoint = _ref.breakpoint,
23
- titleBoxBgColor = _ref.titleBoxBgColor;
24
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n bottom: 0;\n width: 100%;\n background-color: ", ";\n color: inherit;\n cursor: inherit;\n pointer-events: none;\n display: flex;\n flex-direction: column;\n justify-content: center;\n ", "\n"])), token('elevation.surface', rgba(titleBoxBgColor && HEX_REGEX.test(titleBoxBgColor) ? titleBoxBgColor : N0, 0.8)), generateResponsiveStyles(breakpoint));
25
+ titleBoxBgColor = _ref.titleBoxBgColor,
26
+ theme = _ref.theme;
27
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n bottom: 0;\n width: 100%;\n background-color: ", ";\n color: ", ";\n cursor: inherit;\n pointer-events: none;\n display: flex;\n flex-direction: column;\n justify-content: center;\n ", "\n"])), themed({
28
+ light: "var(--ds-surface, ".concat(rgba(titleBoxBgColor && HEX_REGEX.test(titleBoxBgColor) ? titleBoxBgColor : N0, 1), ")"),
29
+ dark: "var(--ds-surface, ".concat(rgba( // theme does not contain this color, use constant instead
30
+ titleBoxBgColor && HEX_REGEX.test(titleBoxBgColor) ? titleBoxBgColor : BACKGROUND_COLOR_DARK, 1), ")")
31
+ })({
32
+ theme: theme
33
+ }), themed({
34
+ light: "var(--ds-text, ".concat(N800, ")"),
35
+ dark: "var(--ds-text, ".concat(TEXT_COLOR_DARK, ")")
36
+ })({
37
+ theme: theme
38
+ }), generateResponsiveStyles(breakpoint));
25
39
  };
26
40
  titleBoxWrapperStyles.displayName = 'TitleBoxWrapper';
27
- var infoStyles = "white-space: nowrap;\n overflow: hidden;";
41
+ var infoStyles = "white-space: nowrap;overflow: hidden;";
28
42
  var iconOverlapStyles = "padding-right: 10px;";
29
43
  export var titleBoxHeaderStyles = function titleBoxHeaderStyles(_ref2) {
30
44
  var hasIconOverlap = _ref2.hasIconOverlap;
@@ -1,14 +1,17 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { errorMessageWrapperStyles, titleBoxFooterStyles, titleBoxHeaderStyles, titleBoxIconStyles, titleBoxWrapperStyles } from './styles';
4
+ import { useGlobalTheme } from '@atlaskit/theme/components';
4
5
  export var TitleBoxWrapper = function TitleBoxWrapper(props) {
5
6
  var breakpoint = props.breakpoint,
6
7
  titleBoxBgColor = props.titleBoxBgColor;
8
+ var theme = useGlobalTheme();
7
9
  return jsx("div", {
8
10
  id: "titleBoxWrapper",
9
11
  css: titleBoxWrapperStyles({
10
12
  breakpoint: breakpoint,
11
- titleBoxBgColor: titleBoxBgColor
13
+ titleBoxBgColor: titleBoxBgColor,
14
+ theme: theme
12
15
  })
13
16
  }, props.children);
14
17
  };
@@ -0,0 +1,93 @@
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 _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
7
+
8
+ var _templateObject;
9
+
10
+ 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); }; }
11
+
12
+ 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; } }
13
+
14
+ /** @jsx jsx */
15
+ import { Component } from 'react';
16
+ import { css, jsx } from '@emotion/react';
17
+ import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
18
+ import { N20, N800, Y500 } from '@atlaskit/theme/colors';
19
+ import { fontSize } from '@atlaskit/theme/constants';
20
+ import { center, borderRadius } from '@atlaskit/media-ui';
21
+ import { defaultImageCardDimensions } from '../../../utils';
22
+
23
+ var isPercentage = function isPercentage(value) {
24
+ return /^\d+(\.\d+)?%$/.test(value);
25
+ };
26
+
27
+ var shouldShowText = function shouldShowText(_ref) {
28
+ var width = _ref.width,
29
+ height = _ref.height;
30
+
31
+ if (isPercentage(width) || isPercentage(height)) {
32
+ return false;
33
+ }
34
+
35
+ return parseInt(width, 10) >= 240 && parseInt(height, 10) >= 90;
36
+ };
37
+
38
+ var normalizeDimension = function normalizeDimension(value, defaultValue) {
39
+ var sValue = value.toString();
40
+ return isPercentage(sValue) ? sValue : isNaN(parseInt(sValue, 10)) ? defaultValue + 'px' : parseInt(sValue, 10) + 'px';
41
+ };
42
+
43
+ var getConvertedDimension = function getConvertedDimension(dimensions) {
44
+ var _dimensions$width = dimensions.width,
45
+ width = _dimensions$width === void 0 ? defaultImageCardDimensions.width : _dimensions$width,
46
+ _dimensions$height = dimensions.height,
47
+ height = _dimensions$height === void 0 ? defaultImageCardDimensions.height : _dimensions$height;
48
+ return {
49
+ width: normalizeDimension(width, defaultImageCardDimensions.width),
50
+ height: normalizeDimension(height, defaultImageCardDimensions.height)
51
+ };
52
+ };
53
+
54
+ var wrapperStyles = function wrapperStyles() {
55
+ var dimensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultImageCardDimensions;
56
+
57
+ try {
58
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n ", ";\n background: ", ";\n color: ", ";\n max-height: 100%;\n max-width: 100%;\n ", ";\n display: flex;\n flex-direction: column;\n\n p {\n font-size: ", "px;\n text-align: center;\n display: ", ";\n }\n "])), center, borderRadius, "var(--ds-background-neutral, ".concat(N20, ")"), "var(--ds-text-subtle, ".concat(N800, ")"), getConvertedDimension(dimensions), fontSize(), shouldShowText(getConvertedDimension(dimensions)) ? 'block' : 'none');
59
+ } catch (e) {
60
+ return null;
61
+ }
62
+ };
63
+
64
+ export var UnhandledErrorCard = /*#__PURE__*/function (_Component) {
65
+ _inherits(UnhandledErrorCard, _Component);
66
+
67
+ var _super = _createSuper(UnhandledErrorCard);
68
+
69
+ function UnhandledErrorCard() {
70
+ _classCallCheck(this, UnhandledErrorCard);
71
+
72
+ return _super.apply(this, arguments);
73
+ }
74
+
75
+ _createClass(UnhandledErrorCard, [{
76
+ key: "render",
77
+ value: function render() {
78
+ var _this$props = this.props,
79
+ dimensions = _this$props.dimensions,
80
+ onClick = _this$props.onClick;
81
+ return jsx("div", {
82
+ css: wrapperStyles(dimensions),
83
+ onClick: onClick
84
+ }, jsx(WarningIcon, {
85
+ label: "Error",
86
+ primaryColor: "var(--ds-icon-warning, ".concat(Y500, ")"),
87
+ size: "medium"
88
+ }), jsx("p", null, "We couldn't load this content"));
89
+ }
90
+ }]);
91
+
92
+ return UnhandledErrorCard;
93
+ }(Component);
@@ -0,0 +1 @@
1
+ export {};
@@ -142,11 +142,20 @@ export var isUnsupportedLocalPreviewError = function isUnsupportedLocalPreviewEr
142
142
  };
143
143
  export function isImageLoadError(err) {
144
144
  return err instanceof ImageLoadError;
145
- } // In a try/catch statement, the error caught is the type of any.
145
+ } // In a try/catch statement, the error caught is the type of unknown.
146
146
  // We can use this helper to ensure that the error handled is the type of MediaCardError if unsure
147
+ // If updatePrimaryReason is true, if it's a MediaCardError already, it will update it's primary reason
147
148
 
148
- export var ensureMediaCardError = function ensureMediaCardError(primaryReason, error) {
149
- return isMediaCardError(error) ? error : new MediaCardError(primaryReason, error);
149
+ export var ensureMediaCardError = function ensureMediaCardError(primaryReason, error, updatePrimaryReason) {
150
+ if (isMediaCardError(error)) {
151
+ if (updatePrimaryReason && error.primaryReason !== primaryReason) {
152
+ return new MediaCardError(primaryReason, error.secondaryError);
153
+ }
154
+
155
+ return error;
156
+ }
157
+
158
+ return new MediaCardError(primaryReason, error);
150
159
  };
151
160
  export var isUploadError = function isUploadError(error) {
152
161
  return error && error.primaryReason === 'upload';
@@ -46,7 +46,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
46
46
  key: "componentDidMount",
47
47
  value: function () {
48
48
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
49
- var _yield$Promise$all, _yield$Promise$all2, mediaClient, cardModule, mediaCardErrorBoundaryModule;
49
+ var _yield$Promise$all, _yield$Promise$all2, mediaClient, cardModule, mediaInlineErrorBoundaryModule;
50
50
 
51
51
  return _regeneratorRuntime.wrap(function _callee$(_context) {
52
52
  while (1) {
@@ -66,17 +66,17 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
66
66
  '@atlaskit/media-client'), import(
67
67
  /* webpackChunkName: "@atlaskit-internal_inline-media-card" */
68
68
  './mediaInlineCard'), import(
69
- /* webpackChunkName: "@atlaskit-internal_media-card-error-boundary" */
70
- '../utils/media-card-analytics-error-boundary')]);
69
+ /* webpackChunkName: "@atlaskit-internal_media-inline-error-boundary" */
70
+ './mediaInlineAnalyticsErrorBoundary')]);
71
71
 
72
72
  case 5:
73
73
  _yield$Promise$all = _context.sent;
74
74
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
75
75
  mediaClient = _yield$Promise$all2[0];
76
76
  cardModule = _yield$Promise$all2[1];
77
- mediaCardErrorBoundaryModule = _yield$Promise$all2[2];
77
+ mediaInlineErrorBoundaryModule = _yield$Promise$all2[2];
78
78
  MediaInlineCardLoader.MediaInlineCard = mediaClient.withMediaClient(cardModule.MediaInlineCard);
79
- MediaInlineCardLoader.ErrorBoundary = mediaCardErrorBoundaryModule.default;
79
+ MediaInlineCardLoader.ErrorBoundary = mediaInlineErrorBoundaryModule.default;
80
80
 
81
81
  if (this.isMounted) {
82
82
  this.setState({
@@ -0,0 +1,99 @@
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+
13
+ 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); }; }
14
+
15
+ 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; } }
16
+
17
+ import React from 'react';
18
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
19
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
20
+ import { fireMediaCardEvent } from '../utils/analytics';
21
+
22
+ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Component) {
23
+ _inherits(WrappedMediaInlineAnalyticsErrorBoundary, _React$Component);
24
+
25
+ var _super = _createSuper(WrappedMediaInlineAnalyticsErrorBoundary);
26
+
27
+ function WrappedMediaInlineAnalyticsErrorBoundary(props) {
28
+ var _this;
29
+
30
+ _classCallCheck(this, WrappedMediaInlineAnalyticsErrorBoundary);
31
+
32
+ _this = _super.call(this, props);
33
+
34
+ _defineProperty(_assertThisInitialized(_this), "fireOperationalEvent", function (error, info) {
35
+ var _window, _window$navigator;
36
+
37
+ var _this$props = _this.props,
38
+ _this$props$data = _this$props.data,
39
+ data = _this$props$data === void 0 ? {} : _this$props$data,
40
+ createAnalyticsEvent = _this$props.createAnalyticsEvent;
41
+ var payload = {
42
+ eventType: 'operational',
43
+ action: 'failed',
44
+ actionSubject: 'mediaInlineRender',
45
+ attributes: _objectSpread({
46
+ browserInfo: (_window = window) !== null && _window !== void 0 && (_window$navigator = _window.navigator) !== null && _window$navigator !== void 0 && _window$navigator.userAgent ? window.navigator.userAgent : 'unknown',
47
+ error: error,
48
+ failReason: 'unexpected-error',
49
+ info: info
50
+ }, data)
51
+ };
52
+ fireMediaCardEvent(payload, createAnalyticsEvent);
53
+ });
54
+
55
+ _this.state = {
56
+ hasError: false
57
+ };
58
+ return _this;
59
+ }
60
+
61
+ _createClass(WrappedMediaInlineAnalyticsErrorBoundary, [{
62
+ key: "componentDidCatch",
63
+ value: function componentDidCatch(error, info) {
64
+ try {
65
+ this.fireOperationalEvent(error, info);
66
+ this.setState({
67
+ hasError: true
68
+ });
69
+ } catch (e) {}
70
+ }
71
+ }, {
72
+ key: "render",
73
+ value: function render() {
74
+ var hasError = this.state.hasError;
75
+ var children = this.props.children;
76
+
77
+ if (hasError) {
78
+ // TODO refactor error boundary for inline card https://product-fabric.atlassian.net/browse/MEX-2140
79
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
80
+ }
81
+
82
+ return children;
83
+ }
84
+ }]);
85
+
86
+ return WrappedMediaInlineAnalyticsErrorBoundary;
87
+ }(React.Component);
88
+
89
+ _defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
90
+
91
+ var packageName = "@atlaskit/media-card";
92
+ var packageVersion = "74.4.1";
93
+ var MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
94
+ packageVersion: packageVersion,
95
+ packageName: packageName,
96
+ componentName: 'mediaInlineCard',
97
+ component: 'mediaInlineCard'
98
+ })(withAnalyticsEvents()(WrappedMediaInlineAnalyticsErrorBoundary));
99
+ export default MediaInlineAnalyticsErrorBoundary;