@atlaskit/media-card 78.19.2 → 78.19.4

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 (59) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/card/svgView/svgView.js +17 -6
  5. package/dist/cjs/inline/loader.js +1 -1
  6. package/dist/cjs/utils/ufoExperiences.js +1 -1
  7. package/dist/es2019/card/card.js +1 -1
  8. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  9. package/dist/es2019/card/svgView/svgView.js +13 -3
  10. package/dist/es2019/inline/loader.js +1 -1
  11. package/dist/es2019/utils/ufoExperiences.js +1 -1
  12. package/dist/esm/card/card.js +1 -1
  13. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  14. package/dist/esm/card/svgView/svgView.js +13 -3
  15. package/dist/esm/inline/loader.js +1 -1
  16. package/dist/esm/utils/ufoExperiences.js +1 -1
  17. package/dist/types/card/card.d.ts +2 -2
  18. package/dist/types/card/externalImageCard.d.ts +2 -2
  19. package/dist/types/card/fileCard.d.ts +2 -2
  20. package/dist/types/card/inlinePlayer.d.ts +1 -1
  21. package/dist/types/card/svgView/svgView.d.ts +3 -1
  22. package/dist/types/card/ui/actionsBar/actionsBar.d.ts +1 -1
  23. package/dist/types/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -1
  24. package/dist/types/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +2 -2
  25. package/dist/types/card/ui/playButton/playButton.d.ts +2 -2
  26. package/dist/types/card/ui/progressBar/progressBar.d.ts +2 -2
  27. package/dist/types/card/ui/tickBox/tickBox.d.ts +2 -2
  28. package/dist/types/errors.d.ts +1 -1
  29. package/dist/types/inline/loader.d.ts +1 -1
  30. package/dist/types/utils/lightCards/cardError.d.ts +3 -2
  31. package/dist/types/utils/lightCards/cardLoading.d.ts +2 -1
  32. package/dist/types/utils/viewportDetector.d.ts +2 -2
  33. package/dist/types-ts4.5/card/card.d.ts +2 -2
  34. package/dist/types-ts4.5/card/externalImageCard.d.ts +2 -2
  35. package/dist/types-ts4.5/card/fileCard.d.ts +2 -2
  36. package/dist/types-ts4.5/card/inlinePlayer.d.ts +1 -1
  37. package/dist/types-ts4.5/card/svgView/svgView.d.ts +3 -1
  38. package/dist/types-ts4.5/card/ui/actionsBar/actionsBar.d.ts +1 -1
  39. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -1
  40. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +2 -2
  41. package/dist/types-ts4.5/card/ui/playButton/playButton.d.ts +2 -2
  42. package/dist/types-ts4.5/card/ui/progressBar/progressBar.d.ts +2 -2
  43. package/dist/types-ts4.5/card/ui/tickBox/tickBox.d.ts +2 -2
  44. package/dist/types-ts4.5/errors.d.ts +1 -1
  45. package/dist/types-ts4.5/inline/loader.d.ts +1 -1
  46. package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +3 -2
  47. package/dist/types-ts4.5/utils/lightCards/cardLoading.d.ts +2 -1
  48. package/dist/types-ts4.5/utils/viewportDetector.d.ts +2 -2
  49. package/package.json +6 -5
  50. package/dist/cjs/card/svgView/errors.js +0 -50
  51. package/dist/cjs/card/svgView/useResolveSvg.js +0 -115
  52. package/dist/es2019/card/svgView/errors.js +0 -28
  53. package/dist/es2019/card/svgView/useResolveSvg.js +0 -68
  54. package/dist/esm/card/svgView/errors.js +0 -43
  55. package/dist/esm/card/svgView/useResolveSvg.js +0 -108
  56. package/dist/types/card/svgView/errors.d.ts +0 -9
  57. package/dist/types/card/svgView/useResolveSvg.d.ts +0 -7
  58. package/dist/types-ts4.5/card/svgView/errors.d.ts +0 -9
  59. package/dist/types-ts4.5/card/svgView/useResolveSvg.d.ts +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 78.19.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#108452](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108452)
8
+ [`47669ab510c09`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/47669ab510c09) -
9
+ Handle errors from SVG blob to Dara URI conversion
10
+ - Updated dependencies
11
+
12
+ ## 78.19.3
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 78.19.2
4
19
 
5
20
  ### Patch Changes
@@ -21,7 +21,7 @@ var _excluded = ["identifier"];
21
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  var packageName = "@atlaskit/media-card";
24
- var packageVersion = "78.19.2";
24
+ var packageVersion = "78.19.4";
25
25
  var CardBase = exports.CardBase = function CardBase(_ref) {
26
26
  var identifier = _ref.identifier,
27
27
  otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
87
87
  }(_react.default.Component);
88
88
  (0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
89
89
  var packageName = "@atlaskit/media-card";
90
- var packageVersion = "78.19.2";
90
+ var packageVersion = "78.19.4";
91
91
 
92
92
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
93
93
  var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
@@ -5,15 +5,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.SvgView = void 0;
8
+ exports.getErrorReason = exports.SvgView = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = require("@emotion/react");
12
12
  var _react2 = _interopRequireWildcard(require("react"));
13
13
  var _errors = require("../../errors");
14
- var _errors2 = require("./errors");
15
14
  var _helpers = require("./helpers");
16
- var _useResolveSvg2 = require("./useResolveSvg");
15
+ var _mediaSvg = require("@atlaskit/media-svg");
17
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -21,6 +20,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
21
20
  * @jsxRuntime classic
22
21
  * @jsx jsx
23
22
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
+ var getErrorReason = exports.getErrorReason = function getErrorReason(svgReason) {
24
+ switch (svgReason) {
25
+ case 'img-error':
26
+ return 'svg-img-error';
27
+ case 'binary-fetch':
28
+ return 'svg-binary-fetch';
29
+ case 'blob-to-datauri':
30
+ return 'svg-blob-to-datauri';
31
+ default:
32
+ return 'svg-unknown-error';
33
+ }
34
+ };
24
35
  var svgRendererStyles = (0, _react.css)({
25
36
  objectFit: 'contain',
26
37
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -58,7 +69,7 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
58
69
  onLoad === null || onLoad === void 0 || onLoad();
59
70
  };
60
71
  var onSvgError = function onSvgError(err) {
61
- var error = new _errors.MediaCardError((0, _errors2.getErrorReason)(err.primaryReason), err.secondaryError);
72
+ var error = new _errors.MediaCardError(getErrorReason(err.primaryReason), err.secondaryError);
62
73
  onError === null || onError === void 0 || onError(error);
63
74
  };
64
75
  (0, _react2.useEffect)(function () {
@@ -66,7 +77,7 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
66
77
  calculateDimensions(imgRef.current);
67
78
  }
68
79
  }, [imgRef, calculateDimensions]);
69
- var _useResolveSvg = (0, _useResolveSvg2.useResolveSvg)(identifier, onSvgError),
80
+ var _useResolveSvg = (0, _mediaSvg.useResolveSvg)(identifier, onSvgError),
70
81
  svgUrl = _useResolveSvg.svgUrl,
71
82
  source = _useResolveSvg.source;
72
83
  var width = svgDimensions.width,
@@ -84,7 +95,7 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
84
95
  }, svgDimensions),
85
96
  onLoad: onSvgLoad,
86
97
  onError: function onError() {
87
- onSvgError(new _errors2.MediaSVGError('img-error'));
98
+ onSvgError(new _mediaSvg.MediaSVGError('img-error'));
88
99
  },
89
100
  ref: imgRef
90
101
  }) : null;
@@ -117,7 +117,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
117
117
  ErrorBoundary = _this$state.ErrorBoundary;
118
118
  var analyticsContext = {
119
119
  packageVersion: "@atlaskit/media-card",
120
- packageName: "78.19.2",
120
+ packageName: "78.19.4",
121
121
  componentName: 'mediaInlineCard',
122
122
  component: 'mediaInlineCard'
123
123
  };
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
17
  var packageName = "@atlaskit/media-card";
18
- var packageVersion = "78.19.2";
18
+ var packageVersion = "78.19.4";
19
19
  var SAMPLE_RATE = 0.05;
20
20
  var concurrentExperience;
21
21
  var getExperience = function getExperience(id) {
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
9
9
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import UFOLabel from '@atlaskit/react-ufo/label';
11
11
  const packageName = "@atlaskit/media-card";
12
- const packageVersion = "78.19.2";
12
+ const packageVersion = "78.19.4";
13
13
  export const CardBase = ({
14
14
  identifier,
15
15
  ...otherProps
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
66
66
  }
67
67
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
68
68
  const packageName = "@atlaskit/media-card";
69
- const packageVersion = "78.19.2";
69
+ const packageVersion = "78.19.4";
70
70
 
71
71
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
72
72
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
@@ -6,10 +6,20 @@
6
6
  import { jsx, css } from '@emotion/react';
7
7
  import React, { useState, useRef, useEffect, useCallback } from 'react';
8
8
  import { MediaCardError } from '../../errors';
9
- import { MediaSVGError } from './errors';
10
9
  import { calculateSvgDimensions } from './helpers';
11
- import { getErrorReason } from './errors';
12
- import { useResolveSvg } from './useResolveSvg';
10
+ import { useResolveSvg, MediaSVGError } from '@atlaskit/media-svg';
11
+ export const getErrorReason = svgReason => {
12
+ switch (svgReason) {
13
+ case 'img-error':
14
+ return 'svg-img-error';
15
+ case 'binary-fetch':
16
+ return 'svg-binary-fetch';
17
+ case 'blob-to-datauri':
18
+ return 'svg-blob-to-datauri';
19
+ default:
20
+ return 'svg-unknown-error';
21
+ }
22
+ };
13
23
  const svgRendererStyles = css({
14
24
  objectFit: 'contain',
15
25
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
37
37
  } = this.state;
38
38
  const analyticsContext = {
39
39
  packageVersion: "@atlaskit/media-card",
40
- packageName: "78.19.2",
40
+ packageName: "78.19.4",
41
41
  componentName: 'mediaInlineCard',
42
42
  component: 'mediaInlineCard'
43
43
  };
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
5
5
  import { MediaCardError } from '../errors';
6
6
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
7
7
  const packageName = "@atlaskit/media-card";
8
- const packageVersion = "78.19.2";
8
+ const packageVersion = "78.19.4";
9
9
  const SAMPLE_RATE = 0.05;
10
10
  let concurrentExperience;
11
11
  const getExperience = id => {
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
11
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
12
12
  import UFOLabel from '@atlaskit/react-ufo/label';
13
13
  var packageName = "@atlaskit/media-card";
14
- var packageVersion = "78.19.2";
14
+ var packageVersion = "78.19.4";
15
15
  export var CardBase = function CardBase(_ref) {
16
16
  var identifier = _ref.identifier,
17
17
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
80
80
  }(React.Component);
81
81
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
82
82
  var packageName = "@atlaskit/media-card";
83
- var packageVersion = "78.19.2";
83
+ var packageVersion = "78.19.4";
84
84
 
85
85
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
86
86
  var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
@@ -10,10 +10,20 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  import { jsx, css } from '@emotion/react';
11
11
  import React, { useState, useRef, useEffect, useCallback } from 'react';
12
12
  import { MediaCardError } from '../../errors';
13
- import { MediaSVGError } from './errors';
14
13
  import { calculateSvgDimensions } from './helpers';
15
- import { getErrorReason } from './errors';
16
- import { useResolveSvg } from './useResolveSvg';
14
+ import { useResolveSvg, MediaSVGError } from '@atlaskit/media-svg';
15
+ export var getErrorReason = function getErrorReason(svgReason) {
16
+ switch (svgReason) {
17
+ case 'img-error':
18
+ return 'svg-img-error';
19
+ case 'binary-fetch':
20
+ return 'svg-binary-fetch';
21
+ case 'blob-to-datauri':
22
+ return 'svg-blob-to-datauri';
23
+ default:
24
+ return 'svg-unknown-error';
25
+ }
26
+ };
17
27
  var svgRendererStyles = css({
18
28
  objectFit: 'contain',
19
29
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
101
101
  ErrorBoundary = _this$state.ErrorBoundary;
102
102
  var analyticsContext = {
103
103
  packageVersion: "@atlaskit/media-card",
104
- packageName: "78.19.2",
104
+ packageName: "78.19.4",
105
105
  componentName: 'mediaInlineCard',
106
106
  component: 'mediaInlineCard'
107
107
  };
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
8
8
  import { MediaCardError } from '../errors';
9
9
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
10
10
  var packageName = "@atlaskit/media-card";
11
- var packageVersion = "78.19.2";
11
+ var packageVersion = "78.19.4";
12
12
  var SAMPLE_RATE = 0.05;
13
13
  var concurrentExperience;
14
14
  var getExperience = function getExperience(id) {
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { type WrappedComponentProps } from 'react-intl-next';
3
3
  import { type CardProps } from '../types';
4
4
  export type CardBaseProps = CardProps & Partial<WrappedComponentProps>;
5
- export declare const CardBase: ({ identifier, ...otherProps }: CardBaseProps & WrappedComponentProps) => JSX.Element;
6
- export declare const CardWithPerformanceObserver: (props: CardBaseProps & WrappedComponentProps) => JSX.Element;
5
+ export declare const CardBase: ({ identifier, ...otherProps }: CardBaseProps & WrappedComponentProps) => React.JSX.Element;
6
+ export declare const CardWithPerformanceObserver: (props: CardBaseProps & WrappedComponentProps) => React.JSX.Element;
7
7
  export declare const Card: React.ComponentType<CardBaseProps>;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { type ExternalImageIdentifier, type Identifier, type MediaClient } from '@atlaskit/media-client';
2
+ import React from 'react';
3
3
  import { type CardEventProps, type SharedCardProps } from '../types';
4
4
  export interface ExternalImageCardProps extends SharedCardProps, CardEventProps {
5
5
  readonly mediaClient: MediaClient;
@@ -9,4 +9,4 @@ export interface ExternalImageCardProps extends SharedCardProps, CardEventProps
9
9
  readonly contextId?: string;
10
10
  readonly shouldHideTooltip?: boolean;
11
11
  }
12
- export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, }: ExternalImageCardProps) => JSX.Element;
12
+ export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, }: ExternalImageCardProps) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
3
2
  import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
4
3
  import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
4
+ import React from 'react';
5
5
  import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
6
6
  import { type CardAction } from './actions';
7
7
  export interface FileCardProps extends CardEventProps {
@@ -53,4 +53,4 @@ export interface FileCardProps extends CardEventProps {
53
53
  /** Sets options for viewer **/
54
54
  readonly includeHashForDuplicateFiles?: boolean;
55
55
  }
56
- export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => JSX.Element;
56
+ export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => React.JSX.Element;
@@ -20,5 +20,5 @@ export interface InlinePlayerOwnProps {
20
20
  }
21
21
  export type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
22
22
  export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
23
- export declare const InlinePlayerBase: ({ identifier, onError, onClick, dimensions, originalDimensions, selected, testId, forwardRef, autoplay, cardPreview, onFullscreenChange, videoControlsWrapperRef, }: InlinePlayerProps) => JSX.Element;
23
+ export declare const InlinePlayerBase: ({ identifier, onError, onClick, dimensions, originalDimensions, selected, testId, forwardRef, autoplay, cardPreview, onFullscreenChange, videoControlsWrapperRef, }: InlinePlayerProps) => React.JSX.Element;
24
24
  export declare const InlinePlayer: React.ForwardRefExoticComponent<Omit<InlinePlayerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -6,7 +6,9 @@ import { jsx } from '@emotion/react';
6
6
  import React from 'react';
7
7
  import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
8
8
  import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
9
- import { MediaCardError } from '../../errors';
9
+ import { MediaCardError, type SvgPrimaryReason } from '../../errors';
10
+ import { type MediaSVGErrorReason } from '@atlaskit/media-svg';
11
+ export declare const getErrorReason: (svgReason: MediaSVGErrorReason) => SvgPrimaryReason;
10
12
  export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
11
13
  export interface SvgViewBaseOwnProps {
12
14
  readonly identifier: FileIdentifier;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { type ActionsBarProps } from './types';
3
3
  export declare class ActionsBar extends React.Component<ActionsBarProps> {
4
- render(): JSX.Element | null;
4
+ render(): React.JSX.Element | null;
5
5
  }
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { type ReactNode, type MouseEvent } from 'react';
2
3
  import { type CardActionIconButtonVariant } from './styles';
3
4
  export type CardActionIconButtonProps = {
@@ -11,4 +12,4 @@ export type CardActionIconButtonProps = {
11
12
  readonly tooltip?: string;
12
13
  readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
13
14
  };
14
- export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => JSX.Element;
15
+ export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type CardAction } from '../../../actions';
3
3
  import { type CardActionIconButtonVariant } from './styles';
4
4
  export type CardActionsDropdownMenuProps = {
@@ -9,4 +9,4 @@ export type CardActionsDropdownMenuProps = {
9
9
  isOpen: boolean;
10
10
  }) => void;
11
11
  };
12
- export declare const CardActionsDropdownMenu: ({ actions, triggerColor, onOpenChange, triggerVariant, }: CardActionsDropdownMenuProps) => JSX.Element | null;
12
+ export declare const CardActionsDropdownMenu: ({ actions, triggerColor, onOpenChange, triggerVariant, }: CardActionsDropdownMenuProps) => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const PlayButton: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const PlayButton: () => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { Breakpoint } from '../common';
3
3
  export type ProgressBarProps = {
4
4
  progress?: number;
@@ -7,4 +7,4 @@ export type ProgressBarProps = {
7
7
  showOnTop?: boolean;
8
8
  };
9
9
  export declare const getNormalizedProgress: (progress?: number) => number;
10
- export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => JSX.Element;
10
+ export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type TickBoxProps } from './types';
3
- export declare const TickBox: ({ selected }: TickBoxProps) => JSX.Element;
3
+ export declare const TickBox: ({ selected }: TickBoxProps) => React.JSX.Element;
@@ -8,7 +8,7 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
8
8
  export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
9
9
  export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
10
10
  export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
11
- export type SvgPrimaryReason = 'svg-img-error' | 'svg-binary-fetch' | 'svg-unknown-error';
11
+ export type SvgPrimaryReason = 'svg-img-error' | 'svg-binary-fetch' | 'svg-blob-to-datauri' | 'svg-unknown-error';
12
12
  export declare function isPollingError(err?: Error): boolean;
13
13
  export declare function isRateLimitedError(error?: Error): boolean;
14
14
  export declare class MediaCardError extends Error {
@@ -21,6 +21,6 @@ export default class MediaInlineCardLoader extends React.PureComponent<MediaInli
21
21
  state: MediaInlineCardLoaderState;
22
22
  componentDidMount(): Promise<void>;
23
23
  componentWillUnmount(): Promise<void>;
24
- render(): JSX.Element;
24
+ render(): React.JSX.Element;
25
25
  }
26
26
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { Component } from 'react';
2
3
  import { type StaticCardProps } from './types';
3
4
  export interface ErrorCardProps extends StaticCardProps {
@@ -7,6 +8,6 @@ export declare class CardError extends Component<ErrorCardProps, {}> {
7
8
  static defaultProps: {
8
9
  size: string;
9
10
  };
10
- render(): JSX.Element;
11
- get icon(): JSX.Element;
11
+ render(): React.JSX.Element;
12
+ get icon(): React.JSX.Element;
12
13
  }
@@ -1,5 +1,6 @@
1
+ import React from 'react';
1
2
  import { Component } from 'react';
2
3
  import { type StaticCardProps } from './types';
3
4
  export declare class CardLoading extends Component<StaticCardProps, {}> {
4
- render(): JSX.Element;
5
+ render(): React.JSX.Element;
5
6
  }
@@ -1,6 +1,6 @@
1
- import { type PropsWithChildren } from 'react';
1
+ import React, { type PropsWithChildren } from 'react';
2
2
  export type ViewportDetectorProps = PropsWithChildren<{
3
3
  cardEl: HTMLElement | null;
4
4
  onVisible: () => void;
5
5
  }>;
6
- export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => JSX.Element;
6
+ export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { type WrappedComponentProps } from 'react-intl-next';
3
3
  import { type CardProps } from '../types';
4
4
  export type CardBaseProps = CardProps & Partial<WrappedComponentProps>;
5
- export declare const CardBase: ({ identifier, ...otherProps }: CardBaseProps & WrappedComponentProps) => JSX.Element;
6
- export declare const CardWithPerformanceObserver: (props: CardBaseProps & WrappedComponentProps) => JSX.Element;
5
+ export declare const CardBase: ({ identifier, ...otherProps }: CardBaseProps & WrappedComponentProps) => React.JSX.Element;
6
+ export declare const CardWithPerformanceObserver: (props: CardBaseProps & WrappedComponentProps) => React.JSX.Element;
7
7
  export declare const Card: React.ComponentType<CardBaseProps>;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { type ExternalImageIdentifier, type Identifier, type MediaClient } from '@atlaskit/media-client';
2
+ import React from 'react';
3
3
  import { type CardEventProps, type SharedCardProps } from '../types';
4
4
  export interface ExternalImageCardProps extends SharedCardProps, CardEventProps {
5
5
  readonly mediaClient: MediaClient;
@@ -9,4 +9,4 @@ export interface ExternalImageCardProps extends SharedCardProps, CardEventProps
9
9
  readonly contextId?: string;
10
10
  readonly shouldHideTooltip?: boolean;
11
11
  }
12
- export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, }: ExternalImageCardProps) => JSX.Element;
12
+ export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, }: ExternalImageCardProps) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
3
2
  import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
4
3
  import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
4
+ import React from 'react';
5
5
  import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
6
6
  import { type CardAction } from './actions';
7
7
  export interface FileCardProps extends CardEventProps {
@@ -53,4 +53,4 @@ export interface FileCardProps extends CardEventProps {
53
53
  /** Sets options for viewer **/
54
54
  readonly includeHashForDuplicateFiles?: boolean;
55
55
  }
56
- export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => JSX.Element;
56
+ export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => React.JSX.Element;
@@ -20,5 +20,5 @@ export interface InlinePlayerOwnProps {
20
20
  }
21
21
  export type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
22
22
  export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
23
- export declare const InlinePlayerBase: ({ identifier, onError, onClick, dimensions, originalDimensions, selected, testId, forwardRef, autoplay, cardPreview, onFullscreenChange, videoControlsWrapperRef, }: InlinePlayerProps) => JSX.Element;
23
+ export declare const InlinePlayerBase: ({ identifier, onError, onClick, dimensions, originalDimensions, selected, testId, forwardRef, autoplay, cardPreview, onFullscreenChange, videoControlsWrapperRef, }: InlinePlayerProps) => React.JSX.Element;
24
24
  export declare const InlinePlayer: React.ForwardRefExoticComponent<Omit<InlinePlayerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -6,7 +6,9 @@ import { jsx } from '@emotion/react';
6
6
  import React from 'react';
7
7
  import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
8
8
  import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
9
- import { MediaCardError } from '../../errors';
9
+ import { MediaCardError, type SvgPrimaryReason } from '../../errors';
10
+ import { type MediaSVGErrorReason } from '@atlaskit/media-svg';
11
+ export declare const getErrorReason: (svgReason: MediaSVGErrorReason) => SvgPrimaryReason;
10
12
  export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
11
13
  export interface SvgViewBaseOwnProps {
12
14
  readonly identifier: FileIdentifier;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { type ActionsBarProps } from './types';
3
3
  export declare class ActionsBar extends React.Component<ActionsBarProps> {
4
- render(): JSX.Element | null;
4
+ render(): React.JSX.Element | null;
5
5
  }
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { type ReactNode, type MouseEvent } from 'react';
2
3
  import { type CardActionIconButtonVariant } from './styles';
3
4
  export type CardActionIconButtonProps = {
@@ -11,4 +12,4 @@ export type CardActionIconButtonProps = {
11
12
  readonly tooltip?: string;
12
13
  readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
13
14
  };
14
- export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => JSX.Element;
15
+ export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type CardAction } from '../../../actions';
3
3
  import { type CardActionIconButtonVariant } from './styles';
4
4
  export type CardActionsDropdownMenuProps = {
@@ -9,4 +9,4 @@ export type CardActionsDropdownMenuProps = {
9
9
  isOpen: boolean;
10
10
  }) => void;
11
11
  };
12
- export declare const CardActionsDropdownMenu: ({ actions, triggerColor, onOpenChange, triggerVariant, }: CardActionsDropdownMenuProps) => JSX.Element | null;
12
+ export declare const CardActionsDropdownMenu: ({ actions, triggerColor, onOpenChange, triggerVariant, }: CardActionsDropdownMenuProps) => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const PlayButton: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const PlayButton: () => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { Breakpoint } from '../common';
3
3
  export type ProgressBarProps = {
4
4
  progress?: number;
@@ -7,4 +7,4 @@ export type ProgressBarProps = {
7
7
  showOnTop?: boolean;
8
8
  };
9
9
  export declare const getNormalizedProgress: (progress?: number) => number;
10
- export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => JSX.Element;
10
+ export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type TickBoxProps } from './types';
3
- export declare const TickBox: ({ selected }: TickBoxProps) => JSX.Element;
3
+ export declare const TickBox: ({ selected }: TickBoxProps) => React.JSX.Element;
@@ -8,7 +8,7 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
8
8
  export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
9
9
  export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
10
10
  export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
11
- export type SvgPrimaryReason = 'svg-img-error' | 'svg-binary-fetch' | 'svg-unknown-error';
11
+ export type SvgPrimaryReason = 'svg-img-error' | 'svg-binary-fetch' | 'svg-blob-to-datauri' | 'svg-unknown-error';
12
12
  export declare function isPollingError(err?: Error): boolean;
13
13
  export declare function isRateLimitedError(error?: Error): boolean;
14
14
  export declare class MediaCardError extends Error {
@@ -21,6 +21,6 @@ export default class MediaInlineCardLoader extends React.PureComponent<MediaInli
21
21
  state: MediaInlineCardLoaderState;
22
22
  componentDidMount(): Promise<void>;
23
23
  componentWillUnmount(): Promise<void>;
24
- render(): JSX.Element;
24
+ render(): React.JSX.Element;
25
25
  }
26
26
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { Component } from 'react';
2
3
  import { type StaticCardProps } from './types';
3
4
  export interface ErrorCardProps extends StaticCardProps {
@@ -7,6 +8,6 @@ export declare class CardError extends Component<ErrorCardProps, {}> {
7
8
  static defaultProps: {
8
9
  size: string;
9
10
  };
10
- render(): JSX.Element;
11
- get icon(): JSX.Element;
11
+ render(): React.JSX.Element;
12
+ get icon(): React.JSX.Element;
12
13
  }
@@ -1,5 +1,6 @@
1
+ import React from 'react';
1
2
  import { Component } from 'react';
2
3
  import { type StaticCardProps } from './types';
3
4
  export declare class CardLoading extends Component<StaticCardProps, {}> {
4
- render(): JSX.Element;
5
+ render(): React.JSX.Element;
5
6
  }
@@ -1,6 +1,6 @@
1
- import { type PropsWithChildren } from 'react';
1
+ import React, { type PropsWithChildren } from 'react';
2
2
  export type ViewportDetectorProps = PropsWithChildren<{
3
3
  cardEl: HTMLElement | null;
4
4
  onVisible: () => void;
5
5
  }>;
6
- export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => JSX.Element;
6
+ export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "78.19.2",
3
+ "version": "78.19.4",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  "./classnames": "./src/classnames.ts"
29
29
  },
30
30
  "atlassian": {
31
- "team": "Media Experience",
31
+ "team": "Media Exif",
32
32
  "website": {
33
33
  "name": "Media Card"
34
34
  },
@@ -38,18 +38,19 @@
38
38
  "@atlaskit/analytics-next": "^10.3.0",
39
39
  "@atlaskit/dropdown-menu": "^12.26.0",
40
40
  "@atlaskit/editor-shared-styles": "^3.2.0",
41
- "@atlaskit/icon": "^23.6.0",
41
+ "@atlaskit/icon": "^23.7.0",
42
42
  "@atlaskit/media-client": "^31.1.0",
43
43
  "@atlaskit/media-client-react": "^3.0.0",
44
44
  "@atlaskit/media-common": "^11.8.0",
45
45
  "@atlaskit/media-file-preview": "^0.10.0",
46
+ "@atlaskit/media-svg": "^1.2.0",
46
47
  "@atlaskit/media-ui": "^27.4.0",
47
48
  "@atlaskit/media-viewer": "^50.1.0",
48
49
  "@atlaskit/platform-feature-flags": "^1.0.0",
49
- "@atlaskit/primitives": "^13.4.0",
50
+ "@atlaskit/primitives": "^13.5.0",
50
51
  "@atlaskit/react-ufo": "^2.14.0",
51
52
  "@atlaskit/spinner": "^17.1.0",
52
- "@atlaskit/theme": "^14.1.0",
53
+ "@atlaskit/theme": "^15.0.0",
53
54
  "@atlaskit/tokens": "^3.3.0",
54
55
  "@atlaskit/tooltip": "^19.1.0",
55
56
  "@atlaskit/ufo": "^0.3.0",
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.getErrorReason = exports.createUnexpectedErrorCallback = exports.MediaSVGError = void 0;
8
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
14
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
15
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
- var getErrorReason = exports.getErrorReason = function getErrorReason(svgReason) {
17
- switch (svgReason) {
18
- case 'img-error':
19
- return 'svg-img-error';
20
- case 'binary-fetch':
21
- return 'svg-binary-fetch';
22
- default:
23
- return 'svg-unknown-error';
24
- }
25
- };
26
- var MediaSVGError = exports.MediaSVGError = /*#__PURE__*/function (_Error) {
27
- function MediaSVGError(primaryReason, secondaryError) {
28
- var _this;
29
- (0, _classCallCheck2.default)(this, MediaSVGError);
30
- _this = _callSuper(this, MediaSVGError, [primaryReason]);
31
-
32
- // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
33
- _this.primaryReason = primaryReason;
34
- _this.secondaryError = secondaryError;
35
- Object.setPrototypeOf(_this, (this instanceof MediaSVGError ? this.constructor : void 0).prototype);
36
-
37
- // https://v8.dev/docs/stack-trace-api
38
- if ('captureStackTrace' in Error) {
39
- Error.captureStackTrace(_this, this instanceof MediaSVGError ? this.constructor : void 0);
40
- }
41
- return _this;
42
- }
43
- (0, _inherits2.default)(MediaSVGError, _Error);
44
- return (0, _createClass2.default)(MediaSVGError);
45
- }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
46
- var createUnexpectedErrorCallback = exports.createUnexpectedErrorCallback = function createUnexpectedErrorCallback(onError) {
47
- return function (e) {
48
- onError === null || onError === void 0 || onError(new MediaSVGError('unexpected', e));
49
- };
50
- };
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.useResolveSvg = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _react = require("react");
12
- var _mediaClientReact = require("@atlaskit/media-client-react");
13
- var _usePrevious = require("../../utils/usePrevious");
14
- var _errors = require("./errors");
15
- var getLocalSvg = /*#__PURE__*/function () {
16
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(preview) {
17
- var _yield$preview, value;
18
- return _regenerator.default.wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- _context.next = 2;
22
- return preview;
23
- case 2:
24
- _yield$preview = _context.sent;
25
- value = _yield$preview.value;
26
- if (!(typeof value === 'string')) {
27
- _context.next = 6;
28
- break;
29
- }
30
- return _context.abrupt("return", value);
31
- case 6:
32
- return _context.abrupt("return", URL.createObjectURL(value));
33
- case 7:
34
- case "end":
35
- return _context.stop();
36
- }
37
- }, _callee);
38
- }));
39
- return function getLocalSvg(_x) {
40
- return _ref.apply(this, arguments);
41
- };
42
- }();
43
- var getRemoteSvg = /*#__PURE__*/function () {
44
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref2, mediaClient) {
45
- var id, collectionName;
46
- return _regenerator.default.wrap(function _callee2$(_context2) {
47
- while (1) switch (_context2.prev = _context2.next) {
48
- case 0:
49
- id = _ref2.id, collectionName = _ref2.collectionName;
50
- _context2.prev = 1;
51
- _context2.t0 = URL;
52
- _context2.next = 5;
53
- return mediaClient.mediaStore.getFileBinary(id, collectionName);
54
- case 5:
55
- _context2.t1 = _context2.sent;
56
- return _context2.abrupt("return", _context2.t0.createObjectURL.call(_context2.t0, _context2.t1));
57
- case 9:
58
- _context2.prev = 9;
59
- _context2.t2 = _context2["catch"](1);
60
- throw new _errors.MediaSVGError('binary-fetch', _context2.t2 instanceof Error ? _context2.t2 : undefined);
61
- case 12:
62
- case "end":
63
- return _context2.stop();
64
- }
65
- }, _callee2, null, [[1, 9]]);
66
- }));
67
- return function getRemoteSvg(_x2, _x3) {
68
- return _ref3.apply(this, arguments);
69
- };
70
- }();
71
- var useResolveSvg = exports.useResolveSvg = function useResolveSvg(identifier, onError) {
72
- var mediaClient = (0, _mediaClientReact.useMediaClient)();
73
- var id = identifier.id,
74
- collectionName = identifier.collectionName;
75
- var _ref4 = (0, _usePrevious.usePrevious)(identifier) || identifier,
76
- prevId = _ref4.id;
77
- var _useFileState = (0, _mediaClientReact.useFileState)(id, {
78
- collectionName: collectionName
79
- }),
80
- fileState = _useFileState.fileState;
81
- var _useState = (0, _react.useState)(undefined),
82
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
83
- svgUrl = _useState2[0],
84
- setSvgUrl = _useState2[1];
85
- var _useState3 = (0, _react.useState)(undefined),
86
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
87
- source = _useState4[0],
88
- setSource = _useState4[1];
89
- (0, _react.useEffect)(function () {
90
- if (id !== prevId) {
91
- setSvgUrl(undefined);
92
- }
93
- }, [id, prevId]);
94
- (0, _react.useEffect)(function () {
95
- if (svgUrl || !fileState || fileState.status === 'error' || (fileState === null || fileState === void 0 ? void 0 : fileState.mimeType) !== 'image/svg+xml') {
96
- return;
97
- }
98
- var preview = fileState.preview;
99
- if (preview) {
100
- getLocalSvg(preview).then(function (content) {
101
- setSvgUrl(content);
102
- setSource('local');
103
- }).catch(onError);
104
- } else {
105
- getRemoteSvg(identifier, mediaClient).then(function (content) {
106
- setSvgUrl(content);
107
- setSource('remote');
108
- }).catch(onError);
109
- }
110
- }, [identifier, fileState, mediaClient, onError, svgUrl]);
111
- return {
112
- svgUrl: svgUrl,
113
- source: source
114
- };
115
- };
@@ -1,28 +0,0 @@
1
- export const getErrorReason = svgReason => {
2
- switch (svgReason) {
3
- case 'img-error':
4
- return 'svg-img-error';
5
- case 'binary-fetch':
6
- return 'svg-binary-fetch';
7
- default:
8
- return 'svg-unknown-error';
9
- }
10
- };
11
- export class MediaSVGError extends Error {
12
- constructor(primaryReason, secondaryError) {
13
- super(primaryReason);
14
-
15
- // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
16
- this.primaryReason = primaryReason;
17
- this.secondaryError = secondaryError;
18
- Object.setPrototypeOf(this, new.target.prototype);
19
-
20
- // https://v8.dev/docs/stack-trace-api
21
- if ('captureStackTrace' in Error) {
22
- Error.captureStackTrace(this, new.target);
23
- }
24
- }
25
- }
26
- export const createUnexpectedErrorCallback = onError => e => {
27
- onError === null || onError === void 0 ? void 0 : onError(new MediaSVGError('unexpected', e));
28
- };
@@ -1,68 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { useFileState, useMediaClient } from '@atlaskit/media-client-react';
3
- import { usePrevious } from '../../utils/usePrevious';
4
- import { MediaSVGError } from './errors';
5
- const getLocalSvg = async preview => {
6
- const {
7
- value
8
- } = await preview;
9
- if (typeof value === 'string') {
10
- return value;
11
- }
12
- return URL.createObjectURL(value);
13
- };
14
- const getRemoteSvg = async ({
15
- id,
16
- collectionName
17
- }, mediaClient) => {
18
- try {
19
- return URL.createObjectURL(await mediaClient.mediaStore.getFileBinary(id, collectionName));
20
- } catch (e) {
21
- throw new MediaSVGError('binary-fetch', e instanceof Error ? e : undefined);
22
- }
23
- };
24
- export const useResolveSvg = (identifier, onError) => {
25
- const mediaClient = useMediaClient();
26
- const {
27
- id,
28
- collectionName
29
- } = identifier;
30
- const {
31
- id: prevId
32
- } = usePrevious(identifier) || identifier;
33
- const {
34
- fileState
35
- } = useFileState(id, {
36
- collectionName
37
- });
38
- const [svgUrl, setSvgUrl] = useState(undefined);
39
- const [source, setSource] = useState(undefined);
40
- useEffect(() => {
41
- if (id !== prevId) {
42
- setSvgUrl(undefined);
43
- }
44
- }, [id, prevId]);
45
- useEffect(() => {
46
- if (svgUrl || !fileState || fileState.status === 'error' || (fileState === null || fileState === void 0 ? void 0 : fileState.mimeType) !== 'image/svg+xml') {
47
- return;
48
- }
49
- const {
50
- preview
51
- } = fileState;
52
- if (preview) {
53
- getLocalSvg(preview).then(content => {
54
- setSvgUrl(content);
55
- setSource('local');
56
- }).catch(onError);
57
- } else {
58
- getRemoteSvg(identifier, mediaClient).then(content => {
59
- setSvgUrl(content);
60
- setSource('remote');
61
- }).catch(onError);
62
- }
63
- }, [identifier, fileState, mediaClient, onError, svgUrl]);
64
- return {
65
- svgUrl,
66
- source
67
- };
68
- };
@@ -1,43 +0,0 @@
1
- import _createClass from "@babel/runtime/helpers/createClass";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
7
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- export var getErrorReason = function getErrorReason(svgReason) {
10
- switch (svgReason) {
11
- case 'img-error':
12
- return 'svg-img-error';
13
- case 'binary-fetch':
14
- return 'svg-binary-fetch';
15
- default:
16
- return 'svg-unknown-error';
17
- }
18
- };
19
- export var MediaSVGError = /*#__PURE__*/function (_Error) {
20
- function MediaSVGError(primaryReason, secondaryError) {
21
- var _this;
22
- _classCallCheck(this, MediaSVGError);
23
- _this = _callSuper(this, MediaSVGError, [primaryReason]);
24
-
25
- // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
26
- _this.primaryReason = primaryReason;
27
- _this.secondaryError = secondaryError;
28
- Object.setPrototypeOf(_this, (this instanceof MediaSVGError ? this.constructor : void 0).prototype);
29
-
30
- // https://v8.dev/docs/stack-trace-api
31
- if ('captureStackTrace' in Error) {
32
- Error.captureStackTrace(_this, this instanceof MediaSVGError ? this.constructor : void 0);
33
- }
34
- return _this;
35
- }
36
- _inherits(MediaSVGError, _Error);
37
- return _createClass(MediaSVGError);
38
- }( /*#__PURE__*/_wrapNativeSuper(Error));
39
- export var createUnexpectedErrorCallback = function createUnexpectedErrorCallback(onError) {
40
- return function (e) {
41
- onError === null || onError === void 0 || onError(new MediaSVGError('unexpected', e));
42
- };
43
- };
@@ -1,108 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { useEffect, useState } from 'react';
5
- import { useFileState, useMediaClient } from '@atlaskit/media-client-react';
6
- import { usePrevious } from '../../utils/usePrevious';
7
- import { MediaSVGError } from './errors';
8
- var getLocalSvg = /*#__PURE__*/function () {
9
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(preview) {
10
- var _yield$preview, value;
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) switch (_context.prev = _context.next) {
13
- case 0:
14
- _context.next = 2;
15
- return preview;
16
- case 2:
17
- _yield$preview = _context.sent;
18
- value = _yield$preview.value;
19
- if (!(typeof value === 'string')) {
20
- _context.next = 6;
21
- break;
22
- }
23
- return _context.abrupt("return", value);
24
- case 6:
25
- return _context.abrupt("return", URL.createObjectURL(value));
26
- case 7:
27
- case "end":
28
- return _context.stop();
29
- }
30
- }, _callee);
31
- }));
32
- return function getLocalSvg(_x) {
33
- return _ref.apply(this, arguments);
34
- };
35
- }();
36
- var getRemoteSvg = /*#__PURE__*/function () {
37
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2, mediaClient) {
38
- var id, collectionName;
39
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
40
- while (1) switch (_context2.prev = _context2.next) {
41
- case 0:
42
- id = _ref2.id, collectionName = _ref2.collectionName;
43
- _context2.prev = 1;
44
- _context2.t0 = URL;
45
- _context2.next = 5;
46
- return mediaClient.mediaStore.getFileBinary(id, collectionName);
47
- case 5:
48
- _context2.t1 = _context2.sent;
49
- return _context2.abrupt("return", _context2.t0.createObjectURL.call(_context2.t0, _context2.t1));
50
- case 9:
51
- _context2.prev = 9;
52
- _context2.t2 = _context2["catch"](1);
53
- throw new MediaSVGError('binary-fetch', _context2.t2 instanceof Error ? _context2.t2 : undefined);
54
- case 12:
55
- case "end":
56
- return _context2.stop();
57
- }
58
- }, _callee2, null, [[1, 9]]);
59
- }));
60
- return function getRemoteSvg(_x2, _x3) {
61
- return _ref3.apply(this, arguments);
62
- };
63
- }();
64
- export var useResolveSvg = function useResolveSvg(identifier, onError) {
65
- var mediaClient = useMediaClient();
66
- var id = identifier.id,
67
- collectionName = identifier.collectionName;
68
- var _ref4 = usePrevious(identifier) || identifier,
69
- prevId = _ref4.id;
70
- var _useFileState = useFileState(id, {
71
- collectionName: collectionName
72
- }),
73
- fileState = _useFileState.fileState;
74
- var _useState = useState(undefined),
75
- _useState2 = _slicedToArray(_useState, 2),
76
- svgUrl = _useState2[0],
77
- setSvgUrl = _useState2[1];
78
- var _useState3 = useState(undefined),
79
- _useState4 = _slicedToArray(_useState3, 2),
80
- source = _useState4[0],
81
- setSource = _useState4[1];
82
- useEffect(function () {
83
- if (id !== prevId) {
84
- setSvgUrl(undefined);
85
- }
86
- }, [id, prevId]);
87
- useEffect(function () {
88
- if (svgUrl || !fileState || fileState.status === 'error' || (fileState === null || fileState === void 0 ? void 0 : fileState.mimeType) !== 'image/svg+xml') {
89
- return;
90
- }
91
- var preview = fileState.preview;
92
- if (preview) {
93
- getLocalSvg(preview).then(function (content) {
94
- setSvgUrl(content);
95
- setSource('local');
96
- }).catch(onError);
97
- } else {
98
- getRemoteSvg(identifier, mediaClient).then(function (content) {
99
- setSvgUrl(content);
100
- setSource('remote');
101
- }).catch(onError);
102
- }
103
- }, [identifier, fileState, mediaClient, onError, svgUrl]);
104
- return {
105
- svgUrl: svgUrl,
106
- source: source
107
- };
108
- };
@@ -1,9 +0,0 @@
1
- import { type SvgPrimaryReason } from '../../errors';
2
- export type MediaSVGErrorReason = 'img-error' | 'binary-fetch' | 'unexpected';
3
- export declare const getErrorReason: (svgReason: MediaSVGErrorReason) => SvgPrimaryReason;
4
- export declare class MediaSVGError extends Error {
5
- readonly primaryReason: MediaSVGErrorReason;
6
- readonly secondaryError?: Error | undefined;
7
- constructor(primaryReason: MediaSVGErrorReason, secondaryError?: Error | undefined);
8
- }
9
- export declare const createUnexpectedErrorCallback: (onError: (error: MediaSVGError) => void) => (e: Error) => void;
@@ -1,7 +0,0 @@
1
- import { type FileIdentifier } from '@atlaskit/media-client';
2
- import { MediaSVGError } from './errors';
3
- import type { ContentSource } from './types';
4
- export declare const useResolveSvg: (identifier: FileIdentifier, onError?: ((error: MediaSVGError) => void) | undefined) => {
5
- svgUrl: string | undefined;
6
- source: ContentSource | undefined;
7
- };
@@ -1,9 +0,0 @@
1
- import { type SvgPrimaryReason } from '../../errors';
2
- export type MediaSVGErrorReason = 'img-error' | 'binary-fetch' | 'unexpected';
3
- export declare const getErrorReason: (svgReason: MediaSVGErrorReason) => SvgPrimaryReason;
4
- export declare class MediaSVGError extends Error {
5
- readonly primaryReason: MediaSVGErrorReason;
6
- readonly secondaryError?: Error | undefined;
7
- constructor(primaryReason: MediaSVGErrorReason, secondaryError?: Error | undefined);
8
- }
9
- export declare const createUnexpectedErrorCallback: (onError: (error: MediaSVGError) => void) => (e: Error) => void;
@@ -1,7 +0,0 @@
1
- import { type FileIdentifier } from '@atlaskit/media-client';
2
- import { MediaSVGError } from './errors';
3
- import type { ContentSource } from './types';
4
- export declare const useResolveSvg: (identifier: FileIdentifier, onError?: ((error: MediaSVGError) => void) | undefined) => {
5
- svgUrl: string | undefined;
6
- source: ContentSource | undefined;
7
- };