@atlaskit/media-card 72.1.0 → 73.2.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 (165) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/dist/cjs/actions.js +2 -2
  3. package/dist/cjs/errors.js +11 -7
  4. package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
  5. package/dist/cjs/files/cardImageView/index.js +52 -42
  6. package/dist/cjs/files/cardImageView/styled.js +1 -1
  7. package/dist/cjs/index.js +8 -8
  8. package/dist/cjs/root/card/cardAnalytics.js +2 -2
  9. package/dist/cjs/root/card/cardState.js +2 -2
  10. package/dist/cjs/root/card/getCardPreview/cache.js +5 -5
  11. package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +4 -1
  12. package/dist/cjs/root/card/getCardPreview/helpers.js +1 -1
  13. package/dist/cjs/root/card/getCardPreview/index.js +18 -9
  14. package/dist/cjs/root/card/getCardStatus.js +1 -1
  15. package/dist/cjs/root/card/index.js +279 -159
  16. package/dist/cjs/root/cardView.js +130 -118
  17. package/dist/cjs/root/inline/loader.js +45 -14
  18. package/dist/cjs/root/inline/mediaInlineCard.js +24 -9
  19. package/dist/cjs/root/inlinePlayer.js +80 -25
  20. package/dist/cjs/root/styled.js +7 -3
  21. package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
  22. package/dist/cjs/root/ui/blanket/styled.js +1 -1
  23. package/dist/cjs/root/ui/common.js +1 -1
  24. package/dist/cjs/root/ui/iconMessage/index.js +5 -3
  25. package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
  26. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +14 -6
  27. package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +4 -2
  28. package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
  29. package/dist/cjs/root/ui/playButton/styled.js +1 -1
  30. package/dist/cjs/root/ui/progressBar/progressBar.js +5 -2
  31. package/dist/cjs/root/ui/progressBar/styled.js +7 -6
  32. package/dist/cjs/root/ui/styled.js +6 -6
  33. package/dist/cjs/root/ui/tickBox/styled.js +1 -1
  34. package/dist/cjs/root/ui/titleBox/failedTitleBox.js +4 -2
  35. package/dist/cjs/root/ui/titleBox/styled.js +1 -1
  36. package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
  37. package/dist/cjs/styles/index.js +25 -23
  38. package/dist/cjs/styles/mixins.js +1 -1
  39. package/dist/cjs/types.js +10 -1
  40. package/dist/cjs/utils/analytics.js +24 -7
  41. package/dist/cjs/utils/breakpoint.js +1 -1
  42. package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +3 -1
  43. package/dist/cjs/utils/cardActions/index.js +10 -10
  44. package/dist/cjs/utils/cardActions/styled.js +1 -1
  45. package/dist/cjs/utils/cardDimensions.js +1 -1
  46. package/dist/cjs/utils/dimensionComparer.js +7 -13
  47. package/dist/cjs/utils/getErrorMessage.js +2 -2
  48. package/dist/cjs/utils/getMediaCardCursor.js +29 -0
  49. package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
  50. package/dist/cjs/utils/globalScope/globalScope.js +94 -0
  51. package/dist/cjs/utils/globalScope/index.js +39 -0
  52. package/dist/cjs/utils/globalScope/types.js +5 -0
  53. package/dist/cjs/utils/index.js +46 -46
  54. package/dist/cjs/utils/lightCards/styled.js +1 -1
  55. package/dist/cjs/utils/objectURLCache.js +1 -1
  56. package/dist/cjs/utils/printScript.js +44 -0
  57. package/dist/cjs/utils/viewportDetector.js +49 -22
  58. package/dist/cjs/version.json +1 -1
  59. package/dist/es2019/files/cardImageView/index.js +19 -5
  60. package/dist/es2019/root/card/cardAnalytics.js +1 -1
  61. package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +4 -1
  62. package/dist/es2019/root/card/getCardPreview/index.js +1 -0
  63. package/dist/es2019/root/card/index.js +150 -49
  64. package/dist/es2019/root/cardView.js +40 -30
  65. package/dist/es2019/root/inline/loader.js +15 -4
  66. package/dist/es2019/root/inline/mediaInlineCard.js +23 -8
  67. package/dist/es2019/root/inlinePlayer.js +59 -5
  68. package/dist/es2019/root/styled.js +2 -1
  69. package/dist/es2019/root/ui/iconMessage/index.js +3 -2
  70. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +14 -6
  71. package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +3 -2
  72. package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
  73. package/dist/es2019/root/ui/progressBar/progressBar.js +4 -2
  74. package/dist/es2019/root/ui/progressBar/styled.js +6 -4
  75. package/dist/es2019/root/ui/styled.js +5 -5
  76. package/dist/es2019/root/ui/titleBox/failedTitleBox.js +3 -2
  77. package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
  78. package/dist/es2019/types.js +7 -1
  79. package/dist/es2019/utils/analytics.js +8 -3
  80. package/dist/es2019/utils/dimensionComparer.js +6 -13
  81. package/dist/es2019/utils/getErrorMessage.js +1 -1
  82. package/dist/es2019/utils/getMediaCardCursor.js +19 -0
  83. package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
  84. package/dist/es2019/utils/globalScope/globalScope.js +62 -0
  85. package/dist/es2019/utils/globalScope/index.js +2 -0
  86. package/dist/es2019/utils/globalScope/types.js +1 -0
  87. package/dist/es2019/utils/printScript.js +19 -0
  88. package/dist/es2019/utils/viewportDetector.js +48 -18
  89. package/dist/es2019/version.json +1 -1
  90. package/dist/esm/actions.js +2 -2
  91. package/dist/esm/errors.js +6 -5
  92. package/dist/esm/files/cardImageView/index.js +53 -41
  93. package/dist/esm/root/card/cardAnalytics.js +1 -1
  94. package/dist/esm/root/card/cardState.js +2 -2
  95. package/dist/esm/root/card/getCardPreview/cache.js +3 -2
  96. package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +4 -1
  97. package/dist/esm/root/card/getCardPreview/index.js +5 -2
  98. package/dist/esm/root/card/index.js +266 -145
  99. package/dist/esm/root/cardView.js +128 -117
  100. package/dist/esm/root/inline/loader.js +46 -14
  101. package/dist/esm/root/inline/mediaInlineCard.js +23 -8
  102. package/dist/esm/root/inlinePlayer.js +77 -24
  103. package/dist/esm/root/styled.js +3 -2
  104. package/dist/esm/root/ui/iconMessage/index.js +3 -2
  105. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +14 -6
  106. package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +3 -2
  107. package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
  108. package/dist/esm/root/ui/progressBar/progressBar.js +5 -2
  109. package/dist/esm/root/ui/progressBar/styled.js +6 -5
  110. package/dist/esm/root/ui/styled.js +5 -5
  111. package/dist/esm/root/ui/titleBox/failedTitleBox.js +3 -2
  112. package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
  113. package/dist/esm/types.js +7 -1
  114. package/dist/esm/utils/analytics.js +17 -6
  115. package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +2 -1
  116. package/dist/esm/utils/dimensionComparer.js +8 -13
  117. package/dist/esm/utils/getErrorMessage.js +1 -1
  118. package/dist/esm/utils/getMediaCardCursor.js +19 -0
  119. package/dist/esm/utils/globalScope/getSSRData.js +10 -0
  120. package/dist/esm/utils/globalScope/globalScope.js +69 -0
  121. package/dist/esm/utils/globalScope/index.js +2 -0
  122. package/dist/esm/utils/globalScope/types.js +1 -0
  123. package/dist/esm/utils/printScript.js +30 -0
  124. package/dist/esm/utils/viewportDetector.js +48 -21
  125. package/dist/esm/version.json +1 -1
  126. package/dist/types/errors.d.ts +1 -1
  127. package/dist/types/files/cardImageView/index.d.ts +6 -2
  128. package/dist/types/index.d.ts +1 -0
  129. package/dist/types/root/card/cardLoader.d.ts +2 -2
  130. package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
  131. package/dist/types/root/card/index.d.ts +10 -9
  132. package/dist/types/root/cardView.d.ts +10 -8
  133. package/dist/types/root/inline/loader.d.ts +2 -0
  134. package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
  135. package/dist/types/root/inlinePlayer.d.ts +10 -1
  136. package/dist/types/root/styled.d.ts +1 -0
  137. package/dist/types/root/ui/iconMessage/index.d.ts +2 -2
  138. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +4 -4
  139. package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +1 -0
  140. package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
  141. package/dist/types/root/ui/progressBar/progressBar.d.ts +3 -1
  142. package/dist/types/root/ui/progressBar/styled.d.ts +2 -1
  143. package/dist/types/root/ui/styled.d.ts +2 -1
  144. package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
  145. package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +2 -2
  146. package/dist/types/root/ui/titleBox/titleBox.d.ts +1 -9
  147. package/dist/types/types.d.ts +6 -1
  148. package/dist/types/utils/analytics.d.ts +6 -0
  149. package/dist/types/utils/getErrorMessage.d.ts +1 -0
  150. package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
  151. package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
  152. package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
  153. package/dist/types/utils/globalScope/index.d.ts +4 -0
  154. package/dist/types/utils/globalScope/types.d.ts +8 -0
  155. package/dist/types/utils/printScript.d.ts +2 -0
  156. package/dist/types/utils/viewportDetector.d.ts +13 -5
  157. package/package.json +14 -16
  158. package/dist/cjs/utils/lazyContent/index.js +0 -56
  159. package/dist/cjs/utils/lazyContent/styled.js +0 -23
  160. package/dist/es2019/utils/lazyContent/index.js +0 -18
  161. package/dist/es2019/utils/lazyContent/styled.js +0 -12
  162. package/dist/esm/utils/lazyContent/index.js +0 -41
  163. package/dist/esm/utils/lazyContent/styled.js +0 -14
  164. package/dist/types/utils/lazyContent/index.d.ts +0 -11
  165. package/dist/types/utils/lazyContent/styled.d.ts +0 -5
@@ -9,15 +9,15 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
11
 
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
+ 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; }
13
13
 
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
15
 
16
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
17
17
 
18
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; } }
19
19
 
20
- import React, { Component } from 'react';
20
+ import React, { Component, createRef } from 'react';
21
21
  import ReactDOM from 'react-dom';
22
22
  import { version as packageVersion, name as packageName } from '../../version.json';
23
23
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -25,18 +25,23 @@ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
25
25
  import DownloadIcon from '@atlaskit/icon/glyph/download';
26
26
  import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
27
27
  import { MediaViewer } from '@atlaskit/media-viewer';
28
- import { IntlProvider, intlShape } from 'react-intl';
28
+ import { injectIntl, IntlProvider } from 'react-intl-next';
29
29
  import { CardView } from '../cardView';
30
- import { ViewportDetector } from '../../utils/viewportDetector';
30
+ import { ABS_VIEWPORT_ANCHOR_OFFSET_TOP, ViewportDetector, ViewportAnchor } from '../../utils/viewportDetector';
31
31
  import { getRequestedDimensions } from '../../utils/getDataURIDimension';
32
- import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, fetchAndCacheRemotePreview } from './getCardPreview';
32
+ import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, isSSRDataPreview, fetchAndCacheRemotePreview } from './getCardPreview';
33
33
  import { getFileDetails } from '../../utils/metadata';
34
34
  import { InlinePlayer } from '../inlinePlayer';
35
- import { getFileAttributes } from '../../utils/analytics';
35
+ import { getFileAttributes, extractErrorInfo } from '../../utils/analytics';
36
36
  import { isLocalPreviewError, MediaCardError, ensureMediaCardError, ImageLoadError } from '../../errors';
37
37
  import { fireOperationalEvent as _fireOperationalEvent, fireCommencedEvent as _fireCommencedEvent, relevantFeatureFlagNames, fireCopiedEvent, fireScreenEvent } from './cardAnalytics';
38
38
  import getDocument from '../../utils/document';
39
+ import { StoreSSRDataScript, getSSRData } from '../../utils/globalScope';
39
40
  import { getCardStateFromFileState, createStateUpdater } from './cardState';
41
+ import { isProcessedFileState } from '@atlaskit/media-client';
42
+ import { getMediaFeatureFlag } from '@atlaskit/media-common';
43
+ import { isBigger } from '../../utils/dimensionComparer';
44
+ import { getMediaCardCursor } from '../../utils/getMediaCardCursor';
40
45
  export var CardBase = /*#__PURE__*/function (_Component) {
41
46
  _inherits(CardBase, _Component);
42
47
 
@@ -53,6 +58,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
53
58
 
54
59
  _defineProperty(_assertThisInitialized(_this), "hasBeenMounted", false);
55
60
 
61
+ _defineProperty(_assertThisInitialized(_this), "viewportPreAnchorRef", /*#__PURE__*/createRef());
62
+
63
+ _defineProperty(_assertThisInitialized(_this), "viewportPostAnchorRef", /*#__PURE__*/createRef());
64
+
56
65
  _defineProperty(_assertThisInitialized(_this), "timeElapsedTillCommenced", performance.now());
57
66
 
58
67
  _defineProperty(_assertThisInitialized(_this), "getImageURLParams", function (_ref) {
@@ -121,27 +130,18 @@ export var CardBase = /*#__PURE__*/function (_Component) {
121
130
  });
122
131
  });
123
132
 
124
- _defineProperty(_assertThisInitialized(_this), "resolveSSRPreview", function (identifier, ssr) {
125
- var mediaClient = _this.props.mediaClient;
126
-
127
- try {
128
- return getSSRCardPreview(ssr, mediaClient, identifier.id, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier));
129
- } catch (e) {// TODO: log SSR reliability 'failed'
130
- // https://product-fabric.atlassian.net/browse/MEX-770
131
- }
132
- });
133
+ _defineProperty(_assertThisInitialized(_this), "refetchSSRPreview", /*#__PURE__*/function () {
134
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(identifier) {
135
+ var _this$props4, mediaClient, _this$props4$dimensio, dimensions, cardPreview;
133
136
 
134
- _defineProperty(_assertThisInitialized(_this), "resolvePreview", /*#__PURE__*/function () {
135
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(identifier, fileState) {
136
- var params, cardPreview, wrappedError;
137
137
  return _regeneratorRuntime.wrap(function _callee$(_context) {
138
138
  while (1) {
139
139
  switch (_context.prev = _context.next) {
140
140
  case 0:
141
- _context.prev = 0;
142
- params = _this.getCardPreviewParams(identifier, fileState);
141
+ _this$props4 = _this.props, mediaClient = _this$props4.mediaClient, _this$props4$dimensio = _this$props4.dimensions, dimensions = _this$props4$dimensio === void 0 ? {} : _this$props4$dimensio;
142
+ _context.prev = 1;
143
143
  _context.next = 4;
144
- return getCardPreview(params);
144
+ return fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier));
145
145
 
146
146
  case 4:
147
147
  cardPreview = _context.sent;
@@ -150,13 +150,52 @@ export var CardBase = /*#__PURE__*/function (_Component) {
150
150
  cardPreview: cardPreview
151
151
  });
152
152
 
153
- _context.next = 12;
153
+ _context.next = 10;
154
154
  break;
155
155
 
156
156
  case 8:
157
157
  _context.prev = 8;
158
- _context.t0 = _context["catch"](0);
159
- wrappedError = ensureMediaCardError('preview-fetch', _context.t0); // If remote preview fails, we set status 'error'
158
+ _context.t0 = _context["catch"](1);
159
+
160
+ case 10:
161
+ case "end":
162
+ return _context.stop();
163
+ }
164
+ }
165
+ }, _callee, null, [[1, 8]]);
166
+ }));
167
+
168
+ return function (_x) {
169
+ return _ref2.apply(this, arguments);
170
+ };
171
+ }());
172
+
173
+ _defineProperty(_assertThisInitialized(_this), "resolvePreview", /*#__PURE__*/function () {
174
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(identifier, fileState) {
175
+ var params, cardPreview, wrappedError;
176
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
177
+ while (1) {
178
+ switch (_context2.prev = _context2.next) {
179
+ case 0:
180
+ _context2.prev = 0;
181
+ params = _this.getCardPreviewParams(identifier, fileState);
182
+ _context2.next = 4;
183
+ return getCardPreview(params);
184
+
185
+ case 4:
186
+ cardPreview = _context2.sent;
187
+
188
+ _this.safeSetState({
189
+ cardPreview: cardPreview
190
+ });
191
+
192
+ _context2.next = 12;
193
+ break;
194
+
195
+ case 8:
196
+ _context2.prev = 8;
197
+ _context2.t0 = _context2["catch"](0);
198
+ wrappedError = ensureMediaCardError('preview-fetch', _context2.t0); // If remote preview fails, we set status 'error'
160
199
  // If local preview fails (i.e, no remote preview available),
161
200
  // we can stay in the same status until there is a remote preview available
162
201
  // If it's any other error we set status 'error'
@@ -174,14 +213,14 @@ export var CardBase = /*#__PURE__*/function (_Component) {
174
213
 
175
214
  case 12:
176
215
  case "end":
177
- return _context.stop();
216
+ return _context2.stop();
178
217
  }
179
218
  }
180
- }, _callee, null, [[0, 8]]);
219
+ }, _callee2, null, [[0, 8]]);
181
220
  }));
182
221
 
183
- return function (_x, _x2) {
184
- return _ref2.apply(this, arguments);
222
+ return function (_x2, _x3) {
223
+ return _ref3.apply(this, arguments);
185
224
  };
186
225
  }());
187
226
 
@@ -199,11 +238,16 @@ export var CardBase = /*#__PURE__*/function (_Component) {
199
238
  };
200
239
  });
201
240
 
202
- _defineProperty(_assertThisInitialized(_this), "onImageError", function () {
203
- var cardPreview = _this.state.cardPreview;
241
+ _defineProperty(_assertThisInitialized(_this), "onImageError", function (cardPreview) {
242
+ var currentPreview = _this.state.cardPreview; // If the dataURI has been replaced, we can dismiss this error
243
+
244
+ if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
245
+ return;
246
+ }
247
+
204
248
  var error = new ImageLoadError(cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source);
205
249
  var isLocal = cardPreview && isLocalPreview(cardPreview);
206
- var isSSR = cardPreview && isSSRClientPreview(cardPreview);
250
+ var isSSR = cardPreview && (isSSRClientPreview(cardPreview) || isSSRDataPreview(cardPreview));
207
251
 
208
252
  if (isLocal || isSSR) {
209
253
  var updateState = {
@@ -220,10 +264,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
220
264
  // https://product-fabric.atlassian.net/browse/MEX-770
221
265
  }
222
266
 
223
- var _this$props4 = _this.props,
224
- identifier = _this$props4.identifier,
225
- _this$props4$dimensio = _this$props4.dimensions,
226
- dimensions = _this$props4$dimensio === void 0 ? {} : _this$props4$dimensio;
267
+ var _this$props5 = _this.props,
268
+ identifier = _this$props5.identifier,
269
+ _this$props5$dimensio = _this$props5.dimensions,
270
+ dimensions = _this$props5$dimensio === void 0 ? {} : _this$props5$dimensio;
227
271
  isFileIdentifier(identifier) && removeCardPreviewFromCache(identifier.id, dimensions);
228
272
 
229
273
  _this.safeSetState(updateState);
@@ -235,7 +279,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
235
279
  }
236
280
  });
237
281
 
238
- _defineProperty(_assertThisInitialized(_this), "onImageLoad", function () {
282
+ _defineProperty(_assertThisInitialized(_this), "onImageLoad", function (cardPreview) {
283
+ var currentPreview = _this.state.cardPreview; // If the dataURI has been replaced, we can dismiss this callback
284
+
285
+ if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
286
+ return;
287
+ }
288
+
239
289
  _this.safeSetState({
240
290
  previewDidRender: true
241
291
  });
@@ -281,10 +331,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
281
331
  });
282
332
 
283
333
  _defineProperty(_assertThisInitialized(_this), "onCardViewClick", function (event, analyticsEvent) {
284
- var _this$props5 = _this.props,
285
- identifier = _this$props5.identifier,
286
- useInlinePlayer = _this$props5.useInlinePlayer,
287
- shouldOpenMediaViewer = _this$props5.shouldOpenMediaViewer;
334
+ var _this$props6 = _this.props,
335
+ identifier = _this$props6.identifier,
336
+ useInlinePlayer = _this$props6.useInlinePlayer,
337
+ shouldOpenMediaViewer = _this$props6.shouldOpenMediaViewer;
288
338
  var cardPreview = _this.state.cardPreview;
289
339
 
290
340
  var _assertThisInitialize2 = _assertThisInitialized(_this),
@@ -300,7 +350,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
300
350
 
301
351
  if (useInlinePlayer && isVideo && !!cardPreview) {
302
352
  _this.setState({
303
- isPlayingFile: true
353
+ isPlayingFile: true,
354
+ shouldAutoplay: true
304
355
  });
305
356
  } else if (shouldOpenMediaViewer) {
306
357
  var mediaViewerSelectedItem;
@@ -339,23 +390,28 @@ export var CardBase = /*#__PURE__*/function (_Component) {
339
390
  });
340
391
 
341
392
  _defineProperty(_assertThisInitialized(_this), "renderInlinePlayer", function () {
342
- var _this$props6 = _this.props,
343
- identifier = _this$props6.identifier,
344
- mediaClient = _this$props6.mediaClient,
345
- dimensions = _this$props6.dimensions,
346
- selected = _this$props6.selected,
347
- testId = _this$props6.testId,
348
- originalDimensions = _this$props6.originalDimensions;
393
+ var _this$props7 = _this.props,
394
+ identifier = _this$props7.identifier,
395
+ mediaClient = _this$props7.mediaClient,
396
+ dimensions = _this$props7.dimensions,
397
+ selected = _this$props7.selected,
398
+ testId = _this$props7.testId,
399
+ originalDimensions = _this$props7.originalDimensions;
400
+ var _this$state = _this.state,
401
+ shouldAutoplay = _this$state.shouldAutoplay,
402
+ cardPreview = _this$state.cardPreview;
349
403
  return /*#__PURE__*/React.createElement(InlinePlayer, {
350
404
  mediaClient: mediaClient,
351
405
  dimensions: dimensions,
352
406
  originalDimensions: originalDimensions,
353
407
  identifier: identifier,
408
+ autoplay: !!shouldAutoplay,
354
409
  onError: _this.onInlinePlayerError,
355
410
  onClick: _this.onClick,
356
411
  selected: selected,
357
412
  ref: _this.setRef,
358
- testId: testId
413
+ testId: testId,
414
+ cardPreview: cardPreview
359
415
  });
360
416
  });
361
417
 
@@ -388,12 +444,12 @@ export var CardBase = /*#__PURE__*/function (_Component) {
388
444
 
389
445
  _defineProperty(_assertThisInitialized(_this), "renderMediaViewer", function () {
390
446
  var mediaViewerSelectedItem = _this.state.mediaViewerSelectedItem;
391
- var _this$props7 = _this.props,
392
- mediaClient = _this$props7.mediaClient,
393
- identifier = _this$props7.identifier,
394
- mediaViewerDataSource = _this$props7.mediaViewerDataSource,
395
- contextId = _this$props7.contextId,
396
- featureFlags = _this$props7.featureFlags;
447
+ var _this$props8 = _this.props,
448
+ mediaClient = _this$props8.mediaClient,
449
+ identifier = _this$props8.identifier,
450
+ mediaViewerDataSource = _this$props8.mediaViewerDataSource,
451
+ contextId = _this$props8.contextId,
452
+ featureFlags = _this$props8.featureFlags;
397
453
 
398
454
  if (!mediaViewerSelectedItem) {
399
455
  return;
@@ -415,35 +471,31 @@ export var CardBase = /*#__PURE__*/function (_Component) {
415
471
  });
416
472
 
417
473
  _defineProperty(_assertThisInitialized(_this), "renderCard", function () {
418
- var _this$props8 = _this.props,
419
- identifier = _this$props8.identifier,
420
- isLazy = _this$props8.isLazy,
421
- appearance = _this$props8.appearance,
422
- resizeMode = _this$props8.resizeMode,
423
- dimensions = _this$props8.dimensions,
424
- selectable = _this$props8.selectable,
425
- selected = _this$props8.selected,
426
- disableOverlay = _this$props8.disableOverlay,
427
- alt = _this$props8.alt,
428
- testId = _this$props8.testId,
429
- featureFlags = _this$props8.featureFlags,
430
- titleBoxBgColor = _this$props8.titleBoxBgColor,
431
- titleBoxIcon = _this$props8.titleBoxIcon,
432
- ssr = _this$props8.ssr;
474
+ var _this$props9 = _this.props,
475
+ identifier = _this$props9.identifier,
476
+ isLazy = _this$props9.isLazy,
477
+ appearance = _this$props9.appearance,
478
+ resizeMode = _this$props9.resizeMode,
479
+ dimensions = _this$props9.dimensions,
480
+ selectable = _this$props9.selectable,
481
+ selected = _this$props9.selected,
482
+ disableOverlay = _this$props9.disableOverlay,
483
+ alt = _this$props9.alt,
484
+ testId = _this$props9.testId,
485
+ featureFlags = _this$props9.featureFlags,
486
+ titleBoxBgColor = _this$props9.titleBoxBgColor,
487
+ titleBoxIcon = _this$props9.titleBoxIcon,
488
+ ssr = _this$props9.ssr,
489
+ useInlinePlayer = _this$props9.useInlinePlayer,
490
+ shouldOpenMediaViewer = _this$props9.shouldOpenMediaViewer;
433
491
  var mediaItemType = identifier.mediaItemType;
434
- var _this$state = _this.state,
435
- status = _this$state.status,
436
- progress = _this$state.progress,
437
- _this$state$cardPrevi = _this$state.cardPreview;
438
- _this$state$cardPrevi = _this$state$cardPrevi === void 0 ? {
439
- dataURI: undefined,
440
- orientation: 1
441
- } : _this$state$cardPrevi;
442
- var dataURI = _this$state$cardPrevi.dataURI,
443
- orientation = _this$state$cardPrevi.orientation,
444
- error = _this$state.error,
445
- cardRef = _this$state.cardRef,
446
- isCardVisible = _this$state.isCardVisible;
492
+ var _this$state2 = _this.state,
493
+ status = _this$state2.status,
494
+ progress = _this$state2.progress,
495
+ cardPreview = _this$state2.cardPreview,
496
+ error = _this$state2.error,
497
+ cardRef = _this$state2.cardRef,
498
+ isCardVisible = _this$state2.isCardVisible;
447
499
 
448
500
  var _assertThisInitialize3 = _assertThisInitialized(_this),
449
501
  metadata = _assertThisInitialize3.metadata;
@@ -459,12 +511,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
459
511
  var nativeLazyLoad = isLazy && !isCardVisible; // Force Media Image to always display img for SSR
460
512
 
461
513
  var forceSyncDisplay = !!ssr;
514
+ var mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, status === 'error' || status === 'failed-processing', !!_this.state.cardPreview, metadata.mediaType);
462
515
  var card = /*#__PURE__*/React.createElement(CardView, {
463
516
  status: status,
464
517
  error: error,
465
518
  mediaItemType: mediaItemType,
466
519
  metadata: metadata,
467
- dataURI: dataURI,
520
+ cardPreview: cardPreview,
468
521
  alt: alt,
469
522
  appearance: appearance,
470
523
  resizeMode: resizeMode,
@@ -477,7 +530,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
477
530
  disableOverlay: disableOverlay,
478
531
  progress: progress,
479
532
  onDisplayImage: onDisplayImage,
480
- previewOrientation: orientation,
481
533
  innerRef: _this.setRef,
482
534
  testId: testId,
483
535
  featureFlags: featureFlags,
@@ -486,12 +538,39 @@ export var CardBase = /*#__PURE__*/function (_Component) {
486
538
  onImageError: _this.onImageError,
487
539
  onImageLoad: _this.onImageLoad,
488
540
  nativeLazyLoad: nativeLazyLoad,
489
- forceSyncDisplay: forceSyncDisplay
541
+ forceSyncDisplay: forceSyncDisplay,
542
+ mediaCardCursor: mediaCardCursor
490
543
  });
491
544
  return isLazy ? /*#__PURE__*/React.createElement(ViewportDetector, {
492
- targetRef: cardRef,
545
+ cardEl: cardRef,
546
+ preAnchorRef: _this.viewportPreAnchorRef,
547
+ postAnchorRef: _this.viewportPostAnchorRef,
493
548
  onVisible: _this.onCardInViewport
494
- }, card) : card;
549
+ }, /*#__PURE__*/React.createElement(ViewportAnchor, {
550
+ ref: _this.viewportPreAnchorRef,
551
+ offsetTop: -ABS_VIEWPORT_ANCHOR_OFFSET_TOP
552
+ }), card, /*#__PURE__*/React.createElement(ViewportAnchor, {
553
+ ref: _this.viewportPostAnchorRef,
554
+ offsetTop: ABS_VIEWPORT_ANCHOR_OFFSET_TOP
555
+ })) : card;
556
+ });
557
+
558
+ _defineProperty(_assertThisInitialized(_this), "storeSSRData", function () {
559
+ var _this$props10 = _this.props,
560
+ ssr = _this$props10.ssr,
561
+ identifier = _this$props10.identifier;
562
+ var _this$state3 = _this.state,
563
+ _this$state3$cardPrev = _this$state3.cardPreview;
564
+ _this$state3$cardPrev = _this$state3$cardPrev === void 0 ? {} : _this$state3$cardPrev;
565
+ var dataURI = _this$state3$cardPrev.dataURI,
566
+ error = _this$state3.error;
567
+ var ssrDataError = !!error ? extractErrorInfo(error) : undefined;
568
+ return isFileIdentifier(identifier) && ssr === 'server' && /*#__PURE__*/React.createElement(StoreSSRDataScript, {
569
+ identifier: identifier,
570
+ dataURI: dataURI,
571
+ dimensions: _this.requestedDimensions,
572
+ error: ssrDataError
573
+ });
495
574
  });
496
575
 
497
576
  _defineProperty(_assertThisInitialized(_this), "onCardInViewport", function () {
@@ -534,20 +613,40 @@ export var CardBase = /*#__PURE__*/function (_Component) {
534
613
 
535
614
  var _cardPreview;
536
615
 
537
- var _this$props9 = _this.props,
538
- _identifier = _this$props9.identifier,
539
- _this$props9$dimensio = _this$props9.dimensions,
540
- _dimensions = _this$props9$dimensio === void 0 ? {} : _this$props9$dimensio,
541
- _ssr = _this$props9.ssr;
616
+ var _error;
617
+
618
+ var _this$props11 = _this.props,
619
+ _identifier = _this$props11.identifier,
620
+ _this$props11$dimensi = _this$props11.dimensions,
621
+ _dimensions = _this$props11$dimensi === void 0 ? {} : _this$props11$dimensi,
622
+ _ssr = _this$props11.ssr,
623
+ _mediaClient = _this$props11.mediaClient;
542
624
 
543
625
  if (isFileIdentifier(_identifier)) {
544
626
  var id = _identifier.id;
545
627
  _cardPreview = getCardPreviewFromCache(id, _dimensions);
546
628
 
547
629
  if (!_cardPreview && _ssr) {
548
- _this.fireCommencedEvent();
549
-
550
- _cardPreview = _this.resolveSSRPreview(_identifier, _ssr);
630
+ var _this$ssrData;
631
+
632
+ _this.ssrData = getSSRData(_identifier);
633
+
634
+ if (_ssr === 'server' || !((_this$ssrData = _this.ssrData) !== null && _this$ssrData !== void 0 && _this$ssrData.dataURI)) {
635
+ try {
636
+ _cardPreview = getSSRCardPreview(_ssr, _mediaClient, _identifier.id, _this.getImageURLParams(_identifier), _this.getMediaBlobUrlAttrs(_identifier));
637
+ } catch (e) {
638
+ // TODO: handle error in client MEX-770
639
+ // If we fail building the dataURI in server, we store the error in the state
640
+ // to be later stored in global scope and logged in client.
641
+ // We don't set the status = error to fall back to the spinner icon
642
+ _error = _ssr === 'server' ? e : undefined;
643
+ }
644
+ } else {
645
+ _cardPreview = {
646
+ dataURI: _this.ssrData.dataURI,
647
+ source: 'ssr-data'
648
+ };
649
+ }
551
650
  }
552
651
  } else if (isExternalImageIdentifier(_identifier)) {
553
652
  _this.fireCommencedEvent();
@@ -571,10 +670,12 @@ export var CardBase = /*#__PURE__*/function (_Component) {
571
670
  status: _status,
572
671
  isCardVisible: _isCardVisible,
573
672
  isPlayingFile: false,
673
+ shouldAutoplay: false,
574
674
  cardPreview: _cardPreview,
575
675
  cardRef: null,
576
676
  isBannedLocalPreview: false,
577
- previewDidRender: false
677
+ previewDidRender: false,
678
+ error: _error
578
679
  };
579
680
  return _this;
580
681
  }
@@ -583,21 +684,32 @@ export var CardBase = /*#__PURE__*/function (_Component) {
583
684
  key: "componentDidMount",
584
685
  value: function componentDidMount() {
585
686
  this.hasBeenMounted = true;
586
- var _this$state2 = this.state,
587
- isCardVisible = _this$state2.isCardVisible,
588
- cardPreview = _this$state2.cardPreview;
589
- var _this$props10 = this.props,
590
- identifier = _this$props10.identifier,
591
- ssr = _this$props10.ssr;
687
+ var _this$state4 = this.state,
688
+ isCardVisible = _this$state4.isCardVisible,
689
+ cardPreview = _this$state4.cardPreview;
690
+ var _this$props12 = this.props,
691
+ identifier = _this$props12.identifier,
692
+ ssr = _this$props12.ssr,
693
+ dimensions = _this$props12.dimensions;
592
694
 
593
695
  if (isCardVisible && isFileIdentifier(identifier)) {
594
696
  this.updateStateForIdentifier(identifier);
595
697
  }
596
698
 
597
- if (isCardVisible && !!ssr && !!cardPreview && isSSRClientPreview(cardPreview) && isFileIdentifier(identifier)) {
598
- // Since the SSR preview brings the token in the query params,
599
- // We need to fetch the remote preview to be able to cache it,
600
- this.setCacheSSRPreview(identifier);
699
+ if (isCardVisible && !!ssr && !!cardPreview && isFileIdentifier(identifier)) {
700
+ var _this$ssrData2;
701
+
702
+ if (isSSRClientPreview(cardPreview)) {
703
+ // Since the SSR preview brings the token in the query params,
704
+ // We need to fetch the remote preview to be able to cache it,
705
+ this.setCacheSSRPreview(identifier);
706
+ }
707
+
708
+ if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData2 = this.ssrData) === null || _this$ssrData2 === void 0 ? void 0 : _this$ssrData2.dimensions, dimensions)) {
709
+ // If dimensions from Server have changed and are bigger,
710
+ // we need to refetch
711
+ this.refetchSSRPreview(identifier);
712
+ }
601
713
  } // we add a listener for each of the cards on the page
602
714
  // and then check if the triggered listener is from the card
603
715
  // that contains a div in current window.getSelection()
@@ -613,18 +725,21 @@ export var CardBase = /*#__PURE__*/function (_Component) {
613
725
  prevIdentifier = prevProps.identifier,
614
726
  prevDimensions = prevProps.dimensions;
615
727
  var prevIsCardVisible = prevState.isCardVisible;
616
- var _this$props11 = this.props,
617
- mediaClient = _this$props11.mediaClient,
618
- identifier = _this$props11.identifier,
619
- dimensions = _this$props11.dimensions,
620
- featureFlags = _this$props11.featureFlags;
621
- var _this$state3 = this.state,
622
- isCardVisible = _this$state3.isCardVisible,
623
- cardPreview = _this$state3.cardPreview,
624
- status = _this$state3.status,
625
- fileState = _this$state3.fileState,
626
- isBannedLocalPreview = _this$state3.isBannedLocalPreview,
627
- previewDidRender = _this$state3.previewDidRender;
728
+ var _this$props13 = this.props,
729
+ mediaClient = _this$props13.mediaClient,
730
+ identifier = _this$props13.identifier,
731
+ dimensions = _this$props13.dimensions,
732
+ featureFlags = _this$props13.featureFlags,
733
+ useInlinePlayer = _this$props13.useInlinePlayer,
734
+ disableOverlay = _this$props13.disableOverlay;
735
+ var _this$state5 = this.state,
736
+ isCardVisible = _this$state5.isCardVisible,
737
+ cardPreview = _this$state5.cardPreview,
738
+ status = _this$state5.status,
739
+ fileState = _this$state5.fileState,
740
+ isBannedLocalPreview = _this$state5.isBannedLocalPreview,
741
+ previewDidRender = _this$state5.previewDidRender,
742
+ isPlayingFile = _this$state5.isPlayingFile;
628
743
  var isDifferent = isDifferentIdentifier(prevIdentifier, identifier);
629
744
  var turnedVisible = !prevIsCardVisible && isCardVisible;
630
745
  var isNewMediaClient = prevMediaClient !== mediaClient;
@@ -680,6 +795,15 @@ export var CardBase = /*#__PURE__*/function (_Component) {
680
795
  });
681
796
  this.unsubscribe();
682
797
  }
798
+
799
+ var isVideo = this.fileAttributes.fileMediatype === 'video';
800
+ var videoAvailableToPlay = fileState && isProcessedFileState(fileState);
801
+
802
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
803
+ this.setState({
804
+ isPlayingFile: true
805
+ });
806
+ }
683
807
  }
684
808
  }, {
685
809
  key: "componentWillUnmount",
@@ -731,8 +855,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
731
855
  get: function get() {
732
856
  var dimensions = this.props.dimensions;
733
857
 
734
- var _ref3 = this.state || {},
735
- element = _ref3.cardRef;
858
+ var _ref4 = this.state || {},
859
+ element = _ref4.cardRef;
736
860
 
737
861
  return getRequestedDimensions({
738
862
  dimensions: dimensions,
@@ -742,23 +866,23 @@ export var CardBase = /*#__PURE__*/function (_Component) {
742
866
  }, {
743
867
  key: "metadata",
744
868
  get: function get() {
745
- var _this$state4;
869
+ var _this$state6;
746
870
 
747
- return getFileDetails(this.props.identifier, (_this$state4 = this.state) === null || _this$state4 === void 0 ? void 0 : _this$state4.fileState);
871
+ return getFileDetails(this.props.identifier, (_this$state6 = this.state) === null || _this$state6 === void 0 ? void 0 : _this$state6.fileState);
748
872
  }
749
873
  }, {
750
874
  key: "fileAttributes",
751
875
  get: function get() {
752
- var _this$state5, _this$state5$fileStat;
876
+ var _this$state7, _this$state7$fileStat;
753
877
 
754
- return getFileAttributes(this.metadata, (_this$state5 = this.state) === null || _this$state5 === void 0 ? void 0 : (_this$state5$fileStat = _this$state5.fileState) === null || _this$state5$fileStat === void 0 ? void 0 : _this$state5$fileStat.status);
878
+ return getFileAttributes(this.metadata, (_this$state7 = this.state) === null || _this$state7 === void 0 ? void 0 : (_this$state7$fileStat = _this$state7.fileState) === null || _this$state7$fileStat === void 0 ? void 0 : _this$state7$fileStat.status);
755
879
  }
756
880
  }, {
757
881
  key: "fireOperationalEvent",
758
882
  value: function fireOperationalEvent() {
759
- var _this$state6 = this.state,
760
- status = _this$state6.status,
761
- error = _this$state6.error;
883
+ var _this$state8 = this.state,
884
+ status = _this$state8.status,
885
+ error = _this$state8.error;
762
886
  var createAnalyticsEvent = this.props.createAnalyticsEvent;
763
887
  createAnalyticsEvent && _fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), error);
764
888
  }
@@ -778,11 +902,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
778
902
  get: function get() {
779
903
  var _this3 = this;
780
904
 
781
- var _this$props12 = this.props,
782
- _this$props12$actions = _this$props12.actions,
783
- actions = _this$props12$actions === void 0 ? [] : _this$props12$actions,
784
- identifier = _this$props12.identifier,
785
- shouldEnableDownloadButton = _this$props12.shouldEnableDownloadButton;
905
+ var _this$props14 = this.props,
906
+ _this$props14$actions = _this$props14.actions,
907
+ actions = _this$props14$actions === void 0 ? [] : _this$props14$actions,
908
+ identifier = _this$props14.identifier,
909
+ shouldEnableDownloadButton = _this$props14.shouldEnableDownloadButton;
786
910
  var status = this.state.status;
787
911
  var metadata = this.metadata;
788
912
 
@@ -804,11 +928,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
804
928
  }, {
805
929
  key: "render",
806
930
  value: function render() {
807
- var _this$state7 = this.state,
808
- isPlayingFile = _this$state7.isPlayingFile,
809
- mediaViewerSelectedItem = _this$state7.mediaViewerSelectedItem;
810
- var innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null);
811
- return this.context.intl ? innerContent : /*#__PURE__*/React.createElement(IntlProvider, {
931
+ var _this$state9 = this.state,
932
+ isPlayingFile = _this$state9.isPlayingFile,
933
+ mediaViewerSelectedItem = _this$state9.mediaViewerSelectedItem;
934
+ var innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null, this.storeSSRData());
935
+ return this.props.intl ? innerContent : /*#__PURE__*/React.createElement(IntlProvider, {
812
936
  locale: "en"
813
937
  }, innerContent);
814
938
  }
@@ -826,11 +950,6 @@ _defineProperty(CardBase, "defaultProps", {
826
950
  featureFlags: {}
827
951
  });
828
952
 
829
- _defineProperty(CardBase, "contextTypes", {
830
- // Required to detect a parent IntlProvider
831
- intl: intlShape
832
- });
833
-
834
953
  export var Card = withMediaAnalyticsContext({
835
954
  packageVersion: packageVersion,
836
955
  packageName: packageName,
@@ -838,4 +957,6 @@ export var Card = withMediaAnalyticsContext({
838
957
  component: 'mediaCard'
839
958
  }, {
840
959
  filterFeatureFlags: relevantFeatureFlagNames
841
- })(withAnalyticsEvents()(CardBase));
960
+ })(withAnalyticsEvents()(injectIntl(CardBase, {
961
+ enforceContext: false
962
+ })));