@atlaskit/media-card 76.1.2 → 76.2.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 +20 -1
- package/dist/cjs/card/actions.js +2 -2
- package/dist/cjs/card/card.js +3 -3
- package/dist/cjs/card/cardLoader.js +2 -5
- package/dist/cjs/card/cardSwitcher.js +12 -0
- package/dist/cjs/card/cardView.js +3 -4
- package/dist/cjs/card/getCardPreview/cache.js +3 -0
- package/dist/cjs/card/getCardPreview/index.js +2 -2
- package/dist/cjs/card/index.js +2 -2
- package/dist/cjs/card/media-card-analytics-error-boundary.js +3 -3
- package/dist/cjs/card/ui/progressBar/styledBar.js +1 -0
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +1 -0
- package/dist/cjs/card/v2/cardV2.js +1054 -0
- package/dist/cjs/card/v2/cardV2Loader.js +95 -0
- package/dist/cjs/errors.js +89 -31
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +4 -4
- package/dist/cjs/inline/mediaInlineCardAnalytics.js +2 -2
- package/dist/cjs/utils/analytics.js +18 -8
- package/dist/cjs/utils/objectURLCache.js +5 -0
- package/dist/cjs/utils/ufoExperiences.js +3 -3
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardLoader.js +2 -5
- package/dist/es2019/card/cardSwitcher.js +4 -0
- package/dist/es2019/card/cardView.js +1 -2
- package/dist/es2019/card/getCardPreview/cache.js +3 -0
- package/dist/es2019/card/index.js +1 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/progressBar/styledBar.js +1 -0
- package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +1 -0
- package/dist/es2019/card/v2/cardV2.js +1031 -0
- package/dist/es2019/card/v2/cardV2Loader.js +58 -0
- package/dist/es2019/errors.js +45 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +2 -2
- package/dist/es2019/utils/analytics.js +17 -7
- package/dist/es2019/utils/objectURLCache.js +3 -0
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/actions.js +2 -2
- package/dist/esm/card/card.js +3 -3
- package/dist/esm/card/cardLoader.js +2 -5
- package/dist/esm/card/cardSwitcher.js +4 -0
- package/dist/esm/card/cardView.js +3 -4
- package/dist/esm/card/getCardPreview/cache.js +3 -0
- package/dist/esm/card/getCardPreview/index.js +2 -2
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +3 -3
- package/dist/esm/card/ui/progressBar/styledBar.js +1 -0
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -0
- package/dist/esm/card/v2/cardV2.js +1043 -0
- package/dist/esm/card/v2/cardV2Loader.js +78 -0
- package/dist/esm/errors.js +83 -30
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +4 -4
- package/dist/esm/inline/mediaInlineCardAnalytics.js +2 -2
- package/dist/esm/utils/analytics.js +19 -9
- package/dist/esm/utils/objectURLCache.js +5 -0
- package/dist/esm/utils/ufoExperiences.js +3 -3
- package/dist/types/card/cardSwitcher.d.ts +3 -0
- package/dist/types/card/getCardPreview/cache.d.ts +2 -0
- package/dist/types/card/index.d.ts +1 -1
- package/dist/types/card/v2/cardV2.d.ts +62 -0
- package/dist/types/card/v2/cardV2Loader.d.ts +4 -0
- package/dist/types/errors.d.ts +12 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/utils/objectURLCache.d.ts +1 -0
- package/dist/types-ts4.5/card/cardSwitcher.d.ts +3 -0
- package/dist/types-ts4.5/card/getCardPreview/cache.d.ts +2 -0
- package/dist/types-ts4.5/card/index.d.ts +1 -1
- package/dist/types-ts4.5/card/v2/cardV2.d.ts +62 -0
- package/dist/types-ts4.5/card/v2/cardV2Loader.d.ts +4 -0
- package/dist/types-ts4.5/errors.d.ts +12 -0
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/dist/types-ts4.5/utils/objectURLCache.d.ts +1 -0
- package/package.json +16 -7
- package/report.api.md +4 -1
- package/tmp/api-report-tmp.d.ts +4 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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) { _defineProperty(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; }
|
|
5
|
+
import React, { useContext } from 'react';
|
|
6
|
+
import Loadable from 'react-loadable';
|
|
7
|
+
import { CardLoading } from '../../utils/lightCards/cardLoading';
|
|
8
|
+
var MediaCardContext = /*#__PURE__*/React.createContext({});
|
|
9
|
+
var CardLoadingWithContext = function CardLoadingWithContext() {
|
|
10
|
+
var props = useContext(MediaCardContext);
|
|
11
|
+
return /*#__PURE__*/React.createElement(CardLoading, props);
|
|
12
|
+
};
|
|
13
|
+
var MediaV2Card = Loadable({
|
|
14
|
+
loader: function loader() {
|
|
15
|
+
return import( /* webpackChunkName: "@atlaskit-internal_media-card-v2" */'./cardV2').then(function (mod) {
|
|
16
|
+
return mod.CardV2;
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
loading: function loading() {
|
|
20
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var MediaCardErrorBoundary = Loadable({
|
|
24
|
+
loader: function loader() {
|
|
25
|
+
return import( /* webpackChunkName: "@atlaskit-internal_media-card-error-boundary" */'../media-card-analytics-error-boundary').then(function (mod) {
|
|
26
|
+
return mod.default;
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
loading: function loading() {
|
|
30
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var MediaCardWithMediaClient = function MediaCardWithMediaClient(props) {
|
|
34
|
+
var dimensions = props.dimensions,
|
|
35
|
+
onClick = props.onClick,
|
|
36
|
+
useMediaClient = props.useMediaClient,
|
|
37
|
+
featureFlags = props.featureFlags;
|
|
38
|
+
var mediaClient = useMediaClient();
|
|
39
|
+
var featureFlagsWithMediaCardV2 = React.useMemo(function () {
|
|
40
|
+
return _objectSpread(_objectSpread({}, featureFlags), {}, {
|
|
41
|
+
mediaCardV2: true //used for analytics - internal use only
|
|
42
|
+
});
|
|
43
|
+
}, [featureFlags]);
|
|
44
|
+
return /*#__PURE__*/React.createElement(MediaCardErrorBoundary, {
|
|
45
|
+
dimensions: dimensions,
|
|
46
|
+
onClick: onClick
|
|
47
|
+
}, /*#__PURE__*/React.createElement(MediaV2Card, _extends({}, props, {
|
|
48
|
+
featureFlags: featureFlagsWithMediaCardV2,
|
|
49
|
+
mediaClient: mediaClient
|
|
50
|
+
})));
|
|
51
|
+
};
|
|
52
|
+
var MediaCardWithMediaClientProvider = Loadable({
|
|
53
|
+
loader: function loader() {
|
|
54
|
+
return import( /* webpackChunkName: "@atlaskit-internal_media-client-react" */'@atlaskit/media-client-react');
|
|
55
|
+
},
|
|
56
|
+
loading: function loading() {
|
|
57
|
+
return /*#__PURE__*/React.createElement(CardLoadingWithContext, null);
|
|
58
|
+
},
|
|
59
|
+
render: function render(loaded, props) {
|
|
60
|
+
var mediaCard = /*#__PURE__*/React.createElement(MediaCardWithMediaClient, _extends({}, props, {
|
|
61
|
+
useMediaClient: loaded.useMediaClient
|
|
62
|
+
}));
|
|
63
|
+
return /*#__PURE__*/React.createElement(loaded.MediaClientContext.Consumer, null, function (value) {
|
|
64
|
+
return value ? mediaCard :
|
|
65
|
+
/*#__PURE__*/
|
|
66
|
+
// TODO - make clientConfig optional
|
|
67
|
+
React.createElement(loaded.MediaClientProvider, {
|
|
68
|
+
clientConfig: props.mediaClientConfig
|
|
69
|
+
}, mediaCard);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
var CardLoader = function CardLoader(props) {
|
|
74
|
+
return /*#__PURE__*/React.createElement(MediaCardContext.Provider, {
|
|
75
|
+
value: props
|
|
76
|
+
}, /*#__PURE__*/React.createElement(MediaCardWithMediaClientProvider, props));
|
|
77
|
+
};
|
|
78
|
+
export default CardLoader;
|
package/dist/esm/errors.js
CHANGED
|
@@ -7,67 +7,120 @@ 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 { isPollingError as isMediaClientPollingError, isRateLimitedError as isMediaClientRateLimitedError } from '@atlaskit/media-client';
|
|
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
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
|
-
export var
|
|
16
|
-
_inherits(
|
|
17
|
-
var _super = _createSuper(
|
|
18
|
-
function
|
|
17
|
+
export var MediaFileStateError = /*#__PURE__*/function (_Error) {
|
|
18
|
+
_inherits(MediaFileStateError, _Error);
|
|
19
|
+
var _super = _createSuper(MediaFileStateError);
|
|
20
|
+
function MediaFileStateError(id, reason) {
|
|
19
21
|
var _this;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
23
|
+
var details = arguments.length > 3 ? arguments[3] : undefined;
|
|
24
|
+
_classCallCheck(this, MediaFileStateError);
|
|
25
|
+
_this = _super.call(this, reason);
|
|
22
26
|
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
23
|
-
_this.
|
|
24
|
-
_this.
|
|
25
|
-
|
|
27
|
+
_this.id = id;
|
|
28
|
+
_this.reason = reason;
|
|
29
|
+
_this.message = message;
|
|
30
|
+
_this.details = details;
|
|
31
|
+
Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof MediaFileStateError ? this.constructor : void 0).prototype);
|
|
26
32
|
|
|
27
33
|
// https://v8.dev/docs/stack-trace-api
|
|
28
34
|
if ('captureStackTrace' in Error) {
|
|
29
|
-
Error.captureStackTrace(_assertThisInitialized(_this), this instanceof
|
|
35
|
+
Error.captureStackTrace(_assertThisInitialized(_this), this instanceof MediaFileStateError ? this.constructor : void 0);
|
|
30
36
|
}
|
|
31
37
|
return _this;
|
|
32
38
|
}
|
|
39
|
+
return _createClass(MediaFileStateError);
|
|
40
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
41
|
+
export function isMediaFileStateError(err) {
|
|
42
|
+
return err instanceof MediaFileStateError;
|
|
43
|
+
}
|
|
44
|
+
export function getFileStateErrorReason(err) {
|
|
45
|
+
var _err$details$reason, _err$details;
|
|
46
|
+
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';
|
|
47
|
+
}
|
|
48
|
+
var POLLING_REASON = 'pollingMaxAttemptsExceeded';
|
|
49
|
+
export function isPollingError(err) {
|
|
50
|
+
if (!err) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return isMediaClientPollingError(err) || isMediaFileStateError(err) && err.reason === POLLING_REASON;
|
|
54
|
+
}
|
|
55
|
+
export function isRateLimitedError(error) {
|
|
56
|
+
if (!error) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (isMediaClientRateLimitedError(error)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (isMediaFileStateError(error)) {
|
|
63
|
+
var _error$details, _error$message;
|
|
64
|
+
return ((_error$details = error.details) === null || _error$details === void 0 ? void 0 : _error$details.statusCode) === 429 || ((_error$message = error.message) === null || _error$message === void 0 ? void 0 : _error$message.includes('429'));
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
export var MediaCardError = /*#__PURE__*/function (_Error2) {
|
|
69
|
+
_inherits(MediaCardError, _Error2);
|
|
70
|
+
var _super2 = _createSuper(MediaCardError);
|
|
71
|
+
function MediaCardError(primaryReason, secondaryError) {
|
|
72
|
+
var _this2;
|
|
73
|
+
_classCallCheck(this, MediaCardError);
|
|
74
|
+
_this2 = _super2.call(this, primaryReason);
|
|
75
|
+
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
76
|
+
_this2.primaryReason = primaryReason;
|
|
77
|
+
_this2.secondaryError = secondaryError;
|
|
78
|
+
Object.setPrototypeOf(_assertThisInitialized(_this2), (this instanceof MediaCardError ? this.constructor : void 0).prototype);
|
|
79
|
+
|
|
80
|
+
// https://v8.dev/docs/stack-trace-api
|
|
81
|
+
if ('captureStackTrace' in Error) {
|
|
82
|
+
Error.captureStackTrace(_assertThisInitialized(_this2), this instanceof MediaCardError ? this.constructor : void 0);
|
|
83
|
+
}
|
|
84
|
+
return _this2;
|
|
85
|
+
}
|
|
33
86
|
return _createClass(MediaCardError);
|
|
34
87
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
35
88
|
export var LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
36
89
|
_inherits(LocalPreviewError, _MediaCardError);
|
|
37
|
-
var
|
|
90
|
+
var _super3 = _createSuper(LocalPreviewError);
|
|
38
91
|
function LocalPreviewError(primaryReason, secondaryError) {
|
|
39
|
-
var
|
|
92
|
+
var _this3;
|
|
40
93
|
_classCallCheck(this, LocalPreviewError);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
94
|
+
_this3 = _super3.call(this, primaryReason, secondaryError);
|
|
95
|
+
_this3.primaryReason = primaryReason;
|
|
96
|
+
_this3.secondaryError = secondaryError;
|
|
97
|
+
return _this3;
|
|
45
98
|
}
|
|
46
99
|
return _createClass(LocalPreviewError);
|
|
47
100
|
}(MediaCardError);
|
|
48
101
|
export var RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
49
102
|
_inherits(RemotePreviewError, _MediaCardError2);
|
|
50
|
-
var
|
|
103
|
+
var _super4 = _createSuper(RemotePreviewError);
|
|
51
104
|
function RemotePreviewError(primaryReason, secondaryError) {
|
|
52
|
-
var
|
|
105
|
+
var _this4;
|
|
53
106
|
_classCallCheck(this, RemotePreviewError);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
107
|
+
_this4 = _super4.call(this, primaryReason, secondaryError);
|
|
108
|
+
_this4.primaryReason = primaryReason;
|
|
109
|
+
_this4.secondaryError = secondaryError;
|
|
110
|
+
return _this4;
|
|
58
111
|
}
|
|
59
112
|
return _createClass(RemotePreviewError);
|
|
60
113
|
}(MediaCardError);
|
|
61
114
|
export var SsrPreviewError = /*#__PURE__*/function (_MediaCardError3) {
|
|
62
115
|
_inherits(SsrPreviewError, _MediaCardError3);
|
|
63
|
-
var
|
|
116
|
+
var _super5 = _createSuper(SsrPreviewError);
|
|
64
117
|
function SsrPreviewError(primaryReason, secondaryError) {
|
|
65
|
-
var
|
|
118
|
+
var _this5;
|
|
66
119
|
_classCallCheck(this, SsrPreviewError);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
120
|
+
_this5 = _super5.call(this, primaryReason, secondaryError);
|
|
121
|
+
_this5.primaryReason = primaryReason;
|
|
122
|
+
_this5.secondaryError = secondaryError;
|
|
123
|
+
return _this5;
|
|
71
124
|
}
|
|
72
125
|
return _createClass(SsrPreviewError);
|
|
73
126
|
}(MediaCardError);
|
|
@@ -90,10 +143,10 @@ export var getImageLoadPrimaryReason = function getImageLoadPrimaryReason(source
|
|
|
90
143
|
};
|
|
91
144
|
export var ImageLoadError = /*#__PURE__*/function (_MediaCardError4) {
|
|
92
145
|
_inherits(ImageLoadError, _MediaCardError4);
|
|
93
|
-
var
|
|
146
|
+
var _super6 = _createSuper(ImageLoadError);
|
|
94
147
|
function ImageLoadError(source) {
|
|
95
148
|
_classCallCheck(this, ImageLoadError);
|
|
96
|
-
return
|
|
149
|
+
return _super6.call(this, getImageLoadPrimaryReason(source));
|
|
97
150
|
}
|
|
98
151
|
return _createClass(ImageLoadError);
|
|
99
152
|
}(MediaCardError);
|
|
@@ -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: "76.1
|
|
106
|
+
packageName: "76.2.1",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -7,8 +7,8 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
-
function ownKeys(
|
|
11
|
-
function _objectSpread(
|
|
10
|
+
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; }
|
|
11
|
+
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) { _defineProperty(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; }
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
14
14
|
import { B300, R300, N30A, N900 } from '@atlaskit/theme/colors';
|
|
@@ -40,8 +40,8 @@ var ErrorBoundaryComponent = function ErrorBoundaryComponent(_ref) {
|
|
|
40
40
|
|
|
41
41
|
var style = _objectSpread({
|
|
42
42
|
lineHeight: '16px',
|
|
43
|
-
padding:
|
|
44
|
-
marginRight:
|
|
43
|
+
padding: "var(--ds-space-025, 2px)".concat(" ", "var(--ds-space-050, 4px)"),
|
|
44
|
+
marginRight: "var(--ds-space-negative-025, -2px)",
|
|
45
45
|
WebkitBoxDecorationBreak: 'clone',
|
|
46
46
|
display: 'inline',
|
|
47
47
|
borderRadius: '3px',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
4
|
import { extractErrorInfo } from '../utils/analytics';
|
|
5
5
|
export var getSucceededStatusPayload = function getSucceededStatusPayload(fileState) {
|
|
6
6
|
return {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
4
|
import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
|
|
5
5
|
import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
|
|
6
6
|
import { createAndFireEvent } from '@atlaskit/analytics-next';
|
|
7
|
-
import { isMediaCardError } from '../errors';
|
|
7
|
+
import { isMediaCardError, getFileStateErrorReason, isMediaFileStateError } from '../errors';
|
|
8
8
|
export var getFileAttributes = function getFileAttributes(metadata, fileStatus) {
|
|
9
9
|
return {
|
|
10
10
|
fileMediatype: metadata.mediaType,
|
|
@@ -97,7 +97,7 @@ export var getRenderErrorFailReason = function getRenderErrorFailReason(error) {
|
|
|
97
97
|
};
|
|
98
98
|
export var getRenderErrorErrorReason = function getRenderErrorErrorReason(error) {
|
|
99
99
|
if (isMediaCardError(error) && error.secondaryError) {
|
|
100
|
-
var mediaClientReason = getMediaClientErrorReason(error.secondaryError);
|
|
100
|
+
var mediaClientReason = isMediaFileStateError(error.secondaryError) ? getFileStateErrorReason(error.secondaryError) : getMediaClientErrorReason(error.secondaryError);
|
|
101
101
|
if (mediaClientReason !== 'unknown') {
|
|
102
102
|
return mediaClientReason;
|
|
103
103
|
}
|
|
@@ -112,14 +112,24 @@ export var getRenderErrorErrorDetail = function getRenderErrorErrorDetail(error)
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
export var getErrorTraceContext = function getErrorTraceContext(error) {
|
|
115
|
-
if (isMediaCardError(error) && !!error.secondaryError
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (isMediaCardError(error) && !!error.secondaryError) {
|
|
116
|
+
if (isRequestError(error.secondaryError)) {
|
|
117
|
+
var _error$secondaryError;
|
|
118
|
+
return (_error$secondaryError = error.secondaryError.metadata) === null || _error$secondaryError === void 0 ? void 0 : _error$secondaryError.traceContext;
|
|
119
|
+
} else if (isMediaFileStateError(error.secondaryError)) {
|
|
120
|
+
var _error$secondaryError2, _error$secondaryError3;
|
|
121
|
+
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;
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
};
|
|
120
125
|
export var getRenderErrorRequestMetadata = function getRenderErrorRequestMetadata(error) {
|
|
121
|
-
if (isMediaCardError(error) && !!error.secondaryError
|
|
122
|
-
|
|
126
|
+
if (isMediaCardError(error) && !!error.secondaryError) {
|
|
127
|
+
if (isRequestError(error.secondaryError)) {
|
|
128
|
+
return error.secondaryError.metadata;
|
|
129
|
+
} else if (isMediaFileStateError(error.secondaryError)) {
|
|
130
|
+
var _error$secondaryError4;
|
|
131
|
+
return (_error$secondaryError4 = error.secondaryError.details) === null || _error$secondaryError4 === void 0 ? void 0 : _error$secondaryError4.metadata;
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
};
|
|
125
135
|
export var extractErrorInfo = function extractErrorInfo(error, metadataTraceContext) {
|
|
@@ -65,6 +65,11 @@ export var ObjectURLCache = /*#__PURE__*/function () {
|
|
|
65
65
|
var removed = this.cache.delete(key);
|
|
66
66
|
removed && URL.revokeObjectURL(removed.dataURI);
|
|
67
67
|
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "clear",
|
|
70
|
+
value: function clear() {
|
|
71
|
+
this.cache.clear();
|
|
72
|
+
}
|
|
68
73
|
}]);
|
|
69
74
|
return ObjectURLCache;
|
|
70
75
|
}();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
4
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
5
5
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
6
6
|
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 = "76.1
|
|
10
|
+
var packageVersion = "76.2.1";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -7,6 +7,7 @@ export interface CardPreviewCache {
|
|
|
7
7
|
get(id: string, mode: Mode): CardPreview | undefined;
|
|
8
8
|
set(id: string, mode: Mode, cardPreview: CardPreview): void;
|
|
9
9
|
remove(id: string, mode: Mode): void;
|
|
10
|
+
clear(): void;
|
|
10
11
|
}
|
|
11
12
|
export declare class CardPreviewCacheImpl implements CardPreviewCache {
|
|
12
13
|
private previewCache;
|
|
@@ -14,6 +15,7 @@ export declare class CardPreviewCacheImpl implements CardPreviewCache {
|
|
|
14
15
|
get: (id: string, mode: Mode) => CardPreview | undefined;
|
|
15
16
|
set: (id: string, mode: Mode, cardPreview: CardPreview) => void;
|
|
16
17
|
remove: (id: string, mode: Mode) => void;
|
|
18
|
+
clear: () => void;
|
|
17
19
|
}
|
|
18
20
|
declare const _default: CardPreviewCacheImpl;
|
|
19
21
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Card } from './
|
|
1
|
+
export { default as Card } from './cardSwitcher';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
import { FileIdentifier, FileState, MediaSubscription } from '@atlaskit/media-client';
|
|
4
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import { CardAction } from '../actions';
|
|
6
|
+
import { CardProps, CardState, CardStatus } from '../../types';
|
|
7
|
+
export type CardV2BaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
8
|
+
export declare class CardV2Base extends Component<CardV2BaseProps, CardState> {
|
|
9
|
+
private internalOccurrenceKey;
|
|
10
|
+
private hasBeenMounted;
|
|
11
|
+
private fileStateFlags;
|
|
12
|
+
private ssrReliability;
|
|
13
|
+
private timeElapsedTillCommenced;
|
|
14
|
+
subscription?: MediaSubscription;
|
|
15
|
+
private ssrData?;
|
|
16
|
+
private traceContext;
|
|
17
|
+
static defaultProps: Partial<CardProps>;
|
|
18
|
+
constructor(props: CardV2BaseProps);
|
|
19
|
+
private getSSRPreview;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
22
|
+
componentWillUnmount(): void;
|
|
23
|
+
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
24
|
+
private getImageURLParams;
|
|
25
|
+
private getMediaBlobUrlAttrs;
|
|
26
|
+
private getCardPreviewParams;
|
|
27
|
+
private setCacheSSRPreview;
|
|
28
|
+
private refetchSSRPreview;
|
|
29
|
+
private resolveUpfrontPreview;
|
|
30
|
+
private fetchAndCacheRemotePreview;
|
|
31
|
+
private resolvePreview;
|
|
32
|
+
updateFileStateFlag(fileState?: FileState): void;
|
|
33
|
+
private subscribeFileState;
|
|
34
|
+
private get requestedDimensions();
|
|
35
|
+
private get metadata();
|
|
36
|
+
private get fileAttributes();
|
|
37
|
+
private getPerformanceAttributes;
|
|
38
|
+
private logSSRImageError;
|
|
39
|
+
private onImageError;
|
|
40
|
+
private onImageLoad;
|
|
41
|
+
private fireOperationalEvent;
|
|
42
|
+
private fireCommencedEvent;
|
|
43
|
+
private fireCopiedEvent;
|
|
44
|
+
private fireScreenEvent;
|
|
45
|
+
private fireNonCriticalErrorEvent;
|
|
46
|
+
private safeSetState;
|
|
47
|
+
get actions(): CardAction[];
|
|
48
|
+
onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
49
|
+
onInlinePlayerError: () => void;
|
|
50
|
+
setRef: (cardRef: HTMLDivElement | null) => void;
|
|
51
|
+
renderInlinePlayer: () => JSX.Element;
|
|
52
|
+
onMediaViewerClose: () => void;
|
|
53
|
+
private onDisplayImage;
|
|
54
|
+
renderMediaViewer: () => React.ReactPortal | undefined;
|
|
55
|
+
renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
|
|
56
|
+
private storeSSRData;
|
|
57
|
+
render(): JSX.Element;
|
|
58
|
+
private onCardInViewport;
|
|
59
|
+
onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
60
|
+
onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare const CardV2: React.ComponentType<CardV2BaseProps>;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
1
2
|
import { CardPreview } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Primary reason is logged through Data Portal.
|
|
@@ -8,6 +9,17 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
|
|
|
8
9
|
export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
|
|
9
10
|
export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
10
11
|
export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
12
|
+
export declare class MediaFileStateError extends Error {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly reason?: string | undefined;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly details?: Record<string, any> | undefined;
|
|
17
|
+
constructor(id: string, reason?: string | undefined, message?: string, details?: Record<string, any> | undefined);
|
|
18
|
+
}
|
|
19
|
+
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
20
|
+
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
21
|
+
export declare function isPollingError(err?: Error): boolean;
|
|
22
|
+
export declare function isRateLimitedError(error?: Error): boolean;
|
|
11
23
|
export declare class MediaCardError extends Error {
|
|
12
24
|
readonly primaryReason: MediaCardErrorPrimaryReason;
|
|
13
25
|
readonly secondaryError?: Error | undefined;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface CardPreviewCache {
|
|
|
7
7
|
get(id: string, mode: Mode): CardPreview | undefined;
|
|
8
8
|
set(id: string, mode: Mode, cardPreview: CardPreview): void;
|
|
9
9
|
remove(id: string, mode: Mode): void;
|
|
10
|
+
clear(): void;
|
|
10
11
|
}
|
|
11
12
|
export declare class CardPreviewCacheImpl implements CardPreviewCache {
|
|
12
13
|
private previewCache;
|
|
@@ -14,6 +15,7 @@ export declare class CardPreviewCacheImpl implements CardPreviewCache {
|
|
|
14
15
|
get: (id: string, mode: Mode) => CardPreview | undefined;
|
|
15
16
|
set: (id: string, mode: Mode, cardPreview: CardPreview) => void;
|
|
16
17
|
remove: (id: string, mode: Mode) => void;
|
|
18
|
+
clear: () => void;
|
|
17
19
|
}
|
|
18
20
|
declare const _default: CardPreviewCacheImpl;
|
|
19
21
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Card } from './
|
|
1
|
+
export { default as Card } from './cardSwitcher';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
import { FileIdentifier, FileState, MediaSubscription } from '@atlaskit/media-client';
|
|
4
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import { CardAction } from '../actions';
|
|
6
|
+
import { CardProps, CardState, CardStatus } from '../../types';
|
|
7
|
+
export type CardV2BaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
8
|
+
export declare class CardV2Base extends Component<CardV2BaseProps, CardState> {
|
|
9
|
+
private internalOccurrenceKey;
|
|
10
|
+
private hasBeenMounted;
|
|
11
|
+
private fileStateFlags;
|
|
12
|
+
private ssrReliability;
|
|
13
|
+
private timeElapsedTillCommenced;
|
|
14
|
+
subscription?: MediaSubscription;
|
|
15
|
+
private ssrData?;
|
|
16
|
+
private traceContext;
|
|
17
|
+
static defaultProps: Partial<CardProps>;
|
|
18
|
+
constructor(props: CardV2BaseProps);
|
|
19
|
+
private getSSRPreview;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
22
|
+
componentWillUnmount(): void;
|
|
23
|
+
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
24
|
+
private getImageURLParams;
|
|
25
|
+
private getMediaBlobUrlAttrs;
|
|
26
|
+
private getCardPreviewParams;
|
|
27
|
+
private setCacheSSRPreview;
|
|
28
|
+
private refetchSSRPreview;
|
|
29
|
+
private resolveUpfrontPreview;
|
|
30
|
+
private fetchAndCacheRemotePreview;
|
|
31
|
+
private resolvePreview;
|
|
32
|
+
updateFileStateFlag(fileState?: FileState): void;
|
|
33
|
+
private subscribeFileState;
|
|
34
|
+
private get requestedDimensions();
|
|
35
|
+
private get metadata();
|
|
36
|
+
private get fileAttributes();
|
|
37
|
+
private getPerformanceAttributes;
|
|
38
|
+
private logSSRImageError;
|
|
39
|
+
private onImageError;
|
|
40
|
+
private onImageLoad;
|
|
41
|
+
private fireOperationalEvent;
|
|
42
|
+
private fireCommencedEvent;
|
|
43
|
+
private fireCopiedEvent;
|
|
44
|
+
private fireScreenEvent;
|
|
45
|
+
private fireNonCriticalErrorEvent;
|
|
46
|
+
private safeSetState;
|
|
47
|
+
get actions(): CardAction[];
|
|
48
|
+
onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
49
|
+
onInlinePlayerError: () => void;
|
|
50
|
+
setRef: (cardRef: HTMLDivElement | null) => void;
|
|
51
|
+
renderInlinePlayer: () => JSX.Element;
|
|
52
|
+
onMediaViewerClose: () => void;
|
|
53
|
+
private onDisplayImage;
|
|
54
|
+
renderMediaViewer: () => React.ReactPortal | undefined;
|
|
55
|
+
renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
|
|
56
|
+
private storeSSRData;
|
|
57
|
+
render(): JSX.Element;
|
|
58
|
+
private onCardInViewport;
|
|
59
|
+
onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
60
|
+
onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare const CardV2: React.ComponentType<CardV2BaseProps>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
1
2
|
import { CardPreview } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Primary reason is logged through Data Portal.
|
|
@@ -8,6 +9,17 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
|
|
|
8
9
|
export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
|
|
9
10
|
export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
10
11
|
export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
12
|
+
export declare class MediaFileStateError extends Error {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly reason?: string | undefined;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly details?: Record<string, any> | undefined;
|
|
17
|
+
constructor(id: string, reason?: string | undefined, message?: string, details?: Record<string, any> | undefined);
|
|
18
|
+
}
|
|
19
|
+
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
20
|
+
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
21
|
+
export declare function isPollingError(err?: Error): boolean;
|
|
22
|
+
export declare function isRateLimitedError(error?: Error): boolean;
|
|
11
23
|
export declare class MediaCardError extends Error {
|
|
12
24
|
readonly primaryReason: MediaCardErrorPrimaryReason;
|
|
13
25
|
readonly secondaryError?: Error | undefined;
|