@atlaskit/media-card 73.1.1 → 73.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/cjs/files/cardImageView/index.js +51 -41
  3. package/dist/cjs/root/card/cardAnalytics.js +4 -4
  4. package/dist/cjs/root/card/getCardPreview/index.js +7 -1
  5. package/dist/cjs/root/card/index.js +301 -155
  6. package/dist/cjs/root/cardView.js +127 -115
  7. package/dist/cjs/root/inlinePlayer.js +4 -2
  8. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +14 -6
  9. package/dist/cjs/root/ui/styled.js +5 -5
  10. package/dist/cjs/types.js +10 -1
  11. package/dist/cjs/utils/analytics.js +32 -13
  12. package/dist/cjs/utils/dimensionComparer.js +7 -13
  13. package/dist/cjs/utils/getMediaCardCursor.js +29 -0
  14. package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
  15. package/dist/cjs/utils/globalScope/globalScope.js +94 -0
  16. package/dist/cjs/utils/globalScope/index.js +39 -0
  17. package/dist/cjs/utils/globalScope/types.js +5 -0
  18. package/dist/cjs/utils/printScript.js +44 -0
  19. package/dist/cjs/utils/viewportDetector.js +1 -1
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/files/cardImageView/index.js +19 -5
  22. package/dist/es2019/root/card/cardAnalytics.js +4 -4
  23. package/dist/es2019/root/card/getCardPreview/index.js +1 -0
  24. package/dist/es2019/root/card/index.js +167 -40
  25. package/dist/es2019/root/cardView.js +40 -30
  26. package/dist/es2019/root/inlinePlayer.js +4 -2
  27. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +14 -6
  28. package/dist/es2019/root/ui/styled.js +4 -4
  29. package/dist/es2019/types.js +7 -1
  30. package/dist/es2019/utils/analytics.js +17 -9
  31. package/dist/es2019/utils/dimensionComparer.js +6 -13
  32. package/dist/es2019/utils/getMediaCardCursor.js +19 -0
  33. package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
  34. package/dist/es2019/utils/globalScope/globalScope.js +62 -0
  35. package/dist/es2019/utils/globalScope/index.js +2 -0
  36. package/dist/es2019/utils/globalScope/types.js +1 -0
  37. package/dist/es2019/utils/printScript.js +19 -0
  38. package/dist/es2019/utils/viewportDetector.js +1 -1
  39. package/dist/es2019/version.json +1 -1
  40. package/dist/esm/files/cardImageView/index.js +53 -41
  41. package/dist/esm/root/card/cardAnalytics.js +4 -4
  42. package/dist/esm/root/card/getCardPreview/index.js +3 -0
  43. package/dist/esm/root/card/index.js +284 -138
  44. package/dist/esm/root/cardView.js +126 -115
  45. package/dist/esm/root/inlinePlayer.js +4 -2
  46. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +14 -6
  47. package/dist/esm/root/ui/styled.js +5 -5
  48. package/dist/esm/types.js +7 -1
  49. package/dist/esm/utils/analytics.js +26 -12
  50. package/dist/esm/utils/dimensionComparer.js +8 -13
  51. package/dist/esm/utils/getMediaCardCursor.js +19 -0
  52. package/dist/esm/utils/globalScope/getSSRData.js +10 -0
  53. package/dist/esm/utils/globalScope/globalScope.js +69 -0
  54. package/dist/esm/utils/globalScope/index.js +2 -0
  55. package/dist/esm/utils/globalScope/types.js +1 -0
  56. package/dist/esm/utils/printScript.js +30 -0
  57. package/dist/esm/utils/viewportDetector.js +1 -1
  58. package/dist/esm/version.json +1 -1
  59. package/dist/types/__tests_external__/page-objects/MediaCard.d.ts +0 -1
  60. package/dist/types/errors.d.ts +1 -1
  61. package/dist/types/files/cardImageView/index.d.ts +6 -2
  62. package/dist/types/root/card/cardAnalytics.d.ts +2 -1
  63. package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
  64. package/dist/types/root/card/index.d.ts +5 -1
  65. package/dist/types/root/cardView.d.ts +8 -6
  66. package/dist/types/root/inlinePlayer.d.ts +3 -1
  67. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +4 -4
  68. package/dist/types/root/ui/styled.d.ts +2 -1
  69. package/dist/types/types.d.ts +6 -1
  70. package/dist/types/utils/analytics.d.ts +27 -5
  71. package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
  72. package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
  73. package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
  74. package/dist/types/utils/globalScope/index.d.ts +4 -0
  75. package/dist/types/utils/globalScope/types.d.ts +8 -0
  76. package/dist/types/utils/printScript.d.ts +2 -0
  77. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 73.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9671dfa12b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9671dfa12b1) - Revert [MEX-1276] fix vertical scroll for firefox when media link is wrapped
8
+
9
+ ## 73.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`7d8e24c4dcd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d8e24c4dcd) - Log reliability of Media Card SSR
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 73.2.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [`3ad0bbf0f93`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3ad0bbf0f93) - Log media ssr getImageURLSync error in global variable ssr data.
24
+ - [`1dcf16cb69e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1dcf16cb69e) - Reuse image url from server when hydrates and refetch if dimensions in client are bigger
25
+ - [`a5cabf7f670`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5cabf7f670) - Made InlinePlayer compatible with SSR
26
+
27
+ ### Patch Changes
28
+
29
+ - [`46cd0dfed6f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46cd0dfed6f) - Removed duplicated commenced event
30
+ - [`5571b079998`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5571b079998) - Added example using FileState Factory helper
31
+ - [`116ae9cd4fe`](https://bitbucket.org/atlassian/atlassian-frontend/commits/116ae9cd4fe) - Update SSR example with media single in stretchy-fit mode.
32
+ - [`42485996554`](https://bitbucket.org/atlassian/atlassian-frontend/commits/42485996554) - vr tests for ssr cases
33
+ - [`a31422c7a74`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a31422c7a74) - MEX-1194 introduce cursor states to media card
34
+ - [`af3fcc847ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af3fcc847ce) - Improved filestate simulations example
35
+ - [`8fd03048678`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8fd03048678) - Added example and test for media ssr usage in renderer
36
+ - Updated dependencies
37
+
3
38
  ## 73.1.1
4
39
 
5
40
  ### Patch Changes
@@ -180,18 +180,28 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
180
180
  size: "large"
181
181
  })));
182
182
  });
183
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderMediaImage", function () {
183
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onImageLoad", function () {
184
184
  var _this$props6 = _this.props,
185
- status = _this$props6.status,
186
- mediaItemType = _this$props6.mediaItemType,
187
- dataURI = _this$props6.dataURI,
188
- mediaType = _this$props6.mediaType,
189
- mimeType = _this$props6.mimeType,
190
- previewOrientation = _this$props6.previewOrientation,
191
- onDisplayImage = _this$props6.onDisplayImage,
192
- alt = _this$props6.alt,
193
185
  onImageLoad = _this$props6.onImageLoad,
194
- onImageError = _this$props6.onImageError;
186
+ cardPreview = _this$props6.cardPreview;
187
+ onImageLoad && onImageLoad(cardPreview);
188
+ });
189
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onImageError", function () {
190
+ var _this$props7 = _this.props,
191
+ onImageError = _this$props7.onImageError,
192
+ cardPreview = _this$props7.cardPreview;
193
+ onImageError && onImageError(cardPreview);
194
+ });
195
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderMediaImage", function () {
196
+ var _this$props8 = _this.props,
197
+ status = _this$props8.status,
198
+ mediaItemType = _this$props8.mediaItemType,
199
+ dataURI = _this$props8.dataURI,
200
+ mediaType = _this$props8.mediaType,
201
+ mimeType = _this$props8.mimeType,
202
+ previewOrientation = _this$props8.previewOrientation,
203
+ onDisplayImage = _this$props8.onDisplayImage,
204
+ alt = _this$props8.alt;
195
205
 
196
206
  if (!(0, _shouldDisplayImageThumbnail.shouldDisplayImageThumbnail)(status, mediaItemType, dataURI, mediaType, mimeType)) {
197
207
  return null;
@@ -208,16 +218,16 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
208
218
  crop: _this.isCropped,
209
219
  stretch: _this.isStretched,
210
220
  previewOrientation: previewOrientation,
211
- onImageLoad: onImageLoad,
212
- onImageError: onImageError
221
+ onImageLoad: _this.onImageLoad,
222
+ onImageError: _this.onImageError
213
223
  });
214
224
  });
215
225
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderProgressBar", function () {
216
- var _this$props7 = _this.props,
217
- mediaName = _this$props7.mediaName,
218
- progress = _this$props7.progress,
219
- actions = _this$props7.actions,
220
- status = _this$props7.status;
226
+ var _this$props9 = _this.props,
227
+ mediaName = _this$props9.mediaName,
228
+ progress = _this$props9.progress,
229
+ actions = _this$props9.actions,
230
+ status = _this$props9.status;
221
231
 
222
232
  if (status !== 'uploading') {
223
233
  return null;
@@ -235,10 +245,10 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
235
245
  }) : null))));
236
246
  });
237
247
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSuccessCardContents", function () {
238
- var _this$props8 = _this.props,
239
- disableOverlay = _this$props8.disableOverlay,
240
- selectable = _this$props8.selectable,
241
- status = _this$props8.status;
248
+ var _this$props10 = _this.props,
249
+ disableOverlay = _this$props10.disableOverlay,
250
+ selectable = _this$props10.selectable,
251
+ status = _this$props10.status;
242
252
  var overlay = null;
243
253
 
244
254
  if (!disableOverlay) {
@@ -258,15 +268,15 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
258
268
  }, _this.renderMediaImage(), _this.renderProgressBar(), _this.renderPlayButton()), overlay);
259
269
  });
260
270
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSuccessCardOverlay", function () {
261
- var _this$props9 = _this.props,
262
- status = _this$props9.status,
263
- mediaName = _this$props9.mediaName,
264
- mediaType = _this$props9.mediaType,
265
- fileSize = _this$props9.fileSize,
266
- dataURI = _this$props9.dataURI,
267
- selectable = _this$props9.selectable,
268
- selected = _this$props9.selected,
269
- actions = _this$props9.actions;
271
+ var _this$props11 = _this.props,
272
+ status = _this$props11.status,
273
+ mediaName = _this$props11.mediaName,
274
+ mediaType = _this$props11.mediaType,
275
+ fileSize = _this$props11.fileSize,
276
+ dataURI = _this$props11.dataURI,
277
+ selectable = _this$props11.selectable,
278
+ selected = _this$props11.selected,
279
+ actions = _this$props11.actions;
270
280
  var isPersistent = mediaType === 'doc' || !dataURI;
271
281
  return /*#__PURE__*/_react.default.createElement(_cardOverlay.CardOverlay, {
272
282
  cardStatus: status,
@@ -285,14 +295,14 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
285
295
  (0, _createClass2.default)(FileCardImageView, [{
286
296
  key: "render",
287
297
  value: function render() {
288
- var _this$props10 = this.props,
289
- disableOverlay = _this$props10.disableOverlay,
290
- selectable = _this$props10.selectable,
291
- selected = _this$props10.selected,
292
- mediaType = _this$props10.mediaType,
293
- progress = _this$props10.progress,
294
- status = _this$props10.status,
295
- mediaName = _this$props10.mediaName;
298
+ var _this$props12 = this.props,
299
+ disableOverlay = _this$props12.disableOverlay,
300
+ selectable = _this$props12.selectable,
301
+ selected = _this$props12.selected,
302
+ mediaType = _this$props12.mediaType,
303
+ progress = _this$props12.progress,
304
+ status = _this$props12.status,
305
+ mediaName = _this$props12.mediaName;
296
306
  return /*#__PURE__*/_react.default.createElement(_styled.Wrapper, {
297
307
  "data-testid": "media-file-card-view",
298
308
  "data-test-media-name": mediaName,
@@ -309,9 +319,9 @@ var FileCardImageView = /*#__PURE__*/function (_Component) {
309
319
  }, {
310
320
  key: "isFileCardImageReadyForDisplay",
311
321
  get: function get() {
312
- var _this$props11 = this.props,
313
- dataURI = _this$props11.dataURI,
314
- status = _this$props11.status;
322
+ var _this$props13 = this.props,
323
+ dataURI = _this$props13.dataURI,
324
+ status = _this$props13.status;
315
325
  return !!dataURI || !['loading', 'processing', 'loading-preview'].includes(status);
316
326
  }
317
327
  }, {
@@ -10,22 +10,22 @@ var _analytics = require("../../utils/analytics");
10
10
  var relevantFeatureFlagNames = ['newCardExperience', 'captions', 'timestampOnVideo'];
11
11
  exports.relevantFeatureFlagNames = relevantFeatureFlagNames;
12
12
 
13
- var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, error) {
13
+ var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability, error) {
14
14
  var fireEvent = function fireEvent(payload) {
15
15
  return (0, _analytics.fireMediaCardEvent)(payload, createAnalyticsEvent);
16
16
  };
17
17
 
18
18
  switch (status) {
19
19
  case 'complete':
20
- fireEvent((0, _analytics.getRenderSucceededEventPayload)(fileAttributes, performanceAttributes));
20
+ fireEvent((0, _analytics.getRenderSucceededEventPayload)(fileAttributes, performanceAttributes, ssrReliability));
21
21
  break;
22
22
 
23
23
  case 'failed-processing':
24
- fireEvent((0, _analytics.getRenderFailedFileStatusPayload)(fileAttributes, performanceAttributes));
24
+ fireEvent((0, _analytics.getRenderFailedFileStatusPayload)(fileAttributes, performanceAttributes, ssrReliability));
25
25
  break;
26
26
 
27
27
  case 'error':
28
- error && fireEvent((0, _analytics.getRenderErrorEventPayload)(fileAttributes, performanceAttributes, error));
28
+ error && fireEvent((0, _analytics.getRenderErrorEventPayload)(fileAttributes, performanceAttributes, error, ssrReliability));
29
29
  break;
30
30
  }
31
31
  };
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "getCardPreviewFromFilePreview", {
25
25
  return _helpers.getCardPreviewFromFilePreview;
26
26
  }
27
27
  });
28
- exports.isSSRServerPreview = exports.isSSRPreview = exports.isSSRClientPreview = exports.isLocalPreview = exports.getSSRCardPreview = exports.getFilePreviewFromFileState = void 0;
28
+ exports.isSSRServerPreview = exports.isSSRPreview = exports.isSSRDataPreview = exports.isSSRClientPreview = exports.isLocalPreview = exports.getSSRCardPreview = exports.getFilePreviewFromFileState = void 0;
29
29
  Object.defineProperty(exports, "isSupportedLocalPreview", {
30
30
  enumerable: true,
31
31
  get: function get() {
@@ -278,6 +278,12 @@ var isSSRClientPreview = function isSSRClientPreview(preview) {
278
278
 
279
279
  exports.isSSRClientPreview = isSSRClientPreview;
280
280
 
281
+ var isSSRDataPreview = function isSSRDataPreview(preview) {
282
+ return preview.source === 'ssr-data';
283
+ };
284
+
285
+ exports.isSSRDataPreview = isSSRDataPreview;
286
+
281
287
  var fetchAndCacheRemotePreview = /*#__PURE__*/function () {
282
288
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(mediaClient, id, dimensions, params, mediaBlobUrlAttrs) {
283
289
  var remotePreview;