@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
@@ -4,30 +4,19 @@ import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
4
4
  export default class MediaInlineCardLoader extends React.PureComponent {
5
5
  constructor(...args) {
6
6
  super(...args);
7
-
8
7
  _defineProperty(this, "isMounted", false);
9
-
10
8
  _defineProperty(this, "state", {
11
9
  MediaInlineCard: MediaInlineCardLoader.MediaInlineCard,
12
10
  ErrorBoundary: MediaInlineCardLoader.ErrorBoundary
13
11
  });
14
12
  }
15
-
16
13
  async componentDidMount() {
17
14
  this.isMounted = true;
18
-
19
15
  if (!this.state.MediaInlineCard) {
20
16
  try {
21
- const [mediaClient, cardModule, mediaInlineErrorBoundaryModule] = await Promise.all([import(
22
- /* webpackChunkName: "@atlaskit-internal_media-client" */
23
- '@atlaskit/media-client'), import(
24
- /* webpackChunkName: "@atlaskit-internal_inline-media-card" */
25
- './mediaInlineCard'), import(
26
- /* webpackChunkName: "@atlaskit-internal_media-inline-error-boundary" */
27
- './mediaInlineAnalyticsErrorBoundary')]);
17
+ const [mediaClient, cardModule, mediaInlineErrorBoundaryModule] = await Promise.all([import( /* webpackChunkName: "@atlaskit-internal_media-client" */'@atlaskit/media-client'), import( /* webpackChunkName: "@atlaskit-internal_inline-media-card" */'./mediaInlineCard'), import( /* webpackChunkName: "@atlaskit-internal_media-inline-error-boundary" */'./mediaInlineAnalyticsErrorBoundary')]);
28
18
  MediaInlineCardLoader.MediaInlineCard = mediaClient.withMediaClient(cardModule.MediaInlineCard);
29
19
  MediaInlineCardLoader.ErrorBoundary = mediaInlineErrorBoundaryModule.default;
30
-
31
20
  if (this.isMounted) {
32
21
  this.setState({
33
22
  MediaInlineCard: MediaInlineCardLoader.MediaInlineCard,
@@ -37,26 +26,20 @@ export default class MediaInlineCardLoader extends React.PureComponent {
37
26
  } catch (error) {}
38
27
  }
39
28
  }
40
-
41
29
  async componentWillUnmount() {
42
30
  this.isMounted = false;
43
31
  }
44
-
45
32
  render() {
46
33
  const {
47
34
  MediaInlineCard,
48
35
  ErrorBoundary
49
36
  } = this.state;
50
-
51
37
  if (!MediaInlineCard || !ErrorBoundary) {
52
38
  return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
53
39
  message: ""
54
40
  });
55
41
  }
56
-
57
42
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(MediaInlineCard, this.props));
58
43
  }
59
-
60
44
  }
61
-
62
45
  _defineProperty(MediaInlineCardLoader, "displayName", 'MediaInlineCardLoader');
@@ -3,14 +3,11 @@ import React from 'react';
3
3
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import { fireMediaCardEvent } from '../utils/analytics';
6
-
7
6
  class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
8
7
  constructor(props) {
9
8
  super(props);
10
-
11
9
  _defineProperty(this, "fireOperationalEvent", (error, info) => {
12
10
  var _window, _window$navigator;
13
-
14
11
  const {
15
12
  data = {},
16
13
  createAnalyticsEvent
@@ -29,12 +26,10 @@ class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
29
26
  };
30
27
  fireMediaCardEvent(payload, createAnalyticsEvent);
31
28
  });
32
-
33
29
  this.state = {
34
30
  hasError: false
35
31
  };
36
32
  }
37
-
38
33
  componentDidCatch(error, info) {
39
34
  try {
40
35
  this.fireOperationalEvent(error, info);
@@ -43,7 +38,6 @@ class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
43
38
  });
44
39
  } catch (e) {}
45
40
  }
46
-
47
41
  render() {
48
42
  const {
49
43
  hasError
@@ -51,21 +45,16 @@ class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
51
45
  const {
52
46
  children
53
47
  } = this.props;
54
-
55
48
  if (hasError) {
56
49
  // TODO refactor error boundary for inline card https://product-fabric.atlassian.net/browse/MEX-2140
57
50
  return /*#__PURE__*/React.createElement(React.Fragment, null);
58
51
  }
59
-
60
52
  return children;
61
53
  }
62
-
63
54
  }
64
-
65
55
  _defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
66
-
67
56
  const packageName = "@atlaskit/media-card";
68
- const packageVersion = "74.5.0";
57
+ const packageVersion = "74.5.2";
69
58
  const MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
70
59
  packageVersion,
71
60
  packageName,
@@ -19,19 +19,15 @@ export const MediaInlineCardInternal = ({
19
19
  const [fileState, setFileState] = useState();
20
20
  const [isErrored, setIsErrored] = useState(false);
21
21
  const [isMediaViewerVisible, setMediaViewerVisible] = useState(false);
22
-
23
22
  const onMediaInlineCardClick = event => {
24
23
  if (shouldOpenMediaViewer) {
25
24
  setMediaViewerVisible(true);
26
25
  }
27
-
28
26
  if (onClick) {
29
27
  onClick(event);
30
28
  }
31
29
  };
32
-
33
30
  const onMediaViewerClose = () => setMediaViewerVisible(false);
34
-
35
31
  const renderMediaViewer = () => {
36
32
  if (isMediaViewerVisible) {
37
33
  const dataSource = mediaViewerDataSource || {
@@ -45,16 +41,13 @@ export const MediaInlineCardInternal = ({
45
41
  onClose: onMediaViewerClose
46
42
  }), document.body);
47
43
  }
48
-
49
44
  return null;
50
45
  };
51
-
52
46
  const renderContent = children => {
53
47
  return intl ? children : /*#__PURE__*/React.createElement(IntlProvider, {
54
48
  locale: "en"
55
49
  }, children);
56
50
  };
57
-
58
51
  const defaultIntl = createIntl({
59
52
  locale: 'en'
60
53
  });
@@ -74,42 +67,36 @@ export const MediaInlineCardInternal = ({
74
67
  subscription.unsubscribe();
75
68
  };
76
69
  }, [identifier.collectionName, identifier.id, mediaClient.file]);
77
-
78
70
  if (!fileState) {
79
71
  return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
80
72
  message: (intl || defaultIntl).formatMessage(messages.loading_file),
81
73
  isSelected: isSelected
82
74
  });
83
75
  }
84
-
85
76
  if (isErrored) {
86
77
  return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
87
78
  message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file),
88
79
  isSelected: isSelected
89
80
  });
90
81
  }
91
-
92
82
  if (fileState.status === 'error') {
93
83
  return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
94
84
  message: fileState.message || '',
95
85
  isSelected: isSelected
96
86
  });
97
87
  }
98
-
99
88
  if (fileState.status === 'failed-processing') {
100
89
  return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
101
90
  message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file),
102
91
  isSelected: isSelected
103
92
  });
104
93
  }
105
-
106
94
  if (fileState.status === 'uploading') {
107
95
  return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
108
96
  message: fileState.name,
109
97
  isSelected: isSelected
110
98
  });
111
99
  }
112
-
113
100
  const {
114
101
  mediaType,
115
102
  name,
@@ -124,7 +111,6 @@ export const MediaInlineCardInternal = ({
124
111
  });
125
112
  const mediaViewer = renderMediaViewer();
126
113
  let formattedDate;
127
-
128
114
  if (fileState.createdAt) {
129
115
  const {
130
116
  locale = 'en'
@@ -133,7 +119,6 @@ export const MediaInlineCardInternal = ({
133
119
  };
134
120
  formattedDate = formatDate(fileState.createdAt, locale);
135
121
  }
136
-
137
122
  return renderContent( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
138
123
  position: "bottom",
139
124
  content: formattedDate,
@@ -2,8 +2,8 @@
2
2
  * Entry Point: @atlaskit/media-card/types
3
3
  * tsconfig.entry-points.json
4
4
  */
5
- export let MediaCardCursor;
6
5
 
6
+ export let MediaCardCursor;
7
7
  (function (MediaCardCursor) {
8
8
  MediaCardCursor["Action"] = "pointer";
9
9
  MediaCardCursor["NotReady"] = "wait";
@@ -95,12 +95,10 @@ export const getRenderErrorFailReason = error => {
95
95
  export const getRenderErrorErrorReason = error => {
96
96
  if (isMediaCardError(error) && error.secondaryError) {
97
97
  const mediaClientReason = getMediaClientErrorReason(error.secondaryError);
98
-
99
98
  if (mediaClientReason !== 'unknown') {
100
99
  return mediaClientReason;
101
100
  }
102
101
  }
103
-
104
102
  return 'nativeError';
105
103
  };
106
104
  export const getRenderErrorErrorDetail = error => {
@@ -113,7 +111,6 @@ export const getRenderErrorErrorDetail = error => {
113
111
  export const getErrorTraceContext = error => {
114
112
  if (isMediaCardError(error) && !!error.secondaryError && isRequestError(error.secondaryError)) {
115
113
  var _error$secondaryError;
116
-
117
114
  return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
118
115
  }
119
116
  };
@@ -1,7 +1,6 @@
1
1
  import { size } from '@atlaskit/media-ui';
2
2
  export const breakpointSize = (width, sizes = cardBreakpointSizes) => {
3
3
  const value = parseInt(`${width}`, 10); // Normalize value
4
-
5
4
  const keys = Object.keys(sizes);
6
5
  const defaultValue = keys[0];
7
6
  let breakpoint;
@@ -32,7 +31,6 @@ export const breakpointStyles = ({
32
31
  ${size('14px !important')}
33
32
  }
34
33
  `;
35
-
36
34
  case 'medium':
37
35
  return `
38
36
  .title {
@@ -42,7 +40,6 @@ export const breakpointStyles = ({
42
40
  ${size('16px !important')}
43
41
  }
44
42
  `;
45
-
46
43
  case 'large':
47
44
  return `
48
45
  .overlay {
@@ -58,7 +55,6 @@ export const breakpointStyles = ({
58
55
  ${size('18px !important')}
59
56
  }
60
57
  `;
61
-
62
58
  case 'xlarge':
63
59
  return `
64
60
  border-radius: 2px;
@@ -5,12 +5,10 @@ import { CardActionButton } from './cardActionButton';
5
5
  export class CardActionIconButton extends Component {
6
6
  constructor(...args) {
7
7
  super(...args);
8
-
9
8
  _defineProperty(this, "onMouseDown", event => {
10
9
  event.preventDefault();
11
10
  });
12
11
  }
13
-
14
12
  render() {
15
13
  const {
16
14
  icon,
@@ -26,8 +24,8 @@ export class CardActionIconButton extends Component {
26
24
  },
27
25
  variant: variant
28
26
  }, icon);
29
- } // this is to prevent currently focused text to loose cursor on clicking card action
30
- // this does not prevent onclick behavior
31
-
27
+ }
32
28
 
29
+ // this is to prevent currently focused text to loose cursor on clicking card action
30
+ // this does not prevent onclick behavior
33
31
  }
@@ -15,12 +15,10 @@ const CardActionButtonWithAnalytics = withAnalyticsEvents({
15
15
  attributes: {}
16
16
  })
17
17
  })(CardActionButton);
18
-
19
18
  // Trick applied due to the lack of props type of DropdownItem
20
19
  const DropdownItemWithProps = props => /*#__PURE__*/React.createElement(DropdownItem, _extends({
21
20
  testId: "media-card-actions-menu-item"
22
21
  }, props));
23
-
24
22
  const createDropdownItemWithAnalytics = (action, index) => {
25
23
  const {
26
24
  label,
@@ -42,7 +40,6 @@ const createDropdownItemWithAnalytics = (action, index) => {
42
40
  onClick: handler
43
41
  }, label);
44
42
  };
45
-
46
43
  export class CardActionsDropdownMenu extends Component {
47
44
  render() {
48
45
  const {
@@ -51,7 +48,6 @@ export class CardActionsDropdownMenu extends Component {
51
48
  onOpenChange,
52
49
  triggerVariant
53
50
  } = this.props;
54
-
55
51
  if (actions.length > 0) {
56
52
  return /*#__PURE__*/React.createElement(DropdownMenu, {
57
53
  testId: "media-card-actions-menu",
@@ -73,5 +69,4 @@ export class CardActionsDropdownMenu extends Component {
73
69
  return null;
74
70
  }
75
71
  }
76
-
77
72
  }
@@ -7,26 +7,21 @@ import { CardActionsDropdownMenu } from './cardActionsDropdownMenu';
7
7
  import { PreventClickThrough } from '../preventClickThrough';
8
8
  import { createAndFireMediaCardEvent } from '../analytics';
9
9
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
10
-
11
10
  const CardActionIconButtonWithProps = props => jsx(CardActionIconButton, props);
12
-
13
11
  export class CardActionsView extends Component {
14
12
  render() {
15
13
  const {
16
14
  actions
17
15
  } = this.props;
18
-
19
16
  if (!actions.length) {
20
17
  return null;
21
18
  }
22
-
23
19
  const primaryAction = actions.find(actionWithIcon);
24
20
  const otherActions = actions.filter(actionNotEqualTo(primaryAction));
25
21
  return jsx(PreventClickThrough, null, jsx("div", {
26
22
  css: wrapperStyles
27
23
  }, primaryAction ? this.renderActionIconButton(primaryAction, true) : null, this.renderOtherActionButtons(otherActions)));
28
24
  }
29
-
30
25
  renderActionIconButton(action, isPrimary) {
31
26
  const {
32
27
  triggerColor,
@@ -56,7 +51,6 @@ export class CardActionsView extends Component {
56
51
  variant: variant
57
52
  });
58
53
  }
59
-
60
54
  renderOtherActionButtons(actions) {
61
55
  if (actions.length === 0) {
62
56
  return null;
@@ -68,7 +62,6 @@ export class CardActionsView extends Component {
68
62
  } = this.props;
69
63
  const firstActionWithIcon = actions.find(actionWithIcon);
70
64
  const otherActions = actions.filter(actionNotEqualTo(firstActionWithIcon));
71
-
72
65
  if (firstActionWithIcon && otherActions.length === 0) {
73
66
  return this.renderActionIconButton(firstActionWithIcon, false);
74
67
  } else {
@@ -81,13 +74,10 @@ export class CardActionsView extends Component {
81
74
  }
82
75
  }
83
76
  }
84
-
85
77
  }
86
-
87
78
  function actionWithIcon(action) {
88
79
  return !!action.icon;
89
80
  }
90
-
91
81
  function actionNotEqualTo(otherAction) {
92
82
  return action => action !== otherAction;
93
83
  }
@@ -10,12 +10,10 @@ export const wrapperStyles = css`
10
10
  line-height: 0;
11
11
  `;
12
12
  export let CardActionIconButtonVariant;
13
-
14
13
  (function (CardActionIconButtonVariant) {
15
14
  CardActionIconButtonVariant["default"] = "default";
16
15
  CardActionIconButtonVariant["filled"] = "filled";
17
16
  })(CardActionIconButtonVariant || (CardActionIconButtonVariant = {}));
18
-
19
17
  const getVariantStyles = variant => {
20
18
  return variant === 'filled' ? `
21
19
  background-color: ${`var(--ds-surface-overlay, ${rgba(N0, 0.8)})`};
@@ -34,7 +32,6 @@ const getVariantStyles = variant => {
34
32
  }
35
33
  `;
36
34
  };
37
-
38
35
  export const cardActionButtonStyles = ({
39
36
  variant
40
37
  }) => css`
@@ -1,4 +1,5 @@
1
1
  // Default dimensions
2
+
2
3
  export const defaultSmallCardDimensions = {
3
4
  width: '100%',
4
5
  height: 42
@@ -14,7 +15,9 @@ export const defaultHorizontalCardDimensions = {
14
15
  export const defaultSquareCardDimensions = {
15
16
  width: 300,
16
17
  height: 300
17
- }; // Small dimensions
18
+ };
19
+
20
+ // Small dimensions
18
21
 
19
22
  export const minSmallCardDimensions = {
20
23
  width: 200,
@@ -31,7 +34,9 @@ export const minSquareCardDimensions = {
31
34
  export const minHorizontalCardDimensions = {
32
35
  width: 400,
33
36
  height: 125
34
- }; // Max dimensions
37
+ };
38
+
39
+ // Max dimensions
35
40
 
36
41
  export const maxImageCardDimensions = {
37
42
  width: 480,
@@ -49,59 +54,47 @@ export const getCardMaxHeight = appearance => {
49
54
  if (appearance === 'image') {
50
55
  return maxImageCardDimensions.height;
51
56
  }
52
-
53
57
  if (appearance === 'horizontal') {
54
58
  return maxHorizontalCardDimensions.height;
55
59
  }
56
-
57
60
  if (appearance === 'square') {
58
61
  return maxSquareCardDimensions.height;
59
62
  }
60
-
61
63
  return maxSquareCardDimensions.width;
62
64
  };
63
65
  export const getCardMinWidth = appearance => {
64
66
  if (appearance === 'image') {
65
67
  return minImageCardDimensions.width;
66
68
  }
67
-
68
69
  if (appearance === 'horizontal') {
69
70
  return minHorizontalCardDimensions.width;
70
71
  }
71
-
72
72
  if (appearance === 'square') {
73
73
  return minSquareCardDimensions.width;
74
74
  }
75
-
76
75
  return minSmallCardDimensions.width;
77
76
  };
78
77
  export const getCardMaxWidth = appearance => {
79
78
  if (appearance === 'image') {
80
79
  return maxImageCardDimensions.width;
81
80
  }
82
-
83
81
  if (appearance === 'horizontal') {
84
82
  return maxHorizontalCardDimensions.width;
85
83
  }
86
-
87
84
  if (appearance === 'square') {
88
85
  return maxSquareCardDimensions.width;
89
86
  }
90
-
91
87
  return maxSquareCardDimensions.width;
92
88
  };
93
89
  export const getDefaultCardDimensions = appearance => {
94
90
  if (appearance === 'image') {
95
91
  return defaultImageCardDimensions;
96
92
  }
97
-
98
93
  if (appearance === 'square') {
99
94
  return defaultSquareCardDimensions;
100
95
  }
101
-
102
96
  if (appearance === 'horizontal') {
103
97
  return defaultHorizontalCardDimensions;
104
98
  }
105
-
106
99
  return defaultImageCardDimensions;
107
100
  };
@@ -1,13 +1,10 @@
1
1
  import { isValidPercentageUnit } from './isValidPercentageUnit';
2
2
  import { containsPixelUnit } from './containsPixelUnit';
3
-
4
3
  const isPixelEquivalent = dimension => typeof dimension === 'number' || containsPixelUnit(`${dimension}`);
5
-
6
4
  export const canCompareDimension = (current, next) => {
7
5
  if (!current || !next) {
8
6
  return false;
9
7
  }
10
-
11
8
  const bothPixelEquivalent = isPixelEquivalent(current) && isPixelEquivalent(next);
12
9
  const bothPercentage = isValidPercentageUnit(current) && isValidPercentageUnit(next);
13
10
  return bothPixelEquivalent || bothPercentage;
@@ -2,10 +2,8 @@ export default (() => {
2
2
  if (typeof window === 'undefined') {
3
3
  return;
4
4
  }
5
-
6
5
  if (typeof window.document === 'undefined') {
7
6
  return;
8
7
  }
9
-
10
8
  return window.document;
11
9
  });
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /**@jsx jsx */
4
3
  import { jsx } from '@emotion/react';
5
4
  import { Component } from 'react';
@@ -17,9 +16,7 @@ export class ErrorIcon extends Component {
17
16
  size: size
18
17
  }));
19
18
  }
20
-
21
19
  }
22
-
23
20
  _defineProperty(ErrorIcon, "defaultProps", {
24
21
  size: 'small'
25
22
  });
@@ -28,5 +28,4 @@ export class FileIcon extends Component {
28
28
  className: fileTypeIconClass
29
29
  }, icon);
30
30
  }
31
-
32
31
  }
@@ -6,19 +6,15 @@ import { containsPixelUnit } from './containsPixelUnit';
6
6
  export const getDataURIDimension = (dimension, options) => {
7
7
  const retinaFactor = isRetina() ? 2 : 1;
8
8
  const dimensionValue = options.dimensions && options.dimensions[dimension] || '';
9
-
10
9
  if (isValidPercentageUnit(dimensionValue) && options.element) {
11
10
  return getElementDimension(options.element, dimension) * retinaFactor;
12
11
  }
13
-
14
12
  if (typeof dimensionValue === 'number') {
15
13
  return dimensionValue * retinaFactor;
16
14
  }
17
-
18
15
  if (containsPixelUnit(`${dimensionValue}`)) {
19
16
  return parseInt(`${dimensionValue}`, 10) * retinaFactor;
20
17
  }
21
-
22
18
  return defaultImageCardDimensions[dimension] * retinaFactor;
23
19
  };
24
20
  export const getRequestedDimensions = options => {
@@ -1,23 +1,20 @@
1
1
  import { MediaCardCursor } from '../types';
2
-
3
2
  /**
4
3
  * When the returned value is undefined, we'd expect the media card to take the parent's cursor style.
5
4
  */
5
+
6
6
  export const getMediaCardCursor = (useInlinePlayer, useMediaViewer, isErrorStatus, hasCardPreview, mediaType) => {
7
7
  // If error status or no action is requested = NoAction
8
8
  if (isErrorStatus || !useInlinePlayer && !useMediaViewer) {
9
9
  return;
10
10
  }
11
-
12
11
  if (!mediaType && (useInlinePlayer || useInlinePlayer && useMediaViewer)) {
13
12
  return MediaCardCursor.NotReady;
14
13
  } else if (mediaType === 'video' && hasCardPreview && useInlinePlayer) {
15
14
  return MediaCardCursor.Action;
16
15
  }
17
-
18
16
  if (useMediaViewer) {
19
17
  return MediaCardCursor.Action;
20
18
  }
21
-
22
19
  return;
23
20
  };
@@ -1,10 +1,8 @@
1
1
  import { getMediaCardSSR, getKey } from './globalScope';
2
2
  export const getSSRData = identifier => {
3
3
  const mediaCardSsr = getMediaCardSSR();
4
-
5
4
  if (!mediaCardSsr) {
6
5
  return;
7
6
  }
8
-
9
7
  return mediaCardSsr[getKey(identifier)];
10
8
  };
@@ -5,32 +5,27 @@ import { printFunctionCall, printScript } from '../printScript';
5
5
  // Any changes to this file must be tested directly in product before merging.
6
6
  // The scripts printed here might differ from what we observe in our internal tests
7
7
  // due to minimification, for example.
8
+
8
9
  export const GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
9
10
  export const GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
10
11
  export function getMediaGlobalScope(globalScope = window) {
11
12
  // Must match GLOBAL_MEDIA_NAMESPACE. Can't reference the constant from here.
12
13
  const namespace = '__MEDIA_INTERNAL';
13
-
14
14
  if (!globalScope[namespace]) {
15
15
  globalScope[namespace] = {};
16
16
  }
17
-
18
17
  return globalScope[namespace];
19
18
  }
20
19
  export function getMediaCardSSR(globalScope = window) {
21
- const globalMedia = getMediaGlobalScope(globalScope); // Must match GLOBAL_MEDIA_CARD_SSR. Can't reference the constant from here.
22
-
20
+ const globalMedia = getMediaGlobalScope(globalScope);
21
+ // Must match GLOBAL_MEDIA_CARD_SSR. Can't reference the constant from here.
23
22
  const key = 'mediaCardSsr';
24
-
25
23
  if (!globalMedia[key]) {
26
24
  globalMedia[key] = {};
27
25
  }
28
-
29
26
  return globalMedia[key];
30
27
  }
31
-
32
28
  const dashed = param => param ? `-${param}` : '';
33
-
34
29
  export const getKey = ({
35
30
  id,
36
31
  collectionName,
@@ -44,12 +39,10 @@ export const storeDataURI = (key, dataURI, dimensions, error, globalScope = wind
44
39
  error
45
40
  };
46
41
  };
47
-
48
42
  const generateScript = (identifier, dataURI, dimensions, error) => {
49
43
  const functionCall = printFunctionCall(storeDataURI, getKey(identifier), dataURI, dimensions, error);
50
44
  return printScript([getMediaCardSSR.toString(), getMediaGlobalScope.toString(), functionCall]);
51
45
  };
52
-
53
46
  export const StoreSSRDataScript = ({
54
47
  dataURI,
55
48
  identifier,
@@ -11,7 +11,6 @@ export class CardError extends Component {
11
11
  dimensions: dimensions
12
12
  }, this.icon);
13
13
  }
14
-
15
14
  get icon() {
16
15
  const {
17
16
  size
@@ -20,9 +19,7 @@ export class CardError extends Component {
20
19
  size: size
21
20
  });
22
21
  }
23
-
24
22
  }
25
-
26
23
  _defineProperty(CardError, "defaultProps", {
27
24
  size: 'medium'
28
25
  });