@atlaskit/media-card 74.7.3 → 74.8.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 (52) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/card/card.js +99 -108
  3. package/dist/cjs/card/cardLoader.js +3 -3
  4. package/dist/cjs/card/cardView.js +6 -7
  5. package/dist/cjs/card/getCardPreview/helpers.js +108 -117
  6. package/dist/cjs/card/getCardPreview/index.js +99 -104
  7. package/dist/cjs/card/inlinePlayer.js +92 -97
  8. package/dist/cjs/card/inlinePlayerLazy.js +19 -20
  9. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  10. package/dist/cjs/card/ui/common.js +4 -4
  11. package/dist/cjs/inline/loader.js +50 -52
  12. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +59 -9
  13. package/dist/cjs/types.js +4 -4
  14. package/dist/cjs/utils/cardActions/cardActionIconButton.js +2 -3
  15. package/dist/cjs/utils/cardActions/styles.js +4 -4
  16. package/dist/cjs/utils/ufoExperiences.js +1 -1
  17. package/dist/cjs/utils/videoSnapshot.js +41 -44
  18. package/dist/cjs/utils/viewportDetector.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/card/card.js +6 -7
  21. package/dist/es2019/card/cardView.js +2 -3
  22. package/dist/es2019/card/inlinePlayer.js +1 -3
  23. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  24. package/dist/es2019/card/ui/common.js +3 -3
  25. package/dist/es2019/inline/loader.js +3 -1
  26. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +60 -7
  27. package/dist/es2019/types.js +3 -3
  28. package/dist/es2019/utils/cardActions/cardActionIconButton.js +2 -3
  29. package/dist/es2019/utils/cardActions/styles.js +3 -3
  30. package/dist/es2019/utils/ufoExperiences.js +1 -1
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/card/card.js +99 -109
  33. package/dist/esm/card/cardView.js +6 -7
  34. package/dist/esm/card/getCardPreview/helpers.js +108 -117
  35. package/dist/esm/card/getCardPreview/index.js +99 -104
  36. package/dist/esm/card/inlinePlayer.js +92 -98
  37. package/dist/esm/card/inlinePlayerLazy.js +17 -20
  38. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  39. package/dist/esm/card/ui/common.js +3 -3
  40. package/dist/esm/inline/loader.js +44 -47
  41. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +59 -9
  42. package/dist/esm/types.js +3 -3
  43. package/dist/esm/utils/cardActions/cardActionIconButton.js +2 -3
  44. package/dist/esm/utils/cardActions/styles.js +3 -3
  45. package/dist/esm/utils/ufoExperiences.js +1 -1
  46. package/dist/esm/utils/videoSnapshot.js +41 -44
  47. package/dist/esm/utils/viewportDetector.js +1 -1
  48. package/dist/esm/version.json +1 -1
  49. package/dist/types/inline/loader.d.ts +1 -0
  50. package/dist/types/inline/mediaInlineAnalyticsErrorBoundary.d.ts +1 -0
  51. package/package.json +28 -28
  52. 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.3";
130
+ var packageVersion = "74.8.0";
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);
@@ -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
  };
@@ -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.3";
17
+ var packageVersion = "74.8.0";
18
18
  var concurrentExperience;
19
19
  var getExperience = function getExperience(id) {
20
20
  if (!concurrentExperience) {
@@ -1,57 +1,54 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.takeSnapshot = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
11
10
  var takeSnapshot = /*#__PURE__*/function () {
12
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(blob) {
13
- return _regeneratorRuntime().wrap(function _callee$(_context) {
14
- while (1) {
15
- switch (_context.prev = _context.next) {
16
- case 0:
17
- return _context.abrupt("return", new Promise(function (resolve, reject) {
18
- var url = URL.createObjectURL(blob);
19
- var video = document.createElement('video');
20
- video.preload = 'metadata';
21
- video.src = url;
22
- video.muted = true;
23
- video.play().catch(function () {
24
- return reject(new Error('failed to play video'));
25
- });
26
- video.addEventListener('timeupdate', function timeUpdateHandler() {
27
- video.removeEventListener('timeupdate', timeUpdateHandler);
28
- video.pause();
29
- URL.revokeObjectURL(url);
30
- //create canvas to draw our first frame on.
11
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(blob) {
12
+ return _regenerator.default.wrap(function _callee$(_context) {
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.
31
29
 
32
- if (!video.videoWidth && !video.videoHeight) {
33
- return reject(new Error('error retrieving video dimensions'));
34
- }
35
- var canvas = document.createElement('canvas');
36
- canvas.width = video.videoWidth;
37
- canvas.height = video.videoHeight;
38
- var context = canvas.getContext('2d');
39
- if (!context) {
40
- return reject(new Error('error creating canvas context'));
41
- }
42
- context.drawImage(video, 0, 0, canvas.width, canvas.height);
43
- var dataURL = canvas.toDataURL('image/jpeg', 0.85);
44
- resolve(dataURL);
45
- });
46
- video.addEventListener('error', function () {
47
- reject(new Error('failed to load video'));
48
- URL.revokeObjectURL(url);
49
- });
50
- }));
51
- case 1:
52
- case "end":
53
- return _context.stop();
54
- }
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();
55
52
  }
56
53
  }, _callee);
57
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.3",
3
+ "version": "74.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -27,16 +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.3";
30
+ const packageVersion = "74.8.0";
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
- // Generate unique traceId for file
38
32
  constructor(props) {
39
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)
40
36
  _defineProperty(this, "internalOccurrenceKey", generateUniqueId());
41
37
  _defineProperty(this, "hasBeenMounted", false);
42
38
  _defineProperty(this, "fileStateFlags", {
@@ -51,7 +47,10 @@ export class CardBase extends Component {
51
47
  status: 'unknown'
52
48
  }
53
49
  });
50
+ // We initialise timeElapsedTillCommenced
51
+ // to avoid extra branching on a possibly undefined value.
54
52
  _defineProperty(this, "timeElapsedTillCommenced", performance.now());
53
+ // Generate unique traceId for file
55
54
  _defineProperty(this, "traceContext", {
56
55
  traceId: getRandomHex(8)
57
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,9 +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
364
  render() {
366
365
  const {
367
366
  featureFlags
@@ -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,
@@ -170,9 +171,6 @@ export class InlinePlayerBase extends Component {
170
171
  }
171
172
  });
172
173
  }
173
-
174
- // Tries to use the binary artifact to provide something to play while the video is still processing
175
-
176
174
  componentWillUnmount() {
177
175
  this.unsubscribe();
178
176
  this.revoke();
@@ -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.3";
69
+ const packageVersion = "74.8.0";
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.3";
110
+ const packageVersion = "74.8.0";
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)})`};
@@ -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.3";
7
+ const packageVersion = "74.8.0";
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.3",
3
+ "version": "74.8.0",
4
4
  "sideEffects": false
5
5
  }