@atlaskit/media-card 74.7.3 → 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 (52) hide show
  1. package/CHANGELOG.md +9 -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 +4 -4
  52. package/report.api.md +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 74.7.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5c6e8f7b846`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5c6e8f7b846) - - refactored card file states example
8
+ - added inline card file states example
9
+ - [`e8bb5592bf8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e8bb5592bf8) - MEX-2140 Refactor error boundary of media inline card
10
+ - Updated dependencies
11
+
3
12
  ## 74.7.3
4
13
 
5
14
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.CardBase = exports.Card = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -42,28 +43,21 @@ var _ufoExperiences = require("../utils/ufoExperiences");
42
43
  var _generateUniqueId = require("../utils/generateUniqueId");
43
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44
45
  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; }
45
- 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; }
46
46
  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; }
47
47
  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; }
48
48
  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); }; }
49
49
  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; } }
50
50
  var packageName = "@atlaskit/media-card";
51
- var packageVersion = "74.7.3";
51
+ var packageVersion = "74.7.4";
52
52
  var CardBase = /*#__PURE__*/function (_Component) {
53
53
  (0, _inherits2.default)(CardBase, _Component);
54
54
  var _super = _createSuper(CardBase);
55
- // An internalOccurrenceKey is a randomly generated value to differentiate various instances
56
- // of Cards regardless of whether it shares the same file (either internal or external)
57
-
58
- // We initialise timeElapsedTillCommenced
59
- // to avoid extra branching on a possibly undefined value.
60
-
61
- // Generate unique traceId for file
62
-
63
55
  function CardBase(props) {
64
56
  var _this;
65
57
  (0, _classCallCheck2.default)(this, CardBase);
66
58
  _this = _super.call(this, props);
59
+ // An internalOccurrenceKey is a randomly generated value to differentiate various instances
60
+ // of Cards regardless of whether it shares the same file (either internal or external)
67
61
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "internalOccurrenceKey", (0, _generateUniqueId.generateUniqueId)());
68
62
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasBeenMounted", false);
69
63
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fileStateFlags", {
@@ -78,7 +72,10 @@ var CardBase = /*#__PURE__*/function (_Component) {
78
72
  status: 'unknown'
79
73
  }
80
74
  });
75
+ // We initialise timeElapsedTillCommenced
76
+ // to avoid extra branching on a possibly undefined value.
81
77
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "timeElapsedTillCommenced", performance.now());
78
+ // Generate unique traceId for file
82
79
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "traceContext", {
83
80
  traceId: (0, _mediaCommon.getRandomHex)(8)
84
81
  });
@@ -144,31 +141,29 @@ var CardBase = /*#__PURE__*/function (_Component) {
144
141
  });
145
142
  });
146
143
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "refetchSSRPreview", /*#__PURE__*/function () {
147
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(identifier) {
144
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(identifier) {
148
145
  var cardPreview, wrappedError;
149
- return _regeneratorRuntime().wrap(function _callee$(_context) {
150
- while (1) {
151
- switch (_context.prev = _context.next) {
152
- case 0:
153
- _context.prev = 0;
154
- _context.next = 3;
155
- return _this.fetchAndCacheRemotePreview(identifier);
156
- case 3:
157
- cardPreview = _context.sent;
158
- _this.safeSetState({
159
- cardPreview: cardPreview
160
- });
161
- _context.next = 11;
162
- break;
163
- case 7:
164
- _context.prev = 7;
165
- _context.t0 = _context["catch"](0);
166
- wrappedError = (0, _errors.ensureMediaCardError)('remote-preview-fetch-ssr', _context.t0, true);
167
- _this.fireNonCriticalErrorEvent(wrappedError);
168
- case 11:
169
- case "end":
170
- return _context.stop();
171
- }
146
+ return _regenerator.default.wrap(function _callee$(_context) {
147
+ while (1) switch (_context.prev = _context.next) {
148
+ case 0:
149
+ _context.prev = 0;
150
+ _context.next = 3;
151
+ return _this.fetchAndCacheRemotePreview(identifier);
152
+ case 3:
153
+ cardPreview = _context.sent;
154
+ _this.safeSetState({
155
+ cardPreview: cardPreview
156
+ });
157
+ _context.next = 11;
158
+ break;
159
+ case 7:
160
+ _context.prev = 7;
161
+ _context.t0 = _context["catch"](0);
162
+ wrappedError = (0, _errors.ensureMediaCardError)('remote-preview-fetch-ssr', _context.t0, true);
163
+ _this.fireNonCriticalErrorEvent(wrappedError);
164
+ case 11:
165
+ case "end":
166
+ return _context.stop();
172
167
  }
173
168
  }, _callee, null, [[0, 7]]);
174
169
  }));
@@ -177,45 +172,43 @@ var CardBase = /*#__PURE__*/function (_Component) {
177
172
  };
178
173
  }());
179
174
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resolveUpfrontPreview", /*#__PURE__*/function () {
180
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(identifier) {
175
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(identifier) {
181
176
  var requestedDimensions, cardPreview, currentDimensions, areValidRequestedDimensions;
182
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
183
- while (1) {
184
- switch (_context2.prev = _context2.next) {
185
- case 0:
186
- requestedDimensions = _objectSpread({}, _this.props.dimensions);
187
- _context2.prev = 1;
188
- _context2.next = 4;
189
- return _this.fetchAndCacheRemotePreview(identifier);
190
- case 4:
191
- cardPreview = _context2.sent;
192
- currentDimensions = _this.props.dimensions;
193
- areValidRequestedDimensions = !(0, _dimensionComparer.isBigger)(requestedDimensions, currentDimensions); // If there are new and bigger dimensions in the props, and the upfront preview is still resolving,
194
- // the fetched preview is no longer valid, and thus, we dismiss it and set the flag wasResolvedUpfrontPreview = true
195
- // to trigger a normal preview fetch.
196
- if (areValidRequestedDimensions) {
197
- _this.safeSetState({
198
- cardPreview: cardPreview,
199
- wasResolvedUpfrontPreview: true
200
- });
201
- } else {
202
- _this.safeSetState({
203
- wasResolvedUpfrontPreview: true
204
- });
205
- }
206
- _context2.next = 13;
207
- break;
208
- case 10:
209
- _context2.prev = 10;
210
- _context2.t0 = _context2["catch"](1);
177
+ return _regenerator.default.wrap(function _callee2$(_context2) {
178
+ while (1) switch (_context2.prev = _context2.next) {
179
+ case 0:
180
+ requestedDimensions = _objectSpread({}, _this.props.dimensions);
181
+ _context2.prev = 1;
182
+ _context2.next = 4;
183
+ return _this.fetchAndCacheRemotePreview(identifier);
184
+ case 4:
185
+ cardPreview = _context2.sent;
186
+ currentDimensions = _this.props.dimensions;
187
+ areValidRequestedDimensions = !(0, _dimensionComparer.isBigger)(requestedDimensions, currentDimensions); // If there are new and bigger dimensions in the props, and the upfront preview is still resolving,
188
+ // the fetched preview is no longer valid, and thus, we dismiss it and set the flag wasResolvedUpfrontPreview = true
189
+ // to trigger a normal preview fetch.
190
+ if (areValidRequestedDimensions) {
211
191
  _this.safeSetState({
192
+ cardPreview: cardPreview,
212
193
  wasResolvedUpfrontPreview: true
213
194
  });
214
- // NO need to log error. If this call fails, a refetch will happen after
215
- case 13:
216
- case "end":
217
- return _context2.stop();
218
- }
195
+ } else {
196
+ _this.safeSetState({
197
+ wasResolvedUpfrontPreview: true
198
+ });
199
+ }
200
+ _context2.next = 13;
201
+ break;
202
+ case 10:
203
+ _context2.prev = 10;
204
+ _context2.t0 = _context2["catch"](1);
205
+ _this.safeSetState({
206
+ wasResolvedUpfrontPreview: true
207
+ });
208
+ // NO need to log error. If this call fails, a refetch will happen after
209
+ case 13:
210
+ case "end":
211
+ return _context2.stop();
219
212
  }
220
213
  }, _callee2, null, [[1, 10]]);
221
214
  }));
@@ -231,45 +224,43 @@ var CardBase = /*#__PURE__*/function (_Component) {
231
224
  return (0, _getCardPreview.fetchAndCacheRemotePreview)(mediaClient, identifier.id, dimensions, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier));
232
225
  });
233
226
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resolvePreview", /*#__PURE__*/function () {
234
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(identifier, fileState) {
227
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(identifier, fileState) {
235
228
  var params, cardPreview, wrappedError;
236
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
237
- while (1) {
238
- switch (_context3.prev = _context3.next) {
239
- case 0:
240
- _context3.prev = 0;
241
- params = _this.getCardPreviewParams(identifier, fileState);
242
- _context3.next = 4;
243
- return (0, _getCardPreview.getCardPreview)(params);
244
- case 4:
245
- cardPreview = _context3.sent;
229
+ return _regenerator.default.wrap(function _callee3$(_context3) {
230
+ while (1) switch (_context3.prev = _context3.next) {
231
+ case 0:
232
+ _context3.prev = 0;
233
+ params = _this.getCardPreviewParams(identifier, fileState);
234
+ _context3.next = 4;
235
+ return (0, _getCardPreview.getCardPreview)(params);
236
+ case 4:
237
+ cardPreview = _context3.sent;
238
+ _this.safeSetState({
239
+ cardPreview: cardPreview
240
+ });
241
+ _context3.next = 12;
242
+ break;
243
+ case 8:
244
+ _context3.prev = 8;
245
+ _context3.t0 = _context3["catch"](0);
246
+ wrappedError = (0, _errors.ensureMediaCardError)('preview-fetch', _context3.t0); // If remote preview fails, we set status 'error'
247
+ // If local preview fails (i.e, no remote preview available),
248
+ // we can stay in the same status until there is a remote preview available
249
+ // If it's any other error we set status 'error'
250
+ if ((0, _errors.isLocalPreviewError)(wrappedError)) {
251
+ // This error should already been logged inside the getCardPreview. No need to log it here.
252
+ _this.safeSetState({
253
+ isBannedLocalPreview: true
254
+ });
255
+ } else {
246
256
  _this.safeSetState({
247
- cardPreview: cardPreview
257
+ status: 'error',
258
+ error: wrappedError
248
259
  });
249
- _context3.next = 12;
250
- break;
251
- case 8:
252
- _context3.prev = 8;
253
- _context3.t0 = _context3["catch"](0);
254
- wrappedError = (0, _errors.ensureMediaCardError)('preview-fetch', _context3.t0); // If remote preview fails, we set status 'error'
255
- // If local preview fails (i.e, no remote preview available),
256
- // we can stay in the same status until there is a remote preview available
257
- // If it's any other error we set status 'error'
258
- if ((0, _errors.isLocalPreviewError)(wrappedError)) {
259
- // This error should already been logged inside the getCardPreview. No need to log it here.
260
- _this.safeSetState({
261
- isBannedLocalPreview: true
262
- });
263
- } else {
264
- _this.safeSetState({
265
- status: 'error',
266
- error: wrappedError
267
- });
268
- }
269
- case 12:
270
- case "end":
271
- return _context3.stop();
272
- }
260
+ }
261
+ case 12:
262
+ case "end":
263
+ return _context3.stop();
273
264
  }
274
265
  }, _callee3, null, [[0, 8]]);
275
266
  }));
@@ -618,9 +609,9 @@ var CardBase = /*#__PURE__*/function (_Component) {
618
609
  var _this$props9 = _this.props,
619
610
  ssr = _this$props9.ssr,
620
611
  identifier = _this$props9.identifier;
621
- var _this$state$cardPrevi = _this.state.cardPreview;
622
- _this$state$cardPrevi = _this$state$cardPrevi === void 0 ? {} : _this$state$cardPrevi;
623
- var dataURI = _this$state$cardPrevi.dataURI;
612
+ var _this$state$cardPrevi = _this.state.cardPreview,
613
+ _this$state$cardPrevi2 = _this$state$cardPrevi === void 0 ? {} : _this$state$cardPrevi,
614
+ dataURI = _this$state$cardPrevi2.dataURI;
624
615
  return (0, _mediaClient2.isFileIdentifier)(identifier) && ssr === 'server' && /*#__PURE__*/_react.default.createElement(_globalScope.StoreSSRDataScript, {
625
616
  identifier: identifier,
626
617
  dataURI: dataURI,
@@ -21,7 +21,7 @@ var CardLoadingWithContext = function CardLoadingWithContext() {
21
21
  var MediaCard = (0, _reactLoadable.default)({
22
22
  loader: function loader() {
23
23
  return Promise.resolve().then(function () {
24
- return _interopRequireWildcard(require('./card'));
24
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-card" */'./card'));
25
25
  }).then(function (mod) {
26
26
  return mod.Card;
27
27
  });
@@ -33,7 +33,7 @@ var MediaCard = (0, _reactLoadable.default)({
33
33
  var MediaCardErrorBoundary = (0, _reactLoadable.default)({
34
34
  loader: function loader() {
35
35
  return Promise.resolve().then(function () {
36
- return _interopRequireWildcard(require('./media-card-analytics-error-boundary'));
36
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-card-error-boundary" */'./media-card-analytics-error-boundary'));
37
37
  }).then(function (mod) {
38
38
  return mod.default;
39
39
  });
@@ -45,7 +45,7 @@ var MediaCardErrorBoundary = (0, _reactLoadable.default)({
45
45
  var MediaCardWithMediaClient = (0, _reactLoadable.default)({
46
46
  loader: function loader() {
47
47
  return Promise.resolve().then(function () {
48
- return _interopRequireWildcard(require('@atlaskit/media-client'));
48
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client" */'@atlaskit/media-client'));
49
49
  });
50
50
  },
51
51
  loading: function loading() {
@@ -93,6 +93,8 @@ var CardViewBase = /*#__PURE__*/function (_React$Component) {
93
93
  });
94
94
  onImageError && onImageError(cardPreview);
95
95
  });
96
+ // If the dimensions.width is a percentage, we need to transform it
97
+ // into a pixel value in order to get the right breakpoints applied.
96
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "saveElementWidth", function () {
97
99
  var dimensions = _this.props.dimensions;
98
100
  if (!dimensions) {
@@ -358,9 +360,6 @@ var CardViewBase = /*#__PURE__*/function (_React$Component) {
358
360
  var width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || _cardDimensions.defaultImageCardDimensions.width;
359
361
  return (0, _styles.calcBreakpointSize)(parseInt("".concat(width), 10));
360
362
  }
361
-
362
- // If the dimensions.width is a percentage, we need to transform it
363
- // into a pixel value in order to get the right breakpoints applied.
364
363
  }, {
365
364
  key: "render",
366
365
  value: function render() {
@@ -465,10 +464,10 @@ var CardViewBase = /*#__PURE__*/function (_React$Component) {
465
464
  value: function renderImageRenderer() {
466
465
  var _this$props9 = this.props,
467
466
  cardPreview = _this$props9.cardPreview,
468
- _this$props9$metadata = _this$props9.metadata;
469
- _this$props9$metadata = _this$props9$metadata === void 0 ? {} : _this$props9$metadata;
470
- var _this$props9$metadata2 = _this$props9$metadata.mediaType,
471
- mediaType = _this$props9$metadata2 === void 0 ? 'unknown' : _this$props9$metadata2,
467
+ _this$props9$metadata = _this$props9.metadata,
468
+ _this$props9$metadata2 = _this$props9$metadata === void 0 ? {} : _this$props9$metadata,
469
+ _this$props9$metadata3 = _this$props9$metadata2.mediaType,
470
+ mediaType = _this$props9$metadata3 === void 0 ? 'unknown' : _this$props9$metadata3,
472
471
  alt = _this$props9.alt,
473
472
  resizeMode = _this$props9.resizeMode,
474
473
  onDisplayImage = _this$props9.onDisplayImage,