@atlaskit/media-card 77.2.3 → 77.4.0
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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/getCardPreview/cache.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/imageRenderer/imageRenderer.js +6 -3
- package/dist/cjs/card/v2/cardV2.js +18 -1037
- package/dist/cjs/card/v2/externalImageCard.js +299 -0
- package/dist/cjs/card/v2/fileCard.js +1001 -0
- package/dist/cjs/errors.js +33 -55
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/cjs/utils/useCurrentValueRef.js +12 -0
- package/dist/cjs/utils/usePrevious.js +14 -0
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/getCardPreview/cache.js +2 -0
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +6 -3
- package/dist/es2019/card/v2/cardV2.js +17 -1021
- package/dist/es2019/card/v2/externalImageCard.js +261 -0
- package/dist/es2019/card/v2/fileCard.js +881 -0
- package/dist/es2019/errors.js +1 -17
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/es2019/utils/useCurrentValueRef.js +6 -0
- package/dist/es2019/utils/usePrevious.js +8 -0
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/getCardPreview/cache.js +2 -0
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/imageRenderer/imageRenderer.js +6 -3
- package/dist/esm/card/v2/cardV2.js +19 -1036
- package/dist/esm/card/v2/externalImageCard.js +289 -0
- package/dist/esm/card/v2/fileCard.js +991 -0
- package/dist/esm/errors.js +31 -55
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/esm/utils/useCurrentValueRef.js +6 -0
- package/dist/esm/utils/usePrevious.js +8 -0
- package/dist/types/card/v2/cardV2.d.ts +4 -60
- package/dist/types/card/v2/externalImageCard.d.ts +14 -0
- package/dist/types/card/v2/fileCard.d.ts +19 -0
- package/dist/types/errors.d.ts +1 -7
- package/dist/types/utils/useCurrentValueRef.d.ts +2 -0
- package/dist/types/utils/usePrevious.d.ts +1 -0
- package/dist/types-ts4.5/card/v2/cardV2.d.ts +4 -60
- package/dist/types-ts4.5/card/v2/externalImageCard.d.ts +14 -0
- package/dist/types-ts4.5/card/v2/fileCard.d.ts +19 -0
- package/dist/types-ts4.5/errors.d.ts +1 -7
- package/dist/types-ts4.5/utils/useCurrentValueRef.d.ts +2 -0
- package/dist/types-ts4.5/utils/usePrevious.d.ts +1 -0
- package/package.json +5 -5
package/dist/es2019/errors.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import { isPollingError as isMediaClientPollingError, isRateLimitedError as isMediaClientRateLimitedError } from '@atlaskit/media-client';
|
|
2
|
-
|
|
2
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
3
3
|
/**
|
|
4
4
|
* Primary reason is logged through Data Portal.
|
|
5
5
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export class MediaFileStateError extends Error {
|
|
9
|
-
constructor(id, reason, message = '', details) {
|
|
10
|
-
super(reason);
|
|
11
|
-
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
12
|
-
this.id = id;
|
|
13
|
-
this.reason = reason;
|
|
14
|
-
this.message = message;
|
|
15
|
-
this.details = details;
|
|
16
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
17
|
-
|
|
18
|
-
// https://v8.dev/docs/stack-trace-api
|
|
19
|
-
if ('captureStackTrace' in Error) {
|
|
20
|
-
Error.captureStackTrace(this, new.target);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
8
|
export function isMediaFileStateError(err) {
|
|
25
9
|
return err instanceof MediaFileStateError;
|
|
26
10
|
}
|
|
@@ -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: "77.
|
|
40
|
+
packageName: "77.4.0",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
4
4
|
import { MediaCardError } from '../errors';
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
const packageName = "@atlaskit/media-card";
|
|
7
|
-
const packageVersion = "77.
|
|
7
|
+
const packageVersion = "77.4.0";
|
|
8
8
|
let concurrentExperience;
|
|
9
9
|
const getExperience = id => {
|
|
10
10
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -40,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
40
40
|
import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
|
|
41
41
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
42
42
|
var packageName = "@atlaskit/media-card";
|
|
43
|
-
var packageVersion = "77.
|
|
43
|
+
var packageVersion = "77.4.0";
|
|
44
44
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(CardBase, _Component);
|
|
46
46
|
var _super = _createSuper(CardBase);
|
|
@@ -29,4 +29,6 @@ export var CardPreviewCacheImpl = /*#__PURE__*/_createClass(function CardPreview
|
|
|
29
29
|
});
|
|
30
30
|
this.previewCache = previewCache;
|
|
31
31
|
});
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
32
34
|
export default new CardPreviewCacheImpl(createObjectURLCache());
|
|
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
83
83
|
}(React.Component);
|
|
84
84
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
85
85
|
var packageName = "@atlaskit/media-card";
|
|
86
|
-
var packageVersion = "77.
|
|
86
|
+
var packageVersion = "77.4.0";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { MediaImage } from '@atlaskit/media-ui';
|
|
4
4
|
import { resizeModeToMediaImageProps } from './resizeModeToMediaImageProps';
|
|
5
|
+
import { useCurrentValueRef } from '../../../utils/useCurrentValueRef';
|
|
5
6
|
export var ImageRenderer = function ImageRenderer(_ref) {
|
|
6
7
|
var cardPreview = _ref.cardPreview,
|
|
7
8
|
alt = _ref.alt,
|
|
@@ -12,12 +13,14 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
12
13
|
mediaType = _ref.mediaType,
|
|
13
14
|
nativeLazyLoad = _ref.nativeLazyLoad,
|
|
14
15
|
forceSyncDisplay = _ref.forceSyncDisplay;
|
|
16
|
+
var onDisplayImageRef = useCurrentValueRef(onDisplayImage);
|
|
15
17
|
useEffect(function () {
|
|
16
18
|
// TODO: trigger accordingly with the succeeded event. This could be a breaking change
|
|
17
|
-
if (mediaType === 'image'
|
|
18
|
-
|
|
19
|
+
if (mediaType === 'image') {
|
|
20
|
+
var _onDisplayImageRef$cu;
|
|
21
|
+
(_onDisplayImageRef$cu = onDisplayImageRef.current) === null || _onDisplayImageRef$cu === void 0 || _onDisplayImageRef$cu.call(onDisplayImageRef);
|
|
19
22
|
}
|
|
20
|
-
}, [mediaType,
|
|
23
|
+
}, [mediaType, onDisplayImageRef]);
|
|
21
24
|
var onLoad = function onLoad() {
|
|
22
25
|
onImageLoad && onImageLoad(cardPreview);
|
|
23
26
|
};
|