@atlaskit/media-card 74.5.0 → 74.5.2

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 (267) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/card/actions.js +0 -5
  3. package/dist/cjs/card/card.js +126 -260
  4. package/dist/cjs/card/cardAnalytics.js +0 -18
  5. package/dist/cjs/card/cardImageView/cardImageViewWrapper.js +7 -16
  6. package/dist/cjs/card/cardImageView/cardOverlay/cardOverlayComponents.js +3 -15
  7. package/dist/cjs/card/cardImageView/cardOverlay/index.js +20 -52
  8. package/dist/cjs/card/cardImageView/cardOverlay/styles.js +1 -19
  9. package/dist/cjs/card/cardImageView/cardViewWrapper.js +7 -10
  10. package/dist/cjs/card/cardImageView/fileCardImageView.js +66 -111
  11. package/dist/cjs/card/cardImageView/index.js +0 -1
  12. package/dist/cjs/card/cardImageView/styles.js +0 -14
  13. package/dist/cjs/card/cardLoader.js +3 -20
  14. package/dist/cjs/card/cardState.js +0 -9
  15. package/dist/cjs/card/cardView.js +105 -198
  16. package/dist/cjs/card/getCardPreview/cache.js +0 -12
  17. package/dist/cjs/card/getCardPreview/filePreviewStatus.js +8 -16
  18. package/dist/cjs/card/getCardPreview/helpers.js +0 -39
  19. package/dist/cjs/card/getCardPreview/imageRefetchingAnalytics.js +0 -8
  20. package/dist/cjs/card/getCardPreview/index.js +16 -85
  21. package/dist/cjs/card/getCardStatus.js +5 -24
  22. package/dist/cjs/card/index.js +0 -2
  23. package/dist/cjs/card/inlinePlayer.js +19 -102
  24. package/dist/cjs/card/inlinePlayerLazy.js +0 -11
  25. package/dist/cjs/card/inlinePlayerWrapper.js +5 -8
  26. package/dist/cjs/card/media-card-analytics-error-boundary.js +6 -34
  27. package/dist/cjs/card/styles/animations.js +0 -5
  28. package/dist/cjs/card/styles/getSelectedBorderStyle.js +0 -4
  29. package/dist/cjs/card/styles/index.js +0 -14
  30. package/dist/cjs/card/styles/mixins.js +0 -11
  31. package/dist/cjs/card/styles/styles.js +4 -20
  32. package/dist/cjs/card/ui/actionsBar/actionsBar.js +2 -20
  33. package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +1 -4
  34. package/dist/cjs/card/ui/actionsBar/styles.js +0 -8
  35. package/dist/cjs/card/ui/blanket/blanket.js +1 -4
  36. package/dist/cjs/card/ui/blanket/styles.js +0 -9
  37. package/dist/cjs/card/ui/common.js +0 -8
  38. package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +2 -5
  39. package/dist/cjs/card/ui/iconMessage/index.js +4 -22
  40. package/dist/cjs/card/ui/iconMessage/styles.js +1 -10
  41. package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +2 -5
  42. package/dist/cjs/card/ui/iconWrapper/styles.js +3 -11
  43. package/dist/cjs/card/ui/imageRenderer/imageRenderer.js +8 -21
  44. package/dist/cjs/card/ui/loadingRateLimited/styles.js +1 -10
  45. package/dist/cjs/card/ui/newFileExperience/newFileExperienceWrapper.js +14 -19
  46. package/dist/cjs/card/ui/newFileExperience/styles.js +10 -26
  47. package/dist/cjs/card/ui/playButton/playButton.js +0 -7
  48. package/dist/cjs/card/ui/playButton/playButtonBackground.js +1 -4
  49. package/dist/cjs/card/ui/playButton/playButtonWrapper.js +1 -4
  50. package/dist/cjs/card/ui/playButton/styles.js +0 -6
  51. package/dist/cjs/card/ui/progressBar/progressBar.js +6 -14
  52. package/dist/cjs/card/ui/progressBar/styledBar.js +4 -7
  53. package/dist/cjs/card/ui/progressBar/styles.js +4 -18
  54. package/dist/cjs/card/ui/styles.js +12 -46
  55. package/dist/cjs/card/ui/tickBox/styles.js +0 -11
  56. package/dist/cjs/card/ui/tickBox/tickBox.js +0 -6
  57. package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +1 -4
  58. package/dist/cjs/card/ui/titleBox/failedTitleBox.js +2 -11
  59. package/dist/cjs/card/ui/titleBox/styles.js +4 -19
  60. package/dist/cjs/card/ui/titleBox/titleBox.js +9 -21
  61. package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +2 -14
  62. package/dist/cjs/card/ui/unhandledErrorCard/index.js +6 -36
  63. package/dist/cjs/classnames.js +0 -1
  64. package/dist/cjs/errors.js +7 -66
  65. package/dist/cjs/index.js +0 -8
  66. package/dist/cjs/inline/index.js +0 -2
  67. package/dist/cjs/inline/loader.js +2 -43
  68. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +4 -29
  69. package/dist/cjs/inline/mediaInlineCard.js +21 -57
  70. package/dist/cjs/types.js +0 -2
  71. package/dist/cjs/utils/analytics.js +0 -49
  72. package/dist/cjs/utils/breakpoint.js +0 -10
  73. package/dist/cjs/utils/cardActions/cardActionButton.js +1 -4
  74. package/dist/cjs/utils/cardActions/cardActionIconButton.js +7 -29
  75. package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +6 -35
  76. package/dist/cjs/utils/cardActions/cardActionsView.js +7 -34
  77. package/dist/cjs/utils/cardActions/index.js +0 -4
  78. package/dist/cjs/utils/cardActions/styles.js +0 -13
  79. package/dist/cjs/utils/cardDimensions.js +5 -22
  80. package/dist/cjs/utils/containsPixelUnit.js +0 -2
  81. package/dist/cjs/utils/dimensionComparer.js +0 -8
  82. package/dist/cjs/utils/document.js +0 -4
  83. package/dist/cjs/utils/errorIcon/index.js +0 -18
  84. package/dist/cjs/utils/errorIcon/styles.js +0 -5
  85. package/dist/cjs/utils/fileIcon/index.js +3 -21
  86. package/dist/cjs/utils/fileIcon/styles.js +0 -6
  87. package/dist/cjs/utils/generateUniqueId.js +0 -2
  88. package/dist/cjs/utils/getCSSUnitValue.js +0 -1
  89. package/dist/cjs/utils/getDataURIDimension.js +0 -13
  90. package/dist/cjs/utils/getElementDimension.js +0 -2
  91. package/dist/cjs/utils/getErrorMessage.js +0 -6
  92. package/dist/cjs/utils/getMediaCardCursor.js +1 -6
  93. package/dist/cjs/utils/globalScope/getSSRData.js +0 -5
  94. package/dist/cjs/utils/globalScope/globalScope.js +8 -25
  95. package/dist/cjs/utils/globalScope/index.js +0 -2
  96. package/dist/cjs/utils/index.js +0 -12
  97. package/dist/cjs/utils/isRetina.js +0 -1
  98. package/dist/cjs/utils/isValidPercentageUnit.js +0 -2
  99. package/dist/cjs/utils/lightCards/cardError.js +0 -21
  100. package/dist/cjs/utils/lightCards/cardLoading.js +3 -27
  101. package/dist/cjs/utils/lightCards/getDimensionsWithDefault.js +0 -2
  102. package/dist/cjs/utils/lightCards/lightCardWrappers.js +1 -9
  103. package/dist/cjs/utils/lightCards/styles.js +1 -13
  104. package/dist/cjs/utils/metadata.js +0 -7
  105. package/dist/cjs/utils/objectURLCache.js +0 -22
  106. package/dist/cjs/utils/preventClickThrough.js +0 -5
  107. package/dist/cjs/utils/printScript.js +0 -10
  108. package/dist/cjs/utils/progressBar/index.js +0 -17
  109. package/dist/cjs/utils/progressBar/styles.js +0 -6
  110. package/dist/cjs/utils/resizeModeToMediaImageProps.js +0 -1
  111. package/dist/cjs/utils/shouldDisplayImageThumbnail.js +0 -5
  112. package/dist/cjs/utils/ufoExperiences.js +1 -21
  113. package/dist/cjs/utils/videoSnapshot.js +2 -11
  114. package/dist/cjs/utils/viewportDetector.js +5 -24
  115. package/dist/cjs/version.json +1 -1
  116. package/dist/es2019/card/actions.js +2 -1
  117. package/dist/es2019/card/card.js +26 -121
  118. package/dist/es2019/card/cardAnalytics.js +0 -5
  119. package/dist/es2019/card/cardImageView/cardOverlay/index.js +2 -16
  120. package/dist/es2019/card/cardImageView/cardOverlay/styles.js +1 -2
  121. package/dist/es2019/card/cardImageView/fileCardImageView.js +3 -36
  122. package/dist/es2019/card/cardImageView/styles.js +0 -3
  123. package/dist/es2019/card/cardLoader.js +3 -14
  124. package/dist/es2019/card/cardState.js +1 -2
  125. package/dist/es2019/card/cardView.js +24 -68
  126. package/dist/es2019/card/getCardPreview/cache.js +0 -4
  127. package/dist/es2019/card/getCardPreview/filePreviewStatus.js +8 -5
  128. package/dist/es2019/card/getCardPreview/helpers.js +0 -9
  129. package/dist/es2019/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
  130. package/dist/es2019/card/getCardPreview/index.js +16 -30
  131. package/dist/es2019/card/getCardStatus.js +2 -15
  132. package/dist/es2019/card/inlinePlayer.js +2 -35
  133. package/dist/es2019/card/inlinePlayerLazy.js +1 -2
  134. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -15
  135. package/dist/es2019/card/styles/getSelectedBorderStyle.js +1 -1
  136. package/dist/es2019/card/styles/styles.js +0 -3
  137. package/dist/es2019/card/ui/actionsBar/actionsBar.js +0 -3
  138. package/dist/es2019/card/ui/common.js +0 -2
  139. package/dist/es2019/card/ui/iconMessage/styles.js +0 -2
  140. package/dist/es2019/card/ui/iconWrapper/styles.js +2 -2
  141. package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +0 -3
  142. package/dist/es2019/card/ui/progressBar/styles.js +1 -3
  143. package/dist/es2019/card/ui/styles.js +3 -4
  144. package/dist/es2019/card/ui/titleBox/styles.js +2 -3
  145. package/dist/es2019/card/ui/unhandledErrorCard/index.js +0 -8
  146. package/dist/es2019/errors.js +8 -17
  147. package/dist/es2019/index.js +1 -0
  148. package/dist/es2019/inline/loader.js +1 -18
  149. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -12
  150. package/dist/es2019/inline/mediaInlineCard.js +0 -15
  151. package/dist/es2019/types.js +1 -1
  152. package/dist/es2019/utils/analytics.js +0 -3
  153. package/dist/es2019/utils/breakpoint.js +0 -4
  154. package/dist/es2019/utils/cardActions/cardActionIconButton.js +3 -5
  155. package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +0 -5
  156. package/dist/es2019/utils/cardActions/cardActionsView.js +0 -10
  157. package/dist/es2019/utils/cardActions/styles.js +0 -3
  158. package/dist/es2019/utils/cardDimensions.js +7 -14
  159. package/dist/es2019/utils/dimensionComparer.js +0 -3
  160. package/dist/es2019/utils/document.js +0 -2
  161. package/dist/es2019/utils/errorIcon/index.js +0 -3
  162. package/dist/es2019/utils/fileIcon/index.js +0 -1
  163. package/dist/es2019/utils/getDataURIDimension.js +0 -4
  164. package/dist/es2019/utils/getMediaCardCursor.js +1 -4
  165. package/dist/es2019/utils/globalScope/getSSRData.js +0 -2
  166. package/dist/es2019/utils/globalScope/globalScope.js +3 -10
  167. package/dist/es2019/utils/lightCards/cardError.js +0 -3
  168. package/dist/es2019/utils/lightCards/cardLoading.js +0 -3
  169. package/dist/es2019/utils/lightCards/lightCardWrappers.js +0 -1
  170. package/dist/es2019/utils/metadata.js +0 -5
  171. package/dist/es2019/utils/objectURLCache.js +0 -10
  172. package/dist/es2019/utils/printScript.js +0 -3
  173. package/dist/es2019/utils/progressBar/index.js +0 -2
  174. package/dist/es2019/utils/shouldDisplayImageThumbnail.js +0 -2
  175. package/dist/es2019/utils/ufoExperiences.js +5 -10
  176. package/dist/es2019/utils/videoSnapshot.js +2 -4
  177. package/dist/es2019/utils/viewportDetector.js +0 -5
  178. package/dist/es2019/version.json +1 -1
  179. package/dist/esm/card/actions.js +0 -3
  180. package/dist/esm/card/card.js +126 -254
  181. package/dist/esm/card/cardAnalytics.js +0 -6
  182. package/dist/esm/card/cardImageView/cardImageViewWrapper.js +6 -6
  183. package/dist/esm/card/cardImageView/cardOverlay/cardOverlayComponents.js +2 -2
  184. package/dist/esm/card/cardImageView/cardOverlay/index.js +22 -37
  185. package/dist/esm/card/cardImageView/cardOverlay/styles.js +2 -6
  186. package/dist/esm/card/cardImageView/cardViewWrapper.js +6 -6
  187. package/dist/esm/card/cardImageView/fileCardImageView.js +66 -104
  188. package/dist/esm/card/cardImageView/styles.js +0 -5
  189. package/dist/esm/card/cardLoader.js +6 -17
  190. package/dist/esm/card/cardState.js +1 -2
  191. package/dist/esm/card/cardView.js +105 -171
  192. package/dist/esm/card/getCardPreview/cache.js +0 -7
  193. package/dist/esm/card/getCardPreview/filePreviewStatus.js +11 -11
  194. package/dist/esm/card/getCardPreview/helpers.js +0 -28
  195. package/dist/esm/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
  196. package/dist/esm/card/getCardPreview/index.js +16 -53
  197. package/dist/esm/card/getCardStatus.js +5 -20
  198. package/dist/esm/card/inlinePlayer.js +19 -85
  199. package/dist/esm/card/inlinePlayerLazy.js +1 -5
  200. package/dist/esm/card/inlinePlayerWrapper.js +4 -4
  201. package/dist/esm/card/media-card-analytics-error-boundary.js +6 -28
  202. package/dist/esm/card/styles/animations.js +0 -2
  203. package/dist/esm/card/styles/getSelectedBorderStyle.js +1 -1
  204. package/dist/esm/card/styles/index.js +0 -2
  205. package/dist/esm/card/styles/styles.js +4 -9
  206. package/dist/esm/card/ui/actionsBar/actionsBar.js +2 -12
  207. package/dist/esm/card/ui/actionsBar/styles.js +0 -2
  208. package/dist/esm/card/ui/blanket/styles.js +0 -2
  209. package/dist/esm/card/ui/common.js +0 -4
  210. package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +1 -1
  211. package/dist/esm/card/ui/iconMessage/index.js +4 -4
  212. package/dist/esm/card/ui/iconMessage/styles.js +1 -5
  213. package/dist/esm/card/ui/iconWrapper/iconWrapper.js +1 -1
  214. package/dist/esm/card/ui/iconWrapper/styles.js +3 -5
  215. package/dist/esm/card/ui/imageRenderer/imageRenderer.js +8 -11
  216. package/dist/esm/card/ui/loadingRateLimited/styles.js +1 -3
  217. package/dist/esm/card/ui/newFileExperience/newFileExperienceWrapper.js +13 -13
  218. package/dist/esm/card/ui/newFileExperience/styles.js +10 -12
  219. package/dist/esm/card/ui/playButton/styles.js +0 -2
  220. package/dist/esm/card/ui/progressBar/progressBar.js +6 -6
  221. package/dist/esm/card/ui/progressBar/styledBar.js +3 -3
  222. package/dist/esm/card/ui/progressBar/styles.js +4 -8
  223. package/dist/esm/card/ui/styles.js +12 -20
  224. package/dist/esm/card/ui/tickBox/styles.js +0 -2
  225. package/dist/esm/card/ui/titleBox/failedTitleBox.js +2 -2
  226. package/dist/esm/card/ui/titleBox/styles.js +4 -7
  227. package/dist/esm/card/ui/titleBox/titleBox.js +9 -11
  228. package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -1
  229. package/dist/esm/card/ui/unhandledErrorCard/index.js +6 -24
  230. package/dist/esm/errors.js +8 -40
  231. package/dist/esm/index.js +1 -0
  232. package/dist/esm/inline/loader.js +3 -40
  233. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +4 -23
  234. package/dist/esm/inline/mediaInlineCard.js +21 -40
  235. package/dist/esm/types.js +1 -1
  236. package/dist/esm/utils/analytics.js +0 -6
  237. package/dist/esm/utils/breakpoint.js +0 -5
  238. package/dist/esm/utils/cardActions/cardActionIconButton.js +7 -18
  239. package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +6 -19
  240. package/dist/esm/utils/cardActions/cardActionsView.js +7 -22
  241. package/dist/esm/utils/cardActions/styles.js +0 -5
  242. package/dist/esm/utils/cardDimensions.js +7 -14
  243. package/dist/esm/utils/dimensionComparer.js +0 -3
  244. package/dist/esm/utils/document.js +0 -2
  245. package/dist/esm/utils/errorIcon/index.js +0 -9
  246. package/dist/esm/utils/errorIcon/styles.js +0 -2
  247. package/dist/esm/utils/fileIcon/index.js +3 -11
  248. package/dist/esm/utils/fileIcon/styles.js +0 -2
  249. package/dist/esm/utils/getDataURIDimension.js +0 -4
  250. package/dist/esm/utils/getMediaCardCursor.js +1 -4
  251. package/dist/esm/utils/globalScope/getSSRData.js +0 -2
  252. package/dist/esm/utils/globalScope/globalScope.js +8 -15
  253. package/dist/esm/utils/lightCards/cardError.js +0 -9
  254. package/dist/esm/utils/lightCards/cardLoading.js +3 -13
  255. package/dist/esm/utils/lightCards/lightCardWrappers.js +0 -1
  256. package/dist/esm/utils/lightCards/styles.js +1 -3
  257. package/dist/esm/utils/metadata.js +0 -5
  258. package/dist/esm/utils/objectURLCache.js +0 -15
  259. package/dist/esm/utils/printScript.js +0 -5
  260. package/dist/esm/utils/progressBar/index.js +0 -9
  261. package/dist/esm/utils/progressBar/styles.js +0 -2
  262. package/dist/esm/utils/shouldDisplayImageThumbnail.js +0 -2
  263. package/dist/esm/utils/ufoExperiences.js +1 -12
  264. package/dist/esm/utils/videoSnapshot.js +2 -6
  265. package/dist/esm/utils/viewportDetector.js +5 -16
  266. package/dist/esm/version.json +1 -1
  267. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
2
2
  export const isFinalCardStatus = status => ['complete', 'error', 'failed-processing'].includes(status);
3
-
4
3
  const getCardStatusBuggy = (fileStatus, {
5
4
  hasFilesize,
6
5
  isPreviewable,
@@ -11,7 +10,6 @@ const getCardStatusBuggy = (fileStatus, {
11
10
  case 'failed-processing':
12
11
  case 'error':
13
12
  return fileStatus;
14
-
15
13
  case 'processing':
16
14
  // Legacy empty files logic
17
15
  // isPreviewable will most likely be false for empty files,
@@ -19,28 +17,22 @@ const getCardStatusBuggy = (fileStatus, {
19
17
  // TODO: https://product-fabric.atlassian.net/browse/BMPT-1247
20
18
  if (!hasFilesize) {
21
19
  return 'processing';
22
- } // If we show no preview for this file
20
+ }
21
+ // If we show no preview for this file
23
22
  // we won't show the "creating preview" message, i.e. Card is "complete".
24
-
25
-
26
23
  if (!isPreviewable) {
27
24
  return 'complete';
28
25
  }
29
-
30
26
  return 'processing';
31
-
32
27
  case 'processed':
33
28
  if (!isPreviewable || !hasPreview) {
34
29
  return 'complete';
35
30
  }
36
-
37
31
  return 'loading-preview';
38
-
39
32
  default:
40
33
  return 'loading';
41
34
  }
42
35
  };
43
-
44
36
  const getCardStatusFixed = (fileStatus, {
45
37
  isPreviewable,
46
38
  hasPreview
@@ -51,23 +43,18 @@ const getCardStatusFixed = (fileStatus, {
51
43
  case 'error':
52
44
  case 'processing':
53
45
  return fileStatus;
54
-
55
46
  case 'processed':
56
47
  if (!isPreviewable || !hasPreview) {
57
48
  return 'complete';
58
49
  }
59
-
60
50
  return 'loading-preview';
61
-
62
51
  default:
63
52
  return 'loading';
64
53
  }
65
54
  };
66
-
67
55
  export const getCardStatus = (fileStatus, filePreviewStatus, featureFlags) => {
68
56
  if (getMediaFeatureFlag('fetchFileStateAfterUpload', featureFlags)) {
69
57
  return getCardStatusFixed(fileStatus, filePreviewStatus);
70
58
  }
71
-
72
59
  return getCardStatusBuggy(fileStatus, filePreviewStatus);
73
60
  };
@@ -16,30 +16,23 @@ export const getPreferredVideoArtifact = fileState => {
16
16
  const {
17
17
  artifacts
18
18
  } = fileState;
19
-
20
19
  if (!artifacts) {
21
20
  return undefined;
22
21
  }
23
-
24
22
  return artifacts['video_1280.mp4'] ? 'video_1280.mp4' : artifacts['video_640.mp4'] ? 'video_640.mp4' : undefined;
25
23
  }
26
-
27
24
  return undefined;
28
25
  };
29
26
  export class InlinePlayerBase extends Component {
30
27
  constructor(...args) {
31
28
  super(...args);
32
-
33
29
  _defineProperty(this, "state", {});
34
-
35
30
  _defineProperty(this, "divRef", /*#__PURE__*/React.createRef());
36
-
37
31
  _defineProperty(this, "setFileSrc", fileSrc => {
38
32
  this.setState({
39
33
  fileSrc
40
34
  });
41
35
  });
42
-
43
36
  _defineProperty(this, "setBinaryURL", async () => {
44
37
  const {
45
38
  mediaClient,
@@ -50,7 +43,6 @@ export class InlinePlayerBase extends Component {
50
43
  id,
51
44
  collectionName
52
45
  } = identifier;
53
-
54
46
  try {
55
47
  const fileSrc = await mediaClient.file.getFileBinaryURL(id, collectionName);
56
48
  this.setFileSrc(fileSrc);
@@ -60,23 +52,19 @@ export class InlinePlayerBase extends Component {
60
52
  }
61
53
  }
62
54
  });
63
-
64
55
  _defineProperty(this, "unsubscribe", () => {
65
56
  if (this.subscription) {
66
57
  this.subscription.unsubscribe();
67
58
  }
68
59
  });
69
-
70
60
  _defineProperty(this, "revoke", () => {
71
61
  const {
72
62
  fileSrc
73
63
  } = this.state;
74
-
75
64
  if (fileSrc) {
76
65
  URL.revokeObjectURL(fileSrc);
77
66
  }
78
67
  });
79
-
80
68
  _defineProperty(this, "onDownloadClick", () => {
81
69
  const {
82
70
  mediaClient,
@@ -88,7 +76,6 @@ export class InlinePlayerBase extends Component {
88
76
  } = identifier;
89
77
  mediaClient.file.downloadBinary(id, undefined, collectionName);
90
78
  });
91
-
92
79
  _defineProperty(this, "onFirstPlay", () => {
93
80
  const {
94
81
  identifier
@@ -98,20 +85,16 @@ export class InlinePlayerBase extends Component {
98
85
  viewingLevel: 'full'
99
86
  });
100
87
  });
101
-
102
88
  _defineProperty(this, "saveElementWidth", () => {
103
89
  const {
104
90
  dimensions
105
91
  } = this.props;
106
-
107
92
  if (!dimensions) {
108
93
  return;
109
94
  }
110
-
111
95
  const {
112
96
  width
113
97
  } = dimensions;
114
-
115
98
  if (width && isValidPercentageUnit(width) && !!this.divRef.current) {
116
99
  const elementWidth = getElementDimension(this.divRef.current, 'width');
117
100
  this.setState({
@@ -120,7 +103,6 @@ export class InlinePlayerBase extends Component {
120
103
  }
121
104
  });
122
105
  }
123
-
124
106
  componentDidMount() {
125
107
  this.saveElementWidth();
126
108
  const {
@@ -147,38 +129,32 @@ export class InlinePlayerBase extends Component {
147
129
  isUploading: false
148
130
  });
149
131
  }
150
-
151
132
  const {
152
133
  fileSrc: existingFileSrc
153
- } = this.state; // we want to reuse the existing fileSrc to prevent re renders
154
-
134
+ } = this.state;
135
+ // we want to reuse the existing fileSrc to prevent re renders
155
136
  if (existingFileSrc) {
156
137
  return;
157
138
  }
158
-
159
139
  if (fileState.status !== 'error' && fileState.preview) {
160
140
  const {
161
141
  value
162
142
  } = await fileState.preview;
163
-
164
143
  if (value instanceof Blob && value.type.indexOf('video/') === 0) {
165
144
  const fileSrc = URL.createObjectURL(value);
166
145
  this.setFileSrc(fileSrc);
167
146
  return;
168
147
  }
169
148
  }
170
-
171
149
  if (fileState.status === 'processed' || fileState.status === 'processing') {
172
150
  const artifactName = getPreferredVideoArtifact(fileState);
173
151
  const {
174
152
  artifacts
175
153
  } = fileState;
176
-
177
154
  if (!artifactName || !artifacts) {
178
155
  this.setBinaryURL();
179
156
  return;
180
157
  }
181
-
182
158
  try {
183
159
  const fileSrc = await mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
184
160
  this.setFileSrc(fileSrc);
@@ -186,7 +162,6 @@ export class InlinePlayerBase extends Component {
186
162
  const {
187
163
  onError
188
164
  } = this.props;
189
-
190
165
  if (onError && error instanceof Error) {
191
166
  onError(error);
192
167
  }
@@ -195,17 +170,14 @@ export class InlinePlayerBase extends Component {
195
170
  }
196
171
  });
197
172
  }
198
-
199
173
  componentWillUnmount() {
200
174
  this.unsubscribe();
201
175
  this.revoke();
202
176
  }
203
-
204
177
  get breakpoint() {
205
178
  const width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || defaultImageCardDimensions.width;
206
179
  return calcBreakpointSize(parseInt(`${width}`, 10));
207
180
  }
208
-
209
181
  render() {
210
182
  const {
211
183
  onClick,
@@ -224,14 +196,12 @@ export class InlinePlayerBase extends Component {
224
196
  isUploading,
225
197
  progress
226
198
  } = this.state;
227
-
228
199
  if (!fileSrc) {
229
200
  return /*#__PURE__*/React.createElement(CardLoading, {
230
201
  testId: testId,
231
202
  dimensions: dimensions
232
203
  });
233
204
  }
234
-
235
205
  return /*#__PURE__*/React.createElement(InlinePlayerWrapper, {
236
206
  testId: testId || 'media-card-inline-player',
237
207
  selected: {
@@ -262,13 +232,10 @@ export class InlinePlayerBase extends Component {
262
232
  showOnTop: true
263
233
  }) : null);
264
234
  }
265
-
266
235
  }
267
-
268
236
  _defineProperty(InlinePlayerBase, "defaultProps", {
269
237
  dimensions: defaultImageCardDimensions
270
238
  });
271
-
272
239
  const InlinePlayerForwardRef = /*#__PURE__*/React.forwardRef((props, ref) => {
273
240
  return /*#__PURE__*/React.createElement(InlinePlayerBase, _extends({}, props, {
274
241
  forwardRef: ref
@@ -2,8 +2,7 @@ import { lazy } from 'react';
2
2
  export const InlinePlayerLazy = /*#__PURE__*/lazy(async () => {
3
3
  const {
4
4
  InlinePlayer
5
- } = await import(
6
- /* webpackChunkName: "@atlaskit-internal_media-card-inlineplayer" */
5
+ } = await import( /* webpackChunkName: "@atlaskit-internal_media-card-inlineplayer" */
7
6
  './inlinePlayer');
8
7
  return {
9
8
  default: InlinePlayer
@@ -4,14 +4,11 @@ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { UnhandledErrorCard } from './ui/unhandledErrorCard';
5
5
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
6
6
  import { fireMediaCardEvent } from '../utils/analytics';
7
-
8
7
  class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
9
8
  constructor(props) {
10
9
  super(props);
11
-
12
10
  _defineProperty(this, "fireOperationalEvent", (error, info) => {
13
11
  var _window, _window$navigator;
14
-
15
12
  const {
16
13
  data = {},
17
14
  createAnalyticsEvent
@@ -30,32 +27,26 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
30
27
  };
31
28
  fireMediaCardEvent(payload, createAnalyticsEvent);
32
29
  });
33
-
34
30
  _defineProperty(this, "handleOnClick", event => {
35
31
  try {
36
32
  var _this$props$onClick, _this$props;
37
-
38
33
  (_this$props$onClick = (_this$props = this.props).onClick) === null || _this$props$onClick === void 0 ? void 0 : _this$props$onClick.call(_this$props, {
39
34
  event
40
35
  });
41
36
  } catch (e) {}
42
37
  });
43
-
44
38
  this.state = {
45
39
  hasError: false
46
40
  };
47
41
  }
48
-
49
42
  componentDidCatch(error, info) {
50
43
  try {
51
44
  this.fireOperationalEvent(error, info);
52
45
  } catch (e) {}
53
-
54
46
  this.setState({
55
47
  hasError: true
56
48
  });
57
49
  }
58
-
59
50
  render() {
60
51
  const {
61
52
  hasError
@@ -64,23 +55,18 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
64
55
  dimensions,
65
56
  children
66
57
  } = this.props;
67
-
68
58
  if (hasError) {
69
59
  return /*#__PURE__*/React.createElement(UnhandledErrorCard, {
70
60
  dimensions: dimensions,
71
61
  onClick: this.handleOnClick
72
62
  });
73
63
  }
74
-
75
64
  return children;
76
65
  }
77
-
78
66
  }
79
-
80
67
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
81
-
82
68
  const packageName = "@atlaskit/media-card";
83
- const packageVersion = "74.5.0";
69
+ const packageVersion = "74.5.2";
84
70
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
85
71
  packageVersion,
86
72
  packageName,
@@ -1,10 +1,10 @@
1
1
  import { borderRadius } from '@atlaskit/media-ui';
2
2
  import { getSelectionStyles, SelectionStyle, hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
3
+
3
4
  /*
4
5
  * Used to display the blue border around a selected card without
5
6
  * shrinking the image OR growing the card size
6
7
  */
7
-
8
8
  export const getSelectedBorderStyle = ({
9
9
  selected
10
10
  }) => `
@@ -5,11 +5,8 @@ import { breakpointStyles } from '../../utils/breakpoint';
5
5
  import { getSelectedBorderStyle } from './getSelectedBorderStyle';
6
6
  import { getDimensionsWithDefault } from '../../utils/lightCards/getDimensionsWithDefault';
7
7
  export const inlinePlayerClassName = 'media-card-inline-player';
8
-
9
8
  const getWrapperHeight = dimensions => dimensions && dimensions.height ? `height: ${getCSSUnitValue(dimensions.height)}; max-height: 100%;` : '';
10
-
11
9
  const getWrapperWidth = dimensions => dimensions && dimensions.width ? `width: ${getCSSUnitValue(dimensions.width)}; max-width: 100%;` : '';
12
-
13
10
  export const wrapperStyles = ({
14
11
  dimensions,
15
12
  breakpointSize = 'medium',
@@ -7,11 +7,9 @@ export class ActionsBar extends React.Component {
7
7
  isFixed,
8
8
  actions
9
9
  } = this.props;
10
-
11
10
  if (actions.length === 0) {
12
11
  return null;
13
12
  }
14
-
15
13
  return /*#__PURE__*/React.createElement(ActionsBarWrapper, {
16
14
  isFixed: isFixed
17
15
  }, /*#__PURE__*/React.createElement(CardActionsView, {
@@ -19,5 +17,4 @@ export class ActionsBar extends React.Component {
19
17
  variant: CardActionIconButtonVariant.filled
20
18
  }));
21
19
  }
22
-
23
20
  }
@@ -1,10 +1,8 @@
1
1
  export let Breakpoint;
2
-
3
2
  (function (Breakpoint) {
4
3
  Breakpoint["SMALL"] = "small";
5
4
  Breakpoint["LARGE"] = "large";
6
5
  })(Breakpoint || (Breakpoint = {}));
7
-
8
6
  export const responsiveSettings = {
9
7
  [Breakpoint.SMALL]: {
10
8
  fontSize: 11,
@@ -10,7 +10,6 @@ const animatedStyles = css`
10
10
  animation-timing-function: ease-in-out;
11
11
  animation-iteration-count: infinite;
12
12
  `;
13
-
14
13
  const getStylesBasedOnProps = ({
15
14
  animated,
16
15
  reducedFont
@@ -25,7 +24,6 @@ const getStylesBasedOnProps = ({
25
24
  margin-bottom: -1em;
26
25
  padding: 3px 10px;
27
26
  `;
28
-
29
27
  export const iconMessageWrapperStyles = props => css`
30
28
  ${getStylesBasedOnProps(props)}
31
29
  `;
@@ -4,9 +4,9 @@ export function titleBoxHeight(hasTitleBox, breakpoint) {
4
4
  // there is no titlebox
5
5
  if (!hasTitleBox) {
6
6
  return `0px`;
7
- } // calculate height of the titlebox
8
-
7
+ }
9
8
 
9
+ // calculate height of the titlebox
10
10
  const marginBottom = getTitleBoxHeight(breakpoint);
11
11
  return `${marginBottom}px`;
12
12
  }
@@ -19,15 +19,12 @@ export const ImageRenderer = ({
19
19
  onDisplayImage();
20
20
  }
21
21
  }, [mediaType, onDisplayImage]);
22
-
23
22
  const onLoad = () => {
24
23
  onImageLoad && onImageLoad(cardPreview);
25
24
  };
26
-
27
25
  const onError = () => {
28
26
  onImageError && onImageError(cardPreview);
29
27
  };
30
-
31
28
  return /*#__PURE__*/React.createElement(MediaImage, _extends({
32
29
  dataURI: cardPreview.dataURI,
33
30
  alt: alt,
@@ -6,7 +6,6 @@ import { Breakpoint, getTitleBoxHeight, responsiveSettings } from '../common';
6
6
  const height = 3;
7
7
  const padding = 1;
8
8
  const width = 95; // %
9
-
10
9
  const left = (100 - width) / 2; // %
11
10
 
12
11
  const smallSizeSettings = {
@@ -23,8 +22,8 @@ export function generateResponsiveStyles(breakpoint, positionBottom, showOnTop,
23
22
  ${showOnTop ? 'top' : 'bottom'}: ${marginBottom}px
24
23
  `;
25
24
  }
26
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
27
25
 
26
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
28
27
  const getStyledBarStylesBasedOnProps = ({
29
28
  progress,
30
29
  breakpoint,
@@ -53,7 +52,6 @@ ${generateResponsiveStyles(breakpoint, positionBottom, showOnTop)}
53
52
  `;
54
53
  /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
55
54
 
56
-
57
55
  export const styledBarStyles = props => {
58
56
  return css`
59
57
  ${getStyledBarStylesBasedOnProps(props)}
@@ -34,9 +34,10 @@ export const getWrapperDimensions = (dimensions, appearance) => {
34
34
  height: ${getCSSUnitValue(height || defaultHeight)};
35
35
  max-height: 100%;
36
36
  `;
37
- }; // This is a trick to simulate the blue border without affecting the dimensions.
38
- // CSS outline has no 'radius', therefore we can't achieve the same effect with it
37
+ };
39
38
 
39
+ // This is a trick to simulate the blue border without affecting the dimensions.
40
+ // CSS outline has no 'radius', therefore we can't achieve the same effect with it
40
41
  export const getWrapperShadow = (disableOverlay, selected) => {
41
42
  const withOverlayShadow = !disableOverlay ? `${`var(--ds-shadow-raised, ${`0 1px 1px ${N60A}, 0 0 1px 0 ${N60A}`})`}` : '';
42
43
  const selectedShadow = selected ? akEditorSelectedBoxShadow : '';
@@ -48,7 +49,6 @@ export const getClickablePlayButtonStyles = isPlayButtonClickable => {
48
49
  if (!isPlayButtonClickable) {
49
50
  return '';
50
51
  }
51
-
52
52
  return `
53
53
  &:hover .${playButtonClassName} {
54
54
  ${fixedPlayButtonStyles}
@@ -59,7 +59,6 @@ export const getSelectableTickBoxStyles = isTickBoxSelectable => {
59
59
  if (!isTickBoxSelectable) {
60
60
  return '';
61
61
  }
62
-
63
62
  return `
64
63
  &:hover .${tickBoxClassName} {
65
64
  ${tickboxFixedStyles}
@@ -3,7 +3,6 @@ import { responsiveSettings, getTitleBoxHeight, Breakpoint } from '../common';
3
3
  import { N0, N800 } from '@atlaskit/theme/colors';
4
4
  import { rgba } from '../../styles/mixins';
5
5
  import { themed } from '@atlaskit/theme/components';
6
-
7
6
  const generateResponsiveStyles = (breakpoint = Breakpoint.SMALL) => {
8
7
  const setting = responsiveSettings[breakpoint];
9
8
  const verticalPadding = setting.titleBox.verticalPadding;
@@ -12,7 +11,6 @@ const generateResponsiveStyles = (breakpoint = Breakpoint.SMALL) => {
12
11
  return `height: ${height}px;
13
12
  padding: ${verticalPadding}px ${horizontalPadding}px;`;
14
13
  };
15
-
16
14
  const HEX_REGEX = /^#[0-9A-F]{6}$/i;
17
15
  const BACKGROUND_COLOR_DARK = '#161a1d';
18
16
  const TEXT_COLOR_DARK = '#C7D1DB';
@@ -26,7 +24,8 @@ export const titleBoxWrapperStyles = ({
26
24
  width: 100%;
27
25
  background-color: ${themed({
28
26
  light: `var(--ds-surface, ${rgba(titleBoxBgColor && HEX_REGEX.test(titleBoxBgColor) ? titleBoxBgColor : N0, 1)})`,
29
- dark: `var(--ds-surface, ${rgba( // theme does not contain this color, use constant instead
27
+ dark: `var(--ds-surface, ${rgba(
28
+ // theme does not contain this color, use constant instead
30
29
  titleBoxBgColor && HEX_REGEX.test(titleBoxBgColor) ? titleBoxBgColor : BACKGROUND_COLOR_DARK, 1)})`
31
30
  })({
32
31
  theme
@@ -6,9 +6,7 @@ import { N20, N800, Y500 } from '@atlaskit/theme/colors';
6
6
  import { fontSize } from '@atlaskit/theme/constants';
7
7
  import { center, borderRadius } from '@atlaskit/media-ui';
8
8
  import { defaultImageCardDimensions } from '../../../utils';
9
-
10
9
  const isPercentage = value => /^\d+(\.\d+)?%$/.test(value);
11
-
12
10
  const shouldShowText = ({
13
11
  width,
14
12
  height
@@ -16,15 +14,12 @@ const shouldShowText = ({
16
14
  if (isPercentage(width) || isPercentage(height)) {
17
15
  return false;
18
16
  }
19
-
20
17
  return parseInt(width, 10) >= 240 && parseInt(height, 10) >= 90;
21
18
  };
22
-
23
19
  const normalizeDimension = (value, defaultValue) => {
24
20
  const sValue = value.toString();
25
21
  return isPercentage(sValue) ? sValue : isNaN(parseInt(sValue, 10)) ? defaultValue + 'px' : parseInt(sValue, 10) + 'px';
26
22
  };
27
-
28
23
  const getConvertedDimension = dimensions => {
29
24
  const {
30
25
  width = defaultImageCardDimensions.width,
@@ -35,7 +30,6 @@ const getConvertedDimension = dimensions => {
35
30
  height: normalizeDimension(height, defaultImageCardDimensions.height)
36
31
  };
37
32
  };
38
-
39
33
  const wrapperStyles = (dimensions = defaultImageCardDimensions) => {
40
34
  try {
41
35
  return css`
@@ -59,7 +53,6 @@ const wrapperStyles = (dimensions = defaultImageCardDimensions) => {
59
53
  return null;
60
54
  }
61
55
  };
62
-
63
56
  export class UnhandledErrorCard extends Component {
64
57
  render() {
65
58
  const {
@@ -75,5 +68,4 @@ export class UnhandledErrorCard extends Component {
75
68
  size: "medium"
76
69
  }), jsx("p", null, "We couldn't load this content"));
77
70
  }
78
-
79
71
  }
@@ -2,19 +2,20 @@
2
2
  * Primary reason is logged through Data Portal.
3
3
  * Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
4
4
  */
5
+
5
6
  export class MediaCardError extends Error {
6
7
  constructor(primaryReason, secondaryError) {
7
- super(primaryReason); // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
8
-
8
+ super(primaryReason);
9
+ // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
9
10
  this.primaryReason = primaryReason;
10
11
  this.secondaryError = secondaryError;
11
- Object.setPrototypeOf(this, new.target.prototype); // https://v8.dev/docs/stack-trace-api
12
+ Object.setPrototypeOf(this, new.target.prototype);
12
13
 
14
+ // https://v8.dev/docs/stack-trace-api
13
15
  if ('captureStackTrace' in Error) {
14
16
  Error.captureStackTrace(this, new.target);
15
17
  }
16
18
  }
17
-
18
19
  }
19
20
  export class LocalPreviewError extends MediaCardError {
20
21
  constructor(primaryReason, secondaryError) {
@@ -22,7 +23,6 @@ export class LocalPreviewError extends MediaCardError {
22
23
  this.primaryReason = primaryReason;
23
24
  this.secondaryError = secondaryError;
24
25
  }
25
-
26
26
  }
27
27
  export class RemotePreviewError extends MediaCardError {
28
28
  constructor(primaryReason, secondaryError) {
@@ -30,7 +30,6 @@ export class RemotePreviewError extends MediaCardError {
30
30
  this.primaryReason = primaryReason;
31
31
  this.secondaryError = secondaryError;
32
32
  }
33
-
34
33
  }
35
34
  export class SsrPreviewError extends MediaCardError {
36
35
  constructor(primaryReason, secondaryError) {
@@ -38,26 +37,20 @@ export class SsrPreviewError extends MediaCardError {
38
37
  this.primaryReason = primaryReason;
39
38
  this.secondaryError = secondaryError;
40
39
  }
41
-
42
40
  }
43
41
  export const getImageLoadPrimaryReason = source => {
44
42
  switch (source) {
45
43
  case 'cache-remote':
46
44
  return 'cache-remote-uri';
47
-
48
45
  case 'cache-local':
49
46
  return 'cache-local-uri';
50
-
51
47
  case 'external':
52
48
  return 'external-uri';
53
-
54
49
  case 'local':
55
50
  return 'local-uri';
56
-
57
51
  case 'remote':
58
52
  return 'remote-uri';
59
53
  // This fail reason will come from a bug, most likely.
60
-
61
54
  default:
62
55
  return `unknown-uri`;
63
56
  }
@@ -66,7 +59,6 @@ export class ImageLoadError extends MediaCardError {
66
59
  constructor(source) {
67
60
  super(getImageLoadPrimaryReason(source));
68
61
  }
69
-
70
62
  }
71
63
  export function isMediaCardError(err) {
72
64
  return err instanceof MediaCardError;
@@ -76,19 +68,18 @@ export const isRemotePreviewError = err => err instanceof RemotePreviewError;
76
68
  export const isUnsupportedLocalPreviewError = err => isMediaCardError(err) && err.primaryReason === 'local-preview-unsupported';
77
69
  export function isImageLoadError(err) {
78
70
  return err instanceof ImageLoadError;
79
- } // In a try/catch statement, the error caught is the type of unknown.
71
+ }
72
+
73
+ // In a try/catch statement, the error caught is the type of unknown.
80
74
  // We can use this helper to ensure that the error handled is the type of MediaCardError if unsure
81
75
  // If updatePrimaryReason is true, if it's a MediaCardError already, it will update it's primary reason
82
-
83
76
  export const ensureMediaCardError = (primaryReason, error, updatePrimaryReason) => {
84
77
  if (isMediaCardError(error)) {
85
78
  if (updatePrimaryReason && error.primaryReason !== primaryReason) {
86
79
  return new MediaCardError(primaryReason, error.secondaryError);
87
80
  }
88
-
89
81
  return error;
90
82
  }
91
-
92
83
  return new MediaCardError(primaryReason, error);
93
84
  };
94
85
  export const isUploadError = error => error && error.primaryReason === 'upload';
@@ -2,6 +2,7 @@
2
2
  * Entry Point: @atlaskit/media-card
3
3
  * tsconfig.entry-points.json
4
4
  */
5
+
5
6
  export { Card } from './card';
6
7
  export { MediaInlineCard } from './inline';
7
8
  export { CardLoading } from './utils/lightCards/cardLoading';