@atlaskit/media-card 74.7.2 → 74.7.4

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 (66) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/card/card.js +92 -101
  3. package/dist/cjs/card/cardImageView/cardOverlay/index.js +1 -1
  4. package/dist/cjs/card/cardImageView/cardOverlay/styles.js +6 -0
  5. package/dist/cjs/card/cardImageView/fileCardImageView.js +1 -1
  6. package/dist/cjs/card/cardLoader.js +3 -3
  7. package/dist/cjs/card/cardView.js +7 -8
  8. package/dist/cjs/card/getCardPreview/cache.js +3 -0
  9. package/dist/cjs/card/getCardPreview/helpers.js +99 -107
  10. package/dist/cjs/card/getCardPreview/index.js +94 -98
  11. package/dist/cjs/card/inlinePlayer.js +87 -90
  12. package/dist/cjs/card/inlinePlayerLazy.js +16 -17
  13. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  14. package/dist/cjs/card/ui/common.js +4 -4
  15. package/dist/cjs/card/ui/unhandledErrorCard/index.js +1 -0
  16. package/dist/cjs/inline/loader.js +45 -47
  17. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +59 -9
  18. package/dist/cjs/types.js +4 -4
  19. package/dist/cjs/utils/cardActions/cardActionIconButton.js +2 -3
  20. package/dist/cjs/utils/cardActions/cardActionsView.js +1 -1
  21. package/dist/cjs/utils/cardActions/styles.js +4 -4
  22. package/dist/cjs/utils/errorIcon/index.js +1 -1
  23. package/dist/cjs/utils/fileIcon/index.js +1 -1
  24. package/dist/cjs/utils/progressBar/index.js +1 -1
  25. package/dist/cjs/utils/progressBar/styles.js +1 -0
  26. package/dist/cjs/utils/ufoExperiences.js +1 -1
  27. package/dist/cjs/utils/videoSnapshot.js +38 -40
  28. package/dist/cjs/utils/viewportDetector.js +1 -1
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/card/card.js +6 -9
  31. package/dist/es2019/card/cardView.js +2 -4
  32. package/dist/es2019/card/getCardPreview/cache.js +3 -0
  33. package/dist/es2019/card/inlinePlayer.js +1 -0
  34. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  35. package/dist/es2019/card/ui/common.js +3 -3
  36. package/dist/es2019/inline/loader.js +3 -1
  37. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +60 -7
  38. package/dist/es2019/types.js +3 -3
  39. package/dist/es2019/utils/cardActions/cardActionIconButton.js +2 -3
  40. package/dist/es2019/utils/cardActions/styles.js +3 -3
  41. package/dist/es2019/utils/globalScope/globalScope.js +0 -1
  42. package/dist/es2019/utils/ufoExperiences.js +1 -1
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/esm/card/card.js +92 -101
  45. package/dist/esm/card/cardView.js +6 -7
  46. package/dist/esm/card/getCardPreview/cache.js +3 -0
  47. package/dist/esm/card/getCardPreview/helpers.js +99 -107
  48. package/dist/esm/card/getCardPreview/index.js +94 -98
  49. package/dist/esm/card/inlinePlayer.js +87 -90
  50. package/dist/esm/card/inlinePlayerLazy.js +14 -16
  51. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  52. package/dist/esm/card/ui/common.js +3 -3
  53. package/dist/esm/inline/loader.js +39 -41
  54. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +59 -9
  55. package/dist/esm/types.js +3 -3
  56. package/dist/esm/utils/cardActions/cardActionIconButton.js +2 -3
  57. package/dist/esm/utils/cardActions/styles.js +3 -3
  58. package/dist/esm/utils/globalScope/globalScope.js +0 -1
  59. package/dist/esm/utils/ufoExperiences.js +1 -1
  60. package/dist/esm/utils/videoSnapshot.js +38 -40
  61. package/dist/esm/utils/viewportDetector.js +1 -1
  62. package/dist/esm/version.json +1 -1
  63. package/dist/types/inline/loader.d.ts +1 -0
  64. package/dist/types/inline/mediaInlineAnalyticsErrorBoundary.d.ts +1 -0
  65. package/package.json +6 -6
  66. package/report.api.md +1 -0
@@ -15,11 +15,60 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _react = _interopRequireDefault(require("react"));
16
16
  var _mediaCommon = require("@atlaskit/media-common");
17
17
  var _analyticsNext = require("@atlaskit/analytics-next");
18
+ var _colors = require("@atlaskit/theme/colors");
19
+ var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/warning"));
18
20
  var _analytics = require("../utils/analytics");
19
- 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; }
20
- 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) { (0, _defineProperty2.default)(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; }
21
21
  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); }; }
22
22
  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; } }
23
+ 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; }
24
+ 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) { (0, _defineProperty2.default)(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; }
25
+ var ErrorBoundaryComponent = function ErrorBoundaryComponent(_ref) {
26
+ var message = _ref.message,
27
+ isSelected = _ref.isSelected;
28
+ var selectedStyle = {
29
+ cursor: 'pointer',
30
+ boxShadow: "0 0 0 1px ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")")),
31
+ outline: 'none',
32
+ userSelect: 'none',
33
+ borderColor: 'transparent'
34
+ };
35
+
36
+ /* Note:
37
+ - styling is borrowed from packages/media/media-ui/src/MediaInlineCard/Frame/styled.ts
38
+ - because we are not using styled components, we are not able to use themed(), here is the "themed" property of color and backgroundColor
39
+ color: `${themed({
40
+ light: token('color.text', N900),
41
+ dark: token('color.text', DN600),
42
+ })}`,
43
+ backgroundColor: `${themed({
44
+ light: token('color.background.neutral', N30A),
45
+ dark: token('color.background.neutral', DN80),
46
+ })}`,
47
+ */
48
+
49
+ var style = _objectSpread({
50
+ lineHeight: '16px',
51
+ padding: '2px 4px',
52
+ marginRight: '-2px',
53
+ WebkitBoxDecorationBreak: 'clone',
54
+ display: 'inline',
55
+ borderRadius: '3px',
56
+ color: "var(--ds-text, ".concat(_colors.N900, ")"),
57
+ backgroundColor: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
58
+ userSelect: 'text',
59
+ transition: 'all 0.1s ease-in-out 0s',
60
+ cursor: 'pointer'
61
+ }, isSelected ? _objectSpread({}, selectedStyle) : {
62
+ userSelect: 'text'
63
+ });
64
+ return /*#__PURE__*/_react.default.createElement("span", {
65
+ style: style
66
+ }, /*#__PURE__*/_react.default.createElement(_warning.default, {
67
+ label: "error",
68
+ size: "small",
69
+ primaryColor: "var(--ds-icon-danger, ".concat(_colors.R300, ")")
70
+ }), message);
71
+ };
23
72
  var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Component) {
24
73
  (0, _inherits2.default)(WrappedMediaInlineAnalyticsErrorBoundary, _React$Component);
25
74
  var _super = _createSuper(WrappedMediaInlineAnalyticsErrorBoundary);
@@ -65,19 +114,20 @@ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Com
65
114
  key: "render",
66
115
  value: function render() {
67
116
  var hasError = this.state.hasError;
68
- var children = this.props.children;
69
- if (hasError) {
70
- // TODO refactor error boundary for inline card https://product-fabric.atlassian.net/browse/MEX-2140
71
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
72
- }
73
- return children;
117
+ var _this$props2 = this.props,
118
+ children = _this$props2.children,
119
+ isSelected = _this$props2.isSelected;
120
+ return hasError ? /*#__PURE__*/_react.default.createElement(ErrorBoundaryComponent, {
121
+ message: "We couldn't load this content",
122
+ isSelected: isSelected
123
+ }) : children;
74
124
  }
75
125
  }]);
76
126
  return WrappedMediaInlineAnalyticsErrorBoundary;
77
127
  }(_react.default.Component);
78
128
  (0, _defineProperty2.default)(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
79
129
  var packageName = "@atlaskit/media-card";
80
- var packageVersion = "74.7.2";
130
+ var packageVersion = "74.7.4";
81
131
  var MediaInlineAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
82
132
  packageVersion: packageVersion,
83
133
  packageName: packageName,
package/dist/cjs/types.js CHANGED
@@ -8,9 +8,9 @@ exports.MediaCardCursor = void 0;
8
8
  * Entry Point: @atlaskit/media-card/types
9
9
  * tsconfig.entry-points.json
10
10
  */
11
- var MediaCardCursor;
12
- exports.MediaCardCursor = MediaCardCursor;
13
- (function (MediaCardCursor) {
11
+ var MediaCardCursor = /*#__PURE__*/function (MediaCardCursor) {
14
12
  MediaCardCursor["Action"] = "pointer";
15
13
  MediaCardCursor["NotReady"] = "wait";
16
- })(MediaCardCursor || (exports.MediaCardCursor = MediaCardCursor = {}));
14
+ return MediaCardCursor;
15
+ }({});
16
+ exports.MediaCardCursor = MediaCardCursor;
@@ -29,6 +29,8 @@ var CardActionIconButton = /*#__PURE__*/function (_Component) {
29
29
  args[_key] = arguments[_key];
30
30
  }
31
31
  _this = _super.call.apply(_super, [this].concat(args));
32
+ // this is to prevent currently focused text to loose cursor on clicking card action
33
+ // this does not prevent onclick behavior
32
34
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseDown", function (event) {
33
35
  event.preventDefault();
34
36
  });
@@ -51,9 +53,6 @@ var CardActionIconButton = /*#__PURE__*/function (_Component) {
51
53
  variant: variant
52
54
  }, icon);
53
55
  }
54
-
55
- // this is to prevent currently focused text to loose cursor on clicking card action
56
- // this does not prevent onclick behavior
57
56
  }]);
58
57
  return CardActionIconButton;
59
58
  }(_react.Component);
@@ -19,7 +19,7 @@ var _preventClickThrough = require("../preventClickThrough");
19
19
  var _analytics = require("../analytics");
20
20
  var _analyticsNext = require("@atlaskit/analytics-next");
21
21
  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); }; }
22
- 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; } }
22
+ 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; } } /**@jsx jsx */
23
23
  var CardActionIconButtonWithProps = function CardActionIconButtonWithProps(props) {
24
24
  return (0, _react.jsx)(_cardActionIconButton.CardActionIconButton, props);
25
25
  };
@@ -14,12 +14,12 @@ var _mixins = require("../../card/styles/mixins");
14
14
  var _templateObject, _templateObject2;
15
15
  var wrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n display: flex;\n position: relative;\n line-height: 0;\n"])), (0, _styles.rootStyles)());
16
16
  exports.wrapperStyles = wrapperStyles;
17
- var CardActionIconButtonVariant;
18
- exports.CardActionIconButtonVariant = CardActionIconButtonVariant;
19
- (function (CardActionIconButtonVariant) {
17
+ var CardActionIconButtonVariant = /*#__PURE__*/function (CardActionIconButtonVariant) {
20
18
  CardActionIconButtonVariant["default"] = "default";
21
19
  CardActionIconButtonVariant["filled"] = "filled";
22
- })(CardActionIconButtonVariant || (exports.CardActionIconButtonVariant = CardActionIconButtonVariant = {}));
20
+ return CardActionIconButtonVariant;
21
+ }({});
22
+ exports.CardActionIconButtonVariant = CardActionIconButtonVariant;
23
23
  var getVariantStyles = function getVariantStyles(variant) {
24
24
  return variant === 'filled' ? "\n background-color: ".concat("var(--ds-surface-overlay, ".concat((0, _mixins.rgba)(_colors.N0, 0.8), ")"), ";\n margin-right: 8px;\n\n &:last-child {\n margin-right: 0;\n }\n\n &:hover {\n background-color: ", "var(--ds-surface-overlay-hovered, ".concat((0, _mixins.rgba)(_colors.N0, 0.6), ")"), "\n }\n ") : "\n &:hover {\n background-color: ".concat("var(--ds-background-neutral-subtle-hovered, rgba(9, 30, 66, 0.06))", ";\n }\n ");
25
25
  };
@@ -16,7 +16,7 @@ var _react2 = require("react");
16
16
  var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/warning"));
17
17
  var _styles = require("./styles");
18
18
  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); }; }
19
- 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; } }
19
+ 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; } } /**@jsx jsx */
20
20
  var ErrorIcon = /*#__PURE__*/function (_Component) {
21
21
  (0, _inherits2.default)(ErrorIcon, _Component);
22
22
  var _super = _createSuper(ErrorIcon);
@@ -15,7 +15,7 @@ var _react2 = require("react");
15
15
  var _mediaTypeIcon = require("@atlaskit/media-ui/media-type-icon");
16
16
  var _styles = require("./styles");
17
17
  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); }; }
18
- 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; } }
18
+ 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; } } /**@jsx jsx */
19
19
  var fileTypeIconClass = 'file-type-icon';
20
20
  var FileIcon = /*#__PURE__*/function (_Component) {
21
21
  (0, _inherits2.default)(FileIcon, _Component);
@@ -14,7 +14,7 @@ var _react = require("@emotion/react");
14
14
  var _react2 = require("react");
15
15
  var _styles = require("./styles");
16
16
  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); }; }
17
- 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; } }
17
+ 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; } } /**@jsx jsx */
18
18
  var ProgressBar = /*#__PURE__*/function (_Component) {
19
19
  (0, _inherits2.default)(ProgressBar, _Component);
20
20
  var _super = _createSuper(ProgressBar);
@@ -9,5 +9,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _mediaUi = require("@atlaskit/media-ui");
11
11
  var _templateObject;
12
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
12
13
  var progressWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", " z-index: 30;\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.3);\n\n .progressBar {\n width: 0%;\n height: 3px;\n transition: width 0.25s ease-in;\n background-color: white;\n }\n"])), _mediaUi.borderRadius);
13
14
  exports.progressWrapperStyles = progressWrapperStyles;
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
14
14
  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; }
15
15
  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) { (0, _defineProperty2.default)(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; }
16
16
  var packageName = "@atlaskit/media-card";
17
- var packageVersion = "74.7.2";
17
+ var packageVersion = "74.7.4";
18
18
  var concurrentExperience;
19
19
  var getExperience = function getExperience(id) {
20
20
  if (!concurrentExperience) {
@@ -10,47 +10,45 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var takeSnapshot = /*#__PURE__*/function () {
11
11
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(blob) {
12
12
  return _regenerator.default.wrap(function _callee$(_context) {
13
- while (1) {
14
- switch (_context.prev = _context.next) {
15
- case 0:
16
- return _context.abrupt("return", new Promise(function (resolve, reject) {
17
- var url = URL.createObjectURL(blob);
18
- var video = document.createElement('video');
19
- video.preload = 'metadata';
20
- video.src = url;
21
- video.muted = true;
22
- video.play().catch(function () {
23
- return reject(new Error('failed to play video'));
24
- });
25
- video.addEventListener('timeupdate', function timeUpdateHandler() {
26
- video.removeEventListener('timeupdate', timeUpdateHandler);
27
- video.pause();
28
- URL.revokeObjectURL(url);
29
- //create canvas to draw our first frame on.
13
+ while (1) switch (_context.prev = _context.next) {
14
+ case 0:
15
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
16
+ var url = URL.createObjectURL(blob);
17
+ var video = document.createElement('video');
18
+ video.preload = 'metadata';
19
+ video.src = url;
20
+ video.muted = true;
21
+ video.play().catch(function () {
22
+ return reject(new Error('failed to play video'));
23
+ });
24
+ video.addEventListener('timeupdate', function timeUpdateHandler() {
25
+ video.removeEventListener('timeupdate', timeUpdateHandler);
26
+ video.pause();
27
+ URL.revokeObjectURL(url);
28
+ //create canvas to draw our first frame on.
30
29
 
31
- if (!video.videoWidth && !video.videoHeight) {
32
- return reject(new Error('error retrieving video dimensions'));
33
- }
34
- var canvas = document.createElement('canvas');
35
- canvas.width = video.videoWidth;
36
- canvas.height = video.videoHeight;
37
- var context = canvas.getContext('2d');
38
- if (!context) {
39
- return reject(new Error('error creating canvas context'));
40
- }
41
- context.drawImage(video, 0, 0, canvas.width, canvas.height);
42
- var dataURL = canvas.toDataURL('image/jpeg', 0.85);
43
- resolve(dataURL);
44
- });
45
- video.addEventListener('error', function () {
46
- reject(new Error('failed to load video'));
47
- URL.revokeObjectURL(url);
48
- });
49
- }));
50
- case 1:
51
- case "end":
52
- return _context.stop();
53
- }
30
+ if (!video.videoWidth && !video.videoHeight) {
31
+ return reject(new Error('error retrieving video dimensions'));
32
+ }
33
+ var canvas = document.createElement('canvas');
34
+ canvas.width = video.videoWidth;
35
+ canvas.height = video.videoHeight;
36
+ var context = canvas.getContext('2d');
37
+ if (!context) {
38
+ return reject(new Error('error creating canvas context'));
39
+ }
40
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
41
+ var dataURL = canvas.toDataURL('image/jpeg', 0.85);
42
+ resolve(dataURL);
43
+ });
44
+ video.addEventListener('error', function () {
45
+ reject(new Error('failed to load video'));
46
+ URL.revokeObjectURL(url);
47
+ });
48
+ }));
49
+ case 1:
50
+ case "end":
51
+ return _context.stop();
54
52
  }
55
53
  }, _callee);
56
54
  }));
@@ -12,7 +12,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
12
12
  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; }
13
13
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
14
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
16
  var ABS_VIEWPORT_ANCHOR_OFFSET_TOP = 900; //px
17
17
 
18
18
  var createIntersectionObserverCallback = function createIntersectionObserverCallback(onVisible) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.7.2",
3
+ "version": "74.7.4",
4
4
  "sideEffects": false
5
5
  }
@@ -27,18 +27,12 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
27
27
  import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
28
28
  import { generateUniqueId } from '../utils/generateUniqueId';
29
29
  const packageName = "@atlaskit/media-card";
30
- const packageVersion = "74.7.2";
30
+ const packageVersion = "74.7.4";
31
31
  export class CardBase extends Component {
32
- // An internalOccurrenceKey is a randomly generated value to differentiate various instances
33
- // of Cards regardless of whether it shares the same file (either internal or external)
34
-
35
- // We initialise timeElapsedTillCommenced
36
- // to avoid extra branching on a possibly undefined value.
37
-
38
- // Generate unique traceId for file
39
-
40
32
  constructor(props) {
41
33
  super(props);
34
+ // An internalOccurrenceKey is a randomly generated value to differentiate various instances
35
+ // of Cards regardless of whether it shares the same file (either internal or external)
42
36
  _defineProperty(this, "internalOccurrenceKey", generateUniqueId());
43
37
  _defineProperty(this, "hasBeenMounted", false);
44
38
  _defineProperty(this, "fileStateFlags", {
@@ -53,7 +47,10 @@ export class CardBase extends Component {
53
47
  status: 'unknown'
54
48
  }
55
49
  });
50
+ // We initialise timeElapsedTillCommenced
51
+ // to avoid extra branching on a possibly undefined value.
56
52
  _defineProperty(this, "timeElapsedTillCommenced", performance.now());
53
+ // Generate unique traceId for file
57
54
  _defineProperty(this, "traceContext", {
58
55
  traceId: getRandomHex(8)
59
56
  });
@@ -73,6 +73,8 @@ export class CardViewBase extends React.Component {
73
73
  });
74
74
  onImageError && onImageError(cardPreview);
75
75
  });
76
+ // If the dimensions.width is a percentage, we need to transform it
77
+ // into a pixel value in order to get the right breakpoints applied.
76
78
  _defineProperty(this, "saveElementWidth", () => {
77
79
  const {
78
80
  dimensions
@@ -359,10 +361,6 @@ export class CardViewBase extends React.Component {
359
361
  const width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || defaultImageCardDimensions.width;
360
362
  return calcBreakpointSize(parseInt(`${width}`, 10));
361
363
  }
362
-
363
- // If the dimensions.width is a percentage, we need to transform it
364
- // into a pixel value in order to get the right breakpoints applied.
365
-
366
364
  render() {
367
365
  const {
368
366
  featureFlags
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { createObjectURLCache } from '../../utils/objectURLCache';
3
+
4
+ // Dimensions are used to create a key.
5
+ // Cache is invalidated when different dimensions are provided.
3
6
  export const getCacheKey = (id, mode) => {
4
7
  const resizeMode = mode || 'crop';
5
8
  return [id, resizeMode].join('-');
@@ -33,6 +33,7 @@ export class InlinePlayerBase extends Component {
33
33
  fileSrc
34
34
  });
35
35
  });
36
+ // Tries to use the binary artifact to provide something to play while the video is still processing
36
37
  _defineProperty(this, "setBinaryURL", async () => {
37
38
  const {
38
39
  mediaClient,
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
66
66
  }
67
67
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
68
68
  const packageName = "@atlaskit/media-card";
69
- const packageVersion = "74.7.2";
69
+ const packageVersion = "74.7.4";
70
70
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
71
71
  packageVersion,
72
72
  packageName,
@@ -1,8 +1,8 @@
1
- export let Breakpoint;
2
- (function (Breakpoint) {
1
+ export let Breakpoint = /*#__PURE__*/function (Breakpoint) {
3
2
  Breakpoint["SMALL"] = "small";
4
3
  Breakpoint["LARGE"] = "large";
5
- })(Breakpoint || (Breakpoint = {}));
4
+ return Breakpoint;
5
+ }({});
6
6
  export const responsiveSettings = {
7
7
  [Breakpoint.SMALL]: {
8
8
  fontSize: 11,
@@ -39,7 +39,9 @@ export default class MediaInlineCardLoader extends React.PureComponent {
39
39
  message: ""
40
40
  });
41
41
  }
42
- return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(MediaInlineCard, this.props));
42
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
43
+ isSelected: this.props.isSelected
44
+ }, /*#__PURE__*/React.createElement(MediaInlineCard, this.props));
43
45
  }
44
46
  }
45
47
  _defineProperty(MediaInlineCardLoader, "displayName", 'MediaInlineCardLoader');
@@ -2,7 +2,60 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
+ import { B300, R300, N30A, N900 } from '@atlaskit/theme/colors';
6
+ import WarningIcon from '@atlaskit/icon/glyph/warning';
5
7
  import { fireMediaCardEvent } from '../utils/analytics';
8
+ const ErrorBoundaryComponent = ({
9
+ message,
10
+ isSelected
11
+ }) => {
12
+ const selectedStyle = {
13
+ cursor: 'pointer',
14
+ boxShadow: `0 0 0 1px ${`var(--ds-border-selected, ${B300})`}`,
15
+ outline: 'none',
16
+ userSelect: 'none',
17
+ borderColor: 'transparent'
18
+ };
19
+
20
+ /* Note:
21
+ - styling is borrowed from packages/media/media-ui/src/MediaInlineCard/Frame/styled.ts
22
+ - because we are not using styled components, we are not able to use themed(), here is the "themed" property of color and backgroundColor
23
+ color: `${themed({
24
+ light: token('color.text', N900),
25
+ dark: token('color.text', DN600),
26
+ })}`,
27
+ backgroundColor: `${themed({
28
+ light: token('color.background.neutral', N30A),
29
+ dark: token('color.background.neutral', DN80),
30
+ })}`,
31
+ */
32
+
33
+ const style = {
34
+ lineHeight: '16px',
35
+ padding: '2px 4px',
36
+ marginRight: '-2px',
37
+ WebkitBoxDecorationBreak: 'clone',
38
+ display: 'inline',
39
+ borderRadius: '3px',
40
+ color: `var(--ds-text, ${N900})`,
41
+ backgroundColor: `var(--ds-background-neutral, ${N30A})`,
42
+ userSelect: 'text',
43
+ transition: 'all 0.1s ease-in-out 0s',
44
+ cursor: 'pointer',
45
+ ...(isSelected ? {
46
+ ...selectedStyle
47
+ } : {
48
+ userSelect: 'text'
49
+ })
50
+ };
51
+ return /*#__PURE__*/React.createElement("span", {
52
+ style: style
53
+ }, /*#__PURE__*/React.createElement(WarningIcon, {
54
+ label: "error",
55
+ size: "small",
56
+ primaryColor: `var(--ds-icon-danger, ${R300})`
57
+ }), message);
58
+ };
6
59
  class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
7
60
  constructor(props) {
8
61
  super(props);
@@ -43,18 +96,18 @@ class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
43
96
  hasError
44
97
  } = this.state;
45
98
  const {
46
- children
99
+ children,
100
+ isSelected
47
101
  } = this.props;
48
- if (hasError) {
49
- // TODO refactor error boundary for inline card https://product-fabric.atlassian.net/browse/MEX-2140
50
- return /*#__PURE__*/React.createElement(React.Fragment, null);
51
- }
52
- return children;
102
+ return hasError ? /*#__PURE__*/React.createElement(ErrorBoundaryComponent, {
103
+ message: "We couldn't load this content",
104
+ isSelected: isSelected
105
+ }) : children;
53
106
  }
54
107
  }
55
108
  _defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
56
109
  const packageName = "@atlaskit/media-card";
57
- const packageVersion = "74.7.2";
110
+ const packageVersion = "74.7.4";
58
111
  const MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
59
112
  packageVersion,
60
113
  packageName,
@@ -3,8 +3,8 @@
3
3
  * tsconfig.entry-points.json
4
4
  */
5
5
 
6
- export let MediaCardCursor;
7
- (function (MediaCardCursor) {
6
+ export let MediaCardCursor = /*#__PURE__*/function (MediaCardCursor) {
8
7
  MediaCardCursor["Action"] = "pointer";
9
8
  MediaCardCursor["NotReady"] = "wait";
10
- })(MediaCardCursor || (MediaCardCursor = {}));
9
+ return MediaCardCursor;
10
+ }({});
@@ -5,6 +5,8 @@ import { CardActionButton } from './cardActionButton';
5
5
  export class CardActionIconButton extends Component {
6
6
  constructor(...args) {
7
7
  super(...args);
8
+ // this is to prevent currently focused text to loose cursor on clicking card action
9
+ // this does not prevent onclick behavior
8
10
  _defineProperty(this, "onMouseDown", event => {
9
11
  event.preventDefault();
10
12
  });
@@ -25,7 +27,4 @@ export class CardActionIconButton extends Component {
25
27
  variant: variant
26
28
  }, icon);
27
29
  }
28
-
29
- // this is to prevent currently focused text to loose cursor on clicking card action
30
- // this does not prevent onclick behavior
31
30
  }
@@ -9,11 +9,11 @@ export const wrapperStyles = css`
9
9
  position: relative;
10
10
  line-height: 0;
11
11
  `;
12
- export let CardActionIconButtonVariant;
13
- (function (CardActionIconButtonVariant) {
12
+ export let CardActionIconButtonVariant = /*#__PURE__*/function (CardActionIconButtonVariant) {
14
13
  CardActionIconButtonVariant["default"] = "default";
15
14
  CardActionIconButtonVariant["filled"] = "filled";
16
- })(CardActionIconButtonVariant || (CardActionIconButtonVariant = {}));
15
+ return CardActionIconButtonVariant;
16
+ }({});
17
17
  const getVariantStyles = variant => {
18
18
  return variant === 'filled' ? `
19
19
  background-color: ${`var(--ds-surface-overlay, ${rgba(N0, 0.8)})`};
@@ -5,7 +5,6 @@ import { printFunctionCall, printScript } from '../printScript';
5
5
  // Any changes to this file must be tested directly in product before merging.
6
6
  // The scripts printed here might differ from what we observe in our internal tests
7
7
  // due to minimification, for example.
8
-
9
8
  export const GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
10
9
  export const GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
11
10
  export function getMediaGlobalScope(globalScope = window) {
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
4
4
  import { MediaCardError } from '../errors';
5
5
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
6
6
  const packageName = "@atlaskit/media-card";
7
- const packageVersion = "74.7.2";
7
+ const packageVersion = "74.7.4";
8
8
  let concurrentExperience;
9
9
  const getExperience = id => {
10
10
  if (!concurrentExperience) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.7.2",
3
+ "version": "74.7.4",
4
4
  "sideEffects": false
5
5
  }