@atlaskit/media-card 73.1.1 → 73.2.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 (72) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/files/cardImageView/index.js +51 -41
  3. package/dist/cjs/root/card/getCardPreview/index.js +7 -1
  4. package/dist/cjs/root/card/index.js +247 -151
  5. package/dist/cjs/root/cardView.js +127 -115
  6. package/dist/cjs/root/inlinePlayer.js +4 -2
  7. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +14 -6
  8. package/dist/cjs/root/ui/styled.js +5 -5
  9. package/dist/cjs/types.js +10 -1
  10. package/dist/cjs/utils/analytics.js +23 -7
  11. package/dist/cjs/utils/dimensionComparer.js +7 -13
  12. package/dist/cjs/utils/getMediaCardCursor.js +29 -0
  13. package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
  14. package/dist/cjs/utils/globalScope/globalScope.js +94 -0
  15. package/dist/cjs/utils/globalScope/index.js +39 -0
  16. package/dist/cjs/utils/globalScope/types.js +5 -0
  17. package/dist/cjs/utils/printScript.js +44 -0
  18. package/dist/cjs/utils/viewportDetector.js +3 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/files/cardImageView/index.js +19 -5
  21. package/dist/es2019/root/card/getCardPreview/index.js +1 -0
  22. package/dist/es2019/root/card/index.js +107 -35
  23. package/dist/es2019/root/cardView.js +40 -30
  24. package/dist/es2019/root/inlinePlayer.js +4 -2
  25. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +14 -6
  26. package/dist/es2019/root/ui/styled.js +4 -4
  27. package/dist/es2019/types.js +7 -1
  28. package/dist/es2019/utils/analytics.js +8 -3
  29. package/dist/es2019/utils/dimensionComparer.js +6 -13
  30. package/dist/es2019/utils/getMediaCardCursor.js +19 -0
  31. package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
  32. package/dist/es2019/utils/globalScope/globalScope.js +62 -0
  33. package/dist/es2019/utils/globalScope/index.js +2 -0
  34. package/dist/es2019/utils/globalScope/types.js +1 -0
  35. package/dist/es2019/utils/printScript.js +19 -0
  36. package/dist/es2019/utils/viewportDetector.js +3 -1
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/esm/files/cardImageView/index.js +53 -41
  39. package/dist/esm/root/card/getCardPreview/index.js +3 -0
  40. package/dist/esm/root/card/index.js +228 -134
  41. package/dist/esm/root/cardView.js +126 -115
  42. package/dist/esm/root/inlinePlayer.js +4 -2
  43. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +14 -6
  44. package/dist/esm/root/ui/styled.js +5 -5
  45. package/dist/esm/types.js +7 -1
  46. package/dist/esm/utils/analytics.js +17 -6
  47. package/dist/esm/utils/dimensionComparer.js +8 -13
  48. package/dist/esm/utils/getMediaCardCursor.js +19 -0
  49. package/dist/esm/utils/globalScope/getSSRData.js +10 -0
  50. package/dist/esm/utils/globalScope/globalScope.js +69 -0
  51. package/dist/esm/utils/globalScope/index.js +2 -0
  52. package/dist/esm/utils/globalScope/types.js +1 -0
  53. package/dist/esm/utils/printScript.js +30 -0
  54. package/dist/esm/utils/viewportDetector.js +3 -1
  55. package/dist/esm/version.json +1 -1
  56. package/dist/types/errors.d.ts +1 -1
  57. package/dist/types/files/cardImageView/index.d.ts +6 -2
  58. package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
  59. package/dist/types/root/card/index.d.ts +3 -1
  60. package/dist/types/root/cardView.d.ts +8 -6
  61. package/dist/types/root/inlinePlayer.d.ts +3 -1
  62. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +4 -4
  63. package/dist/types/root/ui/styled.d.ts +2 -1
  64. package/dist/types/types.d.ts +6 -1
  65. package/dist/types/utils/analytics.d.ts +6 -0
  66. package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
  67. package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
  68. package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
  69. package/dist/types/utils/globalScope/index.d.ts +4 -0
  70. package/dist/types/utils/globalScope/types.d.ts +8 -0
  71. package/dist/types/utils/printScript.d.ts +2 -0
  72. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 73.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3ad0bbf0f93`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3ad0bbf0f93) - Log media ssr getImageURLSync error in global variable ssr data.
8
+ - [`1dcf16cb69e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1dcf16cb69e) - Reuse image url from server when hydrates and refetch if dimensions in client are bigger
9
+ - [`a5cabf7f670`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5cabf7f670) - Made InlinePlayer compatible with SSR
10
+
11
+ ### Patch Changes
12
+
13
+ - [`46cd0dfed6f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46cd0dfed6f) - Removed duplicated commenced event
14
+ - [`5571b079998`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5571b079998) - Added example using FileState Factory helper
15
+ - [`116ae9cd4fe`](https://bitbucket.org/atlassian/atlassian-frontend/commits/116ae9cd4fe) - Update SSR example with media single in stretchy-fit mode.
16
+ - [`42485996554`](https://bitbucket.org/atlassian/atlassian-frontend/commits/42485996554) - vr tests for ssr cases
17
+ - [`a31422c7a74`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a31422c7a74) - MEX-1194 introduce cursor states to media card
18
+ - [`af3fcc847ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af3fcc847ce) - Improved filestate simulations example
19
+ - [`8fd03048678`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8fd03048678) - Added example and test for media ssr usage in renderer
20
+ - Updated dependencies
21
+
3
22
  ## 73.1.1
4
23
 
5
24
  ### 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
  }, {
@@ -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;