@atlaskit/media-card 77.6.0 → 77.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/useFilePreview/analytics.js +50 -0
- package/dist/cjs/card/v2/useFilePreview/errors.js +13 -2
- package/dist/cjs/card/v2/useFilePreview/helpers.js +1 -1
- package/dist/cjs/card/v2/useFilePreview/useFilePreview.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/useFilePreview/analytics.js +44 -0
- package/dist/es2019/card/v2/useFilePreview/errors.js +10 -1
- package/dist/es2019/card/v2/useFilePreview/helpers.js +1 -1
- package/dist/es2019/card/v2/useFilePreview/useFilePreview.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/useFilePreview/analytics.js +44 -0
- package/dist/esm/card/v2/useFilePreview/errors.js +10 -1
- package/dist/esm/card/v2/useFilePreview/helpers.js +1 -1
- package/dist/esm/card/v2/useFilePreview/useFilePreview.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/v2/useFilePreview/analytics.d.ts +28 -0
- package/dist/types/card/v2/useFilePreview/errors.d.ts +4 -0
- package/dist/types/card/v2/useFilePreview/helpers.d.ts +1 -1
- package/dist/types/card/v2/useFilePreview/useFilePreview.d.ts +1 -1
- package/dist/types-ts4.5/card/v2/useFilePreview/analytics.d.ts +28 -0
- package/dist/types-ts4.5/card/v2/useFilePreview/errors.d.ts +4 -0
- package/dist/types-ts4.5/card/v2/useFilePreview/helpers.d.ts +1 -1
- package/dist/types-ts4.5/card/v2/useFilePreview/useFilePreview.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60393](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60393) [`7f40d5c65a95`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7f40d5c65a95) - Isolated analytics resources for preview hook
|
|
8
|
+
|
|
3
9
|
## 77.6.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -49,7 +49,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
49
49
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
50
50
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
51
|
var packageName = "@atlaskit/media-card";
|
|
52
|
-
var packageVersion = "77.6.
|
|
52
|
+
var packageVersion = "77.6.1";
|
|
53
53
|
var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
|
|
54
54
|
(0, _inherits2.default)(CardBase, _Component);
|
|
55
55
|
var _super = _createSuper(CardBase);
|
|
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
90
90
|
}(_react.default.Component);
|
|
91
91
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "77.6.
|
|
93
|
+
var packageVersion = "77.6.1";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
|
|
|
16
16
|
var _fileCard = require("./fileCard");
|
|
17
17
|
var _excluded = ["identifier"];
|
|
18
18
|
var packageName = "@atlaskit/media-card";
|
|
19
|
-
var packageVersion = "77.6.
|
|
19
|
+
var packageVersion = "77.6.1";
|
|
20
20
|
var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRenderErrorFailReason = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getErrorTraceContext = exports.extractErrorInfo = void 0;
|
|
7
|
+
var _mediaClient = require("@atlaskit/media-client");
|
|
8
|
+
var _errors = require("./errors");
|
|
9
|
+
var getErrorTraceContext = exports.getErrorTraceContext = function getErrorTraceContext(error) {
|
|
10
|
+
if ((0, _errors.isMediaFilePreviewError)(error) && !!error.secondaryError) {
|
|
11
|
+
if ((0, _mediaClient.isRequestError)(error.secondaryError)) {
|
|
12
|
+
var _error$secondaryError;
|
|
13
|
+
return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
|
|
14
|
+
} else if ((0, _errors.isMediaFileStateError)(error.secondaryError)) {
|
|
15
|
+
var _error$secondaryError2;
|
|
16
|
+
return (_error$secondaryError2 = error.secondaryError.details) === null || _error$secondaryError2 === void 0 || (_error$secondaryError2 = _error$secondaryError2.metadata) === null || _error$secondaryError2 === void 0 ? void 0 : _error$secondaryError2.traceContext;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var getRenderErrorFailReason = exports.getRenderErrorFailReason = function getRenderErrorFailReason(error) {
|
|
21
|
+
if ((0, _errors.isMediaFilePreviewError)(error)) {
|
|
22
|
+
return error.primaryReason;
|
|
23
|
+
} else {
|
|
24
|
+
return 'nativeError';
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var getRenderErrorErrorReason = exports.getRenderErrorErrorReason = function getRenderErrorErrorReason(error) {
|
|
28
|
+
if ((0, _errors.isMediaFilePreviewError)(error) && error.secondaryError) {
|
|
29
|
+
var mediaClientReason = (0, _errors.isMediaFileStateError)(error.secondaryError) ? (0, _errors.getFileStateErrorReason)(error.secondaryError) : (0, _mediaClient.getMediaClientErrorReason)(error.secondaryError);
|
|
30
|
+
if (mediaClientReason !== 'unknown') {
|
|
31
|
+
return mediaClientReason;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 'nativeError';
|
|
35
|
+
};
|
|
36
|
+
var getRenderErrorErrorDetail = exports.getRenderErrorErrorDetail = function getRenderErrorErrorDetail(error) {
|
|
37
|
+
if ((0, _errors.isMediaFilePreviewError)(error) && error.secondaryError) {
|
|
38
|
+
return error.secondaryError.message;
|
|
39
|
+
} else {
|
|
40
|
+
return error.message;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var extractErrorInfo = exports.extractErrorInfo = function extractErrorInfo(error, metadataTraceContext) {
|
|
44
|
+
return {
|
|
45
|
+
failReason: getRenderErrorFailReason(error),
|
|
46
|
+
error: getRenderErrorErrorReason(error),
|
|
47
|
+
errorDetail: getRenderErrorErrorDetail(error),
|
|
48
|
+
metadataTraceContext: metadataTraceContext !== null && metadataTraceContext !== void 0 ? metadataTraceContext : getErrorTraceContext(error)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -4,8 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.ensureMediaFilePreviewError = exports.SsrPreviewError = exports.RemotePreviewError = exports.MediaFilePreviewError = exports.LocalPreviewError = exports.ImageLoadError = void 0;
|
|
8
|
+
exports.getFileStateErrorReason = getFileStateErrorReason;
|
|
9
|
+
exports.isLocalPreviewError = void 0;
|
|
8
10
|
exports.isMediaFilePreviewError = isMediaFilePreviewError;
|
|
11
|
+
exports.isMediaFileStateError = isMediaFileStateError;
|
|
9
12
|
exports.isUnsupportedLocalPreviewError = exports.isRemotePreviewError = void 0;
|
|
10
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -14,6 +17,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
17
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
19
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
20
|
+
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
17
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
18
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
23
|
/**
|
|
@@ -129,4 +133,11 @@ var ensureMediaFilePreviewError = exports.ensureMediaFilePreviewError = function
|
|
|
129
133
|
return error;
|
|
130
134
|
}
|
|
131
135
|
return new MediaFilePreviewError(primaryReason, error);
|
|
132
|
-
};
|
|
136
|
+
};
|
|
137
|
+
function isMediaFileStateError(err) {
|
|
138
|
+
return err instanceof _mediaClientReact.MediaFileStateError;
|
|
139
|
+
}
|
|
140
|
+
function getFileStateErrorReason(err) {
|
|
141
|
+
var _err$details$reason, _err$details;
|
|
142
|
+
return (_err$details$reason = (_err$details = err.details) === null || _err$details === void 0 ? void 0 : _err$details.reason) !== null && _err$details$reason !== void 0 ? _err$details$reason : 'unknown';
|
|
143
|
+
}
|
|
@@ -49,7 +49,7 @@ var createRequestDimensions = exports.createRequestDimensions = function createR
|
|
|
49
49
|
return result;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
/** Stores the provided value in a
|
|
52
|
+
/** Stores the provided value in a ref object to avoid "component rerenders" when the value is used as a hook dependency */
|
|
53
53
|
function useCurrentValueRef(value) {
|
|
54
54
|
var ref = (0, _react.useRef)(value);
|
|
55
55
|
ref.current = value;
|
|
@@ -14,7 +14,7 @@ var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
|
14
14
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
15
15
|
var _react = require("react");
|
|
16
16
|
var _errors = require("./errors");
|
|
17
|
-
var _analytics = require("
|
|
17
|
+
var _analytics = require("./analytics");
|
|
18
18
|
var _helpers = require("./helpers");
|
|
19
19
|
var _globalScope = require("./globalScope");
|
|
20
20
|
var _getPreview = require("./getPreview");
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "77.6.
|
|
122
|
+
packageName: "77.6.1",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
14
14
|
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; }
|
|
15
15
|
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; }
|
|
16
16
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "77.6.
|
|
17
|
+
var packageVersion = "77.6.1";
|
|
18
18
|
var concurrentExperience;
|
|
19
19
|
var getExperience = function getExperience(id) {
|
|
20
20
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -27,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
27
27
|
import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
|
|
28
28
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
29
29
|
const packageName = "@atlaskit/media-card";
|
|
30
|
-
const packageVersion = "77.6.
|
|
30
|
+
const packageVersion = "77.6.1";
|
|
31
31
|
export class CardBase extends Component {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
@@ -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 = "77.6.
|
|
69
|
+
const packageVersion = "77.6.1";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { ExternalImageCard } from './externalImageCard';
|
|
8
8
|
import { FileCard } from './fileCard';
|
|
9
9
|
const packageName = "@atlaskit/media-card";
|
|
10
|
-
const packageVersion = "77.6.
|
|
10
|
+
const packageVersion = "77.6.1";
|
|
11
11
|
export const CardV2Base = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
|
|
2
|
+
import { isMediaFilePreviewError, getFileStateErrorReason, isMediaFileStateError } from './errors';
|
|
3
|
+
export const getErrorTraceContext = error => {
|
|
4
|
+
if (isMediaFilePreviewError(error) && !!error.secondaryError) {
|
|
5
|
+
if (isRequestError(error.secondaryError)) {
|
|
6
|
+
var _error$secondaryError;
|
|
7
|
+
return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
|
|
8
|
+
} else if (isMediaFileStateError(error.secondaryError)) {
|
|
9
|
+
var _error$secondaryError2, _error$secondaryError3;
|
|
10
|
+
return (_error$secondaryError2 = error.secondaryError.details) === null || _error$secondaryError2 === void 0 ? void 0 : (_error$secondaryError3 = _error$secondaryError2.metadata) === null || _error$secondaryError3 === void 0 ? void 0 : _error$secondaryError3.traceContext;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export const getRenderErrorFailReason = error => {
|
|
15
|
+
if (isMediaFilePreviewError(error)) {
|
|
16
|
+
return error.primaryReason;
|
|
17
|
+
} else {
|
|
18
|
+
return 'nativeError';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const getRenderErrorErrorReason = error => {
|
|
22
|
+
if (isMediaFilePreviewError(error) && error.secondaryError) {
|
|
23
|
+
const mediaClientReason = isMediaFileStateError(error.secondaryError) ? getFileStateErrorReason(error.secondaryError) : getMediaClientErrorReason(error.secondaryError);
|
|
24
|
+
if (mediaClientReason !== 'unknown') {
|
|
25
|
+
return mediaClientReason;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return 'nativeError';
|
|
29
|
+
};
|
|
30
|
+
export const getRenderErrorErrorDetail = error => {
|
|
31
|
+
if (isMediaFilePreviewError(error) && error.secondaryError) {
|
|
32
|
+
return error.secondaryError.message;
|
|
33
|
+
} else {
|
|
34
|
+
return error.message;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export const extractErrorInfo = (error, metadataTraceContext) => {
|
|
38
|
+
return {
|
|
39
|
+
failReason: getRenderErrorFailReason(error),
|
|
40
|
+
error: getRenderErrorErrorReason(error),
|
|
41
|
+
errorDetail: getRenderErrorErrorDetail(error),
|
|
42
|
+
metadataTraceContext: metadataTraceContext !== null && metadataTraceContext !== void 0 ? metadataTraceContext : getErrorTraceContext(error)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Primary reason is logged through Data Portal.
|
|
3
5
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
@@ -78,4 +80,11 @@ export const ensureMediaFilePreviewError = (primaryReason, error, updatePrimaryR
|
|
|
78
80
|
return error;
|
|
79
81
|
}
|
|
80
82
|
return new MediaFilePreviewError(primaryReason, error);
|
|
81
|
-
};
|
|
83
|
+
};
|
|
84
|
+
export function isMediaFileStateError(err) {
|
|
85
|
+
return err instanceof MediaFileStateError;
|
|
86
|
+
}
|
|
87
|
+
export function getFileStateErrorReason(err) {
|
|
88
|
+
var _err$details$reason, _err$details;
|
|
89
|
+
return (_err$details$reason = (_err$details = err.details) === null || _err$details === void 0 ? void 0 : _err$details.reason) !== null && _err$details$reason !== void 0 ? _err$details$reason : 'unknown';
|
|
90
|
+
}
|
|
@@ -46,7 +46,7 @@ export const createRequestDimensions = dimensions => {
|
|
|
46
46
|
return result;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
/** Stores the provided value in a
|
|
49
|
+
/** Stores the provided value in a ref object to avoid "component rerenders" when the value is used as a hook dependency */
|
|
50
50
|
export function useCurrentValueRef(value) {
|
|
51
51
|
const ref = useRef(value);
|
|
52
52
|
ref.current = value;
|
|
@@ -3,7 +3,7 @@ import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/med
|
|
|
3
3
|
import { isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { ensureMediaFilePreviewError, ImageLoadError, isLocalPreviewError, isUnsupportedLocalPreviewError, MediaFilePreviewError } from './errors';
|
|
6
|
-
import { extractErrorInfo } from '
|
|
6
|
+
import { extractErrorInfo } from './analytics';
|
|
7
7
|
import { isBigger, createRequestDimensions, useCurrentValueRef, usePrevious } from './helpers';
|
|
8
8
|
import { generateScriptProps, getSSRData } from './globalScope';
|
|
9
9
|
import { getAndCacheRemotePreview, getSSRCardPreview, isLocalPreview, isSSRClientPreview, isSSRDataPreview, isPreviewableStatus, extractFilePreviewStatus, mediaFilePreviewCache, getAndCacheLocalPreview } from './getPreview';
|
|
@@ -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.6.
|
|
40
|
+
packageName: "77.6.1",
|
|
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.6.
|
|
7
|
+
const packageVersion = "77.6.1";
|
|
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.6.
|
|
43
|
+
var packageVersion = "77.6.1";
|
|
44
44
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(CardBase, _Component);
|
|
46
46
|
var _super = _createSuper(CardBase);
|
|
@@ -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.6.
|
|
86
|
+
var packageVersion = "77.6.1";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { ExternalImageCard } from './externalImageCard';
|
|
10
10
|
import { FileCard } from './fileCard';
|
|
11
11
|
var packageName = "@atlaskit/media-card";
|
|
12
|
-
var packageVersion = "77.6.
|
|
12
|
+
var packageVersion = "77.6.1";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
|
|
2
|
+
import { isMediaFilePreviewError, getFileStateErrorReason, isMediaFileStateError } from './errors';
|
|
3
|
+
export var getErrorTraceContext = function getErrorTraceContext(error) {
|
|
4
|
+
if (isMediaFilePreviewError(error) && !!error.secondaryError) {
|
|
5
|
+
if (isRequestError(error.secondaryError)) {
|
|
6
|
+
var _error$secondaryError;
|
|
7
|
+
return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
|
|
8
|
+
} else if (isMediaFileStateError(error.secondaryError)) {
|
|
9
|
+
var _error$secondaryError2;
|
|
10
|
+
return (_error$secondaryError2 = error.secondaryError.details) === null || _error$secondaryError2 === void 0 || (_error$secondaryError2 = _error$secondaryError2.metadata) === null || _error$secondaryError2 === void 0 ? void 0 : _error$secondaryError2.traceContext;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export var getRenderErrorFailReason = function getRenderErrorFailReason(error) {
|
|
15
|
+
if (isMediaFilePreviewError(error)) {
|
|
16
|
+
return error.primaryReason;
|
|
17
|
+
} else {
|
|
18
|
+
return 'nativeError';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export var getRenderErrorErrorReason = function getRenderErrorErrorReason(error) {
|
|
22
|
+
if (isMediaFilePreviewError(error) && error.secondaryError) {
|
|
23
|
+
var mediaClientReason = isMediaFileStateError(error.secondaryError) ? getFileStateErrorReason(error.secondaryError) : getMediaClientErrorReason(error.secondaryError);
|
|
24
|
+
if (mediaClientReason !== 'unknown') {
|
|
25
|
+
return mediaClientReason;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return 'nativeError';
|
|
29
|
+
};
|
|
30
|
+
export var getRenderErrorErrorDetail = function getRenderErrorErrorDetail(error) {
|
|
31
|
+
if (isMediaFilePreviewError(error) && error.secondaryError) {
|
|
32
|
+
return error.secondaryError.message;
|
|
33
|
+
} else {
|
|
34
|
+
return error.message;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export var extractErrorInfo = function extractErrorInfo(error, metadataTraceContext) {
|
|
38
|
+
return {
|
|
39
|
+
failReason: getRenderErrorFailReason(error),
|
|
40
|
+
error: getRenderErrorErrorReason(error),
|
|
41
|
+
errorDetail: getRenderErrorErrorDetail(error),
|
|
42
|
+
metadataTraceContext: metadataTraceContext !== null && metadataTraceContext !== void 0 ? metadataTraceContext : getErrorTraceContext(error)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -7,6 +7,8 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* Primary reason is logged through Data Portal.
|
|
12
14
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
@@ -121,4 +123,11 @@ export var ensureMediaFilePreviewError = function ensureMediaFilePreviewError(pr
|
|
|
121
123
|
return error;
|
|
122
124
|
}
|
|
123
125
|
return new MediaFilePreviewError(primaryReason, error);
|
|
124
|
-
};
|
|
126
|
+
};
|
|
127
|
+
export function isMediaFileStateError(err) {
|
|
128
|
+
return err instanceof MediaFileStateError;
|
|
129
|
+
}
|
|
130
|
+
export function getFileStateErrorReason(err) {
|
|
131
|
+
var _err$details$reason, _err$details;
|
|
132
|
+
return (_err$details$reason = (_err$details = err.details) === null || _err$details === void 0 ? void 0 : _err$details.reason) !== null && _err$details$reason !== void 0 ? _err$details$reason : 'unknown';
|
|
133
|
+
}
|
|
@@ -42,7 +42,7 @@ export var createRequestDimensions = function createRequestDimensions(dimensions
|
|
|
42
42
|
return result;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/** Stores the provided value in a
|
|
45
|
+
/** Stores the provided value in a ref object to avoid "component rerenders" when the value is used as a hook dependency */
|
|
46
46
|
export function useCurrentValueRef(value) {
|
|
47
47
|
var ref = useRef(value);
|
|
48
48
|
ref.current = value;
|
|
@@ -9,7 +9,7 @@ import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/med
|
|
|
9
9
|
import { isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
10
10
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import { ensureMediaFilePreviewError, ImageLoadError, isLocalPreviewError, isUnsupportedLocalPreviewError, MediaFilePreviewError } from './errors';
|
|
12
|
-
import { extractErrorInfo } from '
|
|
12
|
+
import { extractErrorInfo } from './analytics';
|
|
13
13
|
import { isBigger, createRequestDimensions, useCurrentValueRef, usePrevious } from './helpers';
|
|
14
14
|
import { generateScriptProps, getSSRData } from './globalScope';
|
|
15
15
|
import { getAndCacheRemotePreview, getSSRCardPreview, isLocalPreview, isSSRClientPreview, isSSRDataPreview, isPreviewableStatus, extractFilePreviewStatus, mediaFilePreviewCache, getAndCacheLocalPreview } from './getPreview';
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "77.6.
|
|
106
|
+
packageName: "77.6.1",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
7
7
|
import { MediaCardError } from '../errors';
|
|
8
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
9
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "77.6.
|
|
10
|
+
var packageVersion = "77.6.1";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
2
|
+
import { SuccessAttributes, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaFilePreviewError, MediaFilePreviewErrorPrimaryReason } from './errors';
|
|
4
|
+
export type FailedErrorFailReason = MediaFilePreviewErrorPrimaryReason | 'nativeError';
|
|
5
|
+
export type MediaFilePreviewErrorInfo = {
|
|
6
|
+
failReason: FailedErrorFailReason;
|
|
7
|
+
error: MediaClientErrorReason | 'nativeError';
|
|
8
|
+
errorDetail: string;
|
|
9
|
+
metadataTraceContext?: MediaTraceContext;
|
|
10
|
+
};
|
|
11
|
+
export type SSRStatusFail = MediaFilePreviewErrorInfo & {
|
|
12
|
+
status: 'fail';
|
|
13
|
+
};
|
|
14
|
+
type SSRStatusSuccess = SuccessAttributes;
|
|
15
|
+
type SSRStatusUnknown = {
|
|
16
|
+
status: 'unknown';
|
|
17
|
+
};
|
|
18
|
+
type SSRStatusAttributes = SSRStatusSuccess | SSRStatusFail | SSRStatusUnknown;
|
|
19
|
+
export type SSRStatus = {
|
|
20
|
+
server: SSRStatusAttributes;
|
|
21
|
+
client: SSRStatusAttributes;
|
|
22
|
+
};
|
|
23
|
+
export declare const getErrorTraceContext: (error: MediaFilePreviewError) => MediaTraceContext | undefined;
|
|
24
|
+
export declare const getRenderErrorFailReason: (error: MediaFilePreviewError) => FailedErrorFailReason;
|
|
25
|
+
export declare const getRenderErrorErrorReason: (error: MediaFilePreviewError) => MediaClientErrorReason | 'nativeError';
|
|
26
|
+
export declare const getRenderErrorErrorDetail: (error: MediaFilePreviewError) => string;
|
|
27
|
+
export declare const extractErrorInfo: (error: MediaFilePreviewError, metadataTraceContext?: MediaTraceContext) => MediaFilePreviewErrorInfo;
|
|
28
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
2
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
1
3
|
import { MediaFilePreview } from './types';
|
|
2
4
|
/**
|
|
3
5
|
* Primary reason is logged through Data Portal.
|
|
@@ -36,3 +38,5 @@ export declare const isLocalPreviewError: (err: Error) => err is LocalPreviewErr
|
|
|
36
38
|
export declare const isRemotePreviewError: (err: Error) => err is RemotePreviewError;
|
|
37
39
|
export declare const isUnsupportedLocalPreviewError: (err: Error) => boolean;
|
|
38
40
|
export declare const ensureMediaFilePreviewError: (primaryReason: MediaFilePreviewErrorPrimaryReason, error: Error, updatePrimaryReason?: boolean) => MediaFilePreviewError;
|
|
41
|
+
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
42
|
+
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
@@ -6,6 +6,6 @@ import { MutableRefObject } from 'react';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const isBigger: (current?: MediaFilePreviewDimensions, next?: MediaFilePreviewDimensions) => boolean;
|
|
8
8
|
export declare const createRequestDimensions: (dimensions: Partial<MediaFilePreviewDimensions>) => Partial<MediaFilePreviewDimensions> | undefined;
|
|
9
|
-
/** Stores the provided value in a
|
|
9
|
+
/** Stores the provided value in a ref object to avoid "component rerenders" when the value is used as a hook dependency */
|
|
10
10
|
export declare function useCurrentValueRef<T>(value: T): MutableRefObject<T>;
|
|
11
11
|
export declare function usePrevious<T>(value: T | undefined): T | undefined;
|
|
@@ -3,7 +3,7 @@ import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs } from '@atlaskit/me
|
|
|
3
3
|
import { MediaTraceContext, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
4
4
|
import { MediaFilePreviewError } from './errors';
|
|
5
5
|
import { MediaFilePreview } from './types';
|
|
6
|
-
import { SSRStatus } from '
|
|
6
|
+
import { SSRStatus } from './analytics';
|
|
7
7
|
export interface UseFilePreviewParams {
|
|
8
8
|
/** Instance of file identifier. */
|
|
9
9
|
readonly identifier: FileIdentifier;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
2
|
+
import { SuccessAttributes, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaFilePreviewError, MediaFilePreviewErrorPrimaryReason } from './errors';
|
|
4
|
+
export type FailedErrorFailReason = MediaFilePreviewErrorPrimaryReason | 'nativeError';
|
|
5
|
+
export type MediaFilePreviewErrorInfo = {
|
|
6
|
+
failReason: FailedErrorFailReason;
|
|
7
|
+
error: MediaClientErrorReason | 'nativeError';
|
|
8
|
+
errorDetail: string;
|
|
9
|
+
metadataTraceContext?: MediaTraceContext;
|
|
10
|
+
};
|
|
11
|
+
export type SSRStatusFail = MediaFilePreviewErrorInfo & {
|
|
12
|
+
status: 'fail';
|
|
13
|
+
};
|
|
14
|
+
type SSRStatusSuccess = SuccessAttributes;
|
|
15
|
+
type SSRStatusUnknown = {
|
|
16
|
+
status: 'unknown';
|
|
17
|
+
};
|
|
18
|
+
type SSRStatusAttributes = SSRStatusSuccess | SSRStatusFail | SSRStatusUnknown;
|
|
19
|
+
export type SSRStatus = {
|
|
20
|
+
server: SSRStatusAttributes;
|
|
21
|
+
client: SSRStatusAttributes;
|
|
22
|
+
};
|
|
23
|
+
export declare const getErrorTraceContext: (error: MediaFilePreviewError) => MediaTraceContext | undefined;
|
|
24
|
+
export declare const getRenderErrorFailReason: (error: MediaFilePreviewError) => FailedErrorFailReason;
|
|
25
|
+
export declare const getRenderErrorErrorReason: (error: MediaFilePreviewError) => MediaClientErrorReason | 'nativeError';
|
|
26
|
+
export declare const getRenderErrorErrorDetail: (error: MediaFilePreviewError) => string;
|
|
27
|
+
export declare const extractErrorInfo: (error: MediaFilePreviewError, metadataTraceContext?: MediaTraceContext) => MediaFilePreviewErrorInfo;
|
|
28
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
2
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
1
3
|
import { MediaFilePreview } from './types';
|
|
2
4
|
/**
|
|
3
5
|
* Primary reason is logged through Data Portal.
|
|
@@ -36,3 +38,5 @@ export declare const isLocalPreviewError: (err: Error) => err is LocalPreviewErr
|
|
|
36
38
|
export declare const isRemotePreviewError: (err: Error) => err is RemotePreviewError;
|
|
37
39
|
export declare const isUnsupportedLocalPreviewError: (err: Error) => boolean;
|
|
38
40
|
export declare const ensureMediaFilePreviewError: (primaryReason: MediaFilePreviewErrorPrimaryReason, error: Error, updatePrimaryReason?: boolean) => MediaFilePreviewError;
|
|
41
|
+
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
42
|
+
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
@@ -6,6 +6,6 @@ import { MutableRefObject } from 'react';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const isBigger: (current?: MediaFilePreviewDimensions, next?: MediaFilePreviewDimensions) => boolean;
|
|
8
8
|
export declare const createRequestDimensions: (dimensions: Partial<MediaFilePreviewDimensions>) => Partial<MediaFilePreviewDimensions> | undefined;
|
|
9
|
-
/** Stores the provided value in a
|
|
9
|
+
/** Stores the provided value in a ref object to avoid "component rerenders" when the value is used as a hook dependency */
|
|
10
10
|
export declare function useCurrentValueRef<T>(value: T): MutableRefObject<T>;
|
|
11
11
|
export declare function usePrevious<T>(value: T | undefined): T | undefined;
|
|
@@ -3,7 +3,7 @@ import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs } from '@atlaskit/me
|
|
|
3
3
|
import { MediaTraceContext, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
4
4
|
import { MediaFilePreviewError } from './errors';
|
|
5
5
|
import { MediaFilePreview } from './types';
|
|
6
|
-
import { SSRStatus } from '
|
|
6
|
+
import { SSRStatus } from './analytics';
|
|
7
7
|
export interface UseFilePreviewParams {
|
|
8
8
|
/** Instance of file identifier. */
|
|
9
9
|
readonly identifier: FileIdentifier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.6.
|
|
3
|
+
"version": "77.6.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@atlaskit/dropdown-menu": "^12.1.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.8.0",
|
|
42
42
|
"@atlaskit/icon": "^22.0.0",
|
|
43
|
-
"@atlaskit/media-client": "^26.
|
|
43
|
+
"@atlaskit/media-client": "^26.1.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
45
45
|
"@atlaskit/media-common": "^11.0.0",
|
|
46
46
|
"@atlaskit/media-ui": "^25.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
49
49
|
"@atlaskit/spinner": "^16.0.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.30.0",
|
|
52
52
|
"@atlaskit/tooltip": "^18.0.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.2.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/media-core": "^34.1.0",
|
|
72
72
|
"@atlaskit/media-picker": "^66.2.0",
|
|
73
73
|
"@atlaskit/media-state": "^1.0.0",
|
|
74
|
-
"@atlaskit/media-test-data": "^1.
|
|
74
|
+
"@atlaskit/media-test-data": "^1.1.0",
|
|
75
75
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
76
76
|
"@atlaskit/ssr": "*",
|
|
77
77
|
"@atlaskit/visual-regression": "*",
|