@atlaskit/media-card 76.0.1 → 76.0.3
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 +14 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardState.js +1 -1
- package/dist/cjs/card/getCardPreview/filePreviewStatus.js +2 -2
- package/dist/cjs/card/getCardPreview/index.js +20 -38
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardState.js +1 -1
- package/dist/es2019/card/getCardPreview/filePreviewStatus.js +2 -2
- package/dist/es2019/card/getCardPreview/index.js +1 -20
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/cardState.js +1 -1
- package/dist/esm/card/getCardPreview/filePreviewStatus.js +2 -2
- package/dist/esm/card/getCardPreview/index.js +20 -39
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/card/getCardPreview/filePreviewStatus.d.ts +1 -2
- package/dist/types-ts4.5/card/getCardPreview/filePreviewStatus.d.ts +1 -2
- package/example-helpers/developmentUseMessage.tsx +1 -1
- package/package.json +5 -5
- package/tmp/api-report-tmp.d.ts +341 -0
- package/dist/cjs/card/getCardPreview/imageRefetchingAnalytics.js +0 -37
- package/dist/es2019/card/getCardPreview/imageRefetchingAnalytics.js +0 -27
- package/dist/esm/card/getCardPreview/imageRefetchingAnalytics.js +0 -29
- package/dist/types/card/getCardPreview/imageRefetchingAnalytics.d.ts +0 -10
- package/dist/types-ts4.5/card/getCardPreview/imageRefetchingAnalytics.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 76.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5dcaf51b269`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5dcaf51b269) - removed unused memory cache logs
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 76.0.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`bb442ced942`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bb442ced942) - Remove newCardExperience feature flag
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 76.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -48,7 +48,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
48
48
|
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); }; }
|
|
49
49
|
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; } }
|
|
50
50
|
var packageName = "@atlaskit/media-card";
|
|
51
|
-
var packageVersion = "76.0.
|
|
51
|
+
var packageVersion = "76.0.3";
|
|
52
52
|
var CardBase = /*#__PURE__*/function (_Component) {
|
|
53
53
|
(0, _inherits2.default)(CardBase, _Component);
|
|
54
54
|
var _super = _createSuper(CardBase);
|
|
@@ -26,7 +26,7 @@ var createStateUpdater = function createStateUpdater(newState, fireErrorEvent) {
|
|
|
26
26
|
};
|
|
27
27
|
exports.createStateUpdater = createStateUpdater;
|
|
28
28
|
var getCardStateFromFileState = function getCardStateFromFileState(fileState, isBannedLocalPreview, featureFlags) {
|
|
29
|
-
var status = (0, _getCardStatus.getCardStatus)(fileState.status, (0, _getCardPreview.extractFilePreviewStatus)(fileState, isBannedLocalPreview
|
|
29
|
+
var status = (0, _getCardStatus.getCardStatus)(fileState.status, (0, _getCardPreview.extractFilePreviewStatus)(fileState, isBannedLocalPreview));
|
|
30
30
|
var error = status === 'error' && (0, _mediaClient.isErrorFileState)(fileState) ? new _errors.MediaCardError('error-file-state', new Error(fileState.message)) : undefined;
|
|
31
31
|
var progress = status === 'uploading' && fileState.status === 'uploading' ? fileState.progress : 1;
|
|
32
32
|
return {
|
|
@@ -9,13 +9,13 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
9
9
|
var _helpers = require("./helpers");
|
|
10
10
|
// TODO: align these checks with helpers from Media Client
|
|
11
11
|
// https://product-fabric.atlassian.net/browse/BMPT-1300
|
|
12
|
-
var extractFilePreviewStatus = function extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
12
|
+
var extractFilePreviewStatus = function extractFilePreviewStatus(fileState, isBannedLocalPreview) {
|
|
13
13
|
var hasFilesize = 'size' in fileState && !!fileState.size;
|
|
14
14
|
var _ref = 'mediaType' in fileState && fileState || {},
|
|
15
15
|
mediaType = _ref.mediaType;
|
|
16
16
|
var _ref2 = 'mimeType' in fileState && fileState || {},
|
|
17
17
|
mimeType = _ref2.mimeType;
|
|
18
|
-
var isPreviewable = !!mediaType && (0, _mediaClient.isPreviewableType)(mediaType
|
|
18
|
+
var isPreviewable = !!mediaType && (0, _mediaClient.isPreviewableType)(mediaType);
|
|
19
19
|
|
|
20
20
|
// Local preview is available only if it's supported by browser and supported by Media Card (isSupportedLocalPreview)
|
|
21
21
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
@@ -42,7 +42,6 @@ var _helpers = require("./helpers");
|
|
|
42
42
|
var _errors = require("../../errors");
|
|
43
43
|
var _dimensionComparer = require("../../utils/dimensionComparer");
|
|
44
44
|
var _filePreviewStatus = require("./filePreviewStatus");
|
|
45
|
-
var _imageRefetchingAnalytics = require("./imageRefetchingAnalytics");
|
|
46
45
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
46
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
48
47
|
var getCardPreviewFromCache = _cache.default.get;
|
|
@@ -109,37 +108,29 @@ var getCardPreview = /*#__PURE__*/function () {
|
|
|
109
108
|
cachedPreview = _cache.default.get(id, mode);
|
|
110
109
|
dimensionsAreBigger = (0, _dimensionComparer.isBigger)(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions);
|
|
111
110
|
if (!(cachedPreview && !dimensionsAreBigger)) {
|
|
112
|
-
_context.next =
|
|
111
|
+
_context.next = 6;
|
|
113
112
|
break;
|
|
114
113
|
}
|
|
115
|
-
if ((0, _mediaCommon.getMediaFeatureFlag)('memoryCacheLogging', featureFlags)) {
|
|
116
|
-
createAnalyticsEvent && (0, _imageRefetchingAnalytics.fireImageFetchingOperationalEvent)(createAnalyticsEvent, 'cache-hit', {
|
|
117
|
-
fileId: id,
|
|
118
|
-
prevDimensions: cachedPreview.dimensions,
|
|
119
|
-
currentDimensions: dimensions,
|
|
120
|
-
source: cachedPreview.source
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
114
|
return _context.abrupt("return", cachedPreview);
|
|
124
|
-
case
|
|
125
|
-
_context.prev =
|
|
115
|
+
case 6:
|
|
116
|
+
_context.prev = 6;
|
|
126
117
|
if (!filePreview) {
|
|
127
|
-
_context.next =
|
|
118
|
+
_context.next = 12;
|
|
128
119
|
break;
|
|
129
120
|
}
|
|
130
|
-
_context.next =
|
|
121
|
+
_context.next = 10;
|
|
131
122
|
return (0, _helpers.getCardPreviewFromFilePreview)(filePreview);
|
|
132
|
-
case
|
|
123
|
+
case 10:
|
|
133
124
|
localPreview = _context.sent;
|
|
134
125
|
return _context.abrupt("return", extendAndCachePreview(id, mode, _objectSpread(_objectSpread({}, localPreview), {}, {
|
|
135
126
|
dimensions: dimensions
|
|
136
127
|
}), mediaBlobUrlAttrs));
|
|
137
|
-
case
|
|
138
|
-
_context.next =
|
|
128
|
+
case 12:
|
|
129
|
+
_context.next = 19;
|
|
139
130
|
break;
|
|
140
|
-
case
|
|
141
|
-
_context.prev =
|
|
142
|
-
_context.t0 = _context["catch"](
|
|
131
|
+
case 14:
|
|
132
|
+
_context.prev = 14;
|
|
133
|
+
_context.t0 = _context["catch"](6);
|
|
143
134
|
/**
|
|
144
135
|
* We report the error if:
|
|
145
136
|
* - local preview is supported and fails
|
|
@@ -158,36 +149,27 @@ var getCardPreview = /*#__PURE__*/function () {
|
|
|
158
149
|
* if there is no remote preview available
|
|
159
150
|
*/
|
|
160
151
|
if (isRemotePreviewReady) {
|
|
161
|
-
_context.next =
|
|
152
|
+
_context.next = 19;
|
|
162
153
|
break;
|
|
163
154
|
}
|
|
164
155
|
throw _context.t0;
|
|
165
|
-
case
|
|
156
|
+
case 19:
|
|
166
157
|
if (isRemotePreviewReady) {
|
|
167
|
-
_context.next =
|
|
158
|
+
_context.next = 21;
|
|
168
159
|
break;
|
|
169
160
|
}
|
|
170
161
|
throw new _errors.MediaCardError('remote-preview-not-ready');
|
|
171
|
-
case
|
|
172
|
-
_context.next =
|
|
162
|
+
case 21:
|
|
163
|
+
_context.next = 23;
|
|
173
164
|
return fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs, traceContext);
|
|
174
|
-
case
|
|
165
|
+
case 23:
|
|
175
166
|
remotePreview = _context.sent;
|
|
176
|
-
if ((0, _mediaCommon.getMediaFeatureFlag)('memoryCacheLogging', featureFlags)) {
|
|
177
|
-
createAnalyticsEvent && (0, _imageRefetchingAnalytics.fireImageFetchingOperationalEvent)(createAnalyticsEvent, 'remote-success', {
|
|
178
|
-
fileId: id,
|
|
179
|
-
prevDimensions: cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions,
|
|
180
|
-
currentDimensions: dimensions,
|
|
181
|
-
dimensionsPercentageDiff: (0, _imageRefetchingAnalytics.calculatePercentageDifference)(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions),
|
|
182
|
-
source: remotePreview.source
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
167
|
return _context.abrupt("return", remotePreview);
|
|
186
|
-
case
|
|
168
|
+
case 25:
|
|
187
169
|
case "end":
|
|
188
170
|
return _context.stop();
|
|
189
171
|
}
|
|
190
|
-
}, _callee, null, [[
|
|
172
|
+
}, _callee, null, [[6, 14]]);
|
|
191
173
|
}));
|
|
192
174
|
return function getCardPreview(_x) {
|
|
193
175
|
return _ref2.apply(this, arguments);
|
|
@@ -205,7 +187,7 @@ var shouldResolvePreview = function shouldResolvePreview(_ref3) {
|
|
|
205
187
|
isBannedLocalPreview = _ref3.isBannedLocalPreview,
|
|
206
188
|
featureFlags = _ref3.featureFlags,
|
|
207
189
|
wasResolvedUpfrontPreview = _ref3.wasResolvedUpfrontPreview;
|
|
208
|
-
var statusIsPreviewable = (0, _filePreviewStatus.isPreviewableStatus)(status, (0, _filePreviewStatus.extractFilePreviewStatus)(fileState, isBannedLocalPreview
|
|
190
|
+
var statusIsPreviewable = (0, _filePreviewStatus.isPreviewableStatus)(status, (0, _filePreviewStatus.extractFilePreviewStatus)(fileState, isBannedLocalPreview));
|
|
209
191
|
var dimensionsAreBigger = (0, _dimensionComparer.isBigger)(prevDimensions, dimensions);
|
|
210
192
|
// We should not fetch the preview if the upfront one hasn't been resolved yet (it could be resolving now), even if there are new dimensions.
|
|
211
193
|
return wasResolvedUpfrontPreview && statusIsPreviewable && (!hasCardPreview || dimensionsAreBigger);
|
|
@@ -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 = "76.0.
|
|
93
|
+
var packageVersion = "76.0.3";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "76.0.
|
|
122
|
+
packageName: "76.0.3",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
16
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "76.0.
|
|
17
|
+
var packageVersion = "76.0.3";
|
|
18
18
|
var concurrentExperience;
|
|
19
19
|
var getExperience = function getExperience(id) {
|
|
20
20
|
if (!concurrentExperience) {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/card/card.js
CHANGED
|
@@ -27,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
27
27
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
28
28
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
29
29
|
const packageName = "@atlaskit/media-card";
|
|
30
|
-
const packageVersion = "76.0.
|
|
30
|
+
const packageVersion = "76.0.3";
|
|
31
31
|
export class CardBase extends Component {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
@@ -18,7 +18,7 @@ export const createStateUpdater = (newState, fireErrorEvent) => prevState => {
|
|
|
18
18
|
return newState;
|
|
19
19
|
};
|
|
20
20
|
export const getCardStateFromFileState = (fileState, isBannedLocalPreview, featureFlags) => {
|
|
21
|
-
const status = getCardStatus(fileState.status, extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
21
|
+
const status = getCardStatus(fileState.status, extractFilePreviewStatus(fileState, isBannedLocalPreview));
|
|
22
22
|
const error = status === 'error' && isErrorFileState(fileState) ? new MediaCardError('error-file-state', new Error(fileState.message)) : undefined;
|
|
23
23
|
const progress = status === 'uploading' && fileState.status === 'uploading' ? fileState.progress : 1;
|
|
24
24
|
return {
|
|
@@ -4,7 +4,7 @@ import { isSupportedLocalPreview } from './helpers';
|
|
|
4
4
|
|
|
5
5
|
// TODO: align these checks with helpers from Media Client
|
|
6
6
|
// https://product-fabric.atlassian.net/browse/BMPT-1300
|
|
7
|
-
export const extractFilePreviewStatus = (fileState, isBannedLocalPreview
|
|
7
|
+
export const extractFilePreviewStatus = (fileState, isBannedLocalPreview) => {
|
|
8
8
|
const hasFilesize = 'size' in fileState && !!fileState.size;
|
|
9
9
|
const {
|
|
10
10
|
mediaType
|
|
@@ -12,7 +12,7 @@ export const extractFilePreviewStatus = (fileState, isBannedLocalPreview, featur
|
|
|
12
12
|
const {
|
|
13
13
|
mimeType
|
|
14
14
|
} = 'mimeType' in fileState && fileState || {};
|
|
15
|
-
const isPreviewable = !!mediaType && isPreviewableType(mediaType
|
|
15
|
+
const isPreviewable = !!mediaType && isPreviewableType(mediaType);
|
|
16
16
|
|
|
17
17
|
// Local preview is available only if it's supported by browser and supported by Media Card (isSupportedLocalPreview)
|
|
18
18
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
@@ -5,8 +5,6 @@ import { getCardPreviewFromFilePreview, getCardPreviewFromBackend } from './help
|
|
|
5
5
|
import { MediaCardError, SsrPreviewError, isUnsupportedLocalPreviewError } from '../../errors';
|
|
6
6
|
import { isBigger } from '../../utils/dimensionComparer';
|
|
7
7
|
import { extractFilePreviewStatus, isPreviewableStatus } from './filePreviewStatus';
|
|
8
|
-
import { fireImageFetchingOperationalEvent, calculatePercentageDifference } from './imageRefetchingAnalytics';
|
|
9
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
10
8
|
export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview } from './helpers';
|
|
11
9
|
export { extractFilePreviewStatus } from './filePreviewStatus';
|
|
12
10
|
export const getCardPreviewFromCache = cardPreviewCache.get;
|
|
@@ -76,14 +74,6 @@ export const getCardPreview = async ({
|
|
|
76
74
|
const cachedPreview = cardPreviewCache.get(id, mode);
|
|
77
75
|
const dimensionsAreBigger = isBigger(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions);
|
|
78
76
|
if (cachedPreview && !dimensionsAreBigger) {
|
|
79
|
-
if (getMediaFeatureFlag('memoryCacheLogging', featureFlags)) {
|
|
80
|
-
createAnalyticsEvent && fireImageFetchingOperationalEvent(createAnalyticsEvent, 'cache-hit', {
|
|
81
|
-
fileId: id,
|
|
82
|
-
prevDimensions: cachedPreview.dimensions,
|
|
83
|
-
currentDimensions: dimensions,
|
|
84
|
-
source: cachedPreview.source
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
77
|
return cachedPreview;
|
|
88
78
|
}
|
|
89
79
|
try {
|
|
@@ -126,15 +116,6 @@ export const getCardPreview = async ({
|
|
|
126
116
|
throw new MediaCardError('remote-preview-not-ready');
|
|
127
117
|
}
|
|
128
118
|
const remotePreview = await fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs, traceContext);
|
|
129
|
-
if (getMediaFeatureFlag('memoryCacheLogging', featureFlags)) {
|
|
130
|
-
createAnalyticsEvent && fireImageFetchingOperationalEvent(createAnalyticsEvent, 'remote-success', {
|
|
131
|
-
fileId: id,
|
|
132
|
-
prevDimensions: cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions,
|
|
133
|
-
currentDimensions: dimensions,
|
|
134
|
-
dimensionsPercentageDiff: calculatePercentageDifference(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions),
|
|
135
|
-
source: remotePreview.source
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
119
|
return remotePreview;
|
|
139
120
|
};
|
|
140
121
|
export const shouldResolvePreview = ({
|
|
@@ -149,7 +130,7 @@ export const shouldResolvePreview = ({
|
|
|
149
130
|
featureFlags,
|
|
150
131
|
wasResolvedUpfrontPreview
|
|
151
132
|
}) => {
|
|
152
|
-
const statusIsPreviewable = isPreviewableStatus(status, extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
133
|
+
const statusIsPreviewable = isPreviewableStatus(status, extractFilePreviewStatus(fileState, isBannedLocalPreview));
|
|
153
134
|
const dimensionsAreBigger = isBigger(prevDimensions, dimensions);
|
|
154
135
|
// We should not fetch the preview if the upfront one hasn't been resolved yet (it could be resolving now), even if there are new dimensions.
|
|
155
136
|
return wasResolvedUpfrontPreview && statusIsPreviewable && (!hasCardPreview || dimensionsAreBigger);
|
|
@@ -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 = "76.0.
|
|
69
|
+
const packageVersion = "76.0.3";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -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: "76.0.
|
|
40
|
+
packageName: "76.0.3",
|
|
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 = "76.0.
|
|
7
|
+
const packageVersion = "76.0.3";
|
|
8
8
|
let concurrentExperience;
|
|
9
9
|
const getExperience = id => {
|
|
10
10
|
if (!concurrentExperience) {
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/card/card.js
CHANGED
|
@@ -40,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
40
40
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
41
41
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
42
42
|
var packageName = "@atlaskit/media-card";
|
|
43
|
-
var packageVersion = "76.0.
|
|
43
|
+
var packageVersion = "76.0.3";
|
|
44
44
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(CardBase, _Component);
|
|
46
46
|
var _super = _createSuper(CardBase);
|
|
@@ -20,7 +20,7 @@ export var createStateUpdater = function createStateUpdater(newState, fireErrorE
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export var getCardStateFromFileState = function getCardStateFromFileState(fileState, isBannedLocalPreview, featureFlags) {
|
|
23
|
-
var status = getCardStatus(fileState.status, extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
23
|
+
var status = getCardStatus(fileState.status, extractFilePreviewStatus(fileState, isBannedLocalPreview));
|
|
24
24
|
var error = status === 'error' && isErrorFileState(fileState) ? new MediaCardError('error-file-state', new Error(fileState.message)) : undefined;
|
|
25
25
|
var progress = status === 'uploading' && fileState.status === 'uploading' ? fileState.progress : 1;
|
|
26
26
|
return {
|
|
@@ -4,13 +4,13 @@ import { isSupportedLocalPreview } from './helpers';
|
|
|
4
4
|
|
|
5
5
|
// TODO: align these checks with helpers from Media Client
|
|
6
6
|
// https://product-fabric.atlassian.net/browse/BMPT-1300
|
|
7
|
-
export var extractFilePreviewStatus = function extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
7
|
+
export var extractFilePreviewStatus = function extractFilePreviewStatus(fileState, isBannedLocalPreview) {
|
|
8
8
|
var hasFilesize = 'size' in fileState && !!fileState.size;
|
|
9
9
|
var _ref = 'mediaType' in fileState && fileState || {},
|
|
10
10
|
mediaType = _ref.mediaType;
|
|
11
11
|
var _ref2 = 'mimeType' in fileState && fileState || {},
|
|
12
12
|
mimeType = _ref2.mimeType;
|
|
13
|
-
var isPreviewable = !!mediaType && isPreviewableType(mediaType
|
|
13
|
+
var isPreviewable = !!mediaType && isPreviewableType(mediaType);
|
|
14
14
|
|
|
15
15
|
// Local preview is available only if it's supported by browser and supported by Media Card (isSupportedLocalPreview)
|
|
16
16
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
@@ -10,8 +10,6 @@ import { getCardPreviewFromFilePreview, getCardPreviewFromBackend } from './help
|
|
|
10
10
|
import { MediaCardError, SsrPreviewError, isUnsupportedLocalPreviewError } from '../../errors';
|
|
11
11
|
import { isBigger } from '../../utils/dimensionComparer';
|
|
12
12
|
import { extractFilePreviewStatus, isPreviewableStatus } from './filePreviewStatus';
|
|
13
|
-
import { fireImageFetchingOperationalEvent, calculatePercentageDifference } from './imageRefetchingAnalytics';
|
|
14
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
15
13
|
export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview } from './helpers';
|
|
16
14
|
export { extractFilePreviewStatus } from './filePreviewStatus';
|
|
17
15
|
export var getCardPreviewFromCache = cardPreviewCache.get;
|
|
@@ -75,37 +73,29 @@ export var getCardPreview = /*#__PURE__*/function () {
|
|
|
75
73
|
cachedPreview = cardPreviewCache.get(id, mode);
|
|
76
74
|
dimensionsAreBigger = isBigger(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions);
|
|
77
75
|
if (!(cachedPreview && !dimensionsAreBigger)) {
|
|
78
|
-
_context.next =
|
|
76
|
+
_context.next = 6;
|
|
79
77
|
break;
|
|
80
78
|
}
|
|
81
|
-
if (getMediaFeatureFlag('memoryCacheLogging', featureFlags)) {
|
|
82
|
-
createAnalyticsEvent && fireImageFetchingOperationalEvent(createAnalyticsEvent, 'cache-hit', {
|
|
83
|
-
fileId: id,
|
|
84
|
-
prevDimensions: cachedPreview.dimensions,
|
|
85
|
-
currentDimensions: dimensions,
|
|
86
|
-
source: cachedPreview.source
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
79
|
return _context.abrupt("return", cachedPreview);
|
|
90
|
-
case
|
|
91
|
-
_context.prev =
|
|
80
|
+
case 6:
|
|
81
|
+
_context.prev = 6;
|
|
92
82
|
if (!filePreview) {
|
|
93
|
-
_context.next =
|
|
83
|
+
_context.next = 12;
|
|
94
84
|
break;
|
|
95
85
|
}
|
|
96
|
-
_context.next =
|
|
86
|
+
_context.next = 10;
|
|
97
87
|
return getCardPreviewFromFilePreview(filePreview);
|
|
98
|
-
case
|
|
88
|
+
case 10:
|
|
99
89
|
localPreview = _context.sent;
|
|
100
90
|
return _context.abrupt("return", extendAndCachePreview(id, mode, _objectSpread(_objectSpread({}, localPreview), {}, {
|
|
101
91
|
dimensions: dimensions
|
|
102
92
|
}), mediaBlobUrlAttrs));
|
|
103
|
-
case
|
|
104
|
-
_context.next =
|
|
93
|
+
case 12:
|
|
94
|
+
_context.next = 19;
|
|
105
95
|
break;
|
|
106
|
-
case
|
|
107
|
-
_context.prev =
|
|
108
|
-
_context.t0 = _context["catch"](
|
|
96
|
+
case 14:
|
|
97
|
+
_context.prev = 14;
|
|
98
|
+
_context.t0 = _context["catch"](6);
|
|
109
99
|
/**
|
|
110
100
|
* We report the error if:
|
|
111
101
|
* - local preview is supported and fails
|
|
@@ -124,36 +114,27 @@ export var getCardPreview = /*#__PURE__*/function () {
|
|
|
124
114
|
* if there is no remote preview available
|
|
125
115
|
*/
|
|
126
116
|
if (isRemotePreviewReady) {
|
|
127
|
-
_context.next =
|
|
117
|
+
_context.next = 19;
|
|
128
118
|
break;
|
|
129
119
|
}
|
|
130
120
|
throw _context.t0;
|
|
131
|
-
case
|
|
121
|
+
case 19:
|
|
132
122
|
if (isRemotePreviewReady) {
|
|
133
|
-
_context.next =
|
|
123
|
+
_context.next = 21;
|
|
134
124
|
break;
|
|
135
125
|
}
|
|
136
126
|
throw new MediaCardError('remote-preview-not-ready');
|
|
137
|
-
case
|
|
138
|
-
_context.next =
|
|
127
|
+
case 21:
|
|
128
|
+
_context.next = 23;
|
|
139
129
|
return fetchAndCacheRemotePreview(mediaClient, id, dimensions, imageUrlParams, mediaBlobUrlAttrs, traceContext);
|
|
140
|
-
case
|
|
130
|
+
case 23:
|
|
141
131
|
remotePreview = _context.sent;
|
|
142
|
-
if (getMediaFeatureFlag('memoryCacheLogging', featureFlags)) {
|
|
143
|
-
createAnalyticsEvent && fireImageFetchingOperationalEvent(createAnalyticsEvent, 'remote-success', {
|
|
144
|
-
fileId: id,
|
|
145
|
-
prevDimensions: cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions,
|
|
146
|
-
currentDimensions: dimensions,
|
|
147
|
-
dimensionsPercentageDiff: calculatePercentageDifference(cachedPreview === null || cachedPreview === void 0 ? void 0 : cachedPreview.dimensions, dimensions),
|
|
148
|
-
source: remotePreview.source
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
132
|
return _context.abrupt("return", remotePreview);
|
|
152
|
-
case
|
|
133
|
+
case 25:
|
|
153
134
|
case "end":
|
|
154
135
|
return _context.stop();
|
|
155
136
|
}
|
|
156
|
-
}, _callee, null, [[
|
|
137
|
+
}, _callee, null, [[6, 14]]);
|
|
157
138
|
}));
|
|
158
139
|
return function getCardPreview(_x) {
|
|
159
140
|
return _ref2.apply(this, arguments);
|
|
@@ -170,7 +151,7 @@ export var shouldResolvePreview = function shouldResolvePreview(_ref3) {
|
|
|
170
151
|
isBannedLocalPreview = _ref3.isBannedLocalPreview,
|
|
171
152
|
featureFlags = _ref3.featureFlags,
|
|
172
153
|
wasResolvedUpfrontPreview = _ref3.wasResolvedUpfrontPreview;
|
|
173
|
-
var statusIsPreviewable = isPreviewableStatus(status, extractFilePreviewStatus(fileState, isBannedLocalPreview
|
|
154
|
+
var statusIsPreviewable = isPreviewableStatus(status, extractFilePreviewStatus(fileState, isBannedLocalPreview));
|
|
174
155
|
var dimensionsAreBigger = isBigger(prevDimensions, dimensions);
|
|
175
156
|
// We should not fetch the preview if the upfront one hasn't been resolved yet (it could be resolving now), even if there are new dimensions.
|
|
176
157
|
return wasResolvedUpfrontPreview && statusIsPreviewable && (!hasCardPreview || dimensionsAreBigger);
|
|
@@ -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 = "76.0.
|
|
86
|
+
var packageVersion = "76.0.3";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -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.0.
|
|
106
|
+
packageName: "76.0.3",
|
|
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 = "76.0.
|
|
10
|
+
var packageVersion = "76.0.3";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
2
1
|
import { CardStatus, FilePreviewStatus } from '../../types';
|
|
3
2
|
import { FileState } from '@atlaskit/media-client';
|
|
4
|
-
export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean
|
|
3
|
+
export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean) => FilePreviewStatus;
|
|
5
4
|
export declare const isPreviewableStatus: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
2
1
|
import { CardStatus, FilePreviewStatus } from '../../types';
|
|
3
2
|
import { FileState } from '@atlaskit/media-client';
|
|
4
|
-
export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean
|
|
3
|
+
export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean) => FilePreviewStatus;
|
|
5
4
|
export declare const isPreviewableStatus: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
|
|
@@ -3,7 +3,7 @@ import InlineMessage from '@atlaskit/inline-message';
|
|
|
3
3
|
|
|
4
4
|
const DevelopmentUseMessage: React.FC = () => (
|
|
5
5
|
<div style={{ textAlign: 'center' }}>
|
|
6
|
-
<InlineMessage
|
|
6
|
+
<InlineMessage appearance="warning" title="Development use only">
|
|
7
7
|
The purpose of this example is to explore on edge cases for this
|
|
8
8
|
component's feature. Some ways of using the component in here might not be
|
|
9
9
|
the standard way. It is discouraged to use this code as a base for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "76.0.
|
|
3
|
+
"version": "76.0.3",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"atlassian": {
|
|
31
31
|
"team": "Media Experience",
|
|
32
32
|
"inPublicMirror": true,
|
|
33
|
-
"releaseModel": "
|
|
33
|
+
"releaseModel": "continuous",
|
|
34
34
|
"website": {
|
|
35
35
|
"name": "Media Card"
|
|
36
36
|
}
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@atlaskit/dropdown-menu": "^11.9.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.4.0",
|
|
42
42
|
"@atlaskit/icon": "^21.12.0",
|
|
43
|
-
"@atlaskit/media-client": "^
|
|
44
|
-
"@atlaskit/media-common": "^
|
|
43
|
+
"@atlaskit/media-client": "^23.0.0",
|
|
44
|
+
"@atlaskit/media-common": "^7.0.0",
|
|
45
45
|
"@atlaskit/media-ui": "^23.0.0",
|
|
46
46
|
"@atlaskit/media-viewer": "^48.0.0",
|
|
47
47
|
"@atlaskit/spinner": "^15.5.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/docs": "*",
|
|
70
70
|
"@atlaskit/inline-message": "^11.5.0",
|
|
71
71
|
"@atlaskit/media-core": "^34.1.0",
|
|
72
|
-
"@atlaskit/media-picker": "^
|
|
72
|
+
"@atlaskit/media-picker": "^66.0.0",
|
|
73
73
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
74
74
|
"@atlaskit/radio": "^5.6.0",
|
|
75
75
|
"@atlaskit/range": "^7.1.0",
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/media-card"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
|
|
9
|
+
import { Component } from 'react';
|
|
10
|
+
import { FileDetails } from '@atlaskit/media-client';
|
|
11
|
+
import { FileIdentifier } from '@atlaskit/media-client';
|
|
12
|
+
import { FileItem } from '@atlaskit/media-client';
|
|
13
|
+
import { FileState } from '@atlaskit/media-client';
|
|
14
|
+
import { Identifier } from '@atlaskit/media-client';
|
|
15
|
+
import { ImageResizeMode } from '@atlaskit/media-client';
|
|
16
|
+
import { MediaClient } from '@atlaskit/media-client';
|
|
17
|
+
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
18
|
+
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
19
|
+
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
20
|
+
import { default as React_2 } from 'react';
|
|
21
|
+
import { ReactNode } from 'react';
|
|
22
|
+
import { SSR } from '@atlaskit/media-common';
|
|
23
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
24
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
25
|
+
import { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
26
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
27
|
+
|
|
28
|
+
// @public (undocumented)
|
|
29
|
+
export const Card: React_2.FC<CardWithMediaClientConfigProps>;
|
|
30
|
+
|
|
31
|
+
// @public (undocumented)
|
|
32
|
+
export interface CardAction {
|
|
33
|
+
// (undocumented)
|
|
34
|
+
handler: CardEventHandler;
|
|
35
|
+
// (undocumented)
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
// (undocumented)
|
|
38
|
+
label?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// @public (undocumented)
|
|
42
|
+
export type CardAppearance = 'auto' | 'horizontal' | 'image' | 'square';
|
|
43
|
+
|
|
44
|
+
// @public (undocumented)
|
|
45
|
+
type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
46
|
+
|
|
47
|
+
// @public (undocumented)
|
|
48
|
+
export interface CardDimensions {
|
|
49
|
+
// (undocumented)
|
|
50
|
+
height?: CardDimensionValue;
|
|
51
|
+
// (undocumented)
|
|
52
|
+
width?: CardDimensionValue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// @public (undocumented)
|
|
56
|
+
export type CardDimensionValue = number | string;
|
|
57
|
+
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
export class CardError extends Component<ErrorCardProps, {}> {
|
|
60
|
+
// (undocumented)
|
|
61
|
+
static defaultProps: {
|
|
62
|
+
size: string;
|
|
63
|
+
};
|
|
64
|
+
// (undocumented)
|
|
65
|
+
get icon(): JSX.Element;
|
|
66
|
+
// (undocumented)
|
|
67
|
+
render(): JSX.Element;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// @public (undocumented)
|
|
71
|
+
export interface CardEvent {
|
|
72
|
+
// (undocumented)
|
|
73
|
+
event: MouseEvent_2<HTMLElement>;
|
|
74
|
+
// (undocumented)
|
|
75
|
+
mediaItemDetails?: FileDetails;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// @public (undocumented)
|
|
79
|
+
export type CardEventHandler = (item?: FileItem, event?: Event) => void;
|
|
80
|
+
|
|
81
|
+
// @public (undocumented)
|
|
82
|
+
interface CardEventProps {
|
|
83
|
+
// (undocumented)
|
|
84
|
+
readonly onClick?: CardOnClickCallback;
|
|
85
|
+
readonly onFullscreenChange?: (fullscreen: boolean) => void;
|
|
86
|
+
// (undocumented)
|
|
87
|
+
readonly onMouseEnter?: (result: CardEvent) => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// @public (undocumented)
|
|
91
|
+
export class CardLoading extends Component<StaticCardProps, {}> {
|
|
92
|
+
// (undocumented)
|
|
93
|
+
render(): JSX.Element;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// @public (undocumented)
|
|
97
|
+
export interface CardOnClickCallback {
|
|
98
|
+
// (undocumented)
|
|
99
|
+
(result: CardEvent, analyticsEvent?: UIAnalyticsEvent): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// @public (undocumented)
|
|
103
|
+
export interface CardPreview {
|
|
104
|
+
// (undocumented)
|
|
105
|
+
dataURI: string;
|
|
106
|
+
// (undocumented)
|
|
107
|
+
dimensions?: CardDimensions;
|
|
108
|
+
// (undocumented)
|
|
109
|
+
orientation?: number;
|
|
110
|
+
// (undocumented)
|
|
111
|
+
source: CardPreviewSource;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// @public (undocumented)
|
|
115
|
+
type CardPreviewSource = 'cache-local' | 'cache-remote' | 'cache-ssr-client' | 'cache-ssr-server' | 'external' | 'local' | 'remote' | 'ssr-client' | 'ssr-data' | 'ssr-server';
|
|
116
|
+
|
|
117
|
+
// @public (undocumented)
|
|
118
|
+
export interface CardProps extends SharedCardProps, CardEventProps {
|
|
119
|
+
// (undocumented)
|
|
120
|
+
readonly contextId?: string;
|
|
121
|
+
// (undocumented)
|
|
122
|
+
readonly identifier: Identifier;
|
|
123
|
+
// (undocumented)
|
|
124
|
+
readonly isLazy?: boolean;
|
|
125
|
+
// (undocumented)
|
|
126
|
+
readonly mediaClient: MediaClient;
|
|
127
|
+
// (undocumented)
|
|
128
|
+
readonly mediaViewerItems?: Identifier[];
|
|
129
|
+
// (undocumented)
|
|
130
|
+
readonly shouldEnableDownloadButton?: boolean;
|
|
131
|
+
// (undocumented)
|
|
132
|
+
readonly shouldOpenMediaViewer?: boolean;
|
|
133
|
+
// (undocumented)
|
|
134
|
+
readonly ssr?: SSR;
|
|
135
|
+
// (undocumented)
|
|
136
|
+
readonly useInlinePlayer?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// @public (undocumented)
|
|
140
|
+
export interface CardState {
|
|
141
|
+
// (undocumented)
|
|
142
|
+
cardPreview?: CardPreview;
|
|
143
|
+
// (undocumented)
|
|
144
|
+
cardRef: HTMLDivElement | null;
|
|
145
|
+
// (undocumented)
|
|
146
|
+
error?: MediaCardError;
|
|
147
|
+
// (undocumented)
|
|
148
|
+
fileState?: FileState;
|
|
149
|
+
// (undocumented)
|
|
150
|
+
isBannedLocalPreview: boolean;
|
|
151
|
+
// (undocumented)
|
|
152
|
+
isCardVisible: boolean;
|
|
153
|
+
// (undocumented)
|
|
154
|
+
isPlayingFile: boolean;
|
|
155
|
+
// (undocumented)
|
|
156
|
+
mediaViewerSelectedItem?: Identifier;
|
|
157
|
+
// (undocumented)
|
|
158
|
+
previewDidRender: boolean;
|
|
159
|
+
// (undocumented)
|
|
160
|
+
progress?: number;
|
|
161
|
+
// (undocumented)
|
|
162
|
+
shouldAutoplay?: boolean;
|
|
163
|
+
// (undocumented)
|
|
164
|
+
status: CardStatus;
|
|
165
|
+
// (undocumented)
|
|
166
|
+
wasResolvedUpfrontPreview: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// @public (undocumented)
|
|
170
|
+
export type CardStatus = 'complete' | 'error' | 'failed-processing' | 'loading' | 'loading-preview' | 'processing' | 'uploading';
|
|
171
|
+
|
|
172
|
+
// @public (undocumented)
|
|
173
|
+
type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardBaseProps>;
|
|
174
|
+
|
|
175
|
+
// @public (undocumented)
|
|
176
|
+
export const defaultImageCardDimensions: {
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// @public (undocumented)
|
|
182
|
+
type ErrorBoundaryComponent = React_2.ComponentType<{
|
|
183
|
+
data?: {
|
|
184
|
+
[k: string]: any;
|
|
185
|
+
};
|
|
186
|
+
isSelected?: boolean;
|
|
187
|
+
}>;
|
|
188
|
+
|
|
189
|
+
// @public (undocumented)
|
|
190
|
+
interface ErrorCardProps extends StaticCardProps {
|
|
191
|
+
// (undocumented)
|
|
192
|
+
readonly size: 'large' | 'medium' | 'small' | 'xlarge';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// @public (undocumented)
|
|
196
|
+
export const fileCardImageViewSelector = "media-file-card-view";
|
|
197
|
+
|
|
198
|
+
// @public (undocumented)
|
|
199
|
+
type ImageLoadPrimaryReason = 'cache-local-uri' | 'cache-remote-uri' | 'external-uri' | 'local-uri' | 'remote-uri' | 'unknown-uri';
|
|
200
|
+
|
|
201
|
+
// @public (undocumented)
|
|
202
|
+
export interface InlineCardEvent {
|
|
203
|
+
// (undocumented)
|
|
204
|
+
event: MouseEvent_2<HTMLElement> | React.KeyboardEvent;
|
|
205
|
+
// (undocumented)
|
|
206
|
+
mediaItemDetails?: FileDetails;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// @public (undocumented)
|
|
210
|
+
export interface InlineCardOnClickCallback {
|
|
211
|
+
// (undocumented)
|
|
212
|
+
(result: InlineCardEvent, analyticsEvent?: UIAnalyticsEvent): void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// @public (undocumented)
|
|
216
|
+
export const inlinePlayerClassName = "media-card-inline-player";
|
|
217
|
+
|
|
218
|
+
// @public (undocumented)
|
|
219
|
+
type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-image' | 'local-preview-rejected' | 'local-preview-unsupported' | 'local-preview-video';
|
|
220
|
+
|
|
221
|
+
// @public (undocumented)
|
|
222
|
+
class MediaCardError extends Error {
|
|
223
|
+
constructor(primaryReason: MediaCardErrorPrimaryReason, secondaryError?: Error | undefined);
|
|
224
|
+
// (undocumented)
|
|
225
|
+
readonly primaryReason: MediaCardErrorPrimaryReason;
|
|
226
|
+
// (undocumented)
|
|
227
|
+
readonly secondaryError?: Error | undefined;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// @public
|
|
231
|
+
type MediaCardErrorPrimaryReason = 'error-file-state' | 'metadata-fetch' | 'missing-error-data' | 'preview-fetch' | 'upload' | ImageLoadPrimaryReason | LocalPreviewPrimaryReason | RemotePreviewPrimaryReason | SsrPreviewPrimaryReason;
|
|
232
|
+
|
|
233
|
+
// @public (undocumented)
|
|
234
|
+
export class MediaInlineCard extends React_2.PureComponent<MediaInlineCardWithMediaClientConfigProps & MediaInlineCardLoaderState, MediaInlineCardLoaderState> {
|
|
235
|
+
// (undocumented)
|
|
236
|
+
componentDidMount(): Promise<void>;
|
|
237
|
+
// (undocumented)
|
|
238
|
+
componentWillUnmount(): Promise<void>;
|
|
239
|
+
// (undocumented)
|
|
240
|
+
static displayName: string;
|
|
241
|
+
// (undocumented)
|
|
242
|
+
static ErrorBoundary?: ErrorBoundaryComponent;
|
|
243
|
+
// (undocumented)
|
|
244
|
+
static MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
|
|
245
|
+
// (undocumented)
|
|
246
|
+
mounted: boolean;
|
|
247
|
+
// (undocumented)
|
|
248
|
+
render(): JSX.Element;
|
|
249
|
+
// (undocumented)
|
|
250
|
+
state: MediaInlineCardLoaderState;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// @public (undocumented)
|
|
254
|
+
interface MediaInlineCardLoaderState {
|
|
255
|
+
// (undocumented)
|
|
256
|
+
ErrorBoundary?: ErrorBoundaryComponent;
|
|
257
|
+
// (undocumented)
|
|
258
|
+
MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// @public (undocumented)
|
|
262
|
+
interface MediaInlineCardProps {
|
|
263
|
+
// (undocumented)
|
|
264
|
+
identifier: FileIdentifier;
|
|
265
|
+
// (undocumented)
|
|
266
|
+
isSelected?: boolean;
|
|
267
|
+
// (undocumented)
|
|
268
|
+
mediaClient: MediaClient;
|
|
269
|
+
// (undocumented)
|
|
270
|
+
mediaViewerItems?: Identifier[];
|
|
271
|
+
// (undocumented)
|
|
272
|
+
onClick?: InlineCardOnClickCallback;
|
|
273
|
+
// (undocumented)
|
|
274
|
+
shouldDisplayToolTip?: boolean;
|
|
275
|
+
// (undocumented)
|
|
276
|
+
shouldOpenMediaViewer?: boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// @public (undocumented)
|
|
280
|
+
type MediaInlineCardWithMediaClientConfigComponent = React_2.ComponentType<MediaInlineCardWithMediaClientConfigProps>;
|
|
281
|
+
|
|
282
|
+
// @public (undocumented)
|
|
283
|
+
type MediaInlineCardWithMediaClientConfigProps = WithMediaClientConfigProps<MediaInlineCardProps>;
|
|
284
|
+
|
|
285
|
+
// @public (undocumented)
|
|
286
|
+
export const newFileExperienceClassName = "new-file-experience-wrapper";
|
|
287
|
+
|
|
288
|
+
export { NumericalCardDimensions }
|
|
289
|
+
|
|
290
|
+
// @public (undocumented)
|
|
291
|
+
type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-fetch-ssr' | 'remote-preview-not-ready';
|
|
292
|
+
|
|
293
|
+
// @public (undocumented)
|
|
294
|
+
export interface SharedCardProps {
|
|
295
|
+
// (undocumented)
|
|
296
|
+
readonly actions?: Array<CardAction>;
|
|
297
|
+
// (undocumented)
|
|
298
|
+
readonly alt?: string;
|
|
299
|
+
// (undocumented)
|
|
300
|
+
readonly appearance?: CardAppearance;
|
|
301
|
+
// (undocumented)
|
|
302
|
+
readonly dimensions?: CardDimensions;
|
|
303
|
+
// (undocumented)
|
|
304
|
+
readonly disableOverlay?: boolean;
|
|
305
|
+
// (undocumented)
|
|
306
|
+
readonly featureFlags?: MediaFeatureFlags;
|
|
307
|
+
// (undocumented)
|
|
308
|
+
readonly originalDimensions?: NumericalCardDimensions;
|
|
309
|
+
// (undocumented)
|
|
310
|
+
readonly resizeMode?: ImageResizeMode;
|
|
311
|
+
// (undocumented)
|
|
312
|
+
readonly selectable?: boolean;
|
|
313
|
+
// (undocumented)
|
|
314
|
+
readonly selected?: boolean;
|
|
315
|
+
// (undocumented)
|
|
316
|
+
readonly testId?: string;
|
|
317
|
+
// (undocumented)
|
|
318
|
+
readonly titleBoxBgColor?: string;
|
|
319
|
+
// (undocumented)
|
|
320
|
+
readonly titleBoxIcon?: TitleBoxIcon;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// @public (undocumented)
|
|
324
|
+
type SsrPreviewPrimaryReason = 'ssr-client-load' | 'ssr-client-uri' | 'ssr-server-load' | 'ssr-server-uri';
|
|
325
|
+
|
|
326
|
+
// @public (undocumented)
|
|
327
|
+
interface StaticCardProps {
|
|
328
|
+
// (undocumented)
|
|
329
|
+
dimensions?: CardDimensions;
|
|
330
|
+
// (undocumented)
|
|
331
|
+
featureFlags?: MediaFeatureFlags;
|
|
332
|
+
// (undocumented)
|
|
333
|
+
testId?: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// @public (undocumented)
|
|
337
|
+
export type TitleBoxIcon = 'LockFilledIcon';
|
|
338
|
+
|
|
339
|
+
// (No @packageDocumentation comment for this package)
|
|
340
|
+
|
|
341
|
+
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fireImageFetchingOperationalEvent = exports.calculatePercentageDifference = void 0;
|
|
7
|
-
var _analytics = require("../../utils/analytics");
|
|
8
|
-
var fireImageFetchingOperationalEvent = function fireImageFetchingOperationalEvent(createAnalyticsEvent, action, cardPreviewAttributes) {
|
|
9
|
-
var fireEvent = function fireEvent(payload) {
|
|
10
|
-
return (0, _analytics.fireMediaCardEvent)(payload, createAnalyticsEvent);
|
|
11
|
-
};
|
|
12
|
-
switch (action) {
|
|
13
|
-
case 'cache-hit':
|
|
14
|
-
fireEvent((0, _analytics.getCacheHitEventPayload)(cardPreviewAttributes));
|
|
15
|
-
break;
|
|
16
|
-
case 'remote-success':
|
|
17
|
-
fireEvent((0, _analytics.getRemoteSuccessEventPayload)(cardPreviewAttributes));
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.fireImageFetchingOperationalEvent = fireImageFetchingOperationalEvent;
|
|
22
|
-
var calculatePercentageDifference = function calculatePercentageDifference(prevDimensions, currentDimensions) {
|
|
23
|
-
if (!prevDimensions) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
var prevWidth = parseInt("".concat(prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.width), 10);
|
|
27
|
-
var currWidth = parseInt("".concat(currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.width), 10);
|
|
28
|
-
var prevHeight = parseInt("".concat(prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.height), 10);
|
|
29
|
-
var currHeight = parseInt("".concat(currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.height), 10);
|
|
30
|
-
var percentageDiffInWidth = ((currWidth - prevWidth) / prevWidth * 100).toFixed(2);
|
|
31
|
-
var percentageDiffInHeight = ((currHeight - prevHeight) / prevHeight * 100).toFixed(2);
|
|
32
|
-
return {
|
|
33
|
-
width: percentageDiffInWidth,
|
|
34
|
-
height: percentageDiffInHeight
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
exports.calculatePercentageDifference = calculatePercentageDifference;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { fireMediaCardEvent, getCacheHitEventPayload, getRemoteSuccessEventPayload } from '../../utils/analytics';
|
|
2
|
-
export const fireImageFetchingOperationalEvent = (createAnalyticsEvent, action, cardPreviewAttributes) => {
|
|
3
|
-
const fireEvent = payload => fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
4
|
-
switch (action) {
|
|
5
|
-
case 'cache-hit':
|
|
6
|
-
fireEvent(getCacheHitEventPayload(cardPreviewAttributes));
|
|
7
|
-
break;
|
|
8
|
-
case 'remote-success':
|
|
9
|
-
fireEvent(getRemoteSuccessEventPayload(cardPreviewAttributes));
|
|
10
|
-
break;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
export const calculatePercentageDifference = (prevDimensions, currentDimensions) => {
|
|
14
|
-
if (!prevDimensions) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const prevWidth = parseInt(`${prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.width}`, 10);
|
|
18
|
-
const currWidth = parseInt(`${currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.width}`, 10);
|
|
19
|
-
const prevHeight = parseInt(`${prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.height}`, 10);
|
|
20
|
-
const currHeight = parseInt(`${currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.height}`, 10);
|
|
21
|
-
const percentageDiffInWidth = ((currWidth - prevWidth) / prevWidth * 100).toFixed(2);
|
|
22
|
-
const percentageDiffInHeight = ((currHeight - prevHeight) / prevHeight * 100).toFixed(2);
|
|
23
|
-
return {
|
|
24
|
-
width: percentageDiffInWidth,
|
|
25
|
-
height: percentageDiffInHeight
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { fireMediaCardEvent, getCacheHitEventPayload, getRemoteSuccessEventPayload } from '../../utils/analytics';
|
|
2
|
-
export var fireImageFetchingOperationalEvent = function fireImageFetchingOperationalEvent(createAnalyticsEvent, action, cardPreviewAttributes) {
|
|
3
|
-
var fireEvent = function fireEvent(payload) {
|
|
4
|
-
return fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
5
|
-
};
|
|
6
|
-
switch (action) {
|
|
7
|
-
case 'cache-hit':
|
|
8
|
-
fireEvent(getCacheHitEventPayload(cardPreviewAttributes));
|
|
9
|
-
break;
|
|
10
|
-
case 'remote-success':
|
|
11
|
-
fireEvent(getRemoteSuccessEventPayload(cardPreviewAttributes));
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export var calculatePercentageDifference = function calculatePercentageDifference(prevDimensions, currentDimensions) {
|
|
16
|
-
if (!prevDimensions) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
var prevWidth = parseInt("".concat(prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.width), 10);
|
|
20
|
-
var currWidth = parseInt("".concat(currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.width), 10);
|
|
21
|
-
var prevHeight = parseInt("".concat(prevDimensions === null || prevDimensions === void 0 ? void 0 : prevDimensions.height), 10);
|
|
22
|
-
var currHeight = parseInt("".concat(currentDimensions === null || currentDimensions === void 0 ? void 0 : currentDimensions.height), 10);
|
|
23
|
-
var percentageDiffInWidth = ((currWidth - prevWidth) / prevWidth * 100).toFixed(2);
|
|
24
|
-
var percentageDiffInHeight = ((currHeight - prevHeight) / prevHeight * 100).toFixed(2);
|
|
25
|
-
return {
|
|
26
|
-
width: percentageDiffInWidth,
|
|
27
|
-
height: percentageDiffInHeight
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { CardDimensions } from '../../types';
|
|
3
|
-
import { CardPreviewAttributes } from '../../utils/analytics';
|
|
4
|
-
type cardAction = 'cache-hit' | 'remote-success';
|
|
5
|
-
export declare const fireImageFetchingOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, action: cardAction, cardPreviewAttributes: CardPreviewAttributes) => void;
|
|
6
|
-
export declare const calculatePercentageDifference: (prevDimensions: CardDimensions | undefined, currentDimensions: CardDimensions | undefined) => {
|
|
7
|
-
width: string;
|
|
8
|
-
height: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { CardDimensions } from '../../types';
|
|
3
|
-
import { CardPreviewAttributes } from '../../utils/analytics';
|
|
4
|
-
type cardAction = 'cache-hit' | 'remote-success';
|
|
5
|
-
export declare const fireImageFetchingOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, action: cardAction, cardPreviewAttributes: CardPreviewAttributes) => void;
|
|
6
|
-
export declare const calculatePercentageDifference: (prevDimensions: CardDimensions | undefined, currentDimensions: CardDimensions | undefined) => {
|
|
7
|
-
width: string;
|
|
8
|
-
height: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
export {};
|